8
0
Просмотр исходного кода

Updated engine guides to match conversion api changes.

Kuba Niegowski 5 лет назад
Родитель
Сommit
bd828dd124

+ 1 - 1
packages/ckeditor5-engine/docs/_snippets/framework/extending-content-allow-div-attributes.js

@@ -24,7 +24,7 @@ function ConvertDivAttributes( editor ) {
 	// View-to-model converter converting a view <div> with all its attributes to the model.
 	editor.conversion.for( 'upcast' ).elementToElement( {
 		view: 'div',
-		model: ( viewElement, modelWriter ) => {
+		model: ( viewElement, { writer: modelWriter } ) => {
 			return modelWriter.createElement( 'div', viewElement.getAttributes() );
 		}
 	} );

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

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

+ 1 - 1
packages/ckeditor5-engine/docs/_snippets/framework/extending-content-arbitrary-attribute-values.js

@@ -39,7 +39,7 @@ function HandleFontSizeValue( editor ) {
 		model: {
 			key: 'fontSize'
 		},
-		view: ( modelValue, viewWriter ) => {
+		view: ( modelValue, { writer: viewWriter } ) => {
 			return viewWriter.createAttributeElement( 'span', {
 				style: `font-size:${ modelValue }px`
 			} );

+ 3 - 3
packages/ckeditor5-engine/docs/framework/guides/deep-dive/conversion-preserving-custom-content.md

@@ -64,7 +64,7 @@ function AllowLinkTarget( editor ) {
 	// Tell the editor that the model "linkTarget" attribute converts into <a target="..."></a>
 	editor.conversion.for( 'downcast' ).attributeToElement( {
 		model: 'linkTarget',
-		view: ( attributeValue, writer ) => {
+		view: ( attributeValue, { writer } ) => {
 			const linkElement = writer.createAttributeElement( 'a', { target: attributeValue }, { priority: 5 } );
 			writer.setCustomProperty( 'link', true, linkElement );
 
@@ -152,7 +152,7 @@ function ConvertDivAttributes( editor ) {
 	// The view-to-model converter converting a view <div> with all its attributes to the model.
 	editor.conversion.for( 'upcast' ).elementToElement( {
 		view: 'div',
-		model: ( viewElement, modelWriter ) => {
+		model: ( viewElement, { writer: modelWriter } ) => {
 			return modelWriter.createElement( 'div', viewElement.getAttributes() );
 		}
 	} );
@@ -246,7 +246,7 @@ function HandleFontSizeValue( editor ) {
 		model: {
 			key: 'fontSize'
 		},
-		view: ( modelValue, viewWriter ) => {
+		view: ( modelValue, { writer: viewWriter } ) => {
 			return viewWriter.createAttributeElement( 'span', {
 				style: `font-size:${ modelValue }px`
 			} );