diff --git a/chrome/content/zotero/containers/containers.js b/chrome/content/zotero/containers/containers.js
deleted file mode 100644
index 561048db77..0000000000
--- a/chrome/content/zotero/containers/containers.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- ***** BEGIN LICENSE BLOCK *****
-
- Copyright © 2018 Center for History and New Media
- George Mason University, Fairfax, Virginia, USA
- http://zotero.org
-
- This file is part of Zotero.
-
- Zotero is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- Zotero is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Zotero. If not, see .
-
- ***** END LICENSE BLOCK *****
-*/
-
-'use strict';
-
-const { defineMessages } = require('react-intl');
-
-ZoteroPane.Containers = {
- async init() {
- await this.initIntlStrings();
- },
-
- loadPane() {
- ZoteroPane.initTagSelector();
- },
-
- async initIntlStrings() {
- this.intlMessages = {};
- const intlFiles = ['zotero.dtd'];
- for (let intlFile of intlFiles) {
- let localeXML = await Zotero.File.getContentsFromURLAsync(`chrome://zotero/locale/${intlFile}`);
- let regexp = /
-
\ No newline at end of file
diff --git a/chrome/content/zotero/containers/tagSelector.jsx b/chrome/content/zotero/containers/tagSelector.jsx
index f58c0f5cbf..67f9af561f 100644
--- a/chrome/content/zotero/containers/tagSelector.jsx
+++ b/chrome/content/zotero/containers/tagSelector.jsx
@@ -457,7 +457,7 @@ Zotero.TagSelector = class TagSelectorContainer extends React.Component {
static init(domEl, opts) {
var ref;
let elem = (
-
+
ref = c } {...opts} />
);
diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js
index 27c7bf5628..a48f15b7b9 100644
--- a/chrome/content/zotero/overlay.js
+++ b/chrome/content/zotero/overlay.js
@@ -84,7 +84,6 @@ var ZoteroOverlay = new function()
throw new Error("Skipping loading");
}
- ZoteroPane.Containers.init();
ZoteroPane.init();
// Clear old Zotero icon pref
diff --git a/chrome/content/zotero/standalone/standalone.js b/chrome/content/zotero/standalone/standalone.js
index 769e867962..6b79fefda2 100644
--- a/chrome/content/zotero/standalone/standalone.js
+++ b/chrome/content/zotero/standalone/standalone.js
@@ -64,7 +64,6 @@ const ZoteroStandalone = new function() {
ZoteroStandalone.DebugOutput.init();
Zotero.hideZoteroPaneOverlays();
- await ZoteroPane.Containers.init();
ZoteroPane.init();
ZoteroPane.makeVisible();
diff --git a/chrome/content/zotero/xpcom/intl.js b/chrome/content/zotero/xpcom/intl.js
index a1e5dc1b5e..5ce8174808 100644
--- a/chrome/content/zotero/xpcom/intl.js
+++ b/chrome/content/zotero/xpcom/intl.js
@@ -49,6 +49,17 @@ Zotero.Intl = new function () {
// Set the locale direction to Zotero.dir
Zotero.dir = Zotero.Locale.defaultScriptDirection(Zotero.locale);
Zotero.rtl = (Zotero.dir === 'rtl');
+
+ this.strings = {};
+ const intlFiles = ['zotero.dtd'];
+ for (let intlFile of intlFiles) {
+ let localeXML = Zotero.File.getContentsFromURL(`chrome://zotero/locale/${intlFile}`);
+ let regexp = / 1;
Zotero.hiDPISuffix = Zotero.hiDPI ? "@2x" : "";
- ZoteroPane_Local.Containers.loadPane();
-
ZoteroPane_Local.setItemsPaneMessage(Zotero.getString('pane.items.loading'));
// Add a default progress window
@@ -257,6 +255,16 @@ var ZoteroPane = new function()
}
+ this.initContainers = function () {
+ this.initTagSelector();
+ };
+
+
+ this.uninitContainers = function () {
+ this.tagSelector.uninit();
+ };
+
+
/*
* Create the New Item (+) submenu with each item type
*/
@@ -346,7 +354,7 @@ var ZoteroPane = new function()
this.serializePersist();
}
- ZoteroPane_Local.Containers.destroy();
+ ZoteroPane_Local.Containers.uninit();
if(this.collectionsView) this.collectionsView.unregister();
if(this.itemsView) this.itemsView.unregister();
@@ -389,6 +397,7 @@ var ZoteroPane = new function()
this.unserializePersist();
this.updateLayout();
this.updateToolbarPosition();
+ this.initContainers();
// restore saved row selection (for tab switching)
// TODO: Remove now that no tab mode?
@@ -1089,18 +1098,30 @@ var ZoteroPane = new function()
this.initTagSelector = function () {
- this.tagSelector = Zotero.TagSelector.init(
- document.getElementById('zotero-tag-selector'),
- {
- onSelection: this.updateTagFilter.bind(this)
- }
- );
+ var container = document.getElementById('zotero-tag-selector-container');
+ if (!container.hasAttribute('collapsed') || container.getAttribute('collapsed') == 'false') {
+ this.tagSelector = Zotero.TagSelector.init(
+ document.getElementById('zotero-tag-selector'),
+ {
+ onSelection: this.updateTagFilter.bind(this)
+ }
+ );
+ }
};
+ /*
+ * Sets the tag filter on the items view
+ */
+ this.updateTagFilter = Zotero.Promise.coroutine(function* () {
+ if (this.itemsView) {
+ yield this.itemsView.setFilter('tags', ZoteroPane_Local.tagSelector.getTagSelection());
+ }
+ });
+
+
this.toggleTagSelector = Zotero.Promise.coroutine(function* () {
var container = document.getElementById('zotero-tag-selector-container');
-
var showing = container.getAttribute('collapsed') == 'true';
container.setAttribute('collapsed', !showing);
@@ -1117,21 +1138,12 @@ var ZoteroPane = new function()
}
});
- /*
- * Sets the tag filter on the items view
- */
- this.updateTagFilter = Zotero.Promise.coroutine(function* () {
- if (this.itemsView) {
- yield this.itemsView.setFilter('tags', ZoteroPane_Local.tagSelector.getTagSelection());
- }
- });
-
this.tagSelectorShown = function () {
var collectionTreeRow = this.getCollectionTreeRow();
if (!collectionTreeRow) return;
- var tagSelector = document.getElementById('zotero-tag-selector');
- return !tagSelector.getAttribute('collapsed')
+ var tagSelector = document.getElementById('zotero-tag-selector-container');
+ return !tagSelector.hasAttribute('collapsed')
|| tagSelector.getAttribute('collapsed') == 'false';
};
@@ -1195,7 +1207,9 @@ var ZoteroPane = new function()
// Clear quick search and tag selector when switching views
document.getElementById('zotero-tb-search').value = "";
- ZoteroPane.tagSelector.clearTagSelection();
+ if (ZoteroPane.tagSelector) {
+ ZoteroPane.tagSelector.clearTagSelection();
+ }
// Not necessary with seltype="cell", which calls nsITreeView::isSelectable()
/*if (collectionTreeRow.isSeparator()) {
@@ -1204,7 +1218,9 @@ var ZoteroPane = new function()
}*/
collectionTreeRow.setSearch('');
- collectionTreeRow.setTags(ZoteroPane_Local.tagSelector.getTagSelection());
+ if (ZoteroPane.tagSelector) {
+ collectionTreeRow.setTags(ZoteroPane.tagSelector.getTagSelection());
+ }
this._updateToolbarIconsForRow(collectionTreeRow);