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

Docs: Updated to match the new API.

Piotrek Koszuliński 7 лет назад
Родитель
Сommit
1c1ba23bbe
1 измененных файлов с 5 добавлено и 3 удалено
  1. 5 3
      packages/ckeditor5-clipboard/docs/framework/guides/deep-dive/clipboard.md

+ 5 - 3
packages/ckeditor5-clipboard/docs/framework/guides/deep-dive/clipboard.md

@@ -68,15 +68,17 @@ The default action is to {@link module:engine/model/model~Model#insertContent in
 At this stage the pasted content can be processed by the features. For example, a feature that wants to transform the pasted text into a link can be implemented in this way:
 At this stage the pasted content can be processed by the features. For example, a feature that wants to transform the pasted text into a link can be implemented in this way:
 
 
 ```js
 ```js
+const writer = new UpcastWriter();
+
 editor.plugins.get( 'Clipboard' ).on( 'inputTransformation', ( evt, data ) => {
 editor.plugins.get( 'Clipboard' ).on( 'inputTransformation', ( evt, data ) => {
 	if ( data.content.childCount == 1 && isUrlText( data.content.getChild( 0 ) ) ) {
 	if ( data.content.childCount == 1 && isUrlText( data.content.getChild( 0 ) ) ) {
 		const linkUrl = data.content.getChild( 0 ).data;
 		const linkUrl = data.content.getChild( 0 ).data;
 
 
-		data.content = new ViewDocumentFragment( [
-			ViewElement(
+		data.content = writer.createDocumentFragment( [
+			writer.createElement(
 				'a',
 				'a',
 				{ href: linkUrl },
 				{ href: linkUrl },
-				[ new ViewText( linkUrl ) ]
+				[ writer.createText( linkUrl ) ]
 			)
 			)
 		] );
 		] );
 	}
 	}