Google Chrome 逃脱了 WYSIWYG Javascript
所以我的问题相对简单,我已经在谷歌上到处寻找解决方案,但我还没有找到。
问题是,我已经为 Drupal 的 WYSIWYG 模块/框架开发了一个 WYSIWYG 插件(不确定这是否相关)。该插件的目的是允许将视频文件嵌入所见即所得内容中。我们的客户提供视频上传/编辑 API,客户可以使用该 API 将文件嵌入到他们的页面上。
简而言之,我的插件会打开一个弹出窗口,用户可以在其中选择从客户站点的帐户中获取的视频之一,然后插件调用 API 并返回 HTML 和 JavaScript,用于嵌入视频然后插入所见即所得的内容。
这在 Firefox 中就像一个魅力,但是我在 Chrome 中遇到了一些问题。经过来回调试后,我注意到 WYSIWYG 编辑器中嵌入的 JavaScript 被转义了(IE、引号变成了 " 等)。
Firefox 不会发生这种情况,所以很可能是 Chrome 造成的,甚至可能是 Webkit 造成的? 我已经检查了通过 Ajax 调用返回的 HTML 和 JavaScript,这很好,当它嵌入到 WYSIWYG 中时,它就会被转义。
顺便说一句,我测试过的所见即所得编辑器是 TinyMCE。
So my problem is relatively simple, I've Googled all over to find a solution but I've yet to find one.
The problem is, I've developed a WYSIWYG plugin for Drupal's WYSIWYG module/framework (not sure if this is relevant). The purpose of the plugin is to allow embedding of video files inside the WYSIWYG content. Our client offers a video uploading/editing API which their customers use to embed files on their pages.
To put it simply, my plugin opens up a pop-up where the user selects one of their videos as fetched from their account at the clients site, the plugin then calls the API and is returned with HTML and JavaScript for embedding the video which is then inserted into the WYSIWYG content.
This works like a charm in Firefox, however I have a few problems with it in Chrome. After debugging back and forth I've noticed that the embedded JavaScript inside the WYSIWYG editor gets escaped (IE, quotes turned into " etc).
This does not happen with Firefox so it's most likely Chrome which is causing it, or perhaps even Webkit?
I've already checked the HTML and JavaScript that gets returned through the Ajax call and it is fine, it's when it gets embedded inside the WYSIWYG it gets escaped.
The WYSIWYG editor I've tested in is TinyMCE by the way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
添加为 @tobbr 的答案以帮助其他 SO 用户:
Adding as an answer for @tobbr to help other SO users: