UNPKG

2.91 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 */
5/**
6 * @module list/legacylistproperties/legacylistpropertiesediting
7 */
8import { Plugin, type Editor } from 'ckeditor5/src/core.js';
9import LegacyListEditing from '../legacylist/legacylistediting.js';
10/**
11 * The engine of the list properties feature.
12 *
13 * It sets the value for the `listItem` attribute of the {@link module:list/legacylist~LegacyList `<listItem>`} element that
14 * allows modifying the list style type.
15 *
16 * It registers the `'listStyle'`, `'listReversed'` and `'listStart'` commands if they are enabled in the configuration.
17 * Read more in {@link module:list/listconfig~ListPropertiesConfig}.
18 */
19export default class LegacyListPropertiesEditing extends Plugin {
20 /**
21 * @inheritDoc
22 */
23 static get requires(): readonly [typeof LegacyListEditing];
24 /**
25 * @inheritDoc
26 */
27 static get pluginName(): "LegacyListPropertiesEditing";
28 /**
29 * @inheritDoc
30 */
31 constructor(editor: Editor);
32 /**
33 * @inheritDoc
34 */
35 init(): void;
36 /**
37 * @inheritDoc
38 */
39 afterInit(): void;
40 /**
41 * Starts listening to {@link module:engine/model/model~Model#deleteContent} and checks whether two lists will be merged into a single
42 * one after deleting the content.
43 *
44 * The purpose of this action is to adjust the `listStyle`, `listReversed` and `listStart` values
45 * for the list that was merged.
46 *
47 * Consider the following model's content:
48 *
49 * ```xml
50 * <listItem listIndent="0" listType="bulleted" listStyle="square">UL List item 1</listItem>
51 * <listItem listIndent="0" listType="bulleted" listStyle="square">UL List item 2</listItem>
52 * <paragraph>[A paragraph.]</paragraph>
53 * <listItem listIndent="0" listType="bulleted" listStyle="circle">UL List item 1</listItem>
54 * <listItem listIndent="0" listType="bulleted" listStyle="circle">UL List item 2</listItem>
55 * ```
56 *
57 * After removing the paragraph element, the second list will be merged into the first one.
58 * We want to inherit the `listStyle` attribute for the second list from the first one.
59 *
60 * ```xml
61 * <listItem listIndent="0" listType="bulleted" listStyle="square">UL List item 1</listItem>
62 * <listItem listIndent="0" listType="bulleted" listStyle="square">UL List item 2</listItem>
63 * <listItem listIndent="0" listType="bulleted" listStyle="square">UL List item 1</listItem>
64 * <listItem listIndent="0" listType="bulleted" listStyle="square">UL List item 2</listItem>
65 * ```
66 *
67 * See https://github.com/ckeditor/ckeditor5/issues/7879.
68 *
69 * @param attributeStrategies Strategies for the enabled attributes.
70 */
71 private _mergeListAttributesWhileMergingLists;
72}