@ckeditor/ckeditor5-template 39.0.1 → 40.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 (118) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/LICENSE.md +4 -4
  3. package/README.md +7 -7
  4. package/build/template.js +2 -2
  5. package/build/translations/ar.js +1 -1
  6. package/build/translations/bg.js +1 -1
  7. package/build/translations/bn.js +1 -1
  8. package/build/translations/ca.js +1 -1
  9. package/build/translations/cs.js +1 -1
  10. package/build/translations/da.js +1 -1
  11. package/build/translations/de.js +1 -1
  12. package/build/translations/el.js +1 -1
  13. package/build/translations/en-au.js +1 -1
  14. package/build/translations/es.js +1 -1
  15. package/build/translations/et.js +1 -1
  16. package/build/translations/fi.js +1 -1
  17. package/build/translations/fr.js +1 -1
  18. package/build/translations/gl.js +1 -1
  19. package/build/translations/he.js +1 -1
  20. package/build/translations/hi.js +1 -1
  21. package/build/translations/hr.js +1 -1
  22. package/build/translations/hu.js +1 -1
  23. package/build/translations/id.js +1 -1
  24. package/build/translations/it.js +1 -1
  25. package/build/translations/ja.js +1 -1
  26. package/build/translations/ko.js +1 -1
  27. package/build/translations/lt.js +1 -1
  28. package/build/translations/lv.js +1 -1
  29. package/build/translations/ms.js +1 -1
  30. package/build/translations/nl.js +1 -1
  31. package/build/translations/no.js +1 -1
  32. package/build/translations/pl.js +1 -1
  33. package/build/translations/pt-br.js +1 -1
  34. package/build/translations/pt.js +1 -1
  35. package/build/translations/ro.js +1 -1
  36. package/build/translations/ru.js +1 -1
  37. package/build/translations/sk.js +1 -1
  38. package/build/translations/sr.js +1 -1
  39. package/build/translations/sv.js +1 -1
  40. package/build/translations/th.js +1 -1
  41. package/build/translations/tr.js +1 -1
  42. package/build/translations/uk.js +1 -1
  43. package/build/translations/uz.js +1 -1
  44. package/build/translations/vi.js +1 -1
  45. package/build/translations/zh-cn.js +1 -1
  46. package/build/translations/zh.js +1 -1
  47. package/lang/contexts.json +1 -2
  48. package/lang/translations/ar.po +1 -4
  49. package/lang/translations/bg.po +1 -4
  50. package/lang/translations/bn.po +1 -4
  51. package/lang/translations/ca.po +1 -4
  52. package/lang/translations/cs.po +1 -4
  53. package/lang/translations/da.po +1 -4
  54. package/lang/translations/de.po +1 -4
  55. package/lang/translations/el.po +1 -4
  56. package/lang/translations/en-au.po +1 -4
  57. package/lang/translations/en.po +1 -4
  58. package/lang/translations/es.po +1 -4
  59. package/lang/translations/et.po +1 -4
  60. package/lang/translations/fi.po +1 -4
  61. package/lang/translations/fr.po +1 -4
  62. package/lang/translations/gl.po +1 -4
  63. package/lang/translations/he.po +1 -4
  64. package/lang/translations/hi.po +1 -4
  65. package/lang/translations/hr.po +1 -4
  66. package/lang/translations/hu.po +1 -4
  67. package/lang/translations/id.po +1 -4
  68. package/lang/translations/it.po +1 -4
  69. package/lang/translations/ja.po +1 -4
  70. package/lang/translations/ko.po +1 -4
  71. package/lang/translations/lt.po +1 -4
  72. package/lang/translations/lv.po +1 -4
  73. package/lang/translations/ms.po +1 -4
  74. package/lang/translations/nl.po +1 -4
  75. package/lang/translations/no.po +1 -4
  76. package/lang/translations/pl.po +1 -4
  77. package/lang/translations/pt-br.po +1 -4
  78. package/lang/translations/pt.po +1 -4
  79. package/lang/translations/ro.po +1 -4
  80. package/lang/translations/ru.po +1 -4
  81. package/lang/translations/sk.po +1 -4
  82. package/lang/translations/sr.po +1 -4
  83. package/lang/translations/sv.po +1 -4
  84. package/lang/translations/th.po +1 -4
  85. package/lang/translations/tr.po +1 -4
  86. package/lang/translations/uk.po +1 -4
  87. package/lang/translations/uz.po +1 -4
  88. package/lang/translations/vi.po +1 -4
  89. package/lang/translations/zh-cn.po +1 -4
  90. package/lang/translations/zh.po +1 -4
  91. package/package.json +3 -8
  92. package/src/augmentation.d.ts +23 -23
  93. package/src/index.d.ts +13 -13
  94. package/src/index.js +1 -1
  95. package/src/template.d.ts +115 -115
  96. package/src/template.js +1 -1
  97. package/src/templatecommand.d.ts +23 -23
  98. package/src/templatecommand.js +1 -1
  99. package/src/templateediting.d.ts +30 -30
  100. package/src/templateediting.js +1 -1
  101. package/src/templateui.d.ts +29 -29
  102. package/src/templateui.js +1 -1
  103. package/src/ui/templatelistbuttonview.d.ts +104 -104
  104. package/src/ui/templatelistbuttonview.js +1 -1
  105. package/src/ui/templatelistitemview.d.ts +34 -34
  106. package/src/ui/templatelistitemview.js +1 -1
  107. package/src/ui/templatelistview.d.ts +38 -0
  108. package/src/ui/templatelistview.js +23 -0
  109. package/theme/template.css +95 -187
  110. package/build/translations/sq.js +0 -1
  111. package/lang/translations/sq.po +0 -41
  112. package/src/ui/templateforminfoview.d.ts +0 -51
  113. package/src/ui/templateforminfoview.js +0 -23
  114. package/src/ui/templateformsearchfieldview.d.ts +0 -43
  115. package/src/ui/templateformsearchfieldview.js +0 -23
  116. package/src/ui/templateformview.d.ts +0 -110
  117. package/src/ui/templateformview.js +0 -23
  118. package/theme/icons/loupe.svg +0 -1
@@ -1,104 +1,104 @@
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 template/ui/templatelistbuttonview
7
- */
8
- import type { Locale } from 'ckeditor5/src/utils';
9
- import { ButtonView, View } from 'ckeditor5/src/ui';
10
- import type { TemplateDefinition } from '../template';
11
- /**
12
- * A class representing an individual button (template) in the list. Renders a rich preview of the template option.
13
- *
14
- * @protected
15
- */
16
- export default class TemplateListButtonView extends ButtonView {
17
- /**
18
- * The definition of the template that the button will apply when executed.
19
- *
20
- * @readonly
21
- */
22
- templateDefinition: TemplateDefinition;
23
- /**
24
- * The view rendering the text part of the template definition.
25
- *
26
- * @protected
27
- * @readonly
28
- */
29
- textPartView: TextPartView | null;
30
- /**
31
- * Creates an instance of the {@link module:template/ui/templatelistbuttonview~TemplateListButtonView} class.
32
- *
33
- * @param locale The localization services instance.
34
- * @param templateDefinition The definition of the template.
35
- */
36
- constructor(locale: Locale, templateDefinition: TemplateDefinition);
37
- /**
38
- * @inheritDoc
39
- */
40
- render(): void;
41
- destroy(): void;
42
- /**
43
- * Tells whether the `title` or `description` of the {@link #templateDefinition} match against the provided regular expression.
44
- *
45
- * @param regExp A regular expression to match the definition against.
46
- * @returns When the match is positive, an object with the `title` and `description` keys is returned that describes
47
- * the match. Otherwise, this method returns `null`.
48
- */
49
- isMatching(regExp: RegExp): object | null;
50
- /**
51
- * Highlights a subset of the {@link #textPartView} text according to a specified regular expression. When `null` is passed,
52
- * the highlighting is turned off.
53
- *
54
- * @param regExp A regular expression used to highlight the matching text in the {@link #textPartView}.
55
- */
56
- highlightText(regExp: RegExp | null): void;
57
- }
58
- /**
59
- * A view representing the title and the description of the template.
60
- *
61
- * @protected
62
- */
63
- export declare class TextPartView extends View {
64
- /**
65
- * The title text of the template.
66
- *
67
- * @readonly
68
- */
69
- title: string;
70
- /**
71
- * The description text of the template.
72
- *
73
- * @readonly
74
- */
75
- description: string | undefined;
76
- /**
77
- * A regular expression used to highlight the matching text in the {@link #titleView} and {@link #descriptionView}.
78
- *
79
- * **Note**: When set to `null`, no text gets highlighted.
80
- */
81
- highlightRegExp: RegExp | null;
82
- /**
83
- * Renders the title text of a template.
84
- *
85
- * **Note**: It acts as a label of the entire button in the context of accessibility.
86
- *
87
- * @readonly
88
- */
89
- titleView: View;
90
- /**
91
- * Renders the description text of a template.
92
- *
93
- * @readonly
94
- */
95
- descriptionView: View;
96
- /**
97
- * Creates an instance of the text part view.
98
- *
99
- * @param locale The {@link module:core/editor/editor~Editor#locale} instance.
100
- * @param templateDefinition The definition of the template.
101
- * @param labelId A unique ID that connects the entire button with the {@link #titleView} in the context of accessibility.
102
- */
103
- constructor(locale: Locale, templateDefinition: TemplateDefinition, labelId: string);
104
- }
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 template/ui/templatelistbuttonview
7
+ */
8
+ import type { Locale } from 'ckeditor5/src/utils';
9
+ import { ButtonView, HighlightedTextView, View } from 'ckeditor5/src/ui';
10
+ import type { TemplateDefinition } from '../template';
11
+ /**
12
+ * A class representing an individual button (template) in the list. Renders a rich preview of the template option.
13
+ *
14
+ * @protected
15
+ */
16
+ export default class TemplateListButtonView extends ButtonView {
17
+ /**
18
+ * The definition of the template that the button will apply when executed.
19
+ *
20
+ * @readonly
21
+ */
22
+ templateDefinition: TemplateDefinition;
23
+ /**
24
+ * The view rendering the text part of the template definition.
25
+ *
26
+ * @protected
27
+ * @readonly
28
+ */
29
+ textPartView: TextPartView | null;
30
+ /**
31
+ * Creates an instance of the {@link module:template/ui/templatelistbuttonview~TemplateListButtonView} class.
32
+ *
33
+ * @param locale The localization services instance.
34
+ * @param templateDefinition The definition of the template.
35
+ */
36
+ constructor(locale: Locale, templateDefinition: TemplateDefinition);
37
+ /**
38
+ * @inheritDoc
39
+ */
40
+ render(): void;
41
+ destroy(): void;
42
+ /**
43
+ * Tells whether the `title` or `description` of the {@link #templateDefinition} match against the provided regular expression.
44
+ *
45
+ * @param regExp A regular expression to match the definition against.
46
+ * @returns When the match is positive, an object with the `title` and `description` keys is returned that describes
47
+ * the match. Otherwise, this method returns `null`.
48
+ */
49
+ isMatching(regExp: RegExp): object | null;
50
+ /**
51
+ * Highlights a subset of the {@link #textPartView} text according to a specified regular expression. When `null` is passed,
52
+ * the highlighting is turned off.
53
+ *
54
+ * @param regExp A regular expression used to highlight the matching text in the {@link #textPartView}.
55
+ */
56
+ highlightText(regExp: RegExp | null): void;
57
+ }
58
+ /**
59
+ * A view representing the title and the description of the template.
60
+ *
61
+ * @protected
62
+ */
63
+ export declare class TextPartView extends View {
64
+ /**
65
+ * The title text of the template.
66
+ *
67
+ * @readonly
68
+ */
69
+ title: string;
70
+ /**
71
+ * The description text of the template.
72
+ *
73
+ * @readonly
74
+ */
75
+ description: string | undefined;
76
+ /**
77
+ * Renders the title text of a template.
78
+ *
79
+ * **Note**: It acts as a label of the entire button in the context of accessibility.
80
+ *
81
+ * @readonly
82
+ */
83
+ titleView: HighlightedTextView;
84
+ /**
85
+ * Renders the description text of a template.
86
+ *
87
+ * @readonly
88
+ */
89
+ descriptionView: HighlightedTextView;
90
+ /**
91
+ * Creates an instance of the text part view.
92
+ *
93
+ * @param locale The {@link module:core/editor/editor~Editor#locale} instance.
94
+ * @param templateDefinition The definition of the template.
95
+ * @param labelId A unique ID that connects the entire button with the {@link #titleView} in the context of accessibility.
96
+ */
97
+ constructor(locale: Locale, templateDefinition: TemplateDefinition, labelId: string);
98
+ /**
99
+ * Highlights a subset of the {@link #titleView} and {@link #descriptionView} text according to a specified regular expression.
100
+ *
101
+ * @param regExp
102
+ */
103
+ highlightText(regExp: RegExp | null): void;
104
+ }
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x93f7=['_setupTextContentRendering','lastIndex','substring','index','textPartView','join','element','highlightRegExp','labelView','ck-template-form__description','</mark>','render','text','titleView','map','remove','templateDefinition','innerHTML','locale','exec','<mark>','change:highlightRegExp','highlightText','isColorInherited','description','push','destroy','ck-template-form__text-part','extendTemplate','descriptionView','ck-button__label','setTemplate','set','length','match'];(function(_0x325f0c,_0x93f73a){const _0x2beeb2=function(_0x19e17a){while(--_0x19e17a){_0x325f0c['push'](_0x325f0c['shift']());}};_0x2beeb2(++_0x93f73a);}(_0x93f7,0x137));const _0x2bee=function(_0x325f0c,_0x93f73a){_0x325f0c=_0x325f0c-0x0;let _0x2beeb2=_0x93f7[_0x325f0c];return _0x2beeb2;};import{ButtonView as _0x28ad7c,View as _0x268ffd}from'ckeditor5/src/ui';import{escape as _0x2f218b}from'lodash-es';import _0x405758 from'../../theme/icons/template-generic.svg';export default class E extends _0x28ad7c{constructor(_0x1dc9ce,_0x345cf6){super(_0x1dc9ce),this[_0x2bee('0x14')]=_0x345cf6,this[_0x2bee('0x8')]=null;const {icon:_0xea5bae=_0x405758}=_0x345cf6;this[_0x2bee('0x1')]({'withText':!0x0,'icon':_0xea5bae}),this[_0x2bee('0x20')]({'attributes':{'role':'option'}}),this['iconView'][_0x2bee('0x1b')]=!0x1;}[_0x2bee('0xf')](){super[_0x2bee('0xf')](),this[_0x2bee('0x8')]=new TextPartView(this[_0x2bee('0x16')],this['templateDefinition'],this[_0x2bee('0xc')]['element']['id']),this['children'][_0x2bee('0x13')](this['labelView']),this['children']['add'](this['textPartView']);}[_0x2bee('0x1e')](){super[_0x2bee('0x1e')](),this[_0x2bee('0xc')][_0x2bee('0x1e')]();}['isMatching'](_0x3afe88){const {title:_0x1de7d4,description:_0x48a2cd}=this[_0x2bee('0x14')],_0x534363=!!_0x1de7d4[_0x2bee('0x3')](_0x3afe88),_0xcc71b4=!(!_0x48a2cd||!_0x48a2cd[_0x2bee('0x3')](_0x3afe88));return _0x534363||_0xcc71b4?{'title':_0x534363,'description':_0xcc71b4}:null;}[_0x2bee('0x1a')](_0x36a551){this[_0x2bee('0x8')][_0x2bee('0xb')]=_0x36a551;}}export class TextPartView extends _0x268ffd{constructor(_0x2580bf,_0x14bb82,_0x1f8d0b){super(_0x2580bf),this['title']=_0x14bb82['title'],this[_0x2bee('0x1c')]=_0x14bb82[_0x2bee('0x1c')],this[_0x2bee('0x1')]('highlightRegExp',null),this[_0x2bee('0x11')]=new _0x268ffd(_0x2580bf),this['titleView'][_0x2bee('0x0')]({'tag':'span','attributes':{'class':['ck',_0x2bee('0x22')],'id':_0x1f8d0b}});const _0x260814=[this[_0x2bee('0x11')]];this[_0x2bee('0x1c')]&&(this[_0x2bee('0x21')]=new _0x268ffd(_0x2580bf),this[_0x2bee('0x21')][_0x2bee('0x0')]({'tag':'p','attributes':{'class':['ck',_0x2bee('0xd')]}}),_0x260814['push'](this['descriptionView'])),this[_0x2bee('0x0')]({'tag':'div','attributes':{'class':['ck',_0x2bee('0x1f')]},'children':_0x260814}),this[_0x2bee('0x4')]();}[_0x2bee('0x4')](){const {title:_0x30d51f,description:_0xa2c6dc,titleView:_0x1eb088,descriptionView:_0x106afe}=this,_0xceeb1f=()=>{_0x1eb088[_0x2bee('0xa')][_0x2bee('0x15')]=C(_0x30d51f,this[_0x2bee('0xb')]),_0xa2c6dc&&(_0x106afe[_0x2bee('0xa')][_0x2bee('0x15')]=C(_0xa2c6dc,this[_0x2bee('0xb')]));};this['on']('render',()=>{_0xceeb1f(),this['on'](_0x2bee('0x19'),_0xceeb1f);});}}function C(_0x2a84cf,_0x270f9f){if(!_0x270f9f)return _0x2f218b(_0x2a84cf);const _0x50a4b7=[];let _0x2ab77a,_0x18c198=0x0;for(;null!==(_0x2ab77a=_0x270f9f[_0x2bee('0x17')](_0x2a84cf));){const _0x7426fd=_0x2ab77a[_0x2bee('0x7')];_0x7426fd!==_0x18c198&&_0x50a4b7[_0x2bee('0x1d')]({'text':_0x2a84cf[_0x2bee('0x6')](_0x18c198,_0x7426fd),'isMatch':!0x1}),_0x50a4b7['push']({'text':_0x2ab77a[0x0],'isMatch':!0x0}),_0x18c198=_0x270f9f[_0x2bee('0x5')];}return _0x18c198!==_0x2a84cf[_0x2bee('0x2')]&&_0x50a4b7['push']({'text':_0x2a84cf[_0x2bee('0x6')](_0x18c198),'isMatch':!0x1}),_0x50a4b7[_0x2bee('0x12')](_0xde93c5=>(_0xde93c5[_0x2bee('0x10')]=_0x2f218b(_0xde93c5[_0x2bee('0x10')]),_0xde93c5))[_0x2bee('0x12')](_0x225cb0=>_0x225cb0['isMatch']?_0x2bee('0x18')+_0x225cb0['text']+_0x2bee('0xe'):_0x225cb0['text'])[_0x2bee('0x9')]('');}
23
+ const _0x1e9e=['isMatching','div','match','textPartView','isColorInherited','element','extendTemplate','render','templateDefinition','description','push','text','option','destroy','labelView','descriptionView','title','ck-button__label','ck-template-form__text-part','titleView','iconView','setTemplate','highlightText','children'];(function(_0x481987,_0x1e9ed3){const _0x45f5d4=function(_0x3b6a15){while(--_0x3b6a15){_0x481987['push'](_0x481987['shift']());}};_0x45f5d4(++_0x1e9ed3);}(_0x1e9e,0x193));const _0x45f5=function(_0x481987,_0x1e9ed3){_0x481987=_0x481987-0x0;let _0x45f5d4=_0x1e9e[_0x481987];return _0x45f5d4;};import{ButtonView as _0x2a6aac,HighlightedTextView as _0x322cc9,View as _0x4e92dd}from'ckeditor5/src/ui';import _0x48cec2 from'../../theme/icons/template-generic.svg';export default class w extends _0x2a6aac{constructor(_0x306ab8,_0x5639da){super(_0x306ab8),this['templateDefinition']=_0x5639da,this[_0x45f5('0x8')]=null;const {icon:_0x3d2540=_0x48cec2}=_0x5639da;this['set']({'withText':!0x0,'icon':_0x3d2540}),this[_0x45f5('0xb')]({'attributes':{'role':_0x45f5('0x11')}}),this[_0x45f5('0x1')][_0x45f5('0x9')]=!0x1;}[_0x45f5('0xc')](){super[_0x45f5('0xc')](),this[_0x45f5('0x8')]=new TextPartView(this['locale'],this[_0x45f5('0xd')],this[_0x45f5('0x13')][_0x45f5('0xa')]['id']),this[_0x45f5('0x4')]['remove'](this[_0x45f5('0x13')]),this[_0x45f5('0x4')]['add'](this['textPartView']);}[_0x45f5('0x12')](){super[_0x45f5('0x12')](),this[_0x45f5('0x13')]['destroy']();}[_0x45f5('0x5')](_0x3430f9){const {title:_0x41d6b3,description:_0x39b46f}=this['templateDefinition'],_0xc03d6f=!!_0x41d6b3[_0x45f5('0x7')](_0x3430f9),_0x3fc773=!(!_0x39b46f||!_0x39b46f[_0x45f5('0x7')](_0x3430f9));return _0xc03d6f||_0x3fc773?{'title':_0xc03d6f,'description':_0x3fc773}:null;}[_0x45f5('0x3')](_0x281513){this[_0x45f5('0x8')][_0x45f5('0x3')](_0x281513);}}export class TextPartView extends _0x4e92dd{constructor(_0x48dd4c,_0x4d96ad,_0x31530b){super(_0x48dd4c),this[_0x45f5('0x15')]=_0x4d96ad['title'],this[_0x45f5('0xe')]=_0x4d96ad[_0x45f5('0xe')],this[_0x45f5('0x0')]=new _0x322cc9(),this[_0x45f5('0x0')]['text']=this['title'],this[_0x45f5('0x0')][_0x45f5('0xb')]({'tag':'span','attributes':{'class':[_0x45f5('0x16')],'id':_0x31530b}});const _0x35c89e=[this[_0x45f5('0x0')]];this[_0x45f5('0xe')]&&(this[_0x45f5('0x14')]=new _0x322cc9(),this['descriptionView'][_0x45f5('0x10')]=this[_0x45f5('0xe')],this[_0x45f5('0x14')][_0x45f5('0xb')]({'tag':'p','attributes':{'class':['ck-template-form__description']}}),_0x35c89e[_0x45f5('0xf')](this['descriptionView'])),this[_0x45f5('0x2')]({'tag':_0x45f5('0x6'),'attributes':{'class':['ck',_0x45f5('0x17')]},'children':_0x35c89e});}[_0x45f5('0x3')](_0x1cf0a1){this[_0x45f5('0x0')]['highlightText'](_0x1cf0a1),this['description']&&this['descriptionView']['highlightText'](_0x1cf0a1);}}
@@ -1,34 +1,34 @@
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 template/ui/templatelistitemview
7
- */
8
- import { type Locale } from 'ckeditor5/src/utils';
9
- import { ListItemView } from 'ckeditor5/src/ui';
10
- import type TemplateListButtonView from './templatelistbuttonview';
11
- /**
12
- * A view representing an item in the list of tempaltes.
13
- *
14
- * @protected
15
- */
16
- export default class TemplateListItemView extends ListItemView {
17
- /**
18
- * The initial index of the item in the list of templates.
19
- * Useful while searching and sorting to reverse the list to the same order.
20
- */
21
- readonly originalIndex: number;
22
- /**
23
- * The instance of the template button view containing the title,
24
- * icon, and description of the template.
25
- */
26
- buttonView: TemplateListButtonView | null;
27
- /**
28
- * Creates an instance of the {@link module:template/ui/templatelistitemview~TemplateListItemView} class.
29
- *
30
- * @param locale The localization services instance.
31
- * @param originalIndex The initial index of the item in the list of templates.
32
- */
33
- constructor(locale: Locale, originalIndex: number);
34
- }
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 template/ui/templatelistitemview
7
+ */
8
+ import { type Locale } from 'ckeditor5/src/utils';
9
+ import { ListItemView } from 'ckeditor5/src/ui';
10
+ import type TemplateListButtonView from './templatelistbuttonview';
11
+ /**
12
+ * A view representing an item in the list of tempaltes.
13
+ *
14
+ * @protected
15
+ */
16
+ export default class TemplateListItemView extends ListItemView {
17
+ /**
18
+ * The initial index of the item in the list of templates.
19
+ * Useful while searching and sorting to reverse the list to the same order.
20
+ */
21
+ readonly originalIndex: number;
22
+ /**
23
+ * The instance of the template button view containing the title,
24
+ * icon, and description of the template.
25
+ */
26
+ buttonView: TemplateListButtonView | null;
27
+ /**
28
+ * Creates an instance of the {@link module:template/ui/templatelistitemview~TemplateListItemView} class.
29
+ *
30
+ * @param locale The localization services instance.
31
+ * @param originalIndex The initial index of the item in the list of templates.
32
+ */
33
+ constructor(locale: Locale, originalIndex: number);
34
+ }
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- var _0x4690=['buttonView','originalIndex'];(function(_0x11878a,_0x46900d){var _0x3719cd=function(_0x112d75){while(--_0x112d75){_0x11878a['push'](_0x11878a['shift']());}};_0x3719cd(++_0x46900d);}(_0x4690,0xad));var _0x3719=function(_0x11878a,_0x46900d){_0x11878a=_0x11878a-0x0;var _0x3719cd=_0x4690[_0x11878a];return _0x3719cd;};import{ListItemView as _0x118e97}from'ckeditor5/src/ui';export default class H extends _0x118e97{constructor(_0x38386c,_0x1eccf9){super(_0x38386c),this[_0x3719('0x0')]=_0x1eccf9,this[_0x3719('0x1')]=null;}}
23
+ var _0x4432=['buttonView'];(function(_0x28cb2e,_0x44327a){var _0x1802b4=function(_0x34b337){while(--_0x34b337){_0x28cb2e['push'](_0x28cb2e['shift']());}};_0x1802b4(++_0x44327a);}(_0x4432,0x10f));var _0x1802=function(_0x28cb2e,_0x44327a){_0x28cb2e=_0x28cb2e-0x0;var _0x1802b4=_0x4432[_0x28cb2e];return _0x1802b4;};import{ListItemView as _0x2cfb69}from'ckeditor5/src/ui';export default class p extends _0x2cfb69{constructor(_0x4109b3,_0x246b9f){super(_0x4109b3),this['originalIndex']=_0x246b9f,this[_0x1802('0x0')]=null;}}
@@ -0,0 +1,38 @@
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 template/ui/templatelistview
7
+ */
8
+ import { ListView, type FilteredView } from 'ckeditor5/src/ui';
9
+ /**
10
+ * The template list view class with filtering and sorting.
11
+ *
12
+ * @private
13
+ */
14
+ export default class TemplateListView extends ListView implements FilteredView {
15
+ /**
16
+ * Filters the list of templates according to a specified regular expression. The filtered list is sorted so that items that
17
+ * match the regular expression in their titles are displayed first.
18
+ *
19
+ * Matching items highlight the regular expression (query) in their titles and/or descriptions.
20
+ *
21
+ * **Note**: The `Collection` (also `ViewCollection`) class does not provide sorting functionality. Thus, the functionality
22
+ * implemented in this method is **extremely inefficient** because it clones the entire collection, sorts it as an array,
23
+ * then purges the original collection and sets it from scratch with the sorted array. Purging and resetting the
24
+ * collection triggers an avalanche of `add` and `remove` events synchronously handled by the `Template` (UI bindings)
25
+ * and **rendered in the DOM**. As long as sorting takes shorter than rendering of the DOM this should not be noticeable
26
+ * but the moment it does not, the UI will start glitching. A proper `Collection#sort` is needed to work around
27
+ * this overhead (see https://github.com/ckeditor/ckeditor5/issues/2065).
28
+ *
29
+ * **Note**: Passing `null` to this method resets the list to its original state.
30
+ *
31
+ * @param regExp A regular expression used to match the list title and description.
32
+ * @returns True if some list items matched the regular expression. False otherwise.
33
+ */
34
+ filter(regExp: RegExp | null): {
35
+ resultsCount: number;
36
+ totalItemsCount: number;
37
+ };
38
+ }
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ *
4
+ *
5
+ *
6
+ *
7
+ * +---------------------------------------------------------------------------------+
8
+ * | |
9
+ * | Hello stranger! |
10
+ * | |
11
+ * | |
12
+ * | What you're currently looking at is the source code of a legally protected, |
13
+ * | proprietary software. Any attempts to deobfuscate / disassemble this code |
14
+ * | are forbidden and will result in legal consequences. |
15
+ * | |
16
+ * | |
17
+ * +---------------------------------------------------------------------------------+
18
+ *
19
+ *
20
+ *
21
+ *
22
+ */
23
+ const _0x5404=['size','addMany','clear','isVisible','length','buttonView','items','originalIndex','map','_resetFiltering','set','sort','title','isMatching','get','highlightText','forEach'];(function(_0x36b71c,_0x5404c9){const _0x311604=function(_0x235b33){while(--_0x235b33){_0x36b71c['push'](_0x36b71c['shift']());}};_0x311604(++_0x5404c9);}(_0x5404,0x14a));const _0x3116=function(_0x36b71c,_0x5404c9){_0x36b71c=_0x36b71c-0x0;let _0x311604=_0x5404[_0x36b71c];return _0x311604;};import{ListView as _0x1bb126}from'ckeditor5/src/ui';export default class a extends _0x1bb126{['filter'](_0x139c1b){if(!_0x139c1b)return this['_resetFiltering']();const _0x589729=new Map(),_0x339775=this['items'][_0x3116('0x1')](_0x2f392f=>{const _0x1b1c5a=_0x2f392f[_0x3116('0xf')][_0x3116('0x6')](_0x139c1b);return _0x2f392f[_0x3116('0xd')]=!!_0x1b1c5a,_0x2f392f[_0x3116('0xf')][_0x3116('0x8')](_0x1b1c5a?_0x139c1b:null),_0x1b1c5a&&_0x589729[_0x3116('0x3')](_0x2f392f,_0x1b1c5a),_0x2f392f;})[_0x3116('0x4')](I)[_0x3116('0x4')](function(_0x2147ae){return function(_0x198f9e,_0x326f89){const _0x208ec4=_0x2147ae[_0x3116('0x7')](_0x198f9e),_0x5de7d0=_0x2147ae[_0x3116('0x7')](_0x326f89);return _0x208ec4&&!_0x5de7d0?-0x1:_0x5de7d0&&!_0x208ec4?0x1:_0x208ec4||_0x5de7d0?_0x208ec4[_0x3116('0x5')]&&!_0x5de7d0[_0x3116('0x5')]?-0x1:!_0x208ec4[_0x3116('0x5')]&&_0x5de7d0[_0x3116('0x5')]?0x1:0x0:0x0;};}(_0x589729));return this[_0x3116('0x10')][_0x3116('0xc')](),this['items'][_0x3116('0xb')](_0x339775),{'resultsCount':_0x589729[_0x3116('0xa')],'totalItemsCount':this[_0x3116('0x10')][_0x3116('0xe')]};}[_0x3116('0x2')](){const _0x34a7e8=this[_0x3116('0x10')]['map'](_0x318dcf=>_0x318dcf)[_0x3116('0x4')](I);return _0x34a7e8[_0x3116('0x9')](_0x1ba390=>{_0x1ba390[_0x3116('0xd')]=!0x0,_0x1ba390[_0x3116('0xf')][_0x3116('0x8')](null);}),this[_0x3116('0x10')][_0x3116('0xc')](),this[_0x3116('0x10')][_0x3116('0xb')](_0x34a7e8),{'resultsCount':_0x34a7e8[_0x3116('0xe')],'totalItemsCount':_0x34a7e8['length']};}}function I(_0x2a4d0c,_0x3d9cba){return _0x2a4d0c[_0x3116('0x0')]-_0x3d9cba[_0x3116('0x0')];}