shenrongliang
2025-04-03 0e7b0e885872459ad27492e84c0dce43a92a465e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { DomEditor } from '@wangeditor/editor'
 
function withTitleBlack(editor) {
  const { isInline, isVoid } = editor
  const newEditor = editor
 
  newEditor.isInline = elem => {
    const type = DomEditor.getNodeType(elem)
    if (type === 'title-black') return true
    if (type === 'number-value') return true
    if (type === 'text-value') return true
    return isInline(elem)
  }
 
  newEditor.isVoid = elem => {
    const type = DomEditor.getNodeType(elem)
    if (type === 'title-black') return true
    if (type === 'number-value') return true
    if (type === 'text-value') return true
    return isVoid(elem)
  }
 
  return newEditor // 返回 newEditor ,重要!!!
}
 
export default withTitleBlack;