remove: z6 compatibility code
This commit is contained in:
parent
d0b6ef9107
commit
ce17eaefa7
|
|
@ -214,14 +214,7 @@ async function updatePreview() {
|
|||
const win = addon.data.templateEditor.window;
|
||||
const container = win?.document.getElementById("preview-container");
|
||||
if (container) {
|
||||
if (ztoolkit.isZotero7()) {
|
||||
container.innerHTML = html;
|
||||
} else {
|
||||
container.innerHTML = "";
|
||||
container.appendChild(
|
||||
ztoolkit.getDOMParser().parseFromString(html, "text/html").body,
|
||||
);
|
||||
}
|
||||
container.innerHTML = html;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -158,26 +158,6 @@ export function initWorkspace(container: XUL.Box | undefined) {
|
|||
flex: "1",
|
||||
width: "700",
|
||||
},
|
||||
styles: ztoolkit.isZotero7()
|
||||
? {}
|
||||
: {
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
},
|
||||
children: ztoolkit.isZotero7()
|
||||
? []
|
||||
: [
|
||||
{
|
||||
tag: "zoteronoteeditor",
|
||||
namespace: "html",
|
||||
id: makeId("editor-main"),
|
||||
attributes: { flex: "1" },
|
||||
styles: {
|
||||
display: "flex",
|
||||
height: "100%",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
tag: "splitter",
|
||||
|
|
@ -196,51 +176,29 @@ export function initWorkspace(container: XUL.Box | undefined) {
|
|||
flex: "1",
|
||||
width: "500",
|
||||
},
|
||||
styles: ztoolkit.isZotero7()
|
||||
? {}
|
||||
: {
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
},
|
||||
children: ztoolkit.isZotero7()
|
||||
? []
|
||||
: [
|
||||
{
|
||||
tag: "zoteronoteeditor",
|
||||
namespace: "html",
|
||||
id: makeId("editor-preview"),
|
||||
attributes: { flex: "1" },
|
||||
styles: {
|
||||
display: "flex",
|
||||
height: "100%",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
container,
|
||||
);
|
||||
// Manually add custom editor items in Zotero 7
|
||||
if (ztoolkit.isZotero7()) {
|
||||
// @ts-ignore
|
||||
const customElements = container.ownerGlobal
|
||||
.customElements as CustomElementRegistry;
|
||||
const mainEditorContainer = container.querySelector(
|
||||
`#${makeId("editor-main-container")}`,
|
||||
);
|
||||
const previewEditorContainer = container.querySelector(
|
||||
`#${makeId("editor-preview-container")}`,
|
||||
);
|
||||
const mainEditor = new (customElements.get("note-editor")!)();
|
||||
mainEditor.id = makeId("editor-main");
|
||||
mainEditor.setAttribute("flex", "1");
|
||||
const previewEditor = new (customElements.get("note-editor")!)();
|
||||
previewEditor.id = makeId("editor-preview");
|
||||
previewEditor.setAttribute("flex", "1");
|
||||
mainEditorContainer?.append(mainEditor);
|
||||
previewEditorContainer?.append(previewEditor);
|
||||
}
|
||||
// @ts-ignore
|
||||
const customElements = container.ownerGlobal
|
||||
.customElements as CustomElementRegistry;
|
||||
const mainEditorContainer = container.querySelector(
|
||||
`#${makeId("editor-main-container")}`,
|
||||
);
|
||||
const previewEditorContainer = container.querySelector(
|
||||
`#${makeId("editor-preview-container")}`,
|
||||
);
|
||||
const mainEditor = new (customElements.get("note-editor")!)();
|
||||
mainEditor.id = makeId("editor-main");
|
||||
mainEditor.setAttribute("flex", "1");
|
||||
const previewEditor = new (customElements.get("note-editor")!)();
|
||||
previewEditor.id = makeId("editor-preview");
|
||||
previewEditor.setAttribute("flex", "1");
|
||||
mainEditorContainer?.append(mainEditor);
|
||||
previewEditorContainer?.append(previewEditor);
|
||||
|
||||
const outlineContainer = container.querySelector(
|
||||
`#${makeId("outline-container")}`,
|
||||
|
|
|
|||
|
|
@ -94,12 +94,7 @@ function hoverWorkspaceTab(hovered: boolean) {
|
|||
const content = tabElem.querySelector(".tab-name") as HTMLDivElement;
|
||||
content.removeAttribute("style");
|
||||
if (hovered) {
|
||||
if (ztoolkit.isZotero7()) {
|
||||
content.style["-moz-box-pack" as any] = "start";
|
||||
} else {
|
||||
content.style.position = "absolute";
|
||||
content.style.left = "22px";
|
||||
}
|
||||
content.style["-moz-box-pack" as any] = "start";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,8 @@ export async function itemPicker() {
|
|||
deferred: Zotero.Promise.defer(),
|
||||
};
|
||||
|
||||
(window as unknown as XUL.XULWindow).openDialog(
|
||||
ztoolkit.isZotero7()
|
||||
? "chrome://zotero/content/selectItemsDialog.xhtml"
|
||||
: "chrome://zotero/content/selectItemsDialog.xul",
|
||||
window.openDialog(
|
||||
"chrome://zotero/content/selectItemsDialog.xhtml",
|
||||
"",
|
||||
"chrome,dialog=no,centerscreen,resizable=yes",
|
||||
io,
|
||||
|
|
|
|||
Loading…
Reference in New Issue