|
|
@@ -15,7 +15,8 @@ import List from '@ckeditor/ckeditor5-list/src/list';
|
|
|
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
|
|
|
import Undo from '@ckeditor/ckeditor5-undo/src/undo';
|
|
|
import Typing from '@ckeditor/ckeditor5-typing/src/typing';
|
|
|
-
|
|
|
+import Image from '@ckeditor/ckeditor5-image/src/image';
|
|
|
+import ImageCaption from '@ckeditor/ckeditor5-image/src/imagecaption';
|
|
|
import global from '@ckeditor/ckeditor5-utils/src/dom/global';
|
|
|
import { getData, setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
|
|
|
|
|
|
@@ -28,7 +29,7 @@ describe( 'AutoMediaEmbed - integration', () => {
|
|
|
|
|
|
return ClassicTestEditor
|
|
|
.create( editorElement, {
|
|
|
- plugins: [ MediaEmbed, AutoMediaEmbed, Link, List, Bold, Typing ]
|
|
|
+ plugins: [ MediaEmbed, AutoMediaEmbed, Link, List, Bold, Typing, Image, ImageCaption ]
|
|
|
} )
|
|
|
.then( newEditor => {
|
|
|
editor = newEditor;
|
|
|
@@ -301,6 +302,18 @@ describe( 'AutoMediaEmbed - integration', () => {
|
|
|
);
|
|
|
} );
|
|
|
|
|
|
+ // #47
|
|
|
+ it( 'does not transform a valid URL into a media if the element cannot be placed in the current position', () => {
|
|
|
+ setData( editor.model, '<image src="foo.png"><caption>Foo.[]</caption></image>' );
|
|
|
+ pasteHtml( editor, 'https://www.youtube.com/watch?v=H08tGjXNHO4' );
|
|
|
+
|
|
|
+ clock.tick( 100 );
|
|
|
+
|
|
|
+ expect( getData( editor.model ) ).to.equal(
|
|
|
+ '<image src="foo.png"><caption>Foo.https://www.youtube.com/watch?v=H08tGjXNHO4[]</caption></image>'
|
|
|
+ );
|
|
|
+ } );
|
|
|
+
|
|
|
it( 'replaces a URL in media if pasted a link when other media element was selected', () => {
|
|
|
setData(
|
|
|
editor.model,
|