@ckeditor/ckeditor5-track-changes 36.0.1 → 37.0.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.
Files changed (127) hide show
  1. package/build/track-changes.js +1 -1
  2. package/ckeditor5-metadata.json +10 -0
  3. package/package.json +20 -5
  4. package/src/augmentation.d.ts +36 -0
  5. package/src/augmentation.js +23 -0
  6. package/src/commands/acceptsuggestioncommand.d.ts +20 -0
  7. package/src/commands/acceptsuggestioncommand.js +1 -1
  8. package/src/commands/discardsuggestioncommand.d.ts +20 -0
  9. package/src/commands/discardsuggestioncommand.js +1 -1
  10. package/src/commands/executeonallsuggestionscommand.d.ts +20 -0
  11. package/src/commands/executeonallsuggestionscommand.js +1 -1
  12. package/src/commands/executeonselectedsuggestionscommand.d.ts +20 -0
  13. package/src/commands/executeonselectedsuggestionscommand.js +1 -1
  14. package/src/commands/trackchangescommand.d.ts +22 -0
  15. package/src/commands/trackchangescommand.js +1 -1
  16. package/src/index.d.ts +12 -0
  17. package/src/index.js +1 -1
  18. package/src/integrations/alignment.d.ts +13 -0
  19. package/src/integrations/alignment.js +1 -1
  20. package/src/integrations/basicstyles.d.ts +13 -0
  21. package/src/integrations/basicstyles.js +1 -1
  22. package/src/integrations/blockquote.d.ts +13 -0
  23. package/src/integrations/blockquote.js +1 -1
  24. package/src/integrations/ckbox.d.ts +13 -0
  25. package/src/integrations/ckbox.js +1 -1
  26. package/src/integrations/codeblock.d.ts +13 -0
  27. package/src/integrations/codeblock.js +1 -1
  28. package/src/integrations/comments.d.ts +10 -0
  29. package/src/integrations/comments.js +1 -1
  30. package/src/integrations/deletecommand.d.ts +12 -0
  31. package/src/integrations/deletecommand.js +1 -1
  32. package/src/integrations/documentlist.d.ts +13 -0
  33. package/src/integrations/documentlist.js +1 -1
  34. package/src/integrations/documentlistproperties.d.ts +25 -0
  35. package/src/integrations/documentlistproperties.js +1 -1
  36. package/src/integrations/entercommand.d.ts +11 -0
  37. package/src/integrations/entercommand.js +1 -1
  38. package/src/integrations/findandreplace.d.ts +17 -0
  39. package/src/integrations/findandreplace.js +1 -1
  40. package/src/integrations/font.d.ts +13 -0
  41. package/src/integrations/font.js +1 -1
  42. package/src/integrations/heading.d.ts +13 -0
  43. package/src/integrations/heading.js +1 -1
  44. package/src/integrations/highlight.d.ts +13 -0
  45. package/src/integrations/highlight.js +1 -1
  46. package/src/integrations/horizontalline.d.ts +13 -0
  47. package/src/integrations/horizontalline.js +1 -1
  48. package/src/integrations/htmlembed.d.ts +13 -0
  49. package/src/integrations/htmlembed.js +1 -1
  50. package/src/integrations/image.d.ts +13 -0
  51. package/src/integrations/image.js +1 -1
  52. package/src/integrations/imagereplace.d.ts +19 -0
  53. package/src/integrations/imagereplace.js +1 -1
  54. package/src/integrations/importword.d.ts +14 -0
  55. package/src/integrations/importword.js +1 -1
  56. package/src/integrations/indent.d.ts +13 -0
  57. package/src/integrations/indent.js +1 -1
  58. package/src/integrations/inputcommand.d.ts +11 -0
  59. package/src/integrations/inputcommand.js +1 -1
  60. package/src/integrations/link.d.ts +13 -0
  61. package/src/integrations/link.js +1 -1
  62. package/src/integrations/list.d.ts +13 -0
  63. package/src/integrations/list.js +1 -1
  64. package/src/integrations/listproperties.d.ts +25 -0
  65. package/src/integrations/listproperties.js +1 -1
  66. package/src/integrations/mediaembed.d.ts +13 -0
  67. package/src/integrations/mediaembed.js +1 -1
  68. package/src/integrations/mention.d.ts +13 -0
  69. package/src/integrations/mention.js +1 -1
  70. package/src/integrations/pagebreak.d.ts +13 -0
  71. package/src/integrations/pagebreak.js +1 -1
  72. package/src/integrations/paragraph.d.ts +13 -0
  73. package/src/integrations/paragraph.js +1 -1
  74. package/src/integrations/removeformat.d.ts +13 -0
  75. package/src/integrations/removeformat.js +1 -1
  76. package/src/integrations/restrictededitingmode.d.ts +13 -0
  77. package/src/integrations/restrictededitingmode.js +1 -1
  78. package/src/integrations/shiftentercommand.d.ts +11 -0
  79. package/src/integrations/shiftentercommand.js +1 -1
  80. package/src/integrations/standardeditingmode.d.ts +13 -0
  81. package/src/integrations/standardeditingmode.js +1 -1
  82. package/src/integrations/style.d.ts +14 -0
  83. package/src/integrations/style.js +1 -1
  84. package/src/integrations/table.d.ts +38 -0
  85. package/src/integrations/table.js +1 -1
  86. package/src/integrations/tablecaption.d.ts +17 -0
  87. package/src/integrations/tablecaption.js +1 -1
  88. package/src/integrations/tableclipboard.d.ts +17 -0
  89. package/src/integrations/tableclipboard.js +1 -1
  90. package/src/integrations/tablecolumnresize.d.ts +22 -0
  91. package/src/integrations/tablecolumnresize.js +1 -1
  92. package/src/integrations/tableheadings.d.ts +17 -0
  93. package/src/integrations/tableheadings.js +1 -1
  94. package/src/integrations/tablemergesplit.d.ts +17 -0
  95. package/src/integrations/tablemergesplit.js +1 -1
  96. package/src/integrations/tableproperties.d.ts +23 -0
  97. package/src/integrations/tableproperties.js +1 -1
  98. package/src/integrations/title.d.ts +13 -0
  99. package/src/integrations/title.js +1 -1
  100. package/src/integrations/undo.d.ts +13 -0
  101. package/src/integrations/undo.js +1 -1
  102. package/src/integrations/utils.d.ts +17 -0
  103. package/src/integrations/utils.js +1 -1
  104. package/src/suggestion.d.ts +266 -0
  105. package/src/suggestion.js +1 -1
  106. package/src/suggestiondescriptionfactory.d.ts +151 -0
  107. package/src/suggestiondescriptionfactory.js +1 -1
  108. package/src/trackchanges.d.ts +222 -0
  109. package/src/trackchanges.js +1 -1
  110. package/src/trackchangesconfig.d.ts +53 -0
  111. package/src/trackchangesconfig.js +23 -0
  112. package/src/trackchangesdata.d.ts +38 -0
  113. package/src/trackchangesdata.js +1 -1
  114. package/src/trackchangesediting.d.ts +391 -0
  115. package/src/trackchangesediting.js +1 -1
  116. package/src/trackchangesui.d.ts +34 -0
  117. package/src/trackchangesui.js +1 -1
  118. package/src/ui/suggestioncontroller.d.ts +36 -0
  119. package/src/ui/suggestioncontroller.js +1 -1
  120. package/src/ui/view/basesuggestionthreadview.d.ts +166 -0
  121. package/src/ui/view/basesuggestionthreadview.js +1 -1
  122. package/src/ui/view/suggestionthreadview.d.ts +184 -0
  123. package/src/ui/view/suggestionthreadview.js +1 -1
  124. package/src/utils/common-translations.d.ts +5 -0
  125. package/src/utils/common-translations.js +1 -1
  126. package/src/utils/utils.d.ts +26 -0
  127. package/src/utils/utils.js +1 -1
