【发布时间】:2012-07-05 16:48:44
【问题描述】:
我正在尝试同时使用Zemanta 的小部件和Redactor HTML 编辑器。我无法让 Zemanta 找到 Redactor 的 iframe/content,并且无法在单击其中一个小部件后向其发送更新。
Redactor 创建一个iframe,但将真实的textarea 隐藏在幕后,我想在两者之间发送更新,但我不知道如何同时更新两者。如果我使用ID 更新textarea,它可以工作,但除非我单击code view,否则我在Redactor 中看不到它。如果我使用 iframe 类,我会在编辑器中看到它,但它不会在 textarea 内进行更改,当我保存时,我什么也得不到。
.redactor_frame (redactor IFRAME)
#zemanta_content (textarea)
如何使用 Zemanta 的小部件更新两者?
get_editor: function () {
var elm = null, win = null, editor = {element: null, property: null, type: null, win: null};
try {
elm = $('.redactor_frame').get(0);
if (elm && elm.contentWindow) {
win = elm.contentWindow;
elm = null;
} else {
elm = $('#zemanta_content').get(0);
}
editor = win && {element: win.document.body, property: 'innerHTML', type: 'RTE', win: win} ||
elm && {element: elm, property: 'value', type: elm.tagName.toLowerCase(), win: null} ||
editor;
} catch (er) {
$.zemanta.log(er);
}
return editor;
}
【问题讨论】:
标签: javascript jquery-plugins wysiwyg redactor zemanta