Kaynağa Gözat

Docs: Improved link decorator feature documentation and translations.

Aleksander Nowodzinski 6 yıl önce
ebeveyn
işleme
7f836bf95a

+ 2 - 2
packages/ckeditor5-link/lang/contexts.json

@@ -5,6 +5,6 @@
 	"Edit link": "Button opening the Link URL editing balloon.",
 	"Open link in new tab": "Button opening the link in new browser tab.",
 	"This link has no URL": "Label explaining that a link has no URL set (the URL is empty).",
-	"Open link in a new tab": "One of the commonly used labels in manual decorators determines if given link can be opened in a new tab",
-	"Downloadable": "One of the commonly used labels in manual decorators determines if given link should be treat as link to download resources."
+	"Open link in a new tab": "The label of the switch button that controls whether the edited link will open in a new tab.",
+	"Downloadable": "The label of the switch button that controls whether the edited link refers to downloadable resource."
 }

+ 5 - 2
packages/ckeditor5-link/src/link.js

@@ -88,8 +88,11 @@ export default class Link extends Plugin {
  * * {@link module:link/link~LinkDecoratorManualDefinition manual} – they allow users to control link attributes individually
  *  using the editor UI.
  *
- * Link decorators are defined as an object with key-value pair, where key is a name provided for given decorator and value is decorator
- * definition.
+ * Link decorators are defined as an object with key-value pairs, where the key is a name provided for a given decorator and the
+ * value is the decorator definition.
+ *
+ * The name of the decorator also corresponds to the {@glink framework/guides/architecture/editing-engine#text-attributes text attribute}
+ * in the model. For instance, the `isExternal` decorator below is represented as a `linkIsExternal` attribute in the model.
  *
  *		const linkConfig = {
  *			decorators: {

+ 8 - 6
packages/ckeditor5-link/src/linkcommand.js

@@ -79,13 +79,15 @@ export default class LinkCommand extends Command {
 	 *
 	 * When the selection is collapsed and inside the text with the `linkHref` attribute, the attribute value will be updated.
 	 *
-	 * # Decorators and attribute management
+	 * # Decorators and model attribute management
 	 *
-	 * This command has an optional argument, which applies or removes model attributes brought by
-	 * {@link module:link/utils~ManualDecorator manual decorators}. Model attribute names correspond to
-	 * decorator {@link module:link/utils~ManualDecorator#id ids} and and they are created based on decorator's entry in configuration.
-	 * Attribute name is combination of `link` prefix with object's key used to define given decorator. For example,
-	 * `'linkIsExternal'`, `'linkIsDownloadable'`, `'linkFoo'`, etc..
+	 * There is an optional argument to this command, which applies or removes model
+	 * {@glink framework/guides/architecture/editing-engine#text-attributes text attributes} brought by
+	 * {@link module:link/utils~ManualDecorator manual link decorators}.
+	 *
+	 * Text attribute names in the model correspond to the entries in the {@link module:link/link~LinkConfig#decorators configuration}.
+	 * For every decorator configured, a model text attribute exists with the "link" prefix. For example, a `'linkMyDecorator'` attribute
+	 * corresponds to the `'myDecorator'` in the configuration.
 	 *
 	 * To learn more about link decorators, check out the {@link module:link/link~LinkConfig#decorators `config.link.decorators`}
 	 * documentation.

+ 1 - 1
packages/ckeditor5-link/src/utils/manualdecorator.js

@@ -23,7 +23,7 @@ export default class ManualDecorator {
 	 *
 	 * @param {Object} config
 	 * @param {String} config.id name of attribute used in model, which represents given manual decorator.
-	 * For example 'linkIsExternal.
+	 * For example `'linkIsExternal'`.
 	 * @param {String} config.label The label used in user interface to toggle manual decorator.
 	 * @param {Object} config.attributes Set of attributes added to output data, when decorator is active for specific link.
 	 * Attributes should keep format of attributes defined in {@link module:engine/view/elementdefinition~ElementDefinition}.

+ 1 - 1
packages/ckeditor5-link/tests/manual/linkdecorator.js

@@ -24,7 +24,7 @@ ClassicEditor
 			decorators: {
 				isExternal: {
 					mode: 'manual',
-					label: 'Open in new window',
+					label: 'Open in a new tab',
 					attributes: {
 						target: '_blank',
 						rel: 'noopener noreferrer'