CoreMedia CKEditor 5 Plugins
    Preparing search index...

    Type Alias ImportedFunction

    ImportedFunction: (
        node: Node,
        context: ConversionContext,
    ) => Node | Skip | undefined

    Provides the possibility to handle a just imported node. The node is neither attached to DOM, nor children are available.

    Implementation Notes:

    • Just exchanging one node with another of a similar (high-level) type is considered harmless. Thus, if an element becomes an element, this is in general safe despite possible implications towards a document valid by schema. Such invalid states may be fixed in later processing, though.

    • In general, it is not recommended to exchange a ParentNode with some node that may not hold any children at this stage, as children will not be handled at all. Better do so in later processing.

    • You may expand a given node to a set of nodes by returning a DocumentFragment instead. Note, though, that in this stage subsequent child nodes will be appended to this DocumentFragment which may be unexpected. In general, such expansion should be done at a later stage.

    • To ignore this node, but still process the children, you may return an empty DocumentFragment instead.

    • To skip all further processing of this node (and not child nodes, as they have not been handled yet), you may signal this by providing the skip signal.

    • If you want to replace, for example, an element by just some character data, it is recommended to do this in later processing when the children have been processed. Otherwise, ensure you understand possible implications of doing this in this early stage, such as that children not being converted to CharacterData are ignored, and that CharacterData are just appended without taking the actual type of data into account.

    • When transforming from HTML to XML, you may experience a rather limited API for importedNode compared to the original node. Like in XML, there is no HTMLElement.dataset. Dealing with this richer API is best done in the setup phase by overriding prepareForImport. Here you may modify the DOM with some restrictions to ease further processing.

    Type Declaration

      • (node: Node, context: ConversionContext): Node | Skip | undefined
      • Parameters

        Returns Node | Skip | undefined

        the node to continue with in further processing or a signal what to do instead