diff --git a/addon/chrome/content/lib/css/dx.light.css b/addon/chrome/content/lib/css/dx.light.css index 0381f77..89f9eb1 100644 --- a/addon/chrome/content/lib/css/dx.light.css +++ b/addon/chrome/content/lib/css/dx.light.css @@ -8617,7 +8617,7 @@ left: -4px; } .dx-treeview-toggle-item-visibility::before { - content: "\f04e"; + content: "▸"; position: absolute; display: block; width: 22px; @@ -8631,7 +8631,7 @@ text-align: center; } .dx-treeview-toggle-item-visibility.dx-treeview-toggle-item-visibility-opened::before { - content: "\f001"; + content: "▾"; position: absolute; display: block; width: 22px; diff --git a/addon/chrome/content/lib/css/icons/dxicons.ttf b/addon/chrome/content/lib/css/icons/dxicons.ttf deleted file mode 100644 index 7e71077..0000000 Binary files a/addon/chrome/content/lib/css/icons/dxicons.ttf and /dev/null differ diff --git a/addon/chrome/content/lib/css/icons/dxicons.woff b/addon/chrome/content/lib/css/icons/dxicons.woff deleted file mode 100644 index 0022db2..0000000 Binary files a/addon/chrome/content/lib/css/icons/dxicons.woff and /dev/null differ diff --git a/addon/chrome/content/lib/css/icons/dxicons.woff2 b/addon/chrome/content/lib/css/icons/dxicons.woff2 deleted file mode 100644 index 264f793..0000000 Binary files a/addon/chrome/content/lib/css/icons/dxicons.woff2 and /dev/null differ diff --git a/addon/chrome/content/wizard.xul b/addon/chrome/content/wizard.xul index bc902b5..d68f7bc 100644 --- a/addon/chrome/content/wizard.xul +++ b/addon/chrome/content/wizard.xul @@ -24,12 +24,6 @@ &zotero.__addonRef__.wizard.page3.header; &zotero.__addonRef__.wizard.page3.description; - - - &zotero.__addonRef__.wizard.page5.header; - &zotero.__addonRef__.wizard.page5.description1; - &zotero.__addonRef__.wizard.page5.description2; - &zotero.__addonRef__.wizard.page4.header; @@ -37,6 +31,12 @@ &zotero.__addonRef__.wizard.page4.description2; &zotero.__addonRef__.wizard.page4.description3; + + + &zotero.__addonRef__.wizard.page5.header; + &zotero.__addonRef__.wizard.page5.description1; + &zotero.__addonRef__.wizard.page5.description2; + &zotero.__addonRef__.wizard.page6.header; &zotero.__addonRef__.wizard.page6.description1; diff --git a/addon/chrome/content/workspace.xul b/addon/chrome/content/workspace.xul index ca5dde6..021d3a0 100644 --- a/addon/chrome/content/workspace.xul +++ b/addon/chrome/content/workspace.xul @@ -31,17 +31,11 @@ - +
-
-
- - Knowledge Outline -
-
@@ -50,29 +44,54 @@ - +
-
+ + + + + Select Main Note
-
+ + + + + Switch Outline Mode
-
+ + + + + + Add Heading
-
+ + + + + Decrease the selected Heading level
-
+ + + + + Raise the selected Heading level
-
+ + + + + Open User Guide
diff --git a/addon/chrome/skin/default/Knowledge4Zotero/workspace.css b/addon/chrome/skin/default/Knowledge4Zotero/workspace.css index 0b99348..5741d03 100644 --- a/addon/chrome/skin/default/Knowledge4Zotero/workspace.css +++ b/addon/chrome/skin/default/Knowledge4Zotero/workspace.css @@ -37,25 +37,48 @@ li { .tooltip { position: relative; display: inline-block; - border-bottom: 1px dotted black; } .tooltip .tooltiptext { visibility: hidden; - width: 120px; - background-color: black; + width: 80px; + background-color: rgb(77, 77, 77); color: #fff; text-align: center; - border-radius: 6px; + border-radius: 3px; padding: 5px 0; position: absolute; z-index: 1; bottom: 100%; left: 50%; - margin-left: -60px; + margin-left: -40px; } .tooltip:hover .tooltiptext { visibility: visible; } + +.tool-button { + width: 36px; + max-width: 36px; + min-width: 36px; + height: 36px; + max-height: 36px; + min-height: 36px; + border-radius: 3px; + font-family: Arial; + background: #fbfbfb; + border: solid #c9c9c9 1px; + text-decoration: none; +} + +.tool-button:hover { + background: #e2e2e2; + text-decoration: none; +} + +.tool-button:active { + background: #b3b3b3; + text-decoration: none; +} \ No newline at end of file diff --git a/package.json b/package.json index 596cb37..e7f4a75 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ }, "devDependencies": { "@types/jquery": "^3.5.14", + "@types/node": "^17.0.31", "release-it": "^14.14.0" } } diff --git a/src/views.ts b/src/views.ts index ba45f06..3a03cdc 100644 --- a/src/views.ts +++ b/src/views.ts @@ -23,7 +23,7 @@ class AddonViews extends AddonBase { export: ``, close: ``, openWorkspaceCollectionView: ``, - switchView: ``, + note: ``, }; this.currentOutline = OutlineType.treeView; this._initIframe = Zotero.Promise.defer(); @@ -381,6 +381,111 @@ class AddonViews extends AddonBase { initKnowledgeWindow(_window: Window) { _window.addEventListener("message", (e) => this.messageHandler(e), false); this.currentOutline = OutlineType.treeView; + _window.document + .getElementById("outline-selectknowledge") + .addEventListener("click", async (e) => { + this._Addon.events.onEditorEvent( + new EditorMessage("selectMainKnowledge", {}) + ); + }); + _window.document + .getElementById("outline-switchview") + .addEventListener("click", async (e) => { + this.switchView(); + }); + _window.document + .getElementById("outline-addafter") + .addEventListener("click", async (e) => { + let node = this._Addon.knowledge.getNoteTreeNodeById( + undefined, + this._Addon.knowledge.currentNodeID + ); + if (node.model.rank === 7) { + this.showProgressWindow("Knowledge", "Please select a Heading."); + return; + } + const text = prompt("Enter new heading:"); + this._Addon.knowledge.openWorkspaceWindow(); + if (text.trim()) { + if (this._Addon.knowledge.currentNodeID < 0) { + // Add a new H1 + this._Addon.knowledge.addSubLineToNote( + undefined, + `

${text}

`, + -1 + ); + return; + } + this._Addon.knowledge.addSubLineToNote( + undefined, + `${text}`, + node.model.endIndex + ); + } + }); + _window.document + .getElementById("outline-indent") + .addEventListener("click", async (e) => { + if (this._Addon.knowledge.currentNodeID < 0) { + this.showProgressWindow("Knowledge", "Please select a Heading."); + return; + } + let node = this._Addon.knowledge.getNoteTreeNodeById( + undefined, + this._Addon.knowledge.currentNodeID + ); + if (node.model.rank === 7) { + this.showProgressWindow("Knowledge", "Please select a Heading."); + return; + } + if (node.model.rank === 6) { + this.showProgressWindow( + "Knowledge", + "Cannot decrease a level 6 Heading." + ); + return; + } + this._Addon.knowledge.changeHeadingLineInNote( + undefined, + 1, + node.model.lineIndex + ); + }); + _window.document + .getElementById("outline-unindent") + .addEventListener("click", async (e) => { + if (this._Addon.knowledge.currentNodeID < 0) { + this.showProgressWindow("Knowledge", "Please select a Heading."); + return; + } + let node = this._Addon.knowledge.getNoteTreeNodeById( + undefined, + this._Addon.knowledge.currentNodeID + ); + if (node.model.rank === 7) { + this.showProgressWindow("Knowledge", "Please select a Heading."); + return; + } + if (node.model.rank === 1) { + this.showProgressWindow( + "Knowledge", + "Cannot raise a level 1 Heading." + ); + return; + } + this._Addon.knowledge.changeHeadingLineInNote( + undefined, + -1, + node.model.lineIndex + ); + }); + _window.document + .getElementById("user-guide") + .addEventListener("click", async (e) => { + this._Addon.events.onEditorEvent( + new EditorMessage("openUserGuide", {}) + ); + }); } async messageHandler(e) { @@ -477,7 +582,7 @@ class AddonViews extends AddonBase { id: String(node.model.id), name: node.model.name, rank: node.model.rank, - icon: node.model.rank === 7 ? "textdocument" : undefined, + icon: node.model.rank === 7 ? this.editorIcon["note"] : undefined, lineIndex: node.model.lineIndex, endIndex: node.model.endIndex, isDirectory: node.hasChildren(), @@ -501,7 +606,7 @@ class AddonViews extends AddonBase { items, expandNodesRecursive: false, dataStructure: "plain", - height: this.$("window").height() - 130, + height: this.$("window").height() - 100, displayExpr: "name", noDataText: "Create a heading with '+'", onItemClick: (e) => { @@ -511,121 +616,6 @@ class AddonViews extends AddonBase { }) ); }, - onItemSelectionChanged: (e) => { - console.log(e); - }, - }); - this.$("#outline-selectknowledge").dxButton({ - icon: "folder", - onClick: async (e) => { - this._Addon.events.onEditorEvent( - new EditorMessage("selectMainKnowledge", {}) - ); - }, - }); - this.$("#outline-switchview").dxButton({ - // icon: this.editorIcon["switchView"], - icon: "chart", - onClick: async (e) => { - this.switchView(); - }, - }); - this.$("#outline-addafter").dxButton({ - icon: "plus", - onClick: (e) => { - let node = this._Addon.knowledge.getNoteTreeNodeById( - undefined, - this._Addon.knowledge.currentNodeID - ); - if (node.model.rank === 7) { - this.showProgressWindow("Knowledge", "Please select a Heading."); - return; - } - const text = prompt("Enter new heading:"); - this._Addon.knowledge.openWorkspaceWindow(); - if (text.trim()) { - if (this._Addon.knowledge.currentNodeID < 0) { - // Add a new H1 - this._Addon.knowledge.addSubLineToNote( - undefined, - `

${text}

`, - -1 - ); - return; - } - this._Addon.knowledge.addSubLineToNote( - undefined, - `${text}`, - node.model.endIndex - ); - } - }, - }); - this.$("#outline-tab").dxButton({ - icon: "increaseindent", - onClick: (e) => { - if (this._Addon.knowledge.currentNodeID < 0) { - this.showProgressWindow("Knowledge", "Please select a Heading."); - return; - } - let node = this._Addon.knowledge.getNoteTreeNodeById( - undefined, - this._Addon.knowledge.currentNodeID - ); - if (node.model.rank === 7) { - this.showProgressWindow("Knowledge", "Please select a Heading."); - return; - } - if (node.model.rank === 6) { - this.showProgressWindow( - "Knowledge", - "Cannot decrease a level 6 Heading." - ); - return; - } - this._Addon.knowledge.changeHeadingLineInNote( - undefined, - 1, - node.model.lineIndex - ); - }, - }); - this.$("#outline-untab").dxButton({ - icon: "decreaseindent", - onClick: (e) => { - if (this._Addon.knowledge.currentNodeID < 0) { - this.showProgressWindow("Knowledge", "Please select a Heading."); - return; - } - let node = this._Addon.knowledge.getNoteTreeNodeById( - undefined, - this._Addon.knowledge.currentNodeID - ); - if (node.model.rank === 7) { - this.showProgressWindow("Knowledge", "Please select a Heading."); - return; - } - if (node.model.rank === 1) { - this.showProgressWindow( - "Knowledge", - "Cannot raise a level 1 Heading." - ); - return; - } - this._Addon.knowledge.changeHeadingLineInNote( - undefined, - -1, - node.model.lineIndex - ); - }, - }); - this.$("#user-guide").dxButton({ - icon: "tips", - onClick: (e) => { - this._Addon.events.onEditorEvent( - new EditorMessage("openUserGuide", {}) - ); - }, }); } @@ -637,7 +627,7 @@ class AddonViews extends AddonBase { setTreeViewSize() { this.$("#treeview").css({ - height: `${this.$("window").height() - 130}px`, + height: `${this.$("window").height() - 100}px`, width: `${this.$("#zotero-knowledge-outline").width() - 10}px`, }); this.$("#mindmapIframe").css({