mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-25 11:16:11 +01: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:
parent
2626f4ee3b
commit
4c6587d6a0
|
@ -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">
|
||||
|
|
|
@ -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) {
|
||||
|
|
9
web_src/js/features/repo-milestone.js
Normal file
9
web_src/js/features/repo-milestone.js
Normal 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);
|
||||
}
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue