dsh-mobile-access 1.1.0 → 1.1.1
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/README.md +12 -2
- package/client.js +43 -0
- 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.
|
|
82
|
+
dsh plugin --profile web add dsh-mobile-access@1.1.1 --registry=https://registry.npmjs.org/
|
|
83
83
|
```
|
|
84
84
|
|
|
85
85
|
这条命令做三件事:
|
|
@@ -175,6 +175,16 @@ Safari 分享按钮 → 添加到主屏幕
|
|
|
175
175
|
- 插件只在 iPhone / iPad 上安装「Return 换行」监听,Mac 和非 Apple 平台不会安装;
|
|
176
176
|
- 左边栏只多一个「手机访问」入口,其他入口和面板保持原样。
|
|
177
177
|
|
|
178
|
+
### iPhone 上切换大模型时页面放大了怎么办
|
|
179
|
+
|
|
180
|
+
从 `1.1.1` 起不需要改 DSH,也不需要关掉 Safari 的缩放。插件只在
|
|
181
|
+
iPhone / iPad 上把可编辑控件(输入框、模型搜索框、提示词编辑器)的字号
|
|
182
|
+
固定到 16px,并给按钮加 `touch-action: manipulation`,避免 iOS Safari 因为
|
|
183
|
+
字号小于 16px 自动放大页面;模型选择菜单因此不会被裁掉。Mac 不生效。
|
|
184
|
+
|
|
185
|
+
如果页面已经处于放大状态,先点 Safari 地址栏刷新一次,或双击页面空白处
|
|
186
|
+
复位,再重新打开模型选择即可。
|
|
187
|
+
|
|
178
188
|
### 配对码过期了怎么办
|
|
179
189
|
|
|
180
190
|
配对码默认 **10 分钟**有效。过期后:
|
|
@@ -336,7 +346,7 @@ iPhone 软键盘没有可用的 Shift 键,因此插件在 **iOS / iPadOS** 上
|
|
|
336
346
|
### 推荐:npm 官方命令
|
|
337
347
|
|
|
338
348
|
```bash
|
|
339
|
-
dsh plugin --profile web add dsh-mobile-access@1.1.
|
|
349
|
+
dsh plugin --profile web add dsh-mobile-access@1.1.1 --registry=https://registry.npmjs.org/
|
|
340
350
|
```
|
|
341
351
|
|
|
342
352
|
### 使用 `@latest`
|
package/client.js
CHANGED
|
@@ -146,6 +146,43 @@ function installClipboardFallback() {
|
|
|
146
146
|
}
|
|
147
147
|
return () => undefined;
|
|
148
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* iOS Safari auto-zooms a focused input, textarea, select or contenteditable
|
|
151
|
+
* whose computed font-size is below 16px. The official model picker's search
|
|
152
|
+
* field is 12px and the composer's editor is 14px, so tapping the model chip
|
|
153
|
+
* or its search box zooms the page and leaves the fixed-position model menu
|
|
154
|
+
* partly off-screen. Force only those editable controls to 16px on coarse
|
|
155
|
+
* pointers; Mac (fine pointer / hover) is untouched, and pinch zoom remains
|
|
156
|
+
* available because the viewport meta is not changed.
|
|
157
|
+
*/
|
|
158
|
+
const IOS_INPUT_ZOOM_GUARD_ID = 'dsh-ma-ios-input-zoom-guard';
|
|
159
|
+
const IOS_INPUT_ZOOM_GUARD_CSS = `@media (hover: none) and (pointer: coarse) {
|
|
160
|
+
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
|
|
161
|
+
textarea,
|
|
162
|
+
select,
|
|
163
|
+
[contenteditable="true"],
|
|
164
|
+
[data-composer-input],
|
|
165
|
+
[role="searchbox"],
|
|
166
|
+
[role="textbox"] {
|
|
167
|
+
font-size: 16px !important;
|
|
168
|
+
}
|
|
169
|
+
button,
|
|
170
|
+
[role="button"],
|
|
171
|
+
[role="menuitem"],
|
|
172
|
+
[role="menuitemradio"] {
|
|
173
|
+
touch-action: manipulation;
|
|
174
|
+
}
|
|
175
|
+
}`;
|
|
176
|
+
function installIOSInputZoomGuard() {
|
|
177
|
+
if (!isAppleMobile())
|
|
178
|
+
return () => undefined;
|
|
179
|
+
document.getElementById(IOS_INPUT_ZOOM_GUARD_ID)?.remove();
|
|
180
|
+
const style = document.createElement('style');
|
|
181
|
+
style.id = IOS_INPUT_ZOOM_GUARD_ID;
|
|
182
|
+
style.textContent = IOS_INPUT_ZOOM_GUARD_CSS;
|
|
183
|
+
document.head.appendChild(style);
|
|
184
|
+
return () => style.remove();
|
|
185
|
+
}
|
|
149
186
|
function useMobileAccessState() {
|
|
150
187
|
const [state, setState] = React.useState(null);
|
|
151
188
|
const [loading, setLoading] = React.useState(true);
|
|
@@ -416,6 +453,12 @@ function factory(require) {
|
|
|
416
453
|
catch (error) {
|
|
417
454
|
ctx.logger?.warn?.(`[mobile-access] iOS Return newline unavailable: ${String(error)}`);
|
|
418
455
|
}
|
|
456
|
+
try {
|
|
457
|
+
cleanups.push(installIOSInputZoomGuard());
|
|
458
|
+
}
|
|
459
|
+
catch (error) {
|
|
460
|
+
ctx.logger?.warn?.(`[mobile-access] iOS input zoom guard unavailable: ${String(error)}`);
|
|
461
|
+
}
|
|
419
462
|
return () => {
|
|
420
463
|
for (const cleanup of cleanups.reverse()) {
|
|
421
464
|
try {
|
package/package.json
CHANGED