diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-10-31 18:06:06 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-10-31 18:08:34 +0300 |
commit | 3b0039f659eab1c29e735ef2a5443e26b33d5d18 (patch) | |
tree | 52d84d372593f4f7056bf8135b86b885b20247bc /app/assets/javascripts/blob | |
parent | 7335395916b7da508abc3880ccb98435c3d50311 (diff) |
Persist blob editor's value on submit, not on click
Prior, the value of the Ace editor was only being persisted if the user
physically clicked the submit button, which the "quick submit" behavior
doesn't do.
Now the value will be properly transferred before any form is submitted.
Diffstat (limited to 'app/assets/javascripts/blob')
-rw-r--r-- | app/assets/javascripts/blob/edit_blob.js.coffee | 8 | ||||
-rw-r--r-- | app/assets/javascripts/blob/new_blob.js.coffee | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/app/assets/javascripts/blob/edit_blob.js.coffee b/app/assets/javascripts/blob/edit_blob.js.coffee index 050888f9c15..f6bf836f19f 100644 --- a/app/assets/javascripts/blob/edit_blob.js.coffee +++ b/app/assets/javascripts/blob/edit_blob.js.coffee @@ -11,10 +11,10 @@ class @EditBlob if ace_mode editor.getSession().setMode "ace/mode/" + ace_mode - $(".js-commit-button").click -> - $("#file-content").val editor.getValue() - $(".file-editor form").submit() - return false + # Before a form submission, move the content from the Ace editor into the + # submitted textarea + $('form').submit -> + $("#file-content").val(editor.getValue()) editModePanes = $(".js-edit-mode-pane") editModeLinks = $(".js-edit-mode a") diff --git a/app/assets/javascripts/blob/new_blob.js.coffee b/app/assets/javascripts/blob/new_blob.js.coffee index 1f36a53f191..68c5e5195e3 100644 --- a/app/assets/javascripts/blob/new_blob.js.coffee +++ b/app/assets/javascripts/blob/new_blob.js.coffee @@ -11,10 +11,10 @@ class @NewBlob if ace_mode editor.getSession().setMode "ace/mode/" + ace_mode - $(".js-commit-button").click -> - $("#file-content").val editor.getValue() - $(".file-editor form").submit() - return false + # Before a form submission, move the content from the Ace editor into the + # submitted textarea + $('form').submit -> + $("#file-content").val(editor.getValue()) editor: -> return @editor |