@ckeditor/ckeditor5-track-changes 40.0.0 → 40.2.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 (232) hide show
  1. package/CHANGELOG.md +15 -15
  2. package/LICENSE.md +3 -3
  3. package/README.md +1 -1
  4. package/build/track-changes.js +2 -2
  5. package/build/translations/ar.js +1 -1
  6. package/build/translations/az.js +1 -1
  7. package/build/translations/bg.js +1 -1
  8. package/build/translations/bn.js +1 -1
  9. package/build/translations/ca.js +1 -1
  10. package/build/translations/cs.js +1 -1
  11. package/build/translations/da.js +1 -1
  12. package/build/translations/de.js +1 -1
  13. package/build/translations/el.js +1 -1
  14. package/build/translations/en-au.js +1 -1
  15. package/build/translations/es.js +1 -1
  16. package/build/translations/et.js +1 -1
  17. package/build/translations/fi.js +1 -1
  18. package/build/translations/fr.js +1 -1
  19. package/build/translations/gl.js +1 -1
  20. package/build/translations/he.js +1 -1
  21. package/build/translations/hi.js +1 -1
  22. package/build/translations/hr.js +1 -1
  23. package/build/translations/hu.js +1 -1
  24. package/build/translations/id.js +1 -1
  25. package/build/translations/it.js +1 -1
  26. package/build/translations/ja.js +1 -1
  27. package/build/translations/ko.js +1 -1
  28. package/build/translations/lt.js +1 -1
  29. package/build/translations/lv.js +1 -1
  30. package/build/translations/ms.js +1 -1
  31. package/build/translations/nl.js +1 -1
  32. package/build/translations/no.js +1 -1
  33. package/build/translations/pl.js +1 -1
  34. package/build/translations/pt-br.js +1 -1
  35. package/build/translations/pt.js +1 -1
  36. package/build/translations/ro.js +1 -1
  37. package/build/translations/ru.js +1 -1
  38. package/build/translations/sk.js +1 -1
  39. package/build/translations/sq.js +1 -1
  40. package/build/translations/sr-latn.js +1 -1
  41. package/build/translations/sr.js +1 -1
  42. package/build/translations/sv.js +1 -1
  43. package/build/translations/th.js +1 -1
  44. package/build/translations/tk.js +1 -1
  45. package/build/translations/tr.js +1 -1
  46. package/build/translations/tt.js +1 -1
  47. package/build/translations/uk.js +1 -1
  48. package/build/translations/ur.js +1 -1
  49. package/build/translations/vi.js +1 -1
  50. package/build/translations/zh-cn.js +1 -1
  51. package/build/translations/zh.js +1 -1
  52. package/lang/contexts.json +20 -1
  53. package/lang/translations/ar.po +78 -2
  54. package/lang/translations/az.po +77 -1
  55. package/lang/translations/bg.po +78 -2
  56. package/lang/translations/bn.po +78 -2
  57. package/lang/translations/ca.po +78 -2
  58. package/lang/translations/cs.po +78 -2
  59. package/lang/translations/da.po +78 -2
  60. package/lang/translations/de.po +78 -2
  61. package/lang/translations/el.po +78 -2
  62. package/lang/translations/en-au.po +78 -2
  63. package/lang/translations/en.po +78 -2
  64. package/lang/translations/es.po +78 -2
  65. package/lang/translations/et.po +78 -2
  66. package/lang/translations/fi.po +78 -2
  67. package/lang/translations/fr.po +78 -2
  68. package/lang/translations/gl.po +90 -14
  69. package/lang/translations/he.po +78 -2
  70. package/lang/translations/hi.po +78 -2
  71. package/lang/translations/hr.po +78 -2
  72. package/lang/translations/hu.po +78 -2
  73. package/lang/translations/id.po +78 -2
  74. package/lang/translations/it.po +78 -2
  75. package/lang/translations/ja.po +78 -2
  76. package/lang/translations/ko.po +78 -2
  77. package/lang/translations/lt.po +78 -2
  78. package/lang/translations/lv.po +78 -2
  79. package/lang/translations/ms.po +78 -2
  80. package/lang/translations/nl.po +78 -2
  81. package/lang/translations/no.po +78 -2
  82. package/lang/translations/pl.po +78 -2
  83. package/lang/translations/pt-br.po +96 -20
  84. package/lang/translations/pt.po +78 -2
  85. package/lang/translations/ro.po +78 -2
  86. package/lang/translations/ru.po +78 -2
  87. package/lang/translations/sk.po +78 -2
  88. package/lang/translations/sq.po +77 -1
  89. package/lang/translations/sr-latn.po +78 -2
  90. package/lang/translations/sr.po +78 -2
  91. package/lang/translations/sv.po +78 -2
  92. package/lang/translations/th.po +78 -2
  93. package/lang/translations/tk.po +77 -1
  94. package/lang/translations/tr.po +78 -2
  95. package/lang/translations/tt.po +77 -1
  96. package/lang/translations/uk.po +78 -2
  97. package/lang/translations/ur.po +77 -1
  98. package/lang/translations/vi.po +78 -2
  99. package/lang/translations/zh-cn.po +78 -2
  100. package/lang/translations/zh.po +78 -2
  101. package/package.json +3 -3
  102. package/src/augmentation.d.ts +40 -40
  103. package/src/commands/acceptsuggestioncommand.d.ts +24 -24
  104. package/src/commands/acceptsuggestioncommand.js +1 -1
  105. package/src/commands/discardsuggestioncommand.d.ts +24 -24
  106. package/src/commands/discardsuggestioncommand.js +1 -1
  107. package/src/commands/executeonallsuggestionscommand.d.ts +24 -24
  108. package/src/commands/executeonallsuggestionscommand.js +1 -1
  109. package/src/commands/executeonselectedsuggestionscommand.d.ts +24 -24
  110. package/src/commands/executeonselectedsuggestionscommand.js +1 -1
  111. package/src/commands/trackchangescommand.d.ts +26 -26
  112. package/src/commands/trackchangescommand.js +1 -1
  113. package/src/index.d.ts +16 -16
  114. package/src/integrations/aiassistant.d.ts +17 -17
  115. package/src/integrations/aiassistant.js +1 -1
  116. package/src/integrations/alignment.d.ts +17 -17
  117. package/src/integrations/alignment.js +1 -1
  118. package/src/integrations/basicstyles.d.ts +17 -17
  119. package/src/integrations/basicstyles.js +1 -1
  120. package/src/integrations/blockquote.d.ts +17 -17
  121. package/src/integrations/blockquote.js +1 -1
  122. package/src/integrations/ckbox.d.ts +17 -17
  123. package/src/integrations/ckbox.js +1 -1
  124. package/src/integrations/codeblock.d.ts +17 -17
  125. package/src/integrations/codeblock.js +1 -1
  126. package/src/integrations/comments.d.ts +14 -14
  127. package/src/integrations/comments.js +1 -1
  128. package/src/integrations/deletecommand.d.ts +17 -17
  129. package/src/integrations/deletecommand.js +1 -1
  130. package/src/integrations/documentlist.d.ts +17 -17
  131. package/src/integrations/documentlist.js +1 -1
  132. package/src/integrations/documentlistproperties.d.ts +29 -29
  133. package/src/integrations/documentlistproperties.js +1 -1
  134. package/src/integrations/entercommand.d.ts +16 -16
  135. package/src/integrations/entercommand.js +1 -1
  136. package/src/integrations/findandreplace.d.ts +21 -21
  137. package/src/integrations/findandreplace.js +1 -1
  138. package/src/integrations/font.d.ts +17 -17
  139. package/src/integrations/font.js +1 -1
  140. package/src/integrations/formatpainter.d.ts +17 -17
  141. package/src/integrations/formatpainter.js +1 -1
  142. package/src/integrations/heading.d.ts +17 -17
  143. package/src/integrations/heading.js +1 -1
  144. package/src/integrations/highlight.d.ts +17 -17
  145. package/src/integrations/highlight.js +1 -1
  146. package/src/integrations/horizontalline.d.ts +17 -17
  147. package/src/integrations/horizontalline.js +1 -1
  148. package/src/integrations/htmlembed.d.ts +17 -17
  149. package/src/integrations/htmlembed.js +1 -1
  150. package/src/integrations/image.d.ts +17 -17
  151. package/src/integrations/image.js +1 -1
  152. package/src/integrations/imagereplace.d.ts +17 -23
  153. package/src/integrations/imagereplace.js +1 -1
  154. package/src/integrations/imagestyle.d.ts +17 -0
  155. package/src/integrations/imagestyle.js +23 -0
  156. package/src/integrations/importword.d.ts +18 -18
  157. package/src/integrations/importword.js +1 -1
  158. package/src/integrations/indent.d.ts +17 -17
  159. package/src/integrations/indent.js +1 -1
  160. package/src/integrations/inputcommand.d.ts +16 -16
  161. package/src/integrations/inputcommand.js +1 -1
  162. package/src/integrations/link.d.ts +17 -17
  163. package/src/integrations/link.js +1 -1
  164. package/src/integrations/list.d.ts +17 -17
  165. package/src/integrations/list.js +1 -1
  166. package/src/integrations/listproperties.d.ts +29 -29
  167. package/src/integrations/listproperties.js +1 -1
  168. package/src/integrations/mediaembed.d.ts +17 -17
  169. package/src/integrations/mediaembed.js +1 -1
  170. package/src/integrations/mention.d.ts +17 -17
  171. package/src/integrations/mention.js +1 -1
  172. package/src/integrations/pagebreak.d.ts +17 -17
  173. package/src/integrations/pagebreak.js +1 -1
  174. package/src/integrations/paragraph.d.ts +17 -17
  175. package/src/integrations/paragraph.js +1 -1
  176. package/src/integrations/removeformat.d.ts +17 -17
  177. package/src/integrations/removeformat.js +1 -1
  178. package/src/integrations/restrictededitingmode.d.ts +17 -17
  179. package/src/integrations/restrictededitingmode.js +1 -1
  180. package/src/integrations/shiftentercommand.d.ts +16 -16
  181. package/src/integrations/shiftentercommand.js +1 -1
  182. package/src/integrations/standardeditingmode.d.ts +17 -17
  183. package/src/integrations/standardeditingmode.js +1 -1
  184. package/src/integrations/style.d.ts +17 -18
  185. package/src/integrations/style.js +1 -1
  186. package/src/integrations/table.d.ts +42 -42
  187. package/src/integrations/table.js +1 -1
  188. package/src/integrations/tablecaption.d.ts +22 -22
  189. package/src/integrations/tablecaption.js +1 -1
  190. package/src/integrations/tableclipboard.d.ts +19 -19
  191. package/src/integrations/tableclipboard.js +1 -1
  192. package/src/integrations/tablecolumnresize.d.ts +26 -26
  193. package/src/integrations/tablecolumnresize.js +1 -1
  194. package/src/integrations/tableheadings.d.ts +22 -22
  195. package/src/integrations/tableheadings.js +1 -1
  196. package/src/integrations/tablemergesplit.d.ts +22 -22
  197. package/src/integrations/tablemergesplit.js +1 -1
  198. package/src/integrations/tableofcontents.d.ts +17 -17
  199. package/src/integrations/tableofcontents.js +1 -1
  200. package/src/integrations/tableproperties.d.ts +27 -27
  201. package/src/integrations/tableproperties.js +1 -1
  202. package/src/integrations/template.d.ts +17 -17
  203. package/src/integrations/template.js +1 -1
  204. package/src/integrations/title.d.ts +17 -17
  205. package/src/integrations/title.js +1 -1
  206. package/src/integrations/undo.d.ts +17 -17
  207. package/src/integrations/undo.js +1 -1
  208. package/src/integrations/utils.d.ts +21 -21
  209. package/src/integrations/utils.js +1 -1
  210. package/src/suggestion.d.ts +291 -276
  211. package/src/suggestion.js +1 -1
  212. package/src/suggestiondescriptionfactory.d.ts +183 -163
  213. package/src/suggestiondescriptionfactory.js +1 -1
  214. package/src/trackchanges.d.ts +180 -244
  215. package/src/trackchanges.js +1 -1
  216. package/src/trackchangesconfig.d.ts +78 -75
  217. package/src/trackchangesdata.d.ts +41 -41
  218. package/src/trackchangesdata.js +1 -1
  219. package/src/trackchangesediting.d.ts +524 -468
  220. package/src/trackchangesediting.js +1 -1
  221. package/src/trackchangesui.d.ts +38 -38
  222. package/src/trackchangesui.js +1 -1
  223. package/src/ui/suggestioncontroller.d.ts +37 -37
  224. package/src/ui/suggestioncontroller.js +1 -1
  225. package/src/ui/view/basesuggestionthreadview.d.ts +170 -170
  226. package/src/ui/view/basesuggestionthreadview.js +1 -1
  227. package/src/ui/view/suggestionthreadview.d.ts +182 -182
  228. package/src/ui/view/suggestionthreadview.js +1 -1
  229. package/src/utils/common-translations.d.ts +9 -9
  230. package/src/utils/common-translations.js +1 -1
  231. package/src/utils/utils.d.ts +30 -30
  232. package/src/utils/utils.js +1 -1
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x2987=['name','createRangeOn','get','activeMarkers','markerRange','writer','element','listIndent','push','toViewElement','TrackChangesEditing','createUIElement','type','getItems','listItem','mapper','test','elementEnd','insert','includes','markerName','nextSibling','getCustomProperty','item','addClass','isAtEnd','isContent','getWalker','bindElementToMarker','plugins','model'];(function(_0xba327,_0x2987c7){const _0x5cd508=function(_0x5a57e9){while(--_0x5a57e9){_0xba327['push'](_0xba327['shift']());}};_0x5cd508(++_0x2987c7);}(_0x2987,0x67));const _0x5cd5=function(_0xba327,_0x2987c7){_0xba327=_0xba327-0x0;let _0x5cd508=_0x2987[_0xba327];return _0x5cd508;};export function getRangesWithAttribute(_0x27256a,_0x4ec76e,_0x529c17){const _0x113a58=[];for(const _0xcff14 of _0x4ec76e[_0x5cd5('0x3')]())_0xcff14['hasAttribute'](_0x27256a)&&_0x113a58[_0x5cd5('0x1d')](_0x529c17[_0x5cd5('0x16')](_0xcff14));return _0x113a58;}export function getElementsAffectedByListItemRename(_0x2d6300){const _0x25595d=[];if(_0x2d6300['is'](_0x5cd5('0x1b'),'listItem')){let _0x4ea83b=_0x2d6300[_0x5cd5('0xb')];for(;_0x4ea83b&&_0x4ea83b['is'](_0x5cd5('0x1b'),_0x5cd5('0x4'))&&_0x4ea83b['getAttribute'](_0x5cd5('0x1c'))>0x0;)_0x25595d[_0x5cd5('0x1d')](_0x4ea83b),_0x4ea83b=_0x4ea83b[_0x5cd5('0xb')];}return _0x25595d;}export function downcastSplitMergeMarker(_0x1db6b8,_0x21f513,{showActiveMarker:_0x31c1f8=!0x0}={}){const _0x5205fe=_0x1db6b8[_0x5cd5('0x13')][_0x5cd5('0x17')](_0x5cd5('0x0'));return(_0x5e90ba,_0x107237,_0xb5b61a)=>{if(!_0xb5b61a['consumable'][_0x5cd5('0x6')](_0x107237[_0x5cd5('0x19')],_0x5e90ba[_0x5cd5('0x15')]))return;const _0x93379f=_0x107237['markerRange'][_0x5cd5('0x11')](),_0x5e9a3a=_0x107237['markerRange']['start'],_0x56149f=_0x1db6b8[_0x5cd5('0x14')]['schema'];let _0x4862ba=null,_0x555d22=null,_0x22fd77=!0x1,_0x350f7f=!0x1;for(const _0x2586a8 of _0x93379f){const _0x5929ad=_0x2586a8[_0x5cd5('0xd')];_0x22fd77=_0x22fd77||_0x56149f[_0x5cd5('0x10')](_0x5929ad);const _0x116190=_0xb5b61a[_0x5cd5('0x5')][_0x5cd5('0x1e')](_0x5929ad);if(_0x116190&&_0x116190[_0x5cd5('0xc')]('addHighlight'))return;_0x5cd5('0x7')==_0x2586a8[_0x5cd5('0x2')]&&(_0x56149f['isBlock'](_0x5929ad)&&!_0x56149f['isLimit'](_0x5929ad)&&(_0x5929ad[_0x5cd5('0xb')]||_0x5e9a3a[_0x5cd5('0xf')]?_0x4862ba&&_0x4862ba['parent']==_0x5929ad||(_0x4862ba=_0x5929ad,_0x2a1c57(_0x2586a8['previousPosition']),_0x350f7f=!0x0):_0x555d22=_0x555d22||_0x2586a8['previousPosition']));}function _0x2a1c57(_0x5b2720){const _0x9f1078=_0xb5b61a[_0x5cd5('0x1a')][_0x5cd5('0x1')]('span',{'class':'ck-suggestion-marker-'+_0x21f513}),_0x140632=_0xb5b61a[_0x5cd5('0x5')]['toViewPosition'](_0x5b2720);_0x31c1f8&&_0x5205fe[_0x5cd5('0x18')][_0x5cd5('0x9')](_0x107237[_0x5cd5('0xa')])&&_0xb5b61a[_0x5cd5('0x1a')][_0x5cd5('0xe')]('ck-suggestion-marker--active',_0x9f1078),_0xb5b61a['writer'][_0x5cd5('0x8')](_0x140632,_0x9f1078),_0xb5b61a['mapper'][_0x5cd5('0x12')](_0x9f1078,_0x107237[_0x5cd5('0xa')]);}_0x22fd77||_0x350f7f||!_0x555d22||_0x2a1c57(_0x555d22);};}
23
+ const _0x24ba=['plugins','writer','activeMarkers','push','schema','getAttribute','getWalker','isAtEnd','ck-suggestion-marker--active','mapper','addClass','isContent','consumable','name','element','nextSibling','createUIElement','test','insert','type','elementEnd','get','markerName','getItems','isLimit','createRangeOn','toViewPosition','includes','parent','markerRange','previousPosition','listItem','item','getCustomProperty'];(function(_0x573cd9,_0x24ba71){const _0x4920d1=function(_0x42eb05){while(--_0x42eb05){_0x573cd9['push'](_0x573cd9['shift']());}};_0x4920d1(++_0x24ba71);}(_0x24ba,0x1d2));const _0x4920=function(_0x573cd9,_0x24ba71){_0x573cd9=_0x573cd9-0x0;let _0x4920d1=_0x24ba[_0x573cd9];return _0x4920d1;};export function getRangesWithAttribute(_0x417211,_0x1f5a50,_0xd96e01){const _0x1bb612=[];for(const _0x2a5d75 of _0x1f5a50[_0x4920('0x21')]())_0x2a5d75['hasAttribute'](_0x417211)&&_0x1bb612[_0x4920('0xd')](_0xd96e01[_0x4920('0x1')](_0x2a5d75));return _0x1bb612;}export function getElementsAffectedByListItemRename(_0x4775ac){const _0xcf7fb3=[];if(_0x4775ac['is'](_0x4920('0x18'),_0x4920('0x7'))){let _0x4a20a1=_0x4775ac[_0x4920('0x19')];for(;_0x4a20a1&&_0x4a20a1['is'](_0x4920('0x18'),_0x4920('0x7'))&&_0x4a20a1[_0x4920('0xf')]('listIndent')>0x0;)_0xcf7fb3[_0x4920('0xd')](_0x4a20a1),_0x4a20a1=_0x4a20a1['nextSibling'];}return _0xcf7fb3;}export function downcastSplitMergeMarker(_0x1320f8,_0x875cd6,{showActiveMarker:_0x54e40b=!0x0}={}){const _0x1aad58=_0x1320f8[_0x4920('0xa')][_0x4920('0x1f')]('TrackChangesEditing');return(_0x2f42e2,_0x33a0cc,_0x2312db)=>{if(!_0x2312db[_0x4920('0x16')][_0x4920('0x1b')](_0x33a0cc['markerRange'],_0x2f42e2[_0x4920('0x17')]))return;const _0x5887da=_0x33a0cc[_0x4920('0x5')][_0x4920('0x10')](),_0x4146d3=_0x33a0cc[_0x4920('0x5')]['start'],_0x3a9cde=_0x1320f8['model'][_0x4920('0xe')];let _0x4d1db5=null,_0x4f7b9f=null,_0x596b7f=!0x1,_0x5a4591=!0x1;for(const _0x408a3c of _0x5887da){const _0x4b44cc=_0x408a3c[_0x4920('0x8')];_0x596b7f=_0x596b7f||_0x3a9cde[_0x4920('0x15')](_0x4b44cc);const _0x342862=_0x2312db[_0x4920('0x13')]['toViewElement'](_0x4b44cc);if(_0x342862&&_0x342862[_0x4920('0x9')]('addHighlight'))return;_0x4920('0x1e')==_0x408a3c[_0x4920('0x1d')]&&(_0x3a9cde['isBlock'](_0x4b44cc)&&!_0x3a9cde[_0x4920('0x0')](_0x4b44cc)&&(_0x4b44cc[_0x4920('0x19')]||_0x4146d3[_0x4920('0x11')]?_0x4d1db5&&_0x4d1db5[_0x4920('0x4')]==_0x4b44cc||(_0x4d1db5=_0x4b44cc,_0x527016(_0x408a3c[_0x4920('0x6')]),_0x5a4591=!0x0):_0x4f7b9f=_0x4f7b9f||_0x408a3c[_0x4920('0x6')]));}function _0x527016(_0x4d97fa){const _0x96e38d=_0x2312db[_0x4920('0xb')][_0x4920('0x1a')]('span',{'class':'ck-suggestion-marker-'+_0x875cd6}),_0x2db5df=_0x2312db[_0x4920('0x13')][_0x4920('0x2')](_0x4d97fa);_0x54e40b&&_0x1aad58[_0x4920('0xc')][_0x4920('0x3')](_0x33a0cc[_0x4920('0x20')])&&_0x2312db['writer'][_0x4920('0x14')](_0x4920('0x12'),_0x96e38d),_0x2312db[_0x4920('0xb')][_0x4920('0x1c')](_0x2db5df,_0x96e38d),_0x2312db[_0x4920('0x13')]['bindElementToMarker'](_0x96e38d,_0x33a0cc[_0x4920('0x20')]);}_0x596b7f||_0x5a4591||!_0x4f7b9f||_0x527016(_0x4f7b9f);};}
@@ -1,276 +1,291 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, 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 track-changes/suggestion
7
- * @publicApi
8
- */
9
- import { Element, type Marker, type Model, type Range, type Item } from 'ckeditor5/src/engine';
10
- import type { User } from 'ckeditor5-collaboration/src/collaboration-core';
11
- import type { CommentThread } from '@ckeditor/ckeditor5-comments';
12
- import type { FormatData } from './trackchangesediting';
13
- declare const Suggestion_base: {
14
- new (): import("ckeditor5/src/utils").Observable;
15
- prototype: import("ckeditor5/src/utils").Observable; /**
16
- * Previous suggestion in suggestions chain.
17
- *
18
- * Chained suggestions should be handled as one entity.
19
- *
20
- * @observable
21
- */
22
- };
23
- /**
24
- * Represents a singular suggestion that is tracked by track changes plugin.
25
- *
26
- * `Suggestion` instances are created and handled by {@link module:track-changes/trackchanges~TrackChanges track changes plugin}.
27
- */
28
- export default class Suggestion extends Suggestion_base {
29
- /**
30
- * Suggestion ID.
31
- */
32
- readonly id: string;
33
- /**
34
- * Suggestion type.
35
- */
36
- type: SuggestionType;
37
- /**
38
- * Suggestion sub-type.
39
- *
40
- * This is an additional identifier for suggestions. Two suggestions of the same type may have different sub-types to differentiate
41
- * suggestions behavior and handle interactions between suggestions.
42
- *
43
- * Sub-type is used for:
44
- *
45
- * * suggestions joining (only suggestions with the same sub-type can be joined),
46
- * * suggestions custom callbacks (fired when adding, deleting and joining suggestions).
47
- */
48
- subType: string | null;
49
- /**
50
- * The author of the change marked by the suggestion.
51
- */
52
- author: User;
53
- /**
54
- * The user which saved the suggestion data in the database.
55
- *
56
- * Usually the same as author but may be different in some cases (e.g. when suggestion was added from an external source).
57
- */
58
- creator: User;
59
- /**
60
- * The flag indicating whether the suggestion comes from an external source.
61
- */
62
- isExternal: boolean;
63
- /**
64
- * Additional suggestion data.
65
- */
66
- data: FormatData | null;
67
- /**
68
- * Date when the suggestion was saved in the database.
69
- */
70
- createdAt: Date | null;
71
- /**
72
- * Date when the change marked by the suggestion was made.
73
- *
74
- * Usually the same as {@link #createdAt `createdAt`} but may be different in some cases
75
- * (e.g. when suggestion was added from an external source).
76
- *
77
- * @observable
78
- */
79
- authoredAt: Date | null;
80
- /**
81
- * Custom suggestion attributes. See also {@link #setAttribute} and {@link #removeAttribute}.
82
- *
83
- * @observable
84
- */
85
- attributes: {
86
- [k: string]: unknown;
87
- };
88
- /**
89
- * Previous suggestion in suggestions chain.
90
- *
91
- * Chained suggestions should be handled as one entity.
92
- *
93
- * @observable
94
- */
95
- previous: Suggestion | null;
96
- /**
97
- * Next suggestion in suggestions chain.
98
- *
99
- * Chained suggestions should be handled as one entity.
100
- *
101
- * @observable
102
- */
103
- next: Suggestion | null;
104
- /**
105
- * Comment thread model for comments added to this suggestion.
106
- *
107
- * @observable
108
- */
109
- commentThread: CommentThread | null;
110
- constructor(model: Model, options: SuggestionOptions);
111
- /**
112
- * The first (most-previous) suggestion in this suggestion chain.
113
- */
114
- get head(): Suggestion;
115
- /**
116
- * Informs whether suggestion has at least one comment.
117
- */
118
- get hasComments(): boolean;
119
- /**
120
- * Informs whether the suggestion is a multi-range suggestion or a single-range suggestion.
121
- *
122
- * This is evaluated basing on the marker name belonging to this suggestion.
123
- * Even if only one marker belongs to the suggestion at a given time it can still be a multi range suggestion.
124
- */
125
- get isMultiRange(): boolean;
126
- /**
127
- * Informs whether the suggestion is still in the editor content.
128
- *
129
- * Returns `true` if there is at least one marker suggestion in the editor content.
130
- */
131
- get isInContent(): boolean;
132
- /**
133
- * Binds given marker name to this suggestion.
134
- */
135
- addMarkerName(markerName: string): void;
136
- /**
137
- * Returns all names of markers belonging to this suggestion.
138
- */
139
- getMarkerNames(): Array<string>;
140
- /**
141
- * Returns all markers belonging to this suggestion.
142
- */
143
- getMarkers(): Array<Marker>;
144
- /**
145
- * Returns the first marker belonging to this suggestion, i.e the first marker that was added to this suggestion
146
- * and not removed yet.
147
- *
148
- * This method is useful if you know that the suggestion has only one marker and want to process it.
149
- */
150
- getFirstMarker(): Marker | null;
151
- /**
152
- * Removes all markers from the suggestion and the editor content.
153
- */
154
- removeMarkers(): void;
155
- /**
156
- * Removes marker with the given name from the suggestion and the editor content.
157
- */
158
- removeMarker(markerName: string): void;
159
- /**
160
- * Adds a new range to this suggestion. It is assumed that the suggestion is a multi-range suggestion.
161
- *
162
- * A marker name is generated from this suggestion's properties and a marker with that name is created and set to a given `range`.
163
- */
164
- addRange(range: Range): void;
165
- /**
166
- * Checks if given `range` is intersecting with any of the ranges of markers belonging to this suggestion.
167
- */
168
- isIntersectingWithRange(range: Range): boolean;
169
- /**
170
- * Returns all ranges of all markers belonging to this suggestion.
171
- */
172
- getRanges(): Array<Range>;
173
- /**
174
- * Returns all {@link module:engine/model/item~Item model items} that are in this suggestion.
175
- */
176
- getItems(): Array<Item>;
177
- /**
178
- * Returns the first range belonging to this suggestion, i.e. the range of the first marker that was added to
179
- * this suggestion and not removed yet.
180
- *
181
- * This method is useful if you know that the suggestion has only one marker and want to process its range.
182
- */
183
- getFirstRange(): Range | null;
184
- /**
185
- * Returns the model element contained in the suggestion.
186
- *
187
- * A {@link module:engine/model/element~Element model element} is considered as contained if there is exactly
188
- * one range in the suggestion, and that range contains exactly one element.
189
- *
190
- * Returns `null` if there is no contained element.
191
- */
192
- getContainedElement(): Element | null;
193
- /**
194
- * Accepts the suggestion.
195
- */
196
- accept(): void;
197
- /**
198
- * Discards the suggestion.
199
- */
200
- discard(): void;
201
- /**
202
- * Returns all suggestions that are in this suggestion chain.
203
- */
204
- getAllAdjacentSuggestions(): Array<Suggestion>;
205
- /**
206
- * Adds suggestion attribute.
207
- *
208
- * Suggestion attributes are custom data that can be set and used by features
209
- * built around suggestions. Use it to store your feature data with other suggestion data.
210
- *
211
- * ```ts
212
- * suggestion.setAttribute( 'isImportant', true );
213
- * ```
214
- *
215
- * You can group multiple values in an object, using dot notation:
216
- *
217
- * ```ts
218
- * suggestion.setAttribute( 'customData.type', 'image' );
219
- * suggestion.setAttribute( 'customData.src', 'foo.jpg' );
220
- * ```
221
- *
222
- * Attributes set on the suggestion can be accessed through `attribute` property:
223
- *
224
- * ```ts
225
- * const isImportant = suggestion.attributes.isImportant;
226
- * const type = suggestion.attributes.customData.type;
227
- * ```
228
- *
229
- * You can also observe `attributes` property or bind other properties to it:
230
- *
231
- * ```ts
232
- * myObj.bind( 'customData' ).to( suggestion, 'attributes', attributes => attributes.customData );
233
- * ```
234
- *
235
- * Whenever `setAttribute()` or `removeAttribute()` is called, `attributes` property
236
- * is re-set and observables are refreshed.
237
- */
238
- setAttribute(name: string, value: unknown): void;
239
- /**
240
- * Removes suggestion attribute.
241
- *
242
- * See also {@link #setAttribute}
243
- */
244
- removeAttribute(name: string): void;
245
- toJSON(): SuggestionJSON;
246
- /**
247
- * Returns a random string that can be used as additional identifier for the marker name for suggestions that are multi range.
248
- */
249
- static getMultiRangeId(): string;
250
- }
251
- export interface SuggestionOptions {
252
- id: string;
253
- type: SuggestionType;
254
- subType: string | null;
255
- attributes: {
256
- [k: string]: unknown;
257
- };
258
- author: User;
259
- creator: User;
260
- onAccept: Function;
261
- onDiscard: Function;
262
- onAttributesChange: Function;
263
- }
264
- export interface SuggestionJSON {
265
- id: string;
266
- type: string;
267
- authorId: string;
268
- createdAt: Date | null;
269
- hasComments?: boolean;
270
- data?: FormatData | null;
271
- attributes: {
272
- [k: string]: unknown;
273
- };
274
- }
275
- export type SuggestionType = 'insertion' | 'deletion' | 'formatInline' | 'formatBlock';
276
- export {};
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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 track-changes/suggestion
7
+ * @publicApi
8
+ */
9
+ import { Element, type Marker, type Model, type Range, type Item } from 'ckeditor5/src/engine';
10
+ import type { User } from 'ckeditor5-collaboration/src/collaboration-core';
11
+ import type { CommentThread } from '@ckeditor/ckeditor5-comments';
12
+ import type { FormatData, AttributeData } from './trackchangesediting';
13
+ declare const Suggestion_base: {
14
+ new (): import("ckeditor5/src/utils").Observable;
15
+ prototype: import("ckeditor5/src/utils").Observable;
16
+ };
17
+ /**
18
+ * Represents a singular suggestion that is tracked by track changes plugin.
19
+ *
20
+ * `Suggestion` instances are created and handled by {@link module:track-changes/trackchanges~TrackChanges track changes plugin}.
21
+ */
22
+ export default class Suggestion extends Suggestion_base {
23
+ /**
24
+ * Suggestion ID.
25
+ */
26
+ readonly id: string;
27
+ /**
28
+ * Suggestion type.
29
+ */
30
+ type: SuggestionType;
31
+ /**
32
+ * Suggestion sub-type.
33
+ *
34
+ * This is an additional identifier for suggestions. Two suggestions of the same type may have different sub-types to differentiate
35
+ * suggestions behavior and handle interactions between suggestions.
36
+ *
37
+ * Sub-type is used for:
38
+ *
39
+ * * suggestions joining (only suggestions with the same sub-type can be joined),
40
+ * * suggestions custom callbacks (fired when adding, deleting and joining suggestions).
41
+ */
42
+ subType: string | null;
43
+ /**
44
+ * The author of the change marked by the suggestion.
45
+ */
46
+ author: User;
47
+ /**
48
+ * The user which saved the suggestion data in the database.
49
+ *
50
+ * Usually the same as author but may be different in some cases (e.g. when suggestion was added from an external source).
51
+ */
52
+ creator: User;
53
+ /**
54
+ * The flag indicating whether the suggestion comes from an external source.
55
+ */
56
+ isExternal: boolean;
57
+ /**
58
+ * Additional suggestion data.
59
+ */
60
+ data: FormatData | AttributeData | null;
61
+ /**
62
+ * Date when the suggestion was saved in the database.
63
+ */
64
+ createdAt: Date | null;
65
+ /**
66
+ * Date when the change marked by the suggestion was made.
67
+ *
68
+ * Usually the same as {@link #createdAt `createdAt`} but may be different in some cases
69
+ * (e.g. when suggestion was added from an external source).
70
+ *
71
+ * @observable
72
+ */
73
+ authoredAt: Date | null;
74
+ /**
75
+ * Custom suggestion attributes. See also {@link #setAttribute} and {@link #removeAttribute}.
76
+ *
77
+ * @observable
78
+ */
79
+ attributes: {
80
+ [k: string]: unknown;
81
+ };
82
+ /**
83
+ * Previous suggestion in suggestions chain.
84
+ *
85
+ * Chained suggestions should be handled as one entity.
86
+ *
87
+ * @observable
88
+ */
89
+ previous: Suggestion | null;
90
+ /**
91
+ * Next suggestion in suggestions chain.
92
+ *
93
+ * Chained suggestions should be handled as one entity.
94
+ *
95
+ * @observable
96
+ */
97
+ next: Suggestion | null;
98
+ /**
99
+ * Comment thread model for comments added to this suggestion.
100
+ *
101
+ * @observable
102
+ */
103
+ commentThread: CommentThread | null;
104
+ constructor(model: Model, options: SuggestionOptions);
105
+ /**
106
+ * The first (most-previous) suggestion in this suggestion chain.
107
+ */
108
+ get head(): Suggestion;
109
+ /**
110
+ * Informs whether suggestion has at least one comment.
111
+ */
112
+ get hasComments(): boolean;
113
+ /**
114
+ * Informs whether the suggestion is a multi-range suggestion or a single-range suggestion.
115
+ *
116
+ * This is evaluated basing on the marker name belonging to this suggestion.
117
+ * Even if only one marker belongs to the suggestion at a given time it can still be a multi range suggestion.
118
+ */
119
+ get isMultiRange(): boolean;
120
+ /**
121
+ * Informs whether the suggestion is still in the editor content.
122
+ *
123
+ * Returns `true` if there is at least one marker suggestion in the editor content.
124
+ */
125
+ get isInContent(): boolean;
126
+ /**
127
+ * Binds given marker name to this suggestion.
128
+ */
129
+ addMarkerName(markerName: string): void;
130
+ /**
131
+ * Returns all names of markers belonging to this suggestion.
132
+ */
133
+ getMarkerNames(): Array<string>;
134
+ /**
135
+ * Returns all markers belonging to this suggestion.
136
+ */
137
+ getMarkers(): Array<Marker>;
138
+ /**
139
+ * Returns the first marker belonging to this suggestion, i.e the first marker that was added to this suggestion
140
+ * and not removed yet.
141
+ *
142
+ * This method is useful if you know that the suggestion has only one marker and want to process it.
143
+ */
144
+ getFirstMarker(): Marker | null;
145
+ /**
146
+ * Removes all markers from the suggestion and the editor content.
147
+ */
148
+ removeMarkers(): void;
149
+ /**
150
+ * Removes marker with the given name from the suggestion and the editor content.
151
+ */
152
+ removeMarker(markerName: string): void;
153
+ /**
154
+ * Adds a new range to this suggestion. It is assumed that the suggestion is a multi-range suggestion.
155
+ *
156
+ * A marker name is generated from this suggestion's properties and a marker with that name is created and set to a given `range`.
157
+ */
158
+ addRange(range: Range): void;
159
+ /**
160
+ * Checks if given `range` is intersecting with any of the ranges of markers belonging to this suggestion.
161
+ */
162
+ isIntersectingWithRange(range: Range): boolean;
163
+ /**
164
+ * Returns all ranges of all markers belonging to this suggestion.
165
+ */
166
+ getRanges(): Array<Range>;
167
+ /**
168
+ * Returns all {@link module:engine/model/item~Item model items} that are in this suggestion.
169
+ */
170
+ getItems(): Array<Item>;
171
+ /**
172
+ * Returns the first range belonging to this suggestion, i.e. the range of the first marker that was added to
173
+ * this suggestion and not removed yet.
174
+ *
175
+ * This method is useful if you know that the suggestion has only one marker and want to process its range.
176
+ */
177
+ getFirstRange(): Range | null;
178
+ /**
179
+ * Returns the model element contained in the suggestion.
180
+ *
181
+ * A {@link module:engine/model/element~Element model element} is considered as contained if there is exactly
182
+ * one range in the suggestion, and that range contains exactly one element.
183
+ *
184
+ * Returns `null` if there is no contained element.
185
+ */
186
+ getContainedElement(): Element | null;
187
+ /**
188
+ * Accepts the suggestion.
189
+ */
190
+ accept(): void;
191
+ /**
192
+ * Discards the suggestion.
193
+ */
194
+ discard(): void;
195
+ /**
196
+ * Returns all suggestions that are in this suggestion chain.
197
+ */
198
+ getAllAdjacentSuggestions(): Array<Suggestion>;
199
+ /**
200
+ * Adds suggestion attribute.
201
+ *
202
+ * Suggestion attributes are custom data that can be set and used by features
203
+ * built around suggestions. Use it to store your feature data with other suggestion data.
204
+ *
205
+ * ```ts
206
+ * suggestion.setAttribute( 'isImportant', true );
207
+ * ```
208
+ *
209
+ * You can group multiple values in an object, using dot notation:
210
+ *
211
+ * ```ts
212
+ * suggestion.setAttribute( 'customData.type', 'image' );
213
+ * suggestion.setAttribute( 'customData.src', 'foo.jpg' );
214
+ * ```
215
+ *
216
+ * Attributes set on the suggestion can be accessed through `attribute` property:
217
+ *
218
+ * ```ts
219
+ * const isImportant = suggestion.attributes.isImportant;
220
+ * const type = suggestion.attributes.customData.type;
221
+ * ```
222
+ *
223
+ * You can also observe `attributes` property or bind other properties to it:
224
+ *
225
+ * ```ts
226
+ * myObj.bind( 'customData' ).to( suggestion, 'attributes', attributes => attributes.customData );
227
+ * ```
228
+ *
229
+ * Whenever `setAttribute()` or `removeAttribute()` is called, `attributes` property
230
+ * is re-set and observables are refreshed.
231
+ */
232
+ setAttribute(name: string, value: unknown): void;
233
+ /**
234
+ * Removes suggestion attribute.
235
+ *
236
+ * See also {@link #setAttribute}
237
+ */
238
+ removeAttribute(name: string): void;
239
+ toJSON(): SuggestionJSON;
240
+ /**
241
+ * Returns a random string that can be used as additional identifier for the marker name for suggestions that are multi range.
242
+ */
243
+ static getMultiRangeId(): string;
244
+ }
245
+ export interface SuggestionOptions {
246
+ id: string;
247
+ type: SuggestionType;
248
+ subType: string | null;
249
+ attributes: {
250
+ [k: string]: unknown;
251
+ };
252
+ author: User;
253
+ creator: User;
254
+ onAccept: Function;
255
+ onDiscard: Function;
256
+ onAttributesChange: Function;
257
+ }
258
+ export interface SuggestionJSON {
259
+ /**
260
+ * Suggestion ID.
261
+ */
262
+ id: string;
263
+ /**
264
+ * Contains the information about the type and subtype of the suggestion.
265
+ */
266
+ type: string;
267
+ /**
268
+ * The ID of the author.
269
+ */
270
+ authorId: string;
271
+ /**
272
+ * Date when the suggestion was saved in the database.
273
+ */
274
+ createdAt: Date | null;
275
+ /**
276
+ * Informs whether suggestion has at least one comment.
277
+ */
278
+ hasComments?: boolean;
279
+ /**
280
+ * Additional suggestion data.
281
+ */
282
+ data?: FormatData | AttributeData | null;
283
+ /**
284
+ * Custom suggestion attributes.
285
+ */
286
+ attributes: {
287
+ [k: string]: unknown;
288
+ };
289
+ }
290
+ export type SuggestionType = 'insertion' | 'deletion' | 'formatInline' | 'formatBlock' | 'attribute';
291
+ export {};