From 8e40d594a2e53585c2ed06a2c2616fcd24c0eae8 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Wed, 20 May 2015 12:53:35 -0400 Subject: Work around a Chrome 43 bug preventing note editing --- app/assets/javascripts/notes.js.coffee | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'app/assets/javascripts/notes.js.coffee') diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee index c25b1ddb066..b87659d6222 100644 --- a/app/assets/javascripts/notes.js.coffee +++ b/app/assets/javascripts/notes.js.coffee @@ -312,6 +312,13 @@ class @Notes form.show() textarea = form.find("textarea") textarea.focus() + + # HACK (rspeicher): Work around a Chrome 43 bug(?). + # The textarea has the correct value, Chrome just won't show it unless we + # modify it, so let's add a newline! + textarea.val (_, value) -> + "#{value}\n" + disableButtonIfEmptyField textarea, form.find(".js-comment-button") ### -- cgit v1.2.1 From cbcc5f854400f8e22c2164d6265fb863279c9622 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Thu, 21 May 2015 11:22:21 +0200 Subject: Workaround that doesn't add unwanted newline. --- app/assets/javascripts/notes.js.coffee | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'app/assets/javascripts/notes.js.coffee') diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee index b87659d6222..f186fec2a0c 100644 --- a/app/assets/javascripts/notes.js.coffee +++ b/app/assets/javascripts/notes.js.coffee @@ -313,11 +313,12 @@ class @Notes textarea = form.find("textarea") textarea.focus() - # HACK (rspeicher): Work around a Chrome 43 bug(?). + # HACK (rspeicher/DouweM): Work around a Chrome 43 bug(?). # The textarea has the correct value, Chrome just won't show it unless we - # modify it, so let's add a newline! - textarea.val (_, value) -> - "#{value}\n" + # modify it, so let's clear it and re-set it! + value = textarea.val() + textarea.val "" + textarea.val value disableButtonIfEmptyField textarea, form.find(".js-comment-button") -- cgit v1.2.1