创建 editor 上下文 EditorContext 对象。建议使用 xhs.createEditorContext 获取 context 对象。
editor 组件的 id
EditorContext
// 示例代码:创建 EditorContext 对象 function createEditorContext(editorId) { // 使用 xhs.createEditorContext 获取 EditorContext 对象 const editorContext = xhs.createEditorContext(editorId); return editorContext; } // 调用示例 const editorId = 'myEditor'; // 替换为实际的 editor 组件 id const editorContext = createEditorContext(editorId); // 使用 EditorContext 示例 editorContext.insertText({ text: 'Hello, 小红书!', success: () => { console.log('文本插入成功'); }, fail: (err) => { console.error('文本插入失败:', err); }, });