-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trigger apply changed when mouse up #2133
Conversation
@@ -179,6 +180,11 @@ export default class ImageEdit implements EditorPlugin { | |||
e.preventDefault(); | |||
} | |||
}, | |||
mouseup: e => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we already have mouse up event handler at line 185
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The handler in the switch case is not triggered when the mouse up event happens in the image wrapper.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. In that case, we should only attach this event handler when image wrapper is showing, and detach it when hide.
Also please try if we can attach the event to the wrapper element only, but not the whole window.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try pass true as the 3rd parameter when addEventListener, see if that can fix this problem:
node.addEventListener('mouseup', handler, true /*useCapture*/);
If that works, also need to pass true when remove event listener.
@@ -57,6 +57,10 @@ export default function applyChange( | |||
newSrc, | |||
}); | |||
newSrc = event.newSrc; | |||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check the new parameter as well.
Added a new parameters
applyChangesOnMouseUp
. If this parameter is true, when editing an image the last changes will be applied when mouse up event occurs.applyChangesOnMouseUp
will be false by default.