@ckeditor/ckeditor5-core 33.0.0 → 34.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.
Files changed (76) hide show
  1. package/LICENSE.md +2 -2
  2. package/README.md +2 -1
  3. package/lang/contexts.json +2 -1
  4. package/lang/translations/af.po +9 -5
  5. package/lang/translations/ar.po +4 -0
  6. package/lang/translations/ast.po +4 -0
  7. package/lang/translations/az.po +4 -0
  8. package/lang/translations/bg.po +4 -0
  9. package/lang/translations/bs.po +4 -0
  10. package/lang/translations/ca.po +4 -0
  11. package/lang/translations/cs.po +4 -0
  12. package/lang/translations/da.po +4 -0
  13. package/lang/translations/de-ch.po +4 -0
  14. package/lang/translations/de.po +4 -0
  15. package/lang/translations/el.po +4 -0
  16. package/lang/translations/en-au.po +5 -1
  17. package/lang/translations/en-gb.po +4 -0
  18. package/lang/translations/en.po +4 -0
  19. package/lang/translations/eo.po +4 -0
  20. package/lang/translations/es.po +5 -1
  21. package/lang/translations/et.po +4 -0
  22. package/lang/translations/eu.po +4 -0
  23. package/lang/translations/fa.po +4 -0
  24. package/lang/translations/fi.po +4 -0
  25. package/lang/translations/fr.po +5 -1
  26. package/lang/translations/gl.po +4 -0
  27. package/lang/translations/gu.po +45 -0
  28. package/lang/translations/he.po +4 -0
  29. package/lang/translations/hi.po +4 -0
  30. package/lang/translations/hr.po +5 -1
  31. package/lang/translations/hu.po +4 -0
  32. package/lang/translations/id.po +4 -0
  33. package/lang/translations/it.po +5 -1
  34. package/lang/translations/ja.po +4 -0
  35. package/lang/translations/jv.po +45 -0
  36. package/lang/translations/km.po +4 -0
  37. package/lang/translations/kn.po +4 -0
  38. package/lang/translations/ko.po +4 -0
  39. package/lang/translations/ku.po +4 -0
  40. package/lang/translations/lt.po +4 -0
  41. package/lang/translations/lv.po +5 -1
  42. package/lang/translations/ms.po +45 -0
  43. package/lang/translations/nb.po +4 -0
  44. package/lang/translations/ne.po +4 -0
  45. package/lang/translations/nl.po +4 -0
  46. package/lang/translations/no.po +4 -0
  47. package/lang/translations/oc.po +4 -0
  48. package/lang/translations/pl.po +4 -0
  49. package/lang/translations/pt-br.po +5 -1
  50. package/lang/translations/pt.po +5 -1
  51. package/lang/translations/ro.po +4 -0
  52. package/lang/translations/ru.po +4 -0
  53. package/lang/translations/si.po +45 -0
  54. package/lang/translations/sk.po +4 -0
  55. package/lang/translations/sl.po +4 -0
  56. package/lang/translations/sq.po +4 -0
  57. package/lang/translations/sr-latn.po +4 -0
  58. package/lang/translations/sr.po +4 -0
  59. package/lang/translations/sv.po +4 -0
  60. package/lang/translations/th.po +4 -0
  61. package/lang/translations/tk.po +4 -0
  62. package/lang/translations/tr.po +4 -0
  63. package/lang/translations/tt.po +4 -0
  64. package/lang/translations/ug.po +4 -0
  65. package/lang/translations/uk.po +4 -0
  66. package/lang/translations/ur.po +45 -0
  67. package/lang/translations/uz.po +4 -0
  68. package/lang/translations/vi.po +4 -0
  69. package/lang/translations/zh-cn.po +4 -0
  70. package/lang/translations/zh.po +4 -0
  71. package/package.json +17 -17
  72. package/src/editor/editor.js +136 -16
  73. package/src/editor/editorconfig.jsdoc +5 -5
  74. package/src/multicommand.js +19 -12
  75. package/src/pendingactions.js +1 -1
  76. package/src/plugincollection.js +7 -6
@@ -5,6 +5,8 @@
5
5
 
6
6
  import Command from './command';
7
7
 
8
+ import insertToPriorityArray from '@ckeditor/ckeditor5-utils/src/inserttopriorityarray';
9
+
8
10
  /**
9
11
  * @module core/multicommand
10
12
  */
@@ -14,16 +16,17 @@ import Command from './command';
14
16
  *
15
17
  * This command is used to proxy multiple commands. The multi-command is enabled when
16
18
  * at least one of its registered child commands is enabled.
17
- * When executing a multi-command the first command that is enabled will be executed.
19
+ * When executing a multi-command the first enabled command with highest priority will be executed.
18
20
  *
19
21
  * const multiCommand = new MultiCommand( editor );
20
22
  *
21
23
  * const commandFoo = new Command( editor );
22
24
  * const commandBar = new Command( editor );
23
25
  *
24
- * // Register child commands.
26
+ * // Register a child command.
25
27
  * multiCommand.registerChildCommand( commandFoo );
26
- * multiCommand.registerChildCommand( commandBar );
28
+ * // Register a child command with a low priority.
29
+ * multiCommand.registerChildCommand( commandBar, { priority: 'low' } );
27
30
  *
28
31
  * // Enable one of the commands.
29
32
  * commandBar.isEnabled = true;
@@ -40,12 +43,12 @@ export default class MultiCommand extends Command {
40
43
  super( editor );
41
44
 
42
45
  /**
43
- * Registered child commands.
46
+ * Registered child commands definitions.
44
47
  *
45
- * @type {Array.<module:core/command~Command>}
48
+ * @type {Array.<Object>}
46
49
  * @private
47
50
  */
48
- this._childCommands = [];
51
+ this._childCommandsDefinitions = [];
49
52
  }
50
53
 
51
54
  /**
@@ -56,23 +59,25 @@ export default class MultiCommand extends Command {
56
59
  }
57
60
 
58
61
  /**
59
- * Executes the first of it registered child commands.
62
+ * Executes the first enabled command which has the highest priority of all registered child commands.
60
63
  *
61
64
  * @returns {*} The value returned by the {@link module:core/command~Command#execute `command.execute()`}.
62
65
  */
63
66
  execute( ...args ) {
64
67
  const command = this._getFirstEnabledCommand();
65
68
 
66
- return command != null && command.execute( args );
69
+ return !!command && command.execute( args );
67
70
  }
68
71
 
69
72
  /**
70
73
  * Registers a child command.
71
74
  *
72
75
  * @param {module:core/command~Command} command
76
+ * @param {Object} options An object with configuration options.
77
+ * @param {module:utils/priorities~PriorityString} [options.priority='normal'] Priority of a command to register.
73
78
  */
74
- registerChildCommand( command ) {
75
- this._childCommands.push( command );
79
+ registerChildCommand( command, options = { priority: 'normal' } ) {
80
+ insertToPriorityArray( this._childCommandsDefinitions, { command, priority: options.priority } );
76
81
 
77
82
  // Change multi command enabled state when one of registered commands changes state.
78
83
  command.on( 'change:isEnabled', () => this._checkEnabled() );
@@ -90,12 +95,14 @@ export default class MultiCommand extends Command {
90
95
  }
91
96
 
92
97
  /**
93
- * Returns a first enabled command or undefined if none of them is enabled.
98
+ * Returns a first enabled command with the highest priority or `undefined` if none of them is enabled.
94
99
  *
95
100
  * @returns {module:core/command~Command|undefined}
96
101
  * @private
97
102
  */
98
103
  _getFirstEnabledCommand() {
99
- return this._childCommands.find( command => command.isEnabled );
104
+ const commandDefinition = this._childCommandsDefinitions.find( ( { command } ) => command.isEnabled );
105
+
106
+ return commandDefinition && commandDefinition.command;
100
107
  }
101
108
  }
@@ -48,7 +48,7 @@ import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
48
48
  *
49
49
  * This plugin is used by features like {@link module:upload/filerepository~FileRepository} to register their ongoing actions
50
50
  * and by features like {@link module:autosave/autosave~Autosave} to detect whether there are any ongoing actions.
51
- * Read more about saving the data in the {@glink builds/guides/integration/saving-data Saving and getting data} guide.
51
+ * Read more about saving the data in the {@glink installation/advanced/saving-data Saving and getting data} guide.
52
52
  *
53
53
  * @extends module:core/contextplugin~ContextPlugin
54
54
  */
@@ -324,7 +324,7 @@ export default class PluginCollection {
324
324
  *
325
325
  * Soft requirements were introduced in version 26.0.0. If you happen to stumble upon this error
326
326
  * when upgrading to version 26.0.0, read also the
327
- * {@glink builds/guides/migration/migration-to-26 Migration to 26.0.0} guide.
327
+ * {@glink updating/migration-to-26 Migration to 26.0.0} guide.
328
328
  *
329
329
  * @error plugincollection-soft-required
330
330
  * @param {String} missingPlugin The name of the required plugin.
@@ -344,16 +344,17 @@ export default class PluginCollection {
344
344
  * This is usually done in CKEditor 5 builds by setting the {@link module:core/editor/editor~Editor.builtinPlugins}
345
345
  * property.
346
346
  *
347
- * **If you see this warning when using one of the {@glink builds/index CKEditor 5 Builds}**, it means
348
- * that you try to enable a plugin which was not included in that build. This may be due to a typo
347
+ * **If you see this warning when using one of the {@glink installation/advanced/alternative-setups/predefined-builds
348
+ * CKEditor 5 Builds}**,
349
+ * it means that you try to enable a plugin which was not included in that build. This may be due to a typo
349
350
  * in the plugin name or simply because that plugin is not a part of this build. In the latter scenario,
350
- * read more about {@glink builds/guides/development/custom-builds custom builds}.
351
+ * read more about {@glink installation/getting-started/quick-start custom builds}.
351
352
  *
352
353
  * **If you see this warning when using one of the editor creators directly** (not a build), then it means
353
354
  * that you tried loading plugins by name. However, unlike CKEditor 4, CKEditor 5 does not implement a "plugin loader".
354
355
  * This means that CKEditor 5 does not know where to load the plugin modules from. Therefore, you need to
355
356
  * provide each plugin through a reference (as a constructor function). Check out the examples in
356
- * {@glink builds/guides/integration/advanced-setup#scenario-2-building-from-source "Building from source"}.
357
+ * {@glink installation/advanced/alternative-setups/integrating-from-source "Building from source"}.
357
358
  *
358
359
  * @error plugincollection-plugin-not-found
359
360
  * @param {String} plugin The name of the plugin which could not be loaded.
@@ -576,7 +577,7 @@ export default class PluginCollection {
576
577
  * They are already built into that editor build and now get added for the second time as dependencies
577
578
  * of the plugin you are installing.
578
579
  *
579
- * Read more about {@glink builds/guides/integration/installing-plugins installing plugins}.
580
+ * Read more about {@glink installation/getting-started/installing-plugins installing plugins}.
580
581
  *
581
582
  * @error plugincollection-plugin-name-conflict
582
583
  * @param {String} pluginName The duplicated plugin name.