mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 16:40:13 +01:00
🚨
This commit is contained in:
parent
a7d0fefff1
commit
f89d16c3a2
5 changed files with 19 additions and 19 deletions
|
|
@ -16,10 +16,10 @@ export const exportAsset = (src: string) => {
|
||||||
properties: ["showOverwriteConfirmation"],
|
properties: ["showOverwriteConfirmation"],
|
||||||
}).then((result: SaveDialogReturnValue) => {
|
}).then((result: SaveDialogReturnValue) => {
|
||||||
if (!result.canceled) {
|
if (!result.canceled) {
|
||||||
fetchPost("/api/file/copyFile", {src, dest: result.filePath})
|
fetchPost("/api/file/copyFile", {src, dest: result.filePath});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
/// #endif
|
/// #endif
|
||||||
}
|
};
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ const focusStack = (backStack: IBackStack) => {
|
||||||
protyle.contentElement.scrollTop = backStack.scrollTop;
|
protyle.contentElement.scrollTop = backStack.scrollTop;
|
||||||
window.siyuan.mobileEditor.protyle.breadcrumb.render(protyle);
|
window.siyuan.mobileEditor.protyle.breadcrumb.render(protyle);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
export const pushBack = () => {
|
export const pushBack = () => {
|
||||||
const protyle = window.siyuan.mobileEditor.protyle;
|
const protyle = window.siyuan.mobileEditor.protyle;
|
||||||
|
|
@ -80,7 +80,7 @@ export const pushBack = () => {
|
||||||
callback: protyle.block.action,
|
callback: protyle.block.action,
|
||||||
isZoom: protyle.block.showAll
|
isZoom: protyle.block.showAll
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
export const goForward = () => {
|
export const goForward = () => {
|
||||||
if (window.JSAndroid && forwardStack.length < 2) {
|
if (window.JSAndroid && forwardStack.length < 2) {
|
||||||
|
|
@ -90,9 +90,9 @@ export const goForward = () => {
|
||||||
if (forwardStack.length < 2) {
|
if (forwardStack.length < 2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
window.siyuan.backStack.push(forwardStack.pop())
|
window.siyuan.backStack.push(forwardStack.pop());
|
||||||
focusStack(forwardStack[forwardStack.length - 1])
|
focusStack(forwardStack[forwardStack.length - 1]);
|
||||||
}
|
};
|
||||||
|
|
||||||
export const goBack = () => {
|
export const goBack = () => {
|
||||||
if (window.JSAndroid && window.siyuan.backStack.length < 1) {
|
if (window.JSAndroid && window.siyuan.backStack.length < 1) {
|
||||||
|
|
@ -114,5 +114,5 @@ export const goBack = () => {
|
||||||
}
|
}
|
||||||
const item = window.siyuan.backStack.pop();
|
const item = window.siyuan.backStack.pop();
|
||||||
forwardStack.push(item);
|
forwardStack.push(item);
|
||||||
focusStack(item)
|
focusStack(item);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ export class Preview {
|
||||||
// 对于超链接锚点不做任何处理
|
// 对于超链接锚点不做任何处理
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isMobile()) {
|
if (isMobile()) {
|
||||||
|
|
|
||||||
|
|
@ -695,12 +695,12 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
// 外部文件拖入编辑器中或者编辑器内选中文字拖拽
|
// 外部文件拖入编辑器中或者编辑器内选中文字拖拽
|
||||||
focusByRange(document.caretRangeFromPoint(event.clientX, event.clientY));
|
focusByRange(document.caretRangeFromPoint(event.clientX, event.clientY));
|
||||||
if (event.dataTransfer.types[0] === "Files") {
|
if (event.dataTransfer.types[0] === "Files") {
|
||||||
const files:string[] = []
|
const files:string[] = [];
|
||||||
let isAllFile = true
|
let isAllFile = true;
|
||||||
for (let i = 0; i < event.dataTransfer.files.length; i++) {
|
for (let i = 0; i < event.dataTransfer.files.length; i++) {
|
||||||
files.push(event.dataTransfer.files[i].path);
|
files.push(event.dataTransfer.files[i].path);
|
||||||
if (event.dataTransfer.files[i].type === "") {
|
if (event.dataTransfer.files[i].type === "") {
|
||||||
isAllFile = false
|
isAllFile = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isAllFile) {
|
if (isAllFile) {
|
||||||
|
|
@ -708,18 +708,18 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
label:window.siyuan.languages.upload,
|
label:window.siyuan.languages.upload,
|
||||||
icon:"iconUpload",
|
icon:"iconUpload",
|
||||||
click(element) {
|
click() {
|
||||||
uploadLocalFiles(files, protyle);
|
uploadLocalFiles(files, protyle);
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
label:window.siyuan.languages.link,
|
label:window.siyuan.languages.link,
|
||||||
icon:"iconLink",
|
icon:"iconLink",
|
||||||
click(element) {
|
click() {
|
||||||
let fileText = ""
|
let fileText = "";
|
||||||
files.forEach((item) => {
|
files.forEach((item) => {
|
||||||
fileText = `[${pathPosix().basename(item)}](${item})\n`
|
fileText = `[${pathPosix().basename(item)}](${item})\n`;
|
||||||
})
|
});
|
||||||
insertHTML(protyle.lute.SpinBlockDOM(fileText), protyle);
|
insertHTML(protyle.lute.SpinBlockDOM(fileText), protyle);
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
|
|
|
||||||
|
|
@ -218,7 +218,7 @@ const setKey = () => {
|
||||||
dialog.element.querySelector(".b3-button--cancel").addEventListener("click", () => {
|
dialog.element.querySelector(".b3-button--cancel").addEventListener("click", () => {
|
||||||
dialog.destroy();
|
dialog.destroy();
|
||||||
});
|
});
|
||||||
const inputElement = dialog.element.querySelector(".b3-text-field") as HTMLInputElement
|
const inputElement = dialog.element.querySelector(".b3-text-field") as HTMLInputElement;
|
||||||
dialog.element.querySelector("#initKeyByPW").addEventListener("click", () => {
|
dialog.element.querySelector("#initKeyByPW").addEventListener("click", () => {
|
||||||
if (!inputElement.value) {
|
if (!inputElement.value) {
|
||||||
showMessage(window.siyuan.languages._kernel[142]);
|
showMessage(window.siyuan.languages._kernel[142]);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue