feat: use combo markdown editor for milestone description

- Use the combo markdown editor for the milestone description. The
milestone description is rendered in markdown, so it makes sense to use
a 'markdown-aware' editor. This also includes the option to use
monospace font.
- Resolves #5649
This commit is contained in:
Gusted 2024-10-22 19:58:44 +02:00
parent 2626f4ee3b
commit 4c6587d6a0
4 changed files with 22 additions and 2 deletions

View file

@ -35,8 +35,15 @@
<input type="date" id="deadline" name="deadline" value="{{.deadline}}" placeholder="{{ctx.Locale.Tr "repo.issues.due_date_form"}}"> <input type="date" id="deadline" name="deadline" value="{{.deadline}}" placeholder="{{ctx.Locale.Tr "repo.issues.due_date_form"}}">
</div> </div>
<div class="field"> <div class="field">
<label>{{ctx.Locale.Tr "repo.milestones.desc"}}</label> {{template "shared/combomarkdowneditor" (dict
<textarea name="content">{{.content}}</textarea> "MarkdownPreviewUrl" (print .Repository.Link "/markup")
"MarkdownPreviewContext" .RepoLink
"TextareaName" "content"
"TextareaPlaceholder" (ctx.Locale.Tr "repo.milestones.desc")
"TextareaAriaLabel" (ctx.Locale.Tr "repo.milestones.desc")
"TextareaContent" .content
"EasyMDE" true
)}}
</div> </div>
<div class="divider"></div> <div class="divider"></div>
<div class="tw-text-right"> <div class="tw-text-right">

View file

@ -14,6 +14,8 @@ func TestEasyMDESwitch(t *testing.T) {
testEasyMDESwitch(t, session, "user2/glob/issues/new", false) testEasyMDESwitch(t, session, "user2/glob/issues/new", false)
testEasyMDESwitch(t, session, "user2/glob/wiki?action=_new", true) testEasyMDESwitch(t, session, "user2/glob/wiki?action=_new", true)
testEasyMDESwitch(t, session, "user2/glob/releases/new", true) testEasyMDESwitch(t, session, "user2/glob/releases/new", true)
testEasyMDESwitch(t, session, "user2/glob/milestones/new", true)
testEasyMDESwitch(t, session, "user2/repo1/milestones/1/edit", true)
} }
func testEasyMDESwitch(t *testing.T, session *TestSession, url string, expected bool) { func testEasyMDESwitch(t *testing.T, session *TestSession, url string, expected bool) {

View file

@ -0,0 +1,9 @@
import {initComboMarkdownEditor} from './comp/ComboMarkdownEditor.js';
export function initRepoMilestoneEditor() {
const editor = document.querySelector('.page-content.repository.milestone .combo-markdown-editor');
if (!editor) {
return;
}
initComboMarkdownEditor(editor);
}

View file

@ -86,6 +86,7 @@ import {initRepoDiffCommitBranchesAndTags} from './features/repo-diff-commit.js'
import {initDirAuto} from './modules/dirauto.js'; import {initDirAuto} from './modules/dirauto.js';
import {initRepositorySearch} from './features/repo-search.js'; import {initRepositorySearch} from './features/repo-search.js';
import {initColorPickers} from './features/colorpicker.js'; import {initColorPickers} from './features/colorpicker.js';
import {initRepoMilestoneEditor} from './features/repo-milestone.js';
// Init Gitea's Fomantic settings // Init Gitea's Fomantic settings
initGiteaFomantic(); initGiteaFomantic();
@ -175,6 +176,7 @@ onDomReady(() => {
initRepoContributors(); initRepoContributors();
initRepoCodeFrequency(); initRepoCodeFrequency();
initRepoRecentCommits(); initRepoRecentCommits();
initRepoMilestoneEditor();
initCommitStatuses(); initCommitStatuses();
initCaptcha(); initCaptcha();