@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.
- package/LICENSE.md +3 -3
- package/README.md +1 -1
- package/build/document-outline.js +1 -1
- package/build/translations/sr-latn.js +1 -0
- package/lang/translations/sr-latn.po +34 -0
- 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
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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')]:[];}
|