@ckeditor/ckeditor5-track-changes 38.1.1 → 38.2.0-alpha.1
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.
- package/build/track-changes.js +2 -2
- package/package.json +4 -3
- package/src/augmentation.d.ts +36 -36
- package/src/commands/acceptsuggestioncommand.d.ts +20 -20
- package/src/commands/acceptsuggestioncommand.js +1 -1
- package/src/commands/discardsuggestioncommand.d.ts +20 -20
- package/src/commands/discardsuggestioncommand.js +1 -1
- package/src/commands/executeonallsuggestionscommand.d.ts +20 -20
- package/src/commands/executeonallsuggestionscommand.js +1 -1
- package/src/commands/executeonselectedsuggestionscommand.d.ts +20 -20
- package/src/commands/executeonselectedsuggestionscommand.js +1 -1
- package/src/commands/trackchangescommand.d.ts +22 -22
- package/src/commands/trackchangescommand.js +1 -1
- package/src/index.d.ts +12 -12
- package/src/index.js +1 -1
- package/src/integrations/alignment.d.ts +13 -13
- package/src/integrations/alignment.js +1 -1
- package/src/integrations/basicstyles.d.ts +13 -13
- package/src/integrations/basicstyles.js +1 -1
- package/src/integrations/blockquote.d.ts +13 -13
- package/src/integrations/blockquote.js +1 -1
- package/src/integrations/ckbox.d.ts +13 -13
- package/src/integrations/ckbox.js +1 -1
- package/src/integrations/codeblock.d.ts +13 -13
- package/src/integrations/codeblock.js +1 -1
- package/src/integrations/comments.d.ts +10 -10
- package/src/integrations/comments.js +1 -1
- package/src/integrations/deletecommand.d.ts +13 -13
- package/src/integrations/deletecommand.js +1 -1
- package/src/integrations/documentlist.d.ts +13 -13
- package/src/integrations/documentlist.js +1 -1
- package/src/integrations/documentlistproperties.d.ts +25 -25
- package/src/integrations/documentlistproperties.js +1 -1
- package/src/integrations/entercommand.d.ts +12 -12
- package/src/integrations/entercommand.js +1 -1
- package/src/integrations/findandreplace.d.ts +17 -17
- package/src/integrations/findandreplace.js +1 -1
- package/src/integrations/font.d.ts +13 -13
- package/src/integrations/font.js +1 -1
- package/src/integrations/formatpainter.d.ts +13 -13
- package/src/integrations/formatpainter.js +1 -1
- package/src/integrations/heading.d.ts +13 -13
- package/src/integrations/heading.js +1 -1
- package/src/integrations/highlight.d.ts +13 -13
- package/src/integrations/highlight.js +1 -1
- package/src/integrations/horizontalline.d.ts +13 -13
- package/src/integrations/horizontalline.js +1 -1
- package/src/integrations/htmlembed.d.ts +13 -13
- package/src/integrations/htmlembed.js +1 -1
- package/src/integrations/image.d.ts +13 -13
- package/src/integrations/image.js +1 -1
- package/src/integrations/imagereplace.d.ts +19 -19
- package/src/integrations/imagereplace.js +1 -1
- package/src/integrations/importword.d.ts +14 -14
- package/src/integrations/importword.js +1 -1
- package/src/integrations/indent.d.ts +13 -13
- package/src/integrations/indent.js +1 -1
- package/src/integrations/inputcommand.d.ts +12 -12
- package/src/integrations/inputcommand.js +1 -1
- package/src/integrations/link.d.ts +13 -13
- package/src/integrations/link.js +1 -1
- package/src/integrations/list.d.ts +13 -13
- package/src/integrations/list.js +1 -1
- package/src/integrations/listproperties.d.ts +25 -25
- package/src/integrations/listproperties.js +1 -1
- package/src/integrations/mediaembed.d.ts +13 -13
- package/src/integrations/mediaembed.js +1 -1
- package/src/integrations/mention.d.ts +13 -13
- package/src/integrations/mention.js +1 -1
- package/src/integrations/pagebreak.d.ts +13 -13
- package/src/integrations/pagebreak.js +1 -1
- package/src/integrations/paragraph.d.ts +13 -13
- package/src/integrations/paragraph.js +1 -1
- package/src/integrations/removeformat.d.ts +13 -13
- package/src/integrations/removeformat.js +1 -1
- package/src/integrations/restrictededitingmode.d.ts +13 -13
- package/src/integrations/restrictededitingmode.js +1 -1
- package/src/integrations/shiftentercommand.d.ts +12 -12
- package/src/integrations/shiftentercommand.js +1 -1
- package/src/integrations/standardeditingmode.d.ts +13 -13
- package/src/integrations/standardeditingmode.js +1 -1
- package/src/integrations/style.d.ts +14 -14
- package/src/integrations/style.js +1 -1
- package/src/integrations/table.d.ts +38 -38
- package/src/integrations/table.js +1 -1
- package/src/integrations/tablecaption.d.ts +18 -18
- package/src/integrations/tablecaption.js +1 -1
- package/src/integrations/tableclipboard.d.ts +18 -18
- package/src/integrations/tableclipboard.js +1 -1
- package/src/integrations/tablecolumnresize.d.ts +22 -22
- package/src/integrations/tablecolumnresize.js +1 -1
- package/src/integrations/tableheadings.d.ts +18 -18
- package/src/integrations/tableheadings.js +1 -1
- package/src/integrations/tablemergesplit.d.ts +18 -18
- package/src/integrations/tablemergesplit.js +1 -1
- package/src/integrations/tableofcontents.d.ts +13 -13
- package/src/integrations/tableofcontents.js +1 -1
- package/src/integrations/tableproperties.d.ts +23 -23
- package/src/integrations/tableproperties.js +1 -1
- package/src/integrations/template.d.ts +13 -13
- package/src/integrations/template.js +1 -1
- package/src/integrations/title.d.ts +13 -13
- package/src/integrations/title.js +1 -1
- package/src/integrations/undo.d.ts +13 -13
- package/src/integrations/undo.js +1 -1
- package/src/integrations/utils.d.ts +17 -17
- package/src/integrations/utils.js +1 -1
- package/src/suggestion.d.ts +266 -266
- package/src/suggestion.js +1 -1
- package/src/suggestiondescriptionfactory.d.ts +163 -151
- package/src/suggestiondescriptionfactory.js +1 -1
- package/src/trackchanges.d.ts +240 -240
- package/src/trackchanges.js +1 -1
- package/src/trackchangesconfig.d.ts +71 -71
- package/src/trackchangesdata.d.ts +37 -37
- package/src/trackchangesdata.js +1 -1
- package/src/trackchangesediting.d.ts +435 -435
- package/src/trackchangesediting.js +1 -1
- package/src/trackchangesui.d.ts +34 -34
- package/src/trackchangesui.js +1 -1
- package/src/ui/suggestioncontroller.d.ts +36 -36
- package/src/ui/suggestioncontroller.js +1 -1
- package/src/ui/view/basesuggestionthreadview.d.ts +166 -166
- package/src/ui/view/basesuggestionthreadview.js +1 -1
- package/src/ui/view/suggestionthreadview.d.ts +182 -182
- package/src/ui/view/suggestionthreadview.js +1 -1
- package/src/utils/common-translations.d.ts +5 -5
- package/src/utils/common-translations.js +1 -1
- package/src/utils/utils.d.ts +26 -26
- package/src/utils/utils.js +1 -1
|
@@ -1,151 +1,163 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module track-changes/suggestiondescriptionfactory
|
|
3
|
-
* @publicApi
|
|
4
|
-
*/
|
|
5
|
-
import { type Locale, type PriorityString } from 'ckeditor5/src/utils';
|
|
6
|
-
import type { Schema, Element } from 'ckeditor5/src/engine';
|
|
7
|
-
import type Suggestion from './suggestion';
|
|
8
|
-
/**
|
|
9
|
-
* Creates descriptions for suggestion chains.
|
|
10
|
-
*
|
|
11
|
-
* One or more suggestions that are next to each other create "suggestion chain". In such chain one suggestion may
|
|
12
|
-
* impact other suggestion when it comes to the description of the whole chain. For example, insertion next to deletion
|
|
13
|
-
* results in "Replaced" description.
|
|
14
|
-
*/
|
|
15
|
-
export default class SuggestionDescriptionFactory {
|
|
16
|
-
constructor(schema: Schema, locale: Locale);
|
|
17
|
-
/**
|
|
18
|
-
* Returns descriptions for given suggestion chain.
|
|
19
|
-
*
|
|
20
|
-
* The structure of the descriptions array is as follows (explained on an example):
|
|
21
|
-
*
|
|
22
|
-
* ```ts
|
|
23
|
-
* [
|
|
24
|
-
* { type: 'insertion', content: '*Insert:* 2 paragraphs' },
|
|
25
|
-
* { type: 'insertion', content: '*Insert:* image },
|
|
26
|
-
* { type: 'replace', content: '*Replace:* "Foo" *with* "Bar"' }
|
|
27
|
-
* ]
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* In above example there are three description instances (or lines). Two new (empty) paragraphs were added,
|
|
31
|
-
* an image was added and then "Foo" text was removed and "Bar" text was added. For example, above structure could be rendered as:
|
|
32
|
-
*
|
|
33
|
-
* ```html
|
|
34
|
-
* <p><strong>Insert:</strong> 2 paragraphs</p>
|
|
35
|
-
* <p><strong>Insert:</strong> image</p>
|
|
36
|
-
* <p><strong>Replace:</strong> "Foo" <strong>with</strong> "Bar"</p>
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
getDescriptions(suggestions: Array<Suggestion>): Array<Description>;
|
|
40
|
-
/**
|
|
41
|
-
* Registers a callback function that returns a custom description for a suggestion.
|
|
42
|
-
*
|
|
43
|
-
* Registered callback is fired for a suggestion whenever there is a need to generate a description for that suggestion.
|
|
44
|
-
*
|
|
45
|
-
* The callback takes the suggestion instance as a parameter and should return
|
|
46
|
-
* {@link module:track-changes/suggestiondescriptionfactory~Description description object} or a falsy value
|
|
47
|
-
* if the suggestion was not handled by the callback.
|
|
48
|
-
*
|
|
49
|
-
* Example of a description callback for the bold style:
|
|
50
|
-
*
|
|
51
|
-
* ```ts
|
|
52
|
-
* suggestionDescriptionFactory.registerDescriptionCallback( suggestion => {
|
|
53
|
-
* const { data } = suggestion;
|
|
54
|
-
*
|
|
55
|
-
* // Omit suggestions that are not bold style suggestions.
|
|
56
|
-
* if ( !data || data.commandName !== 'bold' ) {
|
|
57
|
-
* return;
|
|
58
|
-
* }
|
|
59
|
-
*
|
|
60
|
-
* const isSet = !!data.commandParams[ 0 ].forceValue;
|
|
61
|
-
* const content = isSet ? '*Set format:* bold' : '*Remove format:* bold';
|
|
62
|
-
*
|
|
63
|
-
* return {
|
|
64
|
-
* type: 'format',
|
|
65
|
-
* content
|
|
66
|
-
* };
|
|
67
|
-
* } );
|
|
68
|
-
* ```
|
|
69
|
-
*/
|
|
70
|
-
registerDescriptionCallback(callback: DescriptionCallback): void;
|
|
71
|
-
/**
|
|
72
|
-
* For given `elementName` registers how this element will be labeled in a description (for example when it is added
|
|
73
|
-
* or removed).
|
|
74
|
-
*
|
|
75
|
-
* Instead of a string name you may provide a matching function that takes item {@link module:engine/model/item~Item} as an input
|
|
76
|
-
* and should return boolean value.
|
|
77
|
-
*
|
|
78
|
-
* Provided label callback takes one parameter, `quantity`, and is expected to return the label for the element as a string.
|
|
79
|
-
*
|
|
80
|
-
* A simple use case without using internationalization:
|
|
81
|
-
*
|
|
82
|
-
* ```ts
|
|
83
|
-
* suggestionDescriptionFactory.registerElementLabel(
|
|
84
|
-
* 'paragraph',
|
|
85
|
-
* quantity => quantity == 1 ? 'paragraph' : quantity + ' paragraphs'
|
|
86
|
-
* );
|
|
87
|
-
* ```
|
|
88
|
-
*
|
|
89
|
-
* If you want your feature to be localized to other languages, use localization service:
|
|
90
|
-
*
|
|
91
|
-
* ```ts
|
|
92
|
-
* const t = editor.locale.t; // Remember that you have to use function named `t`.
|
|
93
|
-
*
|
|
94
|
-
* suggestionDescriptionFactory.registerElementLabel(
|
|
95
|
-
* 'paragraph',
|
|
96
|
-
* quantity => t( { string: 'paragraph', plural: '%0 paragraphs', id: 'ELEMENT_PARAGRAPH' }, quantity )
|
|
97
|
-
* );
|
|
98
|
-
* ```
|
|
99
|
-
*/
|
|
100
|
-
registerElementLabel(elementNameOrCallback: string | Function, labelCallback: LabelCallback, priority?: PriorityString): void;
|
|
101
|
-
/**
|
|
102
|
-
* Returns label registered for given element or the element name if there is no label registered for it.
|
|
103
|
-
*/
|
|
104
|
-
getItemLabel(element: Element, quantity?: number): string;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* A description for the suggestion.
|
|
108
|
-
*
|
|
109
|
-
* ```ts
|
|
110
|
-
* {
|
|
111
|
-
* type: 'format',
|
|
112
|
-
* label: '*Set format:* bold'
|
|
113
|
-
* }
|
|
114
|
-
* ```
|
|
115
|
-
*
|
|
116
|
-
* A description for the color-related suggestions like font color may specify the `color` property that will provide a better UX
|
|
117
|
-
* by displaying a color box next to the suggestion.
|
|
118
|
-
*
|
|
119
|
-
* ```ts
|
|
120
|
-
* {
|
|
121
|
-
* type: 'format',
|
|
122
|
-
* label: '*Set font color:*',
|
|
123
|
-
* color: {
|
|
124
|
-
* value: 'hsl( 60, 60%, 60% )',
|
|
125
|
-
* title: 'yellow'
|
|
126
|
-
* }
|
|
127
|
-
* }
|
|
128
|
-
* ```
|
|
129
|
-
*/
|
|
130
|
-
export interface Description {
|
|
131
|
-
type: 'insertion' | 'deletion' | 'replace' | 'format';
|
|
132
|
-
/**
|
|
133
|
-
* Description label. You may use `*` to bold part of the label.
|
|
134
|
-
*/
|
|
135
|
-
content: string;
|
|
136
|
-
/**
|
|
137
|
-
* The optional `color` property used for color-related suggestions.
|
|
138
|
-
* The object should provide the `value` (for displaying the color) and `title` (for describing the color) fields.
|
|
139
|
-
*/
|
|
140
|
-
color?: {
|
|
141
|
-
value: string;
|
|
142
|
-
title: string;
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
export type DescriptionCallback = (suggestion: Suggestion) => Description | DescriptionItem | undefined;
|
|
146
|
-
export type LabelCallback = (quantity: number) => string;
|
|
147
|
-
export interface LabelCallbackObject {
|
|
148
|
-
matchingCallback: (element: Element) => boolean;
|
|
149
|
-
label: LabelCallback;
|
|
150
|
-
priority: PriorityString;
|
|
151
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @module track-changes/suggestiondescriptionfactory
|
|
3
|
+
* @publicApi
|
|
4
|
+
*/
|
|
5
|
+
import { type Locale, type PriorityString } from 'ckeditor5/src/utils.js';
|
|
6
|
+
import type { Schema, Element } from 'ckeditor5/src/engine.js';
|
|
7
|
+
import type Suggestion from './suggestion.js';
|
|
8
|
+
/**
|
|
9
|
+
* Creates descriptions for suggestion chains.
|
|
10
|
+
*
|
|
11
|
+
* One or more suggestions that are next to each other create "suggestion chain". In such chain one suggestion may
|
|
12
|
+
* impact other suggestion when it comes to the description of the whole chain. For example, insertion next to deletion
|
|
13
|
+
* results in "Replaced" description.
|
|
14
|
+
*/
|
|
15
|
+
export default class SuggestionDescriptionFactory {
|
|
16
|
+
constructor(schema: Schema, locale: Locale);
|
|
17
|
+
/**
|
|
18
|
+
* Returns descriptions for given suggestion chain.
|
|
19
|
+
*
|
|
20
|
+
* The structure of the descriptions array is as follows (explained on an example):
|
|
21
|
+
*
|
|
22
|
+
* ```ts
|
|
23
|
+
* [
|
|
24
|
+
* { type: 'insertion', content: '*Insert:* 2 paragraphs' },
|
|
25
|
+
* { type: 'insertion', content: '*Insert:* image },
|
|
26
|
+
* { type: 'replace', content: '*Replace:* "Foo" *with* "Bar"' }
|
|
27
|
+
* ]
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* In above example there are three description instances (or lines). Two new (empty) paragraphs were added,
|
|
31
|
+
* an image was added and then "Foo" text was removed and "Bar" text was added. For example, above structure could be rendered as:
|
|
32
|
+
*
|
|
33
|
+
* ```html
|
|
34
|
+
* <p><strong>Insert:</strong> 2 paragraphs</p>
|
|
35
|
+
* <p><strong>Insert:</strong> image</p>
|
|
36
|
+
* <p><strong>Replace:</strong> "Foo" <strong>with</strong> "Bar"</p>
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
getDescriptions(suggestions: Array<Suggestion>): Array<Description>;
|
|
40
|
+
/**
|
|
41
|
+
* Registers a callback function that returns a custom description for a suggestion.
|
|
42
|
+
*
|
|
43
|
+
* Registered callback is fired for a suggestion whenever there is a need to generate a description for that suggestion.
|
|
44
|
+
*
|
|
45
|
+
* The callback takes the suggestion instance as a parameter and should return
|
|
46
|
+
* {@link module:track-changes/suggestiondescriptionfactory~Description description object} or a falsy value
|
|
47
|
+
* if the suggestion was not handled by the callback.
|
|
48
|
+
*
|
|
49
|
+
* Example of a description callback for the bold style:
|
|
50
|
+
*
|
|
51
|
+
* ```ts
|
|
52
|
+
* suggestionDescriptionFactory.registerDescriptionCallback( suggestion => {
|
|
53
|
+
* const { data } = suggestion;
|
|
54
|
+
*
|
|
55
|
+
* // Omit suggestions that are not bold style suggestions.
|
|
56
|
+
* if ( !data || data.commandName !== 'bold' ) {
|
|
57
|
+
* return;
|
|
58
|
+
* }
|
|
59
|
+
*
|
|
60
|
+
* const isSet = !!data.commandParams[ 0 ].forceValue;
|
|
61
|
+
* const content = isSet ? '*Set format:* bold' : '*Remove format:* bold';
|
|
62
|
+
*
|
|
63
|
+
* return {
|
|
64
|
+
* type: 'format',
|
|
65
|
+
* content
|
|
66
|
+
* };
|
|
67
|
+
* } );
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
registerDescriptionCallback(callback: DescriptionCallback): void;
|
|
71
|
+
/**
|
|
72
|
+
* For given `elementName` registers how this element will be labeled in a description (for example when it is added
|
|
73
|
+
* or removed).
|
|
74
|
+
*
|
|
75
|
+
* Instead of a string name you may provide a matching function that takes item {@link module:engine/model/item~Item} as an input
|
|
76
|
+
* and should return boolean value.
|
|
77
|
+
*
|
|
78
|
+
* Provided label callback takes one parameter, `quantity`, and is expected to return the label for the element as a string.
|
|
79
|
+
*
|
|
80
|
+
* A simple use case without using internationalization:
|
|
81
|
+
*
|
|
82
|
+
* ```ts
|
|
83
|
+
* suggestionDescriptionFactory.registerElementLabel(
|
|
84
|
+
* 'paragraph',
|
|
85
|
+
* quantity => quantity == 1 ? 'paragraph' : quantity + ' paragraphs'
|
|
86
|
+
* );
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* If you want your feature to be localized to other languages, use localization service:
|
|
90
|
+
*
|
|
91
|
+
* ```ts
|
|
92
|
+
* const t = editor.locale.t; // Remember that you have to use function named `t`.
|
|
93
|
+
*
|
|
94
|
+
* suggestionDescriptionFactory.registerElementLabel(
|
|
95
|
+
* 'paragraph',
|
|
96
|
+
* quantity => t( { string: 'paragraph', plural: '%0 paragraphs', id: 'ELEMENT_PARAGRAPH' }, quantity )
|
|
97
|
+
* );
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
registerElementLabel(elementNameOrCallback: string | Function, labelCallback: LabelCallback, priority?: PriorityString): void;
|
|
101
|
+
/**
|
|
102
|
+
* Returns label registered for given element or the element name if there is no label registered for it.
|
|
103
|
+
*/
|
|
104
|
+
getItemLabel(element: Element, quantity?: number): string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* A description for the suggestion.
|
|
108
|
+
*
|
|
109
|
+
* ```ts
|
|
110
|
+
* {
|
|
111
|
+
* type: 'format',
|
|
112
|
+
* label: '*Set format:* bold'
|
|
113
|
+
* }
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* A description for the color-related suggestions like font color may specify the `color` property that will provide a better UX
|
|
117
|
+
* by displaying a color box next to the suggestion.
|
|
118
|
+
*
|
|
119
|
+
* ```ts
|
|
120
|
+
* {
|
|
121
|
+
* type: 'format',
|
|
122
|
+
* label: '*Set font color:*',
|
|
123
|
+
* color: {
|
|
124
|
+
* value: 'hsl( 60, 60%, 60% )',
|
|
125
|
+
* title: 'yellow'
|
|
126
|
+
* }
|
|
127
|
+
* }
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
export interface Description {
|
|
131
|
+
type: 'insertion' | 'deletion' | 'replace' | 'format';
|
|
132
|
+
/**
|
|
133
|
+
* Description label. You may use `*` to bold part of the label.
|
|
134
|
+
*/
|
|
135
|
+
content: string;
|
|
136
|
+
/**
|
|
137
|
+
* The optional `color` property used for color-related suggestions.
|
|
138
|
+
* The object should provide the `value` (for displaying the color) and `title` (for describing the color) fields.
|
|
139
|
+
*/
|
|
140
|
+
color?: {
|
|
141
|
+
value: string;
|
|
142
|
+
title: string;
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
export type DescriptionCallback = (suggestion: Suggestion) => Description | DescriptionItem | undefined;
|
|
146
|
+
export type LabelCallback = (quantity: number) => string;
|
|
147
|
+
export interface LabelCallbackObject {
|
|
148
|
+
matchingCallback: (element: Element) => boolean;
|
|
149
|
+
label: LabelCallback;
|
|
150
|
+
priority: PriorityString;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* An intermediate state which is easier to operate on when consecutive suggestion
|
|
154
|
+
* ranges are traversed.
|
|
155
|
+
*/
|
|
156
|
+
interface DescriptionItem {
|
|
157
|
+
type: 'text' | 'addEmptyContainer' | 'addObject' | 'removeEmptyContainer' | 'removeObject' | 'addContainer' | 'removeContainer';
|
|
158
|
+
add?: string;
|
|
159
|
+
remove?: string;
|
|
160
|
+
element?: Element;
|
|
161
|
+
quantity?: number;
|
|
162
|
+
}
|
|
163
|
+
export {};
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x2029=['isObject','push','matchingCallback','softBreak','isEmpty','quantity','ELEMENT_SPACE','end','element','elementStart','name','Container','addContainer','get','item','text','start','EmptyContainer','getFirstRange','Object','_customCallbacks','_locale','checkChild','*Merge:*\x20%0','REPLACE_TEXT','add','_addDescriptionItems','match','remove','elementEnd','$textProxy','function','label','length','pop','$text','normal','addEmptyContainer','getDescriptions','_itemLabels','isInContent','registerDescriptionCallback','_schema','removeEmptyContainer','replace','deletion','indexOf','insertion','type','data','set','nextSibling','previousSibling','_itemLabelsCallbacks','_resolveDescriptionItems','*Insert:*\x20%0','getItemLabel','*Remove:*\x20%0','$1\x20$2','isEqual','registerElementLabel','*Split:*\x20%0'];(function(_0x2aecc6,_0x2029c8){const _0x234ad5=function(_0x41f45c){while(--_0x41f45c){_0x2aecc6['push'](_0x2aecc6['shift']());}};_0x234ad5(++_0x2029c8);}(_0x2029,0x118));const _0x234a=function(_0x2aecc6,_0x2029c8){_0x2aecc6=_0x2aecc6-0x0;let _0x234ad5=_0x2029[_0x2aecc6];return _0x234ad5;};import{getTranslation as _0x59b9cb}from'./utils/common-translations.js';import{priorities as _0x2d9b28,insertToPriorityArray as _0x2e03b2}from'ckeditor5/src/utils.js';export default class m{constructor(_0x2869b2,_0x5c8234){this[_0x234a('0x32')]=[],this[_0x234a('0x7')]=new Map(),this[_0x234a('0x15')]=[],this['_schema']=_0x2869b2,this[_0x234a('0x33')]=_0x5c8234;}[_0x234a('0x6')](_0x185f31){const _0x4d531f=[];for(let _0x20b203=0x0;_0x20b203<_0x185f31[_0x234a('0x1')];_0x20b203++){const _0x99f876=_0x185f31[_0x20b203];if(!_0x99f876[_0x234a('0x8')])continue;let _0x56e7fb=!0x1;for(const _0x1e5af5 of this[_0x234a('0x32')]){const _0x1b63de=_0x1e5af5(_0x99f876);if(_0x1b63de){_0x234a('0x10')in _0x1b63de&&_0x4d531f[_0x234a('0x1f')](_0x1b63de),_0x56e7fb=!0x0;break;}}if(!_0x56e7fb){this['_addDescriptionItems'](_0x4d531f,_0x99f876);const _0x50aa45=_0x185f31[_0x20b203+0x1];if(_0x50aa45&&!_0x99f876[_0x234a('0x30')]()[_0x234a('0x25')][_0x234a('0x1b')](_0x50aa45['getFirstRange']()[_0x234a('0x2e')])){const _0x149a6e=_0x4d531f[_0x4d531f['length']-0x1],_0x1a8394=_0x234a('0xf')==_0x99f876[_0x234a('0x10')]?_0x234a('0x37'):_0x234a('0x3a');_0x149a6e&&_0x234a('0x2d')==_0x149a6e[_0x234a('0x10')]&&(_0x149a6e[_0x1a8394]+='\x0a');}}}return this[_0x234a('0x16')](_0x4d531f);}[_0x234a('0x9')](_0x4369aa){this[_0x234a('0x32')]['push'](_0x4369aa);}[_0x234a('0x1c')](_0x475d30,_0x2cc39d,_0x2f272b=_0x2d9b28[_0x234a('0x4')]){_0x234a('0x3d')==typeof _0x475d30?_0x2e03b2(this['_itemLabelsCallbacks'],{'matchingCallback':_0x475d30,'label':_0x2cc39d,'priority':_0x2f272b}):this[_0x234a('0x7')][_0x234a('0x12')](_0x475d30,_0x2cc39d);}[_0x234a('0x18')](_0x5027e2,_0x120c00=0x1){let _0x4df7fd;for(const _0x19b3fc of this[_0x234a('0x15')])if(_0x19b3fc[_0x234a('0x20')](_0x5027e2)){_0x4df7fd=_0x19b3fc[_0x234a('0x0')];break;}return _0x4df7fd||(_0x4df7fd=this['_itemLabels'][_0x234a('0x2b')](_0x5027e2[_0x234a('0x28')])),_0x4df7fd?_0x4df7fd(_0x120c00):0x1!==_0x120c00?_0x120c00+'\x20'+_0x5027e2[_0x234a('0x28')]+'s':''+_0x5027e2[_0x234a('0x28')];}[_0x234a('0x38')](_0x4a6077,_0x30bf6b){const _0x42a18e=_0x30bf6b[_0x234a('0x30')]()['getWalker'](),_0x18896c=_0x234a('0xf')==_0x30bf6b[_0x234a('0x10')]?'add':_0x234a('0x3a');for(const _0x109020 of _0x42a18e){const _0x56d0af=_0x109020[_0x234a('0x2c')],_0x5916cd=_0x4a6077[_0x4a6077[_0x234a('0x1')]-0x1];if(_0x56d0af['is'](_0x234a('0x3c')))_0x5916cd&&_0x5916cd[_0x234a('0x10')][_0x234a('0xe')](_0x234a('0x29'))>-0x1&&_0x4a6077[_0x234a('0x2')](),_0x5916cd&&_0x234a('0x2d')==_0x5916cd[_0x234a('0x10')]?_0x5916cd[_0x18896c]+=_0x56d0af[_0x234a('0x11')]:_0x4a6077[_0x234a('0x1f')]({'type':_0x234a('0x2d'),'add':_0x234a('0x37')==_0x18896c?_0x56d0af[_0x234a('0x11')]:'','remove':_0x234a('0x3a')==_0x18896c?_0x56d0af[_0x234a('0x11')]:''});else{if(this[_0x234a('0xa')][_0x234a('0x1e')](_0x56d0af)){const _0x4fcd04=_0x56d0af;if(_0x5916cd&&_0x5916cd[_0x234a('0x10')][_0x234a('0xe')]('Container')>-0x1&&_0x4a6077[_0x234a('0x2')](),_0x234a('0x3b')==_0x109020[_0x234a('0x10')])continue;_0x5916cd&&_0x5916cd[_0x234a('0x10')]==_0x18896c+_0x234a('0x31')&&_0x5916cd['element'][_0x234a('0x28')]==_0x4fcd04[_0x234a('0x28')]?_0x5916cd['quantity']++:_0x4a6077[_0x234a('0x1f')]({'type':_0x18896c+_0x234a('0x31'),'element':_0x4fcd04,'quantity':0x1}),_0x42a18e['skip'](_0x1cdea7=>!(_0x234a('0x3b')==_0x1cdea7[_0x234a('0x10')]&&_0x1cdea7[_0x234a('0x2c')]==_0x56d0af));}else{if(this['_schema'][_0x234a('0x34')](_0x56d0af,_0x234a('0x3'))||_0x56d0af['is'](_0x234a('0x26'),_0x234a('0x21'))){const _0x462fb9=_0x56d0af;if(_0x234a('0x37')==_0x18896c&&_0x234a('0x27')==_0x109020['type']||_0x234a('0x3a')==_0x18896c&&_0x234a('0x3b')==_0x109020[_0x234a('0x10')])continue;if(_0x5916cd&&-0x1==_0x5916cd[_0x234a('0x10')][_0x234a('0xe')]('Container')){_0x234a('0x2d')==_0x5916cd[_0x234a('0x10')]&&(_0x5916cd[_0x18896c]+='\x0a');continue;}let _0x168ab4;if(_0x168ab4=_0x234a('0x37')==_0x18896c?_0x462fb9[_0x234a('0x13')]&&!this['_schema'][_0x234a('0x1e')](_0x462fb9[_0x234a('0x13')])?_0x462fb9['nextSibling']:null:_0x462fb9[_0x234a('0x14')]&&!this[_0x234a('0xa')][_0x234a('0x1e')](_0x462fb9[_0x234a('0x14')])?_0x462fb9[_0x234a('0x14')]:null,_0x462fb9[_0x234a('0x22')]||_0x168ab4&&_0x168ab4['isEmpty']){const _0x3cea1f=_0x168ab4&&_0x168ab4['isEmpty']?_0x168ab4:_0x462fb9;_0x5916cd&&_0x5916cd[_0x234a('0x10')]==_0x18896c+'EmptyContainer'&&_0x5916cd['element'][_0x234a('0x28')]==_0x3cea1f[_0x234a('0x28')]?_0x5916cd[_0x234a('0x23')]++:_0x4a6077['push']({'type':_0x18896c+_0x234a('0x2f'),'element':_0x3cea1f,'quantity':0x1});}else _0x4a6077[_0x234a('0x1f')]({'type':_0x18896c+_0x234a('0x29'),'element':_0x462fb9});}}}}}[_0x234a('0x16')](_0x455487){const _0x540aba=this[_0x234a('0x33')],_0x27a294=[];for(const _0x1b3533 of _0x455487){switch(_0x1b3533['type']){case _0x234a('0x2d'):if(_0x1b3533[_0x234a('0x37')]=_0x1b3533[_0x234a('0x37')][_0x234a('0xc')](/(\S)\u000A+(\S)/g,_0x234a('0x1a'))['replace'](/\u000A/g,''),_0x1b3533['remove']=_0x1b3533[_0x234a('0x3a')][_0x234a('0xc')](/(\S)\u000A+(\S)/g,'$1\x20$2')[_0x234a('0xc')](/\u000A/g,''),''!=_0x1b3533['add']&&''!=_0x1b3533[_0x234a('0x3a')]){_0x27a294[_0x234a('0x1f')]({'type':_0x234a('0xc'),'content':_0x59b9cb(_0x540aba,_0x234a('0x36'),['\x22'+_0x1b3533[_0x234a('0x3a')]+'\x22','\x22'+_0x1b3533['add']+'\x22'])});continue;}if(null!=_0x1b3533['add'][_0x234a('0x39')](/^ +$/)){_0x27a294[_0x234a('0x1f')]({'type':_0x234a('0xf'),'content':_0x59b9cb(_0x540aba,_0x234a('0x17'),_0x59b9cb(_0x540aba,'ELEMENT_SPACE',_0x1b3533[_0x234a('0x37')]['length']))});continue;}if(null!=_0x1b3533['remove'][_0x234a('0x39')](/^ +$/)){_0x27a294[_0x234a('0x1f')]({'type':_0x234a('0xd'),'content':_0x59b9cb(_0x540aba,'*Remove:*\x20%0',_0x59b9cb(_0x540aba,_0x234a('0x24'),_0x1b3533[_0x234a('0x3a')][_0x234a('0x1')]))});continue;}if(''!=_0x1b3533['add']){_0x27a294['push']({'type':'insertion','content':_0x59b9cb(_0x540aba,'*Insert:*\x20%0','\x22'+_0x1b3533[_0x234a('0x37')]+'\x22')});continue;}_0x27a294[_0x234a('0x1f')]({'type':'deletion','content':_0x59b9cb(_0x540aba,'*Remove:*\x20%0','\x22'+_0x1b3533['remove']+'\x22')});continue;case _0x234a('0x5'):case'addObject':_0x27a294[_0x234a('0x1f')]({'type':_0x234a('0xf'),'content':_0x59b9cb(_0x540aba,_0x234a('0x17'),this[_0x234a('0x18')](_0x1b3533['element'],_0x1b3533[_0x234a('0x23')]))});continue;case _0x234a('0xb'):case'removeObject':_0x27a294[_0x234a('0x1f')]({'type':_0x234a('0xd'),'content':_0x59b9cb(_0x540aba,_0x234a('0x19'),this[_0x234a('0x18')](_0x1b3533[_0x234a('0x26')],_0x1b3533[_0x234a('0x23')]))});continue;case _0x234a('0x2a'):_0x27a294[_0x234a('0x1f')]({'type':_0x234a('0xf'),'content':_0x59b9cb(_0x540aba,_0x234a('0x1d'),this[_0x234a('0x18')](_0x1b3533[_0x234a('0x26')],_0x1b3533[_0x234a('0x23')]))});continue;case'removeContainer':_0x27a294[_0x234a('0x1f')]({'type':_0x234a('0xd'),'content':_0x59b9cb(_0x540aba,_0x234a('0x35'),this[_0x234a('0x18')](_0x1b3533[_0x234a('0x26')],_0x1b3533['quantity']))});continue;}_0x27a294[_0x234a('0x1f')](_0x1b3533);}return _0x27a294;}}
|