跳到主要内容

import

描述

在菜单栏中按下"Import"选项或通过 Event Bus 方法触发后触发

用法

"import": ({ html?: string }) => boolean | void;

参数

import 事件的回调函数可接受一个包含以下参数的对象:

  • html - HTML 格式的文本值
信息

如需处理内部事件,您可以使用 Event Bus 方法

示例

// 初始化 RichText
const editor = new richtext.Richtext("#root", {
// 配置属性
});
// 订阅 "import" 事件
editor.api.on("import", (obj) => {
console.log(obj.html);
console.log("The new value was imported");
});
// 导入新值
editor.api.exec("import", {
html: "<h2>some value</h2>" // 仅调用 setValue
});

变更日志: 该事件在 v2.0 中添加