@ckeditor/ckeditor5-basic-styles 35.4.0 → 36.0.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 +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,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/superscript/superscriptui
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
import { Plugin } from 'ckeditor5/src/core';
|
|
11
9
|
import { ButtonView } from 'ckeditor5/src/ui';
|
|
12
|
-
|
|
13
10
|
import superscriptIcon from '../../theme/icons/superscript.svg';
|
|
14
|
-
|
|
15
11
|
const SUPERSCRIPT = 'superscript';
|
|
16
|
-
|
|
17
12
|
/**
|
|
18
13
|
* The superscript UI feature. It introduces the Superscript button.
|
|
19
|
-
*
|
|
20
|
-
* @extends module:core/plugin~Plugin
|
|
21
14
|
*/
|
|
22
15
|
export default class SuperscriptUI 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 'SuperscriptUI';
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
init() {
|
|
26
|
+
const editor = this.editor;
|
|
27
|
+
const t = editor.t;
|
|
28
|
+
// Add superscript button to feature components.
|
|
29
|
+
editor.ui.componentFactory.add(SUPERSCRIPT, locale => {
|
|
30
|
+
const command = editor.commands.get(SUPERSCRIPT);
|
|
31
|
+
const view = new ButtonView(locale);
|
|
32
|
+
view.set({
|
|
33
|
+
label: t('Superscript'),
|
|
34
|
+
icon: superscriptIcon,
|
|
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(SUPERSCRIPT);
|
|
42
|
+
editor.editing.view.focus();
|
|
43
|
+
});
|
|
44
|
+
return view;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
60
47
|
}
|
package/src/superscript.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/superscript
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
import { Plugin } from 'ckeditor5/src/core';
|
|
11
9
|
import SuperscriptEditing from './superscript/superscriptediting';
|
|
12
10
|
import SuperscriptUI from './superscript/superscriptui';
|
|
13
|
-
|
|
14
11
|
/**
|
|
15
12
|
* The superscript feature.
|
|
16
13
|
*
|
|
17
14
|
* It loads the {@link module:basic-styles/superscript/superscriptediting~SuperscriptEditing} and
|
|
18
15
|
* {@link module:basic-styles/superscript/superscriptui~SuperscriptUI} plugins.
|
|
19
|
-
*
|
|
20
|
-
* @extends module:core/plugin~Plugin
|
|
21
16
|
*/
|
|
22
17
|
export default class Superscript 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 [SuperscriptEditing, SuperscriptUI];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
static get pluginName() {
|
|
28
|
+
return 'Superscript';
|
|
29
|
+
}
|
|
36
30
|
}
|
|
@@ -1,60 +1,49 @@
|
|
|
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/underline/underlineediting
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
import { Plugin } from 'ckeditor5/src/core';
|
|
11
9
|
import AttributeCommand from '../attributecommand';
|
|
12
|
-
|
|
13
10
|
const UNDERLINE = 'underline';
|
|
14
|
-
|
|
15
11
|
/**
|
|
16
12
|
* The underline editing feature.
|
|
17
13
|
*
|
|
18
14
|
* It registers the `'underline'` command, the <kbd>Ctrl+U</kbd> keystroke
|
|
19
15
|
* and introduces the `underline` attribute in the model which renders to the view as an `<u>` element.
|
|
20
|
-
*
|
|
21
|
-
* @extends module:core/plugin~Plugin
|
|
22
16
|
*/
|
|
23
17
|
export default class UnderlineEditing 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
|
-
editor.commands.add( UNDERLINE, new AttributeCommand( editor, UNDERLINE ) );
|
|
56
|
-
|
|
57
|
-
// Set the Ctrl+U keystroke.
|
|
58
|
-
editor.keystrokes.set( 'CTRL+U', 'underline' );
|
|
59
|
-
}
|
|
18
|
+
/**
|
|
19
|
+
* @inheritDoc
|
|
20
|
+
*/
|
|
21
|
+
static get pluginName() {
|
|
22
|
+
return 'UnderlineEditing';
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
init() {
|
|
28
|
+
const editor = this.editor;
|
|
29
|
+
// Allow strikethrough attribute on text nodes.
|
|
30
|
+
editor.model.schema.extend('$text', { allowAttributes: UNDERLINE });
|
|
31
|
+
editor.model.schema.setAttributeProperties(UNDERLINE, {
|
|
32
|
+
isFormatting: true,
|
|
33
|
+
copyOnEnter: true
|
|
34
|
+
});
|
|
35
|
+
editor.conversion.attributeToElement({
|
|
36
|
+
model: UNDERLINE,
|
|
37
|
+
view: 'u',
|
|
38
|
+
upcastAlso: {
|
|
39
|
+
styles: {
|
|
40
|
+
'text-decoration': 'underline'
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
// Create underline command.
|
|
45
|
+
editor.commands.add(UNDERLINE, new AttributeCommand(editor, UNDERLINE));
|
|
46
|
+
// Set the Ctrl+U keystroke.
|
|
47
|
+
editor.keystrokes.set('CTRL+U', 'underline');
|
|
48
|
+
}
|
|
60
49
|
}
|
|
@@ -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/underline/underlineui
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
import { Plugin } from 'ckeditor5/src/core';
|
|
11
9
|
import { ButtonView } from 'ckeditor5/src/ui';
|
|
12
|
-
|
|
13
10
|
import underlineIcon from '../../theme/icons/underline.svg';
|
|
14
|
-
|
|
15
11
|
const UNDERLINE = 'underline';
|
|
16
|
-
|
|
17
12
|
/**
|
|
18
13
|
* The underline UI feature. It introduces the Underline button.
|
|
19
|
-
*
|
|
20
|
-
* @extends module:core/plugin~Plugin
|
|
21
14
|
*/
|
|
22
15
|
export default class UnderlineUI 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 'UnderlineUI';
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
init() {
|
|
26
|
+
const editor = this.editor;
|
|
27
|
+
const t = editor.t;
|
|
28
|
+
// Add bold button to feature components.
|
|
29
|
+
editor.ui.componentFactory.add(UNDERLINE, locale => {
|
|
30
|
+
const command = editor.commands.get(UNDERLINE);
|
|
31
|
+
const view = new ButtonView(locale);
|
|
32
|
+
view.set({
|
|
33
|
+
label: t('Underline'),
|
|
34
|
+
icon: underlineIcon,
|
|
35
|
+
keystroke: 'CTRL+U',
|
|
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(UNDERLINE);
|
|
43
|
+
editor.editing.view.focus();
|
|
44
|
+
});
|
|
45
|
+
return view;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
61
48
|
}
|
package/src/underline.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/underline
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
import { Plugin } from 'ckeditor5/src/core';
|
|
11
9
|
import UnderlineEditing from './underline/underlineediting';
|
|
12
10
|
import UnderlineUI from './underline/underlineui';
|
|
13
|
-
|
|
14
11
|
/**
|
|
15
12
|
* The underline feature.
|
|
16
13
|
*
|
|
@@ -19,21 +16,18 @@ import UnderlineUI from './underline/underlineui';
|
|
|
19
16
|
*
|
|
20
17
|
* This is a "glue" plugin which loads the {@link module:basic-styles/underline/underlineediting~UnderlineEditing} and
|
|
21
18
|
* {@link module:basic-styles/underline/underlineui~UnderlineUI} plugins.
|
|
22
|
-
*
|
|
23
|
-
* @extends module:core/plugin~Plugin
|
|
24
19
|
*/
|
|
25
20
|
export default class Underline 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 [UnderlineEditing, UnderlineUI];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
static get pluginName() {
|
|
31
|
+
return 'Underline';
|
|
32
|
+
}
|
|
39
33
|
}
|
package/theme/code.css
CHANGED