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";
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
fetchPost("/api/asset/setFileAnnotation", {
|
||||
path: pdf.appConfig.file.replace(location.origin, "").substr(1) + ".sya",
|
||||
data: JSON.stringify(config),
|
||||
|
|
@ -723,7 +723,7 @@ export const hlPDFRect = (element: HTMLElement, id: string) => {
|
|||
item.classList.remove("pdf__rect--hl");
|
||||
}, 1500);
|
||||
}
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
const copyAnno = (idPath: string, fileName: string, pdf: any) => {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ export const onlyProtyleCommand = (options: {
|
|||
}
|
||||
if (options.command === "switchAdjust") {
|
||||
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) {
|
||||
fullWidth = window.siyuan.config.editor.fullWidth ? "false" : "true";
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ export class Wnd {
|
|||
if (headerDragCounter === 0) {
|
||||
document.querySelectorAll(".layout-tab-bars--drag").forEach(item => {
|
||||
item.classList.remove("layout-tab-bars--drag");
|
||||
})
|
||||
});
|
||||
clearTimeout(dragleaveTimeout);
|
||||
// 窗口拖拽到新窗口时,不 drop 无法移除 clone 的元素
|
||||
dragleaveTimeout = window.setTimeout(() => {
|
||||
|
|
@ -255,7 +255,7 @@ export class Wnd {
|
|||
}) {
|
||||
document.querySelectorAll(".layout-tab-bars--drag").forEach(item => {
|
||||
item.classList.remove("layout-tab-bars--drag");
|
||||
})
|
||||
});
|
||||
headerDragCounter = 0;
|
||||
const it = this as HTMLElement;
|
||||
if (event.dataTransfer.types.includes(Constants.SIYUAN_DROP_FILE)) {
|
||||
|
|
|
|||
|
|
@ -927,8 +927,8 @@ export const zoomOut = (options: {
|
|||
if (options.focusId) {
|
||||
let focusElement = options.protyle.wysiwyg.element.querySelector(`[data-node-id="${options.focusId}"]`);
|
||||
if (!focusElement) {
|
||||
const unfoldResponse = await fetchSyncPost("/api/block/getUnfoldedParentID", {id: options.focusId})
|
||||
options.focusId = unfoldResponse.data.parentID
|
||||
const unfoldResponse = await fetchSyncPost("/api/block/getUnfoldedParentID", {id: options.focusId});
|
||||
options.focusId = unfoldResponse.data.parentID;
|
||||
focusElement = options.protyle.wysiwyg.element.querySelector(`[data-node-id="${unfoldResponse.data.parentID}"]`);
|
||||
}
|
||||
if (focusElement) {
|
||||
|
|
|
|||
|
|
@ -46,13 +46,13 @@ export class Title {
|
|||
this.editElement.addEventListener("paste", (event: ClipboardEvent) => {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
const range = getSelection().getRangeAt(0)
|
||||
let text = event.clipboardData.getData("text/siyuan")
|
||||
const range = getSelection().getRangeAt(0);
|
||||
let text = event.clipboardData.getData("text/siyuan");
|
||||
range.deleteContents();
|
||||
if (text) {
|
||||
text = protyle.lute.BlockDOM2Content(text)
|
||||
text = protyle.lute.BlockDOM2Content(text);
|
||||
} else {
|
||||
text = event.clipboardData.getData("text/plain")
|
||||
text = event.clipboardData.getData("text/plain");
|
||||
}
|
||||
range.insertNode(document.createTextNode(replaceFileName(text)));
|
||||
range.collapse(false);
|
||||
|
|
|
|||
|
|
@ -1291,7 +1291,7 @@ export const openMenuPanel = (options: {
|
|||
} else if (type === "av-view-switch") {
|
||||
if (!target.parentElement.classList.contains("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");
|
||||
avRender(options.blockElement, options.protyle, undefined, target.parentElement.dataset.id);
|
||||
}
|
||||
|
|
@ -1307,7 +1307,7 @@ export const openMenuPanel = (options: {
|
|||
});
|
||||
} else {
|
||||
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");
|
||||
avRender(options.blockElement, options.protyle, () => {
|
||||
openViewMenu({
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, rowIndex)}
|
|||
</div>
|
||||
</div>
|
||||
<div class="av__row--footer${hasCalc ? " av__readonly--show" : ""}">${calcHTML}</div>
|
||||
</div>`
|
||||
</div>`;
|
||||
if (renderAll) {
|
||||
e.firstElementChild.outerHTML = `<div class="av__container">
|
||||
<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) => {
|
||||
const offset = getSelectionOffset(nodeElement, nodeElement, range)
|
||||
const offset = getSelectionOffset(nodeElement, nodeElement, range);
|
||||
const cloneNode = nodeElement.cloneNode(true) as HTMLElement;
|
||||
const cloneRange = focusByOffset(cloneNode, offset.end, offset.end, false);
|
||||
if (cloneRange) {
|
||||
cloneRange.insertNode(document.createElement("wbr"));
|
||||
}
|
||||
protyle.wysiwyg.lastHTMLs[nodeElement.getAttribute("data-node-id")] = cloneNode.outerHTML;
|
||||
}
|
||||
};
|
||||
|
||||
export const focusByWbr = (element: Element, range: Range) => {
|
||||
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
|
||||
hideElements(["toolbar"], protyle);
|
||||
}
|
||||
let range = getEditorRange(protyle.wysiwyg.element);
|
||||
const range = getEditorRange(protyle.wysiwyg.element);
|
||||
const nodeElement = hasClosestBlock(range.startContainer);
|
||||
if (!nodeElement) {
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue