浏览代码

Enable imageUpload command when image is selected.

panr 5 年之前
父节点
当前提交
07b099a76c
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      packages/ckeditor5-image/src/imageupload/imageuploadcommand.js

+ 4 - 1
packages/ckeditor5-image/src/imageupload/imageuploadcommand.js

@@ -44,7 +44,10 @@ export default class ImageUploadCommand extends Command {
 	 * @inheritDoc
 	 */
 	refresh() {
-		this.isEnabled = isImageAllowed( this.editor.model );
+		const imageElement = this.editor.model.document.selection.getSelectedElement();
+		const isImage = imageElement && imageElement.name === 'image';
+
+		this.isEnabled = isImageAllowed( this.editor.model ) || isImage;
 	}
 
 	/**