From 7fa7cf310e95eb5da7bfde583a4a7757855b524f Mon Sep 17 00:00:00 2001 From: windingwind <33902321+windingwind@users.noreply.github.com> Date: Thu, 16 May 2024 16:40:54 +0800 Subject: [PATCH] Fix merge window (#4130) - Fix render issues - Fix merge pane min-width - Use no-titlebar modal for merge window on MacOS - Disable section collapsing in merge pane - Disable section open state caching in merge pane fix: #3611 --- .../zotero/elements/collapsibleSection.js | 11 +- chrome/content/zotero/elements/mergeGroup.js | 2 + chrome/content/zotero/merge.js | 2 +- chrome/content/zotero/merge.xhtml | 9 +- chrome/skin/default/zotero/merge.css | 114 ------------------ scss/merge.scss | 76 ++++++++++++ 6 files changed, 97 insertions(+), 117 deletions(-) delete mode 100644 chrome/skin/default/zotero/merge.css create mode 100644 scss/merge.scss diff --git a/chrome/content/zotero/elements/collapsibleSection.js b/chrome/content/zotero/elements/collapsibleSection.js index 14e76e5814..b60ef1af19 100644 --- a/chrome/content/zotero/elements/collapsibleSection.js +++ b/chrome/content/zotero/elements/collapsibleSection.js @@ -282,10 +282,15 @@ } _saveOpenState() { + if (this._disableCachingOpenState) return; Zotero.Prefs.set(`panes.${this.dataset.pane}.open`, this.open); } _restoreOpenState() { + if (this._disableCachingOpenState) { + this.open = true; + return; + } this._restoringOpenState = true; this.open = Zotero.Prefs.get(`panes.${this.dataset.pane}.open`) ?? true; this._restoringOpenState = false; @@ -304,7 +309,11 @@ } get _disableCollapsing() { - return !!this.closest('panel, menupopup'); + return !!this.closest('panel, menupopup, merge-pane'); + } + + get _disableCachingOpenState() { + return !!this.closest('merge-pane'); } _handleClick = (event) => { diff --git a/chrome/content/zotero/elements/mergeGroup.js b/chrome/content/zotero/elements/mergeGroup.js index 6a08162d3c..276cf6186f 100644 --- a/chrome/content/zotero/elements/mergeGroup.js +++ b/chrome/content/zotero/elements/mergeGroup.js @@ -454,6 +454,8 @@ } else { objbox.item = item; + objbox.render && objbox.render(); + objbox.asyncRender && objbox.asyncRender(); } } diff --git a/chrome/content/zotero/merge.js b/chrome/content/zotero/merge.js index 1b44cbedbe..eea0f3dfe0 100644 --- a/chrome/content/zotero/merge.js +++ b/chrome/content/zotero/merge.js @@ -340,7 +340,7 @@ var Zotero_Merge_Window = new function () { } msg = Zotero.getString('sync.conflict.' + msg, buttonName) - document.getElementById('zotero-merge-instructions').value = msg; + document.getElementById('zotero-merge-instructions').textContent = msg; } diff --git a/chrome/content/zotero/merge.xhtml b/chrome/content/zotero/merge.xhtml index 5ebe7418d1..e3fa264e4f 100644 --- a/chrome/content/zotero/merge.xhtml +++ b/chrome/content/zotero/merge.xhtml @@ -34,18 +34,25 @@ + + + + - + diff --git a/chrome/skin/default/zotero/merge.css b/chrome/skin/default/zotero/merge.css deleted file mode 100644 index 11bdff4766..0000000000 --- a/chrome/skin/default/zotero/merge.css +++ /dev/null @@ -1,114 +0,0 @@ -/* merge.xhtml */ -wizard { - padding-left: 10px; - padding-right: 10px; -} - -wizardpage { - min-width: 762px; - min-height: 300px; -} - -wizard .wizard-header label.wizard-header-label { - margin-left: 0; -} - -/* different order on windows */ -wizard > hbox button[dlgtype=cancel] { - margin-left: 0; -} - -wizard > hbox button[dlgtype=next][disabled=false], -wizard > hbox button[dlgtype=next]:not([disabled]) { - margin-right: 0; -} - -wizard > hbox button:last-child { - margin-right: 0; -} - -wizardpage > description { - margin-left: 10px; -} - -#zotero-merge-button-name { - margin: 0; -} - -wizard > deck { - margin: 0; - padding: 0; -} - - -#resolve-all { - font-size: 1.1em; -} - -#zotero-step-count label:first-child { - margin-left: 0; - font-weight: 600; -} - -#zotero-step-count label { - font-size: 1.1em; -} - -#zotero-step-count label:last-child { - margin-right: 1em; - font-weight: 600; -} - - - -/* Merge Group */ -merge-group { - display: flex; -} - -merge-pane { - flex: 1; - display: flex; - flex-direction: column; - min-width: 26em; -} - -merge-pane groupbox { - flex: 1; -} - -merge-pane[selected=true] h2, -merge-pane[selected=true] attachment-box #title { - color: red; - font-weight: 600; - text-decoration: underline; -} - -merge-group:not([mergetype="note"]) #left-pane:active h2, -merge-group:not([mergetype="note"]) #right-pane:active h2, -merge-group:not([mergetype="note"]) #left-pane:active attachment-box #title, -merge-group:not([mergetype="note"]) #right-pane:active attachment-box #title { - color: red; - font-weight: 600; -} - -#left-pane:hover:not([selected=true]) h2, -#left-pane groupbox:focus:not([selected=true]) h2, -#right-pane:hover:not([selected=true]) h2, -#right-pane groupbox:focus:not([selected=true]) h2 { - text-decoration: underline; -} - -merge-pane .parent-row { - margin: 7px 5px; -} - -merge-pane .parent-row span { - font-weight: 600; -} - -merge-pane .delete-box { - min-width: 15em; - -moz-box-align: center; - -moz-box-pack: center; -} diff --git a/scss/merge.scss b/scss/merge.scss new file mode 100644 index 0000000000..47d5cf8aac --- /dev/null +++ b/scss/merge.scss @@ -0,0 +1,76 @@ +wizardpage { + overflow: hidden; + min-width: 780px; + min-height: 300px; +} + +merge-group { + display: flex; + overflow: auto; + + merge-pane { + flex: 1; + display: flex; + flex-direction: column; + max-height: 0; + min-width: 250px; + + & groupbox { + flex: 1; + } + + &[selected=true] h2, + &[selected=true] attachment-box #title { + color: red; + font-weight: 600; + text-decoration: underline; + } + + .parent-row { + margin: 7px 5px; + + span { + font-weight: 600; + } + } + + .delete-box { + min-width: 15em; + } + } + + &:not([mergetype="note"]) { + #left-pane:active h2, + #right-pane:active h2, + #left-pane:active attachment-box #title, + #right-pane:active attachment-box #title { + color: red; + font-weight: 600; + } + } + + #left-pane:hover:not([selected=true]) h2, + #left-pane groupbox:focus:not([selected=true]) h2, + #right-pane:hover:not([selected=true]) h2, + #right-pane groupbox:focus:not([selected=true]) h2 { + text-decoration: underline; + } +} + +#resolve-all { + font-size: 1.1em; +} + +#zotero-step-count label:first-child { + margin-left: 0; + font-weight: 600; +} + +#zotero-step-count label { + font-size: 1.1em; +} + +#zotero-step-count label:last-child { + margin-right: 1em; + font-weight: 600; +}