mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-26 00:44:07 +01:00
This commit is contained in:
parent
f25b36ff38
commit
cd40ec50bb
21 changed files with 341 additions and 398 deletions
|
|
@ -104,7 +104,7 @@ export class Gutter {
|
|||
const gutterNodeElement = protyle.wysiwyg.element.querySelector(`[data-node-id="${gutterId}"]`)
|
||||
if (gutterNodeElement) {
|
||||
selectElements.forEach((item => {
|
||||
item.classList.remove("protyle-wysiwyg--select")
|
||||
item.classList.remove("protyle-wysiwyg--select")
|
||||
}));
|
||||
gutterNodeElement.classList.add("protyle-wysiwyg--select")
|
||||
selectElements = [gutterNodeElement]
|
||||
|
|
@ -797,20 +797,21 @@ export class Gutter {
|
|||
}
|
||||
this.genAlign(selectsElement, protyle);
|
||||
this.genWidths(selectsElement, protyle);
|
||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.quickMakeCard,
|
||||
accelerator: window.siyuan.config.keymap.editor.general.quickMakeCard.custom,
|
||||
iconHTML: '<svg class="b3-menu__icon" style="color:var(--b3-theme-primary)"><use xlink:href="#iconRiffCard"></use></svg>',
|
||||
icon: "iconRiffCard",
|
||||
click() {
|
||||
quickMakeCard(protyle, selectsElement);
|
||||
}
|
||||
}).element);
|
||||
if (window.siyuan.config.flashcard.deck) {
|
||||
if (!window.siyuan.config.readonly) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.quickMakeCard,
|
||||
accelerator: window.siyuan.config.keymap.editor.general.quickMakeCard.custom,
|
||||
iconHTML: '<svg class="b3-menu__icon" style="color:var(--b3-theme-primary)"><use xlink:href="#iconRiffCard"></use></svg>',
|
||||
icon: "iconRiffCard",
|
||||
click() {
|
||||
quickMakeCard(protyle, selectsElement);
|
||||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.addToDeck,
|
||||
icon: "iconRiffCard",
|
||||
ignore: !window.siyuan.config.flashcard.deck,
|
||||
click() {
|
||||
const ids: string[] = [];
|
||||
selectsElement.forEach(item => {
|
||||
|
|
@ -1667,32 +1668,30 @@ export class Gutter {
|
|||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.wechatReminder,
|
||||
icon: "iconMp",
|
||||
disabled: window.siyuan.config.readonly,
|
||||
ignore: window.siyuan.config.readonly,
|
||||
click() {
|
||||
openWechatNotify(nodeElement);
|
||||
}
|
||||
}).element);
|
||||
}
|
||||
if (type !== "NodeThematicBreak") {
|
||||
if (type !== "NodeThematicBreak" && !window.siyuan.config.readonly) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.quickMakeCard,
|
||||
accelerator: window.siyuan.config.keymap.editor.general.quickMakeCard.custom,
|
||||
iconHTML: '<svg class="b3-menu__icon" style="color:var(--b3-theme-primary)"><use xlink:href="#iconRiffCard"></use></svg>',
|
||||
icon: "iconRiffCard",
|
||||
disabled: window.siyuan.config.readonly,
|
||||
click() {
|
||||
quickMakeCard(protyle, [nodeElement]);
|
||||
}
|
||||
}).element);
|
||||
if (window.siyuan.config.flashcard.deck) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.addToDeck,
|
||||
icon: "iconRiffCard",
|
||||
click() {
|
||||
makeCard(protyle.app, [id]);
|
||||
}
|
||||
}).element);
|
||||
}
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.addToDeck,
|
||||
ignore: !window.siyuan.config.flashcard.deck,
|
||||
icon: "iconRiffCard",
|
||||
click() {
|
||||
makeCard(protyle.app, [id]);
|
||||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -109,68 +109,63 @@ export const openTitleMenu = (protyle: IProtyle, position: IPosition) => {
|
|||
openFileAttr(response.data.ial, "bookmark", protyle);
|
||||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.wechatReminder,
|
||||
icon: "iconMp",
|
||||
disabled: window.siyuan.config.readonly,
|
||||
click() {
|
||||
openFileWechatNotify(protyle);
|
||||
}
|
||||
}).element);
|
||||
const riffCardMenu = [{
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.spaceRepetition,
|
||||
accelerator: window.siyuan.config.keymap.editor.general.spaceRepetition.custom,
|
||||
disabled: window.siyuan.config.readonly,
|
||||
click: () => {
|
||||
fetchPost("/api/riff/getTreeRiffDueCards", {rootID: protyle.block.rootID}, (response) => {
|
||||
openCardByData(protyle.app, response.data, "doc", protyle.block.rootID, response.data.name);
|
||||
});
|
||||
}
|
||||
}, {
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.manage,
|
||||
disabled: window.siyuan.config.readonly,
|
||||
click: () => {
|
||||
fetchPost("/api/filetree/getHPathByID", {
|
||||
id: protyle.block.rootID
|
||||
}, (response) => {
|
||||
viewCards(protyle.app, protyle.block.rootID, pathPosix().join(getNotebookName(protyle.notebookId), (response.data)), "Tree");
|
||||
});
|
||||
}
|
||||
}, {
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.quickMakeCard,
|
||||
accelerator: window.siyuan.config.keymap.editor.general.quickMakeCard.custom,
|
||||
disabled: window.siyuan.config.readonly,
|
||||
click: () => {
|
||||
let titleElement = protyle.title?.element;
|
||||
if (!titleElement) {
|
||||
titleElement = document.createElement("div");
|
||||
titleElement.setAttribute("data-node-id", protyle.block.rootID);
|
||||
titleElement.setAttribute(Constants.CUSTOM_RIFF_DECKS, response.data.ial[Constants.CUSTOM_RIFF_DECKS]);
|
||||
if (!window.siyuan.config.readonly) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.wechatReminder,
|
||||
icon: "iconMp",
|
||||
click() {
|
||||
openFileWechatNotify(protyle);
|
||||
}
|
||||
quickMakeCard(protyle, [titleElement]);
|
||||
}
|
||||
}];
|
||||
if (window.siyuan.config.flashcard.deck) {
|
||||
riffCardMenu.push({
|
||||
}).element);
|
||||
const riffCardMenu: IMenu[] = [{
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.addToDeck,
|
||||
disabled: window.siyuan.config.readonly,
|
||||
label: window.siyuan.languages.spaceRepetition,
|
||||
accelerator: window.siyuan.config.keymap.editor.general.spaceRepetition.custom,
|
||||
click: () => {
|
||||
makeCard(protyle.app, [protyle.block.rootID]);
|
||||
fetchPost("/api/riff/getTreeRiffDueCards", {rootID: protyle.block.rootID}, (response) => {
|
||||
openCardByData(protyle.app, response.data, "doc", protyle.block.rootID, response.data.name);
|
||||
});
|
||||
}
|
||||
});
|
||||
}, {
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.manage,
|
||||
click: () => {
|
||||
fetchPost("/api/filetree/getHPathByID", {
|
||||
id: protyle.block.rootID
|
||||
}, (response) => {
|
||||
viewCards(protyle.app, protyle.block.rootID, pathPosix().join(getNotebookName(protyle.notebookId), (response.data)), "Tree");
|
||||
});
|
||||
}
|
||||
}, {
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.quickMakeCard,
|
||||
accelerator: window.siyuan.config.keymap.editor.general.quickMakeCard.custom,
|
||||
click: () => {
|
||||
let titleElement = protyle.title?.element;
|
||||
if (!titleElement) {
|
||||
titleElement = document.createElement("div");
|
||||
titleElement.setAttribute("data-node-id", protyle.block.rootID);
|
||||
titleElement.setAttribute(Constants.CUSTOM_RIFF_DECKS, response.data.ial[Constants.CUSTOM_RIFF_DECKS]);
|
||||
}
|
||||
quickMakeCard(protyle, [titleElement]);
|
||||
}
|
||||
}];
|
||||
if (window.siyuan.config.flashcard.deck) {
|
||||
riffCardMenu.push({
|
||||
iconHTML: "",
|
||||
label: window.siyuan.languages.addToDeck,
|
||||
click: () => {
|
||||
makeCard(protyle.app, [protyle.block.rootID]);
|
||||
}
|
||||
});
|
||||
}
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.riffCard,
|
||||
type: "submenu",
|
||||
icon: "iconRiffCard",
|
||||
submenu: riffCardMenu,
|
||||
}).element);
|
||||
}
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.riffCard,
|
||||
type: "submenu",
|
||||
icon: "iconRiffCard",
|
||||
submenu: riffCardMenu,
|
||||
disabled: window.siyuan.config.readonly,
|
||||
}).element);
|
||||
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.search,
|
||||
icon: "iconSearch",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue