@ckeditor/ckeditor5-template 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.
@@ -1,38 +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
- }
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
+ }
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
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')];}
23
+ const _0x4772=['items','map','get','_resetFiltering','title','length','buttonView','sort','clear','isVisible','highlightText','set','filter','originalIndex','size'];(function(_0x28d5e7,_0x477258){const _0x599843=function(_0x3d1352){while(--_0x3d1352){_0x28d5e7['push'](_0x28d5e7['shift']());}};_0x599843(++_0x477258);}(_0x4772,0x10f));const _0x5998=function(_0x28d5e7,_0x477258){_0x28d5e7=_0x28d5e7-0x0;let _0x599843=_0x4772[_0x28d5e7];return _0x599843;};import{ListView as _0x39e3d9}from'ckeditor5/src/ui';export default class a extends _0x39e3d9{[_0x5998('0xb')](_0x1eafa2){if(!_0x1eafa2)return this[_0x5998('0x2')]();const _0x1c0b3d=new Map(),_0x2784f7=this[_0x5998('0xe')][_0x5998('0x0')](_0x261efe=>{const _0x4fe397=_0x261efe[_0x5998('0x5')]['isMatching'](_0x1eafa2);return _0x261efe['isVisible']=!!_0x4fe397,_0x261efe['buttonView'][_0x5998('0x9')](_0x4fe397?_0x1eafa2:null),_0x4fe397&&_0x1c0b3d[_0x5998('0xa')](_0x261efe,_0x4fe397),_0x261efe;})['sort'](I)[_0x5998('0x6')](function(_0x150bac){return function(_0x1af61d,_0x3e121b){const _0x32ac20=_0x150bac[_0x5998('0x1')](_0x1af61d),_0x51ae83=_0x150bac[_0x5998('0x1')](_0x3e121b);return _0x32ac20&&!_0x51ae83?-0x1:_0x51ae83&&!_0x32ac20?0x1:_0x32ac20||_0x51ae83?_0x32ac20[_0x5998('0x3')]&&!_0x51ae83['title']?-0x1:!_0x32ac20[_0x5998('0x3')]&&_0x51ae83[_0x5998('0x3')]?0x1:0x0:0x0;};}(_0x1c0b3d));return this[_0x5998('0xe')]['clear'](),this[_0x5998('0xe')]['addMany'](_0x2784f7),{'resultsCount':_0x1c0b3d[_0x5998('0xd')],'totalItemsCount':this[_0x5998('0xe')][_0x5998('0x4')]};}['_resetFiltering'](){const _0x3fea0b=this[_0x5998('0xe')][_0x5998('0x0')](_0x2b9678=>_0x2b9678)[_0x5998('0x6')](I);return _0x3fea0b['forEach'](_0x2750ca=>{_0x2750ca[_0x5998('0x8')]=!0x0,_0x2750ca[_0x5998('0x5')][_0x5998('0x9')](null);}),this[_0x5998('0xe')][_0x5998('0x7')](),this['items']['addMany'](_0x3fea0b),{'resultsCount':_0x3fea0b[_0x5998('0x4')],'totalItemsCount':_0x3fea0b[_0x5998('0x4')]};}}function I(_0x19a9ad,_0x48d672){return _0x19a9ad[_0x5998('0xc')]-_0x48d672['originalIndex'];}