@ckeditor/ckeditor5-basic-styles 35.4.0 → 36.0.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/LICENSE.md +1 -1
- package/build/basic-styles.js +2 -2
- package/package.json +17 -13
- package/src/attributecommand.js +86 -119
- package/src/bold/boldediting.js +45 -56
- package/src/bold/boldui.js +33 -45
- package/src/bold.js +13 -19
- package/src/code/codeediting.js +40 -54
- package/src/code/codeui.js +32 -46
- package/src/code.js +13 -20
- package/src/index.js +1 -3
- package/src/italic/italicediting.js +35 -46
- package/src/italic/italicui.js +33 -46
- package/src/italic.js +13 -19
- package/src/strikethrough/strikethroughediting.js +36 -47
- package/src/strikethrough/strikethroughui.js +33 -46
- package/src/strikethrough.js +13 -19
- package/src/subscript/subscriptediting.js +33 -43
- package/src/subscript/subscriptui.js +32 -45
- package/src/subscript.js +13 -19
- package/src/superscript/superscriptediting.js +33 -43
- package/src/superscript/superscriptui.js +32 -45
- package/src/superscript.js +13 -19
- package/src/underline/underlineediting.js +32 -43
- package/src/underline/underlineui.js +33 -46
- package/src/underline.js +13 -19
- package/theme/code.css +1 -1
|
@@ -1,65 +1,54 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* @module basic-styles/strikethrough/strikethroughediting
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
import { Plugin } from 'ckeditor5/src/core';
|
|
11
9
|
import AttributeCommand from '../attributecommand';
|
|
12
|
-
|
|
13
10
|
const STRIKETHROUGH = 'strikethrough';
|
|
14
|
-
|
|
15
11
|
/**
|
|
16
12
|
* The strikethrough editing feature.
|
|
17
13
|
*
|
|
18
14
|
* It registers the `'strikethrough'` command, the <kbd>Ctrl+Shift+X</kbd> keystroke and introduces the
|
|
19
15
|
* `strikethroughsthrough` attribute in the model which renders to the view
|
|
20
16
|
* as a `<s>` element.
|
|
21
|
-
*
|
|
22
|
-
* @extends module:core/plugin~Plugin
|
|
23
17
|
*/
|
|
24
18
|
export default class StrikethroughEditing extends Plugin {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
editor.commands.add( STRIKETHROUGH, new AttributeCommand( editor, STRIKETHROUGH ) );
|
|
61
|
-
|
|
62
|
-
// Set the Ctrl+Shift+X keystroke.
|
|
63
|
-
editor.keystrokes.set( 'CTRL+SHIFT+X', 'strikethrough' );
|
|
64
|
-
}
|
|
19
|
+
/**
|
|
20
|
+
* @inheritDoc
|
|
21
|
+
*/
|
|
22
|
+
static get pluginName() {
|
|
23
|
+
return 'StrikethroughEditing';
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
init() {
|
|
29
|
+
const editor = this.editor;
|
|
30
|
+
// Allow strikethrough attribute on text nodes.
|
|
31
|
+
editor.model.schema.extend('$text', { allowAttributes: STRIKETHROUGH });
|
|
32
|
+
editor.model.schema.setAttributeProperties(STRIKETHROUGH, {
|
|
33
|
+
isFormatting: true,
|
|
34
|
+
copyOnEnter: true
|
|
35
|
+
});
|
|
36
|
+
editor.conversion.attributeToElement({
|
|
37
|
+
model: STRIKETHROUGH,
|
|
38
|
+
view: 's',
|
|
39
|
+
upcastAlso: [
|
|
40
|
+
'del',
|
|
41
|
+
'strike',
|
|
42
|
+
{
|
|
43
|
+
styles: {
|
|
44
|
+
'text-decoration': 'line-through'
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
// Create strikethrough command.
|
|
50
|
+
editor.commands.add(STRIKETHROUGH, new AttributeCommand(editor, STRIKETHROUGH));
|
|
51
|
+
// Set the Ctrl+Shift+X keystroke.
|
|
52
|
+
editor.keystrokes.set('CTRL+SHIFT+X', 'strikethrough');
|
|
53
|
+
}
|
|
65
54
|
}
|
|
@@ -1,61 +1,48 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* @module basic-styles/strikethrough/strikethroughui
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
import { Plugin } from 'ckeditor5/src/core';
|
|
11
9
|
import { ButtonView } from 'ckeditor5/src/ui';
|
|
12
|
-
|
|
13
10
|
import strikethroughIcon from '../../theme/icons/strikethrough.svg';
|
|
14
|
-
|
|
15
11
|
const STRIKETHROUGH = 'strikethrough';
|
|
16
|
-
|
|
17
12
|
/**
|
|
18
13
|
* The strikethrough UI feature. It introduces the Strikethrough button.
|
|
19
|
-
*
|
|
20
|
-
* @extends module:core/plugin~Plugin
|
|
21
14
|
*/
|
|
22
15
|
export default class StrikethroughUI extends Plugin {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
editor.editing.view.focus();
|
|
56
|
-
} );
|
|
57
|
-
|
|
58
|
-
return view;
|
|
59
|
-
} );
|
|
60
|
-
}
|
|
16
|
+
/**
|
|
17
|
+
* @inheritDoc
|
|
18
|
+
*/
|
|
19
|
+
static get pluginName() {
|
|
20
|
+
return 'StrikethroughUI';
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
init() {
|
|
26
|
+
const editor = this.editor;
|
|
27
|
+
const t = editor.t;
|
|
28
|
+
// Add strikethrough button to feature components.
|
|
29
|
+
editor.ui.componentFactory.add(STRIKETHROUGH, locale => {
|
|
30
|
+
const command = editor.commands.get(STRIKETHROUGH);
|
|
31
|
+
const view = new ButtonView(locale);
|
|
32
|
+
view.set({
|
|
33
|
+
label: t('Strikethrough'),
|
|
34
|
+
icon: strikethroughIcon,
|
|
35
|
+
keystroke: 'CTRL+SHIFT+X',
|
|
36
|
+
tooltip: true,
|
|
37
|
+
isToggleable: true
|
|
38
|
+
});
|
|
39
|
+
view.bind('isOn', 'isEnabled').to(command, 'value', 'isEnabled');
|
|
40
|
+
// Execute command.
|
|
41
|
+
this.listenTo(view, 'execute', () => {
|
|
42
|
+
editor.execute(STRIKETHROUGH);
|
|
43
|
+
editor.editing.view.focus();
|
|
44
|
+
});
|
|
45
|
+
return view;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
61
48
|
}
|
package/src/strikethrough.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* @module basic-styles/strikethrough
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
import { Plugin } from 'ckeditor5/src/core';
|
|
11
9
|
import StrikethroughEditing from './strikethrough/strikethroughediting';
|
|
12
10
|
import StrikethroughUI from './strikethrough/strikethroughui';
|
|
13
|
-
|
|
14
11
|
/**
|
|
15
12
|
* The strikethrough feature.
|
|
16
13
|
*
|
|
@@ -19,21 +16,18 @@ import StrikethroughUI from './strikethrough/strikethroughui';
|
|
|
19
16
|
*
|
|
20
17
|
* This is a "glue" plugin which loads the {@link module:basic-styles/strikethrough/strikethroughediting~StrikethroughEditing} and
|
|
21
18
|
* {@link module:basic-styles/strikethrough/strikethroughui~StrikethroughUI} plugins.
|
|
22
|
-
*
|
|
23
|
-
* @extends module:core/plugin~Plugin
|
|
24
19
|
*/
|
|
25
20
|
export default class Strikethrough extends Plugin {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
static get requires() {
|
|
25
|
+
return [StrikethroughEditing, StrikethroughUI];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
static get pluginName() {
|
|
31
|
+
return 'Strikethrough';
|
|
32
|
+
}
|
|
39
33
|
}
|
|
@@ -1,60 +1,50 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* @module basic-styles/subscript/subscriptediting
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
import { Plugin } from 'ckeditor5/src/core';
|
|
11
9
|
import AttributeCommand from '../attributecommand';
|
|
12
|
-
|
|
13
10
|
const SUBSCRIPT = 'subscript';
|
|
14
|
-
|
|
15
11
|
/**
|
|
16
12
|
* The subscript editing feature.
|
|
17
13
|
*
|
|
18
14
|
* It registers the `sub` command and introduces the `sub` attribute in the model which renders to the view
|
|
19
15
|
* as a `<sub>` element.
|
|
20
|
-
*
|
|
21
|
-
* @extends module:core/plugin~Plugin
|
|
22
16
|
*/
|
|
23
17
|
export default class SubscriptEditing extends Plugin {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
// Create sub command.
|
|
58
|
-
editor.commands.add( SUBSCRIPT, new AttributeCommand( editor, SUBSCRIPT ) );
|
|
59
|
-
}
|
|
18
|
+
/**
|
|
19
|
+
* @inheritDoc
|
|
20
|
+
*/
|
|
21
|
+
static get pluginName() {
|
|
22
|
+
return 'SubscriptEditing';
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
init() {
|
|
28
|
+
const editor = this.editor;
|
|
29
|
+
// Allow sub attribute on text nodes.
|
|
30
|
+
editor.model.schema.extend('$text', { allowAttributes: SUBSCRIPT });
|
|
31
|
+
editor.model.schema.setAttributeProperties(SUBSCRIPT, {
|
|
32
|
+
isFormatting: true,
|
|
33
|
+
copyOnEnter: true
|
|
34
|
+
});
|
|
35
|
+
// Build converter from model to view for data and editing pipelines.
|
|
36
|
+
editor.conversion.attributeToElement({
|
|
37
|
+
model: SUBSCRIPT,
|
|
38
|
+
view: 'sub',
|
|
39
|
+
upcastAlso: [
|
|
40
|
+
{
|
|
41
|
+
styles: {
|
|
42
|
+
'vertical-align': 'sub'
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
// Create sub command.
|
|
48
|
+
editor.commands.add(SUBSCRIPT, new AttributeCommand(editor, SUBSCRIPT));
|
|
49
|
+
}
|
|
60
50
|
}
|
|
@@ -1,60 +1,47 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* @module basic-styles/subscript/subscriptui
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
import { Plugin } from 'ckeditor5/src/core';
|
|
11
9
|
import { ButtonView } from 'ckeditor5/src/ui';
|
|
12
|
-
|
|
13
10
|
import subscriptIcon from '../../theme/icons/subscript.svg';
|
|
14
|
-
|
|
15
11
|
const SUBSCRIPT = 'subscript';
|
|
16
|
-
|
|
17
12
|
/**
|
|
18
13
|
* The subscript UI feature. It introduces the Subscript button.
|
|
19
|
-
*
|
|
20
|
-
* @extends module:core/plugin~Plugin
|
|
21
14
|
*/
|
|
22
15
|
export default class SubscriptUI extends Plugin {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
editor.editing.view.focus();
|
|
55
|
-
} );
|
|
56
|
-
|
|
57
|
-
return view;
|
|
58
|
-
} );
|
|
59
|
-
}
|
|
16
|
+
/**
|
|
17
|
+
* @inheritDoc
|
|
18
|
+
*/
|
|
19
|
+
static get pluginName() {
|
|
20
|
+
return 'SubscriptUI';
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
init() {
|
|
26
|
+
const editor = this.editor;
|
|
27
|
+
const t = editor.t;
|
|
28
|
+
// Add subscript button to feature components.
|
|
29
|
+
editor.ui.componentFactory.add(SUBSCRIPT, locale => {
|
|
30
|
+
const command = editor.commands.get(SUBSCRIPT);
|
|
31
|
+
const view = new ButtonView(locale);
|
|
32
|
+
view.set({
|
|
33
|
+
label: t('Subscript'),
|
|
34
|
+
icon: subscriptIcon,
|
|
35
|
+
tooltip: true,
|
|
36
|
+
isToggleable: true
|
|
37
|
+
});
|
|
38
|
+
view.bind('isOn', 'isEnabled').to(command, 'value', 'isEnabled');
|
|
39
|
+
// Execute command.
|
|
40
|
+
this.listenTo(view, 'execute', () => {
|
|
41
|
+
editor.execute(SUBSCRIPT);
|
|
42
|
+
editor.editing.view.focus();
|
|
43
|
+
});
|
|
44
|
+
return view;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
60
47
|
}
|
package/src/subscript.js
CHANGED
|
@@ -1,36 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* @module basic-styles/subscript
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
import { Plugin } from 'ckeditor5/src/core';
|
|
11
9
|
import SubscriptEditing from './subscript/subscriptediting';
|
|
12
10
|
import SubscriptUI from './subscript/subscriptui';
|
|
13
|
-
|
|
14
11
|
/**
|
|
15
12
|
* The subscript feature.
|
|
16
13
|
*
|
|
17
14
|
* It loads the {@link module:basic-styles/subscript/subscriptediting~SubscriptEditing} and
|
|
18
15
|
* {@link module:basic-styles/subscript/subscriptui~SubscriptUI} plugins.
|
|
19
|
-
*
|
|
20
|
-
* @extends module:core/plugin~Plugin
|
|
21
16
|
*/
|
|
22
17
|
export default class Subscript extends Plugin {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
18
|
+
/**
|
|
19
|
+
* @inheritDoc
|
|
20
|
+
*/
|
|
21
|
+
static get requires() {
|
|
22
|
+
return [SubscriptEditing, SubscriptUI];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
static get pluginName() {
|
|
28
|
+
return 'Subscript';
|
|
29
|
+
}
|
|
36
30
|
}
|
|
@@ -1,60 +1,50 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* @module basic-styles/superscript/superscriptediting
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
import { Plugin } from 'ckeditor5/src/core';
|
|
11
9
|
import AttributeCommand from '../attributecommand';
|
|
12
|
-
|
|
13
10
|
const SUPERSCRIPT = 'superscript';
|
|
14
|
-
|
|
15
11
|
/**
|
|
16
12
|
* The superscript editing feature.
|
|
17
13
|
*
|
|
18
14
|
* It registers the `super` command and introduces the `super` attribute in the model which renders to the view
|
|
19
15
|
* as a `<super>` element.
|
|
20
|
-
*
|
|
21
|
-
* @extends module:core/plugin~Plugin
|
|
22
16
|
*/
|
|
23
17
|
export default class SuperscriptEditing extends Plugin {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
// Create super command.
|
|
58
|
-
editor.commands.add( SUPERSCRIPT, new AttributeCommand( editor, SUPERSCRIPT ) );
|
|
59
|
-
}
|
|
18
|
+
/**
|
|
19
|
+
* @inheritDoc
|
|
20
|
+
*/
|
|
21
|
+
static get pluginName() {
|
|
22
|
+
return 'SuperscriptEditing';
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
init() {
|
|
28
|
+
const editor = this.editor;
|
|
29
|
+
// Allow super attribute on text nodes.
|
|
30
|
+
editor.model.schema.extend('$text', { allowAttributes: SUPERSCRIPT });
|
|
31
|
+
editor.model.schema.setAttributeProperties(SUPERSCRIPT, {
|
|
32
|
+
isFormatting: true,
|
|
33
|
+
copyOnEnter: true
|
|
34
|
+
});
|
|
35
|
+
// Build converter from model to view for data and editing pipelines.
|
|
36
|
+
editor.conversion.attributeToElement({
|
|
37
|
+
model: SUPERSCRIPT,
|
|
38
|
+
view: 'sup',
|
|
39
|
+
upcastAlso: [
|
|
40
|
+
{
|
|
41
|
+
styles: {
|
|
42
|
+
'vertical-align': 'super'
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
// Create super command.
|
|
48
|
+
editor.commands.add(SUPERSCRIPT, new AttributeCommand(editor, SUPERSCRIPT));
|
|
49
|
+
}
|
|
60
50
|
}
|