UNPKG

3.31 kBTypeScriptView Raw
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 */
5import { Plugin } from 'ckeditor5/src/core.js';
6import { Delete } from 'ckeditor5/src/typing.js';
7/**
8 * Enables a set of predefined autoformatting actions.
9 *
10 * For a detailed overview, check the {@glink features/autoformat Autoformatting} feature guide
11 * and the {@glink api/autoformat package page}.
12 */
13export default class Autoformat extends Plugin {
14 /**
15 * @inheritDoc
16 */
17 static get requires(): readonly [typeof Delete];
18 /**
19 * @inheritDoc
20 */
21 static get pluginName(): "Autoformat";
22 /**
23 * @inheritDoc
24 */
25 afterInit(): void;
26 /**
27 * Adds autoformatting related to the {@link module:list/list~List}.
28 *
29 * When typed:
30 * - `* ` or `- ` – A paragraph will be changed into a bulleted list.
31 * - `1. ` or `1) ` – A paragraph will be changed into a numbered list ("1" can be any digit or a list of digits).
32 * - `[] ` or `[ ] ` – A paragraph will be changed into a to-do list.
33 * - `[x] ` or `[ x ] ` – A paragraph will be changed into a checked to-do list.
34 */
35 private _addListAutoformats;
36 /**
37 * Adds autoformatting related to the {@link module:basic-styles/bold~Bold},
38 * {@link module:basic-styles/italic~Italic}, {@link module:basic-styles/code~Code}
39 * and {@link module:basic-styles/strikethrough~Strikethrough}
40 *
41 * When typed:
42 * - `**foobar**` – `**` characters are removed and `foobar` is set to bold,
43 * - `__foobar__` – `__` characters are removed and `foobar` is set to bold,
44 * - `*foobar*` – `*` characters are removed and `foobar` is set to italic,
45 * - `_foobar_` – `_` characters are removed and `foobar` is set to italic,
46 * - ``` `foobar` – ``` ` ``` characters are removed and `foobar` is set to code,
47 * - `~~foobar~~` – `~~` characters are removed and `foobar` is set to strikethrough.
48 */
49 private _addBasicStylesAutoformats;
50 /**
51 * Adds autoformatting related to {@link module:heading/heading~Heading}.
52 *
53 * It is using a number at the end of the command name to associate it with the proper trigger:
54 *
55 * * `heading` with a `heading1` value will be executed when typing `#`,
56 * * `heading` with a `heading2` value will be executed when typing `##`,
57 * * ... up to `heading6` for `######`.
58 */
59 private _addHeadingAutoformats;
60 /**
61 * Adds autoformatting related to {@link module:block-quote/blockquote~BlockQuote}.
62 *
63 * When typed:
64 * * `> ` – A paragraph will be changed to a block quote.
65 */
66 private _addBlockQuoteAutoformats;
67 /**
68 * Adds autoformatting related to {@link module:code-block/codeblock~CodeBlock}.
69 *
70 * When typed:
71 * - `` ``` `` – A paragraph will be changed to a code block.
72 */
73 private _addCodeBlockAutoformats;
74 /**
75 * Adds autoformatting related to {@link module:horizontal-line/horizontalline~HorizontalLine}.
76 *
77 * When typed:
78 * - `` --- `` – Will be replaced with a horizontal line.
79 */
80 private _addHorizontalLineAutoformats;
81}