Skip to content

Commit

Permalink
Fix bug causing editing to break when there are empty blocks of a lan…
Browse files Browse the repository at this point in the history
…guage that uses a StreamParser
  • Loading branch information
heyman committed Jul 11, 2024
1 parent a674616 commit 5943844
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/editor/lang-heynote/nested-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 5943844

Please sign in to comment.