瀏覽代碼

Rename targetDecorator to addTargetToExternalLinks.

Mateusz Samsel 6 年之前
父節點
當前提交
096403a5b0

+ 6 - 4
packages/ckeditor5-link/src/link.js

@@ -67,7 +67,7 @@ export default class Link extends Plugin {
  * **Note**: To control the `target` and `rel` attributes of specific links in the edited content, a dedicated
  * {@link module:link/link~LinkDecoratorManualOption manual} decorator must be defined in the
  * {@link module:link/link~LinkConfig#decorators `config.link.decodators`} array. In such scenario,
- * the `config.link.targetDecorator` option should remain `undefined` or `false` to not interfere with the manual decorator.
+ * the `config.link.addTargetToExternalLinks` option should remain `undefined` or `false` to not interfere with the manual decorator.
  *
  * **Note**: It is possible to add other {@link module:link/link~LinkDecoratorAutomaticOption automatic}
  * or {@link module:link/link~LinkDecoratorManualOption manual} link decorators when this option is active.
@@ -76,7 +76,7 @@ export default class Link extends Plugin {
  * reference.
  *
  * @default false
- * @member {Boolean} module:link/link~LinkConfig#targetDecorator
+ * @member {Boolean} module:link/link~LinkConfig#addTargetToExternalLinks
  */
 
 /**
@@ -120,7 +120,8 @@ export default class Link extends Plugin {
  *
  * **Note**: Since the `target` attribute management for external links is a common use case, there is a predefined automatic decorator
  * dedicated for that purpose which can be enabled by turning a single option on. Check out the
- * {@link module:link/link~LinkConfig#targetDecorator `config.link.targetDecorator`} configuration description to learn more.
+ * {@link module:link/link~LinkConfig#addTargetToExternalLinks `config.link.addTargetToExternalLinks`}
+ * configuration description to learn more.
  *
  * @member {Array.<module:link/link~LinkDecoratorAutomaticOption|module:link/link~LinkDecoratorManualOption>}
  * module:link/link~LinkConfig#decorators
@@ -147,7 +148,8 @@ export default class Link extends Plugin {
  *
  * **Note**: Since the `target` attribute management for external links is a common use case, there is a predefined automatic decorator
  * dedicated for that purpose which can be enabled by turning a single option on. Check out the
- * {@link module:link/link~LinkConfig#targetDecorator `config.link.targetDecorator`} configuration description to learn more.
+ * {@link module:link/link~LinkConfig#addTargetToExternalLinks `config.link.addTargetToExternalLinks`}
+ * configuration description to learn more.
  *
  * @typedef {Object} module:link/link~LinkDecoratorAutomaticOption
  * @property {'automatic'} mode The kind of the decorator. `'automatic'` for all automatic decorators.

+ 3 - 3
packages/ckeditor5-link/src/linkediting.js

@@ -38,7 +38,7 @@ export default class LinkEditing extends Plugin {
 		super( editor );
 
 		editor.config.define( 'link', {
-			targetDecorator: false
+			addTargetToExternalLinks: false
 		} );
 	}
 
@@ -96,7 +96,7 @@ export default class LinkEditing extends Plugin {
 	 * {@link module:link/utils~AutomaticDecorators#getDispatcher} method.
 	 *
 	 * **Note**: This method also activates the automatic external link decorator if enabled via
-	 * {@link module:link/link~LinkConfig#targetDecorator `config.link.targetDecorator`}.
+	 * {@link module:link/link~LinkConfig#addTargetToExternalLinks `config.link.addTargetToExternalLinks`}.
 	 *
 	 * @private
 	 * @param {Array.<module:link/link~LinkDecoratorAutomaticOption>} automaticDecoratorDefinitions
@@ -106,7 +106,7 @@ export default class LinkEditing extends Plugin {
 		const automaticDecorators = new AutomaticDecorators();
 
 		// Adds default decorator for external links.
-		if ( editor.config.get( 'link.targetDecorator' ) ) {
+		if ( editor.config.get( 'link.addTargetToExternalLinks' ) ) {
 			automaticDecorators.add( {
 				mode: DECORATOR_AUTOMATIC,
 				callback: url => EXTERNAL_LINKS_REGEXP.test( url ),

+ 8 - 8
packages/ckeditor5-link/tests/linkediting.js

@@ -392,18 +392,18 @@ describe( 'LinkEditing', () => {
 					url: 'tel:123456789'
 				}
 			];
-			it( 'link.targetDecorator is predefined as false value', () => {
-				expect( editor.config.get( 'link.targetDecorator' ) ).to.be.false;
+			it( 'link.addTargetToExternalLinks is predefined as false value', () => {
+				expect( editor.config.get( 'link.addTargetToExternalLinks' ) ).to.be.false;
 			} );
 
-			describe( 'for link.targetDecorator = false', () => {
+			describe( 'for link.addTargetToExternalLinks = false', () => {
 				let editor, model;
 				beforeEach( () => {
 					return VirtualTestEditor
 						.create( {
 							plugins: [ Paragraph, LinkEditing, Enter ],
 							link: {
-								targetDecorator: true
+								addTargetToExternalLinks: true
 							}
 						} )
 						.then( newEditor => {
@@ -417,8 +417,8 @@ describe( 'LinkEditing', () => {
 					editor.destroy();
 				} );
 
-				it( 'link.targetDecorator is set as true value', () => {
-					expect( editor.config.get( 'link.targetDecorator' ) ).to.be.true;
+				it( 'link.addTargetToExternalLinks is set as true value', () => {
+					expect( editor.config.get( 'link.addTargetToExternalLinks' ) ).to.be.true;
 				} );
 
 				testLinks.forEach( link => {
@@ -480,7 +480,7 @@ describe( 'LinkEditing', () => {
 						.create( {
 							plugins: [ Paragraph, LinkEditing, Enter ],
 							link: {
-								targetDecorator: false,
+								addTargetToExternalLinks: false,
 								decorators: [
 									{
 										mode: 'automatic',
@@ -566,7 +566,7 @@ describe( 'LinkEditing', () => {
 					.create( {
 						plugins: [ Paragraph, LinkEditing, Enter, CustomLinks ],
 						link: {
-							targetDecorator: true,
+							addTargetToExternalLinks: true,
 						}
 					} )
 					.then( newEditor => {