diff --git a/app/src/protyle/hint/extend.ts b/app/src/protyle/hint/extend.ts index d50a8c5d5..bf331f3b5 100644 --- a/app/src/protyle/hint/extend.ts +++ b/app/src/protyle/hint/extend.ts @@ -51,9 +51,13 @@ export const hintSlash = (key: string, protyle: IProtyle) => { value: '
', html: `
${window.siyuan.languages.database}
`, }, { - filter: ["文档", "子文档", "wendang", "wd", "ziwendang", "zwd", "xjwd"], + filter: ["文档", "wendang", "wd", "xjwd", "new doc"], value: Constants.ZWSP + 4, html: `
${window.siyuan.languages.newFile}${updateHotkeyTip(window.siyuan.config.keymap.general.newFile.custom)}
`, + }, { + filter: ["子文档", "ziwendang", "zwd", "xjzwd", "create sub doc"], + value: Constants.ZWSP + 6, + html: `
${window.siyuan.languages.newSubDoc}
`, }, { value: "", html: "separator", diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.ts index 1c56d1d23..75e51a55c 100644 --- a/app/src/protyle/hint/index.ts +++ b/app/src/protyle/hint/index.ts @@ -9,7 +9,7 @@ import { getSelectionPosition } from "../util/selection"; import {genHintItemHTML, hintEmbed, hintRef, hintSlash} from "./extend"; -import {getSavePath} from "../../util/newFile"; +import {getSavePath, newFile} from "../../util/newFile"; import {upDownHint} from "../../util/upDownHint"; import {setPosition} from "../../util/setPosition"; import {getContenteditableElement, hasNextSibling, hasPreviousSibling} from "../wysiwyg/getBlock"; @@ -615,6 +615,16 @@ ${genHintItemHTML(item)} range.deleteContents(); return; } else if (value === Constants.ZWSP + 4) { + // 新建文档 + newFile({ + app: protyle.app, + notebookId: protyle.notebookId, + useSavePath: true, + currentPath: protyle.path, + }); + return; + } else if (value === Constants.ZWSP + 6) { + // 新建子文档 const newSubDocId = Lute.NewNodeID(); fetchPost("/api/filetree/createDoc", { notebook: protyle.notebookId,