Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/14308

Vanessa8af51b8592f2
diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.ts
index 10db19dcf7..888d945781 100644
--- a/app/src/protyle/render/av/openMenuPanel.ts
+++ b/app/src/protyle/render/av/openMenuPanel.ts
@@ -1189,6 +1189,8 @@ export const openMenuPanel = (options: {
event.stopPropagation();
break;
} else if (type === "addColOptionOrCell") {
+ menuElement.querySelector(".b3-menu__item--current")?.classList.remove("b3-menu__item--current");
+ target.classList.add("b3-menu__item--current");
if (target.querySelector(".b3-menu__checked")) {
removeCellOption(options.protyle, options.cellElements, menuElement.querySelector(`.b3-chips .b3-chip[data-content="${escapeAttr(target.dataset.name)}"]`), options.blockElement);
} else {
diff --git a/app/src/protyle/render/av/select.ts b/app/src/protyle/render/av/select.ts
index fa5ec852c4..dd31d57665 100644
--- a/app/src/protyle/render/av/select.ts
+++ b/app/src/protyle/render/av/select.ts
@@ -24,12 +24,13 @@ const filterSelectHTML = (key: string, options: {
});
}
if (options) {
+ const currentName = document.querySelector(".av__panel .b3-menu__item--current")?.getAttribute("data-name") || "";
options.forEach(item => {
if (!key ||
(key.toLowerCase().indexOf(item.name.toLowerCase()) > -1 ||
item.name.toLowerCase().indexOf(key.toLowerCase()) > -1)) {
const airaLabel = item.desc ? `${escapeAriaLabel(item.name)}<div class='ft__on-surface'>${escapeAriaLabel(item.desc || "")}</div>` : "";
- html += `<button data-type="addColOptionOrCell" class="b3-menu__item" data-name="${escapeAttr(item.name)}" data-desc="${escapeAttr(item.desc || "")}" draggable="true" data-color="${item.color}">
+ html += `<button data-type="addColOptionOrCell" class="b3-menu__item${currentName === item.name ? " b3-menu__item--current" : ""}" data-name="${escapeAttr(item.name)}" data-desc="${escapeAttr(item.desc || "")}" draggable="true" data-color="${item.color}">
<svg class="b3-menu__icon fn__grab"><use xlink:href="#iconDrag"></use></svg>
<div class="fn__flex-1 ariaLabel" data-position="parentW" aria-label="${airaLabel}">
<span class="b3-chip" style="background-color:var(--b3-font-background${item.color});color:var(--b3-font-color${item.color})">
@@ -46,6 +47,7 @@ const filterSelectHTML = (key: string, options: {
});
}
if (!hasMatch && key) {
+ html = html.replace('class="b3-menu__item b3-menu__item--current"', 'class="b3-menu__item"');
const colorIndex = (options?.length || 0) % 14 + 1;
html = `<button data-type="addColOptionOrCell" class="b3-menu__item b3-menu__item--current" data-name="${key}" data-color="${colorIndex}">
<svg class="b3-menu__icon"><use xlink:href="#iconAdd"></use></svg>
@@ -56,6 +58,8 @@ const filterSelectHTML = (key: string, options: {
</div>
<span class="b3-menu__accelerator">${window.siyuan.languages.enterKey}</span>
</button>${html}`;
+ } else if (html.indexOf("b3-menu__item--current") === -1) {
+ html = html.replace('class="b3-menu__item"', 'class="b3-menu__item b3-menu__item--current"');
}
return html;
};