Remove processNextEvent() call
This commit is contained in:
parent
f3a64939ed
commit
00b341daf1
|
@ -565,8 +565,10 @@ var Zotero_Citation_Dialog = new function () {
|
|||
if(_previewShown) {
|
||||
document.documentElement.getButton("extra2").label = Zotero.getString("citation.hideEditor");
|
||||
if(text) {
|
||||
_originalHTML = io.preview();
|
||||
io.preview(function(preview) {
|
||||
_originalHTML = preview;
|
||||
editor.value = text;
|
||||
});
|
||||
} else {
|
||||
_updatePreview();
|
||||
}
|
||||
|
@ -620,7 +622,9 @@ var Zotero_Citation_Dialog = new function () {
|
|||
_getCitation();
|
||||
|
||||
editor.readonly = !io.citation.citationItems.length;
|
||||
editor.value = (io.citation.citationItems.length ? io.preview() : "");
|
||||
if(io.citation.citationItems.length) {
|
||||
io.preview(function(preview) {
|
||||
editor.value = preview;
|
||||
|
||||
if(editor.initialized) {
|
||||
_originalHTML = editor.value;
|
||||
|
@ -631,6 +635,11 @@ var Zotero_Citation_Dialog = new function () {
|
|||
};
|
||||
editor.addEventListener("tinymceInitialized", eventListener, false);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
editor.value = "";
|
||||
_originalHTML = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1275,9 +1275,10 @@ Zotero.Integration.Fields.prototype.addEditCitation = function(field, callback)
|
|||
var previewing = false;
|
||||
|
||||
// assign preview function
|
||||
io.preview = function() {
|
||||
if(previewing) return;
|
||||
previewing = true;
|
||||
var previewCallbackQueue;
|
||||
io.preview = function(callback) {
|
||||
if(!previewCallbackQueue) previewCallbackQueue = [];
|
||||
previewCallbackQueue.push(callback);
|
||||
|
||||
var returnVal;
|
||||
me.get(function() {
|
||||
|
@ -1290,14 +1291,10 @@ Zotero.Integration.Fields.prototype.addEditCitation = function(field, callback)
|
|||
citation.properties.zoteroIndex = fieldIndex;
|
||||
citation.properties.noteIndex = field.getNoteIndex();
|
||||
returnVal = me._session.previewCitation(citation);
|
||||
|
||||
for(var i=0, n=previewCallbackQueue.length; i<n; i++) previewCallbackQueue[i](returnVal);
|
||||
previewCallbackQueue = undefined;
|
||||
});
|
||||
|
||||
// wait until we get the preview
|
||||
while(returnVal === undefined) Zotero.mainThread.processNextEvent(true);
|
||||
|
||||
// return the preview
|
||||
return returnVal;
|
||||
previewing = false;
|
||||
}
|
||||
// assign sort function
|
||||
io.sort = function() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user