fix: redesign

This commit is contained in:
windingwind 2024-01-23 19:49:38 +08:00
parent f976d60591
commit 4aade5b40e
16 changed files with 229 additions and 316 deletions

View File

@ -5,6 +5,11 @@
<meta charset="utf-8" />
</head>
<body>
<link
rel="stylesheet"
type="text/css"
href="chrome://zotero-platform/content/zotero.css"
/>
<style>
html,
body {
@ -13,6 +18,8 @@
padding: 0;
margin: 0;
font-family: initial;
overflow: hidden;
background: var(--material-background);
}
#image {
position: relative;
@ -37,7 +44,7 @@
align-items: center;
}
</style>
<link rel="stylesheet" href="./tooltip.css" />
<link rel="stylesheet" href="./toolbutton.css" />
<script>
window.addEventListener("DOMContentLoaded", (e) => {
document.querySelector(".container").style["line-height"] = `${
@ -54,162 +61,138 @@
<img id="image" src="" alt="" />
</div>
<div class="toolbar">
<div class="tooltip" id="left-container">
<button id="left" class="tool-button">
<svg
t="1668665847719"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="6765"
width="18"
height="18"
>
<path
d="M641.28 278.613333l-45.226667-45.226666-278.634666 278.762666 278.613333 278.485334 45.248-45.269334-233.365333-233.237333z"
p-id="6766"
></path>
</svg>
</button>
<span class="tooltiptext">Previous</span>
</div>
<div class="tooltip" id="right-container">
<button id="right" class="tool-button">
<svg
t="1668665870223"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="6907"
width="18"
height="18"
>
<path
d="M593.450667 512.128L360.064 278.613333l45.290667-45.226666 278.613333 278.762666L405.333333 790.613333l-45.226666-45.269333z"
p-id="6908"
></path>
</svg>
</button>
<span class="tooltiptext">Next</span>
</div>
<div class="tooltip" id="bigger-container">
<button id="bigger" class="tool-button">
<svg
t="1668693494267"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="14768"
width="18"
height="18"
>
<path
d="M768 448a320 320 0 1 0-320 320 320 320 0 0 0 320-320z m64 0A384 384 0 1 1 448 64a384 384 0 0 1 384 384z"
p-id="14769"
></path>
<path
d="M681.28 726.72a32 32 0 0 1 45.44-45.44l160 160a32 32 0 0 1-45.44 45.44zM320 480a32 32 0 0 1 0-64h256a32 32 0 0 1 0 64z"
p-id="14770"
></path>
<path
d="M480 576a32 32 0 0 1-64 0V320a32 32 0 0 1 64 0z"
p-id="14771"
></path>
</svg>
</button>
<span class="tooltiptext">Zoom In</span>
</div>
<div class="tooltip" id="smaller-container">
<button id="smaller" class="tool-button">
<svg
t="1668693609992"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="1659"
width="18"
height="18"
>
<path
d="M768 448a320 320 0 1 0-320 320 320 320 0 0 0 320-320z m64 0A384 384 0 1 1 448 64a384 384 0 0 1 384 384z"
p-id="1660"
></path>
<path
d="M681.28 726.72a32 32 0 0 1 45.44-45.44l160 160a32 32 0 0 1-45.44 45.44zM288 480a32 32 0 0 1 0-64h320a32 32 0 0 1 0 64z"
p-id="1661"
></path>
</svg>
</button>
<span class="tooltiptext">Zoom Out</span>
</div>
<div class="tooltip">
<button id="resetwidth" class="tool-button">
<svg
t="1668693928032"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="4264"
width="18"
height="18"
>
<path
d="M113.777 819.198 113.777 204.8c0-50.267 40.75-91.022 91.02-91.022l614.376 0c50.29 0 91.045 40.755 91.045 91.022l0 614.398c0 50.27-40.755 91.02-91.045 91.02L204.797 910.218C154.527 910.218 113.777 869.468 113.777 819.198zM796.438 841.953c25.125 0 45.51-20.385 45.51-45.51L841.948 227.554c0-25.122-20.385-45.51-45.505-45.51L227.552 182.044c-25.125 0-45.535 20.387-45.535 45.51l0 568.889c0 25.125 20.39 45.51 45.535 45.51L796.438 841.953zM623.043 603.269l57.115-57.14L344.357 546.129l55.5 55.505c13.31 13.335 13.335 34.93 0 48.265-13.335 13.33-34.95 13.33-48.29 0l-105.765-105.77c-3.415-1.615-6.78-3.525-9.625-6.37-7.08-7.1-10.1-16.475-9.67-25.76-0.46-9.262 2.59-18.66 9.69-25.76 2.85-2.842 6.15-4.8 9.58-6.348l105.79-105.79c13.34-13.335 34.955-13.335 48.29 0 13.31 13.332 13.335 34.927 0 48.262l-55.5 55.502 335.802 0-57.115-57.117c-13.355-13.335-13.335-34.952 0-48.287s34.93-13.335 48.265 0l115.37 115.395c13.335 13.332 13.36 34.927 0 48.262l-115.37 115.395c-13.335 13.335-34.95 13.335-48.265 0C609.708 638.198 609.708 616.583 623.043 603.269z"
p-id="4265"
></path>
</svg>
</button>
<span class="tooltiptext">Reset Width</span>
</div>
<div class="tooltip">
<button id="copy" class="tool-button">
<svg
t="1668688365150"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="5240"
width="18"
height="18"
>
<path
d="M851.025513 737.324862 400.356301 737.324862c-62.219566 0-112.666535-50.444902-112.666535-112.662943L287.689766 174.012196c0-62.217017 50.446969-112.662943 112.666535-112.662943l450.670235 0c62.219566 0 112.666535 50.444902 112.666535 112.662943l0 450.650747C963.692048 686.879959 913.245079 737.324862 851.025513 737.324862zM907.35878 174.012196c0-31.108508-25.223485-56.33096-56.333268-56.33096L400.356301 117.681236c-31.109783 0-56.334291 25.222451-56.334291 56.33096l0 450.650747c0 31.108508 25.223485 56.331983 56.334291 56.331983l450.670235 0c31.10876 0 56.333268-25.222451 56.333268-56.331983L907.359804 174.012196zM118.687916 399.337057 118.687916 849.988828c0 31.107485 25.223485 56.33096 56.333268 56.33096l450.669212 0c31.109783 0 56.334291-25.222451 56.334291-56.33096l0-56.331983 56.333268 0 0 56.331983c0 62.217017-50.446969 112.660896-112.667559 112.660896L175.021184 962.649723c-62.219566 0-112.667559-50.443879-112.667559-112.660896L62.353625 399.337057c0-62.217017 50.446969-112.662943 112.667559-112.662943l56.334291 0 0 56.33096-56.334291 0C143.9114 343.005075 118.687916 368.228549 118.687916 399.337057z"
p-id="5241"
></path>
</svg>
</button>
<span class="tooltiptext">Copy</span>
</div>
<div class="tooltip">
<button id="save" class="tool-button">
<svg
t="1668693439021"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="13783"
width="18"
height="18"
>
<path
d="M782.54 912.837H241.46C167.323 912.837 107 852.56 107 778.4V245.623c0-74.16 60.323-134.483 134.46-134.483h541.102C856.678 111.162 917 171.462 917 245.623V778.4c0 74.16-60.3 134.438-134.46 134.438zM241.46 163.632c-45.225 0-82.012 36.765-82.012 82.013V778.4c0 45.225 36.787 82.035 82.012 82.035h541.102c45.225 0 82.013-36.81 82.013-82.035V245.623c0-45.248-36.788-82.013-82.013-82.013H241.46v0.022zM771.312 513.26H252.688V111.163h518.648V513.26h-0.022z m-466.2-52.47h413.775V163.632H305.114v297.159zM589.22 240.808h52.425v174.846H589.22V240.807z m0 0"
p-id="13784"
></path>
</svg>
</button>
<span class="tooltiptext">Save</span>
</div>
<div class="tooltip">
<button id="pin" class="tool-button"></button>
<span id="pin-tooltip" class="tooltiptext"></span>
</div>
<button id="left" class="tool-button" title="Previous">
<svg
t="1668665847719"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="6765"
width="18"
height="18"
>
<path
d="M641.28 278.613333l-45.226667-45.226666-278.634666 278.762666 278.613333 278.485334 45.248-45.269334-233.365333-233.237333z"
p-id="6766"
></path>
</svg>
</button>
<button id="right" class="tool-button" title="Next">
<svg
t="1668665870223"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="6907"
width="18"
height="18"
>
<path
d="M593.450667 512.128L360.064 278.613333l45.290667-45.226666 278.613333 278.762666L405.333333 790.613333l-45.226666-45.269333z"
p-id="6908"
></path>
</svg>
</button>
<button id="bigger" class="tool-button" title="Zoom In">
<svg
t="1668693494267"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="14768"
width="18"
height="18"
>
<path
d="M768 448a320 320 0 1 0-320 320 320 320 0 0 0 320-320z m64 0A384 384 0 1 1 448 64a384 384 0 0 1 384 384z"
p-id="14769"
></path>
<path
d="M681.28 726.72a32 32 0 0 1 45.44-45.44l160 160a32 32 0 0 1-45.44 45.44zM320 480a32 32 0 0 1 0-64h256a32 32 0 0 1 0 64z"
p-id="14770"
></path>
<path
d="M480 576a32 32 0 0 1-64 0V320a32 32 0 0 1 64 0z"
p-id="14771"
></path>
</svg>
</button>
<button id="smaller" class="tool-button" title="Zoom Out">
<svg
t="1668693609992"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="1659"
width="18"
height="18"
>
<path
d="M768 448a320 320 0 1 0-320 320 320 320 0 0 0 320-320z m64 0A384 384 0 1 1 448 64a384 384 0 0 1 384 384z"
p-id="1660"
></path>
<path
d="M681.28 726.72a32 32 0 0 1 45.44-45.44l160 160a32 32 0 0 1-45.44 45.44zM288 480a32 32 0 0 1 0-64h320a32 32 0 0 1 0 64z"
p-id="1661"
></path>
</svg>
</button>
<button id="resetwidth" class="tool-button" title="Reset Width">
<svg
t="1668693928032"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="4264"
width="18"
height="18"
>
<path
d="M113.777 819.198 113.777 204.8c0-50.267 40.75-91.022 91.02-91.022l614.376 0c50.29 0 91.045 40.755 91.045 91.022l0 614.398c0 50.27-40.755 91.02-91.045 91.02L204.797 910.218C154.527 910.218 113.777 869.468 113.777 819.198zM796.438 841.953c25.125 0 45.51-20.385 45.51-45.51L841.948 227.554c0-25.122-20.385-45.51-45.505-45.51L227.552 182.044c-25.125 0-45.535 20.387-45.535 45.51l0 568.889c0 25.125 20.39 45.51 45.535 45.51L796.438 841.953zM623.043 603.269l57.115-57.14L344.357 546.129l55.5 55.505c13.31 13.335 13.335 34.93 0 48.265-13.335 13.33-34.95 13.33-48.29 0l-105.765-105.77c-3.415-1.615-6.78-3.525-9.625-6.37-7.08-7.1-10.1-16.475-9.67-25.76-0.46-9.262 2.59-18.66 9.69-25.76 2.85-2.842 6.15-4.8 9.58-6.348l105.79-105.79c13.34-13.335 34.955-13.335 48.29 0 13.31 13.332 13.335 34.927 0 48.262l-55.5 55.502 335.802 0-57.115-57.117c-13.355-13.335-13.335-34.952 0-48.287s34.93-13.335 48.265 0l115.37 115.395c13.335 13.332 13.36 34.927 0 48.262l-115.37 115.395c-13.335 13.335-34.95 13.335-48.265 0C609.708 638.198 609.708 616.583 623.043 603.269z"
p-id="4265"
></path>
</svg>
</button>
<button id="copy" class="tool-button" title="Copy">
<svg
t="1668688365150"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="5240"
width="18"
height="18"
>
<path
d="M851.025513 737.324862 400.356301 737.324862c-62.219566 0-112.666535-50.444902-112.666535-112.662943L287.689766 174.012196c0-62.217017 50.446969-112.662943 112.666535-112.662943l450.670235 0c62.219566 0 112.666535 50.444902 112.666535 112.662943l0 450.650747C963.692048 686.879959 913.245079 737.324862 851.025513 737.324862zM907.35878 174.012196c0-31.108508-25.223485-56.33096-56.333268-56.33096L400.356301 117.681236c-31.109783 0-56.334291 25.222451-56.334291 56.33096l0 450.650747c0 31.108508 25.223485 56.331983 56.334291 56.331983l450.670235 0c31.10876 0 56.333268-25.222451 56.333268-56.331983L907.359804 174.012196zM118.687916 399.337057 118.687916 849.988828c0 31.107485 25.223485 56.33096 56.333268 56.33096l450.669212 0c31.109783 0 56.334291-25.222451 56.334291-56.33096l0-56.331983 56.333268 0 0 56.331983c0 62.217017-50.446969 112.660896-112.667559 112.660896L175.021184 962.649723c-62.219566 0-112.667559-50.443879-112.667559-112.660896L62.353625 399.337057c0-62.217017 50.446969-112.662943 112.667559-112.662943l56.334291 0 0 56.33096-56.334291 0C143.9114 343.005075 118.687916 368.228549 118.687916 399.337057z"
p-id="5241"
></path>
</svg>
</button>
<button id="save" class="tool-button" title="Save">
<svg
t="1668693439021"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="13783"
width="18"
height="18"
>
<path
d="M782.54 912.837H241.46C167.323 912.837 107 852.56 107 778.4V245.623c0-74.16 60.323-134.483 134.46-134.483h541.102C856.678 111.162 917 171.462 917 245.623V778.4c0 74.16-60.3 134.438-134.46 134.438zM241.46 163.632c-45.225 0-82.012 36.765-82.012 82.013V778.4c0 45.225 36.787 82.035 82.012 82.035h541.102c45.225 0 82.013-36.81 82.013-82.035V245.623c0-45.248-36.788-82.013-82.013-82.013H241.46v0.022zM771.312 513.26H252.688V111.163h518.648V513.26h-0.022z m-466.2-52.47h413.775V163.632H305.114v297.159zM589.22 240.808h52.425v174.846H589.22V240.807z m0 0"
p-id="13784"
></path>
</svg>
</button>
<button id="pin" class="tool-button" title="Pin"></button>
</div>
</body>
</html>

View File

@ -8,7 +8,7 @@
type="text/css"
href="chrome://__addonRef__/content/lib/css/dx.light.compact.css"
/>
<link rel="stylesheet" href="chrome://__addonRef__/content/tooltip.css" />
<link rel="stylesheet" href="chrome://__addonRef__/content/toolbutton.css" />
<link
rel="stylesheet"
type="text/css"

View File

@ -8,8 +8,6 @@
<!-- prettier-ignore -->
<?xml-stylesheet href="chrome://zotero-platform/content/zotero.css" type="text/css"?>
<!-- prettier-ignore -->
<?xml-stylesheet href="chrome://__addonRef__/content/virtualizedTable.css" type="text/css"?>
<!-- prettier-ignore -->
<!DOCTYPE html>
<html
lang="en"

View File

@ -8,8 +8,6 @@
<!-- prettier-ignore -->
<?xml-stylesheet href="chrome://zotero-platform/content/zotero.css" type="text/css"?>
<!-- prettier-ignore -->
<?xml-stylesheet href="chrome://__addonRef__/content/virtualizedTable.css" type="text/css"?>
<!-- prettier-ignore -->
<!DOCTYPE html>
<html
lang="en"

View File

@ -0,0 +1,28 @@
.tool-button {
position: relative;
display: inline-block;
width: 36px;
max-width: 36px;
min-width: 36px;
height: 36px;
max-height: 36px;
min-height: 36px;
border-radius: 5px;
font-family: Arial;
background: transparent;
border: none;
text-decoration: none;
user-select: none;
-moz-user-select: none;
fill: currentColor;
}
.tool-button:hover {
background: var(--fill-quinary);
text-decoration: none;
}
.tool-button:active {
background: var(--fill-quarternary);
text-decoration: none;
}

View File

@ -1,65 +0,0 @@
.tooltip {
position: relative;
display: inline-block;
}
.tooltip .tooltiptext {
visibility: hidden;
width: 80px;
background-color: rgb(77, 77, 77);
color: #fff;
text-align: center;
border-radius: 3px;
padding: 5px 0;
position: absolute;
z-index: 1;
bottom: 100%;
left: 50%;
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;
user-select: none;
-moz-user-select: none;
}
.tool-button:hover {
background: #e2e2e2;
text-decoration: none;
}
.tool-button:active {
background: #b3b3b3;
text-decoration: none;
}
@media (prefers-color-scheme: dark) {
.tool-button {
background: #2e2e2e;
border: solid #797979 1px;
}
.tool-button:hover {
background: #494949;
}
.tool-button:active {
background: #5c5c5c;
}
}

View File

@ -3,6 +3,16 @@
<body>
<script src="chrome://__addonRef__/content/lib/js/jquery.min.js"></script>
<script src="chrome://__addonRef__/content/lib/js/dx.all.js"></script>
<link
rel="stylesheet"
type="text/css"
href="chrome://zotero-platform/content/zotero.css"
/>
<link
rel="stylesheet"
type="text/css"
href="chrome://__addonRef__/content/lib/css/dx.light.compact.css"
/>
<style>
html,
body,
@ -33,7 +43,7 @@
}
#treeview {
padding: 20px 0 0 20px;
padding: 20px;
}
.drive-header {
@ -59,25 +69,22 @@
}
#outline-container {
color: -moz-DialogText;
color: var(--fill-primary);
}
.dx-treeview-toggle-item-visibility {
color: currentColor !important;
color: var(--fill-primary);
}
@media (prefers-color-scheme: dark) {
:not(.dx-state-focused) > .dx-treeview-item.dx-state-hover {
background-color: #494949;
color: #fff;
}
:not(.dx-state-focused) > .dx-treeview-item.dx-state-hover {
color: var(--fill-primary);
background-color: var(--fill-quinary);
}
.dx-state-focused > .dx-treeview-item {
background-color: var(--color-accent) !important;
}
</style>
<link
rel="stylesheet"
type="text/css"
href="chrome://__addonRef__/content/lib/css/dx.light.compact.css"
/>
<div
class="dx-viewport"
id="outline-container"

View File

@ -1,5 +0,0 @@
.virtualized-table {
height: 100%;
-moz-user-select: none;
user-select: none;
}

View File

@ -50,14 +50,6 @@
"chrome://zotero/content/elements/noteEditor.js",
this,
);
Services.scriptloader.loadSubScript(
"chrome://zotero/content/elements/relatedBox.js",
this,
);
Services.scriptloader.loadSubScript(
"chrome://zotero/content/elements/tagsBox.js",
this,
);
}
}
window.arguments[0]._initPromise.resolve();

View File

@ -13,7 +13,7 @@
"zotero": {
"id": "__addonID__",
"update_url": "__updateURL__",
"strict_min_version": "6.999",
"strict_min_version": "7.0.0-beta.55",
"strict_max_version": "7.0.*"
}
}

View File

@ -7,7 +7,7 @@
"update_link": "__updateLink__",
"applications": {
"zotero": {
"strict_min_version": "6.999"
"strict_min_version": "7.0.0-beta.55"
}
}
}

View File

@ -107,18 +107,16 @@ export async function showImageViewer(
);
}
});
addon.data.imageViewer.window.document.querySelector("#pin")!.innerHTML =
addon.data.imageViewer.pined
? ICONS.imageViewerPined
: ICONS.imageViewerPin;
addon.data.imageViewer.window.document.querySelector(
"#pin-tooltip",
)!.innerHTML = addon.data.imageViewer.pined ? "Unpin" : "Pin";
addon.data.imageViewer.window.document
.querySelector("#pin")
?.addEventListener("click", (e) => {
setPin();
});
const pin = addon.data.imageViewer.window.document.querySelector(
"#pin",
) as HTMLButtonElement;
pin.innerHTML = addon.data.imageViewer.pined
? ICONS.imageViewerPined
: ICONS.imageViewerPin;
pin.title = addon.data.imageViewer.pined ? "Unpin" : "Pin";
pin?.addEventListener("click", (e) => {
setPin();
});
addon.data.imageViewer.window.addEventListener("keydown", (e) => {
// ctrl+w or esc
if ((e.key === "w" && e.ctrlKey) || e.keyCode === 27) {

View File

@ -23,30 +23,18 @@ export function initWorkspace(container: XUL.Box | undefined) {
callback: (ev: Event) => void,
) {
return {
tag: "div",
id,
classList: ["tooltip"],
children: [
tag: "button",
namespace: "html",
classList: ["tool-button"],
properties: {
innerHTML: content,
title,
},
listeners: [
{
tag: "button",
namespace: "html",
classList: ["tool-button"],
properties: {
innerHTML: content,
},
listeners: [
{
type: "click",
listener: callback,
},
],
},
{
tag: "span",
classList: ["tooltiptext"],
properties: {
innerHTML: title,
},
type: "click",
listener: callback,
},
],
};
@ -79,7 +67,7 @@ export function initWorkspace(container: XUL.Box | undefined) {
tag: "link",
properties: {
rel: "stylesheet",
href: `chrome://${config.addonRef}/content/tooltip.css`,
href: `chrome://${config.addonRef}/content/toolbutton.css`,
},
},
{
@ -158,6 +146,9 @@ export function initWorkspace(container: XUL.Box | undefined) {
flex: "1",
width: "700",
},
styles: {
background: "var(--material-background50)",
},
},
{
tag: "splitter",
@ -203,6 +194,7 @@ export function initWorkspace(container: XUL.Box | undefined) {
const outlineContainer = container.querySelector(
`#${makeId("outline-container")}`,
) as XUL.Box;
outlineContainer.style.background = "var(--material-sidepane)";
const outlineMut = new (ztoolkit.getGlobal("MutationObserver"))(
(mutations) => {
if (outlineContainer.getAttribute("collapsed") === "true") {

View File

@ -60,24 +60,11 @@ async function addWorkspaceTab() {
tabElem.style.width = "30px";
tabElem.style.minWidth = "30px";
tabElem.style.maxWidth = "30px";
tabElem.style.padding = "0px";
const content = tabElem.querySelector(".tab-name") as HTMLDivElement;
const close = tabElem.querySelector(".tab-close") as HTMLDivElement;
content.style.verticalAlign = "middle";
content.style.width = "20px";
content.style.height = "20px";
content.style.display = "inline";
content.innerHTML = "";
ztoolkit.UI.appendElement(
{
tag: "span",
classList: ["icon-bg"],
styles: {
backgroundImage: `url("chrome://${config.addonRef}/content/icons/favicon.png")`,
},
},
content,
);
close.style.visibility = "hidden";
addon.data.workspace.tab.id = id;
container.setAttribute("workspace-type", "tab");
@ -162,14 +149,15 @@ function isContextPaneInitialized() {
export async function activateWorkspaceTab() {
if (Zotero_Tabs.selectedType === TAB_TYPE && isContextPaneInitialized()) {
(
document.querySelector("#zotero-tab-toolbar") as XUL.Box
).style.visibility = "collapse";
const tabToolbar = document.querySelector("#zotero-tab-toolbar") as XUL.Box;
tabToolbar && (tabToolbar.style.visibility = "collapse");
const toolbar = document.querySelector(
"#zotero-context-toolbar-extension",
) as XUL.Box;
toolbar.style.visibility = "collapse";
toolbar.nextElementSibling?.setAttribute("selectedIndex", "1");
if (toolbar) {
toolbar.style.visibility = "collapse";
toolbar.nextElementSibling?.setAttribute("selectedIndex", "1");
}
}
if (addon.data.workspace.tab.active) {
@ -309,13 +297,12 @@ export function deActivateWorkspaceTab() {
if (!isContextPaneInitialized()) {
return;
}
(
document.querySelector("#zotero-tab-toolbar") as XUL.Box
).style.removeProperty("visibility");
const tabToolbar = document.querySelector("#zotero-tab-toolbar") as XUL.Box;
tabToolbar && tabToolbar.style.removeProperty("visibility");
const toolbar = document.querySelector(
"#zotero-context-toolbar-extension",
) as XUL.Box;
toolbar.style.removeProperty("visibility");
toolbar?.style.removeProperty("visibility");
}
function setWorkspaceTabStatus(status: boolean) {

View File

@ -148,7 +148,7 @@ export const ICONS = {
workspace_outline_open: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g><path d="M4,15.62c-.9,0-1.62-.73-1.62-1.62V2c0-.9,.73-1.62,1.62-1.62H13.62V15.62H4Z" style="fill:#fff;"/><path d="M13.25,.75V15.25H4c-.69,0-1.25-.56-1.25-1.25V2c0-.69,.56-1.25,1.25-1.25H13.25m.75-.75H4c-1.1,0-2,.9-2,2V14c0,1.1,.9,2,2,2H14V0h0Z"/></g><line x1="4.5" y1="4.5" x2="11.5" y2="4.5" style="fill:none; stroke:#000; stroke-miterlimit:10; stroke-width:.75px;"/><line x1="5.5" y1="6.5" x2="11.5" y2="6.5" style="fill:none; stroke:#000; stroke-miterlimit:10; stroke-width:.75px;"/><line x1="4.5" y1="9.5" x2="11.5" y2="9.5" style="fill:none; stroke:#000; stroke-miterlimit:10; stroke-width:.75px;"/><line x1="5.5" y1="11.5" x2="11.5" y2="11.5" style="fill:none; stroke:#000; stroke-miterlimit:10; stroke-width:.75px;"/><g><path d="M4,15.62c-.9,0-1.62-.73-1.62-1.62V2c0-.9,.73-1.62,1.62-1.62H13.62V15.62H4Z" style="fill:#678ac5;"/><path d="M13.25,.75V15.25H4c-.69,0-1.25-.56-1.25-1.25V2c0-.69,.56-1.25,1.25-1.25H13.25m.75-.75H4c-1.1,0-2,.9-2,2V14c0,1.1,.9,2,2,2H14V0h0Z" style="fill:#678ac5;"/></g><line x1="4.5" y1="4.5" x2="11.5" y2="4.5" style="fill:none; stroke:#fff; stroke-miterlimit:10; stroke-width:.75px;"/><line x1="5.5" y1="6.5" x2="11.5" y2="6.5" style="fill:none; stroke:#fff; stroke-miterlimit:10; stroke-width:.75px;"/><line x1="4.5" y1="9.5" x2="11.5" y2="9.5" style="fill:none; stroke:#fff; stroke-miterlimit:10; stroke-width:.75px;"/><line x1="5.5" y1="11.5" x2="11.5" y2="11.5" style="fill:none; stroke:#fff; stroke-miterlimit:10; stroke-width:.75px;"/></svg>`,
workspace_preview_collapsed: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g><rect x="2.38" y=".38" width="11.25" height="15.25" style="fill:#fff;"/><path d="M13.25,.75V15.25H2.75V.75H13.25m.75-.75H2V16H14V0h0Z" style="fill:#678ac5;"/></g><path d="M8,5.6c-2.4,0-4,2.4-4,2.4,0,0,1.6,2.4,4,2.4s4-2.4,4-2.4c0,0-1.6-2.4-4-2.4Zm0,3.98c-.88,0-1.59-.71-1.59-1.59s.71-1.59,1.59-1.59,1.59,.71,1.59,1.59c0,.88-.71,1.59-1.59,1.59Zm-.8-1.59c0,.21,.09,.42,.23,.56s.35,.23,.56,.23,.42-.09,.56-.23c.15-.15,.23-.35,.23-.56s-.09-.42-.23-.56c-.15-.15-.35-.23-.56-.23s-.42,.09-.56,.23c-.15,.15-.23,.35-.23,.56Z" style="fill:#678ac5;"/></svg>`,
workspace_preview_open: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g><rect x="2.38" y=".38" width="11.25" height="15.25" style="fill:#678ac5;"/><path d="M13.25,.75V15.25H2.75V.75H13.25m.75-.75H2V16H14V0h0Z" style="fill:#678ac5;"/></g><path d="M8,5.6c-2.4,0-4,2.4-4,2.4,0,0,1.6,2.4,4,2.4s4-2.4,4-2.4c0,0-1.6-2.4-4-2.4Zm0,3.98c-.88,0-1.59-.71-1.59-1.59s.71-1.59,1.59-1.59,1.59,.71,1.59,1.59c0,.88-.71,1.59-1.59,1.59Zm-.8-1.59c0,.21,.09,.42,.23,.56s.35,.23,.56,.23,.42-.09,.56-.23c.15-.15,.23-.35,.23-.56s-.09-.42-.23-.56c-.15-.15-.35-.23-.56-.23s-.42,.09-.56,.23c-.15,.15-.23,.35-.23,.56Z" style="fill:#fff;"/></svg>`,
workspace_notes_collapsed: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g><path d="M2.38,15.62V.38H12c.9,0,1.62,.73,1.62,1.62V14c0,.9-.73,1.62-1.62,1.62H2.38Z" style="fill:#fff;"/><path d="M12,.75c.69,0,1.25,.56,1.25,1.25V14c0,.69-.56,1.25-1.25,1.25H2.75V.75H12m0-.75H2V16H12c1.1,0,2-.9,2-2V2c0-1.1-.9-2-2-2h0Z" style="fill:#678ac5;"/></g><path d="M12.15,10.77l-1.34-1.75c.48-.45,.77-1.09,.77-1.8,0-1.37-1.12-2.49-2.49-2.49s-2.49,1.12-2.49,2.49,1.12,2.49,2.49,2.49c.44,0,.86-.12,1.22-.32l1.35,1.76c.06,.08,.15,.12,.25,.12,.07,0,.13-.02,.19-.06,.14-.1,.16-.3,.06-.43h0Zm-4.97-3.55c0-1.05,.86-1.91,1.92-1.91s1.92,.86,1.92,1.91-.86,1.91-1.92,1.91-1.92-.86-1.92-1.91h0Zm-1.21-1.25h-1.87c-.17,0-.31-.14-.31-.31s.14-.31,.31-.31h1.87c.17,0,.31,.14,.31,.31s-.14,.31-.31,.31h0Zm-.08,3.07h-1.79c-.17,0-.31-.14-.31-.31s.14-.31,.31-.31h1.79c.17,0,.31,.14,.31,.31s-.14,.31-.31,.31h0Zm-.37-1.54h-1.42c-.17,0-.31-.14-.31-.31s.14-.31,.31-.31h1.42c.17,0,.31,.14,.31,.31,0,.17-.14,.31-.31,.31h0Zm2,3.13h-3.43c-.17,0-.31-.14-.31-.31s.14-.31,.31-.31h3.43c.17,0,.31,.14,.31,.31,0,.17-.14,.31-.31,.31h0Z" style="fill:#678ac5;"/></svg>w`,
workspace_notes_collapsed: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g><path d="M2.38,15.62V.38H12c.9,0,1.62,.73,1.62,1.62V14c0,.9-.73,1.62-1.62,1.62H2.38Z" style="fill:#fff;"/><path d="M12,.75c.69,0,1.25,.56,1.25,1.25V14c0,.69-.56,1.25-1.25,1.25H2.75V.75H12m0-.75H2V16H12c1.1,0,2-.9,2-2V2c0-1.1-.9-2-2-2h0Z" style="fill:#678ac5;"/></g><path d="M12.15,10.77l-1.34-1.75c.48-.45,.77-1.09,.77-1.8,0-1.37-1.12-2.49-2.49-2.49s-2.49,1.12-2.49,2.49,1.12,2.49,2.49,2.49c.44,0,.86-.12,1.22-.32l1.35,1.76c.06,.08,.15,.12,.25,.12,.07,0,.13-.02,.19-.06,.14-.1,.16-.3,.06-.43h0Zm-4.97-3.55c0-1.05,.86-1.91,1.92-1.91s1.92,.86,1.92,1.91-.86,1.91-1.92,1.91-1.92-.86-1.92-1.91h0Zm-1.21-1.25h-1.87c-.17,0-.31-.14-.31-.31s.14-.31,.31-.31h1.87c.17,0,.31,.14,.31,.31s-.14,.31-.31,.31h0Zm-.08,3.07h-1.79c-.17,0-.31-.14-.31-.31s.14-.31,.31-.31h1.79c.17,0,.31,.14,.31,.31s-.14,.31-.31,.31h0Zm-.37-1.54h-1.42c-.17,0-.31-.14-.31-.31s.14-.31,.31-.31h1.42c.17,0,.31,.14,.31,.31,0,.17-.14,.31-.31,.31h0Zm2,3.13h-3.43c-.17,0-.31-.14-.31-.31s.14-.31,.31-.31h3.43c.17,0,.31,.14,.31,.31,0,.17-.14,.31-.31,.31h0Z" style="fill:#678ac5;"/></svg>`,
workspace_notes_open: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g><path d="M2.38,15.62V.38H12c.9,0,1.62,.73,1.62,1.62V14c0,.9-.73,1.62-1.62,1.62H2.38Z" style="fill:#678ac5;"/><path d="M12,.75c.69,0,1.25,.56,1.25,1.25V14c0,.69-.56,1.25-1.25,1.25H2.75V.75H12m0-.75H2V16H12c1.1,0,2-.9,2-2V2c0-1.1-.9-2-2-2h0Z" style="fill:#678ac5;"/></g><path d="M12.15,10.77l-1.34-1.75c.48-.45,.77-1.09,.77-1.8,0-1.37-1.12-2.49-2.49-2.49s-2.49,1.12-2.49,2.49,1.12,2.49,2.49,2.49c.44,0,.86-.12,1.22-.32l1.35,1.76c.06,.08,.15,.12,.25,.12,.07,0,.13-.02,.19-.06,.14-.1,.16-.3,.06-.43h0Zm-4.97-3.55c0-1.05,.86-1.91,1.92-1.91s1.92,.86,1.92,1.91-.86,1.91-1.92,1.91-1.92-.86-1.92-1.91h0Zm-1.21-1.25h-1.87c-.17,0-.31-.14-.31-.31s.14-.31,.31-.31h1.87c.17,0,.31,.14,.31,.31s-.14,.31-.31,.31h0Zm-.08,3.07h-1.79c-.17,0-.31-.14-.31-.31s.14-.31,.31-.31h1.79c.17,0,.31,.14,.31,.31s-.14,.31-.31,.31h0Zm-.37-1.54h-1.42c-.17,0-.31-.14-.31-.31s.14-.31,.31-.31h1.42c.17,0,.31,.14,.31,.31,0,.17-.14,.31-.31,.31h0Zm2,3.13h-3.43c-.17,0-.31-.14-.31-.31s.14-.31,.31-.31h3.43c.17,0,.31,.14,.31,.31,0,.17-.14,.31-.31,.31h0Z" style="fill:#fff;"/></svg>`,
readerQuickNote: `<svg t="1651630304116" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="14011" width="16" height="16"><path d="M791.30324 369.7c-5 5-6.2 12.7-2.8 18.9 17.5 31.9 27.4 68.5 27.4 107.4 0 56.2-20.7 107.6-54.9 147-4.5 5.1-5.1 12.6-1.8 18.4l39.2 67.9c3.3 5.7 9.6 8.7 16.1 7.8 6-0.8 12.1-1.2 18.3-1.2 70.1 0.5 128 59.7 127.1 129.7-0.9 69.7-57.4 125.9-127.1 126.4-70.9 0.5-128.9-57.1-128.9-128 0-38.1 16.7-72.3 43.1-95.8l-37-64c-4.2-7.3-13.3-10-20.9-6.4-29.3 14.2-62.3 22.2-97.2 22.2-26.7 0-52.3-4.7-76-13.2-7.3-2.6-15.4 0.3-19.3 7l-24.9 43.1c-3.1 5.4-2.8 12.1 0.8 17.2 15 21.2 23.7 47.1 23.5 75.1-0.7 69.5-57.5 126.2-127 126.8-71.6 0.6-129.8-57.7-129.1-129.4 0.8-69.7 58-126.5 127.8-126.6 12 0 23.7 1.6 34.8 4.7 7 2 14.5-1.1 18.2-7.4l21.7-37.6c3.7-6.4 2.5-14.6-2.9-19.6-33.6-31.2-57.5-72.6-67-119.2-1.5-7.5-8-12.9-15.7-12.9h-92c-6.9 0-13.1 4.5-15.2 11.1C232.80324 590.2 184.70324 627 128.00324 627 57.00324 627-0.49676 569.2 0.00324 498.1 0.40324 427.5 58.60324 370.3 129.20324 371c54.2 0.5 100.4 34.8 118.5 82.8C250.00324 460 256.00324 464 262.60324 464h94.1c7.6 0 14.2-5.3 15.7-12.7 11-54.2 41.5-101.3 84-133.6 6.4-4.9 8.2-13.8 4.2-20.8l-2.2-3.8c-3.5-6-10.3-9-17.1-7.7-8.8 1.8-18 2.7-27.4 2.5-69.5-1-126.9-60.1-126-129.6 0.9-70.3 58.4-126.9 129-126.3 69.3 0.6 126 57 127 126.2 0.4 31.6-10.6 60.7-29.3 83.2-4.3 5.2-5 12.5-1.6 18.3l6.6 11.4c3.6 6.2 10.8 9.3 17.7 7.5 17.5-4.4 35.8-6.7 54.6-6.7 52.3 0 100.4 17.9 138.6 48 6.4 5 15.5 4.5 21.2-1.2l24.2-24.2c4.7-4.7 6-11.8 3.3-17.8-7.3-16.1-11.3-34-11.3-52.8 0-70.7 57.3-128 128-128 70.6 0 128 57.4 128 128 0 70.7-57.3 128-128 128-20.7 0-40.2-4.9-57.5-13.6-6.2-3.1-13.7-2-18.7 2.9l-28.4 28.5z" p-id="14012" fill="#ffd400"></path></svg>`,
embedLinkContent: `<svg t="1652008007954" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10521" width="16" height="16"><path d="M574.3 896H159.7c-17.6 0-31.9-14.3-31.9-32V160c0-17.7 14.3-32 31.9-32h382.7v160c0 35.3 28.6 64 63.8 64h159.5v192c0 17.7 14.3 32 31.9 32 17.6 0 31.9-14.3 31.9-32V270.2c0-8.5-3.3-16.6-9.3-22.6L647.4 73.4c-6-6-14.1-9.4-22.6-9.4h-497C92.6 64 64 92.7 64 128v768c0 35.3 28.6 64 63.8 64h446.5c17.6 0 31.9-14.3 31.9-32s-14.3-32-31.9-32zM638.1 288c-17.6 0-31.9-14.3-31.9-32V128l159.5 160H638.1z" p-id="10522"></path><path d="M418.8 673H225.5c-17.6 0-31.9 14.3-31.9 32s14.3 32 31.9 32h193.3c17.6 0 31.9-14.3 31.9-32s-14.3-32-31.9-32zM608.2 481H225.5c-17.6 0-31.9 14.3-31.9 32s14.3 32 31.9 32h382.7c17.6 0 31.9-14.3 31.9-32s-14.3-32-31.9-32zM225.5 353h191.4c17.6 0 31.9-14.3 31.9-32s-14.3-32-31.9-32H225.5c-17.6 0-31.9 14.3-31.9 32s14.3 32 31.9 32zM862.7 959.4c-23.6 0-47-8.8-64.8-26.6l-24.4-24.4c-12.5-12.5-12.5-32.8 0-45.3s32.7-12.5 45.1 0l24.4 24.4c11.3 11.4 30.7 10.4 43.2-2.1 12.5-12.5 13.4-31.9 2.1-43.3L749.2 702.6c-11.3-11.4-30.7-10.4-43.2 2.1-6.2 6.3-9.8 14.4-10 22.8-0.2 7.9 2.6 15.1 7.9 20.4 12.5 12.5 12.5 32.8 0 45.3s-32.7 12.5-45.1 0c-36.2-36.3-35.2-96.3 2.1-133.8 37.4-37.5 97.2-38.4 133.4-2.1l139.1 139.5c36.2 36.3 35.2 96.3-2.1 133.8-19 19.2-43.9 28.8-68.6 28.8z" p-id="10523"></path><path d="M696.3 883.1c-23.6 0-47-8.8-64.8-26.6l-139-139.6c-17.7-17.8-27.2-41.7-26.6-67.2 0.6-25 10.8-48.6 28.7-66.6 17.9-17.9 41.5-28.2 66.4-28.8 25.5-0.6 49.3 8.9 67 26.6l24.4 24.4c12.5 12.5 12.5 32.8 0 45.3s-32.7 12.5-45.1 0l-24.4-24.4c-5.3-5.3-12.5-8.1-20.4-7.9-8.4 0.2-16.5 3.8-22.8 10-6.2 6.3-9.8 14.4-10 22.8-0.2 7.9 2.6 15.1 7.9 20.4L676.7 811c11.3 11.4 30.7 10.4 43.2-2.1 12.5-12.5 13.4-31.9 2.1-43.3-12.5-12.5-12.5-32.8 0-45.3s32.7-12.5 45.1 0c36.2 36.3 35.3 96.3-2.1 133.8-19.1 19.3-44 29-68.7 29z" p-id="10524"></path></svg>`,

View File

@ -17,10 +17,10 @@ function initZToolkit(_ztoolkit: ReturnType<typeof createZToolkit>) {
const env = __env__;
_ztoolkit.basicOptions.log.prefix = `[${config.addonName}]`;
_ztoolkit.basicOptions.log.disableConsole = env === "production";
_ztoolkit.UI.basicOptions.ui.enableElementJSONLog = __env__ === "development";
_ztoolkit.UI.basicOptions.ui.enableElementDOMLog = __env__ === "development";
_ztoolkit.UI.basicOptions.ui.enableElementJSONLog = env === "development";
_ztoolkit.UI.basicOptions.ui.enableElementDOMLog = env === "development";
_ztoolkit.basicOptions.debug.disableDebugBridgePassword =
__env__ === "development";
env === "development";
_ztoolkit.ProgressWindow.setIconURI(
"default",
`chrome://${config.addonRef}/content/icons/favicon.png`,