An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Keep database custom color swatches selectable https://github.com/siyuan-note/siyuan/issues/18931
Daniel0df070f1fbc9
diff --git a/app/src/protyle/render/av/color.test.ts b/app/src/protyle/render/av/color.test.tsindex 207c99b926..4ed6b8c1d4 100644--- a/app/src/protyle/render/av/color.test.ts+++ b/app/src/protyle/render/av/color.test.ts@@ -63,8 +63,9 @@ describe("AV resolved colors", () => {it("renders multi-digit custom swatches and the management entry", () => {const html = getAVColorGridHTML([customColor], "15", "Manage");- assert.match(html, /data-color="15" class="color__square color__square--current"/);+ assert.match(html, /type="button" data-color="15" class="color__square color__square--current"/);assert.match(html, /data-type="manageAVCustomColors"/);+ assert.match(html, /<svg class="svg--mid"><use xlink:href="#iconSettings"><\/use><\/svg>/);assert.match(html, /light-dark\(#ddeeff, #223344\)/);});});diff --git a/app/src/protyle/render/av/color.ts b/app/src/protyle/render/av/color.tsindex 40220169af..a5af547ac3 100644--- a/app/src/protyle/render/av/color.ts+++ b/app/src/protyle/render/av/color.ts@@ -95,11 +95,12 @@ export const getAVColorGridHTML = (customColors: IAVCustomColor[], currentColor:const colorHTML = colors.map(item => {const reference = getColorReference(item);const index = normalizeAVColorIndex(reference.color);- return `<button data-color="${index}" class="color__square${currentIndex === index ?+ return `<button type="button" data-color="${index}" class="color__square${currentIndex === index ?" color__square--current" : ""}" style="${getAVColorStyle(item)}">A</button>`;}).join("");- return colorHTML + `<button data-type="${AV_MANAGE_CUSTOM_COLORS_TYPE}" class="color__square ariaLabel" ` +- `aria-label="${escapeAttr(manageLabel)}"><svg><use xlink:href="#iconAdd"></use></svg></button>`;+ return colorHTML + `<button type="button" data-type="${AV_MANAGE_CUSTOM_COLORS_TYPE}" ` ++ `class="color__square ariaLabel" aria-label="${escapeAttr(manageLabel)}">` ++ '<svg class="svg--mid"><use xlink:href="#iconSettings"></use></svg></button>';};const mountedPaletteIndexes = new WeakMap<HTMLElement, number[]>();