dsh-mobile-access 1.1.1 → 1.1.2

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.
Files changed (3) hide show
  1. package/README.md +12 -7
  2. package/client.js +65 -4
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -79,7 +79,7 @@ iPhone 打开「设置 → 无线局域网」,确认和 Mac 连的是同一个
79
79
  ### 第 2 步:在 Mac 终端执行一条命令
80
80
 
81
81
  ```bash
82
- dsh plugin --profile web add dsh-mobile-access@1.1.1 --registry=https://registry.npmjs.org/
82
+ dsh plugin --profile web add dsh-mobile-access@1.1.2 --registry=https://registry.npmjs.org/
83
83
  ```
84
84
 
85
85
  这条命令做三件事:
@@ -175,12 +175,17 @@ Safari 分享按钮 → 添加到主屏幕
175
175
  - 插件只在 iPhone / iPad 上安装「Return 换行」监听,Mac 和非 Apple 平台不会安装;
176
176
  - 左边栏只多一个「手机访问」入口,其他入口和面板保持原样。
177
177
 
178
- ### iPhone 上切换大模型时页面放大了怎么办
178
+ ### iPhone 上切换大模型时页面放大、键盘自动弹出怎么办
179
179
 
180
- 从 `1.1.1` 起不需要改 DSH,也不需要关掉 Safari 的缩放。插件只在
181
- iPhone / iPad 上把可编辑控件(输入框、模型搜索框、提示词编辑器)的字号
182
- 固定到 16px,并给按钮加 `touch-action: manipulation`,避免 iOS Safari 因为
183
- 字号小于 16px 自动放大页面;模型选择菜单因此不会被裁掉。Mac 不生效。
180
+ 从 `1.1.2` 起不需要改 DSH,也不需要关掉 Safari 的缩放:
181
+
182
+ - 插件只在 iPhone / iPad 上把可编辑控件(输入框、模型搜索框、提示词编辑器)
183
+ 的字号固定到 16px,并给按钮加 `touch-action: manipulation`,避免 iOS
184
+ Safari 因为字号小于 16px 自动放大页面;
185
+ - 打开右下角模型选择时,插件不会让模型搜索框自动抢焦点,所以键盘不会自动
186
+ 弹出;需要搜索时,点一下搜索框再输入即可;
187
+ - 如果提示词键盘本来就是打开的,点模型入口时会先收起键盘;
188
+ - Mac 和非 Apple 平台不安装这些处理,行为保持原样。
184
189
 
185
190
  如果页面已经处于放大状态,先点 Safari 地址栏刷新一次,或双击页面空白处
186
191
  复位,再重新打开模型选择即可。
@@ -346,7 +351,7 @@ iPhone 软键盘没有可用的 Shift 键,因此插件在 **iOS / iPadOS** 上
346
351
  ### 推荐:npm 官方命令
347
352
 
348
353
  ```bash
349
- dsh plugin --profile web add dsh-mobile-access@1.1.1 --registry=https://registry.npmjs.org/
354
+ dsh plugin --profile web add dsh-mobile-access@1.1.2 --registry=https://registry.npmjs.org/
350
355
  ```
351
356
 
352
357
  ### 使用 `@latest`
package/client.js CHANGED
@@ -83,7 +83,6 @@ function installIOSReturnNewline() {
83
83
  Object.defineProperty(event, 'shiftKey', { configurable: true, value: true });
84
84
  }
85
85
  catch {
86
- // Fall through to the explicit edit fallback.
87
86
  }
88
87
  const currentShift = event.shiftKey;
89
88
  if (currentShift !== true) {
@@ -140,7 +139,6 @@ function installClipboardFallback() {
140
139
  }
141
140
  }
142
141
  catch {
143
- // A host page that froze the descriptor wins; never throw during cleanup.
144
142
  }
145
143
  };
146
144
  }
@@ -183,6 +181,65 @@ function installIOSInputZoomGuard() {
183
181
  document.head.appendChild(style);
184
182
  return () => style.remove();
185
183
  }
