summaryrefslogtreecommitdiffstats
path: root/web_src
diff options
context:
space:
mode:
authorTyrone Yeh <tyrone_yeh@draytek.com>2022-09-03 17:43:27 +0800
committerGitHub <noreply@github.com>2022-09-03 10:43:27 +0100
commite7b5bf0d96a1e860f1ab1414c413c5656f7efc70 (patch)
tree87afe927b68ef6582c8f692af19e32d50148ed42 /web_src
parentde7b87fbc238e0685c01cb26a580b3d21cee623a (diff)
downloadgitea-e7b5bf0d96a1e860f1ab1414c413c5656f7efc70.tar.gz
gitea-e7b5bf0d96a1e860f1ab1414c413c5656f7efc70.zip
Add down key check has tribute container (#21016)
Fixes an issue where users would not be able to select by pressing the down arrow when using @TAG above a message Bug videos: https://user-images.githubusercontent.com/1255041/188095999-c4ccde18-e53b-4251-8a14-d90c4042d768.mp4
Diffstat (limited to 'web_src')
-rw-r--r--web_src/js/features/comp/EasyMDE.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/web_src/js/features/comp/EasyMDE.js b/web_src/js/features/comp/EasyMDE.js
index 015fc35050..1f7fe45153 100644
--- a/web_src/js/features/comp/EasyMDE.js
+++ b/web_src/js/features/comp/EasyMDE.js
@@ -92,6 +92,18 @@ export async function createCommentEasyMDE(textarea, easyMDEOptions = {}) {
}
cm.execCommand('delCharBefore');
},
+ Up: (cm) => {
+ const tributeContainer = document.querySelector('.tribute-container');
+ if (!tributeContainer || tributeContainer.style.display === 'none') {
+ return cm.execCommand('goLineUp');
+ }
+ },
+ Down: (cm) => {
+ const tributeContainer = document.querySelector('.tribute-container');
+ if (!tributeContainer || tributeContainer.style.display === 'none') {
+ return cm.execCommand('goLineDown');
+ }
+ },
});
await attachTribute(inputField, {mentions: true, emoji: true});
attachEasyMDEToElements(easyMDE);