mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 01:20:12 +01:00
This commit is contained in:
parent
3b29cc7bfc
commit
922e86bc8b
8 changed files with 101 additions and 75 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
|
/// #if !MOBILE
|
||||||
import {getAllModels} from "../../layout/getAll";
|
import {getAllModels} from "../../layout/getAll";
|
||||||
import {isMobile} from "../../util/functions";
|
/// #endif
|
||||||
import {setPadding} from "../ui/initUI";
|
import {setPadding} from "../ui/initUI";
|
||||||
|
|
||||||
export const fullscreen = (element: Element, btnElement?: Element) => {
|
export const fullscreen = (element: Element, btnElement?: Element) => {
|
||||||
|
|
@ -22,18 +23,19 @@ export const fullscreen = (element: Element, btnElement?: Element) => {
|
||||||
} else {
|
} else {
|
||||||
btnElement.querySelector("use").setAttribute("xlink:href", "#iconContract");
|
btnElement.querySelector("use").setAttribute("xlink:href", "#iconContract");
|
||||||
}
|
}
|
||||||
} else if (!isMobile()) {
|
}
|
||||||
window.siyuan.editorIsFullscreen = !isFullscreen;
|
/// #if !MOBILE
|
||||||
getAllModels().editor.forEach(item => {
|
window.siyuan.editorIsFullscreen = !isFullscreen;
|
||||||
if (window.siyuan.editorIsFullscreen) {
|
getAllModels().editor.forEach(item => {
|
||||||
if (!element.isSameNode(item.element) && item.element.classList.contains("fullscreen")) {
|
if (window.siyuan.editorIsFullscreen) {
|
||||||
item.element.classList.remove("fullscreen");
|
if (!element.isSameNode(item.element) && item.element.classList.contains("fullscreen")) {
|
||||||
setPadding(item.editor.protyle);
|
|
||||||
}
|
|
||||||
} else if (item.element.classList.contains("fullscreen")) {
|
|
||||||
item.element.classList.remove("fullscreen");
|
item.element.classList.remove("fullscreen");
|
||||||
setPadding(item.editor.protyle);
|
setPadding(item.editor.protyle);
|
||||||
}
|
}
|
||||||
});
|
} else if (item.element.classList.contains("fullscreen")) {
|
||||||
}
|
item.element.classList.remove("fullscreen");
|
||||||
|
setPadding(item.editor.protyle);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
/// #endif
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,14 @@ import {isMobile} from "../../util/functions";
|
||||||
import {zoomOut} from "../../menus/protyle";
|
import {zoomOut} from "../../menus/protyle";
|
||||||
import {getEditorRange} from "../util/selection";
|
import {getEditorRange} from "../util/selection";
|
||||||
import {setPadding} from "../ui/initUI";
|
import {setPadding} from "../ui/initUI";
|
||||||
import {onGet} from "../util/onGet";
|
/// #if !MOBILE
|
||||||
|
import {openFileById} from "../../editor/util";
|
||||||
|
import {getAllModels} from "../../layout/getAll";
|
||||||
|
/// #endif
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
import {getCurrentWindow} from "@electron/remote";
|
import {getCurrentWindow} from "@electron/remote";
|
||||||
/// #endif
|
/// #endif
|
||||||
import {openFileById} from "../../editor/util";
|
import {onGet} from "../util/onGet";
|
||||||
import {getAllModels} from "../../layout/getAll";
|
|
||||||
|
|
||||||
export class Breadcrumb {
|
export class Breadcrumb {
|
||||||
public element: HTMLElement;
|
public element: HTMLElement;
|
||||||
|
|
@ -44,9 +46,9 @@ export class Breadcrumb {
|
||||||
const id = target.getAttribute("data-node-id");
|
const id = target.getAttribute("data-node-id");
|
||||||
if (id) {
|
if (id) {
|
||||||
if (protyle.options.render.breadcrumbDocName && window.siyuan.ctrlIsPressed) {
|
if (protyle.options.render.breadcrumbDocName && window.siyuan.ctrlIsPressed) {
|
||||||
if (!isMobile()) {
|
/// #if !MOBILE
|
||||||
openFileById({id, action: [Constants.CB_GET_FOCUS]});
|
openFileById({id, action: [Constants.CB_GET_FOCUS]});
|
||||||
}
|
/// #endif
|
||||||
} else {
|
} else {
|
||||||
zoomOut(protyle, id);
|
zoomOut(protyle, id);
|
||||||
}
|
}
|
||||||
|
|
@ -218,27 +220,27 @@ export class Breadcrumb {
|
||||||
fetchPost("/api/format/autoSpace", {
|
fetchPost("/api/format/autoSpace", {
|
||||||
id: protyle.block.rootID
|
id: protyle.block.rootID
|
||||||
}, () => {
|
}, () => {
|
||||||
if (isMobile()) {
|
/// #if MOBILE
|
||||||
fetchPost("/api/filetree/getDoc", {
|
fetchPost("/api/filetree/getDoc", {
|
||||||
id: protyle.block.id,
|
id: protyle.block.id,
|
||||||
mode: 0,
|
mode: 0,
|
||||||
size: Constants.SIZE_GET,
|
size: Constants.SIZE_GET,
|
||||||
}, getResponse => {
|
}, getResponse => {
|
||||||
onGet(getResponse, protyle, [Constants.CB_GET_FOCUS]);
|
onGet(getResponse, protyle, [Constants.CB_GET_FOCUS]);
|
||||||
});
|
});
|
||||||
} else {
|
/// #else
|
||||||
getAllModels().editor.forEach(item => {
|
getAllModels().editor.forEach(item => {
|
||||||
if (item.editor.protyle.block.rootID === protyle.block.rootID) {
|
if (item.editor.protyle.block.rootID === protyle.block.rootID) {
|
||||||
fetchPost("/api/filetree/getDoc", {
|
fetchPost("/api/filetree/getDoc", {
|
||||||
id: item.editor.protyle.block.rootID,
|
id: item.editor.protyle.block.rootID,
|
||||||
mode: 0,
|
mode: 0,
|
||||||
size: Constants.SIZE_GET,
|
size: Constants.SIZE_GET,
|
||||||
}, getResponse => {
|
}, getResponse => {
|
||||||
onGet(getResponse, item.editor.protyle, [Constants.CB_GET_FOCUS]);
|
onGet(getResponse, item.editor.protyle, [Constants.CB_GET_FOCUS]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
/// #endif
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
|
|
@ -248,27 +250,27 @@ export class Breadcrumb {
|
||||||
fetchPost("/api/format/netImg2LocalAssets", {
|
fetchPost("/api/format/netImg2LocalAssets", {
|
||||||
id: protyle.block.rootID
|
id: protyle.block.rootID
|
||||||
}, () => {
|
}, () => {
|
||||||
if (isMobile()) {
|
/// #if MOBILE
|
||||||
fetchPost("/api/filetree/getDoc", {
|
fetchPost("/api/filetree/getDoc", {
|
||||||
id: protyle.block.id,
|
id: protyle.block.id,
|
||||||
mode: 0,
|
mode: 0,
|
||||||
size: Constants.SIZE_GET,
|
size: Constants.SIZE_GET,
|
||||||
}, getResponse => {
|
}, getResponse => {
|
||||||
onGet(getResponse, protyle, [Constants.CB_GET_FOCUS]);
|
onGet(getResponse, protyle, [Constants.CB_GET_FOCUS]);
|
||||||
});
|
});
|
||||||
} else {
|
/// #else
|
||||||
getAllModels().editor.forEach(item => {
|
getAllModels().editor.forEach(item => {
|
||||||
if (item.editor.protyle.block.rootID === protyle.block.rootID) {
|
if (item.editor.protyle.block.rootID === protyle.block.rootID) {
|
||||||
fetchPost("/api/filetree/getDoc", {
|
fetchPost("/api/filetree/getDoc", {
|
||||||
id: item.editor.protyle.block.rootID,
|
id: item.editor.protyle.block.rootID,
|
||||||
mode: 0,
|
mode: 0,
|
||||||
size: Constants.SIZE_GET,
|
size: Constants.SIZE_GET,
|
||||||
}, getResponse => {
|
}, getResponse => {
|
||||||
onGet(getResponse, item.editor.protyle, [Constants.CB_GET_FOCUS]);
|
onGet(getResponse, item.editor.protyle, [Constants.CB_GET_FOCUS]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
/// #endif
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,9 @@ import {fetchPost} from "../../util/fetch";
|
||||||
import {getRandomEmoji, openEmojiPanel, unicode2Emoji, updateFileTreeEmoji, updateOutlineEmoji} from "../../emoji";
|
import {getRandomEmoji, openEmojiPanel, unicode2Emoji, updateFileTreeEmoji, updateOutlineEmoji} from "../../emoji";
|
||||||
import {upDownHint} from "../../util/upDownHint";
|
import {upDownHint} from "../../util/upDownHint";
|
||||||
import {setPosition} from "../../util/setPosition";
|
import {setPosition} from "../../util/setPosition";
|
||||||
|
/// #if !MOBILE
|
||||||
import {openGlobalSearch} from "../../search/util";
|
import {openGlobalSearch} from "../../search/util";
|
||||||
|
/// #endif
|
||||||
import {getEventName} from "../util/compatibility";
|
import {getEventName} from "../util/compatibility";
|
||||||
import {Dialog} from "../../dialog";
|
import {Dialog} from "../../dialog";
|
||||||
|
|
||||||
|
|
@ -278,9 +280,9 @@ export class Background {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
break;
|
break;
|
||||||
} else if (type === "open-search") {
|
} else if (type === "open-search") {
|
||||||
if (!isMobile()) {
|
/// #if !MOBILE
|
||||||
openGlobalSearch(`#${target.textContent}#`, !window.siyuan.ctrlIsPressed);
|
openGlobalSearch(`#${target.textContent}#`, !window.siyuan.ctrlIsPressed);
|
||||||
}
|
/// #endif
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -16,16 +16,16 @@ import {Constants} from "../../constants";
|
||||||
import {hasClosestByClassName} from "../util/hasClosest";
|
import {hasClosestByClassName} from "../util/hasClosest";
|
||||||
import {matchHotKey} from "../util/hotKey";
|
import {matchHotKey} from "../util/hotKey";
|
||||||
import {updateHotkeyTip, writeText} from "../util/compatibility";
|
import {updateHotkeyTip, writeText} from "../util/compatibility";
|
||||||
import {setPanelFocus} from "../../layout/util";
|
|
||||||
import {escapeHtml} from "../../util/escape";
|
import {escapeHtml} from "../../util/escape";
|
||||||
import {updatePanelByEditor} from "../../editor/util";
|
|
||||||
import * as dayjs from "dayjs";
|
import * as dayjs from "dayjs";
|
||||||
|
import {setPanelFocus} from "../../layout/util";
|
||||||
|
import {updatePanelByEditor} from "../../editor/util";
|
||||||
|
import {openBacklink, openGraph, openOutline} from "../../layout/dock/util";
|
||||||
import {setTitle} from "../../dialog/processSystem";
|
import {setTitle} from "../../dialog/processSystem";
|
||||||
import {getNoContainerElement} from "../wysiwyg/getBlock";
|
import {getNoContainerElement} from "../wysiwyg/getBlock";
|
||||||
import {commonHotkey} from "../wysiwyg/commonHotkey";
|
import {commonHotkey} from "../wysiwyg/commonHotkey";
|
||||||
import {setPosition} from "../../util/setPosition";
|
import {setPosition} from "../../util/setPosition";
|
||||||
import {code160to32} from "../util/code160to32";
|
import {code160to32} from "../util/code160to32";
|
||||||
import {openBacklink, openGraph, openOutline} from "../../layout/dock/util";
|
|
||||||
import {deleteFile} from "../../editor/deleteFile";
|
import {deleteFile} from "../../editor/deleteFile";
|
||||||
|
|
||||||
export class Title {
|
export class Title {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,9 @@ import {Gutter} from "./gutter";
|
||||||
import {Breadcrumb} from "./breadcrumb";
|
import {Breadcrumb} from "./breadcrumb";
|
||||||
import {onTransaction} from "./wysiwyg/transaction";
|
import {onTransaction} from "./wysiwyg/transaction";
|
||||||
import {fetchPost} from "../util/fetch";
|
import {fetchPost} from "../util/fetch";
|
||||||
|
/// #if !MOBILE
|
||||||
import {Title} from "./header/Title";
|
import {Title} from "./header/Title";
|
||||||
|
/// #endif
|
||||||
import {Background} from "./header/Background";
|
import {Background} from "./header/Background";
|
||||||
import {getDisplayName} from "../util/pathName";
|
import {getDisplayName} from "../util/pathName";
|
||||||
import {onGet} from "./util/onGet";
|
import {onGet} from "./util/onGet";
|
||||||
|
|
@ -49,9 +51,11 @@ class Protyle {
|
||||||
|
|
||||||
this.protyle.hint = new Hint(this.protyle);
|
this.protyle.hint = new Hint(this.protyle);
|
||||||
this.protyle.breadcrumb = new Breadcrumb(this.protyle);
|
this.protyle.breadcrumb = new Breadcrumb(this.protyle);
|
||||||
|
/// #if !MOBILE
|
||||||
if (mergedOptions.render.title) {
|
if (mergedOptions.render.title) {
|
||||||
this.protyle.title = new Title(this.protyle);
|
this.protyle.title = new Title(this.protyle);
|
||||||
}
|
}
|
||||||
|
/// #endif
|
||||||
if (mergedOptions.render.background) {
|
if (mergedOptions.render.background) {
|
||||||
this.protyle.background = new Background(this.protyle);
|
this.protyle.background = new Background(this.protyle);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,14 +10,16 @@ import {hideElements} from "../ui/hideElements";
|
||||||
import {mathRender} from "../markdown/mathRender";
|
import {mathRender} from "../markdown/mathRender";
|
||||||
import {fetchPost, fetchSyncPost} from "../../util/fetch";
|
import {fetchPost, fetchSyncPost} from "../../util/fetch";
|
||||||
import {onGet} from "./onGet";
|
import {onGet} from "./onGet";
|
||||||
|
/// #if !MOBILE
|
||||||
import {getInstanceById} from "../../layout/util";
|
import {getInstanceById} from "../../layout/util";
|
||||||
import {Editor} from "../../editor";
|
|
||||||
import {Tab} from "../../layout/Tab";
|
import {Tab} from "../../layout/Tab";
|
||||||
import {blockRender} from "../markdown/blockRender";
|
|
||||||
import {getAllModels} from "../../layout/getAll";
|
import {getAllModels} from "../../layout/getAll";
|
||||||
|
import {updatePanelByEditor} from "../../editor/util";
|
||||||
|
/// #endif
|
||||||
|
import {Editor} from "../../editor";
|
||||||
|
import {blockRender} from "../markdown/blockRender";
|
||||||
import {processRender} from "./processCode";
|
import {processRender} from "./processCode";
|
||||||
import {highlightRender} from "../markdown/highlightRender";
|
import {highlightRender} from "../markdown/highlightRender";
|
||||||
import {updatePanelByEditor} from "../../editor/util";
|
|
||||||
|
|
||||||
const dragSb = (protyle: IProtyle, sourceElements: Element[], targetElement: Element, isBottom: boolean, direct: "col" | "row") => {
|
const dragSb = (protyle: IProtyle, sourceElements: Element[], targetElement: Element, isBottom: boolean, direct: "col" | "row") => {
|
||||||
const isSameDoc = protyle.element.contains(sourceElements[0]);
|
const isSameDoc = protyle.element.contains(sourceElements[0]);
|
||||||
|
|
@ -211,6 +213,7 @@ const dragSb = (protyle: IProtyle, sourceElements: Element[], targetElement: Ele
|
||||||
doOperations.push(sbData.doOperations[0], sbData.doOperations[1]);
|
doOperations.push(sbData.doOperations[0], sbData.doOperations[1]);
|
||||||
undoOperations.splice(0, 0, sbData.undoOperations[0], sbData.undoOperations[1]);
|
undoOperations.splice(0, 0, sbData.undoOperations[0], sbData.undoOperations[1]);
|
||||||
} else if (oldSourceParentElement && oldSourceParentElement.classList.contains("protyle-wysiwyg") && oldSourceParentElement.innerHTML === "") {
|
} else if (oldSourceParentElement && oldSourceParentElement.classList.contains("protyle-wysiwyg") && oldSourceParentElement.innerHTML === "") {
|
||||||
|
/// #if !MOBILE
|
||||||
// 拖拽后,根文档原内容为空,且不为悬浮窗
|
// 拖拽后,根文档原内容为空,且不为悬浮窗
|
||||||
const protyleElement = hasClosestByClassName(oldSourceParentElement, "protyle", true);
|
const protyleElement = hasClosestByClassName(oldSourceParentElement, "protyle", true);
|
||||||
if (protyleElement && !protyleElement.classList.contains("block__edit")) {
|
if (protyleElement && !protyleElement.classList.contains("block__edit")) {
|
||||||
|
|
@ -229,6 +232,7 @@ const dragSb = (protyle: IProtyle, sourceElements: Element[], targetElement: Ele
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// #endif
|
||||||
}
|
}
|
||||||
if (isSameDoc) {
|
if (isSameDoc) {
|
||||||
transaction(protyle, doOperations, undoOperations);
|
transaction(protyle, doOperations, undoOperations);
|
||||||
|
|
@ -487,6 +491,7 @@ const dragSame = (protyle: IProtyle, sourceElements: Element[], targetElement: E
|
||||||
doOperations.push(sbData.doOperations[0], sbData.doOperations[1]);
|
doOperations.push(sbData.doOperations[0], sbData.doOperations[1]);
|
||||||
undoOperations.splice(0, 0, sbData.undoOperations[0], sbData.undoOperations[1]);
|
undoOperations.splice(0, 0, sbData.undoOperations[0], sbData.undoOperations[1]);
|
||||||
} else if (oldSourceParentElement && oldSourceParentElement.classList.contains("protyle-wysiwyg") && oldSourceParentElement.childElementCount === 0) {
|
} else if (oldSourceParentElement && oldSourceParentElement.classList.contains("protyle-wysiwyg") && oldSourceParentElement.childElementCount === 0) {
|
||||||
|
/// #if !MOBILE
|
||||||
// 拖拽后,根文档原内容为空,且不为悬浮窗
|
// 拖拽后,根文档原内容为空,且不为悬浮窗
|
||||||
const protyleElement = hasClosestByClassName(oldSourceParentElement, "protyle", true);
|
const protyleElement = hasClosestByClassName(oldSourceParentElement, "protyle", true);
|
||||||
if (protyleElement && !protyleElement.classList.contains("block__edit")) {
|
if (protyleElement && !protyleElement.classList.contains("block__edit")) {
|
||||||
|
|
@ -505,6 +510,7 @@ const dragSame = (protyle: IProtyle, sourceElements: Element[], targetElement: E
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// #endif
|
||||||
}
|
}
|
||||||
if (isSameDoc) {
|
if (isSameDoc) {
|
||||||
transaction(protyle, doOperations, undoOperations);
|
transaction(protyle, doOperations, undoOperations);
|
||||||
|
|
@ -636,6 +642,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
dragSame(protyle, sourceElements, targetElement, targetClass.includes("dragover__bottom"));
|
dragSame(protyle, sourceElements, targetElement, targetClass.includes("dragover__bottom"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// #if !MOBILE
|
||||||
if (isBacklink) {
|
if (isBacklink) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// 等待 drag transaction
|
// 等待 drag transaction
|
||||||
|
|
@ -644,6 +651,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
});
|
});
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
|
/// #endif
|
||||||
} else if (window.siyuan.dragElement && window.siyuan.dragElement.getAttribute("data-type") === "navigation-file" && targetElement) {
|
} else if (window.siyuan.dragElement && window.siyuan.dragElement.getAttribute("data-type") === "navigation-file" && targetElement) {
|
||||||
// 文件树拖拽
|
// 文件树拖拽
|
||||||
fetchPost("/api/filetree/doc2Heading", {
|
fetchPost("/api/filetree/doc2Heading", {
|
||||||
|
|
@ -661,8 +669,10 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
size: Constants.SIZE_GET,
|
size: Constants.SIZE_GET,
|
||||||
}, getResponse => {
|
}, getResponse => {
|
||||||
onGet(getResponse, protyle);
|
onGet(getResponse, protyle);
|
||||||
|
/// #if !MOBILE
|
||||||
// 文档标题互转后,需更新大纲
|
// 文档标题互转后,需更新大纲
|
||||||
updatePanelByEditor(protyle, false, false, true);
|
updatePanelByEditor(protyle, false, false, true);
|
||||||
|
/// #endif
|
||||||
// 文档标题互转后,编辑区会跳转到开头 https://github.com/siyuan-note/siyuan/issues/2939
|
// 文档标题互转后,编辑区会跳转到开头 https://github.com/siyuan-note/siyuan/issues/2939
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
protyle.contentElement.scrollTop = scrollTop;
|
protyle.contentElement.scrollTop = scrollTop;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ import {getSearch, isMobile} from "../../util/functions";
|
||||||
import {isLocalPath, pathPosix} from "../../util/pathName";
|
import {isLocalPath, pathPosix} from "../../util/pathName";
|
||||||
import {genEmptyElement} from "../../block/util";
|
import {genEmptyElement} from "../../block/util";
|
||||||
import {previewImage} from "../preview/image";
|
import {previewImage} from "../preview/image";
|
||||||
import {openGlobalSearch} from "../../search/util";
|
|
||||||
import {contentMenu, imgMenu, linkMenu, refMenu, setFold, zoomOut} from "../../menus/protyle";
|
import {contentMenu, imgMenu, linkMenu, refMenu, setFold, zoomOut} from "../../menus/protyle";
|
||||||
import * as dayjs from "dayjs";
|
import * as dayjs from "dayjs";
|
||||||
import {dropEvent} from "../util/editorCommonEvent";
|
import {dropEvent} from "../util/editorCommonEvent";
|
||||||
|
|
@ -49,6 +48,7 @@ import {blockRender} from "../markdown/blockRender";
|
||||||
import {getAllModels} from "../../layout/getAll";
|
import {getAllModels} from "../../layout/getAll";
|
||||||
import {pushBack} from "../../util/backForward";
|
import {pushBack} from "../../util/backForward";
|
||||||
import {openAsset, openBy, openFileById} from "../../editor/util";
|
import {openAsset, openBy, openFileById} from "../../editor/util";
|
||||||
|
import {openGlobalSearch} from "../../search/util";
|
||||||
/// #endif
|
/// #endif
|
||||||
import {BlockPanel} from "../../block/Panel";
|
import {BlockPanel} from "../../block/Panel";
|
||||||
import {isCtrl} from "../util/compatibility";
|
import {isCtrl} from "../util/compatibility";
|
||||||
|
|
@ -1483,12 +1483,14 @@ export class WYSIWYG {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// #if !MOBILE
|
||||||
const tagElement = hasClosestByAttribute(event.target, "data-type", "tag");
|
const tagElement = hasClosestByAttribute(event.target, "data-type", "tag");
|
||||||
if (tagElement && !window.siyuan.altIsPressed && protyle.model) {
|
if (tagElement && !window.siyuan.altIsPressed && protyle.model) {
|
||||||
openGlobalSearch(`#${tagElement.textContent}#`, !window.siyuan.ctrlIsPressed);
|
openGlobalSearch(`#${tagElement.textContent}#`, !window.siyuan.ctrlIsPressed);
|
||||||
hideElements(["dialog"]);
|
hideElements(["dialog"]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
/// #endif
|
||||||
|
|
||||||
const embedItemElement = hasClosestByClassName(event.target, "protyle-wysiwyg__embed");
|
const embedItemElement = hasClosestByClassName(event.target, "protyle-wysiwyg__embed");
|
||||||
if (embedItemElement) {
|
if (embedItemElement) {
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,10 @@ import {isLocalPath} from "../../util/pathName";
|
||||||
import {clipboard} from "electron";
|
import {clipboard} from "electron";
|
||||||
import {getCurrentWindow} from "@electron/remote";
|
import {getCurrentWindow} from "@electron/remote";
|
||||||
/// #endif
|
/// #endif
|
||||||
|
/// #if !MOBILE
|
||||||
|
import {openBy, openFileById} from "../../editor/util";
|
||||||
|
import {commonHotkey} from "./commonHotkey";
|
||||||
|
/// #endif
|
||||||
import {linkMenu, refMenu, setFold, zoomOut} from "../../menus/protyle";
|
import {linkMenu, refMenu, setFold, zoomOut} from "../../menus/protyle";
|
||||||
import {setPosition} from "../../util/setPosition";
|
import {setPosition} from "../../util/setPosition";
|
||||||
import {removeEmbed} from "./removeEmbed";
|
import {removeEmbed} from "./removeEmbed";
|
||||||
|
|
@ -48,11 +52,9 @@ import {bindMenuKeydown} from "../../menus/Menu";
|
||||||
import {fetchPost} from "../../util/fetch";
|
import {fetchPost} from "../../util/fetch";
|
||||||
import {onGet} from "../util/onGet";
|
import {onGet} from "../util/onGet";
|
||||||
import {scrollCenter} from "../../util/highlightById";
|
import {scrollCenter} from "../../util/highlightById";
|
||||||
import {openBy, openFileById} from "../../editor/util";
|
|
||||||
import {BlockPanel} from "../../block/Panel";
|
import {BlockPanel} from "../../block/Panel";
|
||||||
import * as dayjs from "dayjs";
|
import * as dayjs from "dayjs";
|
||||||
import {highlightRender} from "../markdown/highlightRender";
|
import {highlightRender} from "../markdown/highlightRender";
|
||||||
import {commonHotkey} from "./commonHotkey";
|
|
||||||
import {countBlockWord} from "../../layout/status";
|
import {countBlockWord} from "../../layout/status";
|
||||||
|
|
||||||
export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
|
|
@ -813,11 +815,11 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
/// #if !MOBILE
|
||||||
if (commonHotkey(protyle, event)) {
|
if (commonHotkey(protyle, event)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
/// #endif
|
||||||
if (matchHotKey(window.siyuan.config.keymap.editor.general.copyBlockRef.custom, event)) {
|
if (matchHotKey(window.siyuan.config.keymap.editor.general.copyBlockRef.custom, event)) {
|
||||||
const selectElements = protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select");
|
const selectElements = protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select");
|
||||||
let actionElement;
|
let actionElement;
|
||||||
|
|
@ -1404,6 +1406,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// #if !MOBILE
|
||||||
const refElement = hasClosestByAttribute(range.startContainer, "data-type", "block-ref");
|
const refElement = hasClosestByAttribute(range.startContainer, "data-type", "block-ref");
|
||||||
if (refElement) {
|
if (refElement) {
|
||||||
const id = refElement.getAttribute("data-id");
|
const id = refElement.getAttribute("data-id");
|
||||||
|
|
@ -1448,8 +1451,9 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// #endif
|
||||||
|
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER && !MOBILE
|
||||||
if (matchHotKey(window.siyuan.config.keymap.editor.general.pasteAsPlainText.custom, event)) {
|
if (matchHotKey(window.siyuan.config.keymap.editor.general.pasteAsPlainText.custom, event)) {
|
||||||
writeText(clipboard.readText());
|
writeText(clipboard.readText());
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue