mirror of https://github.com/go-gitea/gitea.git
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 <art27@cantab.net> * apply suggestion Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
parent
a83fb3a83a
commit
e078d08ecd
|
@ -1157,11 +1157,9 @@ async function initRepository() {
|
||||||
// Change status
|
// Change status
|
||||||
const $statusButton = $('#status-button');
|
const $statusButton = $('#status-button');
|
||||||
$('#comment-form textarea').on('keyup', function () {
|
$('#comment-form textarea').on('keyup', function () {
|
||||||
if ($(this).val().length === 0) {
|
const $simplemde = $(this).data('simplemde');
|
||||||
$statusButton.text($statusButton.data('status'));
|
const value = ($simplemde && $simplemde.value()) ? $simplemde.value() : $(this).val();
|
||||||
} else {
|
$statusButton.text($statusButton.data(value.length === 0 ? 'status' : 'status-and-comment'));
|
||||||
$statusButton.text($statusButton.data('status-and-comment'));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
$statusButton.on('click', () => {
|
$statusButton.on('click', () => {
|
||||||
$('#status').val($statusButton.data('status-val'));
|
$('#status').val($statusButton.data('status-val'));
|
||||||
|
@ -1670,6 +1668,8 @@ function setCommentSimpleMDE($editArea) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
attachTribute(simplemde.codemirror.getInputField(), {mentions: true, emoji: true});
|
attachTribute(simplemde.codemirror.getInputField(), {mentions: true, emoji: true});
|
||||||
|
$editArea.data('simplemde', simplemde);
|
||||||
|
$(simplemde.codemirror.getInputField()).data('simplemde', simplemde);
|
||||||
return simplemde;
|
return simplemde;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue