Browse Source

Internal: updated the API usage to reflect current widget resizer implementation.

Marek Lewandowski 6 years ago
parent
commit
8befac2ab7

+ 1 - 5
packages/ckeditor5-image/src/image/utils.js

@@ -22,11 +22,7 @@ import { findOptimalInsertionPosition, isWidget, toWidget } from '@ckeditor/cked
 export function toImageWidget( viewElement, writer, label ) {
 export function toImageWidget( viewElement, writer, label ) {
 	writer.setCustomProperty( 'image', true, viewElement );
 	writer.setCustomProperty( 'image', true, viewElement );
 
 
-	return toWidget( viewElement, writer, {
-		label: labelCreator,
-		features: [
-		]
-	} );
+	return toWidget( viewElement, writer, { label: labelCreator } );
 
 
 	function labelCreator() {
 	function labelCreator() {
 		const imgElement = viewElement.getChild( 0 );
 		const imgElement = viewElement.getChild( 0 );

+ 1 - 1
packages/ckeditor5-image/tests/manual/image.html

@@ -1,7 +1,7 @@
 <div id="editor">
 <div id="editor">
 	<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus consequat placerat. Vestibulum id tellus et mauris sagittis tincidunt quis id mauris. Curabitur consectetur lectus sit amet tellus mattis, non lobortis leo interdum. </p>
 	<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus consequat placerat. Vestibulum id tellus et mauris sagittis tincidunt quis id mauris. Curabitur consectetur lectus sit amet tellus mattis, non lobortis leo interdum. </p>
 	<figure class="image image-style-side">
 	<figure class="image image-style-side">
-		<img src="sample.jpg" alt="" />
+		<img src="sample.jpg" alt="" height="60" />
 	</figure>
 	</figure>
 	<figure class="image">
 	<figure class="image">
 		<img src="sample.jpg" alt="" />
 		<img src="sample.jpg" alt="" />

+ 1 - 37
packages/ckeditor5-image/tests/manual/image.js

@@ -14,45 +14,9 @@ import ImagePlugin from '../../src/image';
 import UndoPlugin from '@ckeditor/ckeditor5-undo/src/undo';
 import UndoPlugin from '@ckeditor/ckeditor5-undo/src/undo';
 import ClipboardPlugin from '@ckeditor/ckeditor5-clipboard/src/clipboard';
 import ClipboardPlugin from '@ckeditor/ckeditor5-clipboard/src/clipboard';
 
 
-import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
-
-class ResizeFeaturePlugin extends Plugin {
-	init() {
-		const view = this.editor.editing.view;
-		const viewDocument = view.document;
-
-		this.listenTo( viewDocument, 'selectionChange', ( ...args ) => this._onSelectionChange( ...args ) );
-		// viewDocument.selection.on( 'change', this._onSelectionChange );
-	}
-
-	_onSelectionChange( eventInfo, data ) {
-		console.log( 'sel change' );
-		const selection = data.newSelection;
-		const selectedElement = selection.getSelectedElement();
-
-		if ( selectedElement && selectedElement.hasClass( 'ck-widget' ) ) {
-
-			// const mapper = this.editor.editing.mapper;
-			// const modelElement = mapper.toModelElement( selectedElement );
-			// foo
-		}
-
-		console.log( selectedElement );
-	}
-}
-
 ClassicEditor
 ClassicEditor
 	.create( document.querySelector( '#editor' ), {
 	.create( document.querySelector( '#editor' ), {
-		plugins: [
-			EnterPlugin,
-			TypingPlugin,
-			ParagraphPlugin,
-			HeadingPlugin,
-			ImagePlugin,
-			UndoPlugin,
-			ClipboardPlugin,
-			ResizeFeaturePlugin
-		],
+		plugins: [ EnterPlugin, TypingPlugin, ParagraphPlugin, HeadingPlugin, ImagePlugin, UndoPlugin, ClipboardPlugin ],
 		toolbar: [ 'heading', '|', 'undo', 'redo' ]
 		toolbar: [ 'heading', '|', 'undo', 'redo' ]
 	} )
 	} )
 	.then( editor => {
 	.then( editor => {