@lingjingai/script-editor 0.1.15 → 0.1.17
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/INTEGRATION.md +2 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +445 -202
- package/dist/index.js.map +1 -1
- package/dist/style.css +52 -1
- package/package.json +1 -1
package/INTEGRATION.md
CHANGED
|
@@ -66,6 +66,8 @@ function Host({ script, setScript }) {
|
|
|
66
66
|
- `disabled`、`dark`、`className`
|
|
67
67
|
|
|
68
68
|
**HUD(顶栏)**
|
|
69
|
+
- `onTitleChange?(next: string)`:顶栏左侧常驻**剧本标题**(取 `value.title`)。传了它,标题变**点击即改**;不传则只读展示(`value.title` 为空时不显示)。包**不碰存储**——拿到新标题宿主自己持久化(可 `onEdit(p => ({...p, title}))` 写回 `script.json`,或另调重命名接口)。`0.1.16+`
|
|
70
|
+
- `topBarActions?: ReactNode`:顶栏**右侧**(格式切换/撤销重做旁)的**宿主注入槽**,放 stage 级业务按钮(如「删除剧本」「查看中间产物」)。包只渲染传入节点、零业务。`0.1.16+`
|
|
69
71
|
- `saveStatus`:`"idle" | "saving" | "saved" | "error"`
|
|
70
72
|
- `canUndo` / `canRedo` / `onUndo` / `onRedo` —— **Cmd/Ctrl+Z 撤销、Cmd/Ctrl+Shift+Z(或 Ctrl+Y)重做 已内建**(输入框内放行原生撤回),宿主**不要再自己接键盘监听**,否则会双触发(撤销两步)。`0.1.2+`
|
|
71
73
|
|
package/dist/index.d.ts
CHANGED
|
@@ -488,6 +488,14 @@ interface ScriptEditorProps extends ScriptEditorAdapters {
|
|
|
488
488
|
disabled?: boolean;
|
|
489
489
|
className?: string;
|
|
490
490
|
dark?: boolean;
|
|
491
|
+
/** when provided, the script title (value.title) becomes click-to-edit in the
|
|
492
|
+
* top bar; the host persists the new value (the editor never touches storage,
|
|
493
|
+
* matching the value + onEdit contract — just one more delegated hook). Omit →
|
|
494
|
+
* the title shows read-only (or nothing when value.title is empty). */
|
|
495
|
+
onTitleChange?: (next: string) => void;
|
|
496
|
+
/** host-injected actions for the top bar's right edge (e.g. 删除剧本 /
|
|
497
|
+
* 查看中间产物). The package only renders the node — all business stays host-side. */
|
|
498
|
+
topBarActions?: React.ReactNode;
|
|
491
499
|
saveStatus?: SaveStatus;
|
|
492
500
|
canUndo?: boolean;
|
|
493
501
|
canRedo?: boolean;
|
|
@@ -504,7 +512,7 @@ interface ScriptEditorProps extends ScriptEditorAdapters {
|
|
|
504
512
|
* scroll position across editor unmount/remount (tab switch / project nav). */
|
|
505
513
|
scrollScopeKey?: string;
|
|
506
514
|
}
|
|
507
|
-
declare function ScriptEditor({ value, onEdit, selection: controlledSelection, onSelectionChange, format: controlledFormat, onFormatChange, disabled, className, dark, saveStatus, canUndo, canRedo, onUndo, onRedo, onEditingChange, referenceFocusRequest, scrollScopeKey, diff, asset, onAddChatReferences, onRequestAssetDelete, }: ScriptEditorProps): react.JSX.Element;
|
|
515
|
+
declare function ScriptEditor({ value, onEdit, selection: controlledSelection, onSelectionChange, format: controlledFormat, onFormatChange, disabled, className, dark, onTitleChange, topBarActions, saveStatus, canUndo, canRedo, onUndo, onRedo, onEditingChange, referenceFocusRequest, scrollScopeKey, diff, asset, onAddChatReferences, onRequestAssetDelete, }: ScriptEditorProps): react.JSX.Element;
|
|
508
516
|
|
|
509
517
|
/**
|
|
510
518
|
* Pure ScriptProject mutations.
|