@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.
@@ -1,65 +1,54 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
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
- * @inheritDoc
27
- */
28
- static get pluginName() {
29
- return 'StrikethroughEditing';
30
- }
31
-
32
- /**
33
- * @inheritDoc
34
- */
35
- init() {
36
- const editor = this.editor;
37
-
38
- // Allow strikethrough attribute on text nodes.
39
- editor.model.schema.extend( '$text', { allowAttributes: STRIKETHROUGH } );
40
- editor.model.schema.setAttributeProperties( STRIKETHROUGH, {
41
- isFormatting: true,
42
- copyOnEnter: true
43
- } );
44
-
45
- editor.conversion.attributeToElement( {
46
- model: STRIKETHROUGH,
47
- view: 's',
48
- upcastAlso: [
49
- 'del',
50
- 'strike',
51
- {
52
- styles: {
53
- 'text-decoration': 'line-through'
54
- }
55
- }
56
- ]
57
- } );
58
-
59
- // Create strikethrough command.
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-2022, CKSource Holding sp. z o.o. All rights reserved.
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
- * @inheritDoc
25
- */
26
- static get pluginName() {
27
- return 'StrikethroughUI';
28
- }
29
-
30
- /**
31
- * @inheritDoc
32
- */
33
- init() {
34
- const editor = this.editor;
35
- const t = editor.t;
36
-
37
- // Add strikethrough button to feature components.
38
- editor.ui.componentFactory.add( STRIKETHROUGH, locale => {
39
- const command = editor.commands.get( STRIKETHROUGH );
40
- const view = new ButtonView( locale );
41
-
42
- view.set( {
43
- label: t( 'Strikethrough' ),
44
- icon: strikethroughIcon,
45
- keystroke: 'CTRL+SHIFT+X',
46
- tooltip: true,
47
- isToggleable: true
48
- } );
49
-
50
- view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
51
-
52
- // Execute command.
53
- this.listenTo( view, 'execute', () => {
54
- editor.execute( STRIKETHROUGH );
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
  }
@@ -1,16 +1,13 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
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
- * @inheritDoc
28
- */
29
- static get requires() {
30
- return [ StrikethroughEditing, StrikethroughUI ];
31
- }
32
-
33
- /**
34
- * @inheritDoc
35
- */
36
- static get pluginName() {
37
- return 'Strikethrough';
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-2022, CKSource Holding sp. z o.o. All rights reserved.
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
- * @inheritDoc
26
- */
27
- static get pluginName() {
28
- return 'SubscriptEditing';
29
- }
30
-
31
- /**
32
- * @inheritDoc
33
- */
34
- init() {
35
- const editor = this.editor;
36
- // Allow sub attribute on text nodes.
37
- editor.model.schema.extend( '$text', { allowAttributes: SUBSCRIPT } );
38
- editor.model.schema.setAttributeProperties( SUBSCRIPT, {
39
- isFormatting: true,
40
- copyOnEnter: true
41
- } );
42
-
43
- // Build converter from model to view for data and editing pipelines.
44
-
45
- editor.conversion.attributeToElement( {
46
- model: SUBSCRIPT,
47
- view: 'sub',
48
- upcastAlso: [
49
- {
50
- styles: {
51
- 'vertical-align': 'sub'
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-2022, CKSource Holding sp. z o.o. All rights reserved.
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
- * @inheritDoc
25
- */
26
- static get pluginName() {
27
- return 'SubscriptUI';
28
- }
29
-
30
- /**
31
- * @inheritDoc
32
- */
33
- init() {
34
- const editor = this.editor;
35
- const t = editor.t;
36
-
37
- // Add subscript button to feature components.
38
- editor.ui.componentFactory.add( SUBSCRIPT, locale => {
39
- const command = editor.commands.get( SUBSCRIPT );
40
- const view = new ButtonView( locale );
41
-
42
- view.set( {
43
- label: t( 'Subscript' ),
44
- icon: subscriptIcon,
45
- tooltip: true,
46
- isToggleable: true
47
- } );
48
-
49
- view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
50
-
51
- // Execute command.
52
- this.listenTo( view, 'execute', () => {
53
- editor.execute( SUBSCRIPT );
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-2022, CKSource Holding sp. z o.o. All rights reserved.
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
- * @inheritDoc
25
- */
26
- static get requires() {
27
- return [ SubscriptEditing, SubscriptUI ];
28
- }
29
-
30
- /**
31
- * @inheritDoc
32
- */
33
- static get pluginName() {
34
- return 'Subscript';
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-2022, CKSource Holding sp. z o.o. All rights reserved.
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
- * @inheritDoc
26
- */
27
- static get pluginName() {
28
- return 'SuperscriptEditing';
29
- }
30
-
31
- /**
32
- * @inheritDoc
33
- */
34
- init() {
35
- const editor = this.editor;
36
- // Allow super attribute on text nodes.
37
- editor.model.schema.extend( '$text', { allowAttributes: SUPERSCRIPT } );
38
- editor.model.schema.setAttributeProperties( SUPERSCRIPT, {
39
- isFormatting: true,
40
- copyOnEnter: true
41
- } );
42
-
43
- // Build converter from model to view for data and editing pipelines.
44
-
45
- editor.conversion.attributeToElement( {
46
- model: SUPERSCRIPT,
47
- view: 'sup',
48
- upcastAlso: [
49
- {
50
- styles: {
51
- 'vertical-align': 'super'
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
  }