amis-editor-core 6.11.0-beta.4 → 6.11.0-beta.6

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.
@@ -0,0 +1,28 @@
1
+ import { InlineEditableElement } from './plugin';
2
+ import { EditorNodeType } from './store/node';
3
+ /**
4
+ * 内联编辑上下文接口定义
5
+ * @interface InlineEditContext
6
+ * @property {EditorNodeType} node - 当前编辑器节点实例
7
+ * @property {HTMLElement} elem - 需要编辑的DOM元素
8
+ * @property {InlineEditableElement} config - 内联编辑的配置信息
9
+ * @property {MouseEvent} [event] - 触发编辑的鼠标事件对象
10
+ * @property {Function} onConfirm - 编辑确认后的回调函数,参数为编辑后的内容
11
+ * @property {Function} onCancel - 取消编辑的回调函数
12
+ */
13
+ export interface InlineEditContext {
14
+ node: EditorNodeType;
15
+ elem: HTMLElement;
16
+ config: InlineEditableElement;
17
+ event?: MouseEvent;
18
+ onConfirm: (value: string) => void;
19
+ onCancel: () => void;
20
+ richTextToken?: string;
21
+ richTextOptions?: any;
22
+ }
23
+ /**
24
+ * 启动内联编辑
25
+ * 根据配置的mode选择对应的编辑模式
26
+ * @param {InlineEditContext} context - 编辑上下文
27
+ */
28
+ export declare function startInlineEdit(context: InlineEditContext): void;
package/esm/manager.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  /// <reference types="lodash" />
3
3
  import { DataSchema } from 'amis';
4
4
  import { RenderOptions, GlobalVariableItem } from 'amis-core';
5
- import { PluginInterface, BasicPanelItem, RendererInfo, SubRendererInfo, PluginEvent, RegionConfig, ContextMenuItem, ContextMenuEventContext, EventContext, PluginEventFn, ScaffoldForm, RendererPluginEvent, PluginEvents, PluginActions } from './plugin';
5
+ import { PluginInterface, BasicPanelItem, RendererInfo, SubRendererInfo, PluginEvent, RegionConfig, ContextMenuItem, ContextMenuEventContext, EventContext, PluginEventFn, ScaffoldForm, RendererPluginEvent, PluginEvents, PluginActions, InlineEditableElement } from './plugin';
6
6
  import { EditorStoreType, SubEditorContext } from './store/editor';
7
7
  import { EditorNodeType } from './store/node';
8
8
  import { EditorProps } from './component/Editor';
