@ckeditor/ckeditor5-document-outline 40.0.0 → 40.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/LICENSE.md +3 -3
  2. package/README.md +1 -1
  3. package/build/document-outline.js +1 -1
  4. package/build/translations/sr-latn.js +1 -0
  5. package/lang/translations/sr-latn.po +34 -0
  6. package/package.json +3 -3
  7. package/src/augmentation.d.ts +27 -27
  8. package/src/documentoutline/documentoutlineui.d.ts +40 -40
  9. package/src/documentoutline/documentoutlineui.js +1 -1
  10. package/src/documentoutline/documentoutlineutils.d.ts +66 -66
  11. package/src/documentoutline/documentoutlineutils.js +1 -1
  12. package/src/documentoutline/ui/documentoutlineitemview.d.ts +51 -51
  13. package/src/documentoutline/ui/documentoutlineitemview.js +1 -1
  14. package/src/documentoutline/ui/documentoutlineview.d.ts +52 -52
  15. package/src/documentoutline/ui/documentoutlineview.js +1 -1
  16. package/src/documentoutline/utils.d.ts +17 -17
  17. package/src/documentoutline/utils.js +1 -1
  18. package/src/documentoutline.d.ts +99 -99
  19. package/src/documentoutline.js +1 -1
  20. package/src/index.d.ts +19 -19
  21. package/src/index.js +1 -1
  22. package/src/tableofcontents/headingid.d.ts +18 -18
  23. package/src/tableofcontents/headingid.js +1 -1
  24. package/src/tableofcontents/tableofcontentscommand.d.ts +21 -21
  25. package/src/tableofcontents/tableofcontentscommand.js +1 -1
  26. package/src/tableofcontents/tableofcontentsediting.d.ts +37 -37
  27. package/src/tableofcontents/tableofcontentsediting.js +1 -1
  28. package/src/tableofcontents/tableofcontentsui.d.ts +27 -27
  29. package/src/tableofcontents/tableofcontentsui.js +1 -1
  30. package/src/tableofcontents.d.ts +26 -26
  31. package/src/tableofcontents.js +1 -1
  32. package/theme/tableofcontents.css +3 -4
@@ -1,66 +1,66 @@
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 document-outline/documentoutline/documentoutlineutils
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import { type Element } from 'ckeditor5/src/engine';
10
- import { diffToChanges } from 'ckeditor5/src/utils';
11
- /**
12
- * Document outline utilities.
13
- */
14
- export default class DocumentOutlineUtils extends Plugin {
15
- /**
16
- * @inheritDoc
17
- */
18
- static get pluginName(): "DocumentOutlineUtils";
19
- /**
20
- * Starts listening for editor events and handles them on the model document `change` event. This means both
21
- * changes to the structure of the document and changes to the selection are reflected in the outline.
22
- */
23
- init(): void;
24
- /**
25
- * @inheritDoc
26
- */
27
- afterInit(): void;
28
- }
29
- /**
30
- * The definition of the item in the document outline.
31
- */
32
- export type OutlineItemDefinition = {
33
- level: number;
34
- text: string;
35
- modelElement: Element;
36
- };
37
- /**
38
- * Fired whenever the headings structure in the document changes.
39
- *
40
- * @eventName ~DocumentOutlineUtils#change
41
- * @param outlineDefinitions The list of current outline definitions.
42
- * @param outlineChanges Describes what changes were applied in the headings structure.
43
- * @param activeItemIndex The index of the active document outline item.
44
- */
45
- export type OutlineChangeEvent = {
46
- name: 'change';
47
- args: [
48
- {
49
- outlineDefinitions: Array<OutlineItemDefinition>;
50
- outlineChanges: ReturnType<typeof diffToChanges<OutlineItemDefinition>>;
51
- activeItemIndex: number;
52
- }
53
- ];
54
- };
55
- /**
56
- * Fired whenever the active document outline item is changed.
57
- *
58
- * @eventName ~DocumentOutlineUtils#activeItemIndex
59
- * @param activeItemIndex The index of the active document outline item.
60
- */
61
- export type ActiveOutlineItemChangeEvent = {
62
- name: 'activeItemIndex';
63
- args: [{
64
- index: number;
65
- }];
66
- };
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 document-outline/documentoutline/documentoutlineutils
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import { type Element } from 'ckeditor5/src/engine';
10
+ import { diffToChanges } from 'ckeditor5/src/utils';
11
+ /**
12
+ * Document outline utilities.
13
+ */
14
+ export default class DocumentOutlineUtils extends Plugin {
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ static get pluginName(): "DocumentOutlineUtils";
19
+ /**
20
+ * Starts listening for editor events and handles them on the model document `change` event. This means both
21
+ * changes to the structure of the document and changes to the selection are reflected in the outline.
22
+ */
23
+ init(): void;
24
+ /**
25
+ * @inheritDoc
26
+ */
27
+ afterInit(): void;
28
+ }
29
+ /**
30
+ * The definition of the item in the document outline.
31
+ */
32
+ export type OutlineItemDefinition = {
33
+ level: number;
34
+ text: string;
35
+ modelElement: Element;
36
+ };
37
+ /**
38
+ * Fired whenever the headings structure in the document changes.
39
+ *
40
+ * @eventName ~DocumentOutlineUtils#change
41
+ * @param outlineDefinitions The list of current outline definitions.
42
+ * @param outlineChanges Describes what changes were applied in the headings structure.
43
+ * @param activeItemIndex The index of the active document outline item.
44
+ */
45
+ export type OutlineChangeEvent = {
46
+ name: 'change';
47
+ args: [
48
+ {
49
+ outlineDefinitions: Array<OutlineItemDefinition>;
50
+ outlineChanges: ReturnType<typeof diffToChanges<OutlineItemDefinition>>;
51
+ activeItemIndex: number;
52
+ }
53
+ ];
54
+ };
55
+ /**
56
+ * Fired whenever the active document outline item is changed.
57
+ *
58
+ * @eventName ~DocumentOutlineUtils#activeItemIndex
59
+ * @param activeItemIndex The index of the active document outline item.
60
+ */
61
+ export type ActiveOutlineItemChangeEvent = {
62
+ name: 'activeItemIndex';
63
+ args: [{
64
+ index: number;
65
+ }];
66
+ };
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x6f10=['_headingNames','editor','fire','init','domToView','editing','element','get','createElement','push','item','_deriveHeadingElementsFromConversion','getFirstPosition','model','indexOf','DocumentOutlineUtils','getChildren','data','level','config','getChild','getRoot','view','change','text','modelElement','includes','name','activeItemIndex','length','documentOutline.headings','document','toModel','afterInit','findIndex','domConverter','getRootNames','_getActiveHeading','backward'];(function(_0x432c89,_0x6f10c3){const _0x41823d=function(_0x19c941){while(--_0x19c941){_0x432c89['push'](_0x432c89['shift']());}};_0x41823d(++_0x6f10c3);}(_0x6f10,0x17e));const _0x4182=function(_0x432c89,_0x6f10c3){_0x432c89=_0x432c89-0x0;let _0x41823d=_0x6f10[_0x432c89];return _0x41823d;};import{Plugin as _0x5bd9ee}from'ckeditor5/src/core';import{debounce as _0x163f57}from'lodash-es';import{TreeWalker as _0x4a1168}from'ckeditor5/src/engine';import{getElementText as _0x38d8ec,getDefaultFeatureHeadingNames as _0x1a62da}from'./utils';import{diff as _0x5a31a3,diffToChanges as _0x5f1425}from'ckeditor5/src/utils';export default class n extends _0x5bd9ee{constructor(){super(...arguments),this[_0x4182('0x8')]=[];}static get['pluginName'](){return _0x4182('0x17');}[_0x4182('0xb')](){const _0x3611a1=this[_0x4182('0x9')];this['_headingNames']=this['_getHeadingNames']();let _0x592ff4=[];_0x3611a1[_0x4182('0x15')][_0x4182('0x0')]['on'](_0x4182('0x1f'),_0x163f57(()=>{const _0x2c0007=_0x592ff4;_0x592ff4=this['_getOutlineDefinitions']();const _0x5ea4ee=_0x5a31a3(_0x2c0007,_0x592ff4,(_0xdfa754,_0x113e7e)=>_0xdfa754[_0x4182('0x1a')]===_0x113e7e['level']&&_0xdfa754['text']===_0x113e7e[_0x4182('0x20')]&&_0xdfa754[_0x4182('0x21')]===_0x113e7e['modelElement']),_0x105e4e=_0x5f1425(_0x5ea4ee,_0x592ff4),_0x6e5416=this[_0x4182('0x6')](),_0x251877=_0x592ff4[_0x4182('0x3')](_0x1ee76a=>_0x1ee76a[_0x4182('0x21')]===_0x6e5416);_0x105e4e['length']&&this[_0x4182('0xa')]('change',{'outlineDefinitions':_0x592ff4,'activeItemIndex':_0x251877,'outlineChanges':_0x105e4e}),this[_0x4182('0xa')](_0x4182('0x24'),{'index':_0x251877});},0xfa,{'leading':!0x0,'trailing':!0x0}));}[_0x4182('0x2')](){this[_0x4182('0x8')][_0x4182('0x25')]||this[_0x4182('0x13')]();}['_getOutlineDefinitions'](){const _0x43eef6=this[_0x4182('0x9')],_0x56ec03=[],_0x425fc3=this[_0x4182('0x8')];for(const _0x345ed5 of _0x43eef6['model'][_0x4182('0x0')][_0x4182('0x5')]())_0x185def(_0x43eef6[_0x4182('0x15')][_0x4182('0x0')][_0x4182('0x1d')](_0x345ed5));function _0x185def(_0x4ed923){for(const _0x419d75 of _0x4ed923[_0x4182('0x18')]())_0x419d75['is'](_0x4182('0xe'))&&(_0x425fc3[_0x4182('0x22')](_0x419d75[_0x4182('0x23')])&&_0x56ec03[_0x4182('0x11')]({'level':_0x425fc3[_0x4182('0x16')](_0x419d75[_0x4182('0x23')])+0x1,'text':_0x38d8ec(_0x419d75),'modelElement':_0x419d75}),_0x185def(_0x419d75));}return _0x56ec03;}[_0x4182('0x6')](){const _0x182bc2=this[_0x4182('0x9')][_0x4182('0x15')][_0x4182('0x0')]['selection'][_0x4182('0x14')](),_0x8cf504=new _0x4a1168({'direction':_0x4182('0x7'),'startPosition':_0x182bc2});for(const _0x57c45d of _0x8cf504)if(_0x57c45d[_0x4182('0x12')]['is'](_0x4182('0xe'))&&this[_0x4182('0x8')]['includes'](_0x57c45d[_0x4182('0x12')]['name']))return _0x57c45d[_0x4182('0x12')];}['_getHeadingNames'](){const _0x3dd1bb=this['editor'][_0x4182('0x1b')][_0x4182('0xf')](_0x4182('0x26'));return _0x3dd1bb||_0x1a62da(this[_0x4182('0x9')]);}[_0x4182('0x13')](){const _0x4d0e02=this[_0x4182('0x9')],_0x510fc6=['h1','h2','h3','h4','h5','h6'],_0xb3c501=[];for(const _0x4afcef of _0x510fc6){const _0x5ad244=_0x4d0e02[_0x4182('0xd')][_0x4182('0x1e')][_0x4182('0x4')][_0x4182('0xc')](document[_0x4182('0x10')](_0x4afcef)),_0x110493=_0x4d0e02[_0x4182('0x19')][_0x4182('0x1')](_0x5ad244)[_0x4182('0x1c')](0x0);(null==_0x110493?void 0x0:_0x110493['is'](_0x4182('0xe')))&&_0xb3c501[_0x4182('0x11')](_0x110493[_0x4182('0x23')]);}this[_0x4182('0x8')]=_0xb3c501;}}
23
+ const _0x2b06=['pluginName','model','name','indexOf','fire','_headingNames','activeItemIndex','editing','change','createElement','modelElement','toModel','selection','init','getFirstPosition','documentOutline.headings','getChild','_getHeadingNames','_deriveHeadingElementsFromConversion','length','level','includes','document','_getOutlineDefinitions','view','item','findIndex','afterInit','editor','DocumentOutlineUtils','config','text','getRoot','domToView','getChildren','element','backward','push'];(function(_0x449e5b,_0x2b06b1){const _0x4c12f4=function(_0xcf9859){while(--_0xcf9859){_0x449e5b['push'](_0x449e5b['shift']());}};_0x4c12f4(++_0x2b06b1);}(_0x2b06,0x184));const _0x4c12=function(_0x449e5b,_0x2b06b1){_0x449e5b=_0x449e5b-0x0;let _0x4c12f4=_0x2b06[_0x449e5b];return _0x4c12f4;};import{Plugin as _0xb170a}from'ckeditor5/src/core';import{debounce as _0x54ada4}from'lodash-es';import{TreeWalker as _0x9397a6}from'ckeditor5/src/engine';import{getElementText as _0x2a9b2f,getDefaultFeatureHeadingNames as _0x510644}from'./utils';import{diff as _0x2fcced,diffToChanges as _0x55152e}from'ckeditor5/src/utils';export default class n extends _0xb170a{constructor(){super(...arguments),this['_headingNames']=[];}static get[_0x4c12('0x1e')](){return _0x4c12('0x15');}[_0x4c12('0x5')](){const _0x4eb7a1=this['editor'];this[_0x4c12('0x23')]=this[_0x4c12('0x9')]();let _0xd7a5dd=[];_0x4eb7a1[_0x4c12('0x1f')]['document']['on'](_0x4c12('0x0'),_0x54ada4(()=>{const _0x10c7c7=_0xd7a5dd;_0xd7a5dd=this[_0x4c12('0xf')]();const _0x45aa15=_0x2fcced(_0x10c7c7,_0xd7a5dd,(_0x276262,_0x1ca084)=>_0x276262[_0x4c12('0xc')]===_0x1ca084[_0x4c12('0xc')]&&_0x276262[_0x4c12('0x17')]===_0x1ca084['text']&&_0x276262[_0x4c12('0x2')]===_0x1ca084[_0x4c12('0x2')]),_0x4cd906=_0x55152e(_0x45aa15,_0xd7a5dd),_0x2279f9=this['_getActiveHeading'](),_0x32ec75=_0xd7a5dd[_0x4c12('0x12')](_0x4c584c=>_0x4c584c['modelElement']===_0x2279f9);_0x4cd906['length']&&this[_0x4c12('0x22')](_0x4c12('0x0'),{'outlineDefinitions':_0xd7a5dd,'activeItemIndex':_0x32ec75,'outlineChanges':_0x4cd906}),this['fire'](_0x4c12('0x24'),{'index':_0x32ec75});},0xfa,{'leading':!0x0,'trailing':!0x0}));}[_0x4c12('0x13')](){this['_headingNames'][_0x4c12('0xb')]||this['_deriveHeadingElementsFromConversion']();}[_0x4c12('0xf')](){const _0x2ac4f2=this['editor'],_0x251ca5=[],_0x2282d5=this['_headingNames'];for(const _0x234eb2 of _0x2ac4f2['model']['document']['getRootNames']())_0xdea59(_0x2ac4f2[_0x4c12('0x1f')][_0x4c12('0xe')][_0x4c12('0x18')](_0x234eb2));function _0xdea59(_0x16d84f){for(const _0x182fb8 of _0x16d84f[_0x4c12('0x1a')]())_0x182fb8['is'](_0x4c12('0x1b'))&&(_0x2282d5[_0x4c12('0xd')](_0x182fb8['name'])&&_0x251ca5[_0x4c12('0x1d')]({'level':_0x2282d5[_0x4c12('0x21')](_0x182fb8['name'])+0x1,'text':_0x2a9b2f(_0x182fb8),'modelElement':_0x182fb8}),_0xdea59(_0x182fb8));}return _0x251ca5;}['_getActiveHeading'](){const _0xdec32c=this[_0x4c12('0x14')]['model'][_0x4c12('0xe')][_0x4c12('0x4')][_0x4c12('0x6')](),_0x1a7c1b=new _0x9397a6({'direction':_0x4c12('0x1c'),'startPosition':_0xdec32c});for(const _0x2b48d3 of _0x1a7c1b)if(_0x2b48d3[_0x4c12('0x11')]['is'](_0x4c12('0x1b'))&&this[_0x4c12('0x23')][_0x4c12('0xd')](_0x2b48d3[_0x4c12('0x11')][_0x4c12('0x20')]))return _0x2b48d3[_0x4c12('0x11')];}[_0x4c12('0x9')](){const _0x5553ac=this[_0x4c12('0x14')][_0x4c12('0x16')]['get'](_0x4c12('0x7'));return _0x5553ac||_0x510644(this['editor']);}[_0x4c12('0xa')](){const _0x483de9=this['editor'],_0xf3f45a=['h1','h2','h3','h4','h5','h6'],_0x4af6eb=[];for(const _0x1505af of _0xf3f45a){const _0x2c3cc1=_0x483de9[_0x4c12('0x25')][_0x4c12('0x10')]['domConverter'][_0x4c12('0x19')](document[_0x4c12('0x1')](_0x1505af)),_0x187eff=_0x483de9['data'][_0x4c12('0x3')](_0x2c3cc1)[_0x4c12('0x8')](0x0);(null==_0x187eff?void 0x0:_0x187eff['is'](_0x4c12('0x1b')))&&_0x4af6eb[_0x4c12('0x1d')](_0x187eff[_0x4c12('0x20')]);}this[_0x4c12('0x23')]=_0x4af6eb;}}
@@ -1,51 +1,51 @@
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 document-outline/documentoutline/ui/documentoutlineitemview
7
- */
8
- import { View } from 'ckeditor5/src/ui';
9
- import { type Locale } from 'ckeditor5/src/utils';
10
- /**
11
- * An item of the document outline.
12
- */
13
- export default class DocumentOutlineItemView extends View {
14
- /**
15
- * The textual content of the item.
16
- *
17
- * @observable
18
- */
19
- text: string;
20
- /**
21
- * The level of heading nesting in the document.
22
- *
23
- * @observable
24
- */
25
- level: number;
26
- /**
27
- * Indicates whether the given item is currently active.
28
- *
29
- * @observable
30
- */
31
- isActive: boolean;
32
- /**
33
- * Indicates whether the heading doesn't have any text.
34
- *
35
- * @observable
36
- */
37
- isEmpty: boolean;
38
- /**
39
- * @inheritDoc
40
- */
41
- constructor(locale: Locale, showEmptyHeadingText?: boolean);
42
- }
43
- /**
44
- * Fired whenever an item in the document outline is clicked.
45
- *
46
- * @eventName ~DocumentOutlineItemView#click
47
- */
48
- export type DocumentOutlineItemViewClickEvent = {
49
- name: 'click';
50
- args: [];
51
- };
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 document-outline/documentoutline/ui/documentoutlineitemview
7
+ */
8
+ import { View } from 'ckeditor5/src/ui';
9
+ import { type Locale } from 'ckeditor5/src/utils';
10
+ /**
11
+ * An item of the document outline.
12
+ */
13
+ export default class DocumentOutlineItemView extends View {
14
+ /**
15
+ * The textual content of the item.
16
+ *
17
+ * @observable
18
+ */
19
+ text: string;
20
+ /**
21
+ * The level of heading nesting in the document.
22
+ *
23
+ * @observable
24
+ */
25
+ level: number;
26
+ /**
27
+ * Indicates whether the given item is currently active.
28
+ *
29
+ * @observable
30
+ */
31
+ isActive: boolean;
32
+ /**
33
+ * Indicates whether the heading doesn't have any text.
34
+ *
35
+ * @observable
36
+ */
37
+ isEmpty: boolean;
38
+ /**
39
+ * @inheritDoc
40
+ */
41
+ constructor(locale: Locale, showEmptyHeadingText?: boolean);
42
+ }
43
+ /**
44
+ * Fired whenever an item in the document outline is clicked.
45
+ *
46
+ * @eventName ~DocumentOutlineItemView#click
47
+ */
48
+ export type DocumentOutlineItemViewClickEvent = {
49
+ name: 'click';
50
+ args: [];
51
+ };
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{View as _0x5c187c}from'ckeditor5/src/ui';export default class $ extends _0x5c187c{constructor(_0xe6d56,_0x4db29a=!0x1){super(_0xe6d56);const t=_0xe6d56['t'],_0x122bbf=this['bindTemplate'],_0x3505d6=_0x4db29a?'['+t('Empty\x20heading')+']':'';this['set']('text',''),this['set']('level',0x1),this['set']('isActive',!0x1),this['bind']('isEmpty')['to'](this,'text',_0x222e6c=>!_0x222e6c),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-document-outline__item',_0x122bbf['to']('level',_0x57d845=>'ck-document-outline__item_level-'+_0x57d845),_0x122bbf['if']('isActive','ck-document-outline__item_active'),_0x122bbf['if']('isEmpty','ck-document-outline__item_empty')],'title':_0x122bbf['to']('text')},'children':[{'text':_0x122bbf['to']('text',_0x3e6d3a=>_0x3e6d3a||_0x3505d6)}],'on':{'click':_0x122bbf['to']('click')}});}}
23
+ import{View as _0x3fe098}from'ckeditor5/src/ui';export default class $ extends _0x3fe098{constructor(_0x3e424b,_0x51573c=!0x1){super(_0x3e424b);const t=_0x3e424b['t'],_0x4fdeeb=this['bindTemplate'],_0x3c6317=_0x51573c?'['+t('Empty\x20heading')+']':'';this['set']('text',''),this['set']('level',0x1),this['set']('isActive',!0x1),this['bind']('isEmpty')['to'](this,'text',_0x195d76=>!_0x195d76),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-document-outline__item',_0x4fdeeb['to']('level',_0x54a595=>'ck-document-outline__item_level-'+_0x54a595),_0x4fdeeb['if']('isActive','ck-document-outline__item_active'),_0x4fdeeb['if']('isEmpty','ck-document-outline__item_empty')],'title':_0x4fdeeb['to']('text')},'children':[{'text':_0x4fdeeb['to']('text',_0x1e41de=>_0x1e41de||_0x3c6317)}],'on':{'click':_0x4fdeeb['to']('click')}});}}
@@ -1,52 +1,52 @@
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 document-outline/documentoutline/ui/documentoutlineview
7
- */
8
- import { View, type ViewCollection } from 'ckeditor5/src/ui';
9
- import { type Locale, type diffToChanges } from 'ckeditor5/src/utils';
10
- import type { OutlineItemDefinition } from '../documentoutlineutils';
11
- import DocumentOutlineItemView from './documentoutlineitemview';
12
- /**
13
- * The document outline panel.
14
- */
15
- export default class DocumentOutlineView extends View {
16
- /**
17
- * A collection of document outline items.
18
- */
19
- readonly items: ViewCollection<DocumentOutlineItemView>;
20
- /**
21
- * Indicates which item is active at the moment.
22
- *
23
- * @observable
24
- */
25
- activeItemIndex: number;
26
- /**
27
- * Creates an instance of the {@link module:documentoutline/ui/documentoutlineview~DocumentOutlineView} class.
28
- *
29
- * @param locale The localization services instance.
30
- * @param showEmptyHeadingText Indicates whether the display of a placeholder for empty heading is enabled in the editor.
31
- * @param containerElement The element that contains the document outline.
32
- */
33
- constructor(locale: Locale, showEmptyHeadingText?: boolean, containerElement?: HTMLElement);
34
- /**
35
- * If a heading was added or deleted in the editor, insert or delete it in the document outline.
36
- */
37
- sync(changesInItems: ReturnType<typeof diffToChanges<OutlineItemDefinition>>): void;
38
- /**
39
- * @inheritDoc
40
- */
41
- destroy(): void;
42
- }
43
- /**
44
- * Fired whenever an item in the document outline is clicked.
45
- *
46
- * @eventName ~DocumentOutlineView#itemSelected
47
- * @param itemIndex Index of selected item.
48
- */
49
- export type DocumentOutlineViewItemSelectedEvent = {
50
- name: 'itemSelected';
51
- args: [itemIndex: number];
52
- };
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 document-outline/documentoutline/ui/documentoutlineview
7
+ */
8
+ import { View, type ViewCollection } from 'ckeditor5/src/ui';
9
+ import { type Locale, type diffToChanges } from 'ckeditor5/src/utils';
10
+ import type { OutlineItemDefinition } from '../documentoutlineutils';
11
+ import DocumentOutlineItemView from './documentoutlineitemview';
12
+ /**
13
+ * The document outline panel.
14
+ */
15
+ export default class DocumentOutlineView extends View {
16
+ /**
17
+ * A collection of document outline items.
18
+ */
19
+ readonly items: ViewCollection<DocumentOutlineItemView>;
20
+ /**
21
+ * Indicates which item is active at the moment.
22
+ *
23
+ * @observable
24
+ */
25
+ activeItemIndex: number;
26
+ /**
27
+ * Creates an instance of the {@link module:documentoutline/ui/documentoutlineview~DocumentOutlineView} class.
28
+ *
29
+ * @param locale The localization services instance.
30
+ * @param showEmptyHeadingText Indicates whether the display of a placeholder for empty heading is enabled in the editor.
31
+ * @param containerElement The element that contains the document outline.
32
+ */
33
+ constructor(locale: Locale, showEmptyHeadingText?: boolean, containerElement?: HTMLElement);
34
+ /**
35
+ * If a heading was added or deleted in the editor, insert or delete it in the document outline.
36
+ */
37
+ sync(changesInItems: ReturnType<typeof diffToChanges<OutlineItemDefinition>>): void;
38
+ /**
39
+ * @inheritDoc
40
+ */
41
+ destroy(): void;
42
+ }
43
+ /**
44
+ * Fired whenever an item in the document outline is clicked.
45
+ *
46
+ * @eventName ~DocumentOutlineView#itemSelected
47
+ * @param itemIndex Index of selected item.
48
+ */
49
+ export type DocumentOutlineViewItemSelectedEvent = {
50
+ name: 'itemSelected';
51
+ args: [itemIndex: number];
52
+ };
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{View as _0x427d85}from'ckeditor5/src/ui';import{scrollAncestorsToShowTarget as _0x7c39c2}from'ckeditor5/src/utils';import _0x302be6 from'./documentoutlineitemview';export default class d extends _0x427d85{constructor(_0x3fdf20,_0x5ae982=!0x1,_0x203b14){super(_0x3fdf20);const t=_0x3fdf20['t'];this['showEmptyHeadingText']=_0x5ae982,this['set']('activeItemIndex',-0x1),this['_documentOutlineContainer']=_0x203b14,this['items']=this['createCollection'](),this['items']['delegate']('click')['to'](this),this['on']('click',this['_handleItemClick']['bind'](this)),this['on']('change:activeItemIndex',(_0x465ac2,_0xf2d3eb,_0x2e8fee,_0x5c1413)=>{this['_setActiveItem'](_0x5c1413,_0x2e8fee);}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-document-outline'],'dir':_0x3fdf20['contentLanguageDirection'],'data-document-outline-empty-placeholder':t('Editor\x20headings\x20will\x20appear\x20here\x20as\x20you\x20type.'),'tabindex':-0x1},'children':this['items']});}['sync'](_0x576afb){_0x576afb['forEach'](_0x5caa08=>{'insert'==_0x5caa08['type']?this['_insertItem'](_0x5caa08['index'],..._0x5caa08['values']):'delete'==_0x5caa08['type']&&this['_deleteItem'](_0x5caa08['index'],_0x5caa08['howMany']);});}['_setActiveItem'](_0x4c73f2,_0x217b43){if(-0x1!==_0x4c73f2){const _0x16519a=this['items']['get'](_0x4c73f2);_0x16519a&&(_0x16519a['isActive']=!0x1);}-0x1!==_0x217b43&&(this['items']['get'](_0x217b43)['isActive']=!0x0,this['_scrollToItem'](_0x217b43));}['_insertItem'](_0x4aaa6b,..._0x3bc51a){const _0xf35d50=_0x3bc51a['map']((_0x1b97c4,_0x1142bf)=>{const _0x23425c=new _0x302be6(this['locale'],this['showEmptyHeadingText']);return _0x23425c['text']=_0x1b97c4['text'],_0x23425c['level']=_0x1b97c4['level'],_0x4aaa6b+_0x1142bf===this['activeItemIndex']&&(_0x23425c['isActive']=!0x0),_0x23425c;});this['items']['addMany'](_0xf35d50,_0x4aaa6b);}['_deleteItem'](_0x2212cb,_0xc1d88f){do{this['items']['remove'](_0x2212cb);}while(--_0xc1d88f);}['_handleItemClick'](_0x2ac01b){const _0x1ff9b7=this['items']['getIndex'](_0x2ac01b['source']);this['fire']('itemSelected',_0x1ff9b7);}['_scrollToItem'](_0x19d9c3){_0x7c39c2(this['items']['get'](_0x19d9c3)['element'],0x14,this['_documentOutlineContainer']);}['destroy'](){super['destroy'](),this['element']['remove']();}}
23
+ import{View as _0x2b6a14}from'ckeditor5/src/ui';import{scrollAncestorsToShowTarget as _0x53d5b3}from'ckeditor5/src/utils';import _0x54d3ff from'./documentoutlineitemview';export default class d extends _0x2b6a14{constructor(_0x260eae,_0x493939=!0x1,_0x29a6f3){super(_0x260eae);const t=_0x260eae['t'];this['showEmptyHeadingText']=_0x493939,this['set']('activeItemIndex',-0x1),this['_documentOutlineContainer']=_0x29a6f3,this['items']=this['createCollection'](),this['items']['delegate']('click')['to'](this),this['on']('click',this['_handleItemClick']['bind'](this)),this['on']('change:activeItemIndex',(_0xf0395f,_0x2b7009,_0x3b52f6,_0x22d936)=>{this['_setActiveItem'](_0x22d936,_0x3b52f6);}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-document-outline'],'dir':_0x260eae['contentLanguageDirection'],'data-document-outline-empty-placeholder':t('Editor\x20headings\x20will\x20appear\x20here\x20as\x20you\x20type.'),'tabindex':-0x1},'children':this['items']});}['sync'](_0x9f7a4e){_0x9f7a4e['forEach'](_0x4ed6b6=>{'insert'==_0x4ed6b6['type']?this['_insertItem'](_0x4ed6b6['index'],..._0x4ed6b6['values']):'delete'==_0x4ed6b6['type']&&this['_deleteItem'](_0x4ed6b6['index'],_0x4ed6b6['howMany']);});}['_setActiveItem'](_0x163f3f,_0x3d8073){if(-0x1!==_0x163f3f){const _0x2acb5f=this['items']['get'](_0x163f3f);_0x2acb5f&&(_0x2acb5f['isActive']=!0x1);}-0x1!==_0x3d8073&&(this['items']['get'](_0x3d8073)['isActive']=!0x0,this['_scrollToItem'](_0x3d8073));}['_insertItem'](_0x2bf19a,..._0xd5f2d6){const _0x4d2dd4=_0xd5f2d6['map']((_0x4e92ab,_0x2c24e8)=>{const _0x166052=new _0x54d3ff(this['locale'],this['showEmptyHeadingText']);return _0x166052['text']=_0x4e92ab['text'],_0x166052['level']=_0x4e92ab['level'],_0x2bf19a+_0x2c24e8===this['activeItemIndex']&&(_0x166052['isActive']=!0x0),_0x166052;});this['items']['addMany'](_0x4d2dd4,_0x2bf19a);}['_deleteItem'](_0x1ecd0a,_0x361509){do{this['items']['remove'](_0x1ecd0a);}while(--_0x361509);}['_handleItemClick'](_0x3f55d8){const _0x2626e2=this['items']['getIndex'](_0x3f55d8['source']);this['fire']('itemSelected',_0x2626e2);}['_scrollToItem'](_0x70e151){_0x53d5b3(this['items']['get'](_0x70e151)['element'],0x14,this['_documentOutlineContainer']);}['destroy'](){super['destroy'](),this['element']['remove']();}}
@@ -1,17 +1,17 @@
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 document-outline/documentoutline/utils
7
- */
8
- import { type Element } from 'ckeditor5/src/engine';
9
- import { type Editor } from 'ckeditor5/src/core';
10
- /**
11
- * Returns all text contents that are inside the given element and all its children.
12
- */
13
- export declare function getElementText(element: Element): string;
14
- /**
15
- * Returns a list of standard headings or GHS headings configured in the editor.
16
- */
17
- export declare function getDefaultFeatureHeadingNames(editor: Editor): Array<string>;
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 document-outline/documentoutline/utils
7
+ */
8
+ import { type Element } from 'ckeditor5/src/engine';
9
+ import { type Editor } from 'ckeditor5/src/core';
10
+ /**
11
+ * Returns all text contents that are inside the given element and all its children.
12
+ */
13
+ export declare function getElementText(element: Element): string;
14
+ /**
15
+ * Returns a list of standard headings or GHS headings configured in the editor.
16
+ */
17
+ export declare function getDefaultFeatureHeadingNames(editor: Editor): Array<string>;
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x105c=['paragraph','htmlH2','htmlH5','reduce','data','has','get','push','heading.options','getChildren','model','config','plugins'];(function(_0x394506,_0x105c0c){const _0x1c8d26=function(_0x13ebb6){while(--_0x13ebb6){_0x394506['push'](_0x394506['shift']());}};_0x1c8d26(++_0x105c0c);}(_0x105c,0x154));const _0x1c8d=function(_0x394506,_0x105c0c){_0x394506=_0x394506-0x0;let _0x1c8d26=_0x105c[_0x394506];return _0x1c8d26;};import{Text as _0x3ca39f}from'ckeditor5/src/engine';export function getElementText(_0x3f6721){let _0x2fd63c='';for(const _0x160f6a of _0x3f6721[_0x1c8d('0x7')]())_0x160f6a instanceof _0x3ca39f&&(_0x2fd63c+=_0x160f6a[_0x1c8d('0x2')]);return _0x2fd63c;}export function getDefaultFeatureHeadingNames(_0x17a0a5){const _0x36ab70=_0x17a0a5[_0x1c8d('0x9')][_0x1c8d('0x4')](_0x1c8d('0x6'));return _0x36ab70?_0x36ab70[_0x1c8d('0x1')]((_0x4c39dc,_0x529e73)=>(_0x1c8d('0xb')!==_0x529e73[_0x1c8d('0x8')]&&_0x4c39dc[_0x1c8d('0x5')](_0x529e73[_0x1c8d('0x8')]),_0x4c39dc),[]):_0x17a0a5[_0x1c8d('0xa')][_0x1c8d('0x3')]('GeneralHtmlSupport')?['htmlH1',_0x1c8d('0xc'),'htmlH3','htmlH4',_0x1c8d('0x0'),'htmlH6']:[];}
23
+ const _0x1157=['GeneralHtmlSupport','heading.options','htmlH2','push','has','htmlH6','htmlH5','htmlH1','model','getChildren','get','htmlH3'];(function(_0x3a40d3,_0x115770){const _0x514777=function(_0x2edd52){while(--_0x2edd52){_0x3a40d3['push'](_0x3a40d3['shift']());}};_0x514777(++_0x115770);}(_0x1157,0x158));const _0x5147=function(_0x3a40d3,_0x115770){_0x3a40d3=_0x3a40d3-0x0;let _0x514777=_0x1157[_0x3a40d3];return _0x514777;};import{Text as _0x3d536a}from'ckeditor5/src/engine';export function getElementText(_0x1d9f77){let _0x1d9860='';for(const _0x4f5a85 of _0x1d9f77[_0x5147('0x1')]())_0x4f5a85 instanceof _0x3d536a&&(_0x1d9860+=_0x4f5a85['data']);return _0x1d9860;}export function getDefaultFeatureHeadingNames(_0x520727){const _0x5bf488=_0x520727['config'][_0x5147('0x2')](_0x5147('0x5'));return _0x5bf488?_0x5bf488['reduce']((_0x211504,_0x965ff9)=>('paragraph'!==_0x965ff9[_0x5147('0x0')]&&_0x211504[_0x5147('0x7')](_0x965ff9[_0x5147('0x0')]),_0x211504),[]):_0x520727['plugins'][_0x5147('0x8')](_0x5147('0x4'))?[_0x5147('0xb'),_0x5147('0x6'),_0x5147('0x3'),'htmlH4',_0x5147('0xa'),_0x5147('0x9')]:[];}