MCPcopy Create free account
hub / github.com/editablejs/editable / matcher

Function matcher

packages/models/src/transforms/insert-fragment.ts:84–117  ·  view source on GitHub ↗
([n, p]: NodeEntry)

Source from the content-addressed store, hash-verified

82
83 const matches: NodeEntry[] = []
84 const matcher = ([n, p]: NodeEntry) => {
85 const isRoot = p.length === 0
86 if (isRoot) {
87 return false
88 }
89
90 if (isBlockEmpty) {
91 return true
92 }
93
94 if (
95 mergeStart &&
96 Path.isAncestor(p, firstPath) &&
97 Element.isElement(n) &&
98 !editor.isGrid(n) &&
99 !editor.isVoid(n) &&
100 !editor.isInline(n)
101 ) {
102 return false
103 }
104
105 if (
106 mergeEnd &&
107 Path.isAncestor(p, lastPath) &&
108 Element.isElement(n) &&
109 !editor.isGrid(n) &&
110 !editor.isVoid(n) &&
111 !editor.isInline(n)
112 ) {
113 return false
114 }
115
116 return true
117 }
118
119 for (const entry of Node.nodes({ children: fragment }, { pass: matcher })) {
120 if (matcher(entry)) {

Callers 1

insertFragmentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…