@eddyskywalker/dsh-chatgpt-subscription 1.2.2 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -73334,13 +73334,23 @@ window.__ModuleLoader__.load({
73334
73334
  write("threshold", "progressUpdatesNudgeThreshold", parsed);
73335
73335
  };
73336
73336
  /**
73337
- * 压缩阈值输入:0 与 K/M 写法都接受,半截或非法输入留在框里不打扰宿主。
73337
+ * 压缩阈值输入:输入期间只改草稿,避免每次按键都写入并触发 K/M 回显。
73338
73338
  * @param raw - 输入框的原始文本。
73339
73339
  */
73340
73340
  const editCompactThreshold = (raw) => {
73341
73341
  setCompactThresholdDraft(raw);
73342
- const parsed = parseCapacityOrZero(raw);
73343
- if (parsed === null) return;
73342
+ };
73343
+ /**
73344
+ * 提交压缩阈值:失焦或 Enter 时解析一次;非法输入回到宿主当前值。
73345
+ */
73346
+ const commitCompactThreshold = () => {
73347
+ const parsed = parseCapacityOrZero(compactThresholdDraft);
73348
+ if (parsed === null) {
73349
+ setCompactThresholdDraft(formatCapacity$1(compactThreshold));
73350
+ return;
73351
+ }
73352
+ setCompactThresholdDraft(formatCapacity$1(parsed));
73353
+ if (parsed === compactThreshold) return;
73344
73354
  write("compactThreshold", "compactAfterTasksThreshold", parsed);
73345
73355
  };
73346
73356
  /** 打开面板再收起设置。 */
@@ -73467,8 +73477,11 @@ window.__ModuleLoader__.load({
73467
73477
  onChange: (event) => {
73468
73478
  editCompactThreshold(event.target.value);
73469
73479
  },
73470
- onBlur: () => {
73471
- setCompactThresholdDraft(formatCapacity$1(compactThreshold));
73480
+ onBlur: commitCompactThreshold,
73481
+ onKeyDown: (event) => {
73482
+ if (event.key !== "Enter" || event.nativeEvent.isComposing) return;
73483
+ event.preventDefault();
73484
+ commitCompactThreshold();
73472
73485
  }
73473
73486
  })
73474
73487
  }),