From 997deecbfa77fe00d8260da2921073a0565dc735 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Sat, 5 Mar 2022 04:57:26 +0800 Subject: [PATCH 1/3] Fix the editor height in review box (#19003) Fix the height problem in https://github.com/go-gitea/gitea/pull/18862#issuecomment-1059329539 I have tested this fix. # Screenshots ### Min-height image ### Max-height image --- web_src/js/features/repo-issue.js | 3 ++- web_src/less/_review.less | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/web_src/js/features/repo-issue.js b/web_src/js/features/repo-issue.js index 4f791c7704a6..43ce8a9f1b1f 100644 --- a/web_src/js/features/repo-issue.js +++ b/web_src/js/features/repo-issue.js @@ -462,7 +462,8 @@ export function initRepoPullRequestReview() { (async () => { // the editor's height is too large in some cases, and the panel cannot be scrolled with page now because there is `.repository .diff-detail-box.sticky { position: sticky; }` // the temporary solution is to make the editor's height smaller (about 4 lines). GitHub also only show 4 lines for default. We can improve the UI (including Dropzone area) in future - await createCommentEasyMDE($reviewBox.find('textarea'), {minHeight: '80px', maxHeight: 'calc(100vh - 360px)'}); + // EasyMDE's options can not handle minHeight & maxHeight together correctly, we have to set max-height for .CodeMirror-scroll in CSS. + await createCommentEasyMDE($reviewBox.find('textarea'), {minHeight: '80px'}); initCompImagePaste($reviewBox); })(); } diff --git a/web_src/less/_review.less b/web_src/less/_review.less index 1070ad7ddedc..ac9f57cfbedf 100644 --- a/web_src/less/_review.less +++ b/web_src/less/_review.less @@ -197,6 +197,13 @@ a.blob-excerpt:hover { color: #fff; } +// See the comment of createCommentEasyMDE() for the review editor +// EasyMDE's options can not handle minHeight & maxHeight together correctly, we have to set minHeight in JS code +#review-box .CodeMirror-scroll { + min-height: 80px; + max-height: calc(100vh - 360px); +} + @media @mediaSm { #review-box > .menu { > .ui.segment { From 814750e647722ecf5ed2938844744bed139fffd5 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sat, 5 Mar 2022 04:59:29 +0800 Subject: [PATCH 2/3] Fix update hint bug (#18996) --- templates/admin/dashboard.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/admin/dashboard.tmpl b/templates/admin/dashboard.tmpl index d9e056973aee..5a4b82f1b963 100644 --- a/templates/admin/dashboard.tmpl +++ b/templates/admin/dashboard.tmpl @@ -5,7 +5,7 @@ {{template "base/alert" .}} {{if .NeedUpdate}}
-

{{.i18n.Tr "admin.dashboard.new_version_hint" (.RemoteVersion | Str2html) (AppVer | Str2html)}}

+

{{(.i18n.Tr "admin.dashboard.new_version_hint" .RemoteVersion AppVer) | Str2html}}

{{end}}

From 3e28fa72cedc559e0dc3396d0676a5d1dab12624 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Sun, 6 Mar 2022 01:53:34 +0800 Subject: [PATCH 3/3] Fix EasyMDE error when input Enter (#19004) Co-authored-by: Lunny Xiao --- web_src/js/features/comp/EasyMDE.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web_src/js/features/comp/EasyMDE.js b/web_src/js/features/comp/EasyMDE.js index af28c0b0ee43..0327a1e0238c 100644 --- a/web_src/js/features/comp/EasyMDE.js +++ b/web_src/js/features/comp/EasyMDE.js @@ -74,10 +74,10 @@ export async function createCommentEasyMDE(textarea, easyMDEOptions = {}) { const inputField = easyMDE.codemirror.getInputField(); inputField.classList.add('js-quick-submit'); easyMDE.codemirror.setOption('extraKeys', { - Enter: () => { + Enter: (cm) => { const tributeContainer = document.querySelector('.tribute-container'); if (!tributeContainer || tributeContainer.style.display === 'none') { - return window.CodeMirror.Pass; + cm.execCommand('newlineAndIndent'); } }, Backspace: (cm) => {