Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Docs: Improved link decorator feature documentation and translations.
Browse files Browse the repository at this point in the history
  • Loading branch information
oleq committed Jun 25, 2019
1 parent 7b987bd commit 27a7179
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
4 changes: 2 additions & 2 deletions lang/contexts.json
Expand Up @@ -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."
}
7 changes: 5 additions & 2 deletions src/link.js
Expand Up @@ -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: {
Expand Down
14 changes: 8 additions & 6 deletions src/linkcommand.js
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/utils/manualdecorator.js
Expand Up @@ -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}.
Expand Down
2 changes: 1 addition & 1 deletion tests/manual/linkdecorator.js
Expand Up @@ -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'
Expand Down

0 comments on commit 27a7179

Please sign in to comment.