jwysiwyg 编辑器中的只读内容
我想知道是否有一种方法可以保护 jquery 内联内容编辑器 jwysiwyg 中的一段 html 或文本?
例如,我有一个从外部插入到编辑器中的 div,但我不希望用户修改它。
我无法捕获其中的按键事件(iframe 安全性?),并且将 div 设置为只读或禁用不起作用。
有什么想法吗?
谢谢!
I was wondering if there is a way to protect a piece of html or text inside the jquery inline content editor jwysiwyg?
For example, I have a div that I externally insert to the editor and I do not want the user to modify it.
I could not capture the keypress event inside it (iframe security?) and setting the div to readonly or disabled did not work.
Any ideas?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需为该 div 添加一个单击事件处理程序,以便它引发警报并禁用(灰显)页面的其余部分;类似登录对话框的东西(查看 jQueryUI 对话框 - http://jqueryui.com/demos/dialog/)
Just add a click event handler for that div so it throws an alert and disables (graying out) the rest of the page; something like a login dialog (check out jQueryUI dialog - http://jqueryui.com/demos/dialog/)
试试吧!
要清除编辑器中的内容,请使用
$('#wysiwyg').wysiwyg('clear');
如果您想动态设置编辑器的内容,可以使用
$('#wysiwyg').wysiwyg('setContent' response.message);
Try it!
To clear the content in the editor use
$('#wysiwyg').wysiwyg('clear');
If you want to set the content of the editor on the fly you can use
$('#wysiwyg').wysiwyg('setContent' response.message);