1 | import { Editor } from '@ckeditor/ckeditor5-core';
|
2 | import { DowncastWriter } from '@ckeditor/ckeditor5-engine';
|
3 | import Autoformat from './autoformat';
|
4 |
|
5 | /**
|
6 | * Enables autoformatting mechanism for a given {@link module:core/editor/editor~Editor}.
|
7 | *
|
8 | * It formats the matched text by applying the given model attribute or by running the provided formatting callback.
|
9 | * On every {@link module:engine/model/document~Document#event:change:data data change} in the model document
|
10 | * the autoformatting engine checks the text on the left of the selection
|
11 | * and executes the provided action if the text matches given criteria (regular expression or callback).
|
12 | */
|
13 | export default function inlineAutoformatEditing(
|
14 | editor: Editor,
|
15 | plugin: Autoformat,
|
16 | testRegexpOrCallback:
|
17 | | RegExp
|
18 | | ((text: string) => {
|
19 | remove: Array<[number, number]>;
|
20 | format: Array<[number, number]>;
|
21 | }),
|
22 | formatCallback: (writer: DowncastWriter, rangesToFormat: Range[]) => boolean | void,
|
23 | ): void;
|