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: Prevent proxy fields from shrinking the selector https://github.com/siyuan-note/siyuan/issues/19164
Daniel6956bb81c176
diff --git a/app/src/config/bazaar/events.ts b/app/src/config/bazaar/events.tsindex 570e1e505a..0df1693df6 100644--- a/app/src/config/bazaar/events.ts+++ b/app/src/config/bazaar/events.ts@@ -15,7 +15,6 @@ import {useShell} from "../../util/pathName";import {previewImages} from "../../protyle/preview/image";import {isBazaarPackageRatingEditable, sortBazaarPackages} from "../../util/bazaarPackage";import {Constants} from "../../constants";-import {fitSelectWidthToOptions} from "../../util/select";import {BAZAAR_PACKAGE_CONFIG,getBazaarTypeByMyType,@@ -577,7 +576,6 @@ const bindBazaarSearchEvents = (const bindBazaarSelectEvents = (controller: TBazaarController) => {controller.element.querySelectorAll(".b3-select").forEach((selectElement: HTMLSelectElement) => {- fitSelectWidthToOptions(selectElement);selectElement.addEventListener("change", () => {if (selectElement.getAttribute("data-type") === "downloaded-sort") {const activeBtn = controller.element.querySelector("#configBazaarDownloaded")?.previousElementSiblingdiff --git a/app/src/config/tabs/ai/aiCapabilityUi.ts b/app/src/config/tabs/ai/aiCapabilityUi.tsindex 2a88945c66..093f25f854 100644--- a/app/src/config/tabs/ai/aiCapabilityUi.ts+++ b/app/src/config/tabs/ai/aiCapabilityUi.ts@@ -1,6 +1,5 @@import {escapeAttr, escapeHtml} from "../../../util/escape";import {fetchPost} from "../../../util/fetch";-import {fitSelectWidthToOptions} from "../../../util/select";import {listCapabilityManifests} from "../../../layout/dock/agent/frontendCapabilities";import {AgentActionApprovalDecision,@@ -347,7 +346,6 @@ const openAgentCapabilityView = (settingRoot: HTMLElement, backendCapabilities:const selected = capabilities.filter((capability) => isCapabilityAllowed(capability.id, scope)).length;count.textContent = window.siyuan.languages.agentCapabilitiesSelected.replace("${selected}", String(selected)).replace("${total}", String(capabilities.length));- list.querySelectorAll<HTMLSelectElement>(".b3-select").forEach(fitSelectWidthToOptions);const groupEntries = Array.from(groups.values());list.querySelectorAll<HTMLElement>("[data-type='toggleAgentCapabilityGroup']").forEach((button) => {diff --git a/app/src/config/tabs/appTab.ts b/app/src/config/tabs/appTab.tsindex b1429837bd..0d1255b361 100644--- a/app/src/config/tabs/appTab.ts+++ b/app/src/config/tabs/appTab.ts@@ -24,7 +24,6 @@ import {afterExport} from "../../protyle/export/util";import {genConfigItemMainHtml, genConfigItemName} from "../render/fragments";import {sendAppSetting} from "./appRuntime";import {getHostCapabilities} from "../../util/hostCapabilities";-import {fitSelectWidthToOptions} from "../../util/select";/// #if MOBILEconst registerAppWorkspaceGroup = (tab: SettingTabBuilder) => {@@ -246,9 +245,9 @@ const genNetworkProxyHtml = (): string => {<option value="http" ${proxy.scheme === "http" ? "selected" : ""}>HTTP</option></select><span class="fn__space"></span>- <input id="networkProxyHost" placeholder="user:pass@IP" class="b3-text-field fn__block" value="${Lute.EscapeHTMLStr(proxy.host)}"/>+ <input id="networkProxyHost" placeholder="user:pass@IP" class="b3-text-field fn__flex-1" value="${Lute.EscapeHTMLStr(proxy.host)}"/><span class="fn__space"></span>- <input id="networkProxyPort" placeholder="Port" class="b3-text-field fn__block" value="${Lute.EscapeHTMLStr(proxy.port)}" type="number"/>+ <input id="networkProxyPort" placeholder="Port" class="b3-text-field fn__flex-1" value="${Lute.EscapeHTMLStr(proxy.port)}" type="number"/><span class="fn__space"></span><button id="networkProxyConfirm" class="b3-button fn__size200 b3-button--outline">${window.siyuan.languages.confirm}</button></div>@@ -259,7 +258,6 @@ const mountNetworkProxy = (root: HTMLElement) => {const schemeElement = root.querySelector("#networkProxyScheme") as HTMLSelectElement;const hostElement = root.querySelector("#networkProxyHost") as HTMLInputElement;const portElement = root.querySelector("#networkProxyPort") as HTMLInputElement;- fitSelectWidthToOptions(schemeElement);const updateInputs = () => {const disabled = schemeElement.value === "" || schemeElement.value === "system";hostElement.disabled = disabled;diff --git a/app/src/util/select.ts b/app/src/util/select.tsdeleted file mode 100644index fa4e7df176..0000000000--- a/app/src/util/select.ts+++ /dev/null@@ -1,12 +0,0 @@-export const fitSelectWidthToOptions = (selectElement: HTMLSelectElement) => {- const style = getComputedStyle(selectElement);- const measureContext = document.createElement("canvas").getContext("2d");- if (!measureContext) {- return;- }- measureContext.font = style.font;- const optionWidth = Array.from(selectElement.options).reduce((width, option) =>- Math.max(width, measureContext.measureText(option.text).width), 0);- const paddingWidth = Number.parseFloat(style.paddingLeft) + Number.parseFloat(style.paddingRight);- selectElement.style.minWidth = `${Math.ceil(optionWidth + paddingWidth)}px`;-};