Explorar el Código

Assign command.value on command execution.

panr hace 5 años
padre
commit
55cf69bbb5
Se han modificado 1 ficheros con 10 adiciones y 3 borrados
  1. 10 3
      packages/ckeditor5-image/src/imageresize/imageresizecommand.js

+ 10 - 3
packages/ckeditor5-image/src/imageresize/imageresizecommand.js

@@ -51,8 +51,15 @@ export default class ImageResizeCommand extends Command {
 		const model = this.editor.model;
 		const imageElement = model.document.selection.getSelectedElement();
 
-		model.change( writer => {
-			writer.setAttribute( 'width', options.width, imageElement );
-		} );
+		this.value = {
+			width: options.width,
+			height: null
+		};
+
+		if ( imageElement ) {
+			model.change( writer => {
+				writer.setAttribute( 'width', options.width, imageElement );
+			} );
+		}
 	}
 }