Problem: Markdown takes some time to process
continuous-integration/drone/push Build is passing Details

Solution: Don't process when it's not Markdown
master
Peter Stuifzand 1 year ago
parent 66fe665bf2
commit e7d2c0e1a9

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

Loading…
Cancel
Save