Skip to content

Commit

Permalink
Disable the logic in ImageEdit plugin to set image editing when users…
Browse files Browse the repository at this point in the history
… click images (#1405)

* Update

* Update

* update

Co-authored-by: Jiuqing Song <jisong@microsoft.com>
  • Loading branch information
haven2world and JiuqingSong authored Nov 16, 2022
1 parent fddb2be commit c07624c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const DefaultOptions: Required<ImageEditOptions> = {
disableCrop: false,
disableRotate: false,
disableSideResize: false,
onSelectState: ImageEditOperation.ResizeAndRotate,
};

/**
Expand Down Expand Up @@ -185,10 +186,7 @@ export default class ImageEdit implements EditorPlugin {
e.selectionRangeEx &&
e.selectionRangeEx.type === SelectionRangeTypes.ImageSelection
) {
this.setEditingImage(
e.selectionRangeEx.image,
ImageEditOperation.ResizeAndRotate
);
this.setEditingImage(e.selectionRangeEx.image, this.options.onSelectState);
}
break;
case PluginEventType.MouseDown:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import ModeIndependentColor from './ModeIndependentColor';
import { ImageEditOperation } from '../enum/ImageEditOperation';
import type { CompatibleImageEditOperation } from '../compatibleEnum/ImageEditOperation';

/**
* Options for ImageEdit plugin
Expand Down Expand Up @@ -63,4 +65,10 @@ export default interface ImageEditOptions {
* Whether image crop is disabled. @default false
*/
disableCrop?: boolean;

/**
* Which operations will be executed when image is selected
* @default ImageEditOperation.ResizeAndRotate
*/
onSelectState?: ImageEditOperation | CompatibleImageEditOperation;
}

0 comments on commit c07624c

Please sign in to comment.