Fix bug causing editing to break when there are empty blocks of a language that uses a StreamParser

This commit is contained in:
Jonatan Heyman 2024-07-11 14:30:07 +02:00
parent e8971a6733
commit f33be7f3a4

View File

@ -22,7 +22,13 @@ export function configureNesting() {
if (id == NoteContent) {
let noteLang = node.node.parent.firstChild.getChildren(NoteLanguage)[0]
let langName = input.read(noteLang?.from, noteLang?.to)
//console.log("langName:", langName)
// if the NoteContent is empty, we don't want to return a parser, since that seems to cause an
// error for StreamLanguage parsers when the buffer size is large (e.g >300 kb)
if (node.node.from == node.node.to) {
return null
}
if (langName in languageMapping && languageMapping[langName] !== null) {
//console.log("found parser for language:", langName)
return {