- fix notes in Firefox 4 beta (broken due to bug 628410)
- fix notes in the tab (this seems like an unnecessarily complex solution, but it works)
This commit is contained in:
parent
b22894006a
commit
f1909346d9
|
@ -343,10 +343,16 @@
|
|||
|
||||
// Register handler for deferred setting of content
|
||||
var self = this;
|
||||
var listener = function() {
|
||||
var matchTo = null;
|
||||
var listener = function(e) {
|
||||
var win = self._iframe.contentWindow;
|
||||
var SJOW = self._iframe.contentWindow.wrappedJSObject;
|
||||
|
||||
// only fire if the target matches, or _zoteroMatchTo, which we set last
|
||||
// time the target matched, matches
|
||||
if(e.target !== self._iframe.contentDocument
|
||||
&& (!SJOW._zoteroMatchTo || SJOW._zoteroMatchTo !== matchTo)) return;
|
||||
|
||||
if (!SJOW.tinyMCE) {
|
||||
var exts = Zotero.getInstalledExtensions();
|
||||
for each(var ext in exts) {
|
||||
|
@ -365,13 +371,24 @@
|
|||
|
||||
var editor = SJOW.tinyMCE.get("tinymce");
|
||||
if (!editor) {
|
||||
Zotero.debug("editor not ready");
|
||||
|
||||
// this is a hack; I'm not sure why we can't identify the event target
|
||||
// next time without it, but apparently we can't
|
||||
matchTo = Zotero.randomString();
|
||||
SJOW._zoteroMatchTo = matchTo;
|
||||
|
||||
// Not ready yet
|
||||
return;
|
||||
}
|
||||
|
||||
self._iframe.removeEventListener("DOMContentLoaded", listener, false);
|
||||
if(window.ZoteroTab) {
|
||||
ZoteroTab.containerWindow.gBrowser.removeEventListener("DOMContentLoaded", listener, true);
|
||||
} else {
|
||||
self._iframe.removeEventListener("DOMContentLoaded", listener, false);
|
||||
}
|
||||
|
||||
editor.onInit.add(function() {
|
||||
var onInitFunction = function() {
|
||||
self._editor = editor;
|
||||
if (self._value) {
|
||||
self.value = self._value;
|
||||
|
@ -404,7 +421,9 @@
|
|||
style.innerHTML = css;
|
||||
head.appendChild(style);
|
||||
}
|
||||
});
|
||||
};
|
||||
onInitFunction.__exposedProps__ = {"apply":"r"};
|
||||
editor.onInit.add(onInitFunction);
|
||||
|
||||
if (self._eventHandler) {
|
||||
self._iframe.contentWindow.wrappedJSObject.zoteroHandleEvent = self._eventHandler;
|
||||
|
@ -420,7 +439,14 @@
|
|||
win.statusbar.visible = false;
|
||||
}
|
||||
};
|
||||
this._iframe.addEventListener("DOMContentLoaded", listener, false);
|
||||
|
||||
if(window.ZoteroTab) {
|
||||
// I'm not sure why it's necessary to attach the event listener to the
|
||||
// container window to get it to fire on the tab, but apparently it is...
|
||||
ZoteroTab.containerBrowser.addEventListener("DOMContentLoaded", listener, true);
|
||||
} else {
|
||||
this._iframe.addEventListener("DOMContentLoaded", listener, false);
|
||||
}
|
||||
|
||||
this._iframe.webNavigation.loadURI(uri.spec,
|
||||
Components.interfaces.nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY, null, null, null);
|
||||
|
|
|
@ -363,7 +363,7 @@ var Zotero_Browser = new function() {
|
|||
}
|
||||
|
||||
// Ignore TinyMCE popups
|
||||
if (!doc.location.host && doc.location.href.indexOf("tinymce/themes/advanced") != -1) {
|
||||
if (!doc.location.host && doc.location.href.indexOf("tinymce/") != -1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,9 @@ var ZoteroTab = new function()
|
|||
}
|
||||
if(browserIndex === -1) return;
|
||||
|
||||
this.containerWindow = window;
|
||||
this.containerBrowser = window.gBrowser.browsers[browserIndex];
|
||||
|
||||
// if we somehow ended up with other Zotero tabs in the window, close them
|
||||
var numTabs = window.gBrowser.browsers.length;
|
||||
for(var index = 0; index < numTabs; index++) {
|
||||
|
@ -65,7 +68,7 @@ var ZoteroTab = new function()
|
|||
}
|
||||
|
||||
// get tab for browser
|
||||
var tab = (window.gBrowser.tabs ? window.gBrowser.tabs : window.gBrowser.mTabs)[browserIndex];
|
||||
var tab = window.gBrowser.tabs[browserIndex];
|
||||
if(window.gBrowser.selectedTab === tab) {
|
||||
// if tab is already selected, init now
|
||||
ZoteroPane.init();
|
||||
|
|
Loading…
Reference in New Issue
Block a user