@zhin.js/adapter-sandbox 1.1.23 → 1.1.25
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/CHANGELOG.md +60 -0
- package/adapters/sandbox/index.js +16 -7
- package/adapters/sandbox/index.ts +16 -7
- package/lib/endpoint.js +45 -7
- package/lib/protocol.d.ts +6 -0
- package/lib/protocol.js +15 -0
- package/package.json +17 -17
- package/pages/index/HtmlMessage.js +1 -1
- package/pages/index/HtmlMessage.tsx +1 -1
- package/pages/index/RichTextEditor.js +1 -15
- package/pages/index/RichTextEditor.tsx +4 -15
- package/pages/index/SandboxChat.js +131 -30
- package/pages/index/SandboxChat.tsx +335 -73
- package/pages/index/index.js +1 -1
- package/pages/index/index.tsx +1 -1
- package/pages/index/messages.js +2 -0
- package/pages/index/messages.ts +2 -0
- package/pages/index/styles.js +501 -0
- package/pages/index/styles.ts +500 -0
- package/plugin.js +1 -0
- package/src/endpoint.ts +42 -7
- package/src/protocol.ts +26 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,65 @@
|
|
|
1
1
|
# @zhin.js/adapter-process
|
|
2
2
|
|
|
3
|
+
## 1.1.25
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fed2c27: Upgrade Console Host, Plugin Pages compiler/DX, and `/sandbox` workbench:
|
|
8
|
+
|
|
9
|
+
- Populate React 19, `react-dom/client`, and `react-router-dom` named exports and standalone ESM fallback in `@zhin.js/pagemanager`.
|
|
10
|
+
- Re-export `definePage` from `@zhin.js/page`, forward all `PageMetadata` fields (`group`, `order`, `parent`, `fullWidth`, `titleI18n`), and inject `{ pluginId, owner, localName, route, title }` props into page components.
|
|
11
|
+
- Add `definePluginConsoleRpc.withConfig<TConfig>()` and `@zhin.js/client` `createDeclarativePage` helper.
|
|
12
|
+
- Upgrade local Console shell (`page-renderer.ts`), live `log:entry` SSE broadcasts, and `/sandbox` simulated sender identity/role switching and rich segment rendering.
|
|
13
|
+
|
|
14
|
+
- ed768db: Sandbox `ready` no longer waits on a hung Docker CLI: the shell-isolation probe now has a hard 750ms deadline (SIGKILL + "timed out" status) instead of relying on execFile reporting after stdio closes.
|
|
15
|
+
- 74e7e87: Sandbox 工作台页面现在自带完整样式:改用 Console 主题 token(含回退值)、最小 12px 字号、手机端 44px 点按目标、暗色可用的遮罩色,移除对 Tailwind 工具类和 `adapterConsoleStyles` 的依赖,并为 Markdown 表格/代码块/列表与快捷键提示行补齐样式;表情列表加载失败与消息解析失败会以内联提示显示。本版本发布后 Console 可以删除 `agent-playground.css` 以及 `remote-entry-style-contract.ts` 中的 Sandbox 类名登记。
|
|
16
|
+
- Updated dependencies [6163abc]
|
|
17
|
+
- Updated dependencies [fed2c27]
|
|
18
|
+
- Updated dependencies [bc6ccb1]
|
|
19
|
+
- Updated dependencies [72b5a12]
|
|
20
|
+
- Updated dependencies [aa41889]
|
|
21
|
+
- Updated dependencies [4427e72]
|
|
22
|
+
- Updated dependencies [22bd14a]
|
|
23
|
+
- @zhin.js/core@1.1.57
|
|
24
|
+
- @zhin.js/client@1.1.25
|
|
25
|
+
- @zhin.js/page@1.1.15
|
|
26
|
+
- @zhin.js/im-contract@1.1.12
|
|
27
|
+
- @zhin.js/adapter@1.1.29
|
|
28
|
+
- @zhin.js/host-http@1.1.15
|
|
29
|
+
- @zhin.js/feature-kit@1.1.13
|
|
30
|
+
- @zhin.js/skill@1.1.14
|
|
31
|
+
|
|
32
|
+
## 1.1.24
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- 41ff1a5: ADR 0044 C5: every official adapter now declares a capability `profile` (its `segments` moved into `profile.default.messaging.segments`). icqq declares the complete profile (per conversation kind: scene, all 14 actions with real limits, events, feedback, delivery) and implements the seven new management ports (`pokeUser`, `unmuteGroupMember`, `muteAllGroupMembers`, `setGroupCard`, `setGroupTitle`, `setGroupEssence`, `inviteGroupMember`) with fresh bot-role reads. qq official declares its passive reply windows; undeclared capabilities stay unsupported.
|
|
37
|
+
- 299863a: ADR 0044 C3: runtime consumers read capabilities instead of platform names. Scene facts (group info, member profile) are queried where the profile declares `scene.groupInfo` / `scene.memberProfile`; activity feedback (reaction, typing, status message, refresh interval, quote-only delivery) follows `feedback`, `actions.reaction` and `delivery.proactive` and the per-platform table is gone; large inline media is spooled only where `delivery.spool` is declared; the sandbox ingress and its console shell follow a new additive `runtime.sandbox` capability. `defineAgentTool` and Skill frontmatter accept `requiresCapabilities` (for example `actions.mute`), evaluated against the per-turn `TurnCapabilities`, so moderation tools disappear when the Bot is not an administrator and return when it is; the icqq/qq keyword boost in tool selection is removed and the icqq group-admin tools are tagged. The `icqq` command-line special case in the exec policy is now a generic `registerSensitiveExecCommand` rule registered by the icqq plugin. `EndpointCapabilities` gains a serializable per-kind `kinds` view. Adapters without a profile keep their previous behaviour (their derived profile also reads the management ports they implement).
|
|
38
|
+
- 4fe49b5: 支持配置按需生效:分离保存与有效版本,独立变更先应用,账号资料更新保留连接,模型按回合使用确定版本;Console 返回结构化应用结果。监听改为仅显式 --watch 启用,开发模板显式选择源码和配置监听。
|
|
39
|
+
|
|
40
|
+
自变更消费配置应用回执,避免已处理配置被二次重载;持久化本次写入修订和应用结果,未知结果或修订冲突时停止自动续作并保留现场,恢复不会覆盖未经本次变更确认的配置。
|
|
41
|
+
|
|
42
|
+
- cce07db: Refresh adapter Console pages with lightweight black/white/gray surfaces, clearer account and login workflows, responsive layouts, accessible focus states, and self-contained light/dark styling. Apply the shared visual language to Sandbox conversations and Bilibili comment review while preserving runtime authority and platform send paths.
|
|
43
|
+
- Updated dependencies [b249e5e]
|
|
44
|
+
- Updated dependencies [57661f6]
|
|
45
|
+
- Updated dependencies [cbd3f14]
|
|
46
|
+
- Updated dependencies [299863a]
|
|
47
|
+
- Updated dependencies [aaa93d7]
|
|
48
|
+
- Updated dependencies [bd524d1]
|
|
49
|
+
- Updated dependencies [126ae99]
|
|
50
|
+
- Updated dependencies [4fe49b5]
|
|
51
|
+
- Updated dependencies [cce07db]
|
|
52
|
+
- Updated dependencies [b652db3]
|
|
53
|
+
- Updated dependencies [0315ba0]
|
|
54
|
+
- @zhin.js/core@1.1.56
|
|
55
|
+
- @zhin.js/adapter@1.1.28
|
|
56
|
+
- @zhin.js/im-contract@1.1.11
|
|
57
|
+
- @zhin.js/skill@1.1.13
|
|
58
|
+
- @zhin.js/host-http@1.1.14
|
|
59
|
+
- @zhin.js/feature-kit@1.1.12
|
|
60
|
+
- @zhin.js/client@1.1.24
|
|
61
|
+
- @zhin.js/page@1.1.14
|
|
62
|
+
|
|
3
63
|
## 1.1.23
|
|
4
64
|
|
|
5
65
|
### Patch Changes
|
|
@@ -8,13 +8,22 @@ import {} from "../../lib/protocol.js";
|
|
|
8
8
|
export { SandboxWsEndpoint } from "../../lib/endpoint.js";
|
|
9
9
|
export default defineAdapter({
|
|
10
10
|
capabilities: ['inbound', 'outbound'],
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
profile: {
|
|
12
|
+
default: {
|
|
13
|
+
messaging: {
|
|
14
|
+
// Console UI 直连 URL 媒体、直接渲染 base64 内联媒体;path 由端点读盘
|
|
15
|
+
// 物化为 base64 内联(sandbox 无平台上传通道)。交互段由 Console 原生承载。
|
|
16
|
+
segments: {
|
|
17
|
+
html: 'direct',
|
|
18
|
+
markdown: 'native',
|
|
19
|
+
outboundMedia: ['url', 'base64', 'path'],
|
|
20
|
+
interactive: 'native',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
delivery: { send: true, proactive: true, spool: true },
|
|
24
|
+
// The authenticated local ingress: its configured owner may turn wire metadata into agent-run authority.
|
|
25
|
+
runtime: { sandbox: true },
|
|
26
|
+
},
|
|
18
27
|
},
|
|
19
28
|
createAdapter: context => new SandboxAdapter(context),
|
|
20
29
|
});
|
|
@@ -12,13 +12,22 @@ export type { SandboxEndpointOptions } from '../../src/endpoint.js';
|
|
|
12
12
|
|
|
13
13
|
export default defineAdapter<SandboxEndpointConfig>({
|
|
14
14
|
capabilities: ['inbound', 'outbound'],
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
profile: {
|
|
16
|
+
default: {
|
|
17
|
+
messaging: {
|
|
18
|
+
// Console UI 直连 URL 媒体、直接渲染 base64 内联媒体;path 由端点读盘
|
|
19
|
+
// 物化为 base64 内联(sandbox 无平台上传通道)。交互段由 Console 原生承载。
|
|
20
|
+
segments: {
|
|
21
|
+
html: 'direct',
|
|
22
|
+
markdown: 'native',
|
|
23
|
+
outboundMedia: ['url', 'base64', 'path'],
|
|
24
|
+
interactive: 'native',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
delivery: { send: true, proactive: true, spool: true },
|
|
28
|
+
// The authenticated local ingress: its configured owner may turn wire metadata into agent-run authority.
|
|
29
|
+
runtime: { sandbox: true },
|
|
30
|
+
},
|
|
22
31
|
},
|
|
23
32
|
createAdapter: context => new SandboxAdapter(context),
|
|
24
33
|
});
|
package/lib/endpoint.js
CHANGED
|
@@ -296,6 +296,8 @@ export class SandboxWsEndpoint extends SandboxClient {
|
|
|
296
296
|
}
|
|
297
297
|
const parsed = frame.message;
|
|
298
298
|
void this.#emitPlatformEvent('message', raw);
|
|
299
|
+
const senderId = parsed.senderId || owner;
|
|
300
|
+
const senderName = parsed.senderName || senderId;
|
|
299
301
|
const sceneId = parsed.id || owner;
|
|
300
302
|
const conversation = { ...sandboxInboundConversation(String(this.#options.id), {
|
|
301
303
|
type: parsed.type,
|
|
@@ -304,7 +306,7 @@ export class SandboxWsEndpoint extends SandboxClient {
|
|
|
304
306
|
this.#logger.debug(formatCompact({
|
|
305
307
|
op: 'sandbox_recv',
|
|
306
308
|
target,
|
|
307
|
-
sender:
|
|
309
|
+
sender: senderId,
|
|
308
310
|
channelType: parsed.type,
|
|
309
311
|
channelId: sceneId,
|
|
310
312
|
text: parsed.text.slice(0, 80),
|
|
@@ -313,9 +315,22 @@ export class SandboxWsEndpoint extends SandboxClient {
|
|
|
313
315
|
subscription.conversation = scene;
|
|
314
316
|
const messageId = parsed.messageId ?? randomUUID();
|
|
315
317
|
this.#broadcast(this.#subscribers(scene, true), JSON.stringify({
|
|
316
|
-
...scene, conversation: scene, direction: 'inbound', senderId
|
|
318
|
+
...scene, conversation: scene, direction: 'inbound', senderId,
|
|
319
|
+
...(parsed.senderName ? { senderName: parsed.senderName } : {}),
|
|
320
|
+
...(parsed.senderRole ? { senderRole: parsed.senderRole } : {}),
|
|
317
321
|
messageId, endpoint: this.#options.defaults.id, content: parsed.content, timestamp: parsed.timestamp,
|
|
318
322
|
}));
|
|
323
|
+
const sender = {
|
|
324
|
+
id: senderId,
|
|
325
|
+
name: senderName,
|
|
326
|
+
...(parsed.senderRole
|
|
327
|
+
? {
|
|
328
|
+
role: parsed.senderRole,
|
|
329
|
+
roles: parsed.senderRole === 'master' ? ['master', 'admin'] : parsed.senderRole === 'admin' ? ['admin'] : ['member'],
|
|
330
|
+
permissions: parsed.senderRole === 'master' ? ['master', 'admin'] : parsed.senderRole === 'admin' ? ['admin'] : [],
|
|
331
|
+
}
|
|
332
|
+
: {}),
|
|
333
|
+
};
|
|
319
334
|
void this[endpointSpec].events.message({
|
|
320
335
|
event: raw,
|
|
321
336
|
...(typeof parsed.timestamp === 'number' ? { platformSentAt: parsed.timestamp } : {}),
|
|
@@ -323,7 +338,7 @@ export class SandboxWsEndpoint extends SandboxClient {
|
|
|
323
338
|
message: { conversation, id: messageId },
|
|
324
339
|
content: parsed.text,
|
|
325
340
|
segments: parsed.content,
|
|
326
|
-
sender
|
|
341
|
+
sender,
|
|
327
342
|
endpointId: target,
|
|
328
343
|
metadata: Object.freeze({
|
|
329
344
|
type: parsed.type,
|
|
@@ -331,6 +346,7 @@ export class SandboxWsEndpoint extends SandboxClient {
|
|
|
331
346
|
channelId: parsed.id || owner,
|
|
332
347
|
elements: parsed.content,
|
|
333
348
|
timestamp: parsed.timestamp,
|
|
349
|
+
...(parsed.senderRole ? { senderRole: parsed.senderRole } : {}),
|
|
334
350
|
...(parsed.action ? { action: parsed.action } : {}),
|
|
335
351
|
...(parsed.agentRun ? { sandboxAgentRun: parsed.agentRun } : {}),
|
|
336
352
|
}),
|
|
@@ -421,22 +437,34 @@ export class SandboxWsEndpoint extends SandboxClient {
|
|
|
421
437
|
});
|
|
422
438
|
}
|
|
423
439
|
}
|
|
440
|
+
const SHELL_ISOLATION_PROBE_TIMEOUT_MS = 500;
|
|
441
|
+
/** Hard ceiling for the ready gate even if the Docker CLI ignores SIGTERM or a child keeps stdio open. */
|
|
442
|
+
const SHELL_ISOLATION_PROBE_DEADLINE_MS = 750;
|
|
424
443
|
function probeShellIsolation() {
|
|
425
444
|
return new Promise((resolve) => {
|
|
426
|
-
|
|
445
|
+
let settled = false;
|
|
446
|
+
const settleRef = {};
|
|
447
|
+
const settle = (status) => {
|
|
448
|
+
if (settled)
|
|
449
|
+
return;
|
|
450
|
+
settled = true;
|
|
451
|
+
settleRef.clear?.();
|
|
452
|
+
resolve(status);
|
|
453
|
+
};
|
|
454
|
+
const child = execFile('docker', ['info', '--format', '{{.ServerVersion}}'], {
|
|
427
455
|
encoding: 'utf8',
|
|
428
|
-
timeout:
|
|
456
|
+
timeout: SHELL_ISOLATION_PROBE_TIMEOUT_MS,
|
|
429
457
|
}, (error, stdout) => {
|
|
430
458
|
if (!error) {
|
|
431
459
|
const version = stdout.trim();
|
|
432
|
-
|
|
460
|
+
settle(Object.freeze({
|
|
433
461
|
available: true,
|
|
434
462
|
provider: 'docker',
|
|
435
463
|
message: version ? `Docker ${version}` : 'Docker ready',
|
|
436
464
|
}));
|
|
437
465
|
return;
|
|
438
466
|
}
|
|
439
|
-
|
|
467
|
+
settle(Object.freeze({
|
|
440
468
|
available: false,
|
|
441
469
|
provider: 'docker',
|
|
442
470
|
message: error.killed || error.code === 'ETIMEDOUT'
|
|
@@ -444,6 +472,16 @@ function probeShellIsolation() {
|
|
|
444
472
|
: 'Docker daemon is unavailable',
|
|
445
473
|
}));
|
|
446
474
|
});
|
|
475
|
+
// execFile only reports after the child's stdio closes; a hung CLI must not hold `ready` hostage.
|
|
476
|
+
const deadline = setTimeout(() => {
|
|
477
|
+
try {
|
|
478
|
+
child?.kill('SIGKILL');
|
|
479
|
+
}
|
|
480
|
+
catch { /* already gone */ }
|
|
481
|
+
settle(Object.freeze({ available: false, provider: 'docker', message: 'Docker readiness check timed out' }));
|
|
482
|
+
}, SHELL_ISOLATION_PROBE_DEADLINE_MS);
|
|
483
|
+
deadline.unref?.();
|
|
484
|
+
settleRef.clear = () => clearTimeout(deadline);
|
|
447
485
|
}).catch(() => Object.freeze({
|
|
448
486
|
available: false,
|
|
449
487
|
provider: 'docker',
|
package/lib/protocol.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export interface SandboxConversation {
|
|
|
40
40
|
readonly type: 'private' | 'group' | 'channel';
|
|
41
41
|
readonly id: string;
|
|
42
42
|
}
|
|
43
|
+
export type SandboxSenderRole = 'master' | 'admin' | 'member';
|
|
43
44
|
export interface SandboxParsedMessage {
|
|
44
45
|
type: MessageType;
|
|
45
46
|
id: string;
|
|
@@ -52,7 +53,11 @@ export interface SandboxParsedMessage {
|
|
|
52
53
|
payload: string;
|
|
53
54
|
};
|
|
54
55
|
agentRun?: SandboxAgentRunConfig;
|
|
56
|
+
senderId?: string;
|
|
57
|
+
senderName?: string;
|
|
58
|
+
senderRole?: SandboxSenderRole;
|
|
55
59
|
}
|
|
60
|
+
export type SandboxInboundEnvelope = SandboxParsedMessage;
|
|
56
61
|
export type SandboxWsFrame = {
|
|
57
62
|
readonly kind: 'subscribe';
|
|
58
63
|
readonly conversation: SandboxConversation;
|
|
@@ -65,6 +70,7 @@ export type SandboxWsFrame = {
|
|
|
65
70
|
/** Control frames never fall through into chat or platform message hooks. */
|
|
66
71
|
export declare function parseSandboxWsFrame(raw: string): SandboxWsFrame;
|
|
67
72
|
export declare function parseSandboxWsPayload(raw: string): SandboxParsedMessage;
|
|
73
|
+
export declare const parseSandboxInboundPayload: typeof parseSandboxWsPayload;
|
|
68
74
|
/**
|
|
69
75
|
* 入站归一化 → ConversationRef。sandbox 无平台社交图谱:
|
|
70
76
|
* `private`/`group`/`channel` 直映射;`direct`(私聊)归 'private';
|
package/lib/protocol.js
CHANGED
|
@@ -99,6 +99,7 @@ export function parseSandboxWsFrame(raw) {
|
|
|
99
99
|
export function parseSandboxWsPayload(raw) {
|
|
100
100
|
return normalizeSandboxWsPayload(readSandboxWirePayload(raw), raw);
|
|
101
101
|
}
|
|
102
|
+
export const parseSandboxInboundPayload = parseSandboxWsPayload;
|
|
102
103
|
function normalizeSandboxWsPayload(payload, raw) {
|
|
103
104
|
const type = payload.type ?? 'private';
|
|
104
105
|
const id = payload.id ?? 'sandbox-user';
|
|
@@ -135,6 +136,17 @@ function normalizeSandboxWsPayload(payload, raw) {
|
|
|
135
136
|
const agentRun = normalizeSandboxAgentRunConfig(payload.agentRun);
|
|
136
137
|
const rawMessageId = typeof payload.messageId === 'string' ? payload.messageId.trim() : '';
|
|
137
138
|
const messageId = /^[A-Za-z0-9._:-]{1,160}$/u.test(rawMessageId) ? rawMessageId : undefined;
|
|
139
|
+
const senderId = typeof payload.senderId === 'string' && payload.senderId.trim()
|
|
140
|
+
? payload.senderId.trim()
|
|
141
|
+
: undefined;
|
|
142
|
+
const senderName = typeof payload.senderName === 'string' && payload.senderName.trim()
|
|
143
|
+
? payload.senderName.trim()
|
|
144
|
+
: undefined;
|
|
145
|
+
const senderRole = payload.senderRole === 'master'
|
|
146
|
+
|| payload.senderRole === 'admin'
|
|
147
|
+
|| payload.senderRole === 'member'
|
|
148
|
+
? payload.senderRole
|
|
149
|
+
: undefined;
|
|
138
150
|
return {
|
|
139
151
|
type,
|
|
140
152
|
id,
|
|
@@ -144,6 +156,9 @@ function normalizeSandboxWsPayload(payload, raw) {
|
|
|
144
156
|
text,
|
|
145
157
|
action,
|
|
146
158
|
...(agentRun ? { agentRun } : {}),
|
|
159
|
+
...(senderId ? { senderId } : {}),
|
|
160
|
+
...(senderName ? { senderName } : {}),
|
|
161
|
+
...(senderRole ? { senderRole } : {}),
|
|
147
162
|
};
|
|
148
163
|
}
|
|
149
164
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/adapter-sandbox",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.25",
|
|
4
4
|
"description": "Zhin.js Sandbox adapter for Plugin Runtime (WebSocket /sandbox)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -47,16 +47,16 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"lucide-react": "^0.525.0",
|
|
49
49
|
"react": "^19.2.8",
|
|
50
|
-
"@zhin.js/adapter": "1.1.
|
|
51
|
-
"@zhin.js/client": "1.1.
|
|
50
|
+
"@zhin.js/adapter": "1.1.29",
|
|
51
|
+
"@zhin.js/client": "1.1.25",
|
|
52
52
|
"@zhin.js/console-contract": "1.1.3",
|
|
53
|
-
"@zhin.js/core": "1.1.
|
|
54
|
-
"@zhin.js/feature-kit": "1.1.
|
|
55
|
-
"@zhin.js/host-http": "1.1.
|
|
56
|
-
"@zhin.js/im-contract": "1.1.
|
|
53
|
+
"@zhin.js/core": "1.1.57",
|
|
54
|
+
"@zhin.js/feature-kit": "1.1.13",
|
|
55
|
+
"@zhin.js/host-http": "1.1.15",
|
|
56
|
+
"@zhin.js/im-contract": "1.1.12",
|
|
57
57
|
"@zhin.js/logger": "1.1.2",
|
|
58
|
-
"@zhin.js/page": "1.1.
|
|
59
|
-
"@zhin.js/skill": "1.1.
|
|
58
|
+
"@zhin.js/page": "1.1.15",
|
|
59
|
+
"@zhin.js/skill": "1.1.14"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/react": "^19.2.18",
|
|
@@ -64,18 +64,18 @@
|
|
|
64
64
|
"typescript": "^6.0.3",
|
|
65
65
|
"vitest": "^4.1.10",
|
|
66
66
|
"ws": "^8.21.1",
|
|
67
|
-
"@zhin.js/pagemanager": "1.1.
|
|
68
|
-
"@zhin.js/runtime": "1.1.
|
|
69
|
-
"zhin.js": "1.1.
|
|
67
|
+
"@zhin.js/pagemanager": "1.1.22",
|
|
68
|
+
"@zhin.js/runtime": "1.1.19",
|
|
69
|
+
"zhin.js": "1.1.22"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"react": "^19.0.0",
|
|
73
|
-
"@zhin.js/adapter": "^1.1.
|
|
73
|
+
"@zhin.js/adapter": "^1.1.29",
|
|
74
74
|
"@zhin.js/console-contract": "^1.1.3",
|
|
75
|
-
"@zhin.js/core": "^1.1.
|
|
76
|
-
"@zhin.js/host-http": "^1.1.
|
|
77
|
-
"@zhin.js/page": "^1.1.
|
|
78
|
-
"zhin.js": "^1.1.
|
|
75
|
+
"@zhin.js/core": "^1.1.57",
|
|
76
|
+
"@zhin.js/host-http": "^1.1.15",
|
|
77
|
+
"@zhin.js/page": "^1.1.15",
|
|
78
|
+
"zhin.js": "^1.1.22"
|
|
79
79
|
},
|
|
80
80
|
"peerDependenciesMeta": {
|
|
81
81
|
"react": {
|
|
@@ -22,7 +22,7 @@ export default function HtmlMessage({ html, locale = 'zh-CN' }) {
|
|
|
22
22
|
return () => window.removeEventListener('message', onSize);
|
|
23
23
|
}, [nonce]);
|
|
24
24
|
const srcDoc = createHtmlMessageDocument(html, nonce);
|
|
25
|
-
return _jsx("iframe", { ref: frame, title: sandboxText(locale, "HTML 消息"), sandbox: "allow-scripts", srcDoc: srcDoc, className: "
|
|
25
|
+
return _jsx("iframe", { ref: frame, title: sandboxText(locale, "HTML 消息"), sandbox: "allow-scripts", srcDoc: srcDoc, className: "sandbox-html-frame", style: { height } });
|
|
26
26
|
}
|
|
27
27
|
/** getRandomValues is available on ordinary HTTP LAN pages as well as HTTPS. */
|
|
28
28
|
export function createHtmlMessageNonce() {
|
|
@@ -28,7 +28,7 @@ export default function HtmlMessage({ html, locale = 'zh-CN' }: { readonly html:
|
|
|
28
28
|
title={sandboxText(locale, "HTML 消息")}
|
|
29
29
|
sandbox="allow-scripts"
|
|
30
30
|
srcDoc={srcDoc}
|
|
31
|
-
className="
|
|
31
|
+
className="sandbox-html-frame"
|
|
32
32
|
style={{ height }}
|
|
33
33
|
/>;
|
|
34
34
|
}
|
|
@@ -347,21 +347,7 @@ const RichTextEditor = forwardRef(({ locale = 'zh-CN', placeholder = sandboxText
|
|
|
347
347
|
replaceAtTrigger,
|
|
348
348
|
getContent
|
|
349
349
|
}));
|
|
350
|
-
return (_jsx("div", { ref: editorRef, contentEditable: true, suppressContentEditableWarning: true, onInput: handleChange, onKeyDown: handleKeyDown, onPaste: handlePaste, "data-placeholder": placeholder, className: "rich-text-editor", style: {
|
|
351
|
-
width: '100%',
|
|
352
|
-
minHeight,
|
|
353
|
-
maxHeight,
|
|
354
|
-
padding: '0.5rem 0.75rem',
|
|
355
|
-
border: '1px solid var(--gray-6)',
|
|
356
|
-
borderRadius: '6px',
|
|
357
|
-
backgroundColor: 'var(--gray-1)',
|
|
358
|
-
fontSize: 'var(--font-size-2)',
|
|
359
|
-
outline: 'none',
|
|
360
|
-
overflowY: 'auto',
|
|
361
|
-
lineHeight: '1.5',
|
|
362
|
-
wordWrap: 'break-word',
|
|
363
|
-
color: 'var(--gray-12)'
|
|
364
|
-
} }));
|
|
350
|
+
return (_jsx("div", { ref: editorRef, contentEditable: true, role: "textbox", "aria-label": placeholder, "aria-multiline": "true", suppressContentEditableWarning: true, onInput: handleChange, onKeyDown: handleKeyDown, onPaste: handlePaste, "data-placeholder": placeholder, className: "rich-text-editor", style: { width: '100%', minHeight, maxHeight } }));
|
|
365
351
|
});
|
|
366
352
|
RichTextEditor.displayName = 'RichTextEditor';
|
|
367
353
|
export default RichTextEditor;
|
|
@@ -412,27 +412,16 @@ const RichTextEditor = forwardRef<RichTextEditorRef, RichTextEditorProps>(
|
|
|
412
412
|
<div
|
|
413
413
|
ref={editorRef}
|
|
414
414
|
contentEditable
|
|
415
|
+
role="textbox"
|
|
416
|
+
aria-label={placeholder}
|
|
417
|
+
aria-multiline="true"
|
|
415
418
|
suppressContentEditableWarning
|
|
416
419
|
onInput={handleChange}
|
|
417
420
|
onKeyDown={handleKeyDown}
|
|
418
421
|
onPaste={handlePaste}
|
|
419
422
|
data-placeholder={placeholder}
|
|
420
423
|
className="rich-text-editor"
|
|
421
|
-
style={{
|
|
422
|
-
width: '100%',
|
|
423
|
-
minHeight,
|
|
424
|
-
maxHeight,
|
|
425
|
-
padding: '0.5rem 0.75rem',
|
|
426
|
-
border: '1px solid var(--gray-6)',
|
|
427
|
-
borderRadius: '6px',
|
|
428
|
-
backgroundColor: 'var(--gray-1)',
|
|
429
|
-
fontSize: 'var(--font-size-2)',
|
|
430
|
-
outline: 'none',
|
|
431
|
-
overflowY: 'auto',
|
|
432
|
-
lineHeight: '1.5',
|
|
433
|
-
wordWrap: 'break-word',
|
|
434
|
-
color: 'var(--gray-12)'
|
|
435
|
-
}}
|
|
424
|
+
style={{ width: '100%', minHeight, maxHeight }}
|
|
436
425
|
/>
|
|
437
426
|
)
|
|
438
427
|
}
|