Javascript YUI Rich编辑+;无效HTML+;风格
我试图在编辑器内容中插入一个内联样式标记。当我在rich editor视图中调用saveHTML时,它会去掉样式块。我已经尝试将invalidHTML的style属性更改为false,但它似乎仍然会删除样式块 在此阶段,任何指向API的指针或建议都会很有帮助 谢谢,Javascript YUI Rich编辑+;无效HTML+;风格,javascript,yui,Javascript,Yui,我试图在编辑器内容中插入一个内联样式标记。当我在rich editor视图中调用saveHTML时,它会去掉样式块。我已经尝试将invalidHTML的style属性更改为false,但它似乎仍然会删除样式块 在此阶段,任何指向API的指针或建议都会很有帮助 谢谢, 上校我希望我能正确理解你的问题。你只是想在你的文本区域中插入类似的内容 <style> .className { font-weight: bold;} </style> 我的列表很长(基本上都是h
上校我希望我能正确理解你的问题。你只是想在你的文本区域中插入类似的内容
<style>
.className { font-weight: bold;}
</style>
我的列表很长(基本上都是html标签),因为我排除了除p、style、br、ul、ol、li之外的所有内容。因此,在您的情况下,您应该省略样式标记
然后我设置编辑器,然后在呈现之前将invalidTags作为invalidHTML传递给编辑器
所以这就是一切都说了又做了之后的样子
var invalidTags = {"abbr":{ "keepContents":true },
"acronym":{ "keepContents":true }, "address":{ "keepContents":true },
"applet":"", "area":"", "base":"", "basefont":"", "bdo":"", "big":"",
"blockquote":{ "keepContents":true }, "body":{ "keepContents":true }}
var editor = new YAHOO.widget.Editor('myeditor', {
height: '300px',
width: '500px',
dompath: true,
filterWord: true
}
editor.invalidHTML = invalidTags;
editor.render();
YAHOO.util.Event.on('Update', 'click', function() {
editor.saveHTML();
}
这就是我如何让它保留我想要的标签。风格
希望这能帮到你
var invalidTags = {"abbr":{ "keepContents":true },
"acronym":{ "keepContents":true }, "address":{ "keepContents":true },
"applet":"", "area":"", "base":"", "basefont":"", "bdo":"", "big":"",
"blockquote":{ "keepContents":true }, "body":{ "keepContents":true }}
var editor = new YAHOO.widget.Editor('myeditor', {
height: '300px',
width: '500px',
dompath: true,
filterWord: true
}
editor.invalidHTML = invalidTags;
editor.render();
YAHOO.util.Event.on('Update', 'click', function() {
editor.saveHTML();
}