Skip to content

Commit

Permalink
Switch from SimpleMDE to EasyMDE (#13333)
Browse files Browse the repository at this point in the history
* Switch from SimpleMDE to EasyMDE

Signed-off-by: Andrew Thornton <art27@cantab.net>

* use webpack to webpack the easymde css

Signed-off-by: Andrew Thornton <art27@cantab.net>

* move css to only css

Signed-off-by: Andrew Thornton <art27@cantab.net>

* move loading codemirror modes and addons back in to footer.tmpl

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Fix arc-green

Signed-off-by: Andrew Thornton <art27@cantab.net>

* as per @silverwind

* reinstall codemirror

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: Lauris BH <lauris@nix.lv>
  • Loading branch information
zeripath and lafriks authored Nov 10, 2020
1 parent 21d4963 commit 13b8c0b
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 48 deletions.
33 changes: 33 additions & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
"add-asset-webpack-plugin": "1.0.0",
"babel-loader": "8.1.0",
"clipboard": "2.0.6",
"codemirror": "5.58.2",
"core-js": "3.7.0",
"css-loader": "5.0.1",
"css-minimizer-webpack-plugin": "1.1.5",
"dropzone": "5.7.2",
"easymde": "2.12.1",
"escape-goat": "3.0.0",
"fast-glob": "3.2.4",
"file-loader": "6.2.0",
Expand Down
21 changes: 0 additions & 21 deletions public/vendor/plugins/simplemde/LICENSE

This file was deleted.

7 changes: 0 additions & 7 deletions public/vendor/plugins/simplemde/simplemde.min.css

This file was deleted.

14 changes: 0 additions & 14 deletions public/vendor/plugins/simplemde/simplemde.min.js

This file was deleted.

2 changes: 1 addition & 1 deletion templates/base/footer.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

{{template "base/footer_content" .}}
{{if .RequireSimpleMDE}}
<script src="{{StaticUrlPrefix}}/vendor/plugins/simplemde/simplemde.min.js"></script>
<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>
Expand Down
2 changes: 1 addition & 1 deletion templates/base/head.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<link rel="mask-icon" href="{{StaticUrlPrefix}}/img/gitea-safari.svg" color="#609926">
<link rel="fluid-icon" href="{{StaticUrlPrefix}}/img/gitea-lg.png" title="{{AppName}}">
{{if .RequireSimpleMDE}}
<link rel="stylesheet" href="{{StaticUrlPrefix}}/vendor/plugins/simplemde/simplemde.min.css">
<link rel="stylesheet" href="{{StaticUrlPrefix}}/css/easymde.css?v={{MD5 AppVer}}">
{{end}}
<link rel="stylesheet" href="{{StaticUrlPrefix}}/css/index.css?v={{MD5 AppVer}}">
<noscript>
Expand Down
8 changes: 8 additions & 0 deletions web_src/js/easymde.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import EasyMDE from 'easymde';

import CodeMirror from 'codemirror/lib/codemirror.js';

window.EasyMDE = EasyMDE;
window.SimpleMDE = EasyMDE;
window.CodeMirror = CodeMirror;

2 changes: 1 addition & 1 deletion web_src/less/_editor.less
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
opacity: 1 !important;
}

.editor-toolbar a:not(:hover) {
.editor-toolbar button:not(:hover) {
background-color: transparent !important;
}

Expand Down
6 changes: 3 additions & 3 deletions web_src/less/themes/theme-arc-green.less
Original file line number Diff line number Diff line change
Expand Up @@ -1784,12 +1784,12 @@ a.ui.labels .label:hover {
border-right-color: var(--color-secondary) !important;
}

.editor-toolbar a {
.editor-toolbar button {
color: #87ab63 !important;
}

.editor-toolbar a.active,
.editor-toolbar a:hover {
.editor-toolbar button.active,
.editor-toolbar button:hover {
background: #2a2e3a;
border-color: transparent;
}
Expand Down
4 changes: 4 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ module.exports = {
'eventsource.sharedworker': [
resolve(__dirname, 'web_src/js/features/eventsource.sharedworker.js'),
],
'easymde': [
resolve(__dirname, 'web_src/js/easymde.js'),
resolve(__dirname, 'node_modules/easymde/dist/easymde.min.css'),
],
...themes,
},
devtool: false,
Expand Down

0 comments on commit 13b8c0b

Please sign in to comment.