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 | * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7 | * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8 | */
|
9 | /**
|
10 | * @module paste-from-office/normalizer
|
11 | */
|
12 | import type { ClipboardInputTransformationData } from 'ckeditor5/src/clipboard.js';
|
13 | import type { ParseHtmlResult } from './filters/parse.js';
|
14 | /**
|
15 | * Interface defining a content transformation pasted from an external editor.
|
16 | *
|
17 | * Normalizers are registered by the {@link module:paste-from-office/pastefromoffice~PasteFromOffice} plugin and run on
|
18 | * {@link module:clipboard/clipboardpipeline~ClipboardPipeline#event:inputTransformation inputTransformation event}.
|
19 | * They detect environment-specific quirks and transform it into a form compatible with other CKEditor features.
|
20 | */
|
21 | export interface Normalizer {
|
22 | /**
|
23 | * Must return `true` if the `htmlString` contains content which this normalizer can transform.
|
24 | */
|
25 | isActive(htmlString: string): boolean;
|
26 | /**
|
27 | * Executes the normalization of a given data.
|
28 | */
|
29 | execute(data: NormalizerData): void;
|
30 | }
|
31 | export interface NormalizerData extends ClipboardInputTransformationData {
|
32 | _isTransformedWithPasteFromOffice?: boolean;
|
33 | _parsedData: ParseHtmlResult;
|
34 | }
|