From 29b35626723d4f65b5ca83ad114e854d506e945e Mon Sep 17 00:00:00 2001 From: Tilman Vatteroth Date: Mon, 27 Feb 2023 21:56:05 +0100 Subject: [PATCH] feat: use codemirror precompiled package Signed-off-by: Tilman Vatteroth --- package.json | 2 +- public/js/index.js | 2 +- public/js/lib/editor/index.js | 162 +++++++++++++++++----------------- webpack.common.js | 24 ++--- yarn.lock | 10 +-- 5 files changed, 100 insertions(+), 100 deletions(-) diff --git a/package.json b/package.json index 833f182f6..653d7a144 100644 --- a/package.json +++ b/package.json @@ -146,7 +146,7 @@ "babel-runtime": "6.26.0", "bootstrap": "3.4.1", "bootstrap-validator": "0.11.9", - "codemirror": "git+https://github.com/hedgedoc/CodeMirror.git", + "@hedgedoc/codemirror-5": "5.65.12", "copy-webpack-plugin": "6.4.1", "css-loader": "5.2.7", "emojify.js": "1.1.0", diff --git a/public/js/index.js b/public/js/index.js index 594d6534a..e9d5859c4 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -4,7 +4,7 @@ key, Dropbox, Visibility */ import TurndownService from 'turndown' -import CodeMirror from 'codemirror/lib/codemirror.js' +import CodeMirror from '@hedgedoc/codemirror-5/lib/codemirror.js' import 'jquery-ui/ui/widgets/resizable' import 'jquery-ui/themes/base/resizable.css' diff --git a/public/js/lib/editor/index.js b/public/js/lib/editor/index.js index d37fff13c..65b34a68e 100644 --- a/public/js/lib/editor/index.js +++ b/public/js/lib/editor/index.js @@ -1,84 +1,84 @@ -import 'codemirror/addon/comment/comment.js' -import 'codemirror/addon/comment/continuecomment.js' -import 'codemirror/addon/dialog/dialog.js' -import 'codemirror/addon/display/autorefresh.js' -import 'codemirror/addon/display/fullscreen.js' -import 'codemirror/addon/display/panel.js' -import 'codemirror/addon/display/placeholder.js' -import 'codemirror/addon/edit/closebrackets.js' -import 'codemirror/addon/edit/closetag.js' -import 'codemirror/addon/edit/continuelist.js' -import 'codemirror/addon/edit/matchbrackets.js' -import 'codemirror/addon/edit/matchtags.js' -import 'codemirror/addon/fold/brace-fold.js' -import 'codemirror/addon/fold/foldcode.js' -import 'codemirror/addon/fold/foldgutter.js' -import 'codemirror/addon/fold/markdown-fold.js' -import 'codemirror/addon/fold/xml-fold.js' -import 'codemirror/addon/merge/merge.js' -import 'codemirror/addon/mode/multiplex.js' -import 'codemirror/addon/mode/overlay.js' -import 'codemirror/addon/mode/simple.js' -import 'codemirror/addon/scroll/annotatescrollbar.js' -import 'codemirror/addon/scroll/simplescrollbars.js' -import 'codemirror/addon/search/jump-to-line.js' -import 'codemirror/addon/search/match-highlighter.js' -import 'codemirror/addon/search/matchesonscrollbar.js' -import 'codemirror/addon/search/search.js' -import 'codemirror/addon/search/searchcursor.js' -import 'codemirror/addon/selection/active-line.js' -import 'codemirror/addon/wrap/hardwrap.js' -import 'codemirror/keymap/emacs.js' -import 'codemirror/keymap/sublime.js' -import 'codemirror/keymap/vim.js' -import 'codemirror/mode/clike/clike.js' -import 'codemirror/mode/clojure/clojure.js' -import 'codemirror/mode/cmake/cmake.js' -import 'codemirror/mode/coffeescript/coffeescript.js' -import 'codemirror/mode/css/css.js' -import 'codemirror/mode/csv/csv.js' -import 'codemirror/mode/diff/diff.js' -import 'codemirror/mode/dockerfile/dockerfile.js' -import 'codemirror/mode/gfm/gfm.js' -import 'codemirror/mode/gherkin/gherkin.js' -import 'codemirror/mode/go/go.js' -import 'codemirror/mode/graphviz/graphviz.js' -import 'codemirror/mode/groovy/groovy.js' -import 'codemirror/mode/haskell/haskell.js' -import 'codemirror/mode/htmlembedded/htmlembedded.js' -import 'codemirror/mode/htmlmixed/htmlmixed.js' -import 'codemirror/mode/javascript/javascript.js' -import 'codemirror/mode/jsx/jsx.js' -import 'codemirror/mode/lua/lua.js' -import 'codemirror/mode/markdown/markdown_math.js' -import 'codemirror/mode/mediawiki/mediawiki.js' -import 'codemirror/mode/mermaid/mermaid.js' -import 'codemirror/mode/mllike/mllike.js' -import 'codemirror/mode/nginx/nginx.js' -import 'codemirror/mode/perl/perl.js' -import 'codemirror/mode/php/php.js' -import 'codemirror/mode/plantuml/plantuml.js' -import 'codemirror/mode/protobuf/protobuf.js' -import 'codemirror/mode/pug/pug.js' -import 'codemirror/mode/python/python.js' -import 'codemirror/mode/r/r.js' -import 'codemirror/mode/ruby/ruby.js' -import 'codemirror/mode/rust/rust.js' -import 'codemirror/mode/sas/sas.js' -import 'codemirror/mode/sass/sass.js' -import 'codemirror/mode/shell/shell.js' -import 'codemirror/mode/solidity/solidity.js' -import 'codemirror/mode/sql/sql.js' -import 'codemirror/mode/stex/stex.js' -import 'codemirror/mode/swift/swift.js' -import 'codemirror/mode/tiddlywiki/tiddlywiki.js' -import 'codemirror/mode/typescript/typescript.js' -import 'codemirror/mode/vb/vb.js' -import 'codemirror/mode/verilog/verilog.js' -import 'codemirror/mode/vhdl/vhdl.js' -import 'codemirror/mode/xml/xml.js' -import 'codemirror/mode/yaml-frontmatter/yaml-frontmatter.js' -import 'codemirror/mode/yaml/yaml.js' +import '@hedgedoc/codemirror-5/addon/comment/comment.js' +import '@hedgedoc/codemirror-5/addon/comment/continuecomment.js' +import '@hedgedoc/codemirror-5/addon/dialog/dialog.js' +import '@hedgedoc/codemirror-5/addon/display/autorefresh.js' +import '@hedgedoc/codemirror-5/addon/display/fullscreen.js' +import '@hedgedoc/codemirror-5/addon/display/panel.js' +import '@hedgedoc/codemirror-5/addon/display/placeholder.js' +import '@hedgedoc/codemirror-5/addon/edit/closebrackets.js' +import '@hedgedoc/codemirror-5/addon/edit/closetag.js' +import '@hedgedoc/codemirror-5/addon/edit/continuelist.js' +import '@hedgedoc/codemirror-5/addon/edit/matchbrackets.js' +import '@hedgedoc/codemirror-5/addon/edit/matchtags.js' +import '@hedgedoc/codemirror-5/addon/fold/brace-fold.js' +import '@hedgedoc/codemirror-5/addon/fold/foldcode.js' +import '@hedgedoc/codemirror-5/addon/fold/foldgutter.js' +import '@hedgedoc/codemirror-5/addon/fold/markdown-fold.js' +import '@hedgedoc/codemirror-5/addon/fold/xml-fold.js' +import '@hedgedoc/codemirror-5/addon/merge/merge.js' +import '@hedgedoc/codemirror-5/addon/mode/multiplex.js' +import '@hedgedoc/codemirror-5/addon/mode/overlay.js' +import '@hedgedoc/codemirror-5/addon/mode/simple.js' +import '@hedgedoc/codemirror-5/addon/scroll/annotatescrollbar.js' +import '@hedgedoc/codemirror-5/addon/scroll/simplescrollbars.js' +import '@hedgedoc/codemirror-5/addon/search/jump-to-line.js' +import '@hedgedoc/codemirror-5/addon/search/match-highlighter.js' +import '@hedgedoc/codemirror-5/addon/search/matchesonscrollbar.js' +import '@hedgedoc/codemirror-5/addon/search/search.js' +import '@hedgedoc/codemirror-5/addon/search/searchcursor.js' +import '@hedgedoc/codemirror-5/addon/selection/active-line.js' +import '@hedgedoc/codemirror-5/addon/wrap/hardwrap.js' +import '@hedgedoc/codemirror-5/keymap/emacs.js' +import '@hedgedoc/codemirror-5/keymap/sublime.js' +import '@hedgedoc/codemirror-5/keymap/vim.js' +import '@hedgedoc/codemirror-5/mode/clike/clike.js' +import '@hedgedoc/codemirror-5/mode/clojure/clojure.js' +import '@hedgedoc/codemirror-5/mode/cmake/cmake.js' +import '@hedgedoc/codemirror-5/mode/coffeescript/coffeescript.js' +import '@hedgedoc/codemirror-5/mode/css/css.js' +import '@hedgedoc/codemirror-5/mode/csv/csv.js' +import '@hedgedoc/codemirror-5/mode/diff/diff.js' +import '@hedgedoc/codemirror-5/mode/dockerfile/dockerfile.js' +import '@hedgedoc/codemirror-5/mode/gfm/gfm.js' +import '@hedgedoc/codemirror-5/mode/gherkin/gherkin.js' +import '@hedgedoc/codemirror-5/mode/go/go.js' +import '@hedgedoc/codemirror-5/mode/graphviz/graphviz.js' +import '@hedgedoc/codemirror-5/mode/groovy/groovy.js' +import '@hedgedoc/codemirror-5/mode/haskell/haskell.js' +import '@hedgedoc/codemirror-5/mode/htmlembedded/htmlembedded.js' +import '@hedgedoc/codemirror-5/mode/htmlmixed/htmlmixed.js' +import '@hedgedoc/codemirror-5/mode/javascript/javascript.js' +import '@hedgedoc/codemirror-5/mode/jsx/jsx.js' +import '@hedgedoc/codemirror-5/mode/lua/lua.js' +import '@hedgedoc/codemirror-5/mode/markdown/markdown_math.js' +import '@hedgedoc/codemirror-5/mode/mediawiki/mediawiki.js' +import '@hedgedoc/codemirror-5/mode/mermaid/mermaid.js' +import '@hedgedoc/codemirror-5/mode/mllike/mllike.js' +import '@hedgedoc/codemirror-5/mode/nginx/nginx.js' +import '@hedgedoc/codemirror-5/mode/perl/perl.js' +import '@hedgedoc/codemirror-5/mode/php/php.js' +import '@hedgedoc/codemirror-5/mode/plantuml/plantuml.js' +import '@hedgedoc/codemirror-5/mode/protobuf/protobuf.js' +import '@hedgedoc/codemirror-5/mode/pug/pug.js' +import '@hedgedoc/codemirror-5/mode/python/python.js' +import '@hedgedoc/codemirror-5/mode/r/r.js' +import '@hedgedoc/codemirror-5/mode/ruby/ruby.js' +import '@hedgedoc/codemirror-5/mode/rust/rust.js' +import '@hedgedoc/codemirror-5/mode/sas/sas.js' +import '@hedgedoc/codemirror-5/mode/sass/sass.js' +import '@hedgedoc/codemirror-5/mode/shell/shell.js' +import '@hedgedoc/codemirror-5/mode/solidity/solidity.js' +import '@hedgedoc/codemirror-5/mode/sql/sql.js' +import '@hedgedoc/codemirror-5/mode/stex/stex.js' +import '@hedgedoc/codemirror-5/mode/swift/swift.js' +import '@hedgedoc/codemirror-5/mode/tiddlywiki/tiddlywiki.js' +import '@hedgedoc/codemirror-5/mode/typescript/typescript.js' +import '@hedgedoc/codemirror-5/mode/vb/vb.js' +import '@hedgedoc/codemirror-5/mode/verilog/verilog.js' +import '@hedgedoc/codemirror-5/mode/vhdl/vhdl.js' +import '@hedgedoc/codemirror-5/mode/xml/xml.js' +import '@hedgedoc/codemirror-5/mode/yaml-frontmatter/yaml-frontmatter.js' +import '@hedgedoc/codemirror-5/mode/yaml/yaml.js' import '../../../vendor/codemirror-spell-checker/spell-checker.min.js' import '../../../vendor/inlineAttachment/inline-attachment' diff --git a/webpack.common.js b/webpack.common.js index b19fd9891..0a7b906c5 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -28,7 +28,7 @@ module.exports = { jQuery: 'jquery', 'window.jQuery': 'jquery', 'moment': 'moment', - CodeMirror: 'codemirror/lib/codemirror.js' + CodeMirror: '@hedgedoc/codemirror-5/lib/codemirror.js' }), new HtmlWebpackPlugin({ template: 'public/views/includes/header.ejs', @@ -175,16 +175,16 @@ module.exports = { ], 'index-styles': [ path.join(__dirname, 'public/vendor/codemirror-spell-checker/spell-checker.min.css'), - path.join(__dirname, 'node_modules/codemirror/lib/codemirror.css'), - path.join(__dirname, 'node_modules/codemirror/addon/fold/foldgutter.css'), - path.join(__dirname, 'node_modules/codemirror/addon/display/fullscreen.css'), - path.join(__dirname, 'node_modules/codemirror/addon/dialog/dialog.css'), - path.join(__dirname, 'node_modules/codemirror/addon/scroll/simplescrollbars.css'), - path.join(__dirname, 'node_modules/codemirror/addon/search/matchesonscrollbar.css'), - path.join(__dirname, 'node_modules/codemirror/theme/monokai.css'), - path.join(__dirname, 'node_modules/codemirror/theme/one-dark.css'), - path.join(__dirname, 'node_modules/codemirror/mode/tiddlywiki/tiddlywiki.css'), - path.join(__dirname, 'node_modules/codemirror/mode/mediawiki/mediawiki.css'), + path.join(__dirname, 'node_modules/@hedgedoc/codemirror-5/lib/codemirror.css'), + path.join(__dirname, 'node_modules/@hedgedoc/codemirror-5/addon/fold/foldgutter.css'), + path.join(__dirname, 'node_modules/@hedgedoc/codemirror-5/addon/display/fullscreen.css'), + path.join(__dirname, 'node_modules/@hedgedoc/codemirror-5/addon/dialog/dialog.css'), + path.join(__dirname, 'node_modules/@hedgedoc/codemirror-5/addon/scroll/simplescrollbars.css'), + path.join(__dirname, 'node_modules/@hedgedoc/codemirror-5/addon/search/matchesonscrollbar.css'), + path.join(__dirname, 'node_modules/@hedgedoc/codemirror-5/theme/monokai.css'), + path.join(__dirname, 'node_modules/@hedgedoc/codemirror-5/theme/one-dark.css'), + path.join(__dirname, 'node_modules/@hedgedoc/codemirror-5/mode/tiddlywiki/tiddlywiki.css'), + path.join(__dirname, 'node_modules/@hedgedoc/codemirror-5/mode/mediawiki/mediawiki.css'), path.join(__dirname, 'node_modules/spin.js/spin.css'), path.join(__dirname, 'public/css/github-extract.css'), path.join(__dirname, 'public/vendor/showup/showup.css'), @@ -304,7 +304,7 @@ module.exports = { use: { loader: 'imports-loader', options: { - imports: ['default codemirror CodeMirror'] + imports: ['default @hedgedoc/codemirror-5 CodeMirror'] } } }, diff --git a/yarn.lock b/yarn.lock index 70a95a6ce..ebc679455 100644 --- a/yarn.lock +++ b/yarn.lock @@ -182,6 +182,11 @@ resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6" integrity sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw== +"@hedgedoc/codemirror-5@5.65.12": + version "5.65.12" + resolved "https://registry.yarnpkg.com/@hedgedoc/codemirror-5/-/codemirror-5-5.65.12.tgz#86ac7a79b05964b2b8f504144e35654720a49ef6" + integrity sha512-t86sQMXQZMPy75xbhhqZpRKUx3E3Mp4FdRzVrY0CO8BSSgiAg+RpfMFmCJYLFf4voTetsVberq2q7/GfDaYkzw== + "@humanwhocodes/config-array@^0.11.8": version "0.11.8" resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.8.tgz#03595ac2075a4dc0f191cc2131de14fbd7d410b9" @@ -2618,11 +2623,6 @@ cls-bluebird@^2.1.0: is-bluebird "^1.0.2" shimmer "^1.1.0" -"codemirror@git+https://github.com/hedgedoc/CodeMirror.git": - version "5.65.12" - uid "64922b591f46d784169cae67ea8938b10254bc0e" - resolved "git+https://github.com/hedgedoc/CodeMirror.git#64922b591f46d784169cae67ea8938b10254bc0e" - collection-visit@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0"