Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Replace easymde with textarea #15394

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/content/page/index.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ Windows, on architectures like amd64, i386, ARM, PowerPC, and others.
* [DropzoneJS](http://www.dropzonejs.com/)
* [Highlight](https://highlightjs.org/)
* [Clipboard](https://zenorocha.github.io/clipboard.js/)
* [CodeMirror](https://codemirror.net/)
* [jQuery MiniColors](https://github.com/claviska/jquery-minicolors)
* Database drivers:
* [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)
Expand Down
1 change: 0 additions & 1 deletion docs/content/page/index.fr-fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ Le but de ce projet est de fournir de la manière la plus simple, la plus rapide
* [DropzoneJS](http://www.dropzonejs.com/)
* [Highlight](https://highlightjs.org/)
* [Clipboard](https://zenorocha.github.io/clipboard.js/)
* [CodeMirror](https://codemirror.net/)
* [jQuery MiniColors](https://github.com/claviska/jquery-minicolors)
* Connecteurs de base de données :
* [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)
Expand Down
1 change: 0 additions & 1 deletion docs/content/page/index.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ Gitea的首要目标是创建一个极易安装,运行非常快速,安装和
* [DropzoneJS](http://www.dropzonejs.com/)
* [Highlight](https://highlightjs.org/)
* [Clipboard](https://zenorocha.github.io/clipboard.js/)
* [CodeMirror](https://codemirror.net/)
* [jQuery MiniColors](https://github.com/claviska/jquery-minicolors)
* 数据库驱动:
* [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)
Expand Down
1 change: 0 additions & 1 deletion docs/content/page/index.zh-tw.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ Gitea 是從 [Gogs](http://gogs.io) Fork 出來的,請閱讀部落格文章 [G
- [DropzoneJS](http://www.dropzonejs.com/)
- [Highlight](https://highlightjs.org/)
- [Clipboard](https://zenorocha.github.io/clipboard.js/)
- [CodeMirror](https://codemirror.net/)
- [jQuery MiniColors](https://github.com/claviska/jquery-minicolors)
- 資料庫驅動程式:
- [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)
Expand Down
38 changes: 5 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
},
"dependencies": {
"@claviska/jquery-minicolors": "2.3.5",
"@github/markdown-toolbar-element": "1.5.1",
"@primer/octicons": "12.1.0",
"add-asset-webpack-plugin": "2.0.1",
"clipboard": "2.0.8",
"codemirror": "5.60.0",
"css-loader": "5.2.0",
"css-minimizer-webpack-plugin": "1.3.0",
"dropzone": "5.9.2",
"easymde": "2.14.0",
"esbuild-loader": "2.11.0",
"escape-goat": "3.0.0",
"fast-glob": "3.2.5",
Expand Down
1 change: 0 additions & 1 deletion routers/repo/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ func FileHistory(ctx *context.Context) {
func Diff(ctx *context.Context) {
ctx.Data["PageIsDiff"] = true
ctx.Data["RequireHighlightJS"] = true
ctx.Data["RequireSimpleMDE"] = true
ctx.Data["RequireTribute"] = true

userName := ctx.Repo.Owner.Name
Expand Down
1 change: 0 additions & 1 deletion routers/repo/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,6 @@ func CompareDiff(ctx *context.Context) {
ctx.Data["IsRepoToolbarCommits"] = true
ctx.Data["IsDiffCompare"] = true
ctx.Data["RequireTribute"] = true
ctx.Data["RequireSimpleMDE"] = true
ctx.Data["PullRequestWorkInProgressPrefixes"] = setting.Repository.PullRequest.WorkInProgressPrefixes
setTemplateIfExists(ctx, pullRequestTemplateKey, nil, pullRequestTemplateCandidates)
ctx.Data["IsAttachmentEnabled"] = setting.Attachment.Enabled
Expand Down
4 changes: 0 additions & 4 deletions routers/repo/editor.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ func editFile(ctx *context.Context, isNewFile bool) {
ctx.Data["PageIsEdit"] = true
ctx.Data["IsNewFile"] = isNewFile
ctx.Data["RequireHighlightJS"] = true
ctx.Data["RequireSimpleMDE"] = true
canCommit := renderCommitRights(ctx)

treePath := cleanUploadFileName(ctx.Repo.TreePath)
Expand Down Expand Up @@ -189,7 +188,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["RequireSimpleMDE"] = true
ctx.Data["TreePath"] = form.TreePath
ctx.Data["TreeNames"] = treeNames
ctx.Data["TreePaths"] = treePaths
Expand Down Expand Up @@ -533,7 +531,6 @@ func DeleteFilePost(ctx *context.Context) {
func UploadFile(ctx *context.Context) {
ctx.Data["PageIsUpload"] = true
ctx.Data["RequireTribute"] = true
ctx.Data["RequireSimpleMDE"] = true
upload.AddUploadContext(ctx, "repo")
canCommit := renderCommitRights(ctx)
treePath := cleanUploadFileName(ctx.Repo.TreePath)
Expand Down Expand Up @@ -569,7 +566,6 @@ func UploadFilePost(ctx *context.Context) {
form := web.GetForm(ctx).(*forms.UploadRepoFileForm)
ctx.Data["PageIsUpload"] = true
ctx.Data["RequireTribute"] = true
ctx.Data["RequireSimpleMDE"] = true
upload.AddUploadContext(ctx, "repo")
canCommit := renderCommitRights(ctx)

Expand Down
3 changes: 0 additions & 3 deletions routers/repo/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,6 @@ func NewIssue(ctx *context.Context) {
ctx.Data["PageIsIssueList"] = true
ctx.Data["NewIssueChooseTemplate"] = len(ctx.IssueTemplatesFromDefaultBranch()) > 0
ctx.Data["RequireHighlightJS"] = true
ctx.Data["RequireSimpleMDE"] = true
ctx.Data["RequireTribute"] = true
ctx.Data["PullRequestWorkInProgressPrefixes"] = setting.Repository.PullRequest.WorkInProgressPrefixes
title := ctx.Query("title")
Expand Down Expand Up @@ -937,7 +936,6 @@ func NewIssuePost(ctx *context.Context) {
ctx.Data["PageIsIssueList"] = true
ctx.Data["NewIssueChooseTemplate"] = len(ctx.IssueTemplatesFromDefaultBranch()) > 0
ctx.Data["RequireHighlightJS"] = true
ctx.Data["RequireSimpleMDE"] = true
ctx.Data["ReadOnly"] = false
ctx.Data["PullRequestWorkInProgressPrefixes"] = setting.Repository.PullRequest.WorkInProgressPrefixes
ctx.Data["IsAttachmentEnabled"] = setting.Attachment.Enabled
Expand Down Expand Up @@ -1107,7 +1105,6 @@ func ViewIssue(ctx *context.Context) {

ctx.Data["RequireHighlightJS"] = true
ctx.Data["RequireTribute"] = true
ctx.Data["RequireSimpleMDE"] = true
ctx.Data["IsProjectsEnabled"] = ctx.Repo.CanRead(models.UnitTypeProjects)
ctx.Data["IsAttachmentEnabled"] = setting.Attachment.Enabled
upload.AddUploadContext(ctx, "comment")
Expand Down
1 change: 0 additions & 1 deletion routers/repo/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,6 @@ func ViewPullFiles(ctx *context.Context) {
setCompareContext(ctx, baseCommit, commit, headTarget)

ctx.Data["RequireHighlightJS"] = true
ctx.Data["RequireSimpleMDE"] = true
ctx.Data["RequireTribute"] = true
if ctx.Data["Assignees"], err = ctx.Repo.Repository.GetAssignees(); err != nil {
ctx.ServerError("GetAssignees", err)
Expand Down
4 changes: 0 additions & 4 deletions routers/repo/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,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["RequireSimpleMDE"] = true
ctx.Data["RequireTribute"] = true
ctx.Data["tag_target"] = ctx.Repo.Repository.DefaultBranch
if tagName := ctx.Query("tag"); len(tagName) > 0 {
Expand Down Expand Up @@ -246,7 +245,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["RequireSimpleMDE"] = true
ctx.Data["RequireTribute"] = true

if ctx.HasError() {
Expand Down Expand Up @@ -349,7 +347,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["RequireSimpleMDE"] = true
ctx.Data["RequireTribute"] = true
ctx.Data["IsAttachmentEnabled"] = setting.Attachment.Enabled
upload.AddUploadContext(ctx, "release")
Expand Down Expand Up @@ -388,7 +385,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["RequireSimpleMDE"] = true
ctx.Data["RequireTribute"] = true

tagName := ctx.Params("*")
Expand Down
4 changes: 0 additions & 4 deletions routers/repo/wiki.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,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["RequireSimpleMDE"] = true

if !ctx.Repo.Repository.HasWiki() {
ctx.Data["title"] = "Home"
Expand All @@ -562,7 +561,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["RequireSimpleMDE"] = true

if ctx.HasError() {
ctx.HTML(http.StatusOK, tplWikiNew)
Expand Down Expand Up @@ -600,7 +598,6 @@ func NewWikiPost(ctx *context.Context) {
func EditWiki(ctx *context.Context) {
ctx.Data["PageIsWiki"] = true
ctx.Data["PageIsWikiEdit"] = true
ctx.Data["RequireSimpleMDE"] = true

if !ctx.Repo.Repository.HasWiki() {
ctx.Redirect(ctx.Repo.RepoLink + "/wiki")
Expand All @@ -620,7 +617,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["RequireSimpleMDE"] = true

if ctx.HasError() {
ctx.HTML(http.StatusOK, tplWikiNew)
Expand Down
8 changes: 0 additions & 8 deletions templates/base/footer.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@
{{template "custom/body_outer_post" .}}

{{template "base/footer_content" .}}
{{if .RequireSimpleMDE}}
<script src="{{StaticUrlPrefix}}/js/easymde.js?v={{MD5 AppVer}}"></script>
<script src="{{StaticUrlPrefix}}/vendor/plugins/codemirror/addon/mode/loadmode.js"></script>
<script src="{{StaticUrlPrefix}}/vendor/plugins/codemirror/mode/meta.js"></script>
<script>
CodeMirror.modeURL = '{{StaticUrlPrefix}}/vendor/plugins/codemirror/mode/%N/%N.js';
</script>
{{end}}

<!-- Third-party libraries -->
{{if .RequireU2F}}
Expand Down
6 changes: 0 additions & 6 deletions templates/base/head.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
StaticUrlPrefix: '{{StaticUrlPrefix}}',
UseServiceWorker: {{UseServiceWorker}},
csrf: '{{.CsrfToken}}',
HighlightJS: {{if .RequireHighlightJS}}true{{else}}false{{end}},
SimpleMDE: {{if .RequireSimpleMDE}}true{{else}}false{{end}},
Tribute: {{if .RequireTribute}}true{{else}}false{{end}},
NotificationSettings: {
MinTimeout: {{NotificationSettings.MinTimeout}},
TimeoutStep: {{NotificationSettings.TimeoutStep}},
Expand Down Expand Up @@ -64,9 +61,6 @@
</script>
<link rel="icon" href="{{StaticUrlPrefix}}/img/logo.svg" type="image/svg+xml">
<link rel="alternate icon" href="{{StaticUrlPrefix}}/img/favicon.png" type="image/png">
{{if .RequireSimpleMDE}}
<link rel="stylesheet" href="{{StaticUrlPrefix}}/css/easymde.css?v={{MD5 AppVer}}">
{{end}}
<link rel="stylesheet" href="{{StaticUrlPrefix}}/css/index.css?v={{MD5 AppVer}}">
<noscript>
<style>
Expand Down
8 changes: 5 additions & 3 deletions templates/repo/editor/edit.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@
<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>
<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>
{{end}}
{{template "shared/markdowntoolbar" .}}
</div>
<div class="ui bottom attached active tab segment" data-tab="write">
<textarea id="edit_area" name="content" class="hide" data-id="repo-{{.Repository.Name}}-{{.TreePath}}"
<textarea class="edit_area" name="content" class="hide"
data-id="repo-{{.Repository.Name}}-{{.TreePath}}"
data-url="{{.Repository.APIURL}}/markdown"
data-context="{{.RepoLink}}"
data-markdown-file-exts="{{.MarkdownFileExts}}"
data-line-wrap-extensions="{{.LineWrapExtensions}}">
{{.FileContent}}</textarea>
data-line-wrap-extensions="{{.LineWrapExtensions}}"
>{{.FileContent}}</textarea>
<div class="editor-loading is-loading"></div>
</div>
<div class="ui bottom attached tab segment markdown" data-tab="preview">
Expand Down
11 changes: 7 additions & 4 deletions templates/repo/issue/comment_tab.tmpl
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<div class="ui top tabular menu" data-write="write" data-preview="preview">
<div class="ui top tabular menu df" data-write="write" data-preview="preview">
<a class="active item" data-tab="write">{{.i18n.Tr "write"}}</a>
<a class="item" data-tab="preview" data-url="{{.Repository.APIURL}}/markdown" data-context="{{.RepoLink}}">{{.i18n.Tr "preview"}}</a>
{{template "shared/markdowntoolbar" .}}
</div>
<div class="field">
<div class="ui bottom active tab" data-tab="write">
<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}}">
{{- if .BodyQuery}}{{.BodyQuery}}{{else if .IssueTemplate}}{{.IssueTemplate}}{{else if .PullRequestTemplate}}{{.PullRequestTemplate}}{{else}}{{.content}}{{end -}}
</textarea>
<textarea class="edit_area" name="content" tabindex="4"
data-id="issue-{{.RepoName}}"
data-url="{{.Repository.APIURL}}/markdown"
data-context="{{.Repo.RepoLink}}"
>{{if .BodyQuery}}{{.BodyQuery}}{{else if .IssueTemplate}}{{.IssueTemplate}}{{else if .PullRequestTemplate}}{{.PullRequestTemplate}}{{else}}{{.content}}{{end}}</textarea>
</div>
<div class="ui bottom tab markdown" data-tab="preview">
{{.i18n.Tr "loading"}}
Expand Down
7 changes: 6 additions & 1 deletion templates/repo/wiki/new.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@
<div class="ui top attached tabular menu previewtabs" data-write="write" data-preview="preview">
<a class="active item" data-tab="write">{{.i18n.Tr "write"}}</a>
<a class="item" data-tab="preview" data-url="{{$.Repository.APIURL}}/markdown" data-context="{{$.RepoLink}}">{{$.i18n.Tr "preview"}}</a>
{{template "shared/markdowntoolbar" .}}
</div>
<div class="field content" data-loading="{{.i18n.Tr "loading"}}">
<div class="ui bottom active tab" data-tab="write">
<textarea class="js-quick-submit" id="edit_area" name="content" data-id="wiki-{{.title}}" data-url="{{.Repository.APIURL}}/markdown" data-context="{{.RepoLink}}" required>{{if .PageIsWikiEdit}}{{.content}}{{else}}{{.i18n.Tr "repo.wiki.welcome"}}{{end}}</textarea>
<textarea class="edit_area" name="content" required
data-id="wiki-{{.title}}"
data-url="{{.Repository.APIURL}}/markdown"
data-context="{{.RepoLink}}" required
>{{if .PageIsWikiEdit}}{{.content}}{{else}}{{.i18n.Tr "repo.wiki.welcome"}}{{end}}</textarea>
</div>
</div>
<div class="field">
Expand Down
21 changes: 21 additions & 0 deletions templates/shared/markdowntoolbar.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<markdown-toolbar class="markdown-toolbar">
<div class="markdown-toolbar-buttons">
<md-header class="markdown-toolbar-button">{{svg "octicon-heading"}}</md-header>
<md-bold class="markdown-toolbar-button">{{svg "octicon-bold"}}</md-bold>
<md-italic class="markdown-toolbar-button">{{svg "octicon-italic"}}</md-italic>
</div>
<div class="markdown-toolbar-buttons">
<md-quote class="markdown-toolbar-button">{{svg "octicon-quote"}}</md-quote>
<md-code class="markdown-toolbar-button">{{svg "octicon-code"}}</md-code>
<md-link class="markdown-toolbar-button">{{svg "octicon-link"}}</md-link>
</div>
<div class="markdown-toolbar-buttons">
<md-unordered-list class="markdown-toolbar-button">{{svg "octicon-list-unordered"}}</md-unordered-list>
<md-ordered-list class="markdown-toolbar-button">{{svg "octicon-list-ordered"}}</md-ordered-list>
<md-task-list class="markdown-toolbar-button">{{svg "octicon-tasklist"}}</md-task-list>
</div>
<div class="markdown-toolbar-buttons" class="p-2">
<md-mention class="markdown-toolbar-button">{{svg "octicon-mention"}}</md-mention>
<md-ref class="markdown-toolbar-button">{{svg "octicon-cross-reference"}}</md-ref>
</div>
</markdown-toolbar>
8 changes: 0 additions & 8 deletions web_src/js/easymde.js

This file was deleted.

Loading