Merge pull request #1288 from sharelatex/cmg-cancel-comments-ff

Make comments cancel when you cancel them on firefox

GitOrigin-RevId: 68b8be1ac34f0510103f3b9a8e7b617988fb55de
This commit is contained in:
Chrystal Maria Griffiths 2018-12-19 10:27:22 +00:00 committed by sharelatex
parent 2b556df43c
commit 366dbbd54f

View file

@ -50,13 +50,18 @@ define(['base'], App =>
return (scope.submitNewComment = function(event) { return (scope.submitNewComment = function(event) {
// If this is from a blur event from clicking on cancel, ignore it. // If this is from a blur event from clicking on cancel, ignore it.
if ( if (event != null && event.type === 'blur') {
event != null && if (
event.type === 'blur' && // Includes relatedTarget workaround for Firefox
$(event.relatedTarget).hasClass('rp-entry-button-cancel') $(event.relatedTarget).hasClass('rp-entry-button-cancel') ||
) { $(event.originalEvent.explicitOriginalTarget).hasClass(
return true 'rp-entry-button-cancel'
)
) {
return true
}
} }
scope.onSubmit({ content: scope.state.content }) scope.onSubmit({ content: scope.state.content })
scope.state.isAdding = false scope.state.isAdding = false
return (scope.state.content = '') return (scope.state.content = '')