mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-03-22 09:07:47 +01:00
Revert "Prevent the Return key from submitting while composing using an IME"
This reverts commit d13f1cf7b8
.
This commit is contained in:
parent
aeef50ad78
commit
6a0d9063ba
1 changed files with 0 additions and 18 deletions
|
@ -13,14 +13,8 @@ $(document).on "click", "button[name=ab-comments]", ->
|
||||||
commentBox.slideUp()
|
commentBox.slideUp()
|
||||||
btn[0].dataset.state = 'hidden'
|
btn[0].dataset.state = 'hidden'
|
||||||
|
|
||||||
isComposing = false
|
|
||||||
compositionHasJustEnded = false
|
|
||||||
|
|
||||||
$(document).on "keyup", "input[name=ab-comment-new]", (evt) ->
|
$(document).on "keyup", "input[name=ab-comment-new]", (evt) ->
|
||||||
if isComposing or compositionHasJustEnded
|
|
||||||
compositionHasJustEnded = false
|
|
||||||
return
|
|
||||||
|
|
||||||
input = $(this)
|
input = $(this)
|
||||||
aid = input[0].dataset.aId
|
aid = input[0].dataset.aId
|
||||||
ctr = $("span#ab-comment-charcount-#{aid}")
|
ctr = $("span#ab-comment-charcount-#{aid}")
|
||||||
|
@ -55,18 +49,6 @@ $(document).on "keyup", "input[name=ab-comment-new]", (evt) ->
|
||||||
complete: (jqxhr, status) ->
|
complete: (jqxhr, status) ->
|
||||||
input.removeAttr 'disabled'
|
input.removeAttr 'disabled'
|
||||||
|
|
||||||
# IME Return key handling
|
|
||||||
$(document).on "compositionstart", "input[name=ab-comment-new]", (evt) ->
|
|
||||||
isComposing = true
|
|
||||||
|
|
||||||
$(document).on "compositionend", "input[name=ab-comment-new]", (evt) ->
|
|
||||||
isComposing = false
|
|
||||||
compositionHasJustEnded = true
|
|
||||||
|
|
||||||
$(document).on "keydown", "input[name=ab-comment-new]", (evt) ->
|
|
||||||
# 229 is a special keyCode for events processed by an IME
|
|
||||||
# https://developer.mozilla.org/en-US/docs/Web/API/Document/keyup_event
|
|
||||||
compositionHasJustEnded = false unless event.which == 229
|
|
||||||
|
|
||||||
# character count
|
# character count
|
||||||
$(document).on "input", "input[name=ab-comment-new]", (evt) ->
|
$(document).on "input", "input[name=ab-comment-new]", (evt) ->
|
||||||
|
|
Loading…
Reference in a new issue