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/7881

Vanessae014d6e1f79b
diff --git a/app/src/util/globalShortcut.ts b/app/src/util/globalShortcut.ts
index e889b8c0b3..f73f123d5f 100644
--- a/app/src/util/globalShortcut.ts
+++ b/app/src/util/globalShortcut.ts
@@ -69,9 +69,13 @@ const switchDialogEvent = (event: MouseEvent, switchDialog: Dialog) => {
let target = event.target as HTMLElement;
while (!target.isSameNode(switchDialog.element)) {
if (target.classList.contains("b3-list-item")) {
- const currentType = target.getAttribute("data-type") as TDockType;
+ const currentType = target.getAttribute("data-type");
if (currentType) {
- getDockByType(currentType).toggleModel(currentType, true);
+ if (currentType === "riffCard") {
+ openCard();
+ } else {
+ getDockByType(currentType as TDockType).toggleModel(currentType as TDockType, true);
+ }
} else {
const currentId = target.getAttribute("data-id");
getAllTabs().find(item => {
@@ -358,9 +362,13 @@ export const globalShortcut = () => {
currentLiElement.removeAttribute("data-original");
currentLiElement = switchDialog.element.querySelector(".b3-list-item--focus");
}
- const currentType = currentLiElement.getAttribute("data-type") as TDockType;
+ const currentType = currentLiElement.getAttribute("data-type");
if (currentType) {
- getDockByType(currentType).toggleModel(currentType, true);
+ if (currentType === "riffCard") {
+ openCard()
+ } else {
+ getDockByType(currentType as TDockType).toggleModel(currentType as TDockType, true);
+ }
if (document.activeElement) {
(document.activeElement as HTMLElement).blur();
}
@@ -465,9 +473,14 @@ export const globalShortcut = () => {
}
let dockHtml = "";
if (!isTabWindow) {
- dockHtml = '<ul class="b3-list b3-list--background" style="max-height: calc(70vh - 35px);overflow: auto">';
+ dockHtml = `<ul class="b3-list b3-list--background" style="max-height: calc(70vh - 35px);overflow: auto">
+<li data-type="riffCard" data-index="0" class="b3-list-item${!tabHtml ? " b3-list-item--focus" : ""}">
+ <svg class="b3-list-item__graphic"><use xlink:href="#iconRiffCard"></use></svg>
+ <span class="b3-list-item__text">${window.siyuan.languages.riffCard}</span>
+ <span class="b3-list-item__meta">${updateHotkeyTip(window.siyuan.config.keymap.general.riffCard.custom)}</span>
+</li>`;
getAllDocks().forEach((item, index) => {
- dockHtml += `<li data-type="${item.type}" data-index="${index}" class="b3-list-item${(!tabHtml && !dockHtml) ? " b3-list-item--focus" : ""}">
+ dockHtml += `<li data-type="${item.type}" data-index="${index + 1}" class="b3-list-item">
<svg class="b3-list-item__graphic"><use xlink:href="#${item.icon}"></use></svg>
<span class="b3-list-item__text">${window.siyuan.languages[item.hotkeyLangId]}</span>
<span class="b3-list-item__meta">${updateHotkeyTip(window.siyuan.config.keymap.general[item.hotkeyLangId].custom)}</span>
@@ -915,9 +928,13 @@ const dialogArrow = (element: HTMLElement, event: KeyboardEvent) => {
(sideElement.querySelector(`[data-index="${currentLiElement.getAttribute("data-index")}"]`) || sideElement.lastElementChild).classList.add("b3-list-item--focus");
}
} else if (event.key === "Enter") {
- const currentType = currentLiElement.getAttribute("data-type") as TDockType;
+ const currentType = currentLiElement.getAttribute("data-type");
if (currentType) {
- getDockByType(currentType).toggleModel(currentType, true);
+ if (currentType === "riffCard") {
+ openCard()
+ } else {
+ getDockByType(currentType as TDockType).toggleModel(currentType as TDockType, true);
+ }
} else {
openFileById({
id: currentLiElement.getAttribute("data-node-id"),
@@ -963,9 +980,14 @@ ${unicode2Emoji(item.icon || Constants.SIYUAN_IMAGE_FILE, false, "b3-list-item__
});
let dockHtml = "";
if (!isWindow()) {
- dockHtml = '<ul class="b3-list b3-list--background" style="max-height: calc(70vh - 35px);overflow: auto">';
+ dockHtml = `<ul class="b3-list b3-list--background" style="max-height: calc(70vh - 35px);overflow: auto">
+<li data-type="riffCard" data-index="0" class="b3-list-item${!tabHtml ? " b3-list-item--focus" : ""}">
+ <svg class="b3-list-item__graphic"><use xlink:href="#iconRiffCard"></use></svg>
+ <span class="b3-list-item__text">${window.siyuan.languages.riffCard}</span>
+ <span class="b3-list-item__meta">${updateHotkeyTip(window.siyuan.config.keymap.general.riffCard.custom)}</span>
+</li>`;
getAllDocks().forEach((item, index) => {
- dockHtml += `<li data-type="${item.type}" data-index="${index}" class="b3-list-item${(!tabHtml && !dockHtml) ? " b3-list-item--focus" : ""}">
+ dockHtml += `<li data-type="${item.type}" data-index="${index + 1}" class="b3-list-item">
<svg class="b3-list-item__graphic"><use xlink:href="#${item.icon}"></use></svg>
<span class="b3-list-item__text">${window.siyuan.languages[item.hotkeyLangId]}</span>
<span class="b3-list-item__meta">${updateHotkeyTip(window.siyuan.config.keymap.general[item.hotkeyLangId].custom)}</span>