NEWCKEditor AI on your premises: Hook your LLM and register MCP tools. Webinar coming soon!
Sign up (with export icon)

core/editor/utils/normalizerootsconfig

Api-module iconmodule

Functions

  • Chevron-right icon

    normalizeMultiRootEditorConstructorParams( sourceElementOrDataOrConfig, editorConfig ) → object
    internal

    Normalizes the parameters passed to the editor constructor when a multi root is used. It supports both of the following signatures:

    new Editor( editorConfig: EditorConfig );
    new Editor( sourceElementsOrData: Record<string, string> | Record<string, HTMLElement>, editorConfig: EditorConfig );
    
    Copy code

    Parameters

    sourceElementOrDataOrConfig : Record<string, string> | Record<string, HTMLElement>
    editorConfig : EditorConfig

    Returns

    object
  • Chevron-right icon

    normalizeRootsConfig( sourceElementsOrData, config, defaultRootName, separateAttachTo ) → void
    internal

    Normalizes the editor roots configuration. It ensures that all root configurations are defined in config.roots and that they have initialData defined.

    It normalizes a single-root configuration (where config.root is used) to a multi-root configuration (where all roots are defined in config.roots). This is considered a standard configuration format, so the editor features can always expect roots to be defined in config.roots.

    It also handles legacy configuration options, such as config.initialData, config.placeholder, and config.label.

    Parameters

    sourceElementsOrData : string | HTMLElement | Record<string, string> | Record<string, HTMLElement>
    config : Config<EditorConfig>
    defaultRootName : string | false

    Defaults to 'main'

    separateAttachTo : boolean

    Defaults to false

    Returns

    void
  • Chevron-right icon

    normalizeSingleRootEditorConstructorParams( sourceElementOrDataOrConfig, editorConfig ) → object
    internal

    Normalizes the parameters passed to the editor constructor when a single root is used. It supports both of the following signatures:

    new Editor( editorConfig: EditorConfig );
    new Editor( sourceElementOrData: HTMLElement | string, editorConfig: EditorConfig );
    
    Copy code

    Parameters

    sourceElementOrDataOrConfig : string | HTMLElement | EditorConfig
    editorConfig : EditorConfig

    Returns

    object