restrictededitingmode.js 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /**
  2. * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  4. */
  5. /**
  6. * @module restricted-editing/restrictededitingmode
  7. */
  8. import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
  9. import RestrictedEditingModeEditing from './restrictededitingmodeediting';
  10. import RestrictedEditingModeUI from './restrictededitingmodeui';
  11. import '../theme/restrictedediting.css';
  12. /**
  13. * The Restricted Editing Mode plugin.
  14. *
  15. * This is a "glue" plugin which loads the following plugins:
  16. *
  17. * * The {@link module:restricted-editing/restrictededitingmodeediting~RestrictedEditingModeEditing restricted mode editing feature} and
  18. * * The {@link module:restricted-editing/restrictededitingmodeui~RestrictedEditingModeUI restricted mode ui feature}.
  19. *
  20. * @extends module:core/plugin~Plugin
  21. */
  22. export default class RestrictedEditingMode extends Plugin {
  23. /**
  24. * @inheritDoc
  25. */
  26. static get pluginName() {
  27. return 'RestrictedEditingMode';
  28. }
  29. /**
  30. * @inheritDoc
  31. */
  32. static get requires() {
  33. return [ RestrictedEditingModeEditing, RestrictedEditingModeUI ];
  34. }
  35. }
  36. /**
  37. * The configuration of the restricted editing mode feature. Introduced by the
  38. * {@link module:restricted-editing/restrictededitingmode~RestrictedEditingMode} feature.
  39. *
  40. * Read more in {@link module:restricted-editing/restrictededitingmode~RestrictedEditingModeConfig}.
  41. *
  42. * @member {module:restricted-editing/restrictededitingmode~RestrictedEditingModeConfig}
  43. * module:core/editor/editorconfig~EditorConfig#restrictedEditing
  44. */
  45. /**
  46. * The configuration of the restricted editing mode feature.
  47. * The option is used by the {@link module:restricted-editing/restrictededitingmode~RestrictedEditingMode} feature.
  48. *
  49. * ClassicEditor
  50. * .create( {
  51. * restrictedEditing: {
  52. * allowedCommands: [ 'bold', 'link', 'unlink' ],
  53. * allowedAttributes: [ 'bold', 'linkHref' ]
  54. * }
  55. * } )
  56. * .then( ... )
  57. * .catch( ... );
  58. *
  59. * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
  60. *
  61. * @interface module:restricted-editing/restrictededitingmode~RestrictedEditingModeConfig
  62. */
  63. /**
  64. * The commands names allowed in non-restricted areas of the content.
  65. *
  66. * Define which feature commands should be enabled in restricted editing mode. The commands used for typing and deleting text
  67. * (`'input'`, `'delete'` and `'forwardDelete'`) are allowed by the feature inside non-restricted regions and does not have to be defined.
  68. *
  69. * **Note**: The restricted editing mode always allows to use restricted mode navigation commands as well as `'undo'` and `'redo'` commands.
  70. *
  71. * The default value is:
  72. *
  73. * const restrictedEditingConfig = {
  74. * allowedCommands: [ 'bold', 'italic', 'link', 'unlink' ]
  75. * };
  76. *
  77. * @member {Array.<String>} module:restricted-editing/restrictededitingmode~RestrictedEditingModeConfig#allowedCommands
  78. */
  79. /**
  80. * The text attribute names allowed when pasting content ot non-restricted areas.
  81. *
  82. * The default value is:
  83. *
  84. * const restrictedEditingConfig = {
  85. * allowedAttributes: [ 'bold', 'italic', 'linkHref' ]
  86. * };
  87. *
  88. * @member {Array.<String>} module:restricted-editing/restrictededitingmode~RestrictedEditingModeConfig#allowedAttributes
  89. */