184
+ /**
185
+ * The official model menu can move focus into its search field while it opens.
186
+ * On iPhone that opens the software keyboard and shifts the fixed-position menu
187
+ * above the visible viewport. Suppress only programmatic search-box focus until
188
+ * the user deliberately taps that field; blur a focused composer control before
189
+ * any composer menu opens. Native taps still focus normally, and Mac is untouched.
190
+ */
191
+ function installIOSModelKeyboardGuard() {
192
+ if (!isAppleMobile())
193
+ return () => undefined;
194
+ if (typeof HTMLInputElement === 'undefined')
195
+ return () => undefined;
196
+ const doc = document;
197
+ const allowed = new WeakSet();
198
+ const onPointerDown = (event) => {
199
+ const target = event.target;
200
+ if (target === null || typeof target.closest !== 'function')
201
+ return;
202
+ const search = target.closest('input[role="searchbox"]');
203
+ if (search !== null) {
204
+ allowed.add(search);
205
+ return;
206
+ }
207
+ const trigger = target.closest('button[aria-haspopup="menu"]');
208
+ if (trigger === null || trigger.closest('[data-composer-card]') === null)
209
+ return;
210
+ const active = doc.activeElement;
211
+ if (active !== null && active !== trigger && typeof active.blur === 'function') {
212
+ try {
213
+ active.blur();
214
+ }
215
+ catch {
216
+ }
217
+ }
218
+ };
219
+ const prototype = HTMLInputElement.prototype;
220
+ const originalFocus = prototype.focus;
221
+ const guardedFocus = function (options) {
222
+ if (this.getAttribute('role') === 'searchbox' && !allowed.has(this))
223
+ return;
224
+ originalFocus.call(this, options);
225
+ };
226
+ Object.defineProperty(prototype, 'focus', {
227
+ configurable: true,
228
+ writable: true,
229
+ value: guardedFocus,
230
+ });
231
+ doc.addEventListener('pointerdown', onPointerDown, true);
232
+ return () => {
233
+ doc.removeEventListener('pointerdown', onPointerDown, true);
234
+ if (prototype.focus === guardedFocus) {
235
+ Object.defineProperty(prototype, 'focus', {
236
+ configurable: true,
237
+ writable: true,
238
+ value: originalFocus,
239
+ });
240
+ }
241
+ };
242
+ }
186
243
  function useMobileAccessState() {
187
244
  const [state, setState] = React.useState(null);
188
245
  const [loading, setLoading] = React.useState(true);
@@ -312,7 +369,6 @@ function statusOf(state, loading, error, t) {
312
369
  return { label: t('statusExpired'), tone: 'warn' };
313
370
  return { label: t('statusReady'), tone: 'ok' };
314
371
  }
315
-
316
372
  "use strict";
317
373
  const NS = 'dsh-mobile-access';
318
374
  const PANEL_ID = 'mobile-access';
@@ -459,13 +515,18 @@ function factory(require) {
459
515
  catch (error) {
460
516
  ctx.logger?.warn?.(`[mobile-access] iOS input zoom guard unavailable: ${String(error)}`);
461
517
  }
518
+ try {
519
+ cleanups.push(installIOSModelKeyboardGuard());
520
+ }
521
+ catch (error) {
522
+ ctx.logger?.warn?.(`[mobile-access] iOS model keyboard guard unavailable: ${String(error)}`);
523
+ }
462
524
  return () => {
463
525
  for (const cleanup of cleanups.reverse()) {
464
526
  try {
465
527
  cleanup();
466
528
  }
467
529
  catch {
468
- // Plugin cleanup must never break the host UI.
469
530
  }
470
531
  }
471
532
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mobile-access",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Independent DSH bundle that pairs iPhones and iPads with the official DeepSeek Harness Web GUI over the local network.",
5
5
  "type": "module",
6
6
  "license": "MIT",