MCPcopy Index your code
hub / github.com/tinymce/tinymce / context

Function context

modules/tinymce/src/core/main/ts/annotate/AnnotationContext.ts:42–62  ·  view source on GitHub ↗
(editor: Editor, elem: SugarElement<Node>, wrapName: string, nodeName: string)

Source from the content-addressed store, hash-verified

40 SugarNode.isText(elem) && SugarText.get(elem) === ZWSP;
41
42const context = (editor: Editor, elem: SugarElement<Node>, wrapName: string, nodeName: string): ChildContext => Traverse.parentElement(elem).fold(
43 () => ChildContext.Skipping,
44
45 (parent) => {
46 // We used to skip these, but given that they might be representing empty paragraphs, it probably
47 // makes sense to treat them just like text nodes
48 if (nodeName === 'br' || isZeroWidth(elem)) {
49 return ChildContext.Valid;
50 } else if (isAnnotation(elem)) {
51 return ChildContext.Existing;
52 } else if (isCaretNode(elem.dom)) {
53 return ChildContext.Caret;
54 } else if (Arr.exists(validBlocks, (selector) => Selectors.is(elem, selector))) {
55 return ChildContext.ValidBlock;
56 } else if (!FormatUtils.isValid(editor, wrapName, nodeName) || !FormatUtils.isValid(editor, SugarNode.name(parent), wrapName)) {
57 return ChildContext.InvalidChild;
58 } else {
59 return ChildContext.Valid;
60 }
61 }
62);
63
64export {
65 context

Callers 15

processElementFunction · 0.90
PathPatternTest.tsFile · 0.50
RegexesTest.tsFile · 0.50
UrlTest.tsFile · 0.50
TableSizeTest.tsFile · 0.50
TypeTest.tsFile · 0.50
TransitionsTest.tsFile · 0.50
ForceBlocksTest.tsFile · 0.50

Calls 6

isAnnotationFunction · 0.90
isCaretNodeFunction · 0.90
isZeroWidthFunction · 0.85
foldMethod · 0.80
existsMethod · 0.80
isMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…