mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-13 18:54:21 +01:00
This commit is contained in:
parent
53cc9ed1e3
commit
c77f880803
6 changed files with 40 additions and 4 deletions
|
|
@ -34,6 +34,7 @@ import {transaction} from "../wysiwyg/transaction";
|
|||
import {hideTooltip} from "../../dialog/tooltip";
|
||||
import {transferBlockRef} from "../../menus/block";
|
||||
import {openCardByData} from "../../card/openCard";
|
||||
import {makeCard, quickMakeCard} from "../../card/makeCard";
|
||||
|
||||
export class Title {
|
||||
public element: HTMLElement;
|
||||
|
|
@ -131,6 +132,11 @@ export class Title {
|
|||
});
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
} else if (matchHotKey(window.siyuan.config.keymap.editor.general.quickMakeCard.custom, event)) {
|
||||
quickMakeCard([this.element]);
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
return true;
|
||||
} else if (matchHotKey("⌘A", event)) {
|
||||
getEditorRange(this.editElement).selectNodeContents(this.editElement);
|
||||
event.preventDefault();
|
||||
|
|
@ -358,13 +364,29 @@ export class Title {
|
|||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.riffCard,
|
||||
icon: "iconRiffCard",
|
||||
iconHTML: '<svg class="b3-menu__icon" style="color: var(--b3-theme-secondary)"><use xlink:href="#iconRiffCard"></use></svg>',
|
||||
click: () => {
|
||||
fetchPost("/api/riff/getTreeRiffDueCards", {rootID: protyle.block.rootID}, (response) => {
|
||||
openCardByData(response.data, `<span data-id="${protyle.block.rootID}" class="fn__flex-center">${escapeHtml(this.editElement.textContent)}</span>`);
|
||||
});
|
||||
}
|
||||
}).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([this.element]);
|
||||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.addToDeck,
|
||||
icon: "iconRiffCard",
|
||||
click: () => {
|
||||
makeCard([this.element]);
|
||||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
iconHTML: Constants.ZWSP,
|
||||
|
|
@ -386,6 +408,10 @@ ${window.siyuan.languages.createdAt} ${dayjs(response.data.ial.id.substr(0, 14))
|
|||
if (this.editElement.getAttribute("data-render") === "true" && !refresh) {
|
||||
return false;
|
||||
}
|
||||
this.element.setAttribute("data-node-id", protyle.block.rootID);
|
||||
if (response.data.ial['custom-riff-decks']) {
|
||||
this.element.setAttribute("custom-riff-decks", response.data.ial['custom-riff-decks']);
|
||||
}
|
||||
protyle.background.render(response.data.ial, protyle.block.rootID);
|
||||
protyle.wysiwyg.renderCustom(response.data.ial);
|
||||
this.editElement.setAttribute("data-render", "true");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue