@ckeditor/ckeditor5-document-outline 40.0.0 → 40.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +3 -3
- package/build/document-outline.js +1 -1
- package/package.json +3 -3
- package/src/augmentation.d.ts +27 -27
- package/src/documentoutline/documentoutlineui.d.ts +40 -40
- package/src/documentoutline/documentoutlineui.js +1 -1
- package/src/documentoutline/documentoutlineutils.d.ts +66 -66
- package/src/documentoutline/documentoutlineutils.js +1 -1
- package/src/documentoutline/ui/documentoutlineitemview.d.ts +51 -51
- package/src/documentoutline/ui/documentoutlineitemview.js +1 -1
- package/src/documentoutline/ui/documentoutlineview.d.ts +52 -52
- package/src/documentoutline/ui/documentoutlineview.js +1 -1
- package/src/documentoutline/utils.d.ts +17 -17
- package/src/documentoutline/utils.js +1 -1
- package/src/documentoutline.d.ts +99 -99
- package/src/documentoutline.js +1 -1
- package/src/index.d.ts +19 -19
- package/src/index.js +1 -1
- package/src/tableofcontents/headingid.d.ts +18 -18
- package/src/tableofcontents/headingid.js +1 -1
- package/src/tableofcontents/tableofcontentscommand.d.ts +21 -21
- package/src/tableofcontents/tableofcontentscommand.js +1 -1
- package/src/tableofcontents/tableofcontentsediting.d.ts +37 -37
- package/src/tableofcontents/tableofcontentsediting.js +1 -1
- package/src/tableofcontents/tableofcontentsui.d.ts +27 -27
- package/src/tableofcontents/tableofcontentsui.js +1 -1
- package/src/tableofcontents.d.ts +26 -26
- package/src/tableofcontents.js +1 -1
- package/theme/tableofcontents.css +3 -4
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x2f2e=['level','_getOutlineDefinitions','data','domToView','activeItemIndex','element','editing','_headingNames','name','selection','item','DocumentOutlineUtils','pluginName','get','domConverter','_getActiveHeading','indexOf','backward','fire','getRoot','getChild','getRootNames','length','push','text','editor','change','documentOutline.headings','getChildren','createElement','includes','document','findIndex','modelElement','getFirstPosition','config','model'];(function(_0x4211e3,_0x2f2e33){const _0x269217=function(_0x4b536e){while(--_0x4b536e){_0x4211e3['push'](_0x4211e3['shift']());}};_0x269217(++_0x2f2e33);}(_0x2f2e,0x179));const _0x2692=function(_0x4211e3,_0x2f2e33){_0x4211e3=_0x4211e3-0x0;let _0x269217=_0x2f2e[_0x4211e3];return _0x269217;};import{Plugin as _0x4edffd}from'ckeditor5/src/core';import{debounce as _0x362603}from'lodash-es';import{TreeWalker as _0x54b9cb}from'ckeditor5/src/engine';import{getElementText as _0x172884,getDefaultFeatureHeadingNames as _0x5ec499}from'./utils';import{diff as _0x4e9d1f,diffToChanges as _0x2e6988}from'ckeditor5/src/utils';export default class n extends _0x4edffd{constructor(){super(...arguments),this[_0x2692('0x0')]=[];}static get[_0x2692('0x5')](){return _0x2692('0x4');}['init'](){const _0x31372e=this[_0x2692('0x12')];this['_headingNames']=this['_getHeadingNames']();let _0x46662f=[];_0x31372e[_0x2692('0x1d')][_0x2692('0x18')]['on'](_0x2692('0x13'),_0x362603(()=>{const _0x3d02c3=_0x46662f;_0x46662f=this[_0x2692('0x1f')]();const _0x3c607f=_0x4e9d1f(_0x3d02c3,_0x46662f,(_0x3438ff,_0x4bd935)=>_0x3438ff[_0x2692('0x1e')]===_0x4bd935['level']&&_0x3438ff[_0x2692('0x11')]===_0x4bd935[_0x2692('0x11')]&&_0x3438ff[_0x2692('0x1a')]===_0x4bd935['modelElement']),_0x47c31b=_0x2e6988(_0x3c607f,_0x46662f),_0x4c917f=this[_0x2692('0x8')](),_0x3e4691=_0x46662f[_0x2692('0x19')](_0x22e85b=>_0x22e85b['modelElement']===_0x4c917f);_0x47c31b[_0x2692('0xf')]&&this[_0x2692('0xb')](_0x2692('0x13'),{'outlineDefinitions':_0x46662f,'activeItemIndex':_0x3e4691,'outlineChanges':_0x47c31b}),this['fire'](_0x2692('0x22'),{'index':_0x3e4691});},0xfa,{'leading':!0x0,'trailing':!0x0}));}['afterInit'](){this[_0x2692('0x0')][_0x2692('0xf')]||this['_deriveHeadingElementsFromConversion']();}[_0x2692('0x1f')](){const _0x498602=this[_0x2692('0x12')],_0x2cea0d=[],_0x1c3e4d=this[_0x2692('0x0')];for(const _0x8338f2 of _0x498602[_0x2692('0x1d')][_0x2692('0x18')][_0x2692('0xe')]())_0x19f9a3(_0x498602[_0x2692('0x1d')][_0x2692('0x18')][_0x2692('0xc')](_0x8338f2));function _0x19f9a3(_0x27ab48){for(const _0x2731cf of _0x27ab48[_0x2692('0x15')]())_0x2731cf['is'](_0x2692('0x23'))&&(_0x1c3e4d[_0x2692('0x17')](_0x2731cf[_0x2692('0x1')])&&_0x2cea0d[_0x2692('0x10')]({'level':_0x1c3e4d[_0x2692('0x9')](_0x2731cf['name'])+0x1,'text':_0x172884(_0x2731cf),'modelElement':_0x2731cf}),_0x19f9a3(_0x2731cf));}return _0x2cea0d;}[_0x2692('0x8')](){const _0x443f6a=this[_0x2692('0x12')][_0x2692('0x1d')][_0x2692('0x18')][_0x2692('0x2')][_0x2692('0x1b')](),_0x1a0317=new _0x54b9cb({'direction':_0x2692('0xa'),'startPosition':_0x443f6a});for(const _0x33b3fe of _0x1a0317)if(_0x33b3fe[_0x2692('0x3')]['is']('element')&&this[_0x2692('0x0')][_0x2692('0x17')](_0x33b3fe[_0x2692('0x3')]['name']))return _0x33b3fe['item'];}['_getHeadingNames'](){const _0xfd13f0=this[_0x2692('0x12')][_0x2692('0x1c')][_0x2692('0x6')](_0x2692('0x14'));return _0xfd13f0||_0x5ec499(this[_0x2692('0x12')]);}['_deriveHeadingElementsFromConversion'](){const _0x2fcbac=this[_0x2692('0x12')],_0x2dc59b=['h1','h2','h3','h4','h5','h6'],_0x466d3a=[];for(const _0x180fca of _0x2dc59b){const _0x1b2c5d=_0x2fcbac[_0x2692('0x24')]['view'][_0x2692('0x7')][_0x2692('0x21')](document[_0x2692('0x16')](_0x180fca)),_0x1e7f2d=_0x2fcbac[_0x2692('0x20')]['toModel'](_0x1b2c5d)[_0x2692('0xd')](0x0);(null==_0x1e7f2d?void 0x0:_0x1e7f2d['is'](_0x2692('0x23')))&&_0x466d3a[_0x2692('0x10')](_0x1e7f2d[_0x2692('0x1')]);}this[_0x2692('0x0')]=_0x466d3a;}}
|
|
@@ -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
|
|
23
|
+
import{View as _0x14a9e3}from'ckeditor5/src/ui';export default class $ extends _0x14a9e3{constructor(_0x1ff1ac,_0xb90094=!0x1){super(_0x1ff1ac);const t=_0x1ff1ac['t'],_0x118c84=this['bindTemplate'],_0x4aecbe=_0xb90094?'['+t('Empty\x20heading')+']':'';this['set']('text',''),this['set']('level',0x1),this['set']('isActive',!0x1),this['bind']('isEmpty')['to'](this,'text',_0x4771bb=>!_0x4771bb),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-document-outline__item',_0x118c84['to']('level',_0xc78d60=>'ck-document-outline__item_level-'+_0xc78d60),_0x118c84['if']('isActive','ck-document-outline__item_active'),_0x118c84['if']('isEmpty','ck-document-outline__item_empty')],'title':_0x118c84['to']('text')},'children':[{'text':_0x118c84['to']('text',_0x17f534=>_0x17f534||_0x4aecbe)}],'on':{'click':_0x118c84['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
|
|
23
|
+
import{View as _0x55a0a6}from'ckeditor5/src/ui';import{scrollAncestorsToShowTarget as _0xccf41a}from'ckeditor5/src/utils';import _0x471aaa from'./documentoutlineitemview';export default class d extends _0x55a0a6{constructor(_0x3ebf3e,_0x430793=!0x1,_0x24ee65){super(_0x3ebf3e);const t=_0x3ebf3e['t'];this['showEmptyHeadingText']=_0x430793,this['set']('activeItemIndex',-0x1),this['_documentOutlineContainer']=_0x24ee65,this['items']=this['createCollection'](),this['items']['delegate']('click')['to'](this),this['on']('click',this['_handleItemClick']['bind'](this)),this['on']('change:activeItemIndex',(_0x191cf6,_0x21f8bf,_0x415911,_0x41c2e0)=>{this['_setActiveItem'](_0x41c2e0,_0x415911);}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-document-outline'],'dir':_0x3ebf3e['contentLanguageDirection'],'data-document-outline-empty-placeholder':t('Editor\x20headings\x20will\x20appear\x20here\x20as\x20you\x20type.'),'tabindex':-0x1},'children':this['items']});}['sync'](_0x52cdc3){_0x52cdc3['forEach'](_0x44b671=>{'insert'==_0x44b671['type']?this['_insertItem'](_0x44b671['index'],..._0x44b671['values']):'delete'==_0x44b671['type']&&this['_deleteItem'](_0x44b671['index'],_0x44b671['howMany']);});}['_setActiveItem'](_0x4cc2cd,_0x2ff564){if(-0x1!==_0x4cc2cd){const _0x5c1d38=this['items']['get'](_0x4cc2cd);_0x5c1d38&&(_0x5c1d38['isActive']=!0x1);}-0x1!==_0x2ff564&&(this['items']['get'](_0x2ff564)['isActive']=!0x0,this['_scrollToItem'](_0x2ff564));}['_insertItem'](_0x4d565f,..._0xae8e49){const _0x2e34a3=_0xae8e49['map']((_0x240f0c,_0xc822ed)=>{const _0x49ca2d=new _0x471aaa(this['locale'],this['showEmptyHeadingText']);return _0x49ca2d['text']=_0x240f0c['text'],_0x49ca2d['level']=_0x240f0c['level'],_0x4d565f+_0xc822ed===this['activeItemIndex']&&(_0x49ca2d['isActive']=!0x0),_0x49ca2d;});this['items']['addMany'](_0x2e34a3,_0x4d565f);}['_deleteItem'](_0x151939,_0x2131a7){do{this['items']['remove'](_0x151939);}while(--_0x2131a7);}['_handleItemClick'](_0x4d6741){const _0x462be1=this['items']['getIndex'](_0x4d6741['source']);this['fire']('itemSelected',_0x462be1);}['_scrollToItem'](_0x1082af){_0xccf41a(this['items']['get'](_0x1082af)['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
|
|
23
|
+
const _0xb012=['htmlH6','push','model','data','htmlH2','GeneralHtmlSupport','reduce','htmlH4','heading.options','htmlH1','htmlH5','htmlH3','plugins','get'];(function(_0x1abfba,_0xb012c5){const _0x303079=function(_0x51626e){while(--_0x51626e){_0x1abfba['push'](_0x1abfba['shift']());}};_0x303079(++_0xb012c5);}(_0xb012,0xd4));const _0x3030=function(_0x1abfba,_0xb012c5){_0x1abfba=_0x1abfba-0x0;let _0x303079=_0xb012[_0x1abfba];return _0x303079;};import{Text as _0x4c9401}from'ckeditor5/src/engine';export function getElementText(_0x2918ed){let _0x41602e='';for(const _0x473ee4 of _0x2918ed['getChildren']())_0x473ee4 instanceof _0x4c9401&&(_0x41602e+=_0x473ee4[_0x3030('0x1')]);return _0x41602e;}export function getDefaultFeatureHeadingNames(_0x55fe43){const _0x51e65b=_0x55fe43['config'][_0x3030('0xb')](_0x3030('0x6'));return _0x51e65b?_0x51e65b[_0x3030('0x4')]((_0x441489,_0x41fe21)=>('paragraph'!==_0x41fe21[_0x3030('0x0')]&&_0x441489[_0x3030('0xd')](_0x41fe21[_0x3030('0x0')]),_0x441489),[]):_0x55fe43[_0x3030('0xa')]['has'](_0x3030('0x3'))?[_0x3030('0x7'),_0x3030('0x2'),_0x3030('0x9'),_0x3030('0x5'),_0x3030('0x8'),_0x3030('0xc')]:[];}
|
package/src/documentoutline.d.ts
CHANGED
|
@@ -1,99 +1,99 @@
|
|
|
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
|
|
7
|
-
* @publicApi
|
|
8
|
-
*/
|
|
9
|
-
import { Plugin, type Editor } from 'ckeditor5/src/core';
|
|
10
|
-
import DocumentOutlineUtils from './documentoutline/documentoutlineutils';
|
|
11
|
-
import DocumentOutlineUI from './documentoutline/documentoutlineui';
|
|
12
|
-
/**
|
|
13
|
-
* The document outline feature.
|
|
14
|
-
* It allows for an easy access to a predefined list of headings in the document.
|
|
15
|
-
*/
|
|
16
|
-
export default class DocumentOutline extends Plugin {
|
|
17
|
-
licenseKey: string;
|
|
18
|
-
/**
|
|
19
|
-
* @inheritDoc
|
|
20
|
-
*/
|
|
21
|
-
static get requires(): readonly [typeof DocumentOutlineUtils, typeof DocumentOutlineUI];
|
|
22
|
-
/**
|
|
23
|
-
* @inheritDoc
|
|
24
|
-
*/
|
|
25
|
-
static get pluginName(): "DocumentOutline";
|
|
26
|
-
/**
|
|
27
|
-
* @inheritDoc
|
|
28
|
-
*/
|
|
29
|
-
constructor(editor: Editor);
|
|
30
|
-
/**
|
|
31
|
-
* @inheritDoc
|
|
32
|
-
*/
|
|
33
|
-
init(): void;
|
|
34
|
-
/**
|
|
35
|
-
* @inheritDoc
|
|
36
|
-
*/
|
|
37
|
-
destroy(): void;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* The configuration of the {@link module:document-outline/documentoutline~DocumentOutline document outline feature}.
|
|
41
|
-
*
|
|
42
|
-
* ```ts
|
|
43
|
-
* ClassicEditor
|
|
44
|
-
* .create( editorElement, {
|
|
45
|
-
* documentOutline: ... // Document outline feature configuration.
|
|
46
|
-
* } )
|
|
47
|
-
* .then( /* ... *\/ )
|
|
48
|
-
* .catch( /* ... *\/ );
|
|
49
|
-
* ```
|
|
50
|
-
*
|
|
51
|
-
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
|
52
|
-
*/
|
|
53
|
-
export interface DocumentOutlineConfig {
|
|
54
|
-
/**
|
|
55
|
-
* The container element for the document outline to render. This should be a reference to an existing
|
|
56
|
-
* container element in the DOM.
|
|
57
|
-
*/
|
|
58
|
-
container?: HTMLElement;
|
|
59
|
-
/**
|
|
60
|
-
* An array of {@glink framework/architecture/editing-engine#model model} element names considered
|
|
61
|
-
* as headings in the document outline.
|
|
62
|
-
*
|
|
63
|
-
* The index of the heading in the array reflects the heading nesting level. It can be used e.g. for reducing
|
|
64
|
-
* the number of visible headings.
|
|
65
|
-
*
|
|
66
|
-
* ```ts
|
|
67
|
-
* ClassicEditor
|
|
68
|
-
* .create( editorElement, {
|
|
69
|
-
* plugins: [ DocumentOutline, /* ... *\/ ],
|
|
70
|
-
* documentOutline: {
|
|
71
|
-
* headings: [ 'heading1', 'heading2', /* ... *\/ ],
|
|
72
|
-
* // ...
|
|
73
|
-
* }
|
|
74
|
-
* } )
|
|
75
|
-
* .then( /* ... *\/ )
|
|
76
|
-
* .catch( /* ... *\/ );
|
|
77
|
-
* ```
|
|
78
|
-
*
|
|
79
|
-
* If this configuration is not defined, the feature will use the following defaults instead:
|
|
80
|
-
*
|
|
81
|
-
* 1. If the {@glink features/headings Headings feature} is loaded, it equals
|
|
82
|
-
* * {@link module:heading/headingconfig~HeadingConfig#options `config.heading.options`}.
|
|
83
|
-
* * `[ 'heading1', 'heading2', 'heading3' ]` if `config.heading.options` is not defined.
|
|
84
|
-
* 2. If the {@glink features/html/general-html-support General HTML Support} feature is loaded, it equals
|
|
85
|
-
* `[ 'htmlH1', 'htmlH2', 'htmlH3', 'htmlH4', 'htmlH5', 'htmlH6' ]`.
|
|
86
|
-
*
|
|
87
|
-
* **Note**: The Headings feature takes precedence over the General HTML Support feature when
|
|
88
|
-
* both are loaded.
|
|
89
|
-
*/
|
|
90
|
-
headings?: Array<string>;
|
|
91
|
-
/**
|
|
92
|
-
* Allows you to display a placeholder text: [Empty heading] for empty headings.
|
|
93
|
-
*
|
|
94
|
-
* By default, the display of a placeholder is disabled. To enable it, set this parameter to true.
|
|
95
|
-
*
|
|
96
|
-
* **Note**: This setting also affects Table of contents feature.
|
|
97
|
-
*/
|
|
98
|
-
showEmptyHeadings?: boolean;
|
|
99
|
-
}
|
|
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
|
|
7
|
+
* @publicApi
|
|
8
|
+
*/
|
|
9
|
+
import { Plugin, type Editor } from 'ckeditor5/src/core';
|
|
10
|
+
import DocumentOutlineUtils from './documentoutline/documentoutlineutils';
|
|
11
|
+
import DocumentOutlineUI from './documentoutline/documentoutlineui';
|
|
12
|
+
/**
|
|
13
|
+
* The document outline feature.
|
|
14
|
+
* It allows for an easy access to a predefined list of headings in the document.
|
|
15
|
+
*/
|
|
16
|
+
export default class DocumentOutline extends Plugin {
|
|
17
|
+
licenseKey: string;
|
|
18
|
+
/**
|
|
19
|
+
* @inheritDoc
|
|
20
|
+
*/
|
|
21
|
+
static get requires(): readonly [typeof DocumentOutlineUtils, typeof DocumentOutlineUI];
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
static get pluginName(): "DocumentOutline";
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
constructor(editor: Editor);
|
|
30
|
+
/**
|
|
31
|
+
* @inheritDoc
|
|
32
|
+
*/
|
|
33
|
+
init(): void;
|
|
34
|
+
/**
|
|
35
|
+
* @inheritDoc
|
|
36
|
+
*/
|
|
37
|
+
destroy(): void;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The configuration of the {@link module:document-outline/documentoutline~DocumentOutline document outline feature}.
|
|
41
|
+
*
|
|
42
|
+
* ```ts
|
|
43
|
+
* ClassicEditor
|
|
44
|
+
* .create( editorElement, {
|
|
45
|
+
* documentOutline: ... // Document outline feature configuration.
|
|
46
|
+
* } )
|
|
47
|
+
* .then( /* ... *\/ )
|
|
48
|
+
* .catch( /* ... *\/ );
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
|
52
|
+
*/
|
|
53
|
+
export interface DocumentOutlineConfig {
|
|
54
|
+
/**
|
|
55
|
+
* The container element for the document outline to render. This should be a reference to an existing
|
|
56
|
+
* container element in the DOM.
|
|
57
|
+
*/
|
|
58
|
+
container?: HTMLElement;
|
|
59
|
+
/**
|
|
60
|
+
* An array of {@glink framework/architecture/editing-engine#model model} element names considered
|
|
61
|
+
* as headings in the document outline.
|
|
62
|
+
*
|
|
63
|
+
* The index of the heading in the array reflects the heading nesting level. It can be used e.g. for reducing
|
|
64
|
+
* the number of visible headings.
|
|
65
|
+
*
|
|
66
|
+
* ```ts
|
|
67
|
+
* ClassicEditor
|
|
68
|
+
* .create( editorElement, {
|
|
69
|
+
* plugins: [ DocumentOutline, /* ... *\/ ],
|
|
70
|
+
* documentOutline: {
|
|
71
|
+
* headings: [ 'heading1', 'heading2', /* ... *\/ ],
|
|
72
|
+
* // ...
|
|
73
|
+
* }
|
|
74
|
+
* } )
|
|
75
|
+
* .then( /* ... *\/ )
|
|
76
|
+
* .catch( /* ... *\/ );
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* If this configuration is not defined, the feature will use the following defaults instead:
|
|
80
|
+
*
|
|
81
|
+
* 1. If the {@glink features/headings Headings feature} is loaded, it equals
|
|
82
|
+
* * {@link module:heading/headingconfig~HeadingConfig#options `config.heading.options`}.
|
|
83
|
+
* * `[ 'heading1', 'heading2', 'heading3' ]` if `config.heading.options` is not defined.
|
|
84
|
+
* 2. If the {@glink features/html/general-html-support General HTML Support} feature is loaded, it equals
|
|
85
|
+
* `[ 'htmlH1', 'htmlH2', 'htmlH3', 'htmlH4', 'htmlH5', 'htmlH6' ]`.
|
|
86
|
+
*
|
|
87
|
+
* **Note**: The Headings feature takes precedence over the General HTML Support feature when
|
|
88
|
+
* both are loaded.
|
|
89
|
+
*/
|
|
90
|
+
headings?: Array<string>;
|
|
91
|
+
/**
|
|
92
|
+
* Allows you to display a placeholder text: [Empty heading] for empty headings.
|
|
93
|
+
*
|
|
94
|
+
* By default, the display of a placeholder is disabled. To enable it, set this parameter to true.
|
|
95
|
+
*
|
|
96
|
+
* **Note**: This setting also affects Table of contents feature.
|
|
97
|
+
*/
|
|
98
|
+
showEmptyHeadings?: boolean;
|
|
99
|
+
}
|
package/src/documentoutline.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x300b=['documentOutlineLicenseKeyValid','init','_licenseKeyCheckInterval','requires','documentOutlineLicenseKeyTrial','editor','get','config','pluginName','document-outline-trial-license-key-reached-limit-changes','destroy','DocumentOutline','info','documentOutlineLicenseKeyTrialLimit:operations','licenseKey'];(function(_0x2929ff,_0x300b8a){const _0x1e5ec0=function(_0x144a0b){while(--_0x144a0b){_0x2929ff['push'](_0x2929ff['shift']());}};_0x1e5ec0(++_0x300b8a);}(_0x300b,0x6e));const _0x1e5e=function(_0x2929ff,_0x300b8a){_0x2929ff=_0x2929ff-0x0;let _0x1e5ec0=_0x300b[_0x2929ff];return _0x1e5ec0;};import{Plugin as _0x29b2a8}from'ckeditor5/src/core';import{CKEditorError as _0x412839}from'ckeditor5/src/utils';import _0x5695e2 from'./documentoutline/documentoutlineutils';import _0x5b2eb0 from'./documentoutline/documentoutlineui';export default class l extends _0x29b2a8{static get[_0x1e5e('0xd')](){return[_0x5695e2,_0x5b2eb0];}static get[_0x1e5e('0x3')](){return _0x1e5e('0x6');}constructor(_0xaea3bd){super(_0xaea3bd),this[_0x1e5e('0xc')]=null;}[_0x1e5e('0xb')](){const _0x1a5c0d=this['editor'];this[_0x1e5e('0x9')]=_0x1a5c0d[_0x1e5e('0x2')][_0x1e5e('0x1')](_0x1e5e('0x9'));const _0x25f1e9=this[_0x1e5e('0x0')];this[_0x1e5e('0xc')]=setInterval(()=>{let _0xd6834c;for(const _0x50fe9d in _0x25f1e9){const _0x81168e=_0x50fe9d,_0x106e24=_0x25f1e9[_0x81168e];if(_0x1e5e('0xe')===_0x106e24||'documentOutlineLicenseKeyInvalid'===_0x106e24||'documentOutlineLicenseKeyValid'===_0x106e24||_0x1e5e('0x8')===_0x106e24){delete _0x25f1e9[_0x81168e],_0xd6834c=_0x106e24;break;}}if('documentOutlineLicenseKeyInvalid'===_0xd6834c)throw clearInterval(this[_0x1e5e('0xc')]),new _0x412839('document-outline-invalid-license-key',null);if(_0x1e5e('0xe')===_0xd6834c&&console[_0x1e5e('0x7')]('You\x20are\x20using\x20the\x20trial\x20version\x20of\x20CKEditor\x205\x20document\x20outline\x20plugin\x20with\x20limited\x20usage.\x20Make\x20sure\x20you\x20will\x20not\x20use\x20it\x20in\x20the\x20production\x20environment.'),_0x1e5e('0x8')===_0xd6834c)throw clearInterval(this[_0x1e5e('0xc')]),new _0x412839(_0x1e5e('0x4'),null);_0x1e5e('0xa')===_0xd6834c&&clearInterval(this[_0x1e5e('0xc')]);},0x3e8);}[_0x1e5e('0x5')](){this[_0x1e5e('0xc')]&&clearInterval(this['_licenseKeyCheckInterval']);}}
|
package/src/index.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
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
|
|
7
|
-
*/
|
|
8
|
-
export { default as DocumentOutline, type DocumentOutlineConfig } from './documentoutline';
|
|
9
|
-
export { default as DocumentOutlineUI } from './documentoutline/documentoutlineui';
|
|
10
|
-
export { default as DocumentOutlineUtils } from './documentoutline/documentoutlineutils';
|
|
11
|
-
export { default as TableOfContents } from './tableofcontents';
|
|
12
|
-
export { default as TableOfContentsCommand } from './tableofcontents/tableofcontentscommand';
|
|
13
|
-
export { default as TableOfContentsEditing } from './tableofcontents/tableofcontentsediting';
|
|
14
|
-
export { default as TableOfContentsUI } from './tableofcontents/tableofcontentsui';
|
|
15
|
-
export { default as HeadingId } from './tableofcontents/headingid';
|
|
16
|
-
export declare const icons: {
|
|
17
|
-
tableOfContentsIcon: string;
|
|
18
|
-
};
|
|
19
|
-
import './augmentation';
|
|
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
|
|
7
|
+
*/
|
|
8
|
+
export { default as DocumentOutline, type DocumentOutlineConfig } from './documentoutline';
|
|
9
|
+
export { default as DocumentOutlineUI } from './documentoutline/documentoutlineui';
|
|
10
|
+
export { default as DocumentOutlineUtils } from './documentoutline/documentoutlineutils';
|
|
11
|
+
export { default as TableOfContents } from './tableofcontents';
|
|
12
|
+
export { default as TableOfContentsCommand } from './tableofcontents/tableofcontentscommand';
|
|
13
|
+
export { default as TableOfContentsEditing } from './tableofcontents/tableofcontentsediting';
|
|
14
|
+
export { default as TableOfContentsUI } from './tableofcontents/tableofcontentsui';
|
|
15
|
+
export { default as HeadingId } from './tableofcontents/headingid';
|
|
16
|
+
export declare const icons: {
|
|
17
|
+
tableOfContentsIcon: string;
|
|
18
|
+
};
|
|
19
|
+
import './augmentation';
|
package/src/index.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
export{default as DocumentOutline}from'./documentoutline';export{default as DocumentOutlineUI}from'./documentoutline/documentoutlineui';export{default as DocumentOutlineUtils}from'./documentoutline/documentoutlineutils';import
|
|
23
|
+
export{default as DocumentOutline}from'./documentoutline';export{default as DocumentOutlineUI}from'./documentoutline/documentoutlineui';export{default as DocumentOutlineUtils}from'./documentoutline/documentoutlineutils';import _0x55c1b6 from'../theme/icons/table-of-contents.svg';export{default as TableOfContents}from'./tableofcontents';export{default as TableOfContentsCommand}from'./tableofcontents/tableofcontentscommand';export{default as TableOfContentsEditing}from'./tableofcontents/tableofcontentsediting';export{default as TableOfContentsUI}from'./tableofcontents/tableofcontentsui';export{default as HeadingId}from'./tableofcontents/headingid';export const icons={'tableOfContentsIcon':_0x55c1b6};import'./augmentation';
|