@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/src/bold.js CHANGED
@@ -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/bold
8
7
  */
9
-
10
8
  import { Plugin } from 'ckeditor5/src/core';
11
9
  import BoldEditing from './bold/boldediting';
12
10
  import BoldUI from './bold/boldui';
13
-
14
11
  /**
15
12
  * The bold feature.
16
13
  *
@@ -19,21 +16,18 @@ import BoldUI from './bold/boldui';
19
16
  *
20
17
  * This is a "glue" plugin which loads the {@link module:basic-styles/bold/boldediting~BoldEditing bold editing feature}
21
18
  * and {@link module:basic-styles/bold/boldui~BoldUI bold UI feature}.
22
- *
23
- * @extends module:core/plugin~Plugin
24
19
  */
25
20
  export default class Bold extends Plugin {
26
- /**
27
- * @inheritDoc
28
- */
29
- static get requires() {
30
- return [ BoldEditing, BoldUI ];
31
- }
32
-
33
- /**
34
- * @inheritDoc
35
- */
36
- static get pluginName() {
37
- return 'Bold';
38
- }
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ static get requires() {
25
+ return [BoldEditing, BoldUI];
26
+ }
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ static get pluginName() {
31
+ return 'Bold';
32
+ }
39
33
  }
@@ -1,73 +1,59 @@
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/code/codeediting
8
7
  */
9
-
10
8
  import { Plugin } from 'ckeditor5/src/core';
11
9
  import { TwoStepCaretMovement, inlineHighlight } from 'ckeditor5/src/typing';
12
-
13
10
  import AttributeCommand from '../attributecommand';
14
-
15
11
  const CODE = 'code';
16
12
  const HIGHLIGHT_CLASS = 'ck-code_selected';
17
-
18
13
  /**
19
14
  * The code editing feature.
20
15
  *
21
16
  * It registers the `'code'` command and introduces the `code` attribute in the model which renders to the view
22
17
  * as a `<code>` element.
23
- *
24
- * @extends module:core/plugin~Plugin
25
18
  */
26
19
  export default class CodeEditing extends Plugin {
27
- /**
28
- * @inheritDoc
29
- */
30
- static get pluginName() {
31
- return 'CodeEditing';
32
- }
33
-
34
- /**
35
- * @inheritDoc
36
- */
37
- static get requires() {
38
- return [ TwoStepCaretMovement ];
39
- }
40
-
41
- /**
42
- * @inheritDoc
43
- */
44
- init() {
45
- const editor = this.editor;
46
-
47
- // Allow code attribute on text nodes.
48
- editor.model.schema.extend( '$text', { allowAttributes: CODE } );
49
- editor.model.schema.setAttributeProperties( CODE, {
50
- isFormatting: true,
51
- copyOnEnter: false
52
- } );
53
-
54
- editor.conversion.attributeToElement( {
55
- model: CODE,
56
- view: 'code',
57
- upcastAlso: {
58
- styles: {
59
- 'word-wrap': 'break-word'
60
- }
61
- }
62
- } );
63
-
64
- // Create code command.
65
- editor.commands.add( CODE, new AttributeCommand( editor, CODE ) );
66
-
67
- // Enable two-step caret movement for `code` attribute.
68
- editor.plugins.get( TwoStepCaretMovement ).registerAttribute( CODE );
69
-
70
- // Setup highlight over selected element.
71
- inlineHighlight( editor, CODE, 'code', HIGHLIGHT_CLASS );
72
- }
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ static get pluginName() {
24
+ return 'CodeEditing';
25
+ }
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ static get requires() {
30
+ return [TwoStepCaretMovement];
31
+ }
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ init() {
36
+ const editor = this.editor;
37
+ // Allow code attribute on text nodes.
38
+ editor.model.schema.extend('$text', { allowAttributes: CODE });
39
+ editor.model.schema.setAttributeProperties(CODE, {
40
+ isFormatting: true,
41
+ copyOnEnter: false
42
+ });
43
+ editor.conversion.attributeToElement({
44
+ model: CODE,
45
+ view: 'code',
46
+ upcastAlso: {
47
+ styles: {
48
+ 'word-wrap': 'break-word'
49
+ }
50
+ }
51
+ });
52
+ // Create code command.
53
+ editor.commands.add(CODE, new AttributeCommand(editor, CODE));
54
+ // Enable two-step caret movement for `code` attribute.
55
+ editor.plugins.get(TwoStepCaretMovement).registerAttribute(CODE);
56
+ // Setup highlight over selected element.
57
+ inlineHighlight(editor, CODE, 'code', HIGHLIGHT_CLASS);
58
+ }
73
59
  }
@@ -1,62 +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/code/codeui
8
7
  */
9
-
10
8
  import { Plugin } from 'ckeditor5/src/core';
11
9
  import { ButtonView } from 'ckeditor5/src/ui';
