YUI 丰富编辑器 +无效HTML +风格
我正在尝试将内联样式标签插入编辑器内容中。当我在丰富的编辑器视图中调用 saveHTML 时,它会删除样式块。我尝试将 invalidHTML 的 style 属性更改为 false,但它似乎仍然剥离了样式块。
在此阶段,任何指向 API 的指示或建议都会有所帮助!
谢谢, 上校
I am trying to insert an inline style tag into the editor content. When I call saveHTML it strips out the style block when I'm in rich editor view. I have tried changing the style property of invalidHTML to false, but it still seems to strip the style block out.
Any pointers to the API or suggestions would be helpful at this stage!
Thanks,
Col.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我希望我正确理解你的问题。您只是希望能够在文本区域中插入这样的内容吗?
如果是这样,这就是我使用 YUI API 文档中指定的内容让它工作的方式。特别是 invalidHTML 上的这一部分
在我初始化之前我指定了所有我想要删除的无效标签:
我的列表相当长(基本上是所有 html 标签),因为我排除了除 p、style、br、ul、ol、li 之外的所有内容。因此,在您的情况下,您将省略样式标签。
然后我设置编辑器,然后在渲染之前传入 invalidTags 作为编辑器的 invalidHTML。
这就是一切尘埃落定之后的样子。
这就是我如何让它保留我想要的标签。例如。风格。
希望对您有所帮助。
I hope I understand your question properly. You just want to be able to insert something like this in your textarea?
If so this is how I have it working using what is specified in the YUI API documentation. In particular this part on invalidHTML
Before I initialize the editor I specify all the invalid tags I want stripped out:
Mine's a rather long list (basically all html tags) as I exclude everything except p, style, br, ul, ol, li. So in your case you'd leave out the style tag.
Then I set up the editor and then pass in the invalidTags as the invalidHTML for the editor before rendering.
So this is what everything looks like after all is said and done.
So that's that for how I get it to preserve the tags I want. eg. style.
Hope that helps you out.