@@ -112,10 +112,6 @@ export declare class EditorManager {
112
112
  readonly removable: boolean;
113
113
  readonly duplicatable: boolean;
114
114
  readonly replaceable: boolean;
115
- /**
116
- * 在 component/Editor.tsx 里面实例化的。
117
- * 辅助 component/Editor.tsx 实现一些非 UI 相关的功能。
118
- */
119
115
  memberImmutable(region: string): boolean;
120
116
  readonly isRegion: boolean;
121
117
  readonly childRegions: any[];
@@ -180,10 +176,6 @@ export declare class EditorManager {
180
176
  readonly removable: boolean;
181
177
  readonly duplicatable: boolean;
182
178
  readonly replaceable: boolean;
183
- /**
184
- * 在 component/Editor.tsx 里面实例化的。
185
- * 辅助 component/Editor.tsx 实现一些非 UI 相关的功能。
186
- */
187
179
  memberImmutable(region: string): boolean;
188
180
  readonly isRegion: boolean;
189
181
  readonly childRegions: any[];
@@ -247,10 +239,6 @@ export declare class EditorManager {
247
239
  readonly removable: boolean;
248
240
  readonly duplicatable: boolean;
249
241
  readonly replaceable: boolean;
250
- /**
251
- * 在 component/Editor.tsx 里面实例化的。
252
- * 辅助 component/Editor.tsx 实现一些非 UI 相关的功能。
253
- */
254
242
  memberImmutable(region: string): boolean;
255
243
  readonly isRegion: boolean;
256
244
  readonly childRegions: any[];
@@ -341,10 +329,6 @@ export declare class EditorManager {
341
329
  readonly removable: boolean;
342
330
  readonly duplicatable: boolean;
343
331
  readonly replaceable: boolean;
344
- /**
345
- * 在 component/Editor.tsx 里面实例化的。
346
- * 辅助 component/Editor.tsx 实现一些非 UI 相关的功能。
347
- */
348
332
  memberImmutable(region: string): boolean;
349
333
  readonly isRegion: boolean;
350
334
  readonly childRegions: any[];
@@ -408,10 +392,6 @@ export declare class EditorManager {
408
392
  readonly removable: boolean;
409
393
  readonly duplicatable: boolean;
410
394
  readonly replaceable: boolean;
411
- /**
412
- * 在 component/Editor.tsx 里面实例化的。
413
- * 辅助 component/Editor.tsx 实现一些非 UI 相关的功能。
414
- */
415
395
  memberImmutable(region: string): boolean;
416
396
  readonly isRegion: boolean;
417
397
  readonly childRegions: any[];
@@ -509,10 +489,6 @@ export declare class EditorManager {
509
489
  readonly removable: boolean;
510
490
  readonly duplicatable: boolean;
511
491
  readonly replaceable: boolean;
512
- /**
513
- * 在 component/Editor.tsx 里面实例化的。
514
- * 辅助 component/Editor.tsx 实现一些非 UI 相关的功能。
515
- */
516
492
  memberImmutable(region: string): boolean;
517
493
  readonly isRegion: boolean;
518
494
  readonly childRegions: any[];
@@ -577,10 +553,6 @@ export declare class EditorManager {
577
553
  readonly removable: boolean;
578
554
  readonly duplicatable: boolean;
579
555
  readonly replaceable: boolean;
580
- /**
581
- * 在 component/Editor.tsx 里面实例化的。
582
- * 辅助 component/Editor.tsx 实现一些非 UI 相关的功能。
583
- */
584
556
  memberImmutable(region: string): boolean;
585
557
  readonly isRegion: boolean;
586
558
  readonly childRegions: any[];
@@ -644,10 +616,6 @@ export declare class EditorManager {
644
616
  readonly removable: boolean;
645
617
  readonly duplicatable: boolean;
646
618
  readonly replaceable: boolean;
647
- /**
648
- * 在 component/Editor.tsx 里面实例化的。
649
- * 辅助 component/Editor.tsx 实现一些非 UI 相关的功能。
650
- */
651
619
  memberImmutable(region: string): boolean;
652
620
  readonly isRegion: boolean;
653
621
  readonly childRegions: any[];
@@ -738,10 +706,6 @@ export declare class EditorManager {
738
706
  readonly removable: boolean;
739
707
  readonly duplicatable: boolean;
740
708
  readonly replaceable: boolean;
741
- /**
742
- * 在 component/Editor.tsx 里面实例化的。
743
- * 辅助 component/Editor.tsx 实现一些非 UI 相关的功能。
744
- */
745
709
  memberImmutable(region: string): boolean;
746
710
  readonly isRegion: boolean;
747
711
  readonly childRegions: any[];
@@ -805,10 +769,6 @@ export declare class EditorManager {
805
769
  readonly removable: boolean;
806
770
  readonly duplicatable: boolean;
807
771
  readonly replaceable: boolean;
808
- /**
809
- * 在 component/Editor.tsx 里面实例化的。
810
- * 辅助 component/Editor.tsx 实现一些非 UI 相关的功能。
811
- */
812
772
  memberImmutable(region: string): boolean;
813
773
  readonly isRegion: boolean;
814
774
  readonly childRegions: any[];
@@ -1178,6 +1138,7 @@ export declare class EditorManager {
1178
1138
  * 获取可用上下文待绑定字段
1179
1139
  */
1180
1140
  getAvailableContextFields(node: EditorNodeType): Promise<any>;
1141
+ startInlineEdit(node: EditorNodeType, elem: HTMLElement, config: InlineEditableElement, event?: MouseEvent): void;
1181
1142
  /**
1182
1143
  * 初始化全局变量
1183
1144
  */
package/esm/plugin.d.ts CHANGED
@@ -127,6 +127,11 @@ export interface RendererScaffoldInfo {
127
127
  type?: string;
128
128
  scaffold?: any;
129
129
  }
130
+ export interface InlineEditableElement {
131
+ match: string;
132
+ mode?: 'plain-text' | 'rich-text';
133
+ key: string;
134
+ }
130
135
  /**
131
136
  * 渲染器信息。
132
137
  */
@@ -148,6 +153,10 @@ export interface RendererInfo extends RendererScaffoldInfo {
148
153
  * 配置区域。
149
154
  */
150
155
  regions?: Array<RegionConfig>;
156
+ /**
157
+ * 支持内联编辑的元素集合
158
+ */
159
+ inlineEditableElements?: Array<InlineEditableElement>;
151
160
  /**
152
161
  * 选中不需要高亮
153
162
  */
@@ -347,9 +356,10 @@ export interface PanelProps {
347
356
  export interface PanelItem {
348
357
  nodeId?: string;
349
358
  key: string;
350
- icon: string;
359
+ icon: React.ReactNode;
360
+ tooltip?: string;
351
361
  pluginIcon?: string;
352
- title: string | JSX.Element;
362
+ title?: React.ReactNode;
353
363
  component?: React.ComponentType<PanelProps | any>;
354
364
  order: number;
355
365
  position?: 'left' | 'right';
@@ -453,7 +453,10 @@ export declare const MainStore: import("mobx-state-tree").IModelType<{
453
453
  calculateHighlightBox(root?: any): void;
454
454
  resetHighlightBox(root: any): void;
455
455
  updateState(state: any, replace?: boolean): void;
456
- setWidthMutable(value: any): void;
456
+ setWidthMutable(value: any): void; /**
457
+ * 根据当前分类和关键字获取预置组件
458
+ * 备注:组件面板展示需要
459
+ */
457
460
  setHeightMutable(value: any): void;
458
461
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>, [undefined]>;
459
462
  theme: import("mobx-state-tree").IType<string | undefined, string, string>;
@@ -463,6 +466,7 @@ export declare const MainStore: import("mobx-state-tree").IModelType<{
463
466
  hoverRegion: import("mobx-state-tree").IType<string | undefined, string, string>;
464
467
  activeId: import("mobx-state-tree").IType<string | undefined, string, string>;
465
468
  activeRegion: import("mobx-state-tree").IType<string | undefined, string, string>;
469
+ activeElement: import("mobx-state-tree").IType<string | undefined, string, string>;
466
470
  mouseMoveRegion: import("mobx-state-tree").IType<string | undefined, string, string>;
467
471
  selections: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<string[], string[], string[]>, [undefined]>;
468
472
  contextId: import("mobx-state-tree").IType<string | undefined, string, string>;
@@ -912,7 +916,10 @@ export declare const MainStore: import("mobx-state-tree").IModelType<{
912
916
  calculateHighlightBox(root?: any): void;
913
917
  resetHighlightBox(root: any): void;
914
918
  updateState(state: any, replace?: boolean): void;
915
- setWidthMutable(value: any): void;
919
+ setWidthMutable(value: any): void; /**
920
+ * 根据当前分类和关键字获取预置组件
921
+ * 备注:组件面板展示需要
922
+ */
916
923
  setHeightMutable(value: any): void;
917
924
  } & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
918
925
  parentId: import("mobx-state-tree").IType<string | undefined, string, string>;
@@ -1289,7 +1296,10 @@ export declare const MainStore: import("mobx-state-tree").IModelType<{
1289
1296
  calculateHighlightBox(root?: any): void;
1290
1297
  resetHighlightBox(root: any): void;
1291
1298
  updateState(state: any, replace?: boolean): void;
1292
- setWidthMutable(value: any): void;
1299
+ setWidthMutable(value: any): void; /**
1300
+ * 根据当前分类和关键字获取预置组件
1301
+ * 备注:组件面板展示需要
1302
+ */
1293
1303
  setHeightMutable(value: any): void;
1294
1304
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>)[];
1295
1305
  getNodeById(id: string, regionOrType?: string): EditorNodeType | undefined;
@@ -1689,7 +1699,10 @@ export declare const MainStore: import("mobx-state-tree").IModelType<{
1689
1699
  calculateHighlightBox(root?: any): void;
1690
1700
  resetHighlightBox(root: any): void;
1691
1701
  updateState(state: any, replace?: boolean): void;
1692
- setWidthMutable(value: any): void;
1702
+ setWidthMutable(value: any): void; /**
1703
+ * 根据当前分类和关键字获取预置组件
1704
+ * 备注:组件面板展示需要
1705
+ */
1693
1706
  setHeightMutable(value: any): void;
1694
1707
  } & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
1695
1708
  parentId: import("mobx-state-tree").IType<string | undefined, string, string>;
@@ -2066,7 +2079,10 @@ export declare const MainStore: import("mobx-state-tree").IModelType<{
2066
2079
  calculateHighlightBox(root?: any): void;
2067
2080
  resetHighlightBox(root: any): void;
2068
2081
  updateState(state: any, replace?: boolean): void;
2069
- setWidthMutable(value: any): void;
2082
+ setWidthMutable(value: any): void; /**
2083
+ * 根据当前分类和关键字获取预置组件
2084
+ * 备注:组件面板展示需要
2085
+ */
2070
2086
  setHeightMutable(value: any): void;
2071
2087
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>)[];
2072
2088
  readonly activePath: ({
@@ -2444,7 +2460,10 @@ export declare const MainStore: import("mobx-state-tree").IModelType<{
2444
2460
  calculateHighlightBox(root?: any): void;
2445
2461
  resetHighlightBox(root: any): void;
2446
2462
  updateState(state: any, replace?: boolean): void;
2447
- setWidthMutable(value: any): void;
2463
+ setWidthMutable(value: any): void; /**
2464
+ * 根据当前分类和关键字获取预置组件
2465
+ * 备注:组件面板展示需要
2466
+ */
2448
2467
  setHeightMutable(value: any): void;
2449
2468
  } & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
2450
2469
  parentId: import("mobx-state-tree").IType<string | undefined, string, string>;
@@ -2821,7 +2840,10 @@ export declare const MainStore: import("mobx-state-tree").IModelType<{
2821
2840
  calculateHighlightBox(root?: any): void;
2822
2841
  resetHighlightBox(root: any): void;
2823
2842
  updateState(state: any, replace?: boolean): void;
2824
- setWidthMutable(value: any): void;
2843
+ setWidthMutable(value: any): void; /**
2844
+ * 根据当前分类和关键字获取预置组件
2845
+ * 备注:组件面板展示需要
2846
+ */
2825
2847
  setHeightMutable(value: any): void;
2826
2848
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>)[];
2827
2849
  getNodePathById(id: string): ({
@@ -3199,7 +3221,10 @@ export declare const MainStore: import("mobx-state-tree").IModelType<{
3199
3221
  calculateHighlightBox(root?: any): void;
3200
3222
  resetHighlightBox(root: any): void;
3201
3223
  updateState(state: any, replace?: boolean): void;
3202
- setWidthMutable(value: any): void;
3224
+ setWidthMutable(value: any): void; /**
3225
+ * 根据当前分类和关键字获取预置组件
3226
+ * 备注:组件面板展示需要
3227
+ */
3203
3228
  setHeightMutable(value: any): void;
3204
3229
  } & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
3205
3230
  parentId: import("mobx-state-tree").IType<string | undefined, string, string>;
@@ -3576,7 +3601,10 @@ export declare const MainStore: import("mobx-state-tree").IModelType<{
3576
3601
  calculateHighlightBox(root?: any): void;
3577
3602
  resetHighlightBox(root: any): void;
3578
3603
  updateState(state: any, replace?: boolean): void;
3579
- setWidthMutable(value: any): void;
3604
+ setWidthMutable(value: any): void; /**
3605
+ * 根据当前分类和关键字获取预置组件
3606
+ * 备注:组件面板展示需要
3607
+ */
3580
3608
  setHeightMutable(value: any): void;
3581
3609
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>)[];
3582
3610
  readonly dragging: boolean;
@@ -3661,6 +3689,7 @@ export declare const MainStore: import("mobx-state-tree").IModelType<{
3661
3689
  moveSchema(event: PluginEvent<MoveEventContext>): void;
3662
3690
  setActiveId(id: string, region?: string, selections?: Array<string>, onEditorActive?: boolean): void;
3663
3691
  setActiveIdByComponentId(id: string): void;
3692
+ setActiveElement(selector: string): void;
3664
3693
  setSelections(ids: Array<string>): void;
3665
3694
  clearSelection(): void;
3666
3695
  setHoverId(id: string, region?: string): void;
@@ -6,6 +6,8 @@ import { PluginEventListener, RendererPluginAction, IGlobalEvent } from '../plug
6
6
  import type { SchemaObject } from 'amis';
7
7
  import type { VariableGroup, VariableOptions } from '../variable';
8
8
  import type { EditorNodeType } from '../store/node';
9
+ import { LeftPanelsProps } from './Panel/LeftPanels';
10
+ import { RightPanelsProps } from './Panel/RightPanels';
9
11
  export interface EditorProps extends PluginEventListener {
10
12
  value: SchemaObject;
11
13
  onChange: (value: SchemaObject) => void;
@@ -95,6 +97,13 @@ export interface EditorProps extends PluginEventListener {
95
97
  onEditorMount?: (manager: EditorManager) => void;
96
98
  onEditorUnmount?: (manager: EditorManager) => void;
97
99
  children?: React.ReactNode | ((manager: EditorManager) => React.ReactNode);
100
+ LeftPanelsComponent?: React.ComponentType<LeftPanelsProps>;
101
+ RightPanelsComponent?: React.ComponentType<RightPanelsProps>;
102
+ /**
103
+ * 富文本编辑器配置, 用于内联编辑
104
+ */
105
+ richTextOptions?: any;
106
+ richTextToken?: string;
98
107
  }
99
108
  export default class Editor extends Component<EditorProps> {
100
109
  readonly store: EditorStoreType;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { EditorManager } from '../../manager';
3
3
  import { EditorStoreType } from '../../store/editor';
4
- interface LeftPanelsProps {
4
+ export interface LeftPanelsProps {
5
5
  store: EditorStoreType;
6
6
  manager: EditorManager;
7
7
  theme?: string;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { EditorManager } from '../../manager';
3
3
  import { EditorStoreType } from '../../store/editor';
4
- interface RightPanelsProps {
4
+ export interface RightPanelsProps {
5
5
  store: EditorStoreType;
6
6
  manager: EditorManager;
7
7
  theme?: string;
@@ -23,7 +23,7 @@ export interface PreviewState {
23
23
  ready?: boolean;
24
24
  }
25
25
  export default class Preview extends Component<PreviewProps> {
26
- currentDom: HTMLElement;
26
+ currentDom: React.RefObject<HTMLDivElement>;
27
27
  dialogReaction: any;
28
28
  env: RenderOptions;
29
29
  doingSelection: boolean;
@@ -46,6 +46,7 @@ export default class Preview extends Component<PreviewProps> {
46
46
  h: number;
47
47
  }): void;
48
48
  handleClick(e: MouseEvent): void;
49
+ handleDBClick(e: MouseEvent): void;
49
50
  handleNavSwitch(id: string): void;
50
51
  handleMouseMove(e: MouseEvent): void;
51
52
  handleMouseLeave(): void;
@@ -16,7 +16,7 @@ export default class BackTop extends React.Component<BackTopProps, BackTopStates
16
16
  constructor(props: any);
17
17
  componentDidMount(): void;
18
18
  componentWillUnmount(): void;
19
- getDefaultTarget(): (Window & typeof globalThis) | Document;
19
+ getDefaultTarget(): Document | (Window & typeof globalThis);
20
20
  handleScroll(e: React.UIEvent<HTMLElement> | {
21
21
  target: any;
22
22
  }): void;
package/lib/editor.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-editor-core v6.11.0-beta.4
2
+ * amis-editor-core v6.11.0-beta.6
3
3
  * Copyright 2018-2025 @fex
4
4
  */
5
5
 
package/lib/index.d.ts CHANGED
@@ -42,7 +42,9 @@ import { SchemaForm } from './component/base/SchemaForm';
42
42
  import { RendererThumb } from './component/RendererThumb';
43
43
  import { AvailableRenderersPanel } from './component/Panel/AvailableRenderersPanel';
44
44
  import { deepSplice } from './deepSplice';
45
+ import type { RightPanelsProps } from './component/Panel/RightPanels';
46
+ import type { LeftPanelsProps } from './component/Panel/LeftPanels';
45
47
  export declare const version = "__buildVersion";
46
48
  export default Editor;
47
49
  export { Editor, MiniEditor, utils, deepSplice, mapReactElement, RendererEditor, BasicEditor, CodeEditor, VRenderer, RegionWrapper, IFramePreview as IFrameEditor, SearchPanel, EditorNodeType, EditorNodeSnapshot, EditorStoreType, ContainerWrapper, AvailableRenderersPlugin, AvailableRenderersPanel, BasicToolbarPlugin, CodePlugin, ErrorRendererPlugin, OutlinePlugin, UnknownRendererPlugin, ShortcutKey, SchemaForm as SchemaFrom, // 兼容老版本
48
- SchemaForm, WidthDraggableContainer, RendererThumb };
50
+ SchemaForm, WidthDraggableContainer, RendererThumb, LeftPanelsProps, RightPanelsProps };