@ckeditor/ckeditor5-template 40.0.0 → 40.1.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.
- package/LICENSE.md +2 -2
- package/build/template.js +1 -1
- package/package.json +3 -3
- package/src/augmentation.d.ts +23 -23
- package/src/index.d.ts +13 -13
- package/src/index.js +1 -1
- package/src/template.d.ts +115 -115
- package/src/template.js +1 -1
- package/src/templatecommand.d.ts +23 -23
- package/src/templatecommand.js +1 -1
- package/src/templateediting.d.ts +30 -30
- package/src/templateediting.js +1 -1
- package/src/templateui.d.ts +29 -29
- package/src/templateui.js +1 -1
- package/src/ui/templatelistbuttonview.d.ts +104 -104
- package/src/ui/templatelistbuttonview.js +1 -1
- package/src/ui/templatelistitemview.d.ts +34 -34
- package/src/ui/templatelistitemview.js +1 -1
- package/src/ui/templatelistview.d.ts +38 -38
- package/src/ui/templatelistview.js +1 -1
|
@@ -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
|
|
23
|
+
const _0x4c87=['_resetFiltering','size','sort','length','isMatching','filter','buttonView','get','items','addMany','clear','originalIndex','map','highlightText','title','isVisible','forEach'];(function(_0x7aedb7,_0x4c8724){const _0x450fac=function(_0x1624bb){while(--_0x1624bb){_0x7aedb7['push'](_0x7aedb7['shift']());}};_0x450fac(++_0x4c8724);}(_0x4c87,0x84));const _0x450f=function(_0x7aedb7,_0x4c8724){_0x7aedb7=_0x7aedb7-0x0;let _0x450fac=_0x4c87[_0x7aedb7];return _0x450fac;};import{ListView as _0x5966e6}from'ckeditor5/src/ui';export default class a extends _0x5966e6{[_0x450f('0x9')](_0xdc7ba6){if(!_0xdc7ba6)return this[_0x450f('0x4')]();const _0x2e0f41=new Map(),_0x5b9012=this[_0x450f('0xc')][_0x450f('0x10')](_0x204398=>{const _0x4b4336=_0x204398[_0x450f('0xa')][_0x450f('0x8')](_0xdc7ba6);return _0x204398[_0x450f('0x2')]=!!_0x4b4336,_0x204398[_0x450f('0xa')][_0x450f('0x0')](_0x4b4336?_0xdc7ba6:null),_0x4b4336&&_0x2e0f41['set'](_0x204398,_0x4b4336),_0x204398;})['sort'](I)[_0x450f('0x6')](function(_0x15be70){return function(_0x537108,_0x2a7c5a){const _0x1c89ef=_0x15be70['get'](_0x537108),_0x1ff14a=_0x15be70[_0x450f('0xb')](_0x2a7c5a);return _0x1c89ef&&!_0x1ff14a?-0x1:_0x1ff14a&&!_0x1c89ef?0x1:_0x1c89ef||_0x1ff14a?_0x1c89ef[_0x450f('0x1')]&&!_0x1ff14a['title']?-0x1:!_0x1c89ef[_0x450f('0x1')]&&_0x1ff14a['title']?0x1:0x0:0x0;};}(_0x2e0f41));return this[_0x450f('0xc')][_0x450f('0xe')](),this[_0x450f('0xc')][_0x450f('0xd')](_0x5b9012),{'resultsCount':_0x2e0f41[_0x450f('0x5')],'totalItemsCount':this[_0x450f('0xc')][_0x450f('0x7')]};}['_resetFiltering'](){const _0x74511f=this[_0x450f('0xc')][_0x450f('0x10')](_0x28a0b0=>_0x28a0b0)['sort'](I);return _0x74511f[_0x450f('0x3')](_0x286229=>{_0x286229[_0x450f('0x2')]=!0x0,_0x286229[_0x450f('0xa')][_0x450f('0x0')](null);}),this[_0x450f('0xc')]['clear'](),this['items']['addMany'](_0x74511f),{'resultsCount':_0x74511f[_0x450f('0x7')],'totalItemsCount':_0x74511f[_0x450f('0x7')]};}}function I(_0x50ff3d,_0x353c87){return _0x50ff3d['originalIndex']-_0x353c87[_0x450f('0xf')];}
|