Skip to content

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

:art: Unify database automation control tooltips https://github.com/siyuan-note/siyuan/issues/10863

Danielbcc834385b22
diff --git a/app/src/protyle/render/av/automation.ts b/app/src/protyle/render/av/automation.ts
index a98da8cedb..efc83123cd 100644
--- a/app/src/protyle/render/av/automation.ts
+++ b/app/src/protyle/render/av/automation.ts
@@ -40,7 +40,7 @@ const optionHTML = (value: string, label: string, selected: string) =>
`<option value="${escapeAttr(value)}"${value === selected ? " selected" : ""}>${escapeHtml(label)}</option>`;
const iconButton = (action: string, icon: string, label: string, warning = false) =>
- `<svg class="b3-menu__action b3-menu__action--show${warning ? " b3-menu__action--warning" : ""} ariaLabel" data-action="${action}" role="button" tabindex="0" aria-label="${escapeAttr(label)}"><use xlink:href="#${icon}"></use></svg>`;
+ `<svg class="b3-menu__action b3-menu__action--show${warning ? " b3-menu__action--warning" : ""} ariaLabel" data-action="${action}" role="button" tabindex="0" data-position="north" aria-label="${escapeAttr(label)}"><use xlink:href="#${icon}"></use></svg>`;
export const openAutomationMenu = async (options: {
protyle: IProtyle,
@@ -294,7 +294,7 @@ export const openAutomationMenu = async (options: {
}
body.innerHTML = `<div class="ft__on-surface ft__smaller">${lang.automationTip}</div>
<div class="av__automation-row">${rule ? `<select class="b3-select fn__flex-1" data-rule aria-label="${lang.databaseAutomations}">${rules.map((item, i) => optionHTML(String(i), item.name, String(index))).join("")}</select>` : ""}${iconButton("add-rule", "iconAdd", lang.new)}${rule ? iconButton("remove-rule", "iconTrashcan", lang.delete, true) : ""}</div>
-${rule ? `<div class="av__automation-row"><input class="b3-text-field fn__flex-1" data-name aria-label="${lang.name}" value="${escapeAttr(rule.name)}"><label class="fn__flex fn__flex-center"><input type="checkbox" class="b3-switch fn__flex-center" data-enabled${rule.enabled ? " checked" : ""}><span class="fn__space"></span>${lang.enable}</label></div>
+${rule ? `<div class="av__automation-row"><input class="b3-text-field fn__flex-1" data-name aria-label="${lang.name}" value="${escapeAttr(rule.name)}"><input type="checkbox" class="b3-switch fn__flex-center ariaLabel" data-position="north" aria-label="${escapeAttr(lang.enable)}" data-enabled${rule.enabled ? " checked" : ""}></div>
<div class="ft__error ft__smaller fn__none" role="status" data-status></div>
<div class="ft__b">${lang.automationTrigger}</div><div class="av__automation-row"><select class="b3-select" data-trigger>${optionHTML("added", lang.automationAdded, rule.trigger)}${optionHTML("changed", lang.automationChanged, rule.trigger)}</select>${rule.trigger === "changed" ? `<select class="b3-select fn__flex-1" data-trigger-field aria-label="${lang.fields}">${optionHTML("", lang.all, rule.keyID || "")}${fieldsOf(database).map(field => optionHTML(field.id, field.name, rule.keyID)).join("")}</select>` : ""}</div>
<div data-source-conditions></div><div class="ft__b">${lang.automationAction}</div><div data-actions></div><button type="button" class="b3-button b3-button--cancel" data-action="add-action"><svg><use xlink:href="#iconAdd"></use></svg>${lang.automationAction}</button>` : ""}`;