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 (event != null && event.type === 'blur') {
if ( if (
event != null && // Includes relatedTarget workaround for Firefox
event.type === 'blur' && $(event.relatedTarget).hasClass('rp-entry-button-cancel') ||
$(event.relatedTarget).hasClass('rp-entry-button-cancel') $(event.originalEvent.explicitOriginalTarget).hasClass(
'rp-entry-button-cancel'
)
) { ) {
return true 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 = '')