Skip to content

Commit

Permalink
Fix close button change on delete in simplemde area (#15737) (#15747)
Browse files Browse the repository at this point in the history
Backport #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 <[email protected]>

* apply suggestion

Co-authored-by: 6543 <[email protected]>

Co-authored-by: 6543 <[email protected]>
  • Loading branch information
zeripath and 6543 authored May 6, 2021
1 parent a83fb3a commit e078d08
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions web_src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1157,11 +1157,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'));
Expand Down Expand Up @@ -1670,6 +1668,8 @@ function setCommentSimpleMDE($editArea) {
}
});
attachTribute(simplemde.codemirror.getInputField(), {mentions: true, emoji: true});
$editArea.data('simplemde', simplemde);
$(simplemde.codemirror.getInputField()).data('simplemde', simplemde);
return simplemde;
}

Expand Down

0 comments on commit e078d08

Please sign in to comment.