@ckeditor/ckeditor5-autoformat 48.2.0-alpha.7 → 48.3.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- import type { Autoformat } from './index.js';
6
- declare module '@ckeditor/ckeditor5-core' {
7
- interface PluginsMap {
8
- [Autoformat.pluginName]: Autoformat;
9
- }
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ import type { Autoformat } from "./index.js";
6
+ declare module "@ckeditor/ckeditor5-core" {
7
+ interface PluginsMap {
8
+ [Autoformat.pluginName]: Autoformat;
9
+ }
10
10
  }
@@ -1,88 +1,88 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- import { Plugin } from '@ckeditor/ckeditor5-core';
6
- import { Delete } from '@ckeditor/ckeditor5-typing';
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ import { Plugin, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
6
+ import { Delete } from "@ckeditor/ckeditor5-typing";
7
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
- */
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
+ */
13
13
  export declare 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
- static get isOfficialPlugin(): true;
26
- /**
27
- * @inheritDoc
28
- */
29
- afterInit(): void;
30
- /**
31
- * Adds autoformatting related to the {@link module:list/list~List}.
32
- *
33
- * When typed:
34
- * - `* ` or `- ` – A paragraph will be changed into a bulleted list.
35
- * - `<number>. ` or `<number>) ` &ndash; A paragraph will be changed into a numbered list.
36
- * If the paragraph is adjacent to an existing list, the typed number is ignored and the item joins the list
37
- * as the next sequential item. Otherwise, a new list is created with the `listStart` attribute set to the typed number
38
- * (when the {@link module:list/listproperties~ListProperties start index feature} is enabled).
39
- * - `[] ` or `[ ] ` &ndash; A paragraph will be changed into a to-do list.
40
- * - `[x] ` or `[ x ] ` &ndash; A paragraph will be changed into a checked to-do list.
41
- */
42
- private _addListAutoformats;
43
- /**
44
- * Adds autoformatting related to the {@link module:basic-styles/bold~Bold},
45
- * {@link module:basic-styles/italic~Italic}, {@link module:basic-styles/code~Code}
46
- * and {@link module:basic-styles/strikethrough~Strikethrough}
47
- *
48
- * When typed:
49
- * - `**foobar**` &ndash; `**` characters are removed and `foobar` is set to bold,
50
- * - `__foobar__` &ndash; `__` characters are removed and `foobar` is set to bold,
51
- * - `*foobar*` &ndash; `*` characters are removed and `foobar` is set to italic,
52
- * - `_foobar_` &ndash; `_` characters are removed and `foobar` is set to italic,
53
- * - ``` `foobar` &ndash; ``` ` ``` characters are removed and `foobar` is set to code,
54
- * - `~~foobar~~` &ndash; `~~` characters are removed and `foobar` is set to strikethrough.
55
- */
56
- private _addBasicStylesAutoformats;
57
- /**
58
- * Adds autoformatting related to {@link module:heading/heading~Heading}.
59
- *
60
- * It is using a number at the end of the command name to associate it with the proper trigger:
61
- *
62
- * * `heading` with a `heading1` value will be executed when typing `#`,
63
- * * `heading` with a `heading2` value will be executed when typing `##`,
64
- * * ... up to `heading6` for `######`.
65
- */
66
- private _addHeadingAutoformats;
67
- /**
68
- * Adds autoformatting related to {@link module:block-quote/blockquote~BlockQuote}.
69
- *
70
- * When typed:
71
- * * `> ` &ndash; A paragraph will be changed to a block quote.
72
- */
73
- private _addBlockQuoteAutoformats;
74
- /**
75
- * Adds autoformatting related to {@link module:code-block/codeblock~CodeBlock}.
76
- *
77
- * When typed:
78
- * - `` ``` `` &ndash; A paragraph will be changed to a code block.
79
- */
80
- private _addCodeBlockAutoformats;
81
- /**
82
- * Adds autoformatting related to {@link module:horizontal-line/horizontalline~HorizontalLine}.
83
- *
84
- * When typed:
85
- * - `` --- `` &ndash; Will be replaced with a horizontal line.
86
- */
87
- private _addHorizontalLineAutoformats;
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ static get requires(): PluginDependenciesOf<[Delete]>;
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ static get pluginName(): "Autoformat";
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ static override get isOfficialPlugin(): true;
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ afterInit(): void;
30
+ /**
31
+ * Adds autoformatting related to the {@link module:list/list~List}.
32
+ *
33
+ * When typed:
34
+ * - `* ` or `- ` &ndash; A paragraph will be changed into a bulleted list.
35
+ * - `<number>. ` or `<number>) ` &ndash; A paragraph will be changed into a numbered list.
36
+ * If the paragraph is adjacent to an existing list, the typed number is ignored and the item joins the list
37
+ * as the next sequential item. Otherwise, a new list is created with the `listStart` attribute set to the typed number
38
+ * (when the {@link module:list/listproperties~ListProperties start index feature} is enabled).
39
+ * - `[] ` or `[ ] ` &ndash; A paragraph will be changed into a to-do list.
40
+ * - `[x] ` or `[ x ] ` &ndash; A paragraph will be changed into a checked to-do list.
41
+ */
42
+ private _addListAutoformats;
43
+ /**
44
+ * Adds autoformatting related to the {@link module:basic-styles/bold~Bold},
45
+ * {@link module:basic-styles/italic~Italic}, {@link module:basic-styles/code~Code}
46
+ * and {@link module:basic-styles/strikethrough~Strikethrough}
47
+ *
48
+ * When typed:
49
+ * - `**foobar**` &ndash; `**` characters are removed and `foobar` is set to bold,
50
+ * - `__foobar__` &ndash; `__` characters are removed and `foobar` is set to bold,
51
+ * - `*foobar*` &ndash; `*` characters are removed and `foobar` is set to italic,
52
+ * - `_foobar_` &ndash; `_` characters are removed and `foobar` is set to italic,
53
+ * - ``` `foobar` &ndash; ``` ` ``` characters are removed and `foobar` is set to code,
54
+ * - `~~foobar~~` &ndash; `~~` characters are removed and `foobar` is set to strikethrough.
55
+ */
56
+ private _addBasicStylesAutoformats;
57
+ /**
58
+ * Adds autoformatting related to {@link module:heading/heading~Heading}.
59
+ *
60
+ * It is using a number at the end of the command name to associate it with the proper trigger:
61
+ *
62
+ * * `heading` with a `heading1` value will be executed when typing `#`,
63
+ * * `heading` with a `heading2` value will be executed when typing `##`,
64
+ * * ... up to `heading6` for `######`.
65
+ */
66
+ private _addHeadingAutoformats;
67
+ /**
68
+ * Adds autoformatting related to {@link module:block-quote/blockquote~BlockQuote}.
69
+ *
70
+ * When typed:
71
+ * * `> ` &ndash; A paragraph will be changed to a block quote.
72
+ */
73
+ private _addBlockQuoteAutoformats;
74
+ /**
75
+ * Adds autoformatting related to {@link module:code-block/codeblock~CodeBlock}.
76
+ *
77
+ * When typed:
78
+ * - `` ``` `` &ndash; A paragraph will be changed to a code block.
79
+ */
80
+ private _addCodeBlockAutoformats;
81
+ /**
82
+ * Adds autoformatting related to {@link module:horizontal-line/horizontalline~HorizontalLine}.
83
+ *
84
+ * When typed:
85
+ * - `` --- `` &ndash; Will be replaced with a horizontal line.
86
+ */
87
+ private _addHorizontalLineAutoformats;
88
88
  }
@@ -1,57 +1,57 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * The block autoformatting engine. It allows to format various block patterns. For example,
7
- * it can be configured to turn a paragraph starting with `*` and followed by a space into a list item.
8
- *
9
- * The autoformatting operation is integrated with the undo manager,
10
- * so the autoformatting step can be undone if the user's intention was not to format the text.
11
- *
12
- * See the {@link module:autoformat/blockautoformatediting~blockAutoformatEditing `blockAutoformatEditing`} documentation
13
- * to learn how to create custom block autoformatters. You can also use
14
- * the {@link module:autoformat/autoformat~Autoformat} feature which enables a set of default autoformatters
15
- * (lists, headings, bold and italic).
16
- *
17
- * @module autoformat/blockautoformatediting
18
- */
19
- import type { Editor } from '@ckeditor/ckeditor5-core';
20
- import { type Autoformat } from './autoformat.js';
6
+ * The block autoformatting engine. It allows to format various block patterns. For example,
7
+ * it can be configured to turn a paragraph starting with `*` and followed by a space into a list item.
8
+ *
9
+ * The autoformatting operation is integrated with the undo manager,
10
+ * so the autoformatting step can be undone if the user's intention was not to format the text.
11
+ *
12
+ * See the {@link module:autoformat/blockautoformatediting~blockAutoformatEditing `blockAutoformatEditing`} documentation
13
+ * to learn how to create custom block autoformatters. You can also use
14
+ * the {@link module:autoformat/autoformat~Autoformat} feature which enables a set of default autoformatters
15
+ * (lists, headings, bold and italic).
16
+ *
17
+ * @module autoformat/blockautoformatediting
18
+ */
19
+ import type { Editor } from "@ckeditor/ckeditor5-core";
20
+ import { type Autoformat } from "./autoformat.js";
21
21
  /**
22
- * Creates a listener triggered on {@link module:engine/model/document~ModelDocument#event:change:data `change:data`} event in the document.
23
- * Calls the callback when inserted text matches the regular expression or the command name
24
- * if provided instead of the callback.
25
- *
26
- * Examples of usage:
27
- *
28
- * To convert a paragraph into heading 1 when `- ` is typed, using just the command name:
29
- *
30
- * ```ts
31
- * blockAutoformatEditing( editor, plugin, /^\- $/, 'heading1' );
32
- * ```
33
- *
34
- * To convert a paragraph into heading 1 when `- ` is typed, using just the callback:
35
- *
36
- * ```ts
37
- * blockAutoformatEditing( editor, plugin, /^\- $/, ( context ) => {
38
- * const { match } = context;
39
- * const headingLevel = match[ 1 ].length;
40
- *
41
- * editor.execute( 'heading', {
42
- * formatId: `heading${ headingLevel }`
43
- * } );
44
- * } );
45
- * ```
46
- *
47
- * @param editor The editor instance.
48
- * @param plugin The autoformat plugin instance.
49
- * @param pattern The regular expression to execute on just inserted text. The regular expression is tested against the text
50
- * from the beginning until the caret position.
51
- * @param callbackOrCommand The callback to execute or the command to run when the text is matched.
52
- * In case of providing the callback, it receives the following parameter:
53
- * * match RegExp.exec() result of matching the pattern to inserted text.
54
- */
22
+ * Creates a listener triggered on {@link module:engine/model/document~ModelDocument#event:change:data `change:data`} event in the document.
23
+ * Calls the callback when inserted text matches the regular expression or the command name
24
+ * if provided instead of the callback.
25
+ *
26
+ * Examples of usage:
27
+ *
28
+ * To convert a paragraph into heading 1 when `- ` is typed, using just the command name:
29
+ *
30
+ * ```ts
31
+ * blockAutoformatEditing( editor, plugin, /^\- $/, 'heading1' );
32
+ * ```
33
+ *
34
+ * To convert a paragraph into heading 1 when `- ` is typed, using just the callback:
35
+ *
36
+ * ```ts
37
+ * blockAutoformatEditing( editor, plugin, /^\- $/, ( context ) => {
38
+ * const { match } = context;
39
+ * const headingLevel = match[ 1 ].length;
40
+ *
41
+ * editor.execute( 'heading', {
42
+ * formatId: `heading${ headingLevel }`
43
+ * } );
44
+ * } );
45
+ * ```
46
+ *
47
+ * @param editor The editor instance.
48
+ * @param plugin The autoformat plugin instance.
49
+ * @param pattern The regular expression to execute on just inserted text. The regular expression is tested against the text
50
+ * from the beginning until the caret position.
51
+ * @param callbackOrCommand The callback to execute or the command to run when the text is matched.
52
+ * In case of providing the callback, it receives the following parameter:
53
+ * * match RegExp.exec() result of matching the pattern to inserted text.
54
+ */
55
55
  export declare function blockAutoformatEditing(editor: Editor, plugin: Autoformat, pattern: RegExp, callbackOrCommand: string | ((context: {
56
- match: RegExpExecArray;
56
+ match: RegExpExecArray;
57
57
  }) => unknown)): void;
@@ -2,3 +2,4 @@
2
2
  * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
+
@@ -2,3 +2,4 @@
2
2
  * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
+
package/dist/index.css CHANGED
@@ -3,5 +3,3 @@
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
 
6
-
7
- /*# sourceMappingURL=index.css.map */
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module autoformat
7
- */
8
- export { Autoformat } from './autoformat.js';
9
- export { blockAutoformatEditing } from './blockautoformatediting.js';
10
- export { inlineAutoformatEditing, type AutoformatTestCallback } from './inlineautoformatediting.js';
11
- import './augmentation.js';
6
+ * @module autoformat
7
+ */
8
+ export { Autoformat } from "./autoformat.js";
9
+ export { blockAutoformatEditing } from "./blockautoformatediting.js";
10
+ export { inlineAutoformatEditing, type AutoformatTestCallback } from "./inlineautoformatediting.js";
11
+ import "./augmentation.js";