mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 07:30:12 +01:00
This commit is contained in:
parent
53cc9ed1e3
commit
c77f880803
6 changed files with 40 additions and 4 deletions
|
|
@ -432,6 +432,10 @@
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&[custom-riff-decks] {
|
||||||
|
box-shadow: 3px 0px 0px -1px var(--b3-protyle-inline-mark-background)
|
||||||
|
}
|
||||||
|
|
||||||
&__icon {
|
&__icon {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: -24px;
|
left: -24px;
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,7 @@ export const makeCard = (nodeElement: Element[]) => {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
msgId = showMessage(window.siyuan.languages._kernel[142]);
|
msgId = showMessage(window.siyuan.languages._kernel[142]);
|
||||||
|
inputElement.focus();
|
||||||
}
|
}
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
|
||||||
|
|
@ -299,7 +299,7 @@ export const initFileMenu = (notebookId: string, pathString: string, liElement:
|
||||||
}).element);
|
}).element);
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
label: window.siyuan.languages.riffCard,
|
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: () => {
|
click: () => {
|
||||||
fetchPost("/api/riff/getTreeRiffDueCards", {rootID: id}, (response) => {
|
fetchPost("/api/riff/getTreeRiffDueCards", {rootID: id}, (response) => {
|
||||||
openCardByData(response.data, `<span data-id="${id}" class="fn__flex-center">${escapeHtml(name)}</span>`);
|
openCardByData(response.data, `<span data-id="${id}" class="fn__flex-center">${escapeHtml(name)}</span>`);
|
||||||
|
|
|
||||||
|
|
@ -667,7 +667,7 @@ export class Gutter {
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
label: window.siyuan.languages.quickMakeCard,
|
label: window.siyuan.languages.quickMakeCard,
|
||||||
accelerator: window.siyuan.config.keymap.editor.general.quickMakeCard.custom,
|
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>",
|
iconHTML: '<svg class="b3-menu__icon" style="color:var(--b3-theme-primary)"><use xlink:href="#iconRiffCard"></use></svg>',
|
||||||
icon: "iconRiffCard",
|
icon: "iconRiffCard",
|
||||||
click() {
|
click() {
|
||||||
quickMakeCard(selectsElement);
|
quickMakeCard(selectsElement);
|
||||||
|
|
@ -1440,7 +1440,7 @@ export class Gutter {
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
label: window.siyuan.languages.quickMakeCard,
|
label: window.siyuan.languages.quickMakeCard,
|
||||||
accelerator: window.siyuan.config.keymap.editor.general.quickMakeCard.custom,
|
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>",
|
iconHTML: '<svg class="b3-menu__icon" style="color:var(--b3-theme-primary)"><use xlink:href="#iconRiffCard"></use></svg>',
|
||||||
icon: "iconRiffCard",
|
icon: "iconRiffCard",
|
||||||
click() {
|
click() {
|
||||||
quickMakeCard([nodeElement]);
|
quickMakeCard([nodeElement]);
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ import {transaction} from "../wysiwyg/transaction";
|
||||||
import {hideTooltip} from "../../dialog/tooltip";
|
import {hideTooltip} from "../../dialog/tooltip";
|
||||||
import {transferBlockRef} from "../../menus/block";
|
import {transferBlockRef} from "../../menus/block";
|
||||||
import {openCardByData} from "../../card/openCard";
|
import {openCardByData} from "../../card/openCard";
|
||||||
|
import {makeCard, quickMakeCard} from "../../card/makeCard";
|
||||||
|
|
||||||
export class Title {
|
export class Title {
|
||||||
public element: HTMLElement;
|
public element: HTMLElement;
|
||||||
|
|
@ -131,6 +132,11 @@ export class Title {
|
||||||
});
|
});
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
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)) {
|
} else if (matchHotKey("⌘A", event)) {
|
||||||
getEditorRange(this.editElement).selectNodeContents(this.editElement);
|
getEditorRange(this.editElement).selectNodeContents(this.editElement);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -358,13 +364,29 @@ export class Title {
|
||||||
}).element);
|
}).element);
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
label: window.siyuan.languages.riffCard,
|
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: () => {
|
click: () => {
|
||||||
fetchPost("/api/riff/getTreeRiffDueCards", {rootID: protyle.block.rootID}, (response) => {
|
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>`);
|
openCardByData(response.data, `<span data-id="${protyle.block.rootID}" class="fn__flex-center">${escapeHtml(this.editElement.textContent)}</span>`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).element);
|
}).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({type: "separator"}).element);
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
iconHTML: Constants.ZWSP,
|
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) {
|
if (this.editElement.getAttribute("data-render") === "true" && !refresh) {
|
||||||
return false;
|
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.background.render(response.data.ial, protyle.block.rootID);
|
||||||
protyle.wysiwyg.renderCustom(response.data.ial);
|
protyle.wysiwyg.renderCustom(response.data.ial);
|
||||||
this.editElement.setAttribute("data-render", "true");
|
this.editElement.setAttribute("data-render", "true");
|
||||||
|
|
|
||||||
|
|
@ -448,6 +448,11 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, focus: b
|
||||||
if (refElement) {
|
if (refElement) {
|
||||||
nodeAttrHTML += refElement.outerHTML;
|
nodeAttrHTML += refElement.outerHTML;
|
||||||
}
|
}
|
||||||
|
if (data.new['custom-riff-decks']) {
|
||||||
|
protyle.title.element.setAttribute("custom-riff-decks", data.new['custom-riff-decks']);
|
||||||
|
} else {
|
||||||
|
protyle.title.element.removeAttribute("custom-riff-decks");
|
||||||
|
}
|
||||||
protyle.title.element.querySelector(".protyle-attr").innerHTML = nodeAttrHTML;
|
protyle.title.element.querySelector(".protyle-attr").innerHTML = nodeAttrHTML;
|
||||||
protyle.wysiwyg.renderCustom(attrsResult);
|
protyle.wysiwyg.renderCustom(attrsResult);
|
||||||
if (data.new.icon !== data.old.icon) {
|
if (data.new.icon !== data.old.icon) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue