Skip to content

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

:bug: Size the network proxy selector to its options https://github.com/siyuan-note/siyuan/issues/19164

Danielb982beb8deec
diff --git a/app/src/config/tabs/appTab.ts b/app/src/config/tabs/appTab.ts
index ceca9ae4e9..66e5d40669 100644
--- a/app/src/config/tabs/appTab.ts
+++ b/app/src/config/tabs/appTab.ts
@@ -258,6 +258,15 @@ 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;
+ const schemeStyle = getComputedStyle(schemeElement);
+ const measureContext = document.createElement("canvas").getContext("2d");
+ if (measureContext) {
+ measureContext.font = schemeStyle.font;
+ const optionWidth = Array.from(schemeElement.options).reduce((width, option) =>
+ Math.max(width, measureContext.measureText(option.text).width), 0);
+ const paddingWidth = Number.parseFloat(schemeStyle.paddingLeft) + Number.parseFloat(schemeStyle.paddingRight);
+ schemeElement.style.minWidth = `${Math.ceil(optionWidth + paddingWidth)}px`;
+ }
const updateInputs = () => {
const disabled = schemeElement.value === "" || schemeElement.value === "system";
hostElement.disabled = disabled;