MCPcopy
hub / github.com/tinymce/tinymce / insertAfter

Function insertAfter

modules/tinymce/src/core/main/ts/api/dom/DOMUtils.ts:865–882  ·  view source on GitHub ↗
(node: RunArguments<T>, reference: string | Node)

Source from the content-addressed store, hash-verified

863 };
864
865 const insertAfter = <T extends Node>(node: RunArguments<T>, reference: string | Node): RunResult<typeof node, T> => {
866 const referenceNode = get(reference);
867
868 return run(node, (node) => {
869 const parent = referenceNode?.parentNode;
870 const nextSibling = referenceNode?.nextSibling;
871
872 if (parent) {
873 if (nextSibling) {
874 parent.insertBefore(node, nextSibling);
875 } else {
876 parent.appendChild(node);
877 }
878 }
879
880 return node;
881 });
882 };
883
884 const replace = <T extends Node>(newElm: Node, oldElm: RunArguments<T>, keepChildren?: boolean) => run<T, T>(oldElm, (elm) => {
885 const replacee = Type.isArray(oldElm) ? newElm.cloneNode(true) : newElm;

Callers

nothing calls this directly

Calls 2

getFunction · 0.70
runFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…