Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/439.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript YUI Rich编辑+;无效HTML+;风格_Javascript_Yui - Fatal编程技术网

Javascript YUI Rich编辑+;无效HTML+;风格

Javascript YUI Rich编辑+;无效HTML+;风格,javascript,yui,Javascript,Yui,我试图在编辑器内容中插入一个内联样式标记。当我在rich editor视图中调用saveHTML时,它会去掉样式块。我已经尝试将invalidHTML的style属性更改为false,但它似乎仍然会删除样式块 在此阶段,任何指向API的指针或建议都会很有帮助 谢谢, 上校我希望我能正确理解你的问题。你只是想在你的文本区域中插入类似的内容 <style> .className { font-weight: bold;} </style> 我的列表很长(基本上都是h

我试图在编辑器内容中插入一个内联样式标记。当我在rich editor视图中调用saveHTML时,它会去掉样式块。我已经尝试将invalidHTML的style属性更改为false,但它似乎仍然会删除样式块

在此阶段,任何指向API的指针或建议都会很有帮助

谢谢,
上校

我希望我能正确理解你的问题。你只是想在你的文本区域中插入类似的内容

<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();
}