withimage.js
507 Bytes
import { DomEditor } from '@wangeditor/editor'
export function withBreakAndDelete(editor) {
const { isInline, isVoid } = editor
const newEditor = editor
newEditor.isInline = elem => {
const type = DomEditor.getNodeType(elem)
if (type === 'text') return true
return isInline(elem)
}
newEditor.isVoid = elem => {
const type = DomEditor.getNodeType(elem)
if (type === 'text') return true
return isVoid(elem)
}
return newEditor // 返回 newEditor ,重要!!!
}