UNPKG

@ckeditor/ckeditor5-ai

Version:

AI features for CKEditor 5.

36 lines (35 loc) 2.63 kB
/** * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options */ import { append, appendChild, find, findAll, findOne, getChildren, isComment, isTag, prepend, prependChild, removeElement, replaceElement, textContent, getParent, hasChildren } from 'domutils'; import render from 'dom-serializer'; import { cloneNode, isDocument, isText, Element, Text, type AnyNode, type ChildNode, type Comment, Document, NodeWithChildren, type ParentNode } from 'domhandler'; export { cloneNode, find, findOne, findAll, getChildren, getParent, isComment, isDocument, isTag, isText, append, appendChild, prepend, prependChild, render, removeElement, replaceElement, textContent, hasChildren, Element, Document, NodeWithChildren, Text }; export type { AnyNode, ParentNode, ChildNode }; export declare function parse(html: string): Document; export declare function serialize(document: Document | AnyNode): string; export declare function findByAttribute(name: string, value: string | null, nodes: Array<AnyNode> | ParentNode): ReturnType<typeof findOne>; export declare function findAllByAttribute(name: string, value: string | null, nodes: Array<AnyNode> | ParentNode): ReturnType<typeof findAll>; export declare function findAllComments(document: Document): Array<Comment>; export declare function getAttribute(node: AnyNode | null, name: string): string | null; export declare function setAttribute(node: AnyNode, name: string, value: string | null): void; export declare function insertElement(target: ParentNode | ChildNode, newElement: ParentNode | ChildNode, position: InsertPosition): void; export declare function moveElement(to: ParentNode, from: ParentNode): void; export declare function clone(node: Document): Document; export declare function getParents(node: AnyNode): Array<ParentNode>; export declare function normalizeHTML(html: string): string; export declare function areNodesSame(node1: ChildNode, node2: ChildNode): boolean; export declare function getNodeNestingLevel(node: ChildNode): number; export declare function removeElementsAfter(node: ChildNode): void; export declare function getNodePath(node: AnyNode): DocumentPath; /** * Represents a position in the HTML document as an array of numbers. * * Each number represents either: * - An index of an element among its siblings (for element nodes) * - A character position within a text node (for text nodes) * * Example: [0, 1, 2] means the third child of the second child of the first element. */ export type DocumentPath = ReadonlyArray<number>;