Compare commits

...

2 Commits

Author SHA1 Message Date
e7d2c0e1a9 Problem: Markdown takes some time to process
All checks were successful
continuous-integration/drone/push Build is passing
Solution: Don't process when it's not Markdown
2022-04-29 21:42:06 +02:00
66fe665bf2 Problem: graph is slow
Solution: disable graph
2022-04-29 21:41:49 +02:00
2 changed files with 19 additions and 6 deletions

View File

@ -3,7 +3,7 @@ import moment from 'moment'
import './styles.scss'
import Editor from './editor'
import MD from './markdown'
import wikiGraph from "./graph";
// import wikiGraph from "./graph";
import "./sr";
moment.locale('nl')
@ -11,9 +11,9 @@ moment.locale('nl')
// PrismJS.plugins.filterHighlightAll.reject.addSelector('.language-mermaid')
// PrismJS.plugins.filterHighlightAll.reject.addSelector('.language-dot')
$(function () {
setTimeout(() => wikiGraph('.graph-network'), 1);
})
// $(function () {
// setTimeout(() => wikiGraph('.graph-network'), 1);
// })
/*
* EVENTS

View File

@ -237,6 +237,10 @@ function editor(root, inputData, options) {
return {indented: indented, text: '', fold: 'open', hidden: false}
}
function hasMarkdown(text) {
return text.match(/[^a-zA-Z0-9 .,!@$&"'?]/)
}
function newItem(value) {
let el = document.createElement('div')
el.classList.add('list-item')
@ -253,7 +257,11 @@ function editor(root, inputData, options) {
line.prepend(content)
options.transform(value.text, $(content), value.id, EDITOR)
if (hasMarkdown(value.text)) {
options.transform(value.text, $(content), value.id, EDITOR)
} else {
$(content).html(value.text)
}
let marker = document.createElement('span')
marker.classList.add('marker')
@ -343,7 +351,12 @@ function editor(root, inputData, options) {
value.hidden = value.indented >= hideLevel
options.transform(value.text, $li.find('.content'), value.id, EDITOR)
let $content = $li.find('.content');
if (hasMarkdown(value.text)) {
options.transform(value.text, $content, value.id, EDITOR)
} else {
$content.html(value.text)
}
if (value.indented < hideLevel) {
if (value.fold !== 'open') {