www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 4afc4a4d824acad2b108b9b2cd26e25b000a6629
parent 668a8e72eb194c8ce4191ea94b3eeb9cc624569a
Author: Simon Kornblith <simon@simonster.com>
Date:   Thu, 25 Aug 2011 22:50:51 +0000

Closes #1887: Retrieving editor.value in Zotero_Citation_Dialog._updatePreview() fails


Diffstat:
Mchrome/content/zotero/bindings/styled-textbox.xml | 12++++++++++++
Mchrome/content/zotero/integration/addCitationDialog.js | 12+++++++++++-
2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/chrome/content/zotero/bindings/styled-textbox.xml b/chrome/content/zotero/bindings/styled-textbox.xml @@ -169,6 +169,13 @@ </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[ return this._format; @@ -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); diff --git a/chrome/content/zotero/integration/addCitationDialog.js b/chrome/content/zotero/integration/addCitationDialog.js @@ -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); + } } }