@ckeditor/ckeditor5-template 38.0.1 → 38.1.1
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/build/template.js +1 -1
- package/package.json +8 -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 -26
- package/src/templateediting.js +1 -1
- package/src/templateui.d.ts +29 -29
- package/src/templateui.js +1 -1
- package/src/ui/templateforminfoview.d.ts +51 -51
- package/src/ui/templateforminfoview.js +1 -1
- package/src/ui/templateformsearchfieldview.d.ts +43 -43
- package/src/ui/templateformsearchfieldview.js +1 -1
- package/src/ui/templateformview.d.ts +110 -110
- package/src/ui/templateformview.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
|
@@ -1,110 +1,110 @@
|
|
|
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/templateformview
|
|
7
|
-
*/
|
|
8
|
-
import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils';
|
|
9
|
-
import { View, ListView, type ViewCollection } from 'ckeditor5/src/ui';
|
|
10
|
-
import TemplateFormInfoView from './templateforminfoview';
|
|
11
|
-
import TemplateFormSearchFieldView from './templateformsearchfieldview';
|
|
12
|
-
import { type TemplateDefinition } from '../template';
|
|
13
|
-
/**
|
|
14
|
-
* A class representing the panel with a list of available templates.
|
|
15
|
-
*
|
|
16
|
-
* @extends module:ui/view~View
|
|
17
|
-
*/
|
|
18
|
-
export default class TemplateFormView extends View {
|
|
19
|
-
/**
|
|
20
|
-
* Tracks information about the DOM focus in the form.
|
|
21
|
-
*
|
|
22
|
-
* @readonly
|
|
23
|
-
*/
|
|
24
|
-
focusTracker: FocusTracker;
|
|
25
|
-
/**
|
|
26
|
-
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
27
|
-
*
|
|
28
|
-
* @readonly
|
|
29
|
-
*/
|
|
30
|
-
keystrokes: KeystrokeHandler;
|
|
31
|
-
/**
|
|
32
|
-
* The definition of the template that the button will apply when executed.
|
|
33
|
-
*
|
|
34
|
-
* @readonly
|
|
35
|
-
*/
|
|
36
|
-
templatesDefinitions: Array<TemplateDefinition>;
|
|
37
|
-
/**
|
|
38
|
-
* The templates list view.
|
|
39
|
-
*/
|
|
40
|
-
templateListView: TemplateListView;
|
|
41
|
-
/**
|
|
42
|
-
* A search text field allowing to filter the {@link #templateListView list of templates}.
|
|
43
|
-
*/
|
|
44
|
-
searchFieldView: TemplateFormSearchFieldView;
|
|
45
|
-
/**
|
|
46
|
-
* A view displaying information text when the feature is not configured or no templates were
|
|
47
|
-
* found for the particular phrase.
|
|
48
|
-
*/
|
|
49
|
-
infoView: TemplateFormInfoView;
|
|
50
|
-
/**
|
|
51
|
-
* The collection of the child views inside of the list item {@link #element}.
|
|
52
|
-
*
|
|
53
|
-
* @readonly
|
|
54
|
-
*/
|
|
55
|
-
children: ViewCollection;
|
|
56
|
-
/**
|
|
57
|
-
* Creates an instance of the {@link module:template/ui/templateformview~TemplateFormView} class.
|
|
58
|
-
*
|
|
59
|
-
* @param locale The localization services instance.
|
|
60
|
-
* @param templatesDefinitions Definitions of the templates.
|
|
61
|
-
*/
|
|
62
|
-
constructor(locale: Locale, templatesDefinitions: Array<TemplateDefinition>);
|
|
63
|
-
/**
|
|
64
|
-
* @inheritDoc
|
|
65
|
-
*/
|
|
66
|
-
render(): void;
|
|
67
|
-
/**
|
|
68
|
-
* Focuses the {@link #searchFieldView} if some templates were configured.
|
|
69
|
-
*/
|
|
70
|
-
focus(): void;
|
|
71
|
-
/**
|
|
72
|
-
* Resets the form to its initial state (no search query, all available templates are listed).
|
|
73
|
-
*/
|
|
74
|
-
reset(): void;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* The template list view class with filtering and sorting.
|
|
78
|
-
*
|
|
79
|
-
* @private
|
|
80
|
-
*/
|
|
81
|
-
declare class TemplateListView extends ListView {
|
|
82
|
-
/**
|
|
83
|
-
* Filters the list of templates according to a specified regular expression. The filtered list is sorted so that items that
|
|
84
|
-
* match the regular expression in their titles are displayed first.
|
|
85
|
-
*
|
|
86
|
-
* Matching items highlight the regular expression (query) in their titles and/or descriptions.
|
|
87
|
-
*
|
|
88
|
-
* See {@link #unfilter}.
|
|
89
|
-
*
|
|
90
|
-
* **Note**: The `Collection` (also `ViewCollection`) class does not provide sorting functionality. Thus, the functionality
|
|
91
|
-
* implemented in this method is **extremely inefficient** because it clones the entire collection, sorts it as an array,
|
|
92
|
-
* then purges the original collection and sets it from scratch with the sorted array. Purging and resetting the
|
|
93
|
-
* collection triggers an avalanche of `add` and `remove` events synchronously handled by the `Template` (UI bindings)
|
|
94
|
-
* and **rendered in the DOM**. As long as sorting takes shorter than rendering of the DOM this should not be noticeable
|
|
95
|
-
* but the moment it does not, the UI will start glitching. A proper `Collection#sort` is needed to work around
|
|
96
|
-
* this overhead (see https://github.com/ckeditor/ckeditor5/issues/2065).
|
|
97
|
-
*
|
|
98
|
-
* @param regExp A regular expression used to match the list title and description.
|
|
99
|
-
* @returns True if some list items matched the regular expression. False otherwise.
|
|
100
|
-
*/
|
|
101
|
-
filter(regExp: RegExp): boolean;
|
|
102
|
-
/**
|
|
103
|
-
* Resets the filtering of the list of templates. Removes highlighting in titles and descriptions
|
|
104
|
-
* of list items and restores the default order of the list (as in editor configuration).
|
|
105
|
-
*
|
|
106
|
-
* See {@link #filter}.
|
|
107
|
-
*/
|
|
108
|
-
unfilter(): void;
|
|
109
|
-
}
|
|
110
|
-
export {};
|
|
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/templateformview
|
|
7
|
+
*/
|
|
8
|
+
import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils';
|
|
9
|
+
import { View, ListView, type ViewCollection } from 'ckeditor5/src/ui';
|
|
10
|
+
import TemplateFormInfoView from './templateforminfoview';
|
|
11
|
+
import TemplateFormSearchFieldView from './templateformsearchfieldview';
|
|
12
|
+
import { type TemplateDefinition } from '../template';
|
|
13
|
+
/**
|
|
14
|
+
* A class representing the panel with a list of available templates.
|
|
15
|
+
*
|
|
16
|
+
* @extends module:ui/view~View
|
|
17
|
+
*/
|
|
18
|
+
export default class TemplateFormView extends View {
|
|
19
|
+
/**
|
|
20
|
+
* Tracks information about the DOM focus in the form.
|
|
21
|
+
*
|
|
22
|
+
* @readonly
|
|
23
|
+
*/
|
|
24
|
+
focusTracker: FocusTracker;
|
|
25
|
+
/**
|
|
26
|
+
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
27
|
+
*
|
|
28
|
+
* @readonly
|
|
29
|
+
*/
|
|
30
|
+
keystrokes: KeystrokeHandler;
|
|
31
|
+
/**
|
|
32
|
+
* The definition of the template that the button will apply when executed.
|
|
33
|
+
*
|
|
34
|
+
* @readonly
|
|
35
|
+
*/
|
|
36
|
+
templatesDefinitions: Array<TemplateDefinition>;
|
|
37
|
+
/**
|
|
38
|
+
* The templates list view.
|
|
39
|
+
*/
|
|
40
|
+
templateListView: TemplateListView;
|
|
41
|
+
/**
|
|
42
|
+
* A search text field allowing to filter the {@link #templateListView list of templates}.
|
|
43
|
+
*/
|
|
44
|
+
searchFieldView: TemplateFormSearchFieldView;
|
|
45
|
+
/**
|
|
46
|
+
* A view displaying information text when the feature is not configured or no templates were
|
|
47
|
+
* found for the particular phrase.
|
|
48
|
+
*/
|
|
49
|
+
infoView: TemplateFormInfoView;
|
|
50
|
+
/**
|
|
51
|
+
* The collection of the child views inside of the list item {@link #element}.
|
|
52
|
+
*
|
|
53
|
+
* @readonly
|
|
54
|
+
*/
|
|
55
|
+
children: ViewCollection;
|
|
56
|
+
/**
|
|
57
|
+
* Creates an instance of the {@link module:template/ui/templateformview~TemplateFormView} class.
|
|
58
|
+
*
|
|
59
|
+
* @param locale The localization services instance.
|
|
60
|
+
* @param templatesDefinitions Definitions of the templates.
|
|
61
|
+
*/
|
|
62
|
+
constructor(locale: Locale, templatesDefinitions: Array<TemplateDefinition>);
|
|
63
|
+
/**
|
|
64
|
+
* @inheritDoc
|
|
65
|
+
*/
|
|
66
|
+
render(): void;
|
|
67
|
+
/**
|
|
68
|
+
* Focuses the {@link #searchFieldView} if some templates were configured.
|
|
69
|
+
*/
|
|
70
|
+
focus(): void;
|
|
71
|
+
/**
|
|
72
|
+
* Resets the form to its initial state (no search query, all available templates are listed).
|
|
73
|
+
*/
|
|
74
|
+
reset(): void;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The template list view class with filtering and sorting.
|
|
78
|
+
*
|
|
79
|
+
* @private
|
|
80
|
+
*/
|
|
81
|
+
declare class TemplateListView extends ListView {
|
|
82
|
+
/**
|
|
83
|
+
* Filters the list of templates according to a specified regular expression. The filtered list is sorted so that items that
|
|
84
|
+
* match the regular expression in their titles are displayed first.
|
|
85
|
+
*
|
|
86
|
+
* Matching items highlight the regular expression (query) in their titles and/or descriptions.
|
|
87
|
+
*
|
|
88
|
+
* See {@link #unfilter}.
|
|
89
|
+
*
|
|
90
|
+
* **Note**: The `Collection` (also `ViewCollection`) class does not provide sorting functionality. Thus, the functionality
|
|
91
|
+
* implemented in this method is **extremely inefficient** because it clones the entire collection, sorts it as an array,
|
|
92
|
+
* then purges the original collection and sets it from scratch with the sorted array. Purging and resetting the
|
|
93
|
+
* collection triggers an avalanche of `add` and `remove` events synchronously handled by the `Template` (UI bindings)
|
|
94
|
+
* and **rendered in the DOM**. As long as sorting takes shorter than rendering of the DOM this should not be noticeable
|
|
95
|
+
* but the moment it does not, the UI will start glitching. A proper `Collection#sort` is needed to work around
|
|
96
|
+
* this overhead (see https://github.com/ckeditor/ckeditor5/issues/2065).
|
|
97
|
+
*
|
|
98
|
+
* @param regExp A regular expression used to match the list title and description.
|
|
99
|
+
* @returns True if some list items matched the regular expression. False otherwise.
|
|
100
|
+
*/
|
|
101
|
+
filter(regExp: RegExp): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Resets the filtering of the list of templates. Removes highlighting in titles and descriptions
|
|
104
|
+
* of list items and restores the default order of the list (as in editor configuration).
|
|
105
|
+
*
|
|
106
|
+
* See {@link #filter}.
|
|
107
|
+
*/
|
|
108
|
+
unfilter(): void;
|
|
109
|
+
}
|
|
110
|
+
export {};
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x1dd3=['children','map','title','get','keystrokes','_filterTemplates','listenTo','templateDefinition','arrowdown','_createTemplateListView','set','render','templateListView','_focusCycler','tab','add','createCollection','stopPropagation','isVisible','arrowup','fieldView','unfilter','originalIndex','ck-template-list','reset','forEach','filter','searchFieldView','addMany','isMatching','clear','arrowright','focus','templatesDefinitions','buttonView','highlightText','toLowerCase','infoView','setNoTemplatesFoundText','ck-template-form','_createSearchFieldView','includes','focusTracker','items','length','element','input','delegate','sort','setTemplate'];(function(_0x4bdd87,_0x1dd337){const _0x5cd6a2=function(_0x3a6ba7){while(--_0x3a6ba7){_0x4bdd87['push'](_0x4bdd87['shift']());}};_0x5cd6a2(++_0x1dd337);}(_0x1dd3,0x1a2));const _0x5cd6=function(_0x4bdd87,_0x1dd337){_0x4bdd87=_0x4bdd87-0x0;let _0x5cd6a2=_0x1dd3[_0x4bdd87];return _0x5cd6a2;};import{FocusTracker as _0x4e877f,KeystrokeHandler as _0x40d25d}from'ckeditor5/src/utils';import{View as _0x51d449,ListView as _0x153623,createLabeledInputText as _0xd3e282,FocusCycler as _0x4efb1c,injectCssTransitionDisabler as _0x3cc58a}from'ckeditor5/src/ui';import _0x4560cd from'./templatelistbuttonview';import _0x445a0a from'./templateforminfoview';import _0x58a9bc from'./templateformsearchfieldview';import{escapeRegExp as _0x4d87e3}from'lodash-es';import _0x27c1dd from'./templatelistitemview';export default class f extends _0x51d449{constructor(_0x27a259,_0x4adabd){super(_0x27a259),this[_0x5cd6('0x18')]=new _0x4e877f(),this[_0x5cd6('0x24')]=new _0x40d25d(),this['templatesDefinitions']=_0x4adabd,this[_0x5cd6('0x2c')]=this['_createTemplateListView'](_0x27a259,_0x4adabd),this[_0x5cd6('0x9')]=this[_0x5cd6('0x16')](_0x27a259),this[_0x5cd6('0x13')]=new _0x445a0a(_0x27a259),_0x4adabd[_0x5cd6('0x1a')]||(this['infoView'][_0x5cd6('0x0')]=!0x0,this[_0x5cd6('0x13')]['setNoTemplatesAvailableText']()),this['children']=this[_0x5cd6('0x30')](_0x4adabd[_0x5cd6('0x1a')]?[this[_0x5cd6('0x9')],this['infoView'],this[_0x5cd6('0x2c')]]:[this[_0x5cd6('0x13')]]),this[_0x5cd6('0x2d')]=new _0x4efb1c({'focusables':this[_0x5cd6('0x20')],'focusTracker':this[_0x5cd6('0x18')],'keystrokeHandler':this[_0x5cd6('0x24')],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':_0x5cd6('0x2e')}}),this[_0x5cd6('0x1f')]({'tag':'div','attributes':{'class':['ck',_0x5cd6('0x15')],'tabindex':'-1'},'children':this[_0x5cd6('0x20')]}),_0x3cc58a(this);}[_0x5cd6('0x2b')](){if(super[_0x5cd6('0x2b')](),!this['templatesDefinitions'][_0x5cd6('0x1a')])return;const _0xc6c0b=_0x120c9b=>_0x120c9b[_0x5cd6('0x31')]();this['focusTracker'][_0x5cd6('0x2f')](this[_0x5cd6('0x9')][_0x5cd6('0x1b')]),this[_0x5cd6('0x18')][_0x5cd6('0x2f')](this[_0x5cd6('0x2c')][_0x5cd6('0x1b')]),this[_0x5cd6('0x24')][_0x5cd6('0x26')](this['element']),this[_0x5cd6('0x24')][_0x5cd6('0x2a')](_0x5cd6('0xd'),_0xc6c0b),this[_0x5cd6('0x24')][_0x5cd6('0x2a')]('arrowleft',_0xc6c0b),this[_0x5cd6('0x24')]['set'](_0x5cd6('0x1'),_0xc6c0b),this[_0x5cd6('0x24')][_0x5cd6('0x2a')](_0x5cd6('0x28'),_0xc6c0b);}[_0x5cd6('0xe')](){this['templatesDefinitions'][_0x5cd6('0x1a')]&&this[_0x5cd6('0x9')][_0x5cd6('0xe')]();}[_0x5cd6('0x6')](){this[_0x5cd6('0xf')]['length']&&(this[_0x5cd6('0x9')][_0x5cd6('0x6')](),this[_0x5cd6('0x25')]());}[_0x5cd6('0x25')](_0x5a53d8){if(!this[_0x5cd6('0xf')][_0x5cd6('0x1a')])return;let _0x40be81=!0x1;if(_0x5a53d8)for(const _0x190c56 of this['templateListView'][_0x5cd6('0x19')]){_0x190c56[_0x5cd6('0x20')]['first'][_0x5cd6('0x27')][_0x5cd6('0x22')][_0x5cd6('0x12')]()[_0x5cd6('0x17')](_0x5a53d8['toLowerCase']())?_0x190c56[_0x5cd6('0x0')]=!0x0:_0x190c56[_0x5cd6('0x0')]=!0x1;const _0x47b5d2=new RegExp(_0x4d87e3(_0x5a53d8),'ig');_0x40be81=this[_0x5cd6('0x2c')][_0x5cd6('0x8')](_0x47b5d2);}else this[_0x5cd6('0x2c')][_0x5cd6('0x3')](),_0x40be81=!0x0;this[_0x5cd6('0x13')][_0x5cd6('0x0')]=!_0x40be81,_0x40be81||this['infoView'][_0x5cd6('0x14')](_0x5a53d8);}[_0x5cd6('0x29')](_0x2a323d,_0x40e846){const _0x51dbd5=new L(_0x2a323d);return _0x51dbd5['extendTemplate']({'attributes':{'class':[_0x5cd6('0x5')]}}),_0x51dbd5['items'][_0x5cd6('0xa')](_0x40e846['map']((_0x5cdafd,_0x31cde5)=>{const _0x3c58f6=new _0x27c1dd(_0x2a323d,_0x31cde5),_0xcaa051=new _0x4560cd(_0x2a323d,_0x5cdafd);return _0x3c58f6[_0x5cd6('0x10')]=_0xcaa051,_0x3c58f6['children'][_0x5cd6('0x2f')](_0xcaa051),_0x3c58f6[_0x5cd6('0x20')][_0x5cd6('0x1d')]('execute')['to'](this),_0x3c58f6;})),_0x51dbd5;}[_0x5cd6('0x16')](_0x577c21){const _0x3e28ff=new _0x58a9bc(_0x577c21,_0xd3e282);return this[_0x5cd6('0x26')](_0x3e28ff[_0x5cd6('0x2')],_0x5cd6('0x1c'),()=>{this['_filterTemplates'](_0x3e28ff[_0x5cd6('0x2')][_0x5cd6('0x1b')]['value']);}),_0x3e28ff['on']('reset',()=>{this['reset']();}),_0x3e28ff;}}class L extends _0x153623{[_0x5cd6('0x8')](_0x2d1ee1){const _0x266383=new Map(),_0x219619=this[_0x5cd6('0x19')][_0x5cd6('0x21')](_0x2f3f3d=>{const _0x2c4fd9=_0x2f3f3d['buttonView'][_0x5cd6('0xb')](_0x2d1ee1);return _0x2f3f3d[_0x5cd6('0x0')]=!!_0x2c4fd9,_0x2f3f3d[_0x5cd6('0x10')]['highlightText'](_0x2c4fd9?_0x2d1ee1:null),_0x2c4fd9&&_0x266383[_0x5cd6('0x2a')](_0x2f3f3d,_0x2c4fd9),_0x2f3f3d;})[_0x5cd6('0x1e')](M)['sort']((_0x5f1537,_0x37ed7f)=>{const _0x4bc0ad=_0x266383[_0x5cd6('0x23')](_0x5f1537),_0x5be6d4=_0x266383[_0x5cd6('0x23')](_0x37ed7f);return _0x4bc0ad&&!_0x5be6d4?-0x1:_0x5be6d4&&!_0x4bc0ad?0x1:_0x4bc0ad||_0x5be6d4?_0x4bc0ad[_0x5cd6('0x22')]&&!_0x5be6d4[_0x5cd6('0x22')]?-0x1:!_0x4bc0ad[_0x5cd6('0x22')]&&_0x5be6d4[_0x5cd6('0x22')]?0x1:0x0:0x0;});return this[_0x5cd6('0x19')][_0x5cd6('0xc')](),this['items'][_0x5cd6('0xa')](_0x219619),!!_0x266383['size'];}[_0x5cd6('0x3')](){const _0x1529cd=this[_0x5cd6('0x19')][_0x5cd6('0x21')](_0x108c79=>_0x108c79)[_0x5cd6('0x1e')](M);_0x1529cd[_0x5cd6('0x7')](_0x39de7d=>{_0x39de7d[_0x5cd6('0x0')]=!0x0,_0x39de7d[_0x5cd6('0x10')][_0x5cd6('0x11')](null);}),this[_0x5cd6('0x19')][_0x5cd6('0xc')](),this[_0x5cd6('0x19')][_0x5cd6('0xa')](_0x1529cd);}}function M(_0x567d56,_0x229c7b){return _0x567d56[_0x5cd6('0x4')]-_0x229c7b[_0x5cd6('0x4')];}
|
|
@@ -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, 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
|
+
}
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x43d9=['</mark>','title','innerHTML','ck-template-form__text-part','descriptionView','highlightRegExp','labelView','_setupTextContentRendering','option','element','setTemplate','map','destroy','children','render','add','change:highlightRegExp','iconView','isColorInherited','join','exec','textPartView','<mark>','set','push','description','index','text','extendTemplate','match','locale','templateDefinition','ck-button__label','titleView','length'];(function(_0x6a3541,_0x43d9e4){const _0x1532cf=function(_0x17a301){while(--_0x17a301){_0x6a3541['push'](_0x6a3541['shift']());}};_0x1532cf(++_0x43d9e4);}(_0x43d9,0x7f));const _0x1532=function(_0x6a3541,_0x43d9e4){_0x6a3541=_0x6a3541-0x0;let _0x1532cf=_0x43d9[_0x6a3541];return _0x1532cf;};import{ButtonView as _0x2893df,View as _0x4ab27a}from'ckeditor5/src/ui';import{escape as _0x14190b}from'lodash-es';import _0x44a3dd from'../../theme/icons/template-generic.svg';export default class E extends _0x2893df{constructor(_0x403c40,_0x4dfe29){super(_0x403c40),this['templateDefinition']=_0x4dfe29,this[_0x1532('0x22')]=null;const {icon:_0x26bd16=_0x44a3dd}=_0x4dfe29;this[_0x1532('0x1')]({'withText':!0x0,'icon':_0x26bd16}),this[_0x1532('0x6')]({'attributes':{'role':_0x1532('0x15')}}),this[_0x1532('0x1e')][_0x1532('0x1f')]=!0x1;}['render'](){super[_0x1532('0x1b')](),this[_0x1532('0x22')]=new TextPartView(this[_0x1532('0x8')],this['templateDefinition'],this[_0x1532('0x13')][_0x1532('0x16')]['id']),this['children']['remove'](this['labelView']),this[_0x1532('0x1a')][_0x1532('0x1c')](this[_0x1532('0x22')]);}[_0x1532('0x19')](){super[_0x1532('0x19')](),this['labelView'][_0x1532('0x19')]();}['isMatching'](_0x3c4816){const {title:_0x5ac350,description:_0xf02c43}=this[_0x1532('0x9')],_0x238ece=!!_0x5ac350[_0x1532('0x7')](_0x3c4816),_0x3f8a11=!(!_0xf02c43||!_0xf02c43['match'](_0x3c4816));return _0x238ece||_0x3f8a11?{'title':_0x238ece,'description':_0x3f8a11}:null;}['highlightText'](_0x27e356){this[_0x1532('0x22')][_0x1532('0x12')]=_0x27e356;}}export class TextPartView extends _0x4ab27a{constructor(_0x2e76fa,_0x40bc66,_0x3e10e1){super(_0x2e76fa),this[_0x1532('0xe')]=_0x40bc66[_0x1532('0xe')],this[_0x1532('0x3')]=_0x40bc66['description'],this[_0x1532('0x1')](_0x1532('0x12'),null),this[_0x1532('0xb')]=new _0x4ab27a(_0x2e76fa),this[_0x1532('0xb')][_0x1532('0x17')]({'tag':'span','attributes':{'class':['ck',_0x1532('0xa')],'id':_0x3e10e1}});const _0x30ea5f=[this[_0x1532('0xb')]];this['description']&&(this['descriptionView']=new _0x4ab27a(_0x2e76fa),this['descriptionView']['setTemplate']({'tag':'p','attributes':{'class':['ck','ck-template-form__description']}}),_0x30ea5f[_0x1532('0x2')](this[_0x1532('0x11')])),this['setTemplate']({'tag':'div','attributes':{'class':['ck',_0x1532('0x10')]},'children':_0x30ea5f}),this[_0x1532('0x14')]();}[_0x1532('0x14')](){const {title:_0xbb791f,description:_0x215386,titleView:_0xf4ee84,descriptionView:_0x48a1c5}=this,_0x14c323=()=>{_0xf4ee84[_0x1532('0x16')][_0x1532('0xf')]=C(_0xbb791f,this['highlightRegExp']),_0x215386&&(_0x48a1c5[_0x1532('0x16')][_0x1532('0xf')]=C(_0x215386,this[_0x1532('0x12')]));};this['on'](_0x1532('0x1b'),()=>{_0x14c323(),this['on'](_0x1532('0x1d'),_0x14c323);});}}function C(_0x5888c2,_0x4591ac){if(!_0x4591ac)return _0x14190b(_0x5888c2);const _0x4b2c63=[];let _0x1545aa,_0x37ad6d=0x0;for(;null!==(_0x1545aa=_0x4591ac[_0x1532('0x21')](_0x5888c2));){const _0x47309e=_0x1545aa[_0x1532('0x4')];_0x47309e!==_0x37ad6d&&_0x4b2c63[_0x1532('0x2')]({'text':_0x5888c2['substring'](_0x37ad6d,_0x47309e),'isMatch':!0x1}),_0x4b2c63[_0x1532('0x2')]({'text':_0x1545aa[0x0],'isMatch':!0x0}),_0x37ad6d=_0x4591ac['lastIndex'];}return _0x37ad6d!==_0x5888c2[_0x1532('0xc')]&&_0x4b2c63['push']({'text':_0x5888c2['substring'](_0x37ad6d),'isMatch':!0x1}),_0x4b2c63[_0x1532('0x18')](_0x340589=>(_0x340589[_0x1532('0x5')]=_0x14190b(_0x340589['text']),_0x340589))[_0x1532('0x18')](_0x54c368=>_0x54c368['isMatch']?_0x1532('0x0')+_0x54c368[_0x1532('0x5')]+_0x1532('0xd'):_0x54c368[_0x1532('0x5')])[_0x1532('0x20')]('');}
|
|
@@ -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 _0x3e47=['originalIndex','buttonView'];(function(_0x26e6af,_0x3e47d5){var _0x2ac821=function(_0x5d17ba){while(--_0x5d17ba){_0x26e6af['push'](_0x26e6af['shift']());}};_0x2ac821(++_0x3e47d5);}(_0x3e47,0x107));var _0x2ac8=function(_0x26e6af,_0x3e47d5){_0x26e6af=_0x26e6af-0x0;var _0x2ac821=_0x3e47[_0x26e6af];return _0x2ac821;};import{ListItemView as _0x4bcc68}from'ckeditor5/src/ui';export default class H extends _0x4bcc68{constructor(_0x6907eb,_0x285a83){super(_0x6907eb),this[_0x2ac8('0x1')]=_0x285a83,this[_0x2ac8('0x0')]=null;}}
|