Skip to content

Commit e8bfe05

Browse files
committed
Replace easymde with textarea
WIP on the easymde replacement. Basically it rips out EasyMDE without much second thought. Issue commenting works but other things may be broken.
1 parent f44543a commit e8bfe05

32 files changed

+209
-667
lines changed

docs/content/page/index.en-us.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,6 @@ Windows, on architectures like amd64, i386, ARM, PowerPC, and others.
276276
* [DropzoneJS](http://www.dropzonejs.com/)
277277
* [Highlight](https://highlightjs.org/)
278278
* [Clipboard](https://zenorocha.github.io/clipboard.js/)
279-
* [CodeMirror](https://codemirror.net/)
280279
* [jQuery MiniColors](https://github.com/claviska/jquery-minicolors)
281280
* Database drivers:
282281
* [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)

docs/content/page/index.fr-fr.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ Le but de ce projet est de fournir de la manière la plus simple, la plus rapide
263263
* [DropzoneJS](http://www.dropzonejs.com/)
264264
* [Highlight](https://highlightjs.org/)
265265
* [Clipboard](https://zenorocha.github.io/clipboard.js/)
266-
* [CodeMirror](https://codemirror.net/)
267266
* [jQuery MiniColors](https://github.com/claviska/jquery-minicolors)
268267
* Connecteurs de base de données :
269268
* [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)

docs/content/page/index.zh-cn.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ Gitea的首要目标是创建一个极易安装,运行非常快速,安装和
5656
* [DropzoneJS](http://www.dropzonejs.com/)
5757
* [Highlight](https://highlightjs.org/)
5858
* [Clipboard](https://zenorocha.github.io/clipboard.js/)
59-
* [CodeMirror](https://codemirror.net/)
6059
* [jQuery MiniColors](https://github.com/claviska/jquery-minicolors)
6160
* 数据库驱动:
6261
* [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)

docs/content/page/index.zh-tw.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ Gitea 是從 [Gogs](http://gogs.io) Fork 出來的,請閱讀部落格文章 [G
275275
- [DropzoneJS](http://www.dropzonejs.com/)
276276
- [Highlight](https://highlightjs.org/)
277277
- [Clipboard](https://zenorocha.github.io/clipboard.js/)
278-
- [CodeMirror](https://codemirror.net/)
279278
- [jQuery MiniColors](https://github.com/claviska/jquery-minicolors)
280279
- 資料庫驅動程式:
281280
- [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)

package-lock.json

Lines changed: 5 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@
77
},
88
"dependencies": {
99
"@claviska/jquery-minicolors": "2.3.5",
10+
"@github/markdown-toolbar-element": "1.5.1",
1011
"@primer/octicons": "12.1.0",
1112
"add-asset-webpack-plugin": "2.0.1",
1213
"clipboard": "2.0.8",
13-
"codemirror": "5.60.0",
1414
"css-loader": "5.2.0",
1515
"css-minimizer-webpack-plugin": "1.3.0",
1616
"dropzone": "5.9.2",
17-
"easymde": "2.14.0",
1817
"esbuild-loader": "2.11.0",
1918
"escape-goat": "3.0.0",
2019
"fast-glob": "3.2.5",

routers/repo/commit.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ func FileHistory(ctx *context.Context) {
261261
func Diff(ctx *context.Context) {
262262
ctx.Data["PageIsDiff"] = true
263263
ctx.Data["RequireHighlightJS"] = true
264-
ctx.Data["RequireSimpleMDE"] = true
265264
ctx.Data["RequireTribute"] = true
266265

267266
userName := ctx.Repo.Owner.Name

routers/repo/compare.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,6 @@ func CompareDiff(ctx *context.Context) {
653653
ctx.Data["IsRepoToolbarCommits"] = true
654654
ctx.Data["IsDiffCompare"] = true
655655
ctx.Data["RequireTribute"] = true
656-
ctx.Data["RequireSimpleMDE"] = true
657656
ctx.Data["PullRequestWorkInProgressPrefixes"] = setting.Repository.PullRequest.WorkInProgressPrefixes
658657
setTemplateIfExists(ctx, pullRequestTemplateKey, nil, pullRequestTemplateCandidates)
659658
ctx.Data["IsAttachmentEnabled"] = setting.Attachment.Enabled

routers/repo/editor.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ func editFile(ctx *context.Context, isNewFile bool) {
6767
ctx.Data["PageIsEdit"] = true
6868
ctx.Data["IsNewFile"] = isNewFile
6969
ctx.Data["RequireHighlightJS"] = true
70-
ctx.Data["RequireSimpleMDE"] = true
7170
canCommit := renderCommitRights(ctx)
7271

7372
treePath := cleanUploadFileName(ctx.Repo.TreePath)
@@ -189,7 +188,6 @@ func editFilePost(ctx *context.Context, form forms.EditRepoFileForm, isNewFile b
189188
ctx.Data["PageHasPosted"] = true
190189
ctx.Data["IsNewFile"] = isNewFile
191190
ctx.Data["RequireHighlightJS"] = true
192-
ctx.Data["RequireSimpleMDE"] = true
193191
ctx.Data["TreePath"] = form.TreePath
194192
ctx.Data["TreeNames"] = treeNames
195193
ctx.Data["TreePaths"] = treePaths
@@ -533,7 +531,6 @@ func DeleteFilePost(ctx *context.Context) {
533531
func UploadFile(ctx *context.Context) {
534532
ctx.Data["PageIsUpload"] = true
535533
ctx.Data["RequireTribute"] = true
536-
ctx.Data["RequireSimpleMDE"] = true
537534
upload.AddUploadContext(ctx, "repo")
538535
canCommit := renderCommitRights(ctx)
539536
treePath := cleanUploadFileName(ctx.Repo.TreePath)
@@ -569,7 +566,6 @@ func UploadFilePost(ctx *context.Context) {
569566
form := web.GetForm(ctx).(*forms.UploadRepoFileForm)
570567
ctx.Data["PageIsUpload"] = true
571568
ctx.Data["RequireTribute"] = true
572-
ctx.Data["RequireSimpleMDE"] = true
573569
upload.AddUploadContext(ctx, "repo")
574570
canCommit := renderCommitRights(ctx)
575571

routers/repo/issue.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,6 @@ func NewIssue(ctx *context.Context) {
772772
ctx.Data["PageIsIssueList"] = true
773773
ctx.Data["NewIssueChooseTemplate"] = len(ctx.IssueTemplatesFromDefaultBranch()) > 0
774774
ctx.Data["RequireHighlightJS"] = true
775-
ctx.Data["RequireSimpleMDE"] = true
776775
ctx.Data["RequireTribute"] = true
777776
ctx.Data["PullRequestWorkInProgressPrefixes"] = setting.Repository.PullRequest.WorkInProgressPrefixes
778777
title := ctx.Query("title")
@@ -937,7 +936,6 @@ func NewIssuePost(ctx *context.Context) {
937936
ctx.Data["PageIsIssueList"] = true
938937
ctx.Data["NewIssueChooseTemplate"] = len(ctx.IssueTemplatesFromDefaultBranch()) > 0
939938
ctx.Data["RequireHighlightJS"] = true
940-
ctx.Data["RequireSimpleMDE"] = true
941939
ctx.Data["ReadOnly"] = false
942940
ctx.Data["PullRequestWorkInProgressPrefixes"] = setting.Repository.PullRequest.WorkInProgressPrefixes
943941
ctx.Data["IsAttachmentEnabled"] = setting.Attachment.Enabled
@@ -1107,7 +1105,6 @@ func ViewIssue(ctx *context.Context) {
11071105

11081106
ctx.Data["RequireHighlightJS"] = true
11091107
ctx.Data["RequireTribute"] = true
1110-
ctx.Data["RequireSimpleMDE"] = true
11111108
ctx.Data["IsProjectsEnabled"] = ctx.Repo.CanRead(models.UnitTypeProjects)
11121109
ctx.Data["IsAttachmentEnabled"] = setting.Attachment.Enabled
11131110
upload.AddUploadContext(ctx, "comment")

routers/repo/pull.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,6 @@ func ViewPullFiles(ctx *context.Context) {
674674
setCompareContext(ctx, baseCommit, commit, headTarget)
675675

676676
ctx.Data["RequireHighlightJS"] = true
677-
ctx.Data["RequireSimpleMDE"] = true
678677
ctx.Data["RequireTribute"] = true
679678
if ctx.Data["Assignees"], err = ctx.Repo.Repository.GetAssignees(); err != nil {
680679
ctx.ServerError("GetAssignees", err)

routers/repo/release.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ func LatestRelease(ctx *context.Context) {
212212
func NewRelease(ctx *context.Context) {
213213
ctx.Data["Title"] = ctx.Tr("repo.release.new_release")
214214
ctx.Data["PageIsReleaseList"] = true
215-
ctx.Data["RequireSimpleMDE"] = true
216215
ctx.Data["RequireTribute"] = true
217216
ctx.Data["tag_target"] = ctx.Repo.Repository.DefaultBranch
218217
if tagName := ctx.Query("tag"); len(tagName) > 0 {
@@ -246,7 +245,6 @@ func NewReleasePost(ctx *context.Context) {
246245
form := web.GetForm(ctx).(*forms.NewReleaseForm)
247246
ctx.Data["Title"] = ctx.Tr("repo.release.new_release")
248247
ctx.Data["PageIsReleaseList"] = true
249-
ctx.Data["RequireSimpleMDE"] = true
250248
ctx.Data["RequireTribute"] = true
251249

252250
if ctx.HasError() {
@@ -349,7 +347,6 @@ func EditRelease(ctx *context.Context) {
349347
ctx.Data["Title"] = ctx.Tr("repo.release.edit_release")
350348
ctx.Data["PageIsReleaseList"] = true
351349
ctx.Data["PageIsEditRelease"] = true
352-
ctx.Data["RequireSimpleMDE"] = true
353350
ctx.Data["RequireTribute"] = true
354351
ctx.Data["IsAttachmentEnabled"] = setting.Attachment.Enabled
355352
upload.AddUploadContext(ctx, "release")
@@ -388,7 +385,6 @@ func EditReleasePost(ctx *context.Context) {
388385
ctx.Data["Title"] = ctx.Tr("repo.release.edit_release")
389386
ctx.Data["PageIsReleaseList"] = true
390387
ctx.Data["PageIsEditRelease"] = true
391-
ctx.Data["RequireSimpleMDE"] = true
392388
ctx.Data["RequireTribute"] = true
393389

394390
tagName := ctx.Params("*")

routers/repo/wiki.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,6 @@ func UncycloRaw(ctx *context.Context) {
548548
func NewUncyclo(ctx *context.Context) {
549549
ctx.Data["Title"] = ctx.Tr("repo.wiki.new_page")
550550
ctx.Data["PageIsUncyclo"] = true
551-
ctx.Data["RequireSimpleMDE"] = true
552551

553552
if !ctx.Repo.Repository.HasUncyclo() {
554553
ctx.Data["title"] = "Home"
@@ -562,7 +561,6 @@ func NewUncycloPost(ctx *context.Context) {
562561
form := web.GetForm(ctx).(*forms.NewUncycloForm)
563562
ctx.Data["Title"] = ctx.Tr("repo.wiki.new_page")
564563
ctx.Data["PageIsUncyclo"] = true
565-
ctx.Data["RequireSimpleMDE"] = true
566564

567565
if ctx.HasError() {
568566
ctx.HTML(http.StatusOK, tplUncycloNew)
@@ -600,7 +598,6 @@ func NewUncycloPost(ctx *context.Context) {
600598
func EditUncyclo(ctx *context.Context) {
601599
ctx.Data["PageIsUncyclo"] = true
602600
ctx.Data["PageIsUncycloEdit"] = true
603-
ctx.Data["RequireSimpleMDE"] = true
604601

605602
if !ctx.Repo.Repository.HasUncyclo() {
606603
ctx.Redirect(ctx.Repo.RepoLink + "/wiki")
@@ -620,7 +617,6 @@ func EditUncycloPost(ctx *context.Context) {
620617
form := web.GetForm(ctx).(*forms.NewUncycloForm)
621618
ctx.Data["Title"] = ctx.Tr("repo.wiki.new_page")
622619
ctx.Data["PageIsUncyclo"] = true
623-
ctx.Data["RequireSimpleMDE"] = true
624620

625621
if ctx.HasError() {
626622
ctx.HTML(http.StatusOK, tplUncycloNew)

templates/base/footer.tmpl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@
1111
{{template "custom/body_outer_post" .}}
1212

1313
{{template "base/footer_content" .}}
14-
{{if .RequireSimpleMDE}}
15-
<script src="{{StaticUrlPrefix}}/js/easymde.js?v={{MD5 AppVer}}"></script>
16-
<script src="{{StaticUrlPrefix}}/vendor/plugins/codemirror/addon/mode/loadmode.js"></script>
17-
<script src="{{StaticUrlPrefix}}/vendor/plugins/codemirror/mode/meta.js"></script>
18-
<script>
19-
CodeMirror.modeURL = '{{StaticUrlPrefix}}/vendor/plugins/codemirror/mode/%N/%N.js';
20-
</script>
21-
{{end}}
2214

2315
<!-- Third-party libraries -->
2416
{{if .RequireU2F}}

templates/base/head.tmpl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
StaticUrlPrefix: '{{StaticUrlPrefix}}',
3434
UseServiceWorker: {{UseServiceWorker}},
3535
csrf: '{{.CsrfToken}}',
36-
HighlightJS: {{if .RequireHighlightJS}}true{{else}}false{{end}},
37-
SimpleMDE: {{if .RequireSimpleMDE}}true{{else}}false{{end}},
38-
Tribute: {{if .RequireTribute}}true{{else}}false{{end}},
3936
NotificationSettings: {
4037
MinTimeout: {{NotificationSettings.MinTimeout}},
4138
TimeoutStep: {{NotificationSettings.TimeoutStep}},
@@ -64,9 +61,6 @@
6461
</script>
6562
<link rel="icon" href="{{StaticUrlPrefix}}/img/logo.svg" type="image/svg+xml">
6663
<link rel="alternate icon" href="{{StaticUrlPrefix}}/img/favicon.png" type="image/png">
67-
{{if .RequireSimpleMDE}}
68-
<link rel="stylesheet" href="{{StaticUrlPrefix}}/css/easymde.css?v={{MD5 AppVer}}">
69-
{{end}}
7064
<link rel="stylesheet" href="{{StaticUrlPrefix}}/css/index.css?v={{MD5 AppVer}}">
7165
<noscript>
7266
<style>

templates/repo/editor/edit.tmpl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,16 @@
3434
<a class="item" data-tab="preview" data-url="{{.Repository.APIURL}}/markdown" data-context="{{.RepoLink}}/src/{{.BranchNameSubURL | EscapePound}}" data-preview-file-modes="{{.PreviewableFileModes}}" data-markdown-mode="gfm">{{svg "octicon-eye"}} {{.i18n.Tr "preview"}}</a>
3535
<a class="item" data-tab="diff" data-url="{{.RepoLink}}/_preview/{{.BranchName | EscapePound}}/{{.TreePath | EscapePound}}" data-context="{{.BranchLink}}">{{svg "octicon-diff"}} {{.i18n.Tr "repo.editor.preview_changes"}}</a>
3636
{{end}}
37+
{{template "shared/markdowntoolbar" .}}
3738
</div>
3839
<div class="ui bottom attached active tab segment" data-tab="write">
39-
<textarea id="edit_area" name="content" class="hide" data-id="repo-{{.Repository.Name}}-{{.TreePath}}"
40+
<textarea class="edit_area" name="content" class="hide"
41+
data-id="repo-{{.Repository.Name}}-{{.TreePath}}"
4042
data-url="{{.Repository.APIURL}}/markdown"
4143
data-context="{{.RepoLink}}"
4244
data-markdown-file-exts="{{.MarkdownFileExts}}"
43-
data-line-wrap-extensions="{{.LineWrapExtensions}}">
44-
{{.FileContent}}</textarea>
45+
data-line-wrap-extensions="{{.LineWrapExtensions}}"
46+
>{{.FileContent}}</textarea>
4547
<div class="editor-loading is-loading"></div>
4648
</div>
4749
<div class="ui bottom attached tab segment markdown" data-tab="preview">

templates/repo/issue/comment_tab.tmpl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
<div class="ui top tabular menu" data-write="write" data-preview="preview">
1+
<div class="ui top tabular menu df" data-write="write" data-preview="preview">
22
<a class="active item" data-tab="write">{{.i18n.Tr "write"}}</a>
33
<a class="item" data-tab="preview" data-url="{{.Repository.APIURL}}/markdown" data-context="{{.RepoLink}}">{{.i18n.Tr "preview"}}</a>
4+
{{template "shared/markdowntoolbar" .}}
45
</div>
56
<div class="field">
67
<div class="ui bottom active tab" data-tab="write">
7-
<textarea id="content" class="edit_area js-quick-submit" name="content" tabindex="4" data-id="issue-{{.RepoName}}" data-url="{{.Repository.APIURL}}/markdown" data-context="{{.Repo.RepoLink}}">
8-
{{- if .BodyQuery}}{{.BodyQuery}}{{else if .IssueTemplate}}{{.IssueTemplate}}{{else if .PullRequestTemplate}}{{.PullRequestTemplate}}{{else}}{{.content}}{{end -}}
9-
</textarea>
8+
<textarea class="edit_area" name="content" tabindex="4"
9+
data-id="issue-{{.RepoName}}"
10+
data-url="{{.Repository.APIURL}}/markdown"
11+
data-context="{{.Repo.RepoLink}}"
12+
>{{if .BodyQuery}}{{.BodyQuery}}{{else if .IssueTemplate}}{{.IssueTemplate}}{{else if .PullRequestTemplate}}{{.PullRequestTemplate}}{{else}}{{.content}}{{end}}</textarea>
1013
</div>
1114
<div class="ui bottom tab markdown" data-tab="preview">
1215
{{.i18n.Tr "loading"}}

templates/repo/wiki/new.tmpl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,15 @@
1919
<div class="ui top attached tabular menu previewtabs" data-write="write" data-preview="preview">
2020
<a class="active item" data-tab="write">{{.i18n.Tr "write"}}</a>
2121
<a class="item" data-tab="preview" data-url="{{$.Repository.APIURL}}/markdown" data-context="{{$.RepoLink}}">{{$.i18n.Tr "preview"}}</a>
22+
{{template "shared/markdowntoolbar" .}}
2223
</div>
2324
<div class="field content" data-loading="{{.i18n.Tr "loading"}}">
2425
<div class="ui bottom active tab" data-tab="write">
25-
<textarea class="js-quick-submit" id="edit_area" name="content" data-id="wiki-{{.title}}" data-url="{{.Repository.APIURL}}/markdown" data-context="{{.RepoLink}}" required>{{if .PageIsUncycloEdit}}{{.content}}{{else}}{{.i18n.Tr "repo.wiki.welcome"}}{{end}}</textarea>
26+
<textarea class="edit_area" name="content" required
27+
data-id="wiki-{{.title}}"
28+
data-url="{{.Repository.APIURL}}/markdown"
29+
data-context="{{.RepoLink}}" required
30+
>{{if .PageIsUncycloEdit}}{{.content}}{{else}}{{.i18n.Tr "repo.wiki.welcome"}}{{end}}</textarea>
2631
</div>
2732
</div>
2833
<div class="field">

templates/shared/markdowntoolbar.tmpl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<markdown-toolbar class="markdown-toolbar">
2+
<div class="markdown-toolbar-buttons">
3+
<md-header class="markdown-toolbar-button">{{svg "octicon-heading"}}</md-header>
4+
<md-bold class="markdown-toolbar-button">{{svg "octicon-bold"}}</md-bold>
5+
<md-italic class="markdown-toolbar-button">{{svg "octicon-italic"}}</md-italic>
6+
</div>
7+
<div class="markdown-toolbar-buttons">
8+
<md-quote class="markdown-toolbar-button">{{svg "octicon-quote"}}</md-quote>
9+
<md-code class="markdown-toolbar-button">{{svg "octicon-code"}}</md-code>
10+
<md-link class="markdown-toolbar-button">{{svg "octicon-link"}}</md-link>
11+
</div>
12+
<div class="markdown-toolbar-buttons">
13+
<md-unordered-list class="markdown-toolbar-button">{{svg "octicon-list-unordered"}}</md-unordered-list>
14+
<md-ordered-list class="markdown-toolbar-button">{{svg "octicon-list-ordered"}}</md-ordered-list>
15+
<md-task-list class="markdown-toolbar-button">{{svg "octicon-tasklist"}}</md-task-list>
16+
</div>
17+
<div class="markdown-toolbar-buttons" class="p-2">
18+
<md-mention class="markdown-toolbar-button">{{svg "octicon-mention"}}</md-mention>
19+
<md-ref class="markdown-toolbar-button">{{svg "octicon-cross-reference"}}</md-ref>
20+
</div>
21+
</markdown-toolbar>

web_src/js/easymde.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)