跳到主要内容

Editor API

初始化

interface EditorConfig {
// Configuration for the editor items
items: Array<Record<string, any>>;
// Automatically apply changes to the data object
autoSave?: boolean;
// Define the current active batch for the editor
activeBatch?: string;
// Configuration for the top toolbar
topBar?: {
// Array of items for the toolbar
items: Array<Record<string, any>>;
};
// Configuration for the bottom toolbar
bottomBar?: {
// Array of items for the toolbar
items: Array<Record<string, any>>;
};
// Additional CSS class for the editor's box
css?: string;
// Initial values for the editor fields
values?: Record<string, any>;
// Placement of the editor (inline, modal, sidebar)
placement?: "inline" | "modal" | "sidebar";
// Set the editor to readonly mode
readonly?: boolean;
// Define layout for the editor
layout?: "columns" | "default";
// Function to handle action events
onaction?: (ev: OnActionResult) => void;
// Function to handle change events
onchange?: (ev: OnChangeResult) => void;
// Function to handle save events
onsave?: (ev: OnSaveResult) => void;
// Function to handle validation events
onvalidation?: (ev: OnValidationResult) => void;
}

属性

activeBatch可选。控制编辑器中当前激活的输入批次
autoSave可选。控制编辑器中数据的自动保存
bottomBar可选。控制编辑器底部工具栏的配置
css可选。为编辑器的容器框定义 CSS 类
focus可选。控制编辑器 widget 在渲染时是否自动获得焦点
hotkeys可选。允许为编辑器操作指定自定义快捷键
items可选。定义在 Editor 中渲染的组件
layout可选。控制编辑器组件的布局
placement可选。控制编辑器组件的显示位置
readonly可选。控制编辑器是否处于只读模式
topBar可选。控制编辑器顶部工具栏的配置
values可选。定义编辑器字段的初始值

Events

action当编辑器中任意字段发生变更时触发
change当编辑器中任意字段发生变更时触发
save当用户请求保存编辑器中的数据时触发
validation在验证过程完成时触发

辅助工具


相关资源

  • 访问 功能指南 以了解更多关于该 widget 的功能。
  • 浏览 示例 以直观了解可用功能。