mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 16:40:13 +01:00
🚨
This commit is contained in:
parent
d7b983b36c
commit
b8444f7aca
5 changed files with 18 additions and 18 deletions
|
|
@ -372,7 +372,7 @@ const getHightlightCoordsByRect = (pdf: any, color: string, rectResizeElement: H
|
||||||
const mergeRects = (range: Range) => {
|
const mergeRects = (range: Range) => {
|
||||||
const rects = range.getClientRects();
|
const rects = range.getClientRects();
|
||||||
const mergedRects: { left: number, top: number, right: number, bottom: number }[] = [];
|
const mergedRects: { left: number, top: number, right: number, bottom: number }[] = [];
|
||||||
let lastTop: number = undefined
|
let lastTop: number = undefined;
|
||||||
Array.from(rects).forEach(item => {
|
Array.from(rects).forEach(item => {
|
||||||
if (item.height === 0 || item.width === 0) {
|
if (item.height === 0 || item.width === 0) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -381,11 +381,11 @@ const mergeRects = (range: Range) => {
|
||||||
mergedRects.push({left: item.left, top: item.top, right: item.right, bottom: item.bottom});
|
mergedRects.push({left: item.left, top: item.top, right: item.right, bottom: item.bottom});
|
||||||
lastTop = item.top;
|
lastTop = item.top;
|
||||||
} else {
|
} else {
|
||||||
mergedRects[mergedRects.length - 1].right = item.right
|
mergedRects[mergedRects.length - 1].right = item.right;
|
||||||
}
|
|
||||||
})
|
|
||||||
return mergedRects
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
return mergedRects;
|
||||||
|
};
|
||||||
|
|
||||||
const getHightlightCoordsByRange = (pdf: any, color: string) => {
|
const getHightlightCoordsByRange = (pdf: any, color: string) => {
|
||||||
const range = window.getSelection().getRangeAt(0);
|
const range = window.getSelection().getRangeAt(0);
|
||||||
|
|
|
||||||
|
|
@ -524,7 +524,7 @@ ${passwordHTML}
|
||||||
window.siyuan.config.sync.cloudName = name;
|
window.siyuan.config.sync.cloudName = name;
|
||||||
getCloudList(true);
|
getCloudList(true);
|
||||||
});
|
});
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
confirmDialog(window.siyuan.languages.confirm, response.msg, () => {
|
confirmDialog(window.siyuan.languages.confirm, response.msg, () => {
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ const openFile = (options: IOpenFileOptions) => {
|
||||||
wnd.split(direction).addTab(newTab(options));
|
wnd.split(direction).addTab(newTab(options));
|
||||||
}
|
}
|
||||||
} else if (options.keepCursor && wnd.children[0].model) {
|
} else if (options.keepCursor && wnd.children[0].model) {
|
||||||
const tab = newTab(options)
|
const tab = newTab(options);
|
||||||
tab.headElement.setAttribute("keep-cursor", options.id);
|
tab.headElement.setAttribute("keep-cursor", options.id);
|
||||||
wnd.addTab(tab, options.keepCursor);
|
wnd.addTab(tab, options.keepCursor);
|
||||||
} else if (window.siyuan.config.fileTree.openFilesUseCurrentTab) {
|
} else if (window.siyuan.config.fileTree.openFilesUseCurrentTab) {
|
||||||
|
|
@ -239,7 +239,7 @@ const switchEditor = (editor: Editor, options: IOpenFileOptions, allModels: IMod
|
||||||
if (options.mode) {
|
if (options.mode) {
|
||||||
setEditMode(editor.editor.protyle, options.mode);
|
setEditMode(editor.editor.protyle, options.mode);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
const newTab = (options: IOpenFileOptions) => {
|
const newTab = (options: IOpenFileOptions) => {
|
||||||
let tab: Tab;
|
let tab: Tab;
|
||||||
|
|
@ -293,7 +293,7 @@ const newTab = (options: IOpenFileOptions) => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return tab;
|
return tab;
|
||||||
}
|
};
|
||||||
|
|
||||||
export const updatePanelByEditor = (protyle?: IProtyle, focus = true, pushBackStack = false, reload = false) => {
|
export const updatePanelByEditor = (protyle?: IProtyle, focus = true, pushBackStack = false, reload = false) => {
|
||||||
let title = window.siyuan.languages.siyuanNote;
|
let title = window.siyuan.languages.siyuanNote;
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,11 @@ const filterClipboardHint = (protyle: IProtyle, textPlain: string) => {
|
||||||
needRender = false;
|
needRender = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
if (needRender) {
|
if (needRender) {
|
||||||
protyle.hint.render(protyle);
|
protyle.hint.render(protyle);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const pasteText = (protyle: IProtyle, textPlain: string, nodeElement: Element) => {
|
export const pasteText = (protyle: IProtyle, textPlain: string, nodeElement: Element) => {
|
||||||
const range = getEditorRange(protyle.wysiwyg.element);
|
const range = getEditorRange(protyle.wysiwyg.element);
|
||||||
|
|
@ -59,7 +59,7 @@ export const pasteText = (protyle: IProtyle, textPlain: string, nodeElement: Ele
|
||||||
blockRender(protyle, protyle.wysiwyg.element);
|
blockRender(protyle, protyle.wysiwyg.element);
|
||||||
processRender(protyle.wysiwyg.element);
|
processRender(protyle.wysiwyg.element);
|
||||||
highlightRender(protyle.wysiwyg.element);
|
highlightRender(protyle.wysiwyg.element);
|
||||||
filterClipboardHint(protyle, textPlain)
|
filterClipboardHint(protyle, textPlain);
|
||||||
scrollCenter(protyle);
|
scrollCenter(protyle);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -199,7 +199,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
||||||
// 转换为 md,避免再次粘贴 ID 重复
|
// 转换为 md,避免再次粘贴 ID 重复
|
||||||
const tempMd = protyle.lute.BlockDOM2StdMd(tempElement.innerHTML);
|
const tempMd = protyle.lute.BlockDOM2StdMd(tempElement.innerHTML);
|
||||||
writeText(tempMd);
|
writeText(tempMd);
|
||||||
filterClipboardHint(protyle, tempMd)
|
filterClipboardHint(protyle, tempMd);
|
||||||
} else if (textHTML.endsWith(Constants.ZWSP)) {
|
} else if (textHTML.endsWith(Constants.ZWSP)) {
|
||||||
// 编辑器内部粘贴
|
// 编辑器内部粘贴
|
||||||
tempElement.innerHTML = textHTML.substr(0, textHTML.length - 1);
|
tempElement.innerHTML = textHTML.substr(0, textHTML.length - 1);
|
||||||
|
|
@ -213,7 +213,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
||||||
});
|
});
|
||||||
const tempInnerHTML = tempElement.innerHTML;
|
const tempInnerHTML = tempElement.innerHTML;
|
||||||
insertHTML(tempInnerHTML, protyle);
|
insertHTML(tempInnerHTML, protyle);
|
||||||
filterClipboardHint(protyle, tempInnerHTML)
|
filterClipboardHint(protyle, tempInnerHTML);
|
||||||
} else {
|
} else {
|
||||||
tempElement.innerHTML = textHTML;
|
tempElement.innerHTML = textHTML;
|
||||||
tempElement.querySelectorAll("[style]").forEach((e) => {
|
tempElement.querySelectorAll("[style]").forEach((e) => {
|
||||||
|
|
@ -239,7 +239,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
||||||
blockRender(protyle, protyle.wysiwyg.element);
|
blockRender(protyle, protyle.wysiwyg.element);
|
||||||
processRender(protyle.wysiwyg.element);
|
processRender(protyle.wysiwyg.element);
|
||||||
highlightRender(protyle.wysiwyg.element);
|
highlightRender(protyle.wysiwyg.element);
|
||||||
filterClipboardHint(protyle, response.data)
|
filterClipboardHint(protyle, response.data);
|
||||||
scrollCenter(protyle);
|
scrollCenter(protyle);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
|
@ -258,7 +258,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
||||||
}
|
}
|
||||||
const textPlainDom = protyle.lute.Md2BlockDOM(textPlain);
|
const textPlainDom = protyle.lute.Md2BlockDOM(textPlain);
|
||||||
insertHTML(textPlainDom, protyle);
|
insertHTML(textPlainDom, protyle);
|
||||||
filterClipboardHint(protyle, textPlainDom)
|
filterClipboardHint(protyle, textPlainDom);
|
||||||
}
|
}
|
||||||
blockRender(protyle, protyle.wysiwyg.element);
|
blockRender(protyle, protyle.wysiwyg.element);
|
||||||
processRender(protyle.wysiwyg.element);
|
processRender(protyle.wysiwyg.element);
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ const renderRepoItem = (response: IWebSocketData, element: Element, type: string
|
||||||
element.lastElementChild.innerHTML = `<li class="b3-list--empty">${window.siyuan.languages.emptyContent}</li>`;
|
element.lastElementChild.innerHTML = `<li class="b3-list--empty">${window.siyuan.languages.emptyContent}</li>`;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let actionHTML = ''
|
let actionHTML = "";
|
||||||
if (type === "cloudTag") {
|
if (type === "cloudTag") {
|
||||||
actionHTML = `<span class="b3-list-item__action b3-tooltips b3-tooltips__w" data-type="downloadSnapshot" aria-label="${window.siyuan.languages.download}"><svg><use xlink:href="#iconDownload"></use></svg></span>
|
actionHTML = `<span class="b3-list-item__action b3-tooltips b3-tooltips__w" data-type="downloadSnapshot" aria-label="${window.siyuan.languages.download}"><svg><use xlink:href="#iconDownload"></use></svg></span>
|
||||||
<span class="b3-list-item__action b3-tooltips b3-tooltips__w" data-type="removeCloudRepoTagSnapshot" aria-label="${window.siyuan.languages.remove}"><svg><use xlink:href="#iconTrashcan"></use></svg></span>`;
|
<span class="b3-list-item__action b3-tooltips b3-tooltips__w" data-type="removeCloudRepoTagSnapshot" aria-label="${window.siyuan.languages.remove}"><svg><use xlink:href="#iconTrashcan"></use></svg></span>`;
|
||||||
|
|
@ -450,7 +450,7 @@ export const openHistory = () => {
|
||||||
confirmDialog(window.siyuan.languages.delete, `${window.siyuan.languages.confirmDelete} <i>${tag}</i>?`, () => {
|
confirmDialog(window.siyuan.languages.delete, `${window.siyuan.languages.confirmDelete} <i>${tag}</i>?`, () => {
|
||||||
fetchPost("/api/repo/" + type, {tag}, () => {
|
fetchPost("/api/repo/" + type, {tag}, () => {
|
||||||
if (target.parentElement.parentElement.childElementCount === 1) {
|
if (target.parentElement.parentElement.childElementCount === 1) {
|
||||||
target.parentElement.parentElement.innerHTML = `<li class="b3-list--empty">${window.siyuan.languages.emptyContent}</li>`
|
target.parentElement.parentElement.innerHTML = `<li class="b3-list--empty">${window.siyuan.languages.emptyContent}</li>`;
|
||||||
} else {
|
} else {
|
||||||
target.parentElement.remove();
|
target.parentElement.remove();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue