@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.
- package/LICENSE.md +2 -2
- package/README.md +1 -1
- package/build/template.js +1 -1
- package/build/translations/sr-latn.js +1 -0
- package/lang/translations/sr-latn.po +38 -0
- 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 _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'];}
|