- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在这个项目中使用 WYMeditor。但是,我有服务器端验证,可以在保存数据之前检查文本区域框是否为空。但是当使用 WYMeditor 时,它会插入 <br />
标签,尽管我什至没有在编辑器中单击。
我搜索了一下这个问题,发现它被标记为一个错误,here 。但据说已经修好了。然而,即使我已经下载并正在使用最新的稳定版本,它肯定仍然影响着我。
这是我插入文本区域的代码(我使用的是 CakePHP):
echo $this->Form->create('News', array('type' => 'file'));
echo $this->Form->input('News.title', array('label' => '*Title:'));
echo $this->Form->input('News.body', array('label' => '*Body:', 'class' => 'wymeditor'));
echo $this->Form->input('News.picture', array('label' => 'Picture:', 'type' => 'file'));
echo $this->Form->end(array('label' => 'Save News', 'class' => 'wymupdate'));
还有我的文本区域 JavaScript:
jQuery('.wymeditor').wymeditor({
skin: 'silver',
toolsItems: [
{'name': 'Bold', 'title': 'Strong', 'css': 'wym_tools_strong'},
{'name': 'Italic', 'title': 'Emphasis', 'css': 'wym_tools_emphasis'},
{'name': 'CreateLink', 'title': 'Link', 'css': 'wym_tools_link'},
{'name': 'Unlink', 'title': 'Unlink', 'css': 'wym_tools_unlink'},
{'name': 'InsertOrderedList', 'title': 'Ordered_List', 'css': 'wym_tools_ordered_list'},
{'name': 'InsertUnorderedList', 'title': 'Unordered_List', 'css': 'wym_tools_unordered_list'},
{'name': 'InsertTable', 'title': 'Table', 'css': 'wym_tools_table'},
{'name': 'Undo', 'title': 'Undo', 'css': 'wym_tools_undo'},
{'name': 'Redo', 'title': 'Redo', 'css': 'wym_tools_redo'}
]
});
我没有使用 wymeditor javascript,而是使用所有其他 javascript 对此进行了测试,并且它按预期运行,因此我怀疑 wymeditor javascript 出了问题,但我不确定是什么。
最佳答案
我可以想到导致这些症状的几个可能原因:
您可能使用的是存在此错误的旧版本 WYMeditor。您使用哪个版本?截至撰写本文时,当前版本为 1.0.0b3 。可以对照WYMeditor大师测试here .
如果您在不使用表单的提交处理程序的情况下提交表单,则 wymupdate
类将无法工作,并且您将无法获得隐式 wym.xhtml()
调用,这意味着可能不会发生一些必要的 HTML 清理。您可以尝试调用xhtml()
在您的 WYMeditor 实例上(如果您只有一个 wymeditor,则可以使用 jQuery.wymeditors(0)
检索它)。
如果您可以提供示例页面或更多信息,我将相应地更新此答案。
关于jquery - WYMeditor 在空时插入 <br/>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12254808/
我们的 CMS 将换行符输出为 (愚蠢,我知道,但在语法上是正确的(?)) 这转换为 在 chrome 和 IE10 中到 在火狐中。 所有浏览器都将其显示为两个换行符。 为什么不是翻译成或者只是
我正在尝试将一堆 HTML 文档转换为 XML 合规性(通过 java 方法),并且有很多 (1) 未封闭或 (2) 包含属性的标签。由于某种原因,我使用的正则表达式无法处理包含属性的标签。这是代码
如何转换字符串 "" to "" using java's String.replaceAll(String, String) method? 我都试过了: str.replaceAll("+
这个问题的答案是 community effort 。编辑现有答案以改进这篇文章。它目前不接受新的答案或交互。 我试过检查 other answers ,但我仍然感到困惑——尤其是在看到 W3scho
问题是我无法通过生产者脚本将消息发送到集群内的任何代理。 该设置是一个单一的 Zookeeper 服务器,使用默认设置在 IP (192.168.10.2:2181) 上运行。 此外,还有 3 个代理
我正在尝试使用 python 和 Beautiful Soup 4 用新行替换某些 html 中的每个中断标记。 该文档有 , 和标签,但由于 Beautiful Soup 处理标签的方式,每当它找到
我正在使用带有模板工具包的 perl 生成网页,我在 HTML 文件上更改了一些 JS 代码,编辑后有 显示在 UI 上,我不知道如何,奇怪的是没有 源码中,只有在Inspect element On
这是 HTML 页面的完整源代码: one two three four 谁能解释一下为什么我在IE8或chrome浏览页面时,“三”和“四”之间多了一个空行? 我认为标准应该让所有
我正在使用 并且它按预期在 chrome 和 IE 中正常工作,但在 firefox 中结果很奇怪。当我在 firefox 中看到代码时,它替换了 与 . 我还在某处读到替代语法 XML 允许在许
我有将 BBCode 替换为 html 的代码,当我想替换标签时出现问题 或 [br /]在 [pre=html] code [/pre] 内. Regex exp; string str; str
这个问题不太可能对任何 future 的访客有帮助;它只与一个小的地理区域、一个特定的时间点或一个非常狭窄的情况相关,通常不适用于互联网的全局受众。如需帮助使这个问题更广泛适用,visit the h
我正在使用这个(jQuery)来替换所有 与清除验证错误: $("").replaceAll(""); 但它不会减少任何验证错误。验证器是否检查原始来源? 最佳答案 JQuery 仅在文档呈现后才
我想获取 break html 中的文本,但这不是用段落换行,只是break内的文本。 Division 是我唯一的标识符,它是“Msg”。我怎样才能获得每个元素之一? H
Hood switch - (automatic transmission only).<br><br>Hood Switch (2013 CX-5 - not requir
我想选择 br 后面没有跟另一个 br 的元素。 例如。 sometextadsf 我想选择这两个元素。 sometextadsf 我只想选择 2 个 br 元素,而不是 4 个。 我看过这个问题,但
这个问题在这里已经有了答案: HTML 5: Is it , , or ? (18 个答案) 关闭 9 年前。 当我开始从 w3schools 学习 HTML 时,他们正在使用这个 .当我开始学习
我是 nagios 新手,我已经在我的 Linux 机器上安装了 nagios 3。 我想安装 nagios check_procs 插件。有人可以建议我吗。谢谢 最佳答案 您可以从依赖于您使用的 L
我有一个段落有一些单一的 和双 . 我想添加所有单个 , 但不是双 . 这怎么可能? 如果我用 p br {display:none} 它隐藏了所有的 br 标签。但是,当我有两个 br 时,我希
之间的主要区别是什么?和 在 html 标记中?有人可以解释两者的主要区别,因为这让我感到困惑。预先感谢您的所有评论。 :) 最佳答案 在实践中,不存在。就或 . 但是,区别在于位置,并且对所有
我如何使用JavaScript来检测 成为一个 ? 我试过: jQuery('body').html().replace(/(\\r\n){3, }/g,"\n"); 但这对我不起作用。 最佳
我是一名优秀的程序员,十分优秀!