8
0
Oskar Wróbel 7 лет назад
Родитель
Сommit
9ed55474de

+ 2 - 1
packages/ckeditor5-image/tests/manual/tickets/142/1.html

@@ -1,5 +1,6 @@
-<p><button class="start">Insert image after delay</button></p>
+<p><button class="start">Insert image</button></p>
 
 <div id="editor">
+	<p>lorem ipsum</p>
 	<p>foo <a href="foo">bar</a> biz</p>
 </div>

+ 9 - 15
packages/ckeditor5-image/tests/manual/tickets/142/1.js

@@ -13,9 +13,6 @@ import Link from '@ckeditor/ckeditor5-link/src/link';
 import Image from '../../../../src/image';
 import ImageCaption from '../../../../src/imagecaption';
 
-import Element from '@ckeditor/ckeditor5-engine/src/model/element';
-import Position from '@ckeditor/ckeditor5-engine/src/model/position';
-
 ClassicEditor
 	.create( document.querySelector( '#editor' ), {
 		plugins: [ Enter, Typing, Paragraph, Link, Image, ImageCaption ],
@@ -24,24 +21,21 @@ ClassicEditor
 	.then( editor => {
 		window.editor = editor;
 
-		const doc = editor.document;
+		const doc = editor.model.document;
 
 		document.querySelector( '.start' ).addEventListener( 'click', () => {
-			wait( 3000 ).then( () => {
-				doc.enqueueChanges( () => {
-					const image = new Element( 'image', { src: 'https://www.w3schools.com/w3images/fjords.jpg' } );
+			let image;
 
-					doc.batch( 'transparent' ).insert( new Position( doc.getRoot(), [ 0 ] ), image );
-				} );
+			editor.model.change( writer => {
+				image = writer.createElement( 'image', { src: 'sample-small.jpg' } );
+				writer.insert( image, doc.getRoot().getChild( 0 ), 'after' );
 			} );
+
+			setTimeout( () => {
+				editor.ui.view.element.querySelector( 'img' ).src = '../../sample.jpg';
+			}, 3000 );
 		} );
 	} )
 	.catch( err => {
 		console.error( err.stack );
 	} );
-
-function wait( delay ) {
-	return new Promise( resolve => {
-		setTimeout( () => resolve(), delay );
-	} );
-}

+ 2 - 2
packages/ckeditor5-image/tests/manual/tickets/142/1.md

@@ -1,4 +1,4 @@
 ### Re-render view document after image load [#142](https://github.com/ckeditor/ckeditor5-image/issues/142)
 
-1. Click **Insert image after delay** then quickly select the link in the content (the link editing balloon should show up).
-2. Observe if the balloon remains attached to the link.
+1. Click **Insert image** then quickly select the link in the content (the link editing balloon should show up).
+2. Observe if the balloon remains attached to the link after replacing image source to the biggest one (replacing source is made using DOM API).

BIN
packages/ckeditor5-image/tests/manual/tickets/142/sample-small.jpg


BIN
packages/ckeditor5-image/tests/manual/tickets/142/sample.jpg