@@ -0,0 +1,17 @@
1
+ import type { Editor } from 'ckeditor5/src/core';
2
+ import type { Range, Model, Element, DowncastAddMarkerEvent } from 'ckeditor5/src/engine';
3
+ import type { GetCallback } from 'ckeditor5/src/utils';
4
+ /**
5
+ * Searches given `range` and returns all sub-ranges containing items with given `attributeKey`.
6
+ */
7
+ export declare function getRangesWithAttribute(attributeKey: string, range: Range, model: Model): Array<Range>;
8
+ /**
9
+ * For given `element`, if it is a list item, returns all list items that would be affected by renaming `element` to a different element.
10
+ */
11
+ export declare function getElementsAffectedByListItemRename(element: Element): Array<Element>;
12
+ /**
13
+ * Returns the conversion function for down-casting split/merge markers.
14
+ */
15
+ export declare function downcastSplitMergeMarker(editor: Editor, type: 'split' | 'merge', { showActiveMarker }?: {
16
+ showActiveMarker?: boolean | undefined;
17
+ }): GetCallback<DowncastAddMarkerEvent>;
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0xae45=['isBlock','isLimit','getCustomProperty','schema','get','ck-suggestion-marker--active','markerName','isContent','getItems','hasAttribute','span','isAtEnd','toViewElement','consumable','addClass','push','elementEnd','parent','previousPosition','markerRange','writer','mapper','TrackChangesEditing','model','nextSibling','ck-suggestion-marker-','test','item','type','listIndent','name','element','addHighlight','getWalker','bindElementToMarker','toViewPosition','listItem','activeMarkers','plugins','getAttribute'];(function(_0x3e62f5,_0xae457d){const _0xd59cef=function(_0x3e762f){while(--_0x3e762f){_0x3e62f5['push'](_0x3e62f5['shift']());}};_0xd59cef(++_0xae457d);}(_0xae45,0x16a));const _0xd59c=function(_0x3e62f5,_0xae457d){_0x3e62f5=_0x3e62f5-0x0;let _0xd59cef=_0xae45[_0x3e62f5];return _0xd59cef;};export function getRangesWithAttribute(_0x48a801,_0x2f35cb,_0x4e4c52){const _0x147dcb=[];for(const _0x23e393 of _0x2f35cb[_0xd59c('0x6')]())_0x23e393[_0xd59c('0x7')](_0x48a801)&&_0x147dcb[_0xd59c('0xd')](_0x4e4c52['createRangeOn'](_0x23e393));return _0x147dcb;}export function getElementsAffectedByListItemRename(_0x2c5e2d){const _0x475a01=[];if(_0x2c5e2d['is']('element','listItem')){let _0x46f24=_0x2c5e2d[_0xd59c('0x16')];for(;_0x46f24&&_0x46f24['is'](_0xd59c('0x1d'),_0xd59c('0x22'))&&_0x46f24[_0xd59c('0x25')](_0xd59c('0x1b'))>0x0;)_0x475a01[_0xd59c('0xd')](_0x46f24),_0x46f24=_0x46f24[_0xd59c('0x16')];}return _0x475a01;}export function downcastSplitMergeMarker(_0x201e20,_0x3717c3,{showActiveMarker:_0x2679e7=!0x0}={}){const _0x51d26e=_0x201e20[_0xd59c('0x24')][_0xd59c('0x2')](_0xd59c('0x14'));return(_0x5c1c47,_0x476159,_0x2f1bd7)=>{if(!_0x2f1bd7[_0xd59c('0xb')][_0xd59c('0x18')](_0x476159['markerRange'],_0x5c1c47[_0xd59c('0x1c')]))return;const _0x1e38c5=_0x476159[_0xd59c('0x11')][_0xd59c('0x1f')](),_0xa83910=_0x476159[_0xd59c('0x11')]['start'],_0x5ac129=_0x201e20[_0xd59c('0x15')][_0xd59c('0x1')];let _0x39cff5=null,_0x129210=null,_0x3b4ba0=!0x1,_0x5b2a47=!0x1;for(const _0x15e761 of _0x1e38c5){const _0x4a0e82=_0x15e761[_0xd59c('0x19')];_0x3b4ba0=_0x3b4ba0||_0x5ac129[_0xd59c('0x5')](_0x4a0e82);const _0x4b0157=_0x2f1bd7['mapper'][_0xd59c('0xa')](_0x4a0e82);if(_0x4b0157&&_0x4b0157[_0xd59c('0x0')](_0xd59c('0x1e')))return;_0xd59c('0xe')==_0x15e761[_0xd59c('0x1a')]&&(_0x5ac129[_0xd59c('0x26')](_0x4a0e82)&&!_0x5ac129[_0xd59c('0x27')](_0x4a0e82)&&(_0x4a0e82[_0xd59c('0x16')]||_0xa83910[_0xd59c('0x9')]?_0x39cff5&&_0x39cff5[_0xd59c('0xf')]==_0x4a0e82||(_0x39cff5=_0x4a0e82,_0x1497b7(_0x15e761[_0xd59c('0x10')]),_0x5b2a47=!0x0):_0x129210=_0x129210||_0x15e761[_0xd59c('0x10')]));}function _0x1497b7(_0x5bc430){const _0x2e0f8c=_0x2f1bd7[_0xd59c('0x12')]['createUIElement'](_0xd59c('0x8'),{'class':_0xd59c('0x17')+_0x3717c3}),_0xac336f=_0x2f1bd7[_0xd59c('0x13')][_0xd59c('0x21')](_0x5bc430);_0x2679e7&&_0x51d26e[_0xd59c('0x23')]['includes'](_0x476159[_0xd59c('0x4')])&&_0x2f1bd7[_0xd59c('0x12')][_0xd59c('0xc')](_0xd59c('0x3'),_0x2e0f8c),_0x2f1bd7[_0xd59c('0x12')]['insert'](_0xac336f,_0x2e0f8c),_0x2f1bd7[_0xd59c('0x13')][_0xd59c('0x20')](_0x2e0f8c,_0x476159[_0xd59c('0x4')]);}_0x3b4ba0||_0x5b2a47||!_0x129210||_0x1497b7(_0x129210);};}
23
+ const _0x1ed2=['get','previousPosition','toViewPosition','activeMarkers','element','toViewElement','getCustomProperty','markerName','isBlock','mapper','ck-suggestion-marker--active','hasAttribute','listIndent','push','isContent','span','insert','nextSibling','addHighlight','isLimit','TrackChangesEditing','item','includes','ck-suggestion-marker-','createUIElement','writer','name','start','markerRange','consumable','isAtEnd','createRangeOn','plugins','bindElementToMarker'];(function(_0x512dd5,_0x1ed230){const _0x2316a7=function(_0xd44490){while(--_0xd44490){_0x512dd5['push'](_0x512dd5['shift']());}};_0x2316a7(++_0x1ed230);}(_0x1ed2,0x1b9));const _0x2316=function(_0x512dd5,_0x1ed230){_0x512dd5=_0x512dd5-0x0;let _0x2316a7=_0x1ed2[_0x512dd5];return _0x2316a7;};export function getRangesWithAttribute(_0x5c3ed7,_0x36f399,_0x4bc5c4){const _0x492314=[];for(const _0x1e80b8 of _0x36f399['getItems']())_0x1e80b8[_0x2316('0xc')](_0x5c3ed7)&&_0x492314[_0x2316('0xe')](_0x4bc5c4[_0x2316('0x20')](_0x1e80b8));return _0x492314;}export function getElementsAffectedByListItemRename(_0x2ce7e9){const _0x338c39=[];if(_0x2ce7e9['is'](_0x2316('0x5'),'listItem')){let _0x3dafab=_0x2ce7e9[_0x2316('0x12')];for(;_0x3dafab&&_0x3dafab['is'](_0x2316('0x5'),'listItem')&&_0x3dafab['getAttribute'](_0x2316('0xd'))>0x0;)_0x338c39[_0x2316('0xe')](_0x3dafab),_0x3dafab=_0x3dafab['nextSibling'];}return _0x338c39;}export function downcastSplitMergeMarker(_0x10cf57,_0x1c317a,{showActiveMarker:_0x1688b4=!0x0}={}){const _0x317448=_0x10cf57[_0x2316('0x21')][_0x2316('0x1')](_0x2316('0x15'));return(_0x509fa5,_0x67ca7a,_0x421a0b)=>{if(!_0x421a0b[_0x2316('0x1e')]['test'](_0x67ca7a[_0x2316('0x1d')],_0x509fa5[_0x2316('0x1b')]))return;const _0x3ec57f=_0x67ca7a['markerRange']['getWalker'](),_0x495528=_0x67ca7a[_0x2316('0x1d')][_0x2316('0x1c')],_0xb24156=_0x10cf57['model']['schema'];let _0x5f1b7f=null,_0x26dd04=null,_0x13328b=!0x1,_0x534b5c=!0x1;for(const _0xbde93b of _0x3ec57f){const _0x13f29b=_0xbde93b[_0x2316('0x16')];_0x13328b=_0x13328b||_0xb24156[_0x2316('0xf')](_0x13f29b);const _0x30a3dc=_0x421a0b[_0x2316('0xa')][_0x2316('0x6')](_0x13f29b);if(_0x30a3dc&&_0x30a3dc[_0x2316('0x7')](_0x2316('0x13')))return;'elementEnd'==_0xbde93b['type']&&(_0xb24156[_0x2316('0x9')](_0x13f29b)&&!_0xb24156[_0x2316('0x14')](_0x13f29b)&&(_0x13f29b[_0x2316('0x12')]||_0x495528[_0x2316('0x1f')]?_0x5f1b7f&&_0x5f1b7f['parent']==_0x13f29b||(_0x5f1b7f=_0x13f29b,_0xd4611f(_0xbde93b[_0x2316('0x2')]),_0x534b5c=!0x0):_0x26dd04=_0x26dd04||_0xbde93b[_0x2316('0x2')]));}function _0xd4611f(_0x2aae40){const _0x195f9b=_0x421a0b['writer'][_0x2316('0x19')](_0x2316('0x10'),{'class':_0x2316('0x18')+_0x1c317a}),_0x237e4e=_0x421a0b[_0x2316('0xa')][_0x2316('0x3')](_0x2aae40);_0x1688b4&&_0x317448[_0x2316('0x4')][_0x2316('0x17')](_0x67ca7a['markerName'])&&_0x421a0b[_0x2316('0x1a')]['addClass'](_0x2316('0xb'),_0x195f9b),_0x421a0b[_0x2316('0x1a')][_0x2316('0x11')](_0x237e4e,_0x195f9b),_0x421a0b[_0x2316('0xa')][_0x2316('0x0')](_0x195f9b,_0x67ca7a[_0x2316('0x8')]);}_0x13328b||_0x534b5c||!_0x26dd04||_0xd4611f(_0x26dd04);};}
@@ -0,0 +1,266 @@
1
+ /**
2
+ * @module track-changes/suggestion
3
+ * @publicApi
4
+ */
5
+ import { Element, type Marker, type Model, type Range, type Item } from 'ckeditor5/src/engine';
6
+ import type { User } from 'ckeditor5-collaboration/src/collaboration-core';
7
+ import type { CommentThread } from '@ckeditor/ckeditor5-comments/src/comments/commentsrepository';
8
+ import type { FormatData } from './trackchangesediting';
9
+ declare const Suggestion_base: {
10
+ new (): import("ckeditor5/src/utils").Observable;
11
+ prototype: import("ckeditor5/src/utils").Observable;
12
+ };
13
+ /**
14
+ * Represents a singular suggestion that is tracked by track changes plugin.
15
+ *
16
+ * `Suggestion` instances are created and handled by {@link module:track-changes/trackchanges~TrackChanges track changes plugin}.
17
+ */
18
+ export default class Suggestion extends Suggestion_base {
19
+ /**
20
+ * Suggestion ID.
21
+ */
22
+ readonly id: string;
23
+ /**
24
+ * Suggestion type.
25
+ */
26
+ type: SuggestionType;
27
+ /**
28
+ * Suggestion sub-type.
29
+ *
30
+ * This is an additional identifier for suggestions. Two suggestions of the same type may have different sub-types to differentiate
31
+ * suggestions behavior and handle interactions between suggestions.
32
+ *
33
+ * Sub-type is used for:
34
+ *
35
+ * * suggestions joining (only suggestions with the same sub-type can be joined),
36
+ * * suggestions custom callbacks (fired when adding, deleting and joining suggestions).
37
+ */
38
+ subType: string | null;
39
+ /**
40
+ * The author of the change marked by the suggestion.
41
+ */
42
+ author: User;
43
+ /**
44
+ * The user which saved the suggestion data in the database.
45
+ *
46
+ * Usually the same as author but may be different in some cases (e.g. when suggestion was added from an external source).
47
+ */
48
+ creator: User;
49
+ /**
50
+ * The flag indicating whether the suggestion comes from an external source.
51
+ */
52
+ isExternal: boolean;
53
+ /**
54
+ * Additional suggestion data.
55
+ */
56
+ data: FormatData | null;
57
+ /**
58
+ * Date when the suggestion was saved in the database.
59
+ */
60
+ createdAt: Date | null;
61
+ /**
62
+ * Date when the change marked by the suggestion was made.
63
+ *
64
+ * Usually the same as {@link #createdAt `createdAt`} but may be different in some cases
65
+ * (e.g. when suggestion was added from an external source).
66
+ *
67
+ * @observable
68
+ */
69
+ authoredAt: Date | null;
70
+ /**
71
+ * Custom suggestion attributes. See also {@link #setAttribute} and {@link #removeAttribute}.
72
+ *
73
+ * @observable
74
+ */
75
+ attributes: {
76
+ [k: string]: unknown;
77
+ };
78
+ /**
79
+ * Previous suggestion in suggestions chain.
80
+ *
81
+ * Chained suggestions should be handled as one entity.
82
+ *
83
+ * @observable
84
+ */
85
+ previous: Suggestion | null;
86
+ /**
87
+ * Next suggestion in suggestions chain.
88
+ *
89
+ * Chained suggestions should be handled as one entity.
90
+ *
91
+ * @observable
92
+ */
93
+ next: Suggestion | null;
94
+ /**
95
+ * Comment thread model for comments added to this suggestion.
96
+ *
97
+ * @observable
98
+ */
99
+ commentThread: CommentThread | null;
100
+ constructor(model: Model, options: SuggestionOptions);
101
+ /**
102
+ * The first (most-previous) suggestion in this suggestion chain.
103
+ */
104
+ get head(): Suggestion;
105
+ /**
106
+ * Informs whether suggestion has at least one comment.
107
+ */
108
+ get hasComments(): boolean;
109
+ /**
110
+ * Informs whether the suggestion is a multi-range suggestion or a single-range suggestion.
111
+ *
112
+ * This is evaluated basing on the marker name belonging to this suggestion.
113
+ * Even if only one marker belongs to the suggestion at a given time it can still be a multi range suggestion.
114
+ */
115
+ get isMultiRange(): boolean;
116
+ /**
117
+ * Informs whether the suggestion is still in the editor content.
118
+ *
119
+ * Returns `true` if there is at least one marker suggestion in the editor content.
120
+ */
121
+ get isInContent(): boolean;
122
+ /**
123
+ * Binds given marker name to this suggestion.
124
+ */
125
+ addMarkerName(markerName: string): void;
126
+ /**
127
+ * Returns all names of markers belonging to this suggestion.
128
+ */
129
+ getMarkerNames(): Array<string>;
130
+ /**
131
+ * Returns all markers belonging to this suggestion.
132
+ */
133
+ getMarkers(): Array<Marker>;
134
+ /**
135
+ * Returns the first marker belonging to this suggestion, i.e the first marker that was added to this suggestion
136
+ * and not removed yet.
137
+ *
138
+ * This method is useful if you know that the suggestion has only one marker and want to process it.
139
+ */
140
+ getFirstMarker(): Marker | null;
141
+ /**
142
+ * Removes all markers from the suggestion and the editor content.
143
+ */
144
+ removeMarkers(): void;
145
+ /**
146
+ * Removes marker with the given name from the suggestion and the editor content.
147
+ */
148
+ removeMarker(markerName: string): void;
149
+ /**
150
+ * Adds a new range to this suggestion. It is assumed that the suggestion is a multi-range suggestion.
151
+ *
152
+ * A marker name is generated from this suggestion's properties and a marker with that name is created and set to a given `range`.
153
+ */
154
+ addRange(range: Range): void;
155
+ /**
156
+ * Checks if given `range` is intersecting with any of the ranges of markers belonging to this suggestion.
157
+ */
158
+ isIntersectingWithRange(range: Range): boolean;
159
+ /**
160
+ * Returns all ranges of all markers belonging to this suggestion.
161
+ */
162
+ getRanges(): Array<Range>;
163
+ /**
164
+ * Returns all {@link module:engine/model/item~Item model items} that are in this suggestion.
165
+ */
166
+ getItems(): Array<Item>;
167
+ /**
168
+ * Returns the first range belonging to this suggestion, i.e. the range of the first marker that was added to
169
+ * this suggestion and not removed yet.
170
+ *
171
+ * This method is useful if you know that the suggestion has only one marker and want to process its range.
172
+ */
173
+ getFirstRange(): Range | null;
174
+ /**
175
+ * Returns the model element contained in the suggestion.
176
+ *
177
+ * A {@link module:engine/model/element~Element model element} is considered as contained if there is exactly
178
+ * one range in the suggestion, and that range contains exactly one element.
179
+ *
180
+ * Returns `null` if there is no contained element.
181
+ */
182
+ getContainedElement(): Element | null;
183
+ /**
184
+ * Accepts the suggestion.
185
+ */
186
+ accept(): void;
187
+ /**
188
+ * Discards the suggestion.
189
+ */
190
+ discard(): void;
191
+ /**
192
+ * Returns all suggestions that are in this suggestion chain.
193
+ */
194
+ getAllAdjacentSuggestions(): Array<Suggestion>;
195
+ /**
196
+ * Adds suggestion attribute.
197
+ *
198
+ * Suggestion attributes are custom data that can be set and used by features
199
+ * built around suggestions. Use it to store your feature data with other suggestion data.
200
+ *
201
+ * ```ts
202
+ * suggestion.setAttribute( 'isImportant', true );
203
+ * ```
204
+ *
205
+ * You can group multiple values in an object, using dot notation:
206
+ *
207
+ * ```ts
208
+ * suggestion.setAttribute( 'customData.type', 'image' );
209
+ * suggestion.setAttribute( 'customData.src', 'foo.jpg' );
210
+ * ```
211
+ *
212
+ * Attributes set on the suggestion can be accessed through `attribute` property:
213
+ *
214
+ * ```ts
215
+ * const isImportant = suggestion.attributes.isImportant;
216
+ * const type = suggestion.attributes.customData.type;
217
+ * ```
218
+ *
219
+ * You can also observe `attributes` property or bind other properties to it:
220
+ *
221
+ * ```ts
222
+ * myObj.bind( 'customData' ).to( suggestion, 'attributes', attributes => attributes.customData );
223
+ * ```
224
+ *
225
+ * Whenever `setAttribute()` or `removeAttribute()` is called, `attributes` property
226
+ * is re-set and observables are refreshed.
227
+ */
228
+ setAttribute(name: string, value: unknown): void;
229
+ /**
230
+ * Removes suggestion attribute.
231
+ *
232
+ * See also {@link #setAttribute}
233
+ */
234
+ removeAttribute(name: string): void;
235
+ toJSON(): SuggestionJSON;
236
+ /**
237
+ * Returns a random string that can be used as additional identifier for the marker name for suggestions that are multi range.
238
+ */
239
+ static getMultiRangeId(): string;
240
+ }
241
+ export interface SuggestionOptions {
242
+ id: string;
243
+ type: SuggestionType;
244
+ subType: string | null;
245
+ attributes: {
246
+ [k: string]: unknown;
247
+ };
248
+ author: User;
249
+ creator: User;
250
+ onAccept: Function;
251
+ onDiscard: Function;
252
+ onAttributesChange: Function;
253
+ }
254
+ export interface SuggestionJSON {
255
+ id: string;
256
+ type: string;
257
+ authorId: string;
258
+ createdAt: Date | null;
259
+ hasComments?: boolean;
260
+ data?: FormatData | null;
261
+ attributes: {
262
+ [k: string]: unknown;
263
+ };
264
+ }
265
+ export type SuggestionType = 'insertion' | 'deletion' | 'formatInline' | 'formatBlock';
266
+ export {};
package/src/suggestion.js CHANGED
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x3209=['isIntersecting','size','getMultiRangeId','head','end','decorate','map','getRanges','add','_onAccept','subType','removeMarker','getMarkers','nodeBefore','getItems','_saved','@external','getMarkerNames','author','isMultiRange','commentThread','from','removeAttribute','getAllAdjacentSuggestions','start','change','_model','getFirstMarker','data','setAttribute','next','delete','get','discard','isIntersectingWithRange','getRange','filter','attributes','removeMarkers','createdAt','set','split','previous','clear','_onAttributesChange','nodeAfter','creator','onAttributesChange','hasComments','isInContent','onAccept','_markerNames','push','_onDiscard','type','getFirstRange','substr','authoredAt','addMarkerName','accept'];(function(_0x289cc0,_0x320919){const _0x3ef90a=function(_0x45c2e5){while(--_0x45c2e5){_0x289cc0['push'](_0x289cc0['shift']());}};_0x3ef90a(++_0x320919);}(_0x3209,0x6e));const _0x3ef9=function(_0x289cc0,_0x320919){_0x289cc0=_0x289cc0-0x0;let _0x3ef90a=_0x3209[_0x289cc0];return _0x3ef90a;};import{Element as _0x73cfc3}from'ckeditor5/src/engine';import{ObservableMixin as _0x5ca108,mix as _0x63632,uid as _0x1adafa}from'ckeditor5/src/utils';import{cloneDeep as _0x255cac,isEqual as _0x1ce58c,set as _0x2aeae1,unset as _0x50b38e}from'lodash-es';export default class o{constructor(_0x351fbc,_0xe08bdb){this['id']=_0xe08bdb['id'],this[_0x3ef9('0x4')]=_0xe08bdb[_0x3ef9('0x4')],this[_0x3ef9('0x14')]=_0xe08bdb[_0x3ef9('0x14')]||null,this[_0x3ef9('0x1c')]=_0xe08bdb[_0x3ef9('0x1c')],this[_0x3ef9('0x38')]=_0xe08bdb[_0x3ef9('0x38')]||_0xe08bdb['author'],this['isExternal']=Boolean(_0xe08bdb[_0x3ef9('0x2f')]&&_0xe08bdb[_0x3ef9('0x2f')][_0x3ef9('0x1a')]),this[_0x3ef9('0x26')]=null,this[_0x3ef9('0x24')]=_0x351fbc,this[_0x3ef9('0x13')]=_0xe08bdb[_0x3ef9('0x0')],this[_0x3ef9('0x3')]=_0xe08bdb['onDiscard'],this[_0x3ef9('0x36')]=_0xe08bdb[_0x3ef9('0x39')],this['_markerNames']=new Set(),this[_0x3ef9('0x31')]=null,this[_0x3ef9('0x32')](_0x3ef9('0x7'),null),this[_0x3ef9('0x32')](_0x3ef9('0x2f'),_0xe08bdb[_0x3ef9('0x2f')]||{}),this[_0x3ef9('0x32')](_0x3ef9('0x34'),null),this[_0x3ef9('0x32')](_0x3ef9('0x28'),null),this[_0x3ef9('0x32')](_0x3ef9('0x1e'),null),this['set'](_0x3ef9('0x19'),!0x1),this[_0x3ef9('0xf')](_0x3ef9('0x9')),this[_0x3ef9('0xf')]('discard');}get[_0x3ef9('0xd')](){let _0x53a211=this;for(;_0x53a211[_0x3ef9('0x34')];)_0x53a211=_0x53a211[_0x3ef9('0x34')];return _0x53a211;}get[_0x3ef9('0x3a')](){return!!this['commentThread']&&this[_0x3ef9('0x1e')]['length']>0x0;}get[_0x3ef9('0x1d')](){if(0x0==this[_0x3ef9('0x1')][_0x3ef9('0xb')])return!0x1;return 0x6==Array[_0x3ef9('0x1f')](this[_0x3ef9('0x1')])[0x0][_0x3ef9('0x33')](':')['length'];}get[_0x3ef9('0x3b')](){return null!==this[_0x3ef9('0x25')]();}[_0x3ef9('0x8')](_0xc64907){this[_0x3ef9('0x1')][_0x3ef9('0x12')](_0xc64907);}[_0x3ef9('0x1b')](){return Array[_0x3ef9('0x1f')](this['_markerNames']);}[_0x3ef9('0x16')](){return this['getMarkerNames']()['map'](_0x4c9856=>this[_0x3ef9('0x24')]['markers'][_0x3ef9('0x2a')](_0x4c9856))[_0x3ef9('0x2e')](_0x75c6e2=>_0x75c6e2);}['getFirstMarker'](){return this[_0x3ef9('0x16')]()[0x0]||null;}[_0x3ef9('0x30')](){this[_0x3ef9('0x24')][_0x3ef9('0x23')](_0x4c9699=>{for(const _0xfea378 of this['getMarkers']())_0x4c9699['removeMarker'](_0xfea378);}),this[_0x3ef9('0x1')][_0x3ef9('0x35')]();}[_0x3ef9('0x15')](_0x40a733){this[_0x3ef9('0x24')][_0x3ef9('0x23')](_0x4ad4f7=>{_0x4ad4f7[_0x3ef9('0x15')](_0x40a733);}),this['_markerNames'][_0x3ef9('0x29')](_0x40a733);}['addRange'](_0x135d0a){const _0x48a71b='suggestion:'+this[_0x3ef9('0x4')]+':'+this['subType']+':'+this['id']+':'+this[_0x3ef9('0x38')]['id']+':'+o[_0x3ef9('0xc')]();this[_0x3ef9('0x8')](_0x48a71b),this['_model'][_0x3ef9('0x23')](_0xf4fd43=>{_0xf4fd43['addMarker'](_0x48a71b,{'range':_0x135d0a,'usingOperation':!0x0,'affectsData':!0x0});});}[_0x3ef9('0x2c')](_0x5b4e3d){for(const _0x106506 of this['getRanges']())if(_0x106506[_0x3ef9('0xa')](_0x5b4e3d))return!0x0;return!0x1;}[_0x3ef9('0x11')](){return this['getMarkers']()[_0x3ef9('0x10')](_0xa6ba9a=>_0xa6ba9a[_0x3ef9('0x2d')]());}['getItems'](){return this[_0x3ef9('0x11')]()['reduce']((_0x1a77b7,_0x3cc473)=>[..._0x1a77b7,..._0x3cc473[_0x3ef9('0x18')]()],[]);}[_0x3ef9('0x5')](){return this[_0x3ef9('0x25')]()[_0x3ef9('0x2d')]();}['getContainedElement'](){const _0x3bcefd=this['getRanges']();if(0x1!=_0x3bcefd['length'])return null;const _0x51d73a=_0x3bcefd[0x0],_0x28eb66=_0x51d73a[_0x3ef9('0x22')][_0x3ef9('0x37')],_0x4d1e33=_0x51d73a[_0x3ef9('0xe')][_0x3ef9('0x17')];return _0x28eb66 instanceof _0x73cfc3?_0x28eb66!=_0x4d1e33?null:_0x28eb66:null;}[_0x3ef9('0x9')](){this[_0x3ef9('0x13')](this[_0x3ef9('0x11')](),this[_0x3ef9('0x26')],this[_0x3ef9('0x2f')]),this[_0x3ef9('0x30')]();}[_0x3ef9('0x2b')](){this[_0x3ef9('0x3')](this[_0x3ef9('0x11')](),this[_0x3ef9('0x26')],this[_0x3ef9('0x2f')]),this[_0x3ef9('0x30')]();}[_0x3ef9('0x21')](){const _0x25063d=[];let _0x29bad8=this[_0x3ef9('0xd')];for(;_0x29bad8;)_0x25063d[_0x3ef9('0x2')](_0x29bad8),_0x29bad8=_0x29bad8[_0x3ef9('0x28')];return _0x25063d;}[_0x3ef9('0x27')](_0x16f2e2,_0xd30006){const _0x29b8d9=_0x255cac(this[_0x3ef9('0x2f')]);_0x2aeae1(_0x29b8d9,_0x16f2e2,_0xd30006),_0x1ce58c(_0x29b8d9,this[_0x3ef9('0x2f')])||(this[_0x3ef9('0x2f')]=_0x29b8d9,this[_0x3ef9('0x36')](_0x29b8d9));}[_0x3ef9('0x20')](_0x59a2b3){const _0x3db005=_0x255cac(this['attributes']);_0x50b38e(_0x3db005,_0x59a2b3),_0x1ce58c(_0x3db005,this[_0x3ef9('0x2f')])||(this[_0x3ef9('0x2f')]=_0x3db005,this[_0x3ef9('0x36')](this[_0x3ef9('0x2f')]));}['toJSON'](){return{'id':this['id'],'type':this[_0x3ef9('0x14')]?this['type']+':'+this[_0x3ef9('0x14')]:this[_0x3ef9('0x4')],'authorId':this['creator']['id'],'createdAt':this[_0x3ef9('0x31')],'hasComments':this[_0x3ef9('0x3a')],'data':this[_0x3ef9('0x26')],'attributes':this[_0x3ef9('0x2f')]};}static['getMultiRangeId'](){return _0x1adafa()[_0x3ef9('0x6')](0x1,0x5);}}_0x63632(o,_0x5ca108);
23
+ const _0x1364=['subType','set','addRange','creator','getMarkerNames','isIntersectingWithRange','onAttributesChange','from','removeAttribute','getRange','size','filter','discard','hasComments','head','_onAttributesChange','end','get','getAllAdjacentSuggestions','_markerNames','onAccept','nodeBefore','@external','add','change','clear','getItems','getContainedElement','addMarkerName','start','getMarkers','isExternal','removeMarkers','map','type','_model','author','suggestion:','onDiscard','getRanges','_onDiscard','reduce','getMultiRangeId','substr','isInContent','push','attributes','data','getFirstRange','removeMarker','isMultiRange','createdAt','addMarker','previous','authoredAt','_onAccept','length','toJSON','getFirstMarker','split','setAttribute','accept','decorate','nodeAfter','commentThread'];(function(_0x20bcae,_0x136451){const _0x116048=function(_0xc9f79e){while(--_0xc9f79e){_0x20bcae['push'](_0x20bcae['shift']());}};_0x116048(++_0x136451);}(_0x1364,0x6c));const _0x1160=function(_0x20bcae,_0x136451){_0x20bcae=_0x20bcae-0x0;let _0x116048=_0x1364[_0x20bcae];return _0x116048;};import{Element as _0x4568c0}from'ckeditor5/src/engine';import{ObservableMixin as _0x380a53,uid as _0x32b771}from'ckeditor5/src/utils';import{cloneDeep as _0x15ce27,isEqual as _0x43651e,set as _0x2a2e6a,unset as _0x33b08f}from'lodash-es';export default class u extends _0x380a53(){constructor(_0x501842,_0x45f4a8){super(),this['id']=_0x45f4a8['id'],this[_0x1160('0x38')]=_0x45f4a8[_0x1160('0x38')],this[_0x1160('0x16')]=_0x45f4a8[_0x1160('0x16')]||null,this['author']=_0x45f4a8[_0x1160('0x3a')],this[_0x1160('0x19')]=_0x45f4a8['creator']||_0x45f4a8[_0x1160('0x3a')],this[_0x1160('0x35')]=Boolean(_0x45f4a8[_0x1160('0x3')]&&_0x45f4a8[_0x1160('0x3')][_0x1160('0x2c')]),this[_0x1160('0x4')]=null,this[_0x1160('0x39')]=_0x501842,this[_0x1160('0xc')]=_0x45f4a8[_0x1160('0x2a')],this[_0x1160('0x3e')]=_0x45f4a8[_0x1160('0x3c')],this['_onAttributesChange']=_0x45f4a8[_0x1160('0x1c')],this[_0x1160('0x29')]=new Set(),this['createdAt']=null,this[_0x1160('0x17')](_0x1160('0xb'),null),this[_0x1160('0x17')](_0x1160('0x3'),_0x45f4a8[_0x1160('0x3')]||{}),this[_0x1160('0x17')]('previous',null),this[_0x1160('0x17')]('next',null),this[_0x1160('0x17')](_0x1160('0x15'),null),this['set']('_saved',!0x1),this[_0x1160('0x13')]('accept'),this[_0x1160('0x13')](_0x1160('0x22'));}get['head'](){let _0xcf41fc=this;for(;_0xcf41fc[_0x1160('0xa')];)_0xcf41fc=_0xcf41fc[_0x1160('0xa')];return _0xcf41fc;}get[_0x1160('0x23')](){return!!this[_0x1160('0x15')]&&this[_0x1160('0x15')][_0x1160('0xd')]>0x0;}get[_0x1160('0x7')](){if(0x0==this['_markerNames'][_0x1160('0x20')])return!0x1;return 0x6==Array['from'](this[_0x1160('0x29')])[0x0][_0x1160('0x10')](':')[_0x1160('0xd')];}get[_0x1160('0x1')](){return null!==this['getFirstMarker']();}[_0x1160('0x32')](_0x1f6488){this['_markerNames'][_0x1160('0x2d')](_0x1f6488);}[_0x1160('0x1a')](){return Array[_0x1160('0x1d')](this[_0x1160('0x29')]);}[_0x1160('0x34')](){return this[_0x1160('0x1a')]()[_0x1160('0x37')](_0x76e787=>this['_model']['markers'][_0x1160('0x27')](_0x76e787))[_0x1160('0x21')](_0x2d588d=>_0x2d588d);}[_0x1160('0xf')](){return this['getMarkers']()[0x0]||null;}[_0x1160('0x36')](){this[_0x1160('0x39')][_0x1160('0x2e')](_0x1b50e4=>{for(const _0x43e862 of this[_0x1160('0x34')]())_0x1b50e4['removeMarker'](_0x43e862);}),this[_0x1160('0x29')][_0x1160('0x2f')]();}[_0x1160('0x6')](_0x2eafb1){this[_0x1160('0x39')][_0x1160('0x2e')](_0x454738=>{_0x454738[_0x1160('0x6')](_0x2eafb1);}),this[_0x1160('0x29')]['delete'](_0x2eafb1);}[_0x1160('0x18')](_0x56099d){const _0x56eb26=_0x1160('0x3b')+this[_0x1160('0x38')]+':'+this[_0x1160('0x16')]+':'+this['id']+':'+this[_0x1160('0x19')]['id']+':'+u[_0x1160('0x40')]();this[_0x1160('0x32')](_0x56eb26),this[_0x1160('0x39')][_0x1160('0x2e')](_0x66d7af=>{_0x66d7af[_0x1160('0x9')](_0x56eb26,{'range':_0x56099d,'usingOperation':!0x0,'affectsData':!0x0});});}[_0x1160('0x1b')](_0x9aca45){for(const _0x1af23a of this[_0x1160('0x3d')]())if(_0x1af23a['isIntersecting'](_0x9aca45))return!0x0;return!0x1;}[_0x1160('0x3d')](){return this[_0x1160('0x34')]()[_0x1160('0x37')](_0x1fe8a4=>_0x1fe8a4[_0x1160('0x1f')]());}[_0x1160('0x30')](){return this['getRanges']()[_0x1160('0x3f')]((_0x249108,_0x4d78ba)=>[..._0x249108,..._0x4d78ba[_0x1160('0x30')]()],[]);}[_0x1160('0x5')](){var _0x1f8678;return(null===(_0x1f8678=this[_0x1160('0xf')]())||void 0x0===_0x1f8678?void 0x0:_0x1f8678['getRange']())||null;}[_0x1160('0x31')](){const _0x55d001=this[_0x1160('0x3d')]();if(0x1!=_0x55d001[_0x1160('0xd')])return null;const _0x25f55e=_0x55d001[0x0],_0x55cdad=_0x25f55e[_0x1160('0x33')][_0x1160('0x14')],_0x5da427=_0x25f55e[_0x1160('0x26')][_0x1160('0x2b')];return _0x55cdad instanceof _0x4568c0?_0x55cdad!=_0x5da427?null:_0x55cdad:null;}[_0x1160('0x12')](){this[_0x1160('0xc')](this[_0x1160('0x3d')](),this[_0x1160('0x4')],this[_0x1160('0x3')]),this['removeMarkers']();}[_0x1160('0x22')](){this[_0x1160('0x3e')](this[_0x1160('0x3d')](),this[_0x1160('0x4')],this[_0x1160('0x3')]),this[_0x1160('0x36')]();}[_0x1160('0x28')](){const _0x5552dd=[];let _0x39d7e3=this[_0x1160('0x24')];for(;_0x39d7e3;)_0x5552dd[_0x1160('0x2')](_0x39d7e3),_0x39d7e3=_0x39d7e3['next'];return _0x5552dd;}[_0x1160('0x11')](_0x16c4c8,_0x33831c){const _0x1f593b=_0x15ce27(this['attributes']);_0x2a2e6a(_0x1f593b,_0x16c4c8,_0x33831c),_0x43651e(_0x1f593b,this['attributes'])||(this[_0x1160('0x3')]=_0x1f593b,this[_0x1160('0x25')](_0x1f593b));}[_0x1160('0x1e')](_0x3a764b){const _0x14c49d=_0x15ce27(this[_0x1160('0x3')]);_0x33b08f(_0x14c49d,_0x3a764b),_0x43651e(_0x14c49d,this[_0x1160('0x3')])||(this[_0x1160('0x3')]=_0x14c49d,this[_0x1160('0x25')](this[_0x1160('0x3')]));}[_0x1160('0xe')](){return{'id':this['id'],'type':this[_0x1160('0x16')]?this[_0x1160('0x38')]+':'+this[_0x1160('0x16')]:this[_0x1160('0x38')],'authorId':this[_0x1160('0x19')]['id'],'createdAt':this[_0x1160('0x8')],'hasComments':this['hasComments'],'data':this[_0x1160('0x4')],'attributes':this[_0x1160('0x3')]};}static[_0x1160('0x40')](){return _0x32b771()[_0x1160('0x0')](0x1,0x5);}}
@@ -0,0 +1,151 @@
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
+ }
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x5d89=['$1\x20$2','registerDescriptionCallback','push','*Split:*\x20%0','textProxy','Container','isEmpty','start','addObject','_resolveDescriptionItems','elementEnd','get','_customCallbacks','checkChild','getFirstRange','getItemLabel','data','ELEMENT_SPACE','name','_schema','REPLACE_TEXT','match','insertion','function','*Remove:*\x20%0','length','elementStart','removeContainer','Object','getDescriptions','element','text','isEqual','isObject','_itemLabels','end','item','remove','removeEmptyContainer','*Merge:*\x20%0','EmptyContainer','*Insert:*\x20%0','type','softBreak','indexOf','removeObject','quantity','registerElementLabel','_locale','nextSibling','add','_addDescriptionItems','addEmptyContainer','getWalker','matchingCallback','replace','previousSibling','_itemLabelsCallbacks','deletion','$text'];(function(_0x308abe,_0x5d8932){const _0x1610dc=function(_0x51e90a){while(--_0x51e90a){_0x308abe['push'](_0x308abe['shift']());}};_0x1610dc(++_0x5d8932);}(_0x5d89,0x130));const _0x1610=function(_0x308abe,_0x5d8932){_0x308abe=_0x308abe-0x0;let _0x1610dc=_0x5d89[_0x308abe];return _0x1610dc;};import{getTranslation as _0x26adf6}from'./utils/common-translations';import{priorities as _0x272fb0,insertToPriorityArray as _0x16b162}from'ckeditor5/src/utils';export default class f{constructor(_0x5313c2,_0x1871d5){this[_0x1610('0x8')]=[],this[_0x1610('0x1e')]=new Map(),this['_itemLabelsCallbacks']=[],this[_0x1610('0xf')]=_0x5313c2,this['_locale']=_0x1871d5;}[_0x1610('0x19')](_0x4f6e08){const _0x153de1=[];for(let _0x1f3bec=0x0;_0x1f3bec<_0x4f6e08[_0x1610('0x15')];_0x1f3bec++){const _0x3bdd8c=_0x4f6e08[_0x1f3bec];if(!_0x3bdd8c['isInContent'])continue;let _0x743f5e=!0x1;for(const _0x2324e7 of this[_0x1610('0x8')]){const _0x3685fe=_0x2324e7(_0x3bdd8c);if(_0x3685fe){_0x3685fe[_0x1610('0x26')]&&_0x153de1[_0x1610('0x3a')](_0x3685fe),_0x743f5e=!0x0;break;}}if(!_0x743f5e){this[_0x1610('0x2f')](_0x153de1,_0x3bdd8c);const _0x265c0f=_0x4f6e08[_0x1f3bec+0x1];if(_0x265c0f&&!_0x3bdd8c[_0x1610('0xa')]()[_0x1610('0x1f')][_0x1610('0x1c')](_0x265c0f[_0x1610('0xa')]()[_0x1610('0x3')])){const _0x4aaf97=_0x153de1[_0x153de1[_0x1610('0x15')]-0x1],_0x4dc529=_0x1610('0x12')==_0x3bdd8c[_0x1610('0x26')]?_0x1610('0x2e'):'remove';_0x4aaf97&&'text'==_0x4aaf97[_0x1610('0x26')]&&(_0x4aaf97[_0x4dc529]+='\x0a');}}}return this['_resolveDescriptionItems'](_0x153de1);}[_0x1610('0x39')](_0x57424b){this[_0x1610('0x8')][_0x1610('0x3a')](_0x57424b);}[_0x1610('0x2b')](_0x30491e,_0x54386a,_0x2eaae9=_0x272fb0['normal']){_0x1610('0x13')==typeof _0x30491e?_0x16b162(this[_0x1610('0x35')],{'matchingCallback':_0x30491e,'label':_0x54386a,'priority':_0x2eaae9}):this[_0x1610('0x1e')]['set'](_0x30491e,_0x54386a);}[_0x1610('0xb')](_0x5bf834,_0x10643d=0x1){let _0x57c73e;for(const _0x4b0abd of this[_0x1610('0x35')])if(_0x4b0abd[_0x1610('0x32')](_0x5bf834)){_0x57c73e=_0x4b0abd['label'];break;}return _0x57c73e||(_0x57c73e=this[_0x1610('0x1e')][_0x1610('0x7')](_0x5bf834[_0x1610('0xe')])),_0x57c73e?_0x57c73e(_0x10643d):0x1!==_0x10643d?_0x10643d+'\x20'+_0x5bf834[_0x1610('0xe')]+'s':''+_0x5bf834[_0x1610('0xe')];}['_addDescriptionItems'](_0x5141d6,_0x12abf3){const _0x3f270c=_0x12abf3[_0x1610('0xa')]()[_0x1610('0x31')](),_0x23841d=_0x1610('0x12')==_0x12abf3[_0x1610('0x26')]?_0x1610('0x2e'):'remove';for(const _0x309a33 of _0x3f270c){const _0x1e9bea=_0x309a33['item'],_0x1b1e35=_0x5141d6[_0x5141d6[_0x1610('0x15')]-0x1];if(_0x1e9bea['is'](_0x1610('0x0')))_0x1b1e35&&_0x1b1e35[_0x1610('0x26')]['indexOf']('Container')>-0x1&&_0x5141d6['pop'](),_0x1b1e35&&_0x1610('0x1b')==_0x1b1e35[_0x1610('0x26')]?_0x1b1e35[_0x23841d]+=_0x1e9bea[_0x1610('0xc')]:_0x5141d6[_0x1610('0x3a')]({'type':_0x1610('0x1b'),'add':_0x1610('0x2e')==_0x23841d?_0x1e9bea[_0x1610('0xc')]:'','remove':_0x1610('0x21')==_0x23841d?_0x1e9bea['data']:''});else{if(this['_schema']['isObject'](_0x1e9bea)){if(_0x1b1e35&&_0x1b1e35['type'][_0x1610('0x28')](_0x1610('0x1'))>-0x1&&_0x5141d6['pop'](),_0x1610('0x6')==_0x309a33[_0x1610('0x26')])continue;_0x1b1e35&&_0x1b1e35[_0x1610('0x26')]==_0x23841d+_0x1610('0x18')&&_0x1b1e35[_0x1610('0x1a')]['name']==_0x1e9bea[_0x1610('0xe')]?_0x1b1e35[_0x1610('0x2a')]++:_0x5141d6[_0x1610('0x3a')]({'type':_0x23841d+_0x1610('0x18'),'element':_0x1e9bea,'quantity':0x1}),_0x3f270c['skip'](_0x3961cf=>!(_0x1610('0x6')==_0x3961cf[_0x1610('0x26')]&&_0x3961cf[_0x1610('0x20')]==_0x1e9bea));}else{if(this['_schema'][_0x1610('0x9')](_0x1e9bea,_0x1610('0x37'))||_0x1e9bea['is']('element',_0x1610('0x27'))){if(_0x1610('0x2e')==_0x23841d&&_0x1610('0x16')==_0x309a33[_0x1610('0x26')]||_0x1610('0x21')==_0x23841d&&'elementEnd'==_0x309a33[_0x1610('0x26')])continue;if(_0x1b1e35&&-0x1==_0x1b1e35[_0x1610('0x26')][_0x1610('0x28')](_0x1610('0x1'))){_0x1610('0x1b')==_0x1b1e35[_0x1610('0x26')]&&(_0x1b1e35[_0x23841d]+='\x0a');continue;}let _0x53b9a2;if(_0x53b9a2=_0x1610('0x2e')==_0x23841d?_0x1e9bea[_0x1610('0x2d')]&&!this['_schema']['isObject'](_0x1e9bea['nextSibling'])?_0x1e9bea['nextSibling']:null:_0x1e9bea[_0x1610('0x34')]&&!this[_0x1610('0xf')][_0x1610('0x1d')](_0x1e9bea[_0x1610('0x34')])?_0x1e9bea[_0x1610('0x34')]:null,_0x1e9bea[_0x1610('0x2')]||_0x53b9a2&&_0x53b9a2['isEmpty']){const _0x2cb29d=_0x53b9a2&&_0x53b9a2['isEmpty']?_0x53b9a2:_0x1e9bea;_0x1b1e35&&_0x1b1e35[_0x1610('0x26')]==_0x23841d+_0x1610('0x24')&&_0x1b1e35[_0x1610('0x1a')][_0x1610('0xe')]==_0x2cb29d['name']?_0x1b1e35['quantity']++:_0x5141d6[_0x1610('0x3a')]({'type':_0x23841d+_0x1610('0x24'),'element':_0x2cb29d,'quantity':0x1});}else _0x5141d6[_0x1610('0x3a')]({'type':_0x23841d+_0x1610('0x1'),'element':_0x1e9bea});}}}}}[_0x1610('0x5')](_0x707ccb){const _0x4530e7=this[_0x1610('0x2c')],_0x40e093=[];for(const _0x1b3ea of _0x707ccb){switch(_0x1b3ea[_0x1610('0x26')]){case _0x1610('0x1b'):if(_0x1b3ea[_0x1610('0x2e')]=_0x1b3ea['add'][_0x1610('0x33')](/(\S)\u000A+(\S)/g,_0x1610('0x38'))[_0x1610('0x33')](/\u000A/g,''),_0x1b3ea[_0x1610('0x21')]=_0x1b3ea[_0x1610('0x21')][_0x1610('0x33')](/(\S)\u000A+(\S)/g,_0x1610('0x38'))['replace'](/\u000A/g,''),''!=_0x1b3ea[_0x1610('0x2e')]&&''!=_0x1b3ea['remove']){_0x40e093[_0x1610('0x3a')]({'type':_0x1610('0x33'),'content':_0x26adf6(_0x4530e7,_0x1610('0x10'),['\x22'+_0x1b3ea[_0x1610('0x21')]+'\x22','\x22'+_0x1b3ea[_0x1610('0x2e')]+'\x22'])});continue;}if(null!=_0x1b3ea[_0x1610('0x2e')][_0x1610('0x11')](/^ +$/)){_0x40e093[_0x1610('0x3a')]({'type':_0x1610('0x12'),'content':_0x26adf6(_0x4530e7,_0x1610('0x25'),_0x26adf6(_0x4530e7,_0x1610('0xd'),_0x1b3ea[_0x1610('0x2e')][_0x1610('0x15')]))});continue;}if(null!=_0x1b3ea['remove'][_0x1610('0x11')](/^ +$/)){_0x40e093[_0x1610('0x3a')]({'type':_0x1610('0x36'),'content':_0x26adf6(_0x4530e7,'*Remove:*\x20%0',_0x26adf6(_0x4530e7,'ELEMENT_SPACE',_0x1b3ea[_0x1610('0x21')][_0x1610('0x15')]))});continue;}if(''!=_0x1b3ea['add']){_0x40e093['push']({'type':_0x1610('0x12'),'content':_0x26adf6(_0x4530e7,_0x1610('0x25'),'\x22'+_0x1b3ea[_0x1610('0x2e')]+'\x22')});continue;}_0x40e093['push']({'type':'deletion','content':_0x26adf6(_0x4530e7,'*Remove:*\x20%0','\x22'+_0x1b3ea[_0x1610('0x21')]+'\x22')});continue;case _0x1610('0x30'):case _0x1610('0x4'):_0x40e093[_0x1610('0x3a')]({'type':'insertion','content':_0x26adf6(_0x4530e7,_0x1610('0x25'),this[_0x1610('0xb')](_0x1b3ea[_0x1610('0x1a')],_0x1b3ea['quantity']))});continue;case _0x1610('0x22'):case _0x1610('0x29'):_0x40e093[_0x1610('0x3a')]({'type':_0x1610('0x36'),'content':_0x26adf6(_0x4530e7,_0x1610('0x14'),this[_0x1610('0xb')](_0x1b3ea[_0x1610('0x1a')],_0x1b3ea[_0x1610('0x2a')]))});continue;case'addContainer':_0x40e093[_0x1610('0x3a')]({'type':_0x1610('0x12'),'content':_0x26adf6(_0x4530e7,_0x1610('0x3b'),this[_0x1610('0xb')](_0x1b3ea['element'],_0x1b3ea[_0x1610('0x2a')]))});continue;case _0x1610('0x17'):_0x40e093[_0x1610('0x3a')]({'type':_0x1610('0x36'),'content':_0x26adf6(_0x4530e7,_0x1610('0x23'),this[_0x1610('0xb')](_0x1b3ea['element'],_0x1b3ea[_0x1610('0x2a')]))});continue;}_0x40e093['push'](_0x1b3ea);}return _0x40e093;}}
23
+ const _0x16a8=['addObject','push','_addDescriptionItems','_schema','get','item','registerDescriptionCallback','addEmptyContainer','end','function','deletion','skip','replace','quantity','match','_itemLabels','*Insert:*\x20%0','REPLACE_TEXT','add','set','_itemLabelsCallbacks','text','elementEnd','isEqual','data','_resolveDescriptionItems','element','getFirstRange','removeObject','elementStart','type','nextSibling','checkChild','getItemLabel','_customCallbacks','remove','label','normal','isEmpty','isInContent','removeContainer','previousSibling','indexOf','pop','getDescriptions','removeEmptyContainer','$textProxy','Container','*Remove:*\x20%0','isObject','ELEMENT_SPACE','Object','addContainer','*Merge:*\x20%0','getWalker','*Split:*\x20%0','EmptyContainer','name','length','$1\x20$2','start','insertion'];(function(_0x9933b5,_0x16a864){const _0x28f4c8=function(_0xb3cc5a){while(--_0xb3cc5a){_0x9933b5['push'](_0x9933b5['shift']());}};_0x28f4c8(++_0x16a864);}(_0x16a8,0x8c));const _0x28f4=function(_0x9933b5,_0x16a864){_0x9933b5=_0x9933b5-0x0;let _0x28f4c8=_0x16a8[_0x9933b5];return _0x28f4c8;};import{getTranslation as _0xf62a54}from'./utils/common-translations';import{priorities as _0x32d0b2,insertToPriorityArray as _0x429c91}from'ckeditor5/src/utils';export default class m{constructor(_0x209faa,_0x5904e7){this[_0x28f4('0x12')]=[],this[_0x28f4('0x3d')]=new Map(),this[_0x28f4('0x4')]=[],this['_schema']=_0x209faa,this['_locale']=_0x5904e7;}[_0x28f4('0x1c')](_0x1fabbd){const _0x1b0513=[];for(let _0x2c5dbd=0x0;_0x2c5dbd<_0x1fabbd[_0x28f4('0x2a')];_0x2c5dbd++){const _0x87955b=_0x1fabbd[_0x2c5dbd];if(!_0x87955b[_0x28f4('0x17')])continue;let _0x492767=!0x1;for(const _0x1525b0 of this[_0x28f4('0x12')]){const _0x57170b=_0x1525b0(_0x87955b);if(_0x57170b){'type'in _0x57170b&&_0x1b0513['push'](_0x57170b),_0x492767=!0x0;break;}}if(!_0x492767){this[_0x28f4('0x30')](_0x1b0513,_0x87955b);const _0x413697=_0x1fabbd[_0x2c5dbd+0x1];if(_0x413697&&!_0x87955b['getFirstRange']()[_0x28f4('0x36')][_0x28f4('0x7')](_0x413697[_0x28f4('0xb')]()[_0x28f4('0x2c')])){const _0x461c45=_0x1b0513[_0x1b0513[_0x28f4('0x2a')]-0x1],_0x4e5cfd='insertion'==_0x87955b['type']?_0x28f4('0x2'):_0x28f4('0x13');_0x461c45&&_0x28f4('0x5')==_0x461c45[_0x28f4('0xe')]&&(_0x461c45[_0x4e5cfd]+='\x0a');}}}return this['_resolveDescriptionItems'](_0x1b0513);}[_0x28f4('0x34')](_0x5d3bca){this['_customCallbacks'][_0x28f4('0x2f')](_0x5d3bca);}['registerElementLabel'](_0x1398ca,_0x403dcc,_0xb721d0=_0x32d0b2[_0x28f4('0x15')]){_0x28f4('0x37')==typeof _0x1398ca?_0x429c91(this[_0x28f4('0x4')],{'matchingCallback':_0x1398ca,'label':_0x403dcc,'priority':_0xb721d0}):this['_itemLabels'][_0x28f4('0x3')](_0x1398ca,_0x403dcc);}['getItemLabel'](_0x3d2cc5,_0x33939d=0x1){let _0x200430;for(const _0x170920 of this[_0x28f4('0x4')])if(_0x170920['matchingCallback'](_0x3d2cc5)){_0x200430=_0x170920[_0x28f4('0x14')];break;}return _0x200430||(_0x200430=this['_itemLabels'][_0x28f4('0x32')](_0x3d2cc5[_0x28f4('0x29')])),_0x200430?_0x200430(_0x33939d):0x1!==_0x33939d?_0x33939d+'\x20'+_0x3d2cc5['name']+'s':''+_0x3d2cc5[_0x28f4('0x29')];}['_addDescriptionItems'](_0x387b7a,_0x4ca9bb){const _0x3dafd5=_0x4ca9bb[_0x28f4('0xb')]()[_0x28f4('0x26')](),_0x5e61a6=_0x28f4('0x2d')==_0x4ca9bb[_0x28f4('0xe')]?_0x28f4('0x2'):'remove';for(const _0xda5ef5 of _0x3dafd5){const _0x38d8b1=_0xda5ef5[_0x28f4('0x33')],_0xba1d7=_0x387b7a[_0x387b7a[_0x28f4('0x2a')]-0x1];if(_0x38d8b1['is'](_0x28f4('0x1e')))_0xba1d7&&_0xba1d7[_0x28f4('0xe')][_0x28f4('0x1a')]('Container')>-0x1&&_0x387b7a[_0x28f4('0x1b')](),_0xba1d7&&'text'==_0xba1d7[_0x28f4('0xe')]?_0xba1d7[_0x5e61a6]+=_0x38d8b1[_0x28f4('0x8')]:_0x387b7a[_0x28f4('0x2f')]({'type':_0x28f4('0x5'),'add':'add'==_0x5e61a6?_0x38d8b1['data']:'','remove':_0x28f4('0x13')==_0x5e61a6?_0x38d8b1[_0x28f4('0x8')]:''});else{if(this['_schema']['isObject'](_0x38d8b1)){const _0x576282=_0x38d8b1;if(_0xba1d7&&_0xba1d7[_0x28f4('0xe')][_0x28f4('0x1a')]('Container')>-0x1&&_0x387b7a[_0x28f4('0x1b')](),_0x28f4('0x6')==_0xda5ef5[_0x28f4('0xe')])continue;_0xba1d7&&_0xba1d7['type']==_0x5e61a6+'Object'&&_0xba1d7[_0x28f4('0xa')]['name']==_0x576282['name']?_0xba1d7['quantity']++:_0x387b7a[_0x28f4('0x2f')]({'type':_0x5e61a6+_0x28f4('0x23'),'element':_0x576282,'quantity':0x1}),_0x3dafd5[_0x28f4('0x39')](_0x33a1ab=>!(_0x28f4('0x6')==_0x33a1ab['type']&&_0x33a1ab['item']==_0x38d8b1));}else{if(this[_0x28f4('0x31')][_0x28f4('0x10')](_0x38d8b1,'$text')||_0x38d8b1['is'](_0x28f4('0xa'),'softBreak')){const _0x318a72=_0x38d8b1;if(_0x28f4('0x2')==_0x5e61a6&&_0x28f4('0xd')==_0xda5ef5['type']||'remove'==_0x5e61a6&&_0x28f4('0x6')==_0xda5ef5[_0x28f4('0xe')])continue;if(_0xba1d7&&-0x1==_0xba1d7[_0x28f4('0xe')]['indexOf'](_0x28f4('0x1f'))){'text'==_0xba1d7[_0x28f4('0xe')]&&(_0xba1d7[_0x5e61a6]+='\x0a');continue;}let _0x5a5d8d;if(_0x5a5d8d=_0x28f4('0x2')==_0x5e61a6?_0x318a72[_0x28f4('0xf')]&&!this[_0x28f4('0x31')][_0x28f4('0x21')](_0x318a72[_0x28f4('0xf')])?_0x318a72[_0x28f4('0xf')]:null:_0x318a72[_0x28f4('0x19')]&&!this['_schema'][_0x28f4('0x21')](_0x318a72[_0x28f4('0x19')])?_0x318a72['previousSibling']:null,_0x318a72[_0x28f4('0x16')]||_0x5a5d8d&&_0x5a5d8d['isEmpty']){const _0x55368a=_0x5a5d8d&&_0x5a5d8d[_0x28f4('0x16')]?_0x5a5d8d:_0x318a72;_0xba1d7&&_0xba1d7[_0x28f4('0xe')]==_0x5e61a6+_0x28f4('0x28')&&_0xba1d7[_0x28f4('0xa')]['name']==_0x55368a[_0x28f4('0x29')]?_0xba1d7[_0x28f4('0x3b')]++:_0x387b7a[_0x28f4('0x2f')]({'type':_0x5e61a6+_0x28f4('0x28'),'element':_0x55368a,'quantity':0x1});}else _0x387b7a['push']({'type':_0x5e61a6+'Container','element':_0x318a72});}}}}}[_0x28f4('0x9')](_0x1e5331){const _0x59f5c4=this['_locale'],_0x12ae52=[];for(const _0x2ce6fa of _0x1e5331){switch(_0x2ce6fa[_0x28f4('0xe')]){case _0x28f4('0x5'):if(_0x2ce6fa[_0x28f4('0x2')]=_0x2ce6fa[_0x28f4('0x2')][_0x28f4('0x3a')](/(\S)\u000A+(\S)/g,_0x28f4('0x2b'))['replace'](/\u000A/g,''),_0x2ce6fa[_0x28f4('0x13')]=_0x2ce6fa['remove'][_0x28f4('0x3a')](/(\S)\u000A+(\S)/g,_0x28f4('0x2b'))[_0x28f4('0x3a')](/\u000A/g,''),''!=_0x2ce6fa[_0x28f4('0x2')]&&''!=_0x2ce6fa[_0x28f4('0x13')]){_0x12ae52['push']({'type':_0x28f4('0x3a'),'content':_0xf62a54(_0x59f5c4,_0x28f4('0x1'),['\x22'+_0x2ce6fa[_0x28f4('0x13')]+'\x22','\x22'+_0x2ce6fa['add']+'\x22'])});continue;}if(null!=_0x2ce6fa[_0x28f4('0x2')][_0x28f4('0x3c')](/^ +$/)){_0x12ae52['push']({'type':'insertion','content':_0xf62a54(_0x59f5c4,_0x28f4('0x0'),_0xf62a54(_0x59f5c4,_0x28f4('0x22'),_0x2ce6fa[_0x28f4('0x2')][_0x28f4('0x2a')]))});continue;}if(null!=_0x2ce6fa[_0x28f4('0x13')][_0x28f4('0x3c')](/^ +$/)){_0x12ae52[_0x28f4('0x2f')]({'type':'deletion','content':_0xf62a54(_0x59f5c4,_0x28f4('0x20'),_0xf62a54(_0x59f5c4,_0x28f4('0x22'),_0x2ce6fa[_0x28f4('0x13')][_0x28f4('0x2a')]))});continue;}if(''!=_0x2ce6fa[_0x28f4('0x2')]){_0x12ae52[_0x28f4('0x2f')]({'type':_0x28f4('0x2d'),'content':_0xf62a54(_0x59f5c4,_0x28f4('0x0'),'\x22'+_0x2ce6fa['add']+'\x22')});continue;}_0x12ae52[_0x28f4('0x2f')]({'type':_0x28f4('0x38'),'content':_0xf62a54(_0x59f5c4,_0x28f4('0x20'),'\x22'+_0x2ce6fa[_0x28f4('0x13')]+'\x22')});continue;case _0x28f4('0x35'):case _0x28f4('0x2e'):_0x12ae52['push']({'type':_0x28f4('0x2d'),'content':_0xf62a54(_0x59f5c4,_0x28f4('0x0'),this[_0x28f4('0x11')](_0x2ce6fa[_0x28f4('0xa')],_0x2ce6fa[_0x28f4('0x3b')]))});continue;case _0x28f4('0x1d'):case _0x28f4('0xc'):_0x12ae52[_0x28f4('0x2f')]({'type':_0x28f4('0x38'),'content':_0xf62a54(_0x59f5c4,_0x28f4('0x20'),this[_0x28f4('0x11')](_0x2ce6fa[_0x28f4('0xa')],_0x2ce6fa['quantity']))});continue;case _0x28f4('0x24'):_0x12ae52[_0x28f4('0x2f')]({'type':_0x28f4('0x2d'),'content':_0xf62a54(_0x59f5c4,_0x28f4('0x27'),this[_0x28f4('0x11')](_0x2ce6fa[_0x28f4('0xa')],_0x2ce6fa[_0x28f4('0x3b')]))});continue;case _0x28f4('0x18'):_0x12ae52[_0x28f4('0x2f')]({'type':_0x28f4('0x38'),'content':_0xf62a54(_0x59f5c4,_0x28f4('0x25'),this[_0x28f4('0x11')](_0x2ce6fa[_0x28f4('0xa')],_0x2ce6fa[_0x28f4('0x3b')]))});continue;}_0x12ae52['push'](_0x2ce6fa);}return _0x12ae52;}}