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
This commit is contained in:
windingwind 2024-05-16 16:40:54 +08:00 committed by Dan Stillman
parent 1f322cddb8
commit 7fa7cf310e
6 changed files with 97 additions and 117 deletions

View file

@ -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) => {

View file

@ -454,6 +454,8 @@
}
else {
objbox.item = item;
objbox.render && objbox.render();
objbox.asyncRender && objbox.asyncRender();
}
}

View file

@ -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;
}

View file

@ -34,18 +34,25 @@
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
onload="Zotero_Merge_Window.init()"
drawintitlebar-platforms="mac"
style="min-width: 830px; min-height: 500px;"
>
<wizard id="merge-window" title="">
<linkset>
<html:link rel="localization" href="toolkit/global/wizard.ftl"/>
</linkset>
<script>
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
Services.scriptloader.loadSubScript("chrome://zotero/content/include.js", this);
Services.scriptloader.loadSubScript("chrome://zotero/content/customElements.js", this);
Services.scriptloader.loadSubScript("chrome://zotero/content/titlebar.js", this);
Services.scriptloader.loadSubScript("chrome://zotero/content/components/annotation.js", this);
Services.scriptloader.loadSubScript("chrome://zotero/content/merge.js", this);
</script>
<wizardpage label="&zotero.merge.title;" pageid="page-id">
<description id="zotero-merge-instructions"/>
<html:span id="zotero-merge-instructions"></html:span>
<merge-group flex="1"/>
<separator class="thin"/>
<hbox align="center">

View file

@ -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;
}

76
scss/merge.scss Normal file
View file

@ -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;
}