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: Place new collection attribute caret after the custom prefix https://github.com/siyuan-note/siyuan/issues/20645
Danield88d803b2896
diff --git a/app/src/protyle/render/av/collectionConditions.ts b/app/src/protyle/render/av/collectionConditions.tsindex 8770fc6182..a252dbbc8d 100644--- a/app/src/protyle/render/av/collectionConditions.ts+++ b/app/src/protyle/render/av/collectionConditions.ts@@ -193,7 +193,9 @@ export const mountCollectionConditions = (host: HTMLElement, source: AVAutomatioif (editing < 0 && source.attributes?.length >= 20) { return; }draft = editing >= 0 ? {...source.attributes[editing]} : {name: "custom-", operator: "exists"};renderEditor();- editor.querySelector<HTMLInputElement>("input").focus();+ const input = editor.querySelector<HTMLInputElement>("[data-attr-name]");+ input.focus();+ if (editing < 0) { input.setSelectionRange(input.value.length, input.value.length); }} else if (target.dataset.removeFilter) {const index = Number(target.dataset.index);if (target.dataset.removeFilter === "type") { source.types.splice(index, 1); }diff --git a/app/tests/automationPanel.test.js b/app/tests/automationPanel.test.jsindex 2360998984..91ab56ea3b 100644--- a/app/tests/automationPanel.test.js+++ b/app/tests/automationPanel.test.js@@ -598,6 +598,11 @@ const runCases = async (sources, css, mobile) => {const draftWrites = transactions.length;await click("[data-add-attribute] svg");assert.equal(transactions.length, draftWrites, "adding an attribute starts an unsaved draft");+ const attributeName = get("[data-attr-name]");+ assert.equal(document.activeElement, attributeName, "adding an attribute focuses its name");+ assert.equal(attributeName.value, "custom-");+ assert.deepEqual([attributeName.selectionStart, attributeName.selectionEnd], [7, 7],+ "the caret starts after the custom attribute prefix");await change("[data-attr-name]", "custom-status");await click("[data-attr-operator]");fieldMenu.items.find(item => item.label === lang.filterOperatorIs).click();