Skip to content

Commit

Permalink
🎨 fix #11345
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed May 12, 2024
1 parent 5298c83 commit 636352d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
6 changes: 5 additions & 1 deletion app/src/protyle/hint/extend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,13 @@ export const hintSlash = (key: string, protyle: IProtyle) => {
value: '<div data-type="NodeAttributeView" data-av-type="table"></div>',
html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconDatabase"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.database}</span></div>`,
}, {
filter: ["文档", "子文档", "wendang", "wd", "ziwendang", "zwd", "xjwd"],
filter: ["文档", "wendang", "wd", "xjwd", "new doc"],
value: Constants.ZWSP + 4,
html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconFile"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.newFile}</span><span class="b3-menu__accelerator">${updateHotkeyTip(window.siyuan.config.keymap.general.newFile.custom)}</span></div>`,
}, {
filter: ["子文档", "ziwendang", "zwd", "xjzwd", "create sub doc"],
value: Constants.ZWSP + 6,
html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconFile"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.newSubDoc}</span></div>`,
}, {
value: "",
html: "separator",
Expand Down
12 changes: 11 additions & 1 deletion app/src/protyle/hint/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 636352d

Please sign in to comment.