1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-12-22 17:34:03 +03:00

Fix EasyMDE error when input Enter (#19004)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
wxiaoguang 2022-03-06 01:53:34 +08:00 committed by GitHub
parent 814750e647
commit 3e28fa72ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,10 +74,10 @@ export async function createCommentEasyMDE(textarea, easyMDEOptions = {}) {
const inputField = easyMDE.codemirror.getInputField(); const inputField = easyMDE.codemirror.getInputField();
inputField.classList.add('js-quick-submit'); inputField.classList.add('js-quick-submit');
easyMDE.codemirror.setOption('extraKeys', { easyMDE.codemirror.setOption('extraKeys', {
Enter: () => { Enter: (cm) => {
const tributeContainer = document.querySelector('.tribute-container'); const tributeContainer = document.querySelector('.tribute-container');
if (!tributeContainer || tributeContainer.style.display === 'none') { if (!tributeContainer || tributeContainer.style.display === 'none') {
return window.CodeMirror.Pass; cm.execCommand('newlineAndIndent');
} }
}, },
Backspace: (cm) => { Backspace: (cm) => {