mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-29 00:14:30 -05:00
Load codemirror and codemirror-spell-checker without script-loader
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
23fa44cd36
commit
e17cc6440f
3 changed files with 118 additions and 76 deletions
|
@ -1,9 +1,10 @@
|
||||||
/* eslint-env browser, jquery */
|
/* eslint-env browser, jquery */
|
||||||
/* eslint no-console: ["error", { allow: ["warn", "error", "debug"] }] */
|
/* eslint no-console: ["error", { allow: ["warn", "error", "debug"] }] */
|
||||||
/* global CodeMirror, Cookies, moment, Idle, serverurl,
|
/* global Cookies, moment, Idle, serverurl,
|
||||||
key, Dropbox, ot, hex2rgb, Visibility */
|
key, Dropbox, ot, hex2rgb, Visibility */
|
||||||
|
|
||||||
import TurndownService from 'turndown'
|
import TurndownService from 'turndown'
|
||||||
|
import CodeMirror from 'codemirror/lib/codemirror.js'
|
||||||
|
|
||||||
import { saveAs } from 'file-saver'
|
import { saveAs } from 'file-saver'
|
||||||
import randomColor from 'randomcolor'
|
import randomColor from 'randomcolor'
|
||||||
|
|
|
@ -1,3 +1,39 @@
|
||||||
|
import 'codemirror/keymap/sublime'
|
||||||
|
import 'codemirror/keymap/emacs'
|
||||||
|
import 'codemirror/keymap/vim'
|
||||||
|
import 'codemirror/mode/gfm/gfm'
|
||||||
|
import 'codemirror/addon/mode/overlay.js'
|
||||||
|
import 'codemirror/addon/mode/simple.js'
|
||||||
|
import 'codemirror/addon/mode/multiplex.js'
|
||||||
|
import 'codemirror/addon/selection/active-line.js'
|
||||||
|
import 'codemirror/addon/search/searchcursor.js'
|
||||||
|
import 'codemirror/addon/search/search.js'
|
||||||
|
import 'codemirror/addon/search/jump-to-line.js'
|
||||||
|
import 'codemirror/addon/search/matchesonscrollbar.js'
|
||||||
|
import 'codemirror/addon/search/match-highlighter.js'
|
||||||
|
import 'codemirror/addon/scroll/simplescrollbars.js'
|
||||||
|
import 'codemirror/addon/scroll/annotatescrollbar.js'
|
||||||
|
import 'codemirror/addon/display/panel.js'
|
||||||
|
import 'codemirror/addon/display/placeholder.js'
|
||||||
|
import 'codemirror/addon/display/fullscreen.js'
|
||||||
|
import 'codemirror/addon/display/autorefresh.js'
|
||||||
|
import 'codemirror/addon/dialog/dialog.js'
|
||||||
|
import 'codemirror/addon/edit/matchbrackets.js'
|
||||||
|
import 'codemirror/addon/edit/closebrackets.js'
|
||||||
|
import 'codemirror/addon/edit/matchtags.js'
|
||||||
|
import 'codemirror/addon/edit/closetag.js'
|
||||||
|
import 'codemirror/addon/edit/continuelist.js'
|
||||||
|
import 'codemirror/addon/comment/comment.js'
|
||||||
|
import 'codemirror/addon/comment/continuecomment.js'
|
||||||
|
import 'codemirror/addon/wrap/hardwrap.js'
|
||||||
|
import 'codemirror/addon/fold/foldcode.js'
|
||||||
|
import 'codemirror/addon/fold/brace-fold.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 '../../../vendor/codemirror-spell-checker/spell-checker.min.js'
|
||||||
|
|
||||||
import * as utils from './utils'
|
import * as utils from './utils'
|
||||||
import config from './config'
|
import config from './config'
|
||||||
import statusBarTemplate from './statusbar.html'
|
import statusBarTemplate from './statusbar.html'
|
||||||
|
|
|
@ -20,7 +20,8 @@ module.exports = {
|
||||||
jQuery: 'jquery',
|
jQuery: 'jquery',
|
||||||
'window.jQuery': 'jquery',
|
'window.jQuery': 'jquery',
|
||||||
'moment': 'moment',
|
'moment': 'moment',
|
||||||
'Handlebars': 'handlebars'
|
'Handlebars': 'handlebars',
|
||||||
|
CodeMirror: 'codemirror/lib/codemirror.js'
|
||||||
}),
|
}),
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
template: 'public/views/includes/header.ejs',
|
template: 'public/views/includes/header.ejs',
|
||||||
|
@ -215,10 +216,8 @@ module.exports = {
|
||||||
'script-loader!jquery-ui-resizable',
|
'script-loader!jquery-ui-resizable',
|
||||||
'script-loader!Idle.Js',
|
'script-loader!Idle.Js',
|
||||||
'expose-loader?exposes=LZString!lz-string',
|
'expose-loader?exposes=LZString!lz-string',
|
||||||
'script-loader!codemirror',
|
|
||||||
'script-loader!inlineAttachment',
|
'script-loader!inlineAttachment',
|
||||||
'script-loader!jqueryTextcomplete',
|
'script-loader!jqueryTextcomplete',
|
||||||
'script-loader!codemirrorSpellChecker',
|
|
||||||
'script-loader!codemirrorInlineAttachment',
|
'script-loader!codemirrorInlineAttachment',
|
||||||
'script-loader!ot',
|
'script-loader!ot',
|
||||||
'flowchart.js',
|
'flowchart.js',
|
||||||
|
@ -265,10 +264,8 @@ module.exports = {
|
||||||
'script-loader!Idle.Js',
|
'script-loader!Idle.Js',
|
||||||
'script-loader!gist-embed',
|
'script-loader!gist-embed',
|
||||||
'expose-loader?exposes=LZString!lz-string',
|
'expose-loader?exposes=LZString!lz-string',
|
||||||
'script-loader!codemirror',
|
|
||||||
'script-loader!inlineAttachment',
|
'script-loader!inlineAttachment',
|
||||||
'script-loader!jqueryTextcomplete',
|
'script-loader!jqueryTextcomplete',
|
||||||
'script-loader!codemirrorSpellChecker',
|
|
||||||
'script-loader!codemirrorInlineAttachment',
|
'script-loader!codemirrorInlineAttachment',
|
||||||
'script-loader!ot',
|
'script-loader!ot',
|
||||||
'flowchart.js',
|
'flowchart.js',
|
||||||
|
@ -364,10 +361,8 @@ module.exports = {
|
||||||
modules: ['node_modules'],
|
modules: ['node_modules'],
|
||||||
extensions: ['.js'],
|
extensions: ['.js'],
|
||||||
alias: {
|
alias: {
|
||||||
codemirror: path.join(__dirname, 'node_modules/codemirror/codemirror.min.js'),
|
|
||||||
inlineAttachment: path.join(__dirname, 'public/vendor/inlineAttachment/inline-attachment.js'),
|
inlineAttachment: path.join(__dirname, 'public/vendor/inlineAttachment/inline-attachment.js'),
|
||||||
jqueryTextcomplete: path.join(__dirname, 'public/vendor/jquery-textcomplete/jquery.textcomplete.js'),
|
jqueryTextcomplete: path.join(__dirname, 'public/vendor/jquery-textcomplete/jquery.textcomplete.js'),
|
||||||
codemirrorSpellChecker: path.join(__dirname, 'public/vendor/codemirror-spell-checker/spell-checker.min.js'),
|
|
||||||
codemirrorInlineAttachment: path.join(__dirname, 'public/vendor/inlineAttachment/codemirror.inline-attachment.js'),
|
codemirrorInlineAttachment: path.join(__dirname, 'public/vendor/inlineAttachment/codemirror.inline-attachment.js'),
|
||||||
ot: path.join(__dirname, 'public/vendor/ot/ot.min.js'),
|
ot: path.join(__dirname, 'public/vendor/ot/ot.min.js'),
|
||||||
mermaid: path.join(__dirname, 'node_modules/mermaid/dist/mermaid.min.js'),
|
mermaid: path.join(__dirname, 'node_modules/mermaid/dist/mermaid.min.js'),
|
||||||
|
@ -392,7 +387,17 @@ module.exports = {
|
||||||
},
|
},
|
||||||
|
|
||||||
module: {
|
module: {
|
||||||
rules: [{
|
rules: [
|
||||||
|
{
|
||||||
|
test: require.resolve(path.join(__dirname, 'public/vendor/codemirror-spell-checker/spell-checker.min.js')),
|
||||||
|
use: {
|
||||||
|
loader: 'imports-loader',
|
||||||
|
options: {
|
||||||
|
imports: ['default codemirror CodeMirror']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
use: [{ loader: 'babel-loader' }],
|
use: [{ loader: 'babel-loader' }],
|
||||||
exclude: [/node_modules/, /public\/vendor/]
|
exclude: [/node_modules/, /public\/vendor/]
|
||||||
|
|
Loading…
Reference in a new issue