@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.
- package/CHANGELOG.md +1 -1
- package/LICENSE.md +4 -4
- package/README.md +7 -7
- package/build/template.js +2 -2
- package/build/translations/ar.js +1 -1
- package/build/translations/bg.js +1 -1
- package/build/translations/bn.js +1 -1
- package/build/translations/ca.js +1 -1
- package/build/translations/cs.js +1 -1
- package/build/translations/da.js +1 -1
- package/build/translations/de.js +1 -1
- package/build/translations/el.js +1 -1
- package/build/translations/en-au.js +1 -1
- package/build/translations/es.js +1 -1
- package/build/translations/et.js +1 -1
- package/build/translations/fi.js +1 -1
- package/build/translations/fr.js +1 -1
- package/build/translations/gl.js +1 -1
- package/build/translations/he.js +1 -1
- package/build/translations/hi.js +1 -1
- package/build/translations/hr.js +1 -1
- package/build/translations/hu.js +1 -1
- package/build/translations/id.js +1 -1
- package/build/translations/it.js +1 -1
- package/build/translations/ja.js +1 -1
- package/build/translations/ko.js +1 -1
- package/build/translations/lt.js +1 -1
- package/build/translations/lv.js +1 -1
- package/build/translations/ms.js +1 -1
- package/build/translations/nl.js +1 -1
- package/build/translations/no.js +1 -1
- package/build/translations/pl.js +1 -1
- package/build/translations/pt-br.js +1 -1
- package/build/translations/pt.js +1 -1
- package/build/translations/ro.js +1 -1
- package/build/translations/ru.js +1 -1
- package/build/translations/sk.js +1 -1
- package/build/translations/sr.js +1 -1
- package/build/translations/sv.js +1 -1
- package/build/translations/th.js +1 -1
- package/build/translations/tr.js +1 -1
- package/build/translations/uk.js +1 -1
- package/build/translations/uz.js +1 -1
- package/build/translations/vi.js +1 -1
- package/build/translations/zh-cn.js +1 -1
- package/build/translations/zh.js +1 -1
- package/lang/contexts.json +1 -2
- package/lang/translations/ar.po +1 -4
- package/lang/translations/bg.po +1 -4
- package/lang/translations/bn.po +1 -4
- package/lang/translations/ca.po +1 -4
- package/lang/translations/cs.po +1 -4
- package/lang/translations/da.po +1 -4
- package/lang/translations/de.po +1 -4
- package/lang/translations/el.po +1 -4
- package/lang/translations/en-au.po +1 -4
- package/lang/translations/en.po +1 -4
- package/lang/translations/es.po +1 -4
- package/lang/translations/et.po +1 -4
- package/lang/translations/fi.po +1 -4
- package/lang/translations/fr.po +1 -4
- package/lang/translations/gl.po +1 -4
- package/lang/translations/he.po +1 -4
- package/lang/translations/hi.po +1 -4
- package/lang/translations/hr.po +1 -4
- package/lang/translations/hu.po +1 -4
- package/lang/translations/id.po +1 -4
- package/lang/translations/it.po +1 -4
- package/lang/translations/ja.po +1 -4
- package/lang/translations/ko.po +1 -4
- package/lang/translations/lt.po +1 -4
- package/lang/translations/lv.po +1 -4
- package/lang/translations/ms.po +1 -4
- package/lang/translations/nl.po +1 -4
- package/lang/translations/no.po +1 -4
- package/lang/translations/pl.po +1 -4
- package/lang/translations/pt-br.po +1 -4
- package/lang/translations/pt.po +1 -4
- package/lang/translations/ro.po +1 -4
- package/lang/translations/ru.po +1 -4
- package/lang/translations/sk.po +1 -4
- package/lang/translations/sr.po +1 -4
- package/lang/translations/sv.po +1 -4
- package/lang/translations/th.po +1 -4
- package/lang/translations/tr.po +1 -4
- package/lang/translations/uk.po +1 -4
- package/lang/translations/uz.po +1 -4
- package/lang/translations/vi.po +1 -4
- package/lang/translations/zh-cn.po +1 -4
- package/lang/translations/zh.po +1 -4
- package/package.json +3 -8
- 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 -0
- package/src/ui/templatelistview.js +23 -0
- package/theme/template.css +95 -187
- package/build/translations/sq.js +0 -1
- package/lang/translations/sq.po +0 -41
- package/src/ui/templateforminfoview.d.ts +0 -51
- package/src/ui/templateforminfoview.js +0 -23
- package/src/ui/templateformsearchfieldview.d.ts +0 -43
- package/src/ui/templateformsearchfieldview.js +0 -23
- package/src/ui/templateformview.d.ts +0 -110
- package/src/ui/templateformview.js +0 -23
- 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
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* **Note**:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* @readonly
|
|
88
|
-
*/
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
* @
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
* @
|
|
100
|
-
*
|
|
101
|
-
* @param
|
|
102
|
-
*/
|
|
103
|
-
|
|
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
|
|
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
|
|
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')];}
|