diff --git a/.gitmodules b/.gitmodules
index f70921805c..32ff4587a9 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -29,3 +29,15 @@
[submodule "resource/SingleFile"]
path = resource/SingleFile
url = https://github.com/gildas-lormeau/SingleFile.git
+[submodule "pdf-reader"]
+ path = pdf-reader
+ url = ssh://git@github.com/zotero/pdf-reader.git
+ branch = master
+[submodule "pdf-worker"]
+ path = pdf-worker
+ url = ssh://git@github.com/zotero/pdf-worker.git
+ branch = master
+[submodule "note-editor"]
+ path = note-editor
+ url = ssh://git@github.com/zotero/note-editor.git
+ branch = master
diff --git a/chrome/content/zotero-platform/mac-big-sur/style.css b/chrome/content/zotero-platform/mac-big-sur/style.css
index e206c02b41..d15aec7a87 100644
--- a/chrome/content/zotero-platform/mac-big-sur/style.css
+++ b/chrome/content/zotero-platform/mac-big-sur/style.css
@@ -1,10 +1,10 @@
/* Use standard tab appearance for item pane tabs */
-#zotero-pane #zotero-view-tabbox > tabs > tab {
+.zotero-view-tabbox > tabs > tab {
-moz-appearance: tab;
}
/* Active tab label color in item pane and elsewhere */
-#zotero-pane tabs#zotero-editpane-tabs > tab[visuallyselected="true"][selected="true"] hbox > .tab-text,
+tabs.zotero-editpane-tabs > tab[visuallyselected="true"][selected="true"] hbox > .tab-text,
#zotero-prefs tab[visuallyselected="true"]:not(:-moz-window-inactive),
tabs > tab[visuallyselected="true"] hbox > .tab-text {
color: black !important;
@@ -12,10 +12,6 @@ tabs > tab[visuallyselected="true"] hbox > .tab-text {
}
/* Quick Format dialog, which is based on window corners, which are different on Big Sur */
-#quick-format-dialog #zotero-icon {
- margin-top: 2px;
-}
-
#quick-format-iframe {
margin-top: 2px;
}
\ No newline at end of file
diff --git a/chrome/content/zotero-platform/mac/integration.css b/chrome/content/zotero-platform/mac/integration.css
index f8287e5007..9d62382760 100644
--- a/chrome/content/zotero-platform/mac/integration.css
+++ b/chrome/content/zotero-platform/mac/integration.css
@@ -4,7 +4,7 @@ html > body {
}
body {
- line-height: 1.45em;
+ line-height: 1.6em;
font-size: 15px;
}
@@ -12,45 +12,42 @@ body[multiline="true"] {
line-height: 26px;
}
-#quick-format-dialog {
+window.citation-dialog {
background: transparent;
-moz-appearance: none;
padding: 0;
width: 800px;
}
-#quick-format-dialog.progress-bar #quick-format-deck {
+.citation-dialog.progress-bar .citation-dialog.deck {
height: 37px;
}
-#quick-format-search {
+.citation-dialog.search {
background: white;
- -moz-appearance: searchfield;
-}
-
-#quick-format-search[multiline="true"] {
- padding: 2px 2px 0 19.5px;
+ padding: 2px 2px 0 2px;
margin: 2.5px 3.5px;
border: 1px solid rgba(0, 0, 0, 0.5);
-moz-appearance: none;
+ border-radius: 10px;
}
-#quick-format-search:not([multiline="true"]) {
- padding-top: 3.5px;
- height: 37px !important;
+.citation-dialog.search:not([multiline="true"]) {
+ height: 32px !important;
}
-#quick-format-entry {
+.citation-dialog.entry {
background: -moz-linear-gradient(-90deg, rgb(243,123,119) 0, rgb(180,47,38) 50%, rgb(156,36,27) 50%);
padding: 12px;
}
-#zotero-icon {
- margin: -2px 0 3px -6px;
+.note-dialog .citation-dialog.entry {
+ background: -moz-linear-gradient(-90deg, rgb(249, 231, 179) 0, rgb(228, 193, 94) 50%, rgb(221, 184, 81) 50%);
}
-#quick-format-search[multiline="true"] #zotero-icon {
- margin: 0 0 1px -13px;
+#zotero-icon {
+ margin: -1px 0 0 4px;
+ -moz-appearance: none;
}
#citation-properties menulist {
@@ -106,7 +103,6 @@ panel button:-moz-focusring {
box-shadow: 0 0 1px -moz-mac-focusring inset, 0 0 4px 1px -moz-mac-focusring, 0 0 2px 1px -moz-mac-focusring;
}
-.quick-format-bubble {
- margin-top: 0;
+.citation-dialog.bubble {
padding: 1px 6px 1px 6px;
}
\ No newline at end of file
diff --git a/chrome/content/zotero-platform/mac/overlay.css b/chrome/content/zotero-platform/mac/overlay.css
index acb230d456..0553db9230 100644
--- a/chrome/content/zotero-platform/mac/overlay.css
+++ b/chrome/content/zotero-platform/mac/overlay.css
@@ -107,12 +107,12 @@ input {
margin: 0;
}
-#zotero-view-tabbox {
+.zotero-view-tabbox {
background-color: #fff;
padding: 0;
}
-#zotero-item-pane-content .groupbox-body {
+.zotero-item-pane-content .groupbox-body {
-moz-appearance: none;
background-color: #ffffff;
}
@@ -121,13 +121,13 @@ input {
color: #7f7f7f;
}
-#zotero-view-tabbox > tabpanels {
+.zotero-view-tabbox > tabpanels {
margin: 12px 0 0 0;
padding: 0;
-moz-appearance: none;
}
-#zotero-view-tabbox > tabs {
+.zotero-editpane-tabs {
-moz-appearance: none;
background: -moz-linear-gradient(top, #ededed, #cccccc);
border-style: solid;
@@ -136,15 +136,15 @@ input {
padding: 2px 0 2px 0;
}
-#zotero-view-tabbox > tabs > tab > hbox {
+.zotero-editpane-tabs > tab > hbox {
padding: 0;
}
-#zotero-view-tabbox > tabs > tab > hbox > .tab-icon {
+.zotero-editpane-tabs > tab > hbox > .tab-icon {
display: none;
}
-#zotero-pane #zotero-view-tabbox > tabs > tab {
+.zotero-editpane-tabs > tab {
-moz-box-orient: vertical;
-moz-box-align: center;
-moz-appearance: toolbarbutton;
@@ -153,7 +153,7 @@ input {
padding: 3px 1px 3px 1px;
}
-#zotero-pane #zotero-view-tabbox > tabs > tab > hbox .tab-text {
+.zotero-editpane-tabs > tab > hbox .tab-text {
font-size: 11px;
font-weight: bold;
margin: 2px 7px 2px 9px !important;
@@ -161,11 +161,11 @@ input {
}
/* This seems to be necessary to center the tabs. Not sure why. */
-#zotero-pane #zotero-view-tabbox > tabs > tab:last-of-type > hbox .tab-text {
+.zotero-editpane-tabs > tab:last-of-type > hbox .tab-text {
margin: 2px 9px 2px 9px !important;
}
-#zotero-pane #zotero-view-tabbox > tabs > tab[selected=true] > hbox .tab-text {
+.zotero-editpane-tabs > tab[selected=true] > hbox .tab-text {
color: #FFF !important;
text-shadow: rgba(0, 0, 0, 0.4) 0 1px;
}
@@ -217,18 +217,21 @@ input {
}
#zotero-collections-splitter:not([state=collapsed]),
-#zotero-items-splitter:not([state=collapsed])[orient=horizontal]
+#zotero-items-splitter:not([state=collapsed])[orient=horizontal],
+#zotero-context-splitter:not([state=collapsed])[orient=horizontal]
{
-moz-appearance: none;
border-inline-start: 1px solid #bdbdbd;
margin-inline-end: -4px;
width: 5px !important;
min-width: 5px;
- position: relative;
+ /* Create a separate stacking context to be on top */
+ opacity: 0.99;
background-image: none;
}
-#zotero-items-splitter[orient=vertical]
+#zotero-items-splitter[orient=vertical],
+#zotero-context-splitter-stacked
{
-moz-border-start: none !important;
-moz-border-end: none !important;
@@ -239,17 +242,25 @@ input {
}
#zotero-collections-splitter:not([state=collapsed]) > grippy,
-#zotero-items-splitter:not([state=collapsed]) > grippy
+#zotero-items-splitter:not([state=collapsed]) > grippy,
+#zotero-context-splitter:not([state=collapsed]) > grippy,
+#zotero-context-splitter-stacked:not([state=collapsed]) > grippy
{
display: none;
}
-#zotero-collections-splitter[state=collapsed], #zotero-items-splitter[state=collapsed] {
+#zotero-collections-splitter[state=collapsed],
+#zotero-items-splitter[state=collapsed],
+#zotero-context-splitter[state=collapsed],
+#zotero-context-splitter-stacked[state=collapsed]
+{
border: 0 solid #d6d6d6 !important;
padding: 0;
}
-#zotero-collections-splitter[state=collapsed], #zotero-items-splitter[state=collapsed][orient=horizontal]
+#zotero-collections-splitter[state=collapsed],
+#zotero-items-splitter[state=collapsed][orient=horizontal],
+#zotero-context-splitter[state=collapsed][orient=horizontal]
{
background-image: url("chrome://zotero/skin/mac/vsplitter.png");
background-repeat: repeat-y;
@@ -258,7 +269,8 @@ input {
width: 8px !important;
}
-#zotero-items-splitter[state=collapsed][orient=vertical]
+#zotero-items-splitter[state=collapsed][orient=vertical],
+#zotero-context-splitter-stacked[state=collapsed][orient=vertical]
{
background-image: url("chrome://zotero/skin/mac/hsplitter.png");
background-repeat: repeat-x;
@@ -271,11 +283,17 @@ input {
border-right-width: 1px !important;
}
-#zotero-items-splitter[state=collapsed] {
+#zotero-items-splitter[state=collapsed],
+#zotero-context-splitter[state=collapsed],
+#zotero-context-splitter-stacked[state=collapsed]
+{
border-left-width: 1px !important;
}
-#zotero-collections-splitter[state=collapsed] > grippy, #zotero-items-splitter[state=collapsed] > grippy
+#zotero-collections-splitter[state=collapsed] > grippy,
+#zotero-items-splitter[state=collapsed] > grippy,
+#zotero-context-splitter[state=collapsed] > grippy,
+#zotero-context-splitter-stacked[state=collapsed] > grippy
{
-moz-appearance: none;
background: url(chrome://zotero/skin/mac/vgrippy.png) center/auto 8px no-repeat;
@@ -301,11 +319,20 @@ input {
height: 8px;
}
-#zotero-tags-splitter > grippy:hover, #zotero-collections-splitter > grippy:hover, #zotero-items-splitter > grippy:hover
+#zotero-tags-splitter > grippy:hover,
+#zotero-collections-splitter > grippy:hover,
+#zotero-items-splitter > grippy:hover,
+#zotero-context-splitter > grippy:hover,
+#zotero-context-splitter-stacked > grippy:hover
{
background-color:transparent;
}
+#zotero-context-toolbar-extension {
+ /* To cover #zotero-context-splitter 1px border */
+ margin-inline-start: -1px;
+}
+
#zotero-items-tree
{
-moz-appearance: none;
diff --git a/chrome/content/zotero-platform/unix/integration.css b/chrome/content/zotero-platform/unix/integration.css
index d6ab27d2e8..d297f55d66 100644
--- a/chrome/content/zotero-platform/unix/integration.css
+++ b/chrome/content/zotero-platform/unix/integration.css
@@ -2,18 +2,18 @@ body {
line-height: 1.5em;
}
-#quick-format-search:not([multiline="true"]) {
+.citation-dialog.search:not([multiline="true"]) {
height: 29px !important;
}
-#quick-format-search {
+.citation-dialog.search {
background: white;
padding: 0 2px 0 0;
border: 1px solid rgba(0, 0, 0, 0.5);
-moz-appearance: textfield;
}
-#quick-format-dialog {
+window.citation-dialog {
-moz-appearance: none;
padding: 5px;
}
diff --git a/chrome/content/zotero-platform/unix/itemPane.css b/chrome/content/zotero-platform/unix/itemPane.css
index 999e699e3d..82e8f78040 100644
--- a/chrome/content/zotero-platform/unix/itemPane.css
+++ b/chrome/content/zotero-platform/unix/itemPane.css
@@ -11,20 +11,20 @@
visibility: visible;
}
-#zotero-item-pane-content {
+.zotero-item-pane-content {
margin-right: 6px;
}
/* Make the item pane appear white (same colour as treeview), making the UI more consistent */
-#zotero-item-pane-content tab, #zotero-item-pane-content tabpanels {
+.zotero-item-pane-content tab, .zotero-item-pane-content tabpanels {
background-color: -moz-Field; /* Same as background colour for treeview */
}
/* Possibly irrelevant if mozilla fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1306425 */
-#zotero-view-tabbox tabs tab[visuallyselected=true] {
+.zotero-view-tabbox tabs tab[visuallyselected=true] {
margin-top: 0px !important; /* Importanter than ./itemPane.css:20 */
margin-bottom: -2px !important; /* Importanter than skin/itemPane.css:12 */
}
-#zotero-view-tabbox tabs tab {
+.zotero-view-tabbox tabs tab {
margin-top: 2px !important; /* Importanter than skin/itemPane.css:11 */
}
diff --git a/chrome/content/zotero-platform/unix/overlay.css b/chrome/content/zotero-platform/unix/overlay.css
index cc19958220..50aee11669 100644
--- a/chrome/content/zotero-platform/unix/overlay.css
+++ b/chrome/content/zotero-platform/unix/overlay.css
@@ -76,3 +76,9 @@ tab {
background-color: transparent;
background-image: none;
}
+
+#zotero-context-splitter-stacked {
+ -moz-appearance: none;
+ background-color: #ececec;
+ border-top: 1px solid hsla(0, 0%, 0%, 0.2);
+}
diff --git a/chrome/content/zotero-platform/win/integration.css b/chrome/content/zotero-platform/win/integration.css
index 05bb899e8c..252ff62dbf 100644
--- a/chrome/content/zotero-platform/win/integration.css
+++ b/chrome/content/zotero-platform/win/integration.css
@@ -1,9 +1,10 @@
-#quick-format-dialog {
+window.citation-dialog {
background: transparent;
padding: 0;
+ -moz-appearance: none;
}
-#quick-format-search {
+.citation-dialog.search {
background: white;
padding: 2px 2px 2px 0;
border: 1px solid rgba(0, 0, 0, 0.5);
@@ -11,22 +12,20 @@
-moz-appearance: none;
}
-#quick-format-dialog {
- background: transparent;
- -moz-appearance: none;
- padding: 0;
-}
-
-#quick-format-search:not([multiline="true"]) {
+.citation-dialog.search:not([multiline="true"]) {
height: 28px !important;
}
-#quick-format-entry {
+.citation-dialog.entry {
background: -moz-linear-gradient(-90deg, rgb(243,123,119) 0, rgb(180,47,38) 50%, rgb(156,36,27) 50%);
padding: 10px;
}
-#quick-format-entry:not([square="true"]) {
+.note-dialog .citation-dialog.entry {
+ background: -moz-linear-gradient(-90deg, rgb(249, 231, 179) 0, rgb(228, 193, 94) 50%, rgb(221, 184, 81) 50%);
+}
+
+.citation-dialog.entry:not([square="true"]) {
-moz-border-radius: 15px;
border-radius: 15px;
}
diff --git a/chrome/content/zotero-platform/win/overlay.css b/chrome/content/zotero-platform/win/overlay.css
index 591d8ed3df..7f2044a975 100644
--- a/chrome/content/zotero-platform/win/overlay.css
+++ b/chrome/content/zotero-platform/win/overlay.css
@@ -49,7 +49,7 @@
padding-top: 4px;
}
-#zotero-view-tabbox tab {
+.zotero-view-tabbox tab {
padding-left: .7em;
padding-right: .7em;
}
@@ -61,7 +61,9 @@
#zotero-collections-splitter:not([state=collapsed]),
#zotero-items-splitter:not([state=collapsed]),
-#zotero-tags-splitter:not([state=collapsed]) {
+#zotero-tags-splitter:not([state=collapsed]),
+#zotero-context-splitter:not([state=collapsed]),
+#zotero-context-splitter-stacked:not([state=collapsed]) {
border: 0;
background-color: transparent;
position: relative;
@@ -70,9 +72,15 @@
z-index: 1;
}
+#zotero-context-splitter:not([state=collapsed]),
+#zotero-context-splitter-stacked:not([state=collapsed]) {
+ z-index: 0;
+}
+
#zotero-collections-splitter:not([state=collapsed]),
#zotero-items-splitter:not([state=collapsed]):not([orient=vertical]),
-#zotero-tags-splitter:not([state=collapsed]) {
+#zotero-tags-splitter:not([state=collapsed]),
+#zotero-context-splitter:not([state=collapsed]) {
border-inline-end: 1px solid var(--theme-border-color);
min-width: 0;
width: 3px;
@@ -80,7 +88,8 @@
}
#zotero-tags-splitter:not([state=collapsed]),
-#zotero-items-splitter:not([state=collapsed])[orient=vertical] {
+#zotero-items-splitter:not([state=collapsed])[orient=vertical],
+#zotero-context-splitter-stacked:not([state=collapsed]) {
border-block-end: 1px solid var(--theme-border-color);
min-height: 0;
height: 3px;
@@ -89,17 +98,20 @@
#zotero-collections-splitter > grippy,
#zotero-items-splitter > grippy,
-#zotero-tags-splitter > grippy {
+#zotero-tags-splitter > grippy,
+#zotero-context-splitter > grippy {
border: 0;
}
#zotero-collections-splitter:not([state=collapsed]) > grippy,
#zotero-items-splitter:not([state=collapsed]) > grippy,
-#zotero-tags-splitter:not([state=collapsed]) > grippy {
+#zotero-tags-splitter:not([state=collapsed]) > grippy,
+#zotero-context-splitter:not([state=collapsed]) > grippy,
+#zotero-context-splitter-stacked:not([state=collapsed]) > grippy {
display: none;
}
-#zotero-collections-tree, #zotero-items-tree, #zotero-view-item {
+#zotero-collections-tree, #zotero-items-tree, .zotero-view-item {
-moz-appearance: none;
border-style: solid;
border-color: #818790;
@@ -142,11 +154,11 @@ tree {
margin: .04em 0 0 .15em !important;
}
-#zotero-editpane-tabs spacer {
+.zotero-editpane-tabs spacer {
border: 0;
}
-#zotero-view-item {
+.zotero-view-item {
padding: 0 !important;
-moz-appearance: none;
background-color: -moz-field;
@@ -154,7 +166,7 @@ tree {
border-color: var(--theme-border-color);
}
-#zotero-view-tabbox > tabs {
+.zotero-editpane-tabs {
margin-top: 2px;
}
@@ -163,8 +175,8 @@ tree {
border-width: 0;
}
-#zotero-editpane-item-box > scrollbox, #zotero-view-item > tabpanel > vbox,
-#zotero-editpane-tags > scrollbox, #zotero-editpane-related {
+.zotero-editpane-item-box > scrollbox, .zotero-view-item > tabpanel > vbox,
+#zotero-editpane-tags > scrollbox, .zotero-editpane-related {
padding-top: 5px;
}
@@ -172,6 +184,6 @@ tree {
padding-left: 5px;
}
-#zotero-view-item > tabpanel > vbox {
+.zotero-view-item > tabpanel > vbox {
padding-left: 5px;
}
\ No newline at end of file
diff --git a/chrome/content/zotero/bindings/attachmentbox.xml b/chrome/content/zotero/bindings/attachmentbox.xml
index 4604c9567a..917c99e2a6 100644
--- a/chrome/content/zotero/bindings/attachmentbox.xml
+++ b/chrome/content/zotero/bindings/attachmentbox.xml
@@ -360,9 +360,19 @@
indexStatusRow.hidden = true;
}
+ var type = Zotero.Libraries.get(this.item.libraryID).libraryType;
+ var switherDeck = this._id('attachment-note-editor-switcher');
// Note editor
- var noteEditor = this._id('attachment-note-editor');
- if (this.displayNote && (this.displayNoteIfEmpty || this.item.getNote() != '')) {
+ if (type == 'group' || !Zotero.isPDFBuild) {
+ var noteEditor = this._id('attachment-note-editor-old');
+ switherDeck.selectedIndex = 0;
+ }
+ else {
+ var noteEditor = this._id('attachment-note-editor');
+ switherDeck.selectedIndex = 1;
+ }
+
+ if (this.displayNote && (this.displayNoteIfEmpty || this.item.note != '')) {
noteEditor.linksOnTop = true;
noteEditor.hidden = false;
@@ -624,7 +634,10 @@
-
+
+
+
+
diff --git a/chrome/content/zotero/bindings/itembox.xml b/chrome/content/zotero/bindings/itembox.xml
index b1f961e3ca..506280aae3 100644
--- a/chrome/content/zotero/bindings/itembox.xml
+++ b/chrome/content/zotero/bindings/itembox.xml
@@ -652,7 +652,7 @@
for (var i=0; i
-
-
+
+
-
+
false
- false
false
false
false
+
+
+
+
+ {
+ // For iframes without chrome priviledges, for unknown reasons,
+ // dataTransfer.getData() returns empty value for `drop` event
+ // when dragging something from the outside of Zotero
+ this._iframe.contentWindow.addEventListener('drop', (event) => {
+ this._iframe.contentWindow.wrappedJSObject.droppedData = Components.utils.cloneInto({
+ 'text/plain': event.dataTransfer.getData('text/plain'),
+ 'text/html': event.dataTransfer.getData('text/html'),
+ 'zotero/annotation': event.dataTransfer.getData('zotero/annotation'),
+ 'zotero/item': event.dataTransfer.getData('zotero/item')
+ }, this._iframe.contentWindow);
+ }, true);
+ this._initialized = true;
+ });
+
+ window.fillTooltip = (tooltip) => {
+ let node = window.document.tooltipNode.closest('*[title]');
+ if (!node || !node.getAttribute('title')) {
+ return false;
+ }
+ tooltip.setAttribute('label', node.getAttribute('title'));
+ return true;
+ }
+
+ this.saveSync = () => {
+ if (this._editorInstance) {
+ this._editorInstance.saveSync();
+ }
+ }
+
+ this.getCurrentInstance = () => {
+ return this._editorInstance;
+ }
+
+ this.initEditor = async (state) => {
+ if (this._editorInstance) {
+ this._editorInstance.uninit();
+ }
+ this._editorInstance = new Zotero.EditorInstance();
+ await this._editorInstance.init({
+ state,
+ item: this._item,
+ iframeWindow: document.getAnonymousElementByAttribute(this, 'anonid', 'editor-view').contentWindow,
+ popup: document.getAnonymousElementByAttribute(this, 'anonid', 'editor-menu'),
+ onNavigate: this._navigateHandler,
+ readOnly: !this.editable,
+ disableUI: this.mode == 'merge',
+ onReturn: this._returnHandler,
+ placeholder: this.placeholder
+ });
+ if (this._onInitCallback) {
+ this._onInitCallback();
+ }
+ }
+
+ this.onInit = (callback) => {
+ if (this._editorInstance) {
+ return callback();
+ }
+ this._onInitCallback = callback;
+ }
+
+ this.notify = async (event, type, ids, extraData) => {
+ if (this._editorInstance) {
+ await this._editorInstance.notify(ids);
+ }
+
+ if (!this.item) return;
+ // Try to use the state from the item save event
+ let id = this.item.id;
+ if (ids.includes(id)) {
+ let state = extraData && extraData[id] && extraData[id].state;
+ if (state) {
+ if (extraData[id].noteEditorID !== this._editorInstance.instanceID) {
+ this.initEditor(state);
+ }
+ }
+ else {
+ let curValue = this.item.note;
+ if (curValue !== this._lastHtmlValue) {
+ this.initEditor();
+ }
+ }
+ this._lastHtmlValue = this.item.note;
+ }
+
+ this._id('links-container').hidden = !(this.displayTags && this.displayRelated) || this._hideLinksContainer;
+ this._id('links-box').refresh();
+ }
+
+ this._notifierID = Zotero.Notifier.registerObserver(this, ['item'], 'noteeditor');
+ ]]>
+
+
+
"view"
ed.setMode('readonly'));
- }
- break;
-
- case 'edit':
- if (this.noteField) {
- this.noteField.onInit(ed => ed.setMode('design'));
- }
- this.editable = true;
- this.saveOnEdit = true;
- this.parentClickHandler = this.selectParent;
- this.keyDownHandler = this.handleKeyDown;
- this.commandHandler = this.save;
- this.displayTags = true;
- this.displayRelated = true;
- break;
-
- default:
- throw ("Invalid mode '" + val + "' in noteeditor.xml");
- }
-
- this._mode = val;
- document.getAnonymousNodes(this)[0].setAttribute('mode', val);
- this._id('links-box').mode = val;
- ]]>
+ // Duplicate default property settings here
+ this.editable = false;
+ this.displayTags = false;
+ this.displayRelated = false;
+ this.displayButton = false;
+
+ switch (val) {
+ case 'view':
+ case 'merge':
+ this.editable = false;
+ break;
+
+ case 'edit':
+ this.editable = true;
+ this.parentClickHandler = this.selectParent;
+ this.keyDownHandler = this.handleKeyDown;
+ this.commandHandler = this.save;
+ this.displayTags = true;
+ this.displayRelated = true;
+ break;
+
+ default:
+ throw ("Invalid mode '" + val + "' in noteeditor.xml");
+ }
+
+ this._mode = val;
+ document.getAnonymousNodes(this)[0].setAttribute('mode', val);
+ this._id('links-box').mode = val;
+ this._id('links-container').hidden = !(this.displayTags && this.displayRelated) || this._hideLinksContainer;
+ this._id('links-box').refresh();
+ ]]>
-
+
+
+
+
+
+
+
+
@@ -102,301 +208,156 @@
]]>
-
-
-
+
+ return (async () => {
+ // `item` field can be set before the constructor is called
+ // or noteditor is attached to dom (which happens in the
+ // merge dialog i.e.), therefore we wait for the initialization
+ let n = 0;
+ while (!this._initialized && !this._destroyed) {
+ if (n >= 1000) {
+ throw new Error('Waiting for noteeditor initialization failed');
+ }
+ await Zotero.Promise.delay(10);
+ n++;
+ }
+
+ // The binding can also be immediately destructed
+ // (which also happens in the merge dialog)
+ if (this._destroyed) {
+ return;
+ }
+
+ if (!val) this._item = null;
+ if (this._item && this._item.id === val.id) return;
+
+ this._lastHtmlValue = val.note;
+
+ this._item = val;
+
+ this.initEditor();
+
+ // var parentKey = this._item.parentKey;
+ // if (parentKey) {
+ // this.parentItem = Zotero.Items.getByLibraryAndKey(this._item.libraryID, parentKey);
+ // }
+
+ this._id('links-box').item = this._item;
+ })();
+ ]]>
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ return (async () => {
+
+ })();
+ ]]>