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 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 + ' <span style="background: red; color: white;">' + e.message + '</span>';
}
// try {
// converted = math.evaluate(converted.substring(1), scope).toString()
// } catch (e) {
// converted = converted + ' <span style="background: red; color: white;">' + e.message + '</span>';
// }
} 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: ([^}]+)}}/)

View File

@ -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')