diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2022-01-05 20:17:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-05 13:17:25 +0100 |
commit | a38ba634a4da15fbb2d1b6ac6742cf01c1503ea4 (patch) | |
tree | 9bf892ae0e481e2d3b36b1eaf9a5273152c3c628 /routers/web/repo | |
parent | 0572c78938d3d8287f81f53effc7ffaacd75d3e7 (diff) | |
download | gitea-a38ba634a4da15fbb2d1b6ac6742cf01c1503ea4.tar.gz gitea-a38ba634a4da15fbb2d1b6ac6742cf01c1503ea4.zip |
Load EasyMDE/CodeMirror dynamically, remove RequireEasyMDE (#18069)
This PR makes frontend load EasyMDE/CodeMirror dynamically, and removes `RequireEasyMDE`.
Diffstat (limited to 'routers/web/repo')
-rw-r--r-- | routers/web/repo/commit.go | 1 | ||||
-rw-r--r-- | routers/web/repo/compare.go | 1 | ||||
-rw-r--r-- | routers/web/repo/editor.go | 4 | ||||
-rw-r--r-- | routers/web/repo/issue.go | 3 | ||||
-rw-r--r-- | routers/web/repo/pull.go | 2 | ||||
-rw-r--r-- | routers/web/repo/release.go | 4 | ||||
-rw-r--r-- | routers/web/repo/wiki.go | 4 |
7 files changed, 0 insertions, 19 deletions
diff --git a/routers/web/repo/commit.go b/routers/web/repo/commit.go index e012bc24d2..304f76158c 100644 --- a/routers/web/repo/commit.go +++ b/routers/web/repo/commit.go @@ -254,7 +254,6 @@ func FileHistory(ctx *context.Context) { func Diff(ctx *context.Context) { ctx.Data["PageIsDiff"] = true ctx.Data["RequireHighlightJS"] = true - ctx.Data["RequireEasyMDE"] = true ctx.Data["RequireTribute"] = true userName := ctx.Repo.Owner.Name diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go index 3b016b15fb..3b07c35cb0 100644 --- a/routers/web/repo/compare.go +++ b/routers/web/repo/compare.go @@ -764,7 +764,6 @@ func CompareDiff(ctx *context.Context) { ctx.Data["IsRepoToolbarCommits"] = true ctx.Data["IsDiffCompare"] = true ctx.Data["RequireTribute"] = true - ctx.Data["RequireEasyMDE"] = true setTemplateIfExists(ctx, pullRequestTemplateKey, nil, pullRequestTemplateCandidates) ctx.Data["IsAttachmentEnabled"] = setting.Attachment.Enabled upload.AddUploadContext(ctx, "comment") diff --git a/routers/web/repo/editor.go b/routers/web/repo/editor.go index 12098ddc69..1a7edb7bb4 100644 --- a/routers/web/repo/editor.go +++ b/routers/web/repo/editor.go @@ -69,7 +69,6 @@ func editFile(ctx *context.Context, isNewFile bool) { ctx.Data["PageIsEdit"] = true ctx.Data["IsNewFile"] = isNewFile ctx.Data["RequireHighlightJS"] = true - ctx.Data["RequireEasyMDE"] = true canCommit := renderCommitRights(ctx) treePath := cleanUploadFileName(ctx.Repo.TreePath) @@ -200,7 +199,6 @@ func editFilePost(ctx *context.Context, form forms.EditRepoFileForm, isNewFile b ctx.Data["PageHasPosted"] = true ctx.Data["IsNewFile"] = isNewFile ctx.Data["RequireHighlightJS"] = true - ctx.Data["RequireEasyMDE"] = true ctx.Data["TreePath"] = form.TreePath ctx.Data["TreeNames"] = treeNames ctx.Data["TreePaths"] = treePaths @@ -544,7 +542,6 @@ func DeleteFilePost(ctx *context.Context) { func UploadFile(ctx *context.Context) { ctx.Data["PageIsUpload"] = true ctx.Data["RequireTribute"] = true - ctx.Data["RequireEasyMDE"] = true upload.AddUploadContext(ctx, "repo") canCommit := renderCommitRights(ctx) treePath := cleanUploadFileName(ctx.Repo.TreePath) @@ -580,7 +577,6 @@ func UploadFilePost(ctx *context.Context) { form := web.GetForm(ctx).(*forms.UploadRepoFileForm) ctx.Data["PageIsUpload"] = true ctx.Data["RequireTribute"] = true - ctx.Data["RequireEasyMDE"] = true upload.AddUploadContext(ctx, "repo") canCommit := renderCommitRights(ctx) diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index ea16de3950..a28b37c580 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -789,7 +789,6 @@ func NewIssue(ctx *context.Context) { ctx.Data["PageIsIssueList"] = true ctx.Data["NewIssueChooseTemplate"] = len(ctx.IssueTemplatesFromDefaultBranch()) > 0 ctx.Data["RequireHighlightJS"] = true - ctx.Data["RequireEasyMDE"] = true ctx.Data["RequireTribute"] = true ctx.Data["PullRequestWorkInProgressPrefixes"] = setting.Repository.PullRequest.WorkInProgressPrefixes title := ctx.FormString("title") @@ -962,7 +961,6 @@ func NewIssuePost(ctx *context.Context) { ctx.Data["PageIsIssueList"] = true ctx.Data["NewIssueChooseTemplate"] = len(ctx.IssueTemplatesFromDefaultBranch()) > 0 ctx.Data["RequireHighlightJS"] = true - ctx.Data["RequireEasyMDE"] = true ctx.Data["PullRequestWorkInProgressPrefixes"] = setting.Repository.PullRequest.WorkInProgressPrefixes ctx.Data["IsAttachmentEnabled"] = setting.Attachment.Enabled upload.AddUploadContext(ctx, "comment") @@ -1147,7 +1145,6 @@ func ViewIssue(ctx *context.Context) { ctx.Data["RequireHighlightJS"] = true ctx.Data["RequireTribute"] = true - ctx.Data["RequireEasyMDE"] = true ctx.Data["IsProjectsEnabled"] = ctx.Repo.CanRead(unit.TypeProjects) ctx.Data["IsAttachmentEnabled"] = setting.Attachment.Enabled upload.AddUploadContext(ctx, "comment") diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go index b40eb1ea17..984954b704 100644 --- a/routers/web/repo/pull.go +++ b/routers/web/repo/pull.go @@ -738,7 +738,6 @@ func ViewPullFiles(ctx *context.Context) { setCompareContext(ctx, baseCommit, commit, ctx.Repo.Owner.Name, ctx.Repo.Repository.Name) ctx.Data["RequireHighlightJS"] = true - ctx.Data["RequireEasyMDE"] = true ctx.Data["RequireTribute"] = true if ctx.Data["Assignees"], err = models.GetRepoAssignees(ctx.Repo.Repository); err != nil { ctx.ServerError("GetAssignees", err) @@ -1098,7 +1097,6 @@ func CompareAndPullRequestPost(ctx *context.Context) { ctx.Data["IsDiffCompare"] = true ctx.Data["IsRepoToolbarCommits"] = true ctx.Data["RequireTribute"] = true - ctx.Data["RequireEasyMDE"] = true ctx.Data["RequireHighlightJS"] = true ctx.Data["PullRequestWorkInProgressPrefixes"] = setting.Repository.PullRequest.WorkInProgressPrefixes ctx.Data["IsAttachmentEnabled"] = setting.Attachment.Enabled diff --git a/routers/web/repo/release.go b/routers/web/repo/release.go index 8478cb44ae..f2ab8b85f2 100644 --- a/routers/web/repo/release.go +++ b/routers/web/repo/release.go @@ -262,7 +262,6 @@ func LatestRelease(ctx *context.Context) { func NewRelease(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.release.new_release") ctx.Data["PageIsReleaseList"] = true - ctx.Data["RequireEasyMDE"] = true ctx.Data["RequireTribute"] = true ctx.Data["tag_target"] = ctx.Repo.Repository.DefaultBranch if tagName := ctx.FormString("tag"); len(tagName) > 0 { @@ -296,7 +295,6 @@ func NewReleasePost(ctx *context.Context) { form := web.GetForm(ctx).(*forms.NewReleaseForm) ctx.Data["Title"] = ctx.Tr("repo.release.new_release") ctx.Data["PageIsReleaseList"] = true - ctx.Data["RequireEasyMDE"] = true ctx.Data["RequireTribute"] = true if ctx.HasError() { @@ -415,7 +413,6 @@ func EditRelease(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.release.edit_release") ctx.Data["PageIsReleaseList"] = true ctx.Data["PageIsEditRelease"] = true - ctx.Data["RequireEasyMDE"] = true ctx.Data["RequireTribute"] = true ctx.Data["IsAttachmentEnabled"] = setting.Attachment.Enabled upload.AddUploadContext(ctx, "release") @@ -454,7 +451,6 @@ func EditReleasePost(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.release.edit_release") ctx.Data["PageIsReleaseList"] = true ctx.Data["PageIsEditRelease"] = true - ctx.Data["RequireEasyMDE"] = true ctx.Data["RequireTribute"] = true tagName := ctx.Params("*") diff --git a/routers/web/repo/wiki.go b/routers/web/repo/wiki.go index 7bce7cf11c..d449800b84 100644 --- a/routers/web/repo/wiki.go +++ b/routers/web/repo/wiki.go @@ -622,7 +622,6 @@ func WikiRaw(ctx *context.Context) { func NewWiki(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.wiki.new_page") ctx.Data["PageIsWiki"] = true - ctx.Data["RequireEasyMDE"] = true if !ctx.Repo.Repository.HasWiki() { ctx.Data["title"] = "Home" @@ -639,7 +638,6 @@ func NewWikiPost(ctx *context.Context) { form := web.GetForm(ctx).(*forms.NewWikiForm) ctx.Data["Title"] = ctx.Tr("repo.wiki.new_page") ctx.Data["PageIsWiki"] = true - ctx.Data["RequireEasyMDE"] = true if ctx.HasError() { ctx.HTML(http.StatusOK, tplWikiNew) @@ -677,7 +675,6 @@ func NewWikiPost(ctx *context.Context) { func EditWiki(ctx *context.Context) { ctx.Data["PageIsWiki"] = true ctx.Data["PageIsWikiEdit"] = true - ctx.Data["RequireEasyMDE"] = true if !ctx.Repo.Repository.HasWiki() { ctx.Redirect(ctx.Repo.RepoLink + "/wiki") @@ -697,7 +694,6 @@ func EditWikiPost(ctx *context.Context) { form := web.GetForm(ctx).(*forms.NewWikiForm) ctx.Data["Title"] = ctx.Tr("repo.wiki.new_page") ctx.Data["PageIsWiki"] = true - ctx.Data["RequireEasyMDE"] = true if ctx.HasError() { ctx.HTML(http.StatusOK, tplWikiNew) |