@ckeditor/ckeditor5-template 38.1.1 → 38.2.0-alpha.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 +2 -2
- package/package.json +4 -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/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.js';
|
|
9
|
+
import { View, ListView, type ViewCollection } from 'ckeditor5/src/ui.js';
|
|
10
|
+
import TemplateFormInfoView from './templateforminfoview.js';
|
|
11
|
+
import TemplateFormSearchFieldView from './templateformsearchfieldview.js';
|
|
12
|
+
import { type TemplateDefinition } from '../template.js';
|
|
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 _0x36e3=['get','setNoTemplatesAvailableText','buttonView','templatesDefinitions','_filterTemplates','div','length','includes','render','arrowdown','clear','arrowup','unfilter','items','arrowleft','sort','isMatching','element','input','templateListView','shift\x20+\x20tab','_focusCycler','createCollection','highlightText','forEach','isVisible','templateDefinition','reset','infoView','originalIndex','setNoTemplatesFoundText','value','ck-template-form','toLowerCase','set','keystrokes','focus','first','_createTemplateListView','addMany','title','children','listenTo','map','ck-template-list','searchFieldView','focusTracker','add','extendTemplate','filter','arrowright'];(function(_0x172044,_0x36e3fc){const _0x670019=function(_0x4b9393){while(--_0x4b9393){_0x172044['push'](_0x172044['shift']());}};_0x670019(++_0x36e3fc);}(_0x36e3,0xc5));const _0x6700=function(_0x172044,_0x36e3fc){_0x172044=_0x172044-0x0;let _0x670019=_0x36e3[_0x172044];return _0x670019;};import{FocusTracker as _0x596f77,KeystrokeHandler as _0x4120e5}from'ckeditor5/src/utils.js';import{View as _0x2630fe,ListView as _0x5e61b6,createLabeledInputText as _0x158546,FocusCycler as _0x5a9c0e,injectCssTransitionDisabler as _0x4d3bbb}from'ckeditor5/src/ui.js';import _0x5ba4a0 from'./templatelistbuttonview.js';import _0xaf4f from'./templateforminfoview.js';import _0x3948e0 from'./templateformsearchfieldview.js';import{escapeRegExp as _0x14797b}from'lodash-es';import _0x16b683 from'./templatelistitemview.js';export default class f extends _0x2630fe{constructor(_0x185c57,_0x12510b){super(_0x185c57),this[_0x6700('0x2')]=new _0x596f77(),this[_0x6700('0x2a')]=new _0x4120e5(),this[_0x6700('0xa')]=_0x12510b,this['templateListView']=this['_createTemplateListView'](_0x185c57,_0x12510b),this[_0x6700('0x1')]=this['_createSearchFieldView'](_0x185c57),this[_0x6700('0x23')]=new _0xaf4f(_0x185c57),_0x12510b[_0x6700('0xd')]||(this[_0x6700('0x23')][_0x6700('0x20')]=!0x0,this[_0x6700('0x23')][_0x6700('0x8')]()),this[_0x6700('0x30')]=this[_0x6700('0x1d')](_0x12510b[_0x6700('0xd')]?[this[_0x6700('0x1')],this['infoView'],this[_0x6700('0x1a')]]:[this['infoView']]),this[_0x6700('0x1c')]=new _0x5a9c0e({'focusables':this[_0x6700('0x30')],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':_0x6700('0x1b'),'focusNext':'tab'}}),this['setTemplate']({'tag':_0x6700('0xc'),'attributes':{'class':['ck',_0x6700('0x27')],'tabindex':'-1'},'children':this['children']}),_0x4d3bbb(this);}['render'](){if(super[_0x6700('0xf')](),!this['templatesDefinitions'][_0x6700('0xd')])return;const _0x5e57f4=_0x560498=>_0x560498['stopPropagation']();this[_0x6700('0x2')][_0x6700('0x3')](this['searchFieldView'][_0x6700('0x18')]),this['focusTracker'][_0x6700('0x3')](this[_0x6700('0x1a')][_0x6700('0x18')]),this[_0x6700('0x2a')]['listenTo'](this[_0x6700('0x18')]),this[_0x6700('0x2a')][_0x6700('0x29')](_0x6700('0x6'),_0x5e57f4),this['keystrokes']['set'](_0x6700('0x15'),_0x5e57f4),this[_0x6700('0x2a')][_0x6700('0x29')](_0x6700('0x12'),_0x5e57f4),this[_0x6700('0x2a')]['set'](_0x6700('0x10'),_0x5e57f4);}[_0x6700('0x2b')](){this[_0x6700('0xa')]['length']&&this[_0x6700('0x1')][_0x6700('0x2b')]();}[_0x6700('0x22')](){this['templatesDefinitions'][_0x6700('0xd')]&&(this['searchFieldView'][_0x6700('0x22')](),this[_0x6700('0xb')]());}[_0x6700('0xb')](_0x96dd4d){if(!this[_0x6700('0xa')][_0x6700('0xd')])return;let _0xc79a3d=!0x1;if(_0x96dd4d)for(const _0x3a95f4 of this[_0x6700('0x1a')][_0x6700('0x14')]){_0x3a95f4[_0x6700('0x30')][_0x6700('0x2c')][_0x6700('0x21')][_0x6700('0x2f')]['toLowerCase']()[_0x6700('0xe')](_0x96dd4d[_0x6700('0x28')]())?_0x3a95f4[_0x6700('0x20')]=!0x0:_0x3a95f4[_0x6700('0x20')]=!0x1;const _0x4147ac=new RegExp(_0x14797b(_0x96dd4d),'ig');_0xc79a3d=this[_0x6700('0x1a')][_0x6700('0x5')](_0x4147ac);}else this[_0x6700('0x1a')][_0x6700('0x13')](),_0xc79a3d=!0x0;this[_0x6700('0x23')][_0x6700('0x20')]=!_0xc79a3d,_0xc79a3d||this['infoView'][_0x6700('0x25')](_0x96dd4d);}[_0x6700('0x2d')](_0x25c723,_0x80d298){const _0x449782=new H(_0x25c723);return _0x449782[_0x6700('0x4')]({'attributes':{'class':[_0x6700('0x0')]}}),_0x449782[_0x6700('0x14')][_0x6700('0x2e')](_0x80d298[_0x6700('0x32')]((_0x21aa63,_0x2fed46)=>{const _0x338be2=new _0x16b683(_0x25c723,_0x2fed46),_0x82884=new _0x5ba4a0(_0x25c723,_0x21aa63);return _0x338be2['buttonView']=_0x82884,_0x338be2['children'][_0x6700('0x3')](_0x82884),_0x338be2[_0x6700('0x30')]['delegate']('execute')['to'](this),_0x338be2;})),_0x449782;}['_createSearchFieldView'](_0x477e87){const _0x2a7f47=new _0x3948e0(_0x477e87,_0x158546);return this[_0x6700('0x31')](_0x2a7f47['fieldView'],_0x6700('0x19'),()=>{this[_0x6700('0xb')](_0x2a7f47['fieldView'][_0x6700('0x18')][_0x6700('0x26')]);}),_0x2a7f47['on'](_0x6700('0x22'),()=>{this[_0x6700('0x22')]();}),_0x2a7f47;}}class H extends _0x5e61b6{[_0x6700('0x5')](_0x5aeee3){const _0x3be75b=new Map(),_0x5e7244=this['items'][_0x6700('0x32')](_0x590f2d=>{const _0x332fed=_0x590f2d[_0x6700('0x9')][_0x6700('0x17')](_0x5aeee3);return _0x590f2d[_0x6700('0x20')]=!!_0x332fed,_0x590f2d[_0x6700('0x9')][_0x6700('0x1e')](_0x332fed?_0x5aeee3:null),_0x332fed&&_0x3be75b['set'](_0x590f2d,_0x332fed),_0x590f2d;})[_0x6700('0x16')](L)[_0x6700('0x16')]((_0x12fb97,_0x57723c)=>{const _0x208fab=_0x3be75b[_0x6700('0x7')](_0x12fb97),_0x5743c0=_0x3be75b[_0x6700('0x7')](_0x57723c);return _0x208fab&&!_0x5743c0?-0x1:_0x5743c0&&!_0x208fab?0x1:_0x208fab||_0x5743c0?_0x208fab['title']&&!_0x5743c0[_0x6700('0x2f')]?-0x1:!_0x208fab[_0x6700('0x2f')]&&_0x5743c0[_0x6700('0x2f')]?0x1:0x0:0x0;});return this['items'][_0x6700('0x11')](),this[_0x6700('0x14')][_0x6700('0x2e')](_0x5e7244),!!_0x3be75b['size'];}[_0x6700('0x13')](){const _0x50045b=this[_0x6700('0x14')]['map'](_0x5208e9=>_0x5208e9)[_0x6700('0x16')](L);_0x50045b[_0x6700('0x1f')](_0x5be91f=>{_0x5be91f['isVisible']=!0x0,_0x5be91f[_0x6700('0x9')][_0x6700('0x1e')](null);}),this[_0x6700('0x14')][_0x6700('0x11')](),this['items'][_0x6700('0x2e')](_0x50045b);}}function L(_0x3240b7,_0x2cf629){return _0x3240b7[_0x6700('0x24')]-_0x2cf629[_0x6700('0x24')];}
|
|
@@ -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.js';
|
|
9
|
+
import { ButtonView, View } from 'ckeditor5/src/ui.js';
|
|
10
|
+
import type { TemplateDefinition } from '../template.js';
|
|
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 _0x4140=['ck-template-form__description','set','isMatch','labelView','ck-template-form__text-part','render','</mark>','map','substring','titleView','change:highlightRegExp','textPartView','div','exec','destroy','option','locale','children','highlightRegExp','<mark>','highlightText','lastIndex','join','description','index','isColorInherited','element','templateDefinition','_setupTextContentRendering','isMatching','ck-button__label','remove','push','text','descriptionView','setTemplate','innerHTML','match','title'];(function(_0x20dad2,_0x4140b2){const _0x453492=function(_0x16ade6){while(--_0x16ade6){_0x20dad2['push'](_0x20dad2['shift']());}};_0x453492(++_0x4140b2);}(_0x4140,0xee));const _0x4534=function(_0x20dad2,_0x4140b2){_0x20dad2=_0x20dad2-0x0;let _0x453492=_0x4140[_0x20dad2];return _0x453492;};import{ButtonView as _0x212536,View as _0x3cc6f1}from'ckeditor5/src/ui.js';import{escape as _0x4443be}from'lodash-es';import _0x5f4170 from'../../theme/icons/template-generic.svg';export default class y extends _0x212536{constructor(_0x19c119,_0x415764){super(_0x19c119),this[_0x4534('0x17')]=_0x415764,this[_0x4534('0x7')]=null;const {icon:_0x594eb5=_0x5f4170}=_0x415764;this['set']({'withText':!0x0,'icon':_0x594eb5}),this['extendTemplate']({'attributes':{'role':_0x4534('0xb')}}),this['iconView'][_0x4534('0x15')]=!0x1;}[_0x4534('0x1')](){super[_0x4534('0x1')](),this[_0x4534('0x7')]=new TextPartView(this[_0x4534('0xc')],this['templateDefinition'],this[_0x4534('0x26')][_0x4534('0x16')]['id']),this[_0x4534('0xd')][_0x4534('0x1b')](this['labelView']),this['children']['add'](this[_0x4534('0x7')]);}['destroy'](){super[_0x4534('0xa')](),this['labelView']['destroy']();}[_0x4534('0x19')](_0x27456c){const {title:_0x185e8c,description:_0x283168}=this[_0x4534('0x17')],_0x4ef88d=!!_0x185e8c[_0x4534('0x21')](_0x27456c),_0x514674=!(!_0x283168||!_0x283168[_0x4534('0x21')](_0x27456c));return _0x4ef88d||_0x514674?{'title':_0x4ef88d,'description':_0x514674}:null;}[_0x4534('0x10')](_0x1987b0){this[_0x4534('0x7')][_0x4534('0xe')]=_0x1987b0;}}export class TextPartView extends _0x3cc6f1{constructor(_0x3fbf9f,_0x12d52c,_0x1fa091){super(_0x3fbf9f),this[_0x4534('0x22')]=_0x12d52c[_0x4534('0x22')],this['description']=_0x12d52c[_0x4534('0x13')],this[_0x4534('0x24')]('highlightRegExp',null),this[_0x4534('0x5')]=new _0x3cc6f1(_0x3fbf9f),this[_0x4534('0x5')][_0x4534('0x1f')]({'tag':'span','attributes':{'class':['ck',_0x4534('0x1a')],'id':_0x1fa091}});const _0x80171f=[this[_0x4534('0x5')]];this['description']&&(this['descriptionView']=new _0x3cc6f1(_0x3fbf9f),this[_0x4534('0x1e')][_0x4534('0x1f')]({'tag':'p','attributes':{'class':['ck',_0x4534('0x23')]}}),_0x80171f[_0x4534('0x1c')](this[_0x4534('0x1e')])),this['setTemplate']({'tag':_0x4534('0x8'),'attributes':{'class':['ck',_0x4534('0x0')]},'children':_0x80171f}),this[_0x4534('0x18')]();}[_0x4534('0x18')](){const {title:_0x2b32fd,description:_0xc093fc,titleView:_0x561387,descriptionView:_0x32aaee}=this,_0x42e63b=()=>{_0x561387[_0x4534('0x16')][_0x4534('0x20')]=P(_0x2b32fd,this['highlightRegExp']),_0xc093fc&&(_0x32aaee['element'][_0x4534('0x20')]=P(_0xc093fc,this[_0x4534('0xe')]));};this['on'](_0x4534('0x1'),()=>{_0x42e63b(),this['on'](_0x4534('0x6'),_0x42e63b);});}}function P(_0x310654,_0x2953d5){if(!_0x2953d5)return _0x4443be(_0x310654);const _0x469ff4=[];let _0x75c9a5,_0x4389b3=0x0;for(;null!==(_0x75c9a5=_0x2953d5[_0x4534('0x9')](_0x310654));){const _0x5d241a=_0x75c9a5[_0x4534('0x14')];_0x5d241a!==_0x4389b3&&_0x469ff4['push']({'text':_0x310654[_0x4534('0x4')](_0x4389b3,_0x5d241a),'isMatch':!0x1}),_0x469ff4['push']({'text':_0x75c9a5[0x0],'isMatch':!0x0}),_0x4389b3=_0x2953d5[_0x4534('0x11')];}return _0x4389b3!==_0x310654['length']&&_0x469ff4[_0x4534('0x1c')]({'text':_0x310654['substring'](_0x4389b3),'isMatch':!0x1}),_0x469ff4[_0x4534('0x3')](_0x329ca6=>(_0x329ca6[_0x4534('0x1d')]=_0x4443be(_0x329ca6['text']),_0x329ca6))[_0x4534('0x3')](_0x30870b=>_0x30870b[_0x4534('0x25')]?_0x4534('0xf')+_0x30870b[_0x4534('0x1d')]+_0x4534('0x2'):_0x30870b[_0x4534('0x1d')])[_0x4534('0x12')]('');}
|
|
@@ -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.js';
|
|
9
|
+
import { ListItemView } from 'ckeditor5/src/ui.js';
|
|
10
|
+
import type TemplateListButtonView from './templatelistbuttonview.js';
|
|
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 _0x229a=['originalIndex'];(function(_0x268961,_0x229a29){var _0x21708f=function(_0x3ca96d){while(--_0x3ca96d){_0x268961['push'](_0x268961['shift']());}};_0x21708f(++_0x229a29);}(_0x229a,0x106));var _0x2170=function(_0x268961,_0x229a29){_0x268961=_0x268961-0x0;var _0x21708f=_0x229a[_0x268961];return _0x21708f;};import{ListItemView as _0xadf168}from'ckeditor5/src/ui.js';export default class F extends _0xadf168{constructor(_0x3691f7,_0x1453cd){super(_0x3691f7),this[_0x2170('0x0')]=_0x1453cd,this['buttonView']=null;}}
|