UNPKG

1.95 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 '@ckeditor/ckeditor5-core';
6/**
7 * The paragraph feature for the editor.
8 *
9 * It introduces the `<paragraph>` element in the model which renders as a `<p>` element in the DOM and data.
10 *
11 * It also brings two editors commands:
12 *
13 * * The {@link module:paragraph/paragraphcommand~ParagraphCommand `'paragraph'`} command that converts all
14 * blocks in the model selection into paragraphs.
15 * * The {@link module:paragraph/insertparagraphcommand~InsertParagraphCommand `'insertParagraph'`} command
16 * that inserts a new paragraph at a specified location in the model.
17 */
18export default class Paragraph extends Plugin {
19 /**
20 * @inheritDoc
21 */
22 static get pluginName(): "Paragraph";
23 /**
24 * @inheritDoc
25 */
26 init(): void;
27 /**
28 * A list of element names which should be treated by the autoparagraphing algorithms as
29 * paragraph-like. This means that e.g. the following content:
30 *
31 * ```html
32 * <h1>Foo</h1>
33 * <table>
34 * <tr>
35 * <td>X</td>
36 * <td>
37 * <ul>
38 * <li>Y</li>
39 * <li>Z</li>
40 * </ul>
41 * </td>
42 * </tr>
43 * </table>
44 * ```
45 *
46 * contains five paragraph-like elements: `<h1>`, two `<td>`s and two `<li>`s.
47 * Hence, if none of the features is going to convert those elements the above content will be automatically handled
48 * by the paragraph feature and converted to:
49 *
50 * ```html
51 * <p>Foo</p>
52 * <p>X</p>
53 * <p>Y</p>
54 * <p>Z</p>
55 * ```
56 *
57 * Note: The `<td>` containing two `<li>` elements was ignored as the innermost paragraph-like elements
58 * have a priority upon conversion.
59 */
60 static paragraphLikeElements: Set<string>;
61}