This repository has been archived by the owner on Jun 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #215 from ckeditor/t/142
Fix: The UI should update once the image is loaded. Closes #142. Used the `EditorUI#update` event instead of `View#render` to attach the UI components (see ckeditor/ckeditor5-core#130).
- Loading branch information
Showing
11 changed files
with
114 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md. | ||
*/ | ||
|
||
/* global document, console, window, setTimeout */ | ||
|
||
import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor'; | ||
import Enter from '@ckeditor/ckeditor5-enter/src/enter'; | ||
import Typing from '@ckeditor/ckeditor5-typing/src/typing'; | ||
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph'; | ||
import Link from '@ckeditor/ckeditor5-link/src/link'; | ||
import BlockToolbar from '@ckeditor/ckeditor5-ui/src/toolbar/block/blocktoolbar'; | ||
import Image from '../../../../src/image'; | ||
import ImageCaption from '../../../../src/imagecaption'; | ||
|
||
ClassicEditor | ||
.create( document.querySelector( '#editor' ), { | ||
plugins: [ Enter, Typing, Paragraph, Link, Image, ImageCaption, BlockToolbar ], | ||
toolbar: [], | ||
blockToolbar: [ 'Link' ] | ||
} ) | ||
.then( editor => { | ||
window.editor = editor; | ||
|
||
const doc = editor.model.document; | ||
|
||
document.querySelector( '.start' ).addEventListener( 'click', () => { | ||
let 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 ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
### Update the UI after image load [#142](https://github.com/ckeditor/ckeditor5-image/issues/142) | ||
|
||
1. Click **Insert image** then quickly select the link in the content (the link editing balloon should show up). | ||
2. Observe if the link balloon and block toolbar remains properly positioned after replacing image source to the biggest one (replacing source is made using DOM API). |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.