12
-
13
10
  import codeIcon from '../../theme/icons/code.svg';
14
-
15
11
  import '../../theme/code.css';
16
-
17
12
  const CODE = 'code';
18
-
19
13
  /**
20
14
  * The code UI feature. It introduces the Code button.
21
- *
22
- * @extends module:core/plugin~Plugin
23
15
  */
24
16
  export default class CodeUI extends Plugin {
25
- /**
26
- * @inheritDoc
27
- */
28
- static get pluginName() {
29
- return 'CodeUI';
30
- }
31
-
32
- /**
33
- * @inheritDoc
34
- */
35
- init() {
36
- const editor = this.editor;
37
- const t = editor.t;
38
-
39
- // Add code button to feature components.
40
- editor.ui.componentFactory.add( CODE, locale => {
41
- const command = editor.commands.get( CODE );
42
- const view = new ButtonView( locale );
43
-
44
- view.set( {
45
- label: t( 'Code' ),
46
- icon: codeIcon,
47
- tooltip: true,
48
- isToggleable: true
49
- } );
50
-
51
- view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
52
-
53
- // Execute command.
54
- this.listenTo( view, 'execute', () => {
55
- editor.execute( CODE );
56
- editor.editing.view.focus();
57
- } );
58
-
59
- return view;
60
- } );
61
- }
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ static get pluginName() {
21
+ return 'CodeUI';
22
+ }
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ init() {
27
+ const editor = this.editor;
28
+ const t = editor.t;
29
+ // Add code button to feature components.
30
+ editor.ui.componentFactory.add(CODE, locale => {
31
+ const command = editor.commands.get(CODE);
32
+ const view = new ButtonView(locale);
33
+ view.set({
34
+ label: t('Code'),
35
+ icon: codeIcon,
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(CODE);
43
+ editor.editing.view.focus();
44
+ });
45
+ return view;
46
+ });
47
+ }
62
48
  }
package/src/code.js CHANGED
@@ -1,18 +1,14 @@
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/code
8
7
  */
9
-
10
8
  import { Plugin } from 'ckeditor5/src/core';
11
9
  import CodeEditing from './code/codeediting';
12
10
  import CodeUI from './code/codeui';
13
-
14
11
  import '../theme/code.css';
15
-
16
12
  /**
17
13
  * The code feature.
18
14
  *
@@ -21,21 +17,18 @@ import '../theme/code.css';
21
17
  *
22
18
  * This is a "glue" plugin which loads the {@link module:basic-styles/code/codeediting~CodeEditing code editing feature}
23
19
  * and {@link module:basic-styles/code/codeui~CodeUI code UI feature}.
24
- *
25
- * @extends module:core/plugin~Plugin
26
20
  */
27
21
  export default class Code extends Plugin {
28
- /**
29
- * @inheritDoc
30
- */
31
- static get requires() {
32
- return [ CodeEditing, CodeUI ];
33
- }
34
-
35
- /**
36
- * @inheritDoc
37
- */
38
- static get pluginName() {
39
- return 'Code';
40
- }
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ static get requires() {
26
+ return [CodeEditing, CodeUI];
27
+ }
28
+ /**
29
+ * @inheritDoc
30
+ */
31
+ static get pluginName() {
32
+ return 'Code';
33
+ }
41
34
  }
package/src/index.js CHANGED
@@ -1,12 +1,10 @@
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
8
7
  */
9
-
10
8
  export { default as Bold } from './bold';
11
9
  export { default as BoldEditing } from './bold/boldediting';
12
10
  export { default as BoldUI } from './bold/boldui';
@@ -1,63 +1,52 @@
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/italic/italicediting
8
7
  */
9
-
10
8
  import { Plugin } from 'ckeditor5/src/core';
11
9
  import AttributeCommand from '../attributecommand';
12
-
13
10
  const ITALIC = 'italic';
14
-
15
11
  /**
16
12
  * The italic editing feature.
17
13
  *
18
14
  * It registers the `'italic'` command, the <kbd>Ctrl+I</kbd> keystroke and introduces the `italic` attribute in the model
19
15
  * which renders to the view as an `<i>` element.
20
- *
21
- * @extends module:core/plugin~Plugin
22
16
  */
