1 | /**
|
2 | * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3 | * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4 | */
|
5 | /**
|
6 | * @module core/editor/utils/elementapimixin
|
7 | */
|
8 | import { type Constructor, type Mixed } from '@ckeditor/ckeditor5-utils';
|
9 | import type Editor from '../editor.js';
|
10 | /**
|
11 | * Implementation of the {@link module:core/editor/utils/elementapimixin~ElementApi}.
|
12 | */
|
13 | export default function ElementApiMixin<Base extends Constructor<Editor>>(base: Base): Mixed<Base, ElementApi>;
|
14 | /**
|
15 | * Interface describing an editor that replaced a DOM element (was "initialized on an element").
|
16 | *
|
17 | * Such an editor should provide a method to
|
18 | * {@link module:core/editor/utils/elementapimixin~ElementApi#updateSourceElement update the replaced element with the current data}.
|
19 | */
|
20 | export interface ElementApi {
|
21 | /**
|
22 | * The element on which the editor has been initialized.
|
23 | *
|
24 | * @readonly
|
25 | */
|
26 | sourceElement: HTMLElement | undefined;
|
27 | /**
|
28 | * Updates the {@link #sourceElement editor source element}'s content with the data if the
|
29 | * {@link module:core/editor/editorconfig~EditorConfig#updateSourceElementOnDestroy `updateSourceElementOnDestroy`}
|
30 | * configuration option is set to `true`.
|
31 | *
|
32 | * @param data Data that the {@link #sourceElement editor source element} should be updated with.
|
33 | */
|
34 | updateSourceElement(data?: string): void;
|
35 | }
|