Disable large javascript modules

This commit is contained in:
Peter Stuifzand 2020-10-31 23:28:09 +01:00
parent 87b966ca18
commit 398a554c5d
2 changed files with 30 additions and 41 deletions

View File

@ -9,25 +9,25 @@ import $ from 'jquery';
import Mustache from 'mustache'; import Mustache from 'mustache';
import getCaretCoordinates from './caret-position' import getCaretCoordinates from './caret-position'
import moment from 'moment' import moment from 'moment'
import mermaid from 'mermaid' // import mermaid from 'mermaid'
import {Network, parseDOTNetwork} from "vis-network/peer"; // import {Network, parseDOTNetwork} from "vis-network/peer";
import PrismJS from 'prismjs' // import PrismJS from 'prismjs'
import 'prismjs/plugins/filter-highlight-all/prism-filter-highlight-all' // import 'prismjs/plugins/filter-highlight-all/prism-filter-highlight-all'
import 'prismjs/components/prism-php' // import 'prismjs/components/prism-php'
import 'prismjs/components/prism-go' // import 'prismjs/components/prism-go'
import 'prismjs/components/prism-perl' // import 'prismjs/components/prism-perl'
import 'prismjs/components/prism-css' // import 'prismjs/components/prism-css'
import 'prismjs/components/prism-markup-templating' // import 'prismjs/components/prism-markup-templating'
import 'prismjs/components/prism-jq' // import 'prismjs/components/prism-jq'
import MD from './markdown' import MD from './markdown'
import he from 'he' import he from 'he'
import {all, create} from 'mathjs' // import {all, create} from 'mathjs'
import formulaFunctions from './formula' // import formulaFunctions from './formula'
moment.locale('nl') moment.locale('nl')
const math = create(all) // const math = create(all)
math.import(formulaFunctions) // math.import(formulaFunctions)
function isMultiline(input) { function isMultiline(input) {
return input.value.startsWith("```", 0) return input.value.startsWith("```", 0)
@ -234,11 +234,11 @@ function Editor(holder, input) {
} else if (converted.startsWith("```", 0) || converted.startsWith("$$", 0)) { } else if (converted.startsWith("```", 0) || converted.startsWith("$$", 0)) {
converted = MD.render(converted) converted = MD.render(converted)
} else if (converted.startsWith("=", 0)) { } else if (converted.startsWith("=", 0)) {
try { // try {
converted = math.evaluate(converted.substring(1), scope).toString() // converted = math.evaluate(converted.substring(1), scope).toString()
} catch (e) { // } catch (e) {
converted = converted + ' <span style="background: red; color: white;">' + e.message + '</span>'; // converted = converted + ' <span style="background: red; color: white;">' + e.message + '</span>';
} // }
} else { } else {
let re = /^([A-Z0-9 ]+)::\s*(.+)$/i; let re = /^([A-Z0-9 ]+)::\s*(.+)$/i;
let res = text.match(re) let res = text.match(re)
@ -295,11 +295,11 @@ function Editor(holder, input) {
).save() ).save()
}) })
editor.on('rendered', function () { // editor.on('rendered', function () {
PrismJS.highlightAll() // PrismJS.highlightAll()
mermaid.init() // mermaid.init()
renderGraphs(); // renderGraphs();
}) // })
menu.connectContextMenu(editor) menu.connectContextMenu(editor)
@ -488,9 +488,9 @@ function Editor(holder, input) {
let $input = $(input); let $input = $(input);
$input.parents('.list-item').removeClass('active'); $input.parents('.list-item').removeClass('active');
$('#link-complete').off() $('#link-complete').off()
PrismJS.highlightAll() // PrismJS.highlightAll()
mermaid.init() // mermaid.init()
renderGraphs(); // renderGraphs();
if ($input.val()) { if ($input.val()) {
let query = $input.val(); let query = $input.val();
let res = query.match(/{{query: ([^}]+)}}/) let res = query.match(/{{query: ([^}]+)}}/)

View File

@ -1,24 +1,13 @@
import $ from 'jquery'; import $ from 'jquery';
import moment from 'moment' 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 './styles.scss'
import Editor from './editor' import Editor from './editor'
import MD from './markdown' import MD from './markdown'
import 'katex/dist/katex.min.css'
moment.locale('nl') moment.locale('nl')
mermaid.initialize({startOnLoad: true}) // mermaid.initialize({startOnLoad: true})
// PrismJS.plugins.filterHighlightAll.reject.addSelector('.language-mermaid')
PrismJS.plugins.filterHighlightAll.reject.addSelector('.language-mermaid') // PrismJS.plugins.filterHighlightAll.reject.addSelector('.language-dot')
PrismJS.plugins.filterHighlightAll.reject.addSelector('.language-dot')
// $(function () { // $(function () {
// wikiGraph('.graph-network') // wikiGraph('.graph-network')