23
17
  export default class ItalicEditing extends Plugin {
24
- /**
25
- * @inheritDoc
26
- */
27
- static get pluginName() {
28
- return 'ItalicEditing';
29
- }
30
-
31
- /**
32
- * @inheritDoc
33
- */
34
- init() {
35
- const editor = this.editor;
36
-
37
- // Allow italic attribute on text nodes.
38
- editor.model.schema.extend( '$text', { allowAttributes: ITALIC } );
39
- editor.model.schema.setAttributeProperties( ITALIC, {
40
- isFormatting: true,
41
- copyOnEnter: true
42
- } );
43
-
44
- editor.conversion.attributeToElement( {
45
- model: ITALIC,
46
- view: 'i',
47
- upcastAlso: [
48
- 'em',
49
- {
50
- styles: {
51
- 'font-style': 'italic'
52
- }
53
- }
54
- ]
55
- } );
56
-
57
- // Create italic command.
58
- editor.commands.add( ITALIC, new AttributeCommand( editor, ITALIC ) );
59
-
60
- // Set the Ctrl+I keystroke.
61
- editor.keystrokes.set( 'CTRL+I', ITALIC );
62
- }
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ static get pluginName() {
22
+ return 'ItalicEditing';
23
+ }
24
+ /**
25
+ * @inheritDoc
26
+ */
27
+ init() {
28
+ const editor = this.editor;
29
+ // Allow italic attribute on text nodes.
30
+ editor.model.schema.extend('$text', { allowAttributes: ITALIC });
31
+ editor.model.schema.setAttributeProperties(ITALIC, {
32
+ isFormatting: true,
33
+ copyOnEnter: true
34
+ });
35
+ editor.conversion.attributeToElement({
36
+ model: ITALIC,
37
+ view: 'i',
38
+ upcastAlso: [
39
+ 'em',
40
+ {
41
+ styles: {
42
+ 'font-style': 'italic'
43
+ }
44
+ }
45
+ ]
46
+ });
47
+ // Create italic command.
48
+ editor.commands.add(ITALIC, new AttributeCommand(editor, ITALIC));
49
+ // Set the Ctrl+I keystroke.
50
+ editor.keystrokes.set('CTRL+I', ITALIC);
51
+ }
63
52
  }
@@ -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/italic/italicui
8
7
  */
9
-
10
8
  import { Plugin } from 'ckeditor5/src/core';
11
9
  import { ButtonView } from 'ckeditor5/src/ui';
12
-
13
10
  import italicIcon from '../../theme/icons/italic.svg';
14
-
15
11
  const ITALIC = 'italic';
16
-
17
12
  /**
18
13
  * The italic UI feature. It introduces the Italic button.
19
- *
20
- * @extends module:core/plugin~Plugin
21
14
  */
22
15
  export default class ItalicUI extends Plugin {
23
- /**
24
- * @inheritDoc
25
- */
26
- static get pluginName() {
27
- return 'ItalicUI';
28
- }
29
-
30
- /**
31
- * @inheritDoc
32
- */
33
- init() {
34
- const editor = this.editor;
35
- const t = editor.t;
36
-
37
- // Add bold button to feature components.
38
- editor.ui.componentFactory.add( ITALIC, locale => {
39
- const command = editor.commands.get( ITALIC );
40
- const view = new ButtonView( locale );
41
-
42
- view.set( {
43
- label: t( 'Italic' ),
44
- icon: italicIcon,
45
- keystroke: 'CTRL+I',
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( ITALIC );
55
- editor.editing.view.focus();
56
- } );
57
-
58
- return view;
59
- } );
60
- }
16
+ /**
17
+ * @inheritDoc
18
+ */
19
+ static get pluginName() {
20
+ return 'ItalicUI';
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(ITALIC, locale => {
30
+ const command = editor.commands.get(ITALIC);
31
+ const view = new ButtonView(locale);
32
+ view.set({
33
+ label: t('Italic'),
34
+ icon: italicIcon,
35
+ keystroke: 'CTRL+I',
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(ITALIC);
43
+ editor.editing.view.focus();
44
+ });
45
+ return view;
46
+ });
47
+ }
61
48
  }
package/src/italic.js CHANGED
@@ -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/italic
8
7
  */
9
-
10
8
  import { Plugin } from 'ckeditor5/src/core';
11
9
  import ItalicEditing from './italic/italicediting';
12
10
  import ItalicUI from './italic/italicui';
13
-
14
11
  /**
15
12
  * The italic feature.
16
13
  *
@@ -19,21 +16,18 @@ import ItalicUI from './italic/italicui';
19
16
  *
20
17
  * This is a "glue" plugin which loads the {@link module:basic-styles/italic/italicediting~ItalicEditing} and
21
18
  * {@link module:basic-styles/italic/italicui~ItalicUI} plugins.
22
- *
23
- * @extends module:core/plugin~Plugin
24
19
  */
25
20
  export default class Italic extends Plugin {
26
- /**
27
- * @inheritDoc
28
- */
29
- static get requires() {
30
- return [ ItalicEditing, ItalicUI ];
31
- }
32
-
33
- /**
34
- * @inheritDoc
35
- */
36
- static get pluginName() {
37
- return 'Italic';
38
- }
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ static get requires() {
25
+ return [ItalicEditing, ItalicUI];
26
+ }
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ static get pluginName() {
31
+ return 'Italic';
32
+ }
39
33
  }