Răsfoiți Sursa

Docs: Aligned conversion guide to ckeditor/ckeditor5#1514.

Aleksander Nowodzinski 7 ani în urmă
părinte
comite
d2b05720ff

+ 4 - 1
packages/ckeditor5-engine/docs/_snippets/framework/extending-content-allow-link-target.js

@@ -13,7 +13,10 @@ function AllowLinkTarget( editor ) {
 	editor.conversion.for( 'downcast' ).attributeToElement( {
 	editor.conversion.for( 'downcast' ).attributeToElement( {
 		model: 'linkTarget',
 		model: 'linkTarget',
 		view: ( attributeValue, writer ) => {
 		view: ( attributeValue, writer ) => {
-			return writer.createAttributeElement( 'a', { target: attributeValue }, { priority: 5 } );
+			const linkElement = writer.createAttributeElement( 'a', { target: attributeValue }, { priority: 5 } );
+			writer.setCustomProperty( 'link', true, linkElement );
+
+			return linkElement;
 		},
 		},
 		converterPriority: 'low'
 		converterPriority: 'low'
 	} );
 	} );

+ 4 - 1
packages/ckeditor5-engine/docs/framework/guides/deep-dive/extending-content.md

@@ -442,7 +442,10 @@ function AllowLinkTarget( editor ) {
 	editor.conversion.for( 'downcast' ).attributeToElement( {
 	editor.conversion.for( 'downcast' ).attributeToElement( {
 		model: 'linkTarget',
 		model: 'linkTarget',
 		view: ( attributeValue, writer ) => {
 		view: ( attributeValue, writer ) => {
-			return writer.createAttributeElement( 'a', { target: attributeValue }, { priority: 5 } );
+			const linkElement = writer.createAttributeElement( 'a', { target: attributeValue }, { priority: 5 } );
+			writer.setCustomProperty( 'link', true, linkElement );
+
+			return linkElement;
 		},
 		},
 		converterPriority: 'low'
 		converterPriority: 'low'
 	} );
 	} );