From 398a554c5d4277c0dbc34fd32905d86487a1d240 Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Sat, 31 Oct 2020 23:28:09 +0100 Subject: [PATCH] Disable large javascript modules --- editor/src/editor.js | 54 ++++++++++++++++++++++---------------------- editor/src/index.js | 17 +++----------- 2 files changed, 30 insertions(+), 41 deletions(-) diff --git a/editor/src/editor.js b/editor/src/editor.js index 94126d7..41afbc2 100644 --- a/editor/src/editor.js +++ b/editor/src/editor.js @@ -9,25 +9,25 @@ import $ from 'jquery'; import Mustache from 'mustache'; import getCaretCoordinates from './caret-position' import moment from 'moment' -import mermaid from 'mermaid' -import {Network, parseDOTNetwork} from "vis-network/peer"; -import PrismJS from 'prismjs' -import 'prismjs/plugins/filter-highlight-all/prism-filter-highlight-all' -import 'prismjs/components/prism-php' -import 'prismjs/components/prism-go' -import 'prismjs/components/prism-perl' -import 'prismjs/components/prism-css' -import 'prismjs/components/prism-markup-templating' -import 'prismjs/components/prism-jq' +// import mermaid from 'mermaid' +// import {Network, parseDOTNetwork} from "vis-network/peer"; +// import PrismJS from 'prismjs' +// import 'prismjs/plugins/filter-highlight-all/prism-filter-highlight-all' +// import 'prismjs/components/prism-php' +// import 'prismjs/components/prism-go' +// import 'prismjs/components/prism-perl' +// import 'prismjs/components/prism-css' +// import 'prismjs/components/prism-markup-templating' +// import 'prismjs/components/prism-jq' import MD from './markdown' import he from 'he' -import {all, create} from 'mathjs' -import formulaFunctions from './formula' +// import {all, create} from 'mathjs' +// import formulaFunctions from './formula' moment.locale('nl') -const math = create(all) -math.import(formulaFunctions) +// const math = create(all) +// math.import(formulaFunctions) function isMultiline(input) { return input.value.startsWith("```", 0) @@ -234,11 +234,11 @@ function Editor(holder, input) { } else if (converted.startsWith("```", 0) || converted.startsWith("$$", 0)) { converted = MD.render(converted) } else if (converted.startsWith("=", 0)) { - try { - converted = math.evaluate(converted.substring(1), scope).toString() - } catch (e) { - converted = converted + ' ' + e.message + ''; - } + // try { + // converted = math.evaluate(converted.substring(1), scope).toString() + // } catch (e) { + // converted = converted + ' ' + e.message + ''; + // } } else { let re = /^([A-Z0-9 ]+)::\s*(.+)$/i; let res = text.match(re) @@ -295,11 +295,11 @@ function Editor(holder, input) { ).save() }) - editor.on('rendered', function () { - PrismJS.highlightAll() - mermaid.init() - renderGraphs(); - }) + // editor.on('rendered', function () { + // PrismJS.highlightAll() + // mermaid.init() + // renderGraphs(); + // }) menu.connectContextMenu(editor) @@ -488,9 +488,9 @@ function Editor(holder, input) { let $input = $(input); $input.parents('.list-item').removeClass('active'); $('#link-complete').off() - PrismJS.highlightAll() - mermaid.init() - renderGraphs(); + // PrismJS.highlightAll() + // mermaid.init() + // renderGraphs(); if ($input.val()) { let query = $input.val(); let res = query.match(/{{query: ([^}]+)}}/) diff --git a/editor/src/index.js b/editor/src/index.js index adb6c9b..ed03a74 100644 --- a/editor/src/index.js +++ b/editor/src/index.js @@ -1,24 +1,13 @@ import $ from 'jquery'; import moment from 'moment' -import mermaid from 'mermaid' -import PrismJS from 'prismjs' -import 'prismjs/plugins/filter-highlight-all/prism-filter-highlight-all' -import 'prismjs/components/prism-php' -import 'prismjs/components/prism-go' -import 'prismjs/components/prism-perl' -import 'prismjs/components/prism-css' -import 'prismjs/components/prism-markup-templating' -import 'prismjs/components/prism-jq' import './styles.scss' import Editor from './editor' import MD from './markdown' -import 'katex/dist/katex.min.css' moment.locale('nl') -mermaid.initialize({startOnLoad: true}) - -PrismJS.plugins.filterHighlightAll.reject.addSelector('.language-mermaid') -PrismJS.plugins.filterHighlightAll.reject.addSelector('.language-dot') +// mermaid.initialize({startOnLoad: true}) +// PrismJS.plugins.filterHighlightAll.reject.addSelector('.language-mermaid') +// PrismJS.plugins.filterHighlightAll.reject.addSelector('.language-dot') // $(function () { // wikiGraph('.graph-network')