An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:lipstick: Compact automation menus and reorder collection controls https://github.com/siyuan-note/siyuan/issues/20645
Daniel3c471dc6b2c6
diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20240208172514-9dsv6na.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20240208172514-9dsv6na.syindex e0443e2fa1..76f0fef9ad 100644--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20240208172514-9dsv6na.sy+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20240208172514-9dsv6na.sy@@ -7,7 +7,7 @@"id": "20240208172514-9dsv6na","title": "Database","type": "doc",- "updated": "20261018122129"+ "updated": "20261018144949"},"Children": [{@@ -4554,12 +4554,12 @@"Type": "NodeParagraph","Properties": {"id": "20261017204817-jfdo45b",- "updated": "20261017234820"+ "updated": "20261018144949"},"Children": [{"Type": "NodeText",- "Data": "The Collect menu beside the tag conditions offers Default, Block containing the tag, and Container block. Default prefers the enclosing list item when its first content block contains the tags and it meets the type and attribute conditions; otherwise it uses the eligible tagged block. Selecting both paragraph and list-item types still produces only one target for the same tag source. Block containing the tag filters and collects the actual tagged block by its type and attributes. Container block collects the nearest container meeting the selected type and attribute conditions, deduplicating by block ID; documents are eligible only when explicitly selected. All required tags must occur in the same source block, rather than being combined across children. With no tag conditions, this option has no effect. Preview shows the final collection targets. Changing this option preserves existing entries and fields without converting their bound blocks. The two explicit modes require automation format 4; older formats remain readable, and older clients reject format 4 without rewriting the database."+ "Data": "The Collect menu above Block types offers Default, Block containing the tag, and Container block. Default prefers the enclosing list item when its first content block contains the tags and it meets the type and attribute conditions; otherwise it uses the eligible tagged block. Selecting both paragraph and list-item types still produces only one target for the same tag source. Block containing the tag filters and collects the actual tagged block by its type and attributes. Container block collects the nearest container meeting the selected type and attribute conditions, deduplicating by block ID; documents are eligible only when explicitly selected. All required tags must occur in the same source block, rather than being combined across children. With no tag conditions, this option has no effect. Preview shows the final collection targets. Changing this option preserves existing entries and fields without converting their bound blocks. The two explicit modes require automation format 4; older formats remain readable, and older clients reject format 4 without rewriting the database."}]},diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20240208113259-nykkvaq.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20240208113259-nykkvaq.syindex 8c2ce09a0b..763b061de4 100644--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20240208113259-nykkvaq.sy+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20240208113259-nykkvaq.sy@@ -7,7 +7,7 @@"id": "20240208113259-nykkvaq","title": "数据库","type": "doc",- "updated": "20261018122207"+ "updated": "20261018144949"},"Children": [{@@ -4554,12 +4554,12 @@"Type": "NodeParagraph","Properties": {"id": "20261017204817-4ocp9jq",- "updated": "20261017234820"+ "updated": "20261018144949"},"Children": [{"Type": "NodeText",- "Data": "标签条件旁的「收集对象」提供「默认」「标签所在块」和「容器块」。默认在列表项首个内容块包含标签且列表项满足类型和属性条件时优先收集列表项,否则尝试符合条件的标签所在块;同时选择段落和列表项也不会为同一个标签来源收集两个层级;标签所在块按实际包含标签的块的类型和属性筛选并收集;容器块向上选择最近的符合类型和属性条件的容器,并按块 ID 去重,文档只有被显式选择时才参与。要求全部标签时,标签必须出现在同一个来源块中,不会合并不同子块的标签。没有标签条件时,此选项不影响筛选。预览显示最终收集对象。切换不会转换已有条目的绑定块或修改其字段。两种显式模式需要自动化格式 4,已有格式仍可读取;旧客户端会拒绝格式 4,不会改写数据库。"+ "Data": "块类型上方的「收集对象」提供「默认」「标签所在块」和「容器块」。默认在列表项首个内容块包含标签且列表项满足类型和属性条件时优先收集列表项,否则尝试符合条件的标签所在块;同时选择段落和列表项也不会为同一个标签来源收集两个层级;标签所在块按实际包含标签的块的类型和属性筛选并收集;容器块向上选择最近的符合类型和属性条件的容器,并按块 ID 去重,文档只有被显式选择时才参与。要求全部标签时,标签必须出现在同一个来源块中,不会合并不同子块的标签。没有标签条件时,此选项不影响筛选。预览显示最终收集对象。切换不会转换已有条目的绑定块或修改其字段。两种显式模式需要自动化格式 4,已有格式仍可读取;旧客户端会拒绝格式 4,不会改写数据库。"}]},diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20240208171522-y7dxcno.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20240208171522-y7dxcno.syindex 56af539f6d..b1f5bbb63c 100644--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20240208171522-y7dxcno.sy+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20240208171522-y7dxcno.sy@@ -7,7 +7,7 @@"id": "20240208171522-y7dxcno","title": "資料庫","type": "doc",- "updated": "20261018122207"+ "updated": "20261018144949"},"Children": [{@@ -4554,12 +4554,12 @@"Type": "NodeParagraph","Properties": {"id": "20261017204817-t0qt0db",- "updated": "20261017234820"+ "updated": "20261018144949"},"Children": [{"Type": "NodeText",- "Data": "標籤條件旁的「收集對象」提供「預設」「標籤所在區塊」和「容器區塊」。預設在清單項目首個內容區塊包含標籤且清單項目符合類型與屬性條件時優先收集清單項目,否則嘗試符合條件的標籤所在區塊;同時選取段落和清單項目也不會為同一個標籤來源收集兩個層級;標籤所在區塊依實際包含標籤的區塊類型與屬性篩選並收集;容器區塊向上選擇最近且符合類型與屬性條件的容器,並依區塊 ID 去除重複,文件只有被明確選取時才參與。要求全部標籤時,標籤必須出現在同一個來源區塊中,不會合併不同子區塊的標籤。沒有標籤條件時,此選項不影響篩選。預覽顯示最終收集對象。切換不會轉換既有項目的繫結區塊或修改其欄位。兩種明確模式需要自動化格式 4,既有格式仍可讀取;舊用戶端會拒絕格式 4,不會改寫資料庫。"+ "Data": "區塊類型上方的「收集對象」提供「預設」「標籤所在區塊」和「容器區塊」。預設在清單項目首個內容區塊包含標籤且清單項目符合類型與屬性條件時優先收集清單項目,否則嘗試符合條件的標籤所在區塊;同時選取段落和清單項目也不會為同一個標籤來源收集兩個層級;標籤所在區塊依實際包含標籤的區塊類型與屬性篩選並收集;容器區塊向上選擇最近且符合類型與屬性條件的容器,並依區塊 ID 去除重複,文件只有被明確選取時才參與。要求全部標籤時,標籤必須出現在同一個來源區塊中,不會合併不同子區塊的標籤。沒有標籤條件時,此選項不影響篩選。預覽顯示最終收集對象。切換不會轉換既有項目的繫結區塊或修改其欄位。兩種明確模式需要自動化格式 4,既有格式仍可讀取;舊用戶端會拒絕格式 4,不會改寫資料庫。"}]},diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-3eaevtp.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-3eaevtp.syindex 3d9ceacbb6..a1db95f32d 100644--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-3eaevtp.sy+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-3eaevtp.sy@@ -8,7 +8,7 @@"id": "20240530101000-3eaevtp","title": "データベース","type": "doc",- "updated": "20261018122207"+ "updated": "20261018144949"},"Children": [{@@ -4564,12 +4564,12 @@"Type": "NodeParagraph","Properties": {"id": "20261017204817-a41svnn",- "updated": "20261017234820"+ "updated": "20261018144949"},"Children": [{"Type": "NodeText",- "Data": "タグ条件の横にある「収集対象」では、「デフォルト」「タグを含むブロック」「コンテナブロック」を選べます。デフォルトは最初の内容ブロックにタグがあり、種類と属性の条件に合うリスト項目を優先します。それ以外は条件に合うタグ付きブロックを収集します。段落とリスト項目を両方選んでも、同じタグ元から二つの階層を収集しません。「タグを含むブロック」はタグが実際にあるブロックの種類と属性で絞り込み、収集します。「コンテナブロック」は種類と属性の条件に一致する最も近いコンテナを選び、ブロック ID で重複を除きます。文書は明示的に選択した場合のみ対象になります。すべてのタグを要求する場合、同じ元ブロック内にそろっている必要があり、別々の子ブロックのタグは結合しません。タグ条件がなければ、この設定は絞り込みに影響しません。プレビューには最終的な収集対象が表示されます。切り替えても既存項目のバインド先やフィールドは変更されません。明示的な二つのモードには自動化形式 4 が必要です。既存形式は引き続き読み込めますが、古いクライアントは形式 4 を拒否し、データベースを書き換えません。"+ "Data": "ブロック種類の上にある「収集対象」では、「デフォルト」「タグを含むブロック」「コンテナブロック」を選べます。デフォルトは最初の内容ブロックにタグがあり、種類と属性の条件に合うリスト項目を優先します。それ以外は条件に合うタグ付きブロックを収集します。段落とリスト項目を両方選んでも、同じタグ元から二つの階層を収集しません。「タグを含むブロック」はタグが実際にあるブロックの種類と属性で絞り込み、収集します。「コンテナブロック」は種類と属性の条件に一致する最も近いコンテナを選び、ブロック ID で重複を除きます。文書は明示的に選択した場合のみ対象になります。すべてのタグを要求する場合、同じ元ブロック内にそろっている必要があり、別々の子ブロックのタグは結合しません。タグ条件がなければ、この設定は絞り込みに影響しません。プレビューには最終的な収集対象が表示されます。切り替えても既存項目のバインド先やフィールドは変更されません。明示的な二つのモードには自動化形式 4 が必要です。既存形式は引き続き読み込めますが、古いクライアントは形式 4 を拒否し、データベースを書き換えません。"}]},diff --git a/app/src/assets/scss/business/_av.scss b/app/src/assets/scss/business/_av.scssindex 060591ad70..b24416a5f6 100644--- a/app/src/assets/scss/business/_av.scss+++ b/app/src/assets/scss/business/_av.scss@@ -3343,7 +3343,7 @@ img.av__cellassetimg {.av__automation-menu {> .b3-text-field {flex-shrink: 0;- margin: 0 8px 4px;+ margin: 0 0 4px;}}@@ -3355,9 +3355,16 @@ img.av__cellassetimg {> .b3-list-item {flex-shrink: 0;+ margin-inline: 0;}}+.b3-menu:not(.b3-menu--fullscreen) .av__automation-menu--types {+ width: 14em;+ min-width: 220px;+ max-width: min(320px, calc(100vw - 32px));+}+.av__collection-manager {display: flex;flex-direction: column;diff --git a/app/src/protyle/render/av/collectionConditions.ts b/app/src/protyle/render/av/collectionConditions.tsindex 80f9567dad..d60362f412 100644--- a/app/src/protyle/render/av/collectionConditions.ts+++ b/app/src/protyle/render/av/collectionConditions.ts@@ -37,8 +37,9 @@ export const mountCollectionConditions = (host: HTMLElement, source: AVAutomatioconst addButton = (action: string, label: string) => `<button type="button" class="b3-button b3-button--cancel b3-button--wrap av__automation-source-action" ${action}><svg><use xlink:href="#iconAdd"></use></svg><span>${escapeHtml(label)}</span></button>`;const chip = (kind: string, index: number, label: string, editable = false) => `<div class="b3-chip b3-chip--middle"><span class="fn__ellipsis${editable ? " b3-chip--pointer" : ""} ariaLabel" ${editable ? `data-edit-attribute="${index}" role="button" tabindex="0"` : ""} aria-label="${escapeAttr(label)}">${escapeHtml(label)}</span><svg class="b3-chip__close" data-remove-filter="${kind}" data-index="${index}" role="button" tabindex="0" aria-label="${escapeAttr(lang.delete)}"><use xlink:href="#iconClose"></use></svg></div>`;host.className = "av__automation-control";- host.innerHTML = `<div class="av__automation-control"><span class="av__automation-control-label">${lang.automationCollectionTypes}</span><div class="fn__flex-column"><div class="b3-chips b3-chips__doctag av__automation-chips" data-type-chips></div>${addButton("data-types", `${lang.addAttr} - ${lang.automationCollectionTypes}`)}</div></div>-<div class="av__automation-control"><div class="av__automation-row"><span class="av__automation-control-label fn__flex-1">${lang.tag}</span>${modeButton("tagMatch", lang.tag)}</div><div class="fn__flex-column" data-tags></div><div class="av__automation-row"><span class="av__automation-control-label fn__flex-1">${lang.automationCollectionTarget}</span><button type="button" class="b3-button b3-button--cancel b3-button--wrap av__automation-source-action" data-tag-target aria-label="${escapeAttr(lang.automationCollectionTarget)}"><span>${tagTargets[source.tagTarget || ""]}</span><svg><use xlink:href="#iconDown"></use></svg></button></div><div class="ft__on-surface ft__smaller av__automation-tip" data-tag-target-tip>${tagTargetTips[source.tagTarget || ""]}</div><div class="ft__on-surface ft__smaller av__automation-tip fn__none" data-tag-target-change-tip>${lang.automationCollectionTargetChangeTip}</div></div>+ host.innerHTML = `<div class="av__automation-control"><div class="av__automation-row"><span class="av__automation-control-label fn__flex-1">${lang.automationCollectionTarget}</span><button type="button" class="b3-button b3-button--cancel b3-button--wrap av__automation-source-action" data-tag-target aria-label="${escapeAttr(lang.automationCollectionTarget)}"><span>${tagTargets[source.tagTarget || ""]}</span><svg><use xlink:href="#iconDown"></use></svg></button></div><div class="ft__on-surface ft__smaller av__automation-tip" data-tag-target-tip>${tagTargetTips[source.tagTarget || ""]}</div><div class="ft__on-surface ft__smaller av__automation-tip fn__none" data-tag-target-change-tip>${lang.automationCollectionTargetChangeTip}</div></div>+<div class="av__automation-control"><span class="av__automation-control-label">${lang.automationCollectionTypes}</span><div class="fn__flex-column"><div class="b3-chips b3-chips__doctag av__automation-chips" data-type-chips></div>${addButton("data-types", `${lang.addAttr} - ${lang.automationCollectionTypes}`)}</div></div>+<div class="av__automation-control"><div class="av__automation-row"><span class="av__automation-control-label fn__flex-1">${lang.tag}</span>${modeButton("tagMatch", lang.tag)}</div><div class="fn__flex-column" data-tags></div></div><div class="av__automation-control"><div class="av__automation-row"><span class="av__automation-control-label fn__flex-1">${lang.attr}</span>${modeButton("attributeMatch", lang.attr)}</div><div class="fn__flex-column"><div class="b3-chips b3-chips__doctag av__automation-chips" data-attribute-chips></div>${addButton("data-add-attribute", `${lang.addAttr} - ${lang.attr}`)}</div><div data-attribute-editor></div></div>`;const typeChips = host.querySelector<HTMLElement>("[data-type-chips]");const attributes = host.querySelector<HTMLElement>("[data-attribute-chips]");@@ -93,7 +94,7 @@ export const mountCollectionConditions = (host: HTMLElement, source: AVAutomatiolet menu: Menu;toggleMenu({target, build: () => {menu = new Menu();- menu.addItem({type: "empty", label: `<div class="b3-menu__filter av__automation-menu fn__flex-column"><input class="b3-text-field" data-type-search placeholder="${escapeAttr(lang.searchPlaceholder)}" aria-label="${escapeAttr(lang.search)}"><div class="b3-list b3-list--background av__automation-menu-list fn__flex-1" data-type-list>${Object.entries(types).map(([type, label]) => `<button type="button" class="b3-list-item" data-collection-type="${escapeAttr(type)}"><span class="b3-list-item__text">${escapeHtml(label)}</span><svg class="b3-menu__checked"><use xlink:href="#iconSelect"></use></svg></button>`).join("")}<button type="button" class="b3-list-item" data-custom-callout><svg class="b3-list-item__graphic"><use xlink:href="#iconAdd"></use></svg><span class="b3-list-item__text">${escapeHtml(`${lang.callout} - ${lang.custom}`)}</span></button></div></div>`, bind: element => {+ menu.addItem({type: "empty", label: `<div class="b3-menu__filter av__automation-menu av__automation-menu--types fn__flex-column"><input class="b3-text-field" data-type-search placeholder="${escapeAttr(lang.searchPlaceholder)}" aria-label="${escapeAttr(lang.search)}"><div class="b3-list b3-list--background av__automation-menu-list fn__flex-1" data-type-list>${Object.entries(types).map(([type, label]) => `<button type="button" class="b3-list-item" data-collection-type="${escapeAttr(type)}"><span class="b3-list-item__text ariaLabel" aria-label="${escapeAttr(label)}">${escapeHtml(label)}</span><svg class="b3-menu__checked"><use xlink:href="#iconSelect"></use></svg></button>`).join("")}<button type="button" class="b3-list-item" data-custom-callout><svg class="b3-list-item__graphic"><use xlink:href="#iconAdd"></use></svg><span class="b3-list-item__text">${escapeHtml(`${lang.callout} - ${lang.custom}`)}</span></button></div></div>`, bind: element => {const search = element.querySelector<HTMLInputElement>("[data-type-search]");const list = element.querySelector<HTMLElement>("[data-type-list]");const refresh = () => {diff --git a/app/tests/automationPanel.test.js b/app/tests/automationPanel.test.jsindex 14ea429e30..ef80a31d66 100644--- a/app/tests/automationPanel.test.js+++ b/app/tests/automationPanel.test.js@@ -52,13 +52,21 @@ const runCases = async (sources, css, mobile) => {addItem(item) {this.items.push(item);if (item.bind) {- this.element.innerHTML = item.label;- item.bind(this.element);+ this.element.innerHTML = '<div class="b3-menu__items"><div></div></div>';+ const custom = this.element.firstElementChild.firstElementChild;+ custom.innerHTML = item.label;+ item.bind(custom);}}open() {document.querySelectorAll("body > .b3-menu").forEach(popup => popup.remove());- this.element.className = "b3-menu";+ this.element.className = `b3-menu${mobile ? " b3-menu--fullscreen b3-menu--sheet" : ""}`;+ if (mobile) {+ this.element.style.top = "auto";+ this.element.style.bottom = "0";+ this.element.style.height = "56vh";+ this.element.style.transform = "translateY(0)";+ }document.body.append(this.element);fieldMenu = {items: this.items, element: this.element};}@@ -147,6 +155,11 @@ const runCases = async (sources, css, mobile) => {assert.ok(Math.abs(input.left - row.left) <= 1, "search and list entries share their left edge");assert.ok(Math.abs(input.right - row.right - (list.offsetWidth - list.clientWidth)) <= 1,`search and entries share their right inset: ${input.right}/${row.right}`);+ const items = list.closest(".b3-menu__items");+ const filter = list.closest(".b3-menu__filter");+ const edge = popup.getBoundingClientRect().left + parseFloat(getComputedStyle(popup).borderLeftWidth) ++ parseFloat(getComputedStyle(items).paddingLeft) + parseFloat(getComputedStyle(filter).paddingLeft);+ assert.ok(Math.abs(input.left - edge) <= 1, "search and rows use the common menu inset without a second margin");};const assertChipActionSpacing = (listSelector, buttonSelector) => {const chips = Array.from(get(listSelector).querySelectorAll(".b3-chip"));@@ -486,6 +499,11 @@ const runCases = async (sources, css, mobile) => {assert.equal(get("[data-rule-change-tip]").textContent, lang.automationCollectionRuleChangeTip);assert.equal(get("[data-source-conditions]").closest("section").textContent.includes(lang.automationBlockConditions), true);assert.equal(menu.querySelector("[data-add-condition]"), null);+ const targetControl = get("[data-tag-target]").closest(".av__automation-control");+ const typeControl = get("[data-types]").closest(".av__automation-control");+ const tagControl = get("[data-tags]").closest(".av__automation-control");+ assert.equal(targetControl.nextElementSibling, typeControl, "collection target precedes block types");+ assert.equal(typeControl.nextElementSibling, tagControl, "tag conditions follow block types");assert.ok(get("[data-scope]"));assert.equal(get("[data-scope-control] > .av__automation-control-label").textContent, lang.automationCollectionScope);assert.equal(get("[data-scope-control] > .av__automation-control-label").closest("button"), null);@@ -568,6 +586,14 @@ const runCases = async (sources, css, mobile) => {typeList.scrollTop = 0;await tick();assertSearchAlignment(typePopup, "[data-type-search]", "[data-type-list]");+ const popupWidth = typePopup.getBoundingClientRect().width;+ if (!mobile) {+ assert.ok(popupWidth <= (size === 16 ? 242 : 338), "type menu stays compact while scaling for larger text");+ }+ assert.ok(popupWidth <= window.innerWidth, "compact menu stays within narrow viewports");+ const popupRect = typePopup.getBoundingClientRect();+ assert.ok(popupRect.top >= -1 && popupRect.bottom <= window.innerHeight + 1,+ "opened search menus stay vertically inside the viewport");const first = typeList.firstElementChild.getBoundingClientRect();for (const item of typeList.children) {assert.ok(Math.abs(item.getBoundingClientRect().width - first.width) <= 1, "all type rows stretch to the same full width");@@ -578,9 +604,9 @@ const runCases = async (sources, css, mobile) => {typeList.scrollTop = typeList.scrollHeight;assert.ok(customCallout.getBoundingClientRect().bottom <= typeList.getBoundingClientRect().bottom + 1,"the final custom action is reachable by scrolling");+ typeList.scrollTop = 0;+ await require("electron").ipcRenderer.invoke("automation-capture", `${mobile ? "mobile" : "desktop"}-${width}-${name}-${size === 16 ? "types" : "types-large"}`);}- typeList.scrollTop = 0;- await require("electron").ipcRenderer.invoke("automation-capture", `${mobile ? "mobile" : "desktop"}-${width}-${name}-types`);}}typePopup.style.fontSize = "";@@ -797,7 +823,7 @@ if (process.versions.electron && process.type === "browser") {ipcMain.handle("automation-pointer", (_event, x, y) => win.webContents.debugger.sendCommand("Input.dispatchMouseEvent", {type: "mouseMoved", x, y}));ipcMain.handle("automation-capture", async (_event, name) => {if (!process.env.SIYUAN_AUTOMATION_CAPTURE_DIR) return;- assert.match(name, /^(desktop|mobile)-\d+-(daylight|midnight)(-actions|-conditions|-collection|-review|-review-confirm|-review-unknown|-review-rules|-types)?$/);+ assert.match(name, /^(desktop|mobile)-\d+-(daylight|midnight)(-actions|-conditions|-collection|-review|-review-confirm|-review-unknown|-review-rules|-types|-types-large)?$/);win.webContents.invalidate();await new Promise(resolve => setTimeout(resolve, 150));fs.writeFileSync(path.join(process.env.SIYUAN_AUTOMATION_CAPTURE_DIR, name + ".png"), (await win.webContents.capturePage()).toPNG());