- run plug-in cleanup() method before displaying dialogs (so that ScreenUpdating is re-enabled before dialogs are shown in WinWord)
- code clean-up
This commit is contained in:
parent
4c2b717c65
commit
363f059ca3
1 changed files with 20 additions and 22 deletions
|
@ -486,7 +486,7 @@ Zotero.Integration.Document.prototype._getSession = function(require, dontRunSet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this._session.resetRequest();
|
this._session.resetRequest(this);
|
||||||
return !!dataString;
|
return !!dataString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -975,7 +975,7 @@ Zotero.Integration.Session = function() {
|
||||||
/**
|
/**
|
||||||
* Resets per-request variables in the CitationSet
|
* Resets per-request variables in the CitationSet
|
||||||
*/
|
*/
|
||||||
Zotero.Integration.Session.prototype.resetRequest = function() {
|
Zotero.Integration.Session.prototype.resetRequest = function(doc) {
|
||||||
this.citationsByItemID = new Object();
|
this.citationsByItemID = new Object();
|
||||||
this.citationsByIndex = new Array();
|
this.citationsByIndex = new Array();
|
||||||
this.uriMap = new Zotero.Integration.URIMap(this);
|
this.uriMap = new Zotero.Integration.URIMap(this);
|
||||||
|
@ -990,6 +990,8 @@ Zotero.Integration.Session.prototype.resetRequest = function() {
|
||||||
this.oldCitationIDs = this.citationIDs;
|
this.oldCitationIDs = this.citationIDs;
|
||||||
this.citationIDs = new Object();
|
this.citationIDs = new Object();
|
||||||
this.citationText = new Object();
|
this.citationText = new Object();
|
||||||
|
|
||||||
|
this.doc = doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1019,6 +1021,17 @@ Zotero.Integration.Session.prototype.setData = function(data) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a dialog in a modal-like fashion without hanging the thread
|
||||||
|
*/
|
||||||
|
Zotero.Integration.Session.prototype._displayDialog = function(url, options, io) {
|
||||||
|
if(this.doc) this.doc.cleanup();
|
||||||
|
var window = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
||||||
|
.getService(Components.interfaces.nsIWindowWatcher)
|
||||||
|
.openWindow(null, url, '', 'chrome,centerscreen'+(options ? options : ""), (io ? io : null));
|
||||||
|
while(!window.closed) Zotero.mainThread.processNextEvent(true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a dialog to set document preferences
|
* Displays a dialog to set document preferences
|
||||||
*/
|
*/
|
||||||
|
@ -1035,11 +1048,7 @@ Zotero.Integration.Session.prototype.setDocPrefs = function(primaryFieldType, se
|
||||||
io.secondaryFieldType = secondaryFieldType;
|
io.secondaryFieldType = secondaryFieldType;
|
||||||
}
|
}
|
||||||
|
|
||||||
var window = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
this._displayDialog('chrome://zotero/content/integration/integrationDocPrefs.xul', '', io);
|
||||||
.getService(Components.interfaces.nsIWindowWatcher)
|
|
||||||
.openWindow(null, 'chrome://zotero/content/integration/integrationDocPrefs.xul', '',
|
|
||||||
'chrome,centerscreen', io, true);
|
|
||||||
while(!window.closed) Zotero.mainThread.processNextEvent(true);
|
|
||||||
if(!io.style) throw new Zotero.Integration.UserCancelledException();
|
if(!io.style) throw new Zotero.Integration.UserCancelledException();
|
||||||
|
|
||||||
// set data
|
// set data
|
||||||
|
@ -1072,11 +1081,7 @@ Zotero.Integration.Session.prototype.reselectItem = function(exception) {
|
||||||
io.addBorder = Zotero.isWin;
|
io.addBorder = Zotero.isWin;
|
||||||
io.singleSelection = true;
|
io.singleSelection = true;
|
||||||
|
|
||||||
var window = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
this._displayDialog('chrome://zotero/content/selectItemsDialog.xul', 'resizable', io);
|
||||||
.getService(Components.interfaces.nsIWindowWatcher)
|
|
||||||
.openWindow(null,'chrome://zotero/content/selectItemsDialog.xul', '',
|
|
||||||
'chrome,centerscreen,resizable', io, true);
|
|
||||||
while(!window.closed) Zotero.mainThread.processNextEvent(true);
|
|
||||||
|
|
||||||
if(io.dataOut && io.dataOut.length) {
|
if(io.dataOut && io.dataOut.length) {
|
||||||
var itemID = io.dataOut[0];
|
var itemID = io.dataOut[0];
|
||||||
|
@ -1700,11 +1705,8 @@ Zotero.Integration.Session.prototype.editCitation = function(index, noteIndex, c
|
||||||
// determine whether citation is sortable in current style
|
// determine whether citation is sortable in current style
|
||||||
io.sortable = this.style.opt.sort_citations;
|
io.sortable = this.style.opt.sort_citations;
|
||||||
|
|
||||||
var window = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
|
||||||
.getService(Components.interfaces.nsIWindowWatcher)
|
this._displayDialog('chrome://zotero/content/integration/addCitationDialog.xul', 'resizable', io);
|
||||||
.openWindow(null, 'chrome://zotero/content/integration/addCitationDialog.xul', '',
|
|
||||||
'chrome,centerscreen,resizable', io);
|
|
||||||
while(!window.closed) Zotero.mainThread.processNextEvent(true);
|
|
||||||
|
|
||||||
if(io.citation.citationItems.length) { // we have an item
|
if(io.citation.citationItems.length) { // we have an item
|
||||||
this.addCitation(index, noteIndex, io.citation);
|
this.addCitation(index, noteIndex, io.citation);
|
||||||
|
@ -1723,11 +1725,7 @@ Zotero.Integration.Session.prototype.editBibliography = function() {
|
||||||
|
|
||||||
this.bibliographyDataHasChanged = this.bibliographyHasChanged = true;
|
this.bibliographyDataHasChanged = this.bibliographyHasChanged = true;
|
||||||
|
|
||||||
var window = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
this._displayDialog('chrome://zotero/content/integration/editBibliographyDialog.xul', 'resizable', io);
|
||||||
.getService(Components.interfaces.nsIWindowWatcher)
|
|
||||||
.openWindow(null, 'chrome://zotero/content/integration/editBibliographyDialog.xul', '',
|
|
||||||
'chrome,centerscreen,resizable', io, true);
|
|
||||||
while(!window.closed) Zotero.mainThread.processNextEvent(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue