Closes #1887: Retrieving editor.value in Zotero_Citation_Dialog._updatePreview() fails
This commit is contained in:
parent
668a8e72eb
commit
4afc4a4d82
2 changed files with 23 additions and 1 deletions
|
@ -168,6 +168,13 @@
|
|||
]]></setter>
|
||||
</property>
|
||||
|
||||
<!-- Sets or returns formatting (currently, HTML or Integration) of rich text box -->
|
||||
<property name="initialized">
|
||||
<getter><![CDATA[
|
||||
return !!this._editor;
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<!-- Sets or returns formatting (currently, HTML or Integration) of rich text box -->
|
||||
<property name="format">
|
||||
<getter><![CDATA[
|
||||
|
@ -421,6 +428,11 @@
|
|||
style.innerHTML = css;
|
||||
head.appendChild(style);
|
||||
}
|
||||
|
||||
// Dispatch a tinymceInitialized event
|
||||
var ev = document.createEvent('HTMLEvents');
|
||||
ev.initEvent('tinymceInitialized', true, true);
|
||||
self.dispatchEvent(ev);
|
||||
};
|
||||
onInitFunction.__exposedProps__ = {"apply":"r"};
|
||||
editor.onInit.add(onInitFunction);
|
||||
|
|
|
@ -565,6 +565,7 @@ var Zotero_Citation_Dialog = new function () {
|
|||
if(_previewShown) {
|
||||
document.documentElement.getButton("extra2").label = Zotero.getString("citation.hideEditor");
|
||||
if(text) {
|
||||
_originalHTML = io.previewFunction();
|
||||
editor.value = text;
|
||||
} else {
|
||||
_updatePreview();
|
||||
|
@ -623,7 +624,16 @@ var Zotero_Citation_Dialog = new function () {
|
|||
|
||||
editor.readonly = !io.citation.citationItems.length;
|
||||
editor.value = (io.citation.citationItems.length ? io.previewFunction() : "");
|
||||
_originalHTML = editor.value;
|
||||
|
||||
if(editor.initialized) {
|
||||
_originalHTML = editor.value;
|
||||
} else {
|
||||
var eventListener = function() {
|
||||
_originalHTML = editor.value;
|
||||
editor.removeEventListener("tinymceInitialized", eventListener, false);
|
||||
};
|
||||
editor.addEventListener("tinymceInitialized", eventListener, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue