mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 17:40:13 +01:00
🚨
This commit is contained in:
parent
3aa98db23d
commit
6c75197dbc
9 changed files with 17 additions and 17 deletions
|
|
@ -167,7 +167,7 @@ export const initAnno = (element: HTMLElement, pdf: any) => {
|
||||||
item.style.backgroundColor = "transparent";
|
item.style.backgroundColor = "transparent";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
fetchPost("/api/asset/setFileAnnotation", {
|
fetchPost("/api/asset/setFileAnnotation", {
|
||||||
path: pdf.appConfig.file.replace(location.origin, "").substr(1) + ".sya",
|
path: pdf.appConfig.file.replace(location.origin, "").substr(1) + ".sya",
|
||||||
data: JSON.stringify(config),
|
data: JSON.stringify(config),
|
||||||
|
|
@ -723,7 +723,7 @@ export const hlPDFRect = (element: HTMLElement, id: string) => {
|
||||||
item.classList.remove("pdf__rect--hl");
|
item.classList.remove("pdf__rect--hl");
|
||||||
}, 1500);
|
}, 1500);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const copyAnno = (idPath: string, fileName: string, pdf: any) => {
|
const copyAnno = (idPath: string, fileName: string, pdf: any) => {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ export const onlyProtyleCommand = (options: {
|
||||||
}
|
}
|
||||||
if (options.command === "switchAdjust") {
|
if (options.command === "switchAdjust") {
|
||||||
let fullWidth;
|
let fullWidth;
|
||||||
const adjustWidth = options.protyle.wysiwyg.element.getAttribute(Constants.CUSTOM_SY_FULLWIDTH)
|
const adjustWidth = options.protyle.wysiwyg.element.getAttribute(Constants.CUSTOM_SY_FULLWIDTH);
|
||||||
if (!adjustWidth) {
|
if (!adjustWidth) {
|
||||||
fullWidth = window.siyuan.config.editor.fullWidth ? "false" : "true";
|
fullWidth = window.siyuan.config.editor.fullWidth ? "false" : "true";
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,7 @@ export class Wnd {
|
||||||
if (headerDragCounter === 0) {
|
if (headerDragCounter === 0) {
|
||||||
document.querySelectorAll(".layout-tab-bars--drag").forEach(item => {
|
document.querySelectorAll(".layout-tab-bars--drag").forEach(item => {
|
||||||
item.classList.remove("layout-tab-bars--drag");
|
item.classList.remove("layout-tab-bars--drag");
|
||||||
})
|
});
|
||||||
clearTimeout(dragleaveTimeout);
|
clearTimeout(dragleaveTimeout);
|
||||||
// 窗口拖拽到新窗口时,不 drop 无法移除 clone 的元素
|
// 窗口拖拽到新窗口时,不 drop 无法移除 clone 的元素
|
||||||
dragleaveTimeout = window.setTimeout(() => {
|
dragleaveTimeout = window.setTimeout(() => {
|
||||||
|
|
@ -255,7 +255,7 @@ export class Wnd {
|
||||||
}) {
|
}) {
|
||||||
document.querySelectorAll(".layout-tab-bars--drag").forEach(item => {
|
document.querySelectorAll(".layout-tab-bars--drag").forEach(item => {
|
||||||
item.classList.remove("layout-tab-bars--drag");
|
item.classList.remove("layout-tab-bars--drag");
|
||||||
})
|
});
|
||||||
headerDragCounter = 0;
|
headerDragCounter = 0;
|
||||||
const it = this as HTMLElement;
|
const it = this as HTMLElement;
|
||||||
if (event.dataTransfer.types.includes(Constants.SIYUAN_DROP_FILE)) {
|
if (event.dataTransfer.types.includes(Constants.SIYUAN_DROP_FILE)) {
|
||||||
|
|
|
||||||
|
|
@ -927,8 +927,8 @@ export const zoomOut = (options: {
|
||||||
if (options.focusId) {
|
if (options.focusId) {
|
||||||
let focusElement = options.protyle.wysiwyg.element.querySelector(`[data-node-id="${options.focusId}"]`);
|
let focusElement = options.protyle.wysiwyg.element.querySelector(`[data-node-id="${options.focusId}"]`);
|
||||||
if (!focusElement) {
|
if (!focusElement) {
|
||||||
const unfoldResponse = await fetchSyncPost("/api/block/getUnfoldedParentID", {id: options.focusId})
|
const unfoldResponse = await fetchSyncPost("/api/block/getUnfoldedParentID", {id: options.focusId});
|
||||||
options.focusId = unfoldResponse.data.parentID
|
options.focusId = unfoldResponse.data.parentID;
|
||||||
focusElement = options.protyle.wysiwyg.element.querySelector(`[data-node-id="${unfoldResponse.data.parentID}"]`);
|
focusElement = options.protyle.wysiwyg.element.querySelector(`[data-node-id="${unfoldResponse.data.parentID}"]`);
|
||||||
}
|
}
|
||||||
if (focusElement) {
|
if (focusElement) {
|
||||||
|
|
|
||||||
|
|
@ -46,13 +46,13 @@ export class Title {
|
||||||
this.editElement.addEventListener("paste", (event: ClipboardEvent) => {
|
this.editElement.addEventListener("paste", (event: ClipboardEvent) => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const range = getSelection().getRangeAt(0)
|
const range = getSelection().getRangeAt(0);
|
||||||
let text = event.clipboardData.getData("text/siyuan")
|
let text = event.clipboardData.getData("text/siyuan");
|
||||||
range.deleteContents();
|
range.deleteContents();
|
||||||
if (text) {
|
if (text) {
|
||||||
text = protyle.lute.BlockDOM2Content(text)
|
text = protyle.lute.BlockDOM2Content(text);
|
||||||
} else {
|
} else {
|
||||||
text = event.clipboardData.getData("text/plain")
|
text = event.clipboardData.getData("text/plain");
|
||||||
}
|
}
|
||||||
range.insertNode(document.createTextNode(replaceFileName(text)));
|
range.insertNode(document.createTextNode(replaceFileName(text)));
|
||||||
range.collapse(false);
|
range.collapse(false);
|
||||||
|
|
|
||||||
|
|
@ -1291,7 +1291,7 @@ export const openMenuPanel = (options: {
|
||||||
} else if (type === "av-view-switch") {
|
} else if (type === "av-view-switch") {
|
||||||
if (!target.parentElement.classList.contains("b3-menu__item--current")) {
|
if (!target.parentElement.classList.contains("b3-menu__item--current")) {
|
||||||
avPanelElement.querySelector(".b3-menu__item--current")?.classList.remove("b3-menu__item--current");
|
avPanelElement.querySelector(".b3-menu__item--current")?.classList.remove("b3-menu__item--current");
|
||||||
target.parentElement.classList.add("b3-menu__item--current")
|
target.parentElement.classList.add("b3-menu__item--current");
|
||||||
options.blockElement.removeAttribute("data-render");
|
options.blockElement.removeAttribute("data-render");
|
||||||
avRender(options.blockElement, options.protyle, undefined, target.parentElement.dataset.id);
|
avRender(options.blockElement, options.protyle, undefined, target.parentElement.dataset.id);
|
||||||
}
|
}
|
||||||
|
|
@ -1307,7 +1307,7 @@ export const openMenuPanel = (options: {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
avPanelElement.querySelector(".b3-menu__item--current")?.classList.remove("b3-menu__item--current");
|
avPanelElement.querySelector(".b3-menu__item--current")?.classList.remove("b3-menu__item--current");
|
||||||
target.parentElement.classList.add("b3-menu__item--current")
|
target.parentElement.classList.add("b3-menu__item--current");
|
||||||
options.blockElement.removeAttribute("data-render");
|
options.blockElement.removeAttribute("data-render");
|
||||||
avRender(options.blockElement, options.protyle, () => {
|
avRender(options.blockElement, options.protyle, () => {
|
||||||
openViewMenu({
|
openViewMenu({
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,7 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, rowIndex)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="av__row--footer${hasCalc ? " av__readonly--show" : ""}">${calcHTML}</div>
|
<div class="av__row--footer${hasCalc ? " av__readonly--show" : ""}">${calcHTML}</div>
|
||||||
</div>`
|
</div>`;
|
||||||
if (renderAll) {
|
if (renderAll) {
|
||||||
e.firstElementChild.outerHTML = `<div class="av__container">
|
e.firstElementChild.outerHTML = `<div class="av__container">
|
||||||
<div class="av__header">
|
<div class="av__header">
|
||||||
|
|
|
||||||
|
|
@ -455,14 +455,14 @@ export const focusByOffset = (container: Element, start: number, end: number, is
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setInsertWbrHTML = (nodeElement: HTMLElement, range: Range, protyle: IProtyle) => {
|
export const setInsertWbrHTML = (nodeElement: HTMLElement, range: Range, protyle: IProtyle) => {
|
||||||
const offset = getSelectionOffset(nodeElement, nodeElement, range)
|
const offset = getSelectionOffset(nodeElement, nodeElement, range);
|
||||||
const cloneNode = nodeElement.cloneNode(true) as HTMLElement;
|
const cloneNode = nodeElement.cloneNode(true) as HTMLElement;
|
||||||
const cloneRange = focusByOffset(cloneNode, offset.end, offset.end, false);
|
const cloneRange = focusByOffset(cloneNode, offset.end, offset.end, false);
|
||||||
if (cloneRange) {
|
if (cloneRange) {
|
||||||
cloneRange.insertNode(document.createElement("wbr"));
|
cloneRange.insertNode(document.createElement("wbr"));
|
||||||
}
|
}
|
||||||
protyle.wysiwyg.lastHTMLs[nodeElement.getAttribute("data-node-id")] = cloneNode.outerHTML;
|
protyle.wysiwyg.lastHTMLs[nodeElement.getAttribute("data-node-id")] = cloneNode.outerHTML;
|
||||||
}
|
};
|
||||||
|
|
||||||
export const focusByWbr = (element: Element, range: Range) => {
|
export const focusByWbr = (element: Element, range: Range) => {
|
||||||
const wbrElements = element.querySelectorAll("wbr");
|
const wbrElements = element.querySelectorAll("wbr");
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
event.code !== "") { // 悬浮工具会触发但 code 为空 https://github.com/siyuan-note/siyuan/issues/6573
|
event.code !== "") { // 悬浮工具会触发但 code 为空 https://github.com/siyuan-note/siyuan/issues/6573
|
||||||
hideElements(["toolbar"], protyle);
|
hideElements(["toolbar"], protyle);
|
||||||
}
|
}
|
||||||
let range = getEditorRange(protyle.wysiwyg.element);
|
const range = getEditorRange(protyle.wysiwyg.element);
|
||||||
const nodeElement = hasClosestBlock(range.startContainer);
|
const nodeElement = hasClosestBlock(range.startContainer);
|
||||||
if (!nodeElement) {
|
if (!nodeElement) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue