Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: fix https://github.com/siyuan-note/siyuan/issues/7460

Vanessac77f8808033d
diff --git a/app/src/assets/scss/_protyle.scss b/app/src/assets/scss/_protyle.scss
index b9637ddf7d..bf3eae29a2 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 544020a017..84642a1afc 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 6053ee000c..9e1094b8bb 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: '<svg class="b3-menu__icon" style="color: var(--b3-theme-secondary)"><use xlink:href="#iconRiffCard"></use></svg>',
click: () => {
fetchPost("/api/riff/getTreeRiffDueCards", {rootID: id}, (response) => {
openCardByData(response.data, `<span data-id="${id}" class="fn__flex-center">${escapeHtml(name)}</span>`);
diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts
index fd45a201c0..22ba309ba4 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: "<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",
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: "<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",
click() {
quickMakeCard([nodeElement]);
diff --git a/app/src/protyle/header/Title.ts b/app/src/protyle/header/Title.ts
index adfbffe4f5..ca4084d562 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: '<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");
diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts
index d3a8e92dc7..db03e5a164 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) {