1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-21 08:31:27 -05:00

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"}}">
</div>
<div class="field">
<label>{{ctx.Locale.Tr "repo.milestones.desc"}}</label>
<textarea name="content">{{.content}}</textarea>
{{template "shared/combomarkdowneditor" (dict
"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 class="divider"></div>
<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/wiki?action=_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) {

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 {initRepositorySearch} from './features/repo-search.js';
import {initColorPickers} from './features/colorpicker.js';
import {initRepoMilestoneEditor} from './features/repo-milestone.js';
// Init Gitea's Fomantic settings
initGiteaFomantic();
@ -175,6 +176,7 @@ onDomReady(() => {
initRepoContributors();
initRepoCodeFrequency();
initRepoRecentCommits();
initRepoMilestoneEditor();
initCommitStatuses();
initCaptcha();