summaryrefslogtreecommitdiffstats
path: root/web_src
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-05-05 23:46:04 +0100
committerGitHub <noreply@github.com>2021-05-05 23:46:04 +0100
commite071b53686572c6a31c17655fbfa0035945cfb59 (patch)
tree9edd877159d2c257d2d4659755104f62ed1930b8 /web_src
parentda41714c50b4354a2674946b84403eae03f47ed5 (diff)
downloadgitea-e071b53686572c6a31c17655fbfa0035945cfb59.tar.gz
gitea-e071b53686572c6a31c17655fbfa0035945cfb59.zip
Fix close button change on delete in simplemde area (#15737)
* Fix close button change on delete in simplemde area Fix issue with close button changing when deleting in the simplemde textarea. Signed-off-by: Andrew Thornton <art27@cantab.net> * apply suggestion Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'web_src')
-rw-r--r--web_src/js/index.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/web_src/js/index.js b/web_src/js/index.js
index 89cc0aa11c..2fce21b8d3 100644
--- a/web_src/js/index.js
+++ b/web_src/js/index.js
@@ -1184,11 +1184,9 @@ async function initRepository() {
// Change status
const $statusButton = $('#status-button');
$('#comment-form textarea').on('keyup', function () {
- if ($(this).val().length === 0) {
- $statusButton.text($statusButton.data('status'));
- } else {
- $statusButton.text($statusButton.data('status-and-comment'));
- }
+ const $simplemde = $(this).data('simplemde');
+ const value = ($simplemde && $simplemde.value()) ? $simplemde.value() : $(this).val();
+ $statusButton.text($statusButton.data(value.length === 0 ? 'status' : 'status-and-comment'));
});
$statusButton.on('click', () => {
$('#status').val($statusButton.data('status-val'));
@@ -1698,6 +1696,8 @@ function setCommentSimpleMDE($editArea) {
}
});
attachTribute(simplemde.codemirror.getInputField(), {mentions: true, emoji: true});
+ $editArea.data('simplemde', simplemde);
+ $(simplemde.codemirror.getInputField()).data('simplemde', simplemde);
return simplemde;
}