Ver código fonte

Merge branch 'stable'

Conflicts:
src/restrictededitingmode/converters.js
src/restrictededitingmodeediting.js
src/standardeditingmodeediting.js
Marek Lewandowski 5 anos atrás
pai
commit
a6c1474cd9

+ 2 - 2
packages/ckeditor5-restricted-editing/docs/api/restricted-editing.md

@@ -14,11 +14,11 @@ Check out the {@link features/restricted-editing#demo demo in the restricted edi
 
 ## Documentation
 
-See the {@link features/restricted-editing restricted editing feature} guide and the {@link module:restricted-editing/restrictededitingmode~RestrictedEditingMode} and {@link module:restricted-editing/standardeditingmode~StandardEditingMode} plugins documentation.
+See the {@link features/restricted-editing restricted editing feature} guide as well as the {@link module:restricted-editing/restrictededitingmode~RestrictedEditingMode} and {@link module:restricted-editing/standardeditingmode~StandardEditingMode} plugins documentation.
 
 ## Installation
 
-```bash
+```plaintext
 npm install --save @ckeditor/ckeditor5-restricted-editing
 ```
 

+ 19 - 15
packages/ckeditor5-restricted-editing/docs/features/restricted-editing.md

@@ -4,22 +4,26 @@ menu-title: Restricted editing
 category: features
 ---
 
-The restricted editing feature allows you to define which parts of a document should be editable for a group of users who should have a more restricted editing rights.
+The restricted editing feature allows you to define which parts of a document can be editable for a group of users who have more restricted editing rights.
 
 In order to do that, this feature introduces two editing modes:
 
-* **Standard editing mode** — in this mode the user can freely edit the content and choose regions which should be editable in the second mode — the restricted mode.
-* **Restricted editing mode** — when the editor is initialized in this mode the user can only edit the content within the regions chosen by the user in the previous mode.
+* **Standard editing mode** – In this mode the user can freely edit the content and choose regions that should be editable in the restricted editing mode.
+* **Restricted editing mode** – When the editor is initialized in this mode, the user can only edit the content within the regions chosen by the user in the standard editing mode.
 
-You can imagine a workflow in which a certain group of users is responsible for creating templates of documents while a second group of users can only fill the gaps (for example, fill missing data, like names, dates, product names, etc.).
+You can imagine a workflow in which a certain group of users is responsible for creating templates of documents while a second group of users can only fill the gaps (for example, fill the missing data, like names, dates, product names, etc.).
 
-By using this feature users of your application will be able to create template documents. In a certain way, this feature could be used to generate forms with rich-text capabilities.
+By using this feature, the users of your application will be able to create template documents. In a certain way, this feature could be used to generate forms with rich-text capabilities.
+
+<info-box>
+	See also the {@link features/read-only read-only feature} that lets you turn the entire WYSIWYG editor into read-only mode.
+</info-box>
 
 ## Demo
 
-The demo below allows you to emulate both modes. You can first create a template of the document in the standard editing mode.
+The demo below allows you to emulate both modes. You can start from creating a template of the document in the standard editing mode.
 
-Then you can switch to the restricted editing mode to see how the editable regions and non-editable regions behaves.
+Then you can switch to the restricted editing mode to see how the editable and non-editable regions behave.
 
 <info-box>
 	Tip: Use <kbd>Tab</kbd> to navigate from one editable region to another (and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move back) in the restricted mode.
@@ -31,13 +35,13 @@ Then you can switch to the restricted editing mode to see how the editable regio
 
 To add this feature to your rich-text editor, install the [`@ckeditor/ckeditor5-restricted-editing`](https://www.npmjs.com/package/@ckeditor/ckeditor5-restricted-editing) package:
 
-```bash
+```plaintext
 npm install --save @ckeditor/ckeditor5-restricted-editing
 ```
 
 ### Running the standard editing mode
 
-In order to initialize the editor in the standard editing mode add the {@link module:restricted-editing/standardeditingmode~StandardEditingMode} plugin and add the `'restrictedEditingException'` button to the toolbar:
+In order to initialize the editor in the standard editing mode, add the {@link module:restricted-editing/standardeditingmode~StandardEditingMode} plugin and add the `'restrictedEditingException'` button to the toolbar:
 
 ```js
 import StandardEditingMode from '@ckeditor/ckeditor5-restricted-editing/src/standardeditingmode';
@@ -53,7 +57,7 @@ ClassicEditor
 
 ### Running the restricted editing mode
 
-In order to initialize the editor in the restricted editing mode add the {@link module:restricted-editing/restrictededitingmode~RestrictedEditingMode} plugin and add the `'restrictedEditing'` button to the toolbar:
+In order to initialize the editor in the restricted editing mode, add the {@link module:restricted-editing/restrictededitingmode~RestrictedEditingMode} plugin and add the `'restrictedEditing'` button to the toolbar:
 
 ```js
 import RestrictedEditingMode from '@ckeditor/ckeditor5-restricted-editing/src/restrictededitingmode';
@@ -75,13 +79,13 @@ ClassicEditor
 
 The {@link module:restricted-editing/standardeditingmode~StandardEditingMode} plugin registers:
 
-* The `'restrictedEditingException'` button which allows marking regions to be editable.
-* The {@link module:restricted-editing/restrictededitingexceptioncommand~RestrictedEditingExceptionCommand `'restrictedEditingException'`} command which allows marking regions to be editable..
+* The `'restrictedEditingException'` button that allows marking regions as editable.
+* The {@link module:restricted-editing/restrictededitingexceptioncommand~RestrictedEditingExceptionCommand `'restrictedEditingException'`} command that allows marking regions as editable.
 
 The {@link module:restricted-editing/restrictededitingmode~RestrictedEditingMode} plugin registers:
 
-* The `'restrictedEditing'` dropdown which allows navigating between editable regions.
-* The {@link module:restricted-editing/restrictededitingmodenavigationcommand~RestrictedEditingModeNavigationCommand `'goToPreviousRestrictedEditingException'`} and `'goToNextRestrictedEditingException'` commands which allow navigating between editable regions.
+* The `'restrictedEditing'` dropdown that allows navigating between editable regions.
+* The {@link module:restricted-editing/restrictededitingmodenavigationcommand~RestrictedEditingModeNavigationCommand `'goToPreviousRestrictedEditingException'`} and `'goToNextRestrictedEditingException'` commands that allow navigating between editable regions.
 
 <info-box>
 	We recommend using the official {@link framework/guides/development-tools#ckeditor-5-inspector CKEditor 5 inspector} for development and debugging. It will give you tons of useful information about the state of the editor such as internal data structures, selection, commands, and many more.
@@ -89,7 +93,7 @@ The {@link module:restricted-editing/restrictededitingmode~RestrictedEditingMode
 
 ## Real-time collaboration
 
-When using the real-time collaboration, all the connected users should be always in the same mode. It is not possible to have different list of plugins among users of a single collaborative session.
+When using [real-time collaboration](https://ckeditor.com/collaboration/real-time-collaborative-editing/), all the connected users should always be in the same mode. It is not possible to have a different list of plugins enabled among users of a single collaborative session.
 
 ## Contribute
 

+ 8 - 7
packages/ckeditor5-restricted-editing/src/restrictededitingmode.js

@@ -14,12 +14,12 @@ import RestrictedEditingModeUI from './restrictededitingmodeui';
 import '../theme/restrictedediting.css';
 
 /**
- * The Restricted Editing Mode plugin.
+ * The restricted editing mode plugin.
  *
  * This is a "glue" plugin which loads the following plugins:
  *
- * * The {@link module:restricted-editing/restrictededitingmodeediting~RestrictedEditingModeEditing restricted mode editing feature} and
- * * The {@link module:restricted-editing/restrictededitingmodeui~RestrictedEditingModeUI restricted mode ui feature}.
+ * * The {@link module:restricted-editing/restrictededitingmodeediting~RestrictedEditingModeEditing restricted mode editing feature}.
+ * * The {@link module:restricted-editing/restrictededitingmodeui~RestrictedEditingModeUI restricted mode UI feature}.
  *
  * @extends module:core/plugin~Plugin
  */
@@ -69,12 +69,13 @@ export default class RestrictedEditingMode extends Plugin {
  */
 
 /**
- * The commands names allowed in non-restricted areas of the content.
+ * The command names allowed in non-restricted areas of the content.
  *
- * Define which feature commands should be enabled in restricted editing mode. The commands used for typing and deleting text
- * (`'input'`, `'delete'` and `'forwardDelete'`) are allowed by the feature inside non-restricted regions and does not have to be defined.
+ * Defines which feature commands should be enabled in the restricted editing mode. The commands used for typing and deleting text
+ * (`'input'`, `'delete'` and `'forwardDelete'`) are allowed by the feature inside non-restricted regions and do not need to be defined.
  *
- * **Note**: The restricted editing mode always allows to use restricted mode navigation commands as well as `'undo'` and `'redo'` commands.
+ * **Note**: The restricted editing mode always allows to use the restricted mode navigation commands as well as `'undo'` and `'redo'`
+ * commands.
  *
  * The default value is:
  *

+ 9 - 9
packages/ckeditor5-restricted-editing/src/restrictededitingmode/converters.js

@@ -13,14 +13,14 @@ import { getMarkerAtPosition } from './utils';
 const HIGHLIGHT_CLASS = 'restricted-editing-exception_selected';
 
 /**
- * Adds a visual highlight style to a restricted editing exception the selection is anchored to.
+ * Adds a visual highlight style to a restricted editing exception that the selection is anchored to.
  *
- * Highlight is turned on by adding the `.restricted-editing-exception_selected` class to the
+ * The highlight is turned on by adding the `.ck-restricted-editing-exception_selected` class to the
  * exception in the view:
  *
- * * The class is removed before the conversion has started, as callbacks added with the `'highest'` priority
+ * * The class is removed before the conversion starts, as callbacks added with the `'highest'` priority
  * to {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher} events.
- * * The class is added in the view post fixer, after other changes in the model tree were converted to the view.
+ * * The class is added in the view post-fixer, after other changes in the model tree are converted to the view.
  *
  * This way, adding and removing the highlight does not interfere with conversion.
  *
@@ -67,7 +67,7 @@ export function setupExceptionHighlighting( editor ) {
 }
 
 /**
- * A post-fixer that prevents removing collapsed marker from the document.
+ * A post-fixer that prevents removing a collapsed marker from the document.
  *
  * @param {module:core/editor/editor~Editor} editor
  * @returns {Function}
@@ -92,7 +92,7 @@ export function resurrectCollapsedMarkerPostFixer( editor ) {
 }
 
 /**
- * A post-fixer that extends a marker when user types on it boundaries.
+ * A post-fixer that extends a marker when the user types on its boundaries.
  *
  * @param {module:core/editor/editor~Editor} editor
  * @returns {Function}
@@ -114,12 +114,12 @@ export function extendMarkerOnTypingPostFixer( editor ) {
 }
 
 /**
- * A view highlight to marker conversion helper.
+ * A view highlight-to-marker conversion helper.
  *
  * @param {Object} config Conversion configuration.
- * @param {module:engine/view/matcher~MatcherPattern} [config.view] Pattern matching all view elements which should be converted. If not
+ * @param {module:engine/view/matcher~MatcherPattern} [config.view] A pattern matching all view elements which should be converted. If not
  * set, the converter will fire for every view element.
- * @param {String|module:engine/model/element~Element|Function} config.model Name of the model element, a model element
+ * @param {String|module:engine/model/element~Element|Function} config.model The name of the model element, a model element
  * instance or a function that takes a view element and returns a model element. The model element will be inserted in the model.
  * @param {module:utils/priorities~PriorityString} [config.converterPriority='normal'] Converter priority.
  */

+ 4 - 4
packages/ckeditor5-restricted-editing/src/restrictededitingmode/utils.js

@@ -9,8 +9,8 @@
 
 /**
  * Returns a single "restricted-editing-exception" marker at a given position. Contrary to
- * {@link module:engine/model/markercollection~MarkerCollection#getMarkersAtPosition} it return a marker also when the postion is equal
- * to one of markers start or end positions.
+ * {@link module:engine/model/markercollection~MarkerCollection#getMarkersAtPosition}, it returnd a marker also when the postion is
+ * equal to one of the marker's start or end positions.
  *
  * @param {module:core/editor/editor~Editor} editor
  * @param {module:engine/model/position~Position} position
@@ -29,7 +29,7 @@ export function getMarkerAtPosition( editor, position ) {
 }
 
 /**
- * Checks if the position is fully contained in range. Positions equal to range start or end are considered "in".
+ * Checks if the position is fully contained in the range. Positions equal to range start or end are considered "in".
  *
  * @param {module:engine/model/range~Range} range
  * @param {module:engine/model/position~Position} position
@@ -44,7 +44,7 @@ export function isPositionInRangeBoundaries( range, position ) {
 }
 
 /**
- * Checks if the selection is fully contained in marker. Positions on marker boundaries are considered "in".
+ * Checks if the selection is fully contained in the marker. Positions on marker boundaries are considered "in".
  *
  *		<marker>[]foo</marker> -> true
  *		<marker>f[oo]</marker> -> true

+ 11 - 11
packages/ckeditor5-restricted-editing/src/restrictededitingmodeediting.js

@@ -20,11 +20,11 @@ import { getMarkerAtPosition, isSelectionInMarker } from './restrictededitingmod
 const COMMAND_FORCE_DISABLE_ID = 'RestrictedEditingMode';
 
 /**
- * The Restricted Editing Mode editing feature.
+ * The restricted editing mode editing feature.
  *
- * * It introduces the exception marker group that renders to `<spans>` with the `restricted-editing-exception` CSS class.
+ * * It introduces the exception marker group that renders to `<span>` elements with the `restricted-editing-exception` CSS class.
  * * It registers the `'goToPreviousRestrictedEditingException'` and `'goToNextRestrictedEditingException'` commands.
- * * Also enables highlighting exception markers that are selected.
+ * * It also enables highlighting exception markers that are selected.
  *
  * @extends module:core/plugin~Plugin
  */
@@ -48,7 +48,7 @@ export default class RestrictedEditingModeEditing extends Plugin {
 		} );
 
 		/**
-		 * Command names that are enabled outside non-restricted regions.
+		 * Command names that are enabled outside the non-restricted regions.
 		 *
 		 * @type {Set.<String>}
 		 * @private
@@ -58,7 +58,7 @@ export default class RestrictedEditingModeEditing extends Plugin {
 		/**
 		 * Commands allowed in non-restricted areas.
 		 *
-		 * Commands always enabled combines typing feature commands: `'typing'`, `'delete'` and `'forwardDelete'` with commands defined
+		 * Commands always enabled combine typing feature commands: `'typing'`, `'delete'` and `'forwardDelete'` with commands defined
 		 * in the feature configuration.
 		 *
 		 * @type {Set<string>}
@@ -113,11 +113,11 @@ export default class RestrictedEditingModeEditing extends Plugin {
 	}
 
 	/**
-	 * Setups restricted mode editing conversion:
+	 * Sets up the restricted mode editing conversion:
 	 *
-	 * * ucpast & downcast converters
-	 * * marker highlighting in the edting area
-	 * * marker post-fixers
+	 * * ucpast & downcast converters,
+	 * * marker highlighting in the edting area,
+	 * * marker post-fixers.
 	 *
 	 * @private
 	 */
@@ -230,7 +230,7 @@ export default class RestrictedEditingModeEditing extends Plugin {
 	}
 
 	/**
-	 * Setups the commands toggling - enables or disables commands based on user selection.
+	 * Sets up the command toggling which enables or disables commands based on the user selection.
 	 *
 	 * @private
 	 */
@@ -246,7 +246,7 @@ export default class RestrictedEditingModeEditing extends Plugin {
 	}
 
 	/**
-	 * Checks if commands should be enabled or disabled based on current selection.
+	 * Checks if commands should be enabled or disabled based on the current selection.
 	 *
 	 * @private
 	 */

+ 3 - 3
packages/ckeditor5-restricted-editing/src/restrictededitingmodenavigationcommand.js

@@ -18,14 +18,14 @@ export default class RestrictedEditingModeNavigationCommand extends Command {
 	/**
 	 * Creates an instance of the command.
 	 *
-	 * @param {module:core/editor/editor~Editor} editor Editor instance.
-	 * @param {String} direction Direction the command works. Can be either `'forward'` or `'backward'`.
+	 * @param {module:core/editor/editor~Editor} editor The editor instance.
+	 * @param {String} direction The direction that the command works. Can be either `'forward'` or `'backward'`.
 	 */
 	constructor( editor, direction ) {
 		super( editor );
 
 		/**
-		 * A direction of the command. Can be `'forward'` or `'backward'`.
+		 * The direction of the command. Can be `'forward'` or `'backward'`.
 		 *
 		 * @readonly
 		 * @private

+ 5 - 5
packages/ckeditor5-restricted-editing/src/restrictededitingmodeui.js

@@ -14,9 +14,9 @@ import lockIcon from '../theme/icons/contentlock.svg';
 import Collection from '@ckeditor/ckeditor5-utils/src/collection';
 
 /**
- * The Restricted Editing Mode UI feature.
+ * The restricted editing mode UI feature.
  *
- * It introduces the `'restrictedEditing'` dropdown that offers tools to navigate exceptions across
+ * It introduces the `'restrictedEditing'` dropdown that offers tools to navigate between exceptions across
  * the document.
  *
  * @extends module:core/plugin~Plugin
@@ -74,9 +74,9 @@ export default class RestrictedEditingModeUI extends Plugin {
 	 * Returns a definition of the navigation button to be used in the dropdown.
 	 *
 	 * @private
-	 * @param {String} commandName Name of the command the button represents.
-	 * @param {String} label Translated label of the button.
-	 * @param {String} keystroke Keystroke of the button.
+	 * @param {String} commandName The name of the command that the button represents.
+	 * @param {String} label The translated label of the button.
+	 * @param {String} keystroke The button keystroke.
 	 * @returns {module:ui/dropdown/utils~ListDropdownItemDefinition}
 	 */
 	_getButtonDefinition( commandName, label, keystroke ) {

+ 4 - 4
packages/ckeditor5-restricted-editing/src/standardeditingmode.js

@@ -15,12 +15,12 @@ import StandardEditingModeUI from './standardeditingmodeui';
 import '../theme/restrictedediting.css';
 
 /**
- * The Standard Editing Mode plugin.
+ * The standard editing mode plugin.
  *
- * This is a "glue" plugin which loads the following plugins:
+ * This is a "glue" plugin that loads the following plugins:
  *
- * * The {@link module:restricted-editing/standardeditingmodeediting~StandardEditingModeEditing standard mode editing feature} and
- * * The {@link module:restricted-editing/standardeditingmodeui~StandardEditingModeUI standard mode ui feature}.
+ * * The {@link module:restricted-editing/standardeditingmodeediting~StandardEditingModeEditing standard mode editing feature}.
+ * * The {@link module:restricted-editing/standardeditingmodeui~StandardEditingModeUI standard mode UI feature}.
  *
  * @extends module:core/plugin~Plugin
  */

+ 3 - 3
packages/ckeditor5-restricted-editing/src/standardeditingmodeediting.js

@@ -11,10 +11,10 @@ import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
 import RestrictedEditingExceptionCommand from './restrictededitingexceptioncommand';
 
 /**
- * The Standard Editing Mode editing feature.
+ * The standard editing mode editing feature.
  *
- * * It introduces the `restrictedEditingException` text attributes that is rendered as
- * `<spans>` with the `restricted-editing-exception` CSS class.
+ * * It introduces the `restrictedEditingException` text attribute that is rendered as
+ * a `<span>` element with the `restricted-editing-exception` CSS class.
  * * It registers the `'restrictedEditingException'` command.
  *
  * @extends module:core/plugin~Plugin

+ 1 - 1
packages/ckeditor5-restricted-editing/src/standardeditingmodeui.js

@@ -13,7 +13,7 @@ import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
 import unlockIcon from '../theme/icons/contentunlock.svg';
 
 /**
- * The Standard Editing Mode UI feature.
+ * The standard editing mode UI feature.
  *
  * It introduces the `'restrictedEditingException'` button that marks text as unrestricted for editing.
  *