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

Merge pull request 'feat: use combo markdown editor for milestone description' (#5657) from gusted/forgejo-milestone-comboeditor into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5657
Reviewed-by: Otto <otto@codeberg.org>
This commit is contained in:
Gusted 2024-10-23 13:38:35 +00:00
commit 3a4bc7cdd1
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();