wangEditor
wangEditor copied to clipboard
自定义扩展功能node节点不对问题
问题描述
在使用react 中使用wangeditor的自定义扩展功能时候,我将自定义的node设置为行内元素,但是渲染出来的一直表现为块级元素 比如原来的元素是<p>123</p>,我的目的是成为<p>1<span>2</span>3</p>但是实际效果是<p>1</p><span>2</span><p>3</p>
效果如下
自定义按钮的触发事件为
editor.restoreSelection();
editor.insertNode(myResume);
// 光标移动一位
editor.move(1);
之前相同功能我在原生的slate中实现过 代码为
const isActive = this.isBimlightBlockActive();
if (isActive) {
Transforms.unwrapNodes(this.editor, {
// @ts-ignore
match: n => n.type === 'bimlight',
});
} else {
const bimlight = {
type: 'bimlight',
bimlight: bimCodes.join(','),
children: [{ text: '' }],
};
Transforms.wrapNodes(this.editor, bimlight, { split: true });
Transforms.collapse(this.editor, { edge: 'end' });
}
this.forceUpdatePath();然而放在这里是同样的效果
wangEditor 版本
请输入内容……
是否查阅了文档 ?
(文档链接 www.wangeditor.com )
是/否
(请告诉我们,如何最快的复现该问题?)
- 步骤一 选中文本
- 步骤二 点击自定义扩展按钮