UNPKG

@ckeditor/ckeditor5-core

Version:

The core architecture of CKEditor 5 – the best browser-based rich text editor.

51 lines (50 loc) 2.4 kB
/** * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options */ /** * @module core/editor/utils/normalizerootsconfig */ import type { EditorConfig } from '../editorconfig.js'; import { type Config } from '@ckeditor/ckeditor5-utils'; /** * 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`. * * @internal */ export declare function normalizeRootsConfig(sourceElementsOrData: HTMLElement | string | Record<string, HTMLElement> | Record<string, string>, config: Config<EditorConfig>, defaultRootName?: string | false, separateAttachTo?: boolean): void; /** * Normalizes the parameters passed to the editor constructor when a single root is used. It supports both of the following signatures: * * ```ts * new Editor( editorConfig: EditorConfig ); * new Editor( sourceElementOrData: HTMLElement | string, editorConfig: EditorConfig ); * ``` * * @internal */ export declare function normalizeSingleRootEditorConstructorParams(sourceElementOrDataOrConfig: HTMLElement | string | EditorConfig, editorConfig: EditorConfig): { sourceElementOrData: HTMLElement | string; editorConfig: EditorConfig; }; /** * Normalizes the parameters passed to the editor constructor when a multi root is used. It supports both of the following signatures: * * ```ts * new Editor( editorConfig: EditorConfig ); * new Editor( sourceElementsOrData: Record<string, string> | Record<string, HTMLElement>, editorConfig: EditorConfig ); * ``` * * @internal */ export declare function normalizeMultiRootEditorConstructorParams(sourceElementOrDataOrConfig: Record<string, string> | Record<string, HTMLElement>, editorConfig: EditorConfig): { sourceElementsOrData: Record<string, string> | Record<string, HTMLElement>; editorConfig: EditorConfig; };