diff --git a/app/src/assets/scss/_protyle.scss b/app/src/assets/scss/_protyle.scss
index b9637ddf7..bf3eae29a 100644
--- a/app/src/assets/scss/_protyle.scss
+++ b/app/src/assets/scss/_protyle.scss
@@ -432,6 +432,10 @@
opacity: 1;
}
+ &[custom-riff-decks] {
+ box-shadow: 3px 0px 0px -1px var(--b3-protyle-inline-mark-background)
+ }
+
&__icon {
position: absolute;
left: -24px;
diff --git a/app/src/card/makeCard.ts b/app/src/card/makeCard.ts
index 544020a01..84642a1af 100644
--- a/app/src/card/makeCard.ts
+++ b/app/src/card/makeCard.ts
@@ -92,6 +92,7 @@ export const makeCard = (nodeElement: Element[]) => {
});
} else {
msgId = showMessage(window.siyuan.languages._kernel[142]);
+ inputElement.focus();
}
event.stopPropagation();
event.preventDefault();
diff --git a/app/src/menus/navigation.ts b/app/src/menus/navigation.ts
index 6053ee000..9e1094b8b 100644
--- a/app/src/menus/navigation.ts
+++ b/app/src/menus/navigation.ts
@@ -299,7 +299,7 @@ export const initFileMenu = (notebookId: string, pathString: string, liElement:
}).element);
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.riffCard,
- icon: "iconRiffCard",
+ iconHTML: '',
click: () => {
fetchPost("/api/riff/getTreeRiffDueCards", {rootID: id}, (response) => {
openCardByData(response.data, `${escapeHtml(name)}`);
diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts
index fd45a201c..22ba309ba 100644
--- a/app/src/protyle/gutter/index.ts
+++ b/app/src/protyle/gutter/index.ts
@@ -667,7 +667,7 @@ export class Gutter {
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.quickMakeCard,
accelerator: window.siyuan.config.keymap.editor.general.quickMakeCard.custom,
- iconHTML: "",
+ iconHTML: '',
icon: "iconRiffCard",
click() {
quickMakeCard(selectsElement);
@@ -1440,7 +1440,7 @@ export class Gutter {
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.quickMakeCard,
accelerator: window.siyuan.config.keymap.editor.general.quickMakeCard.custom,
- iconHTML: "",
+ iconHTML: '',
icon: "iconRiffCard",
click() {
quickMakeCard([nodeElement]);
diff --git a/app/src/protyle/header/Title.ts b/app/src/protyle/header/Title.ts
index adfbffe4f..ca4084d56 100644
--- a/app/src/protyle/header/Title.ts
+++ b/app/src/protyle/header/Title.ts
@@ -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: '',
click: () => {
fetchPost("/api/riff/getTreeRiffDueCards", {rootID: protyle.block.rootID}, (response) => {
openCardByData(response.data, `${escapeHtml(this.editElement.textContent)}`);
});
}
}).element);
+ window.siyuan.menus.menu.append(new MenuItem({
+ label: window.siyuan.languages.quickMakeCard,
+ accelerator: window.siyuan.config.keymap.editor.general.quickMakeCard.custom,
+ iconHTML: '',
+ 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");
diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts
index d3a8e92dc..db03e5a16 100644
--- a/app/src/protyle/wysiwyg/transaction.ts
+++ b/app/src/protyle/wysiwyg/transaction.ts
@@ -448,6 +448,11 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, focus: b
if (refElement) {
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.wysiwyg.renderCustom(attrsResult);
if (data.new.icon !== data.old.icon) {