Fix bug causing an endless loop with the lang auto detector continuously changing the language of the current block

This commit is contained in:
Jonatan Heyman 2023-01-19 00:18:18 +01:00
parent 335390d8e5
commit c4e78a70ce

View File

@ -78,7 +78,9 @@ export function languageDetection(getView) {
// if content is cleared, set language to plaintext
const view = getView()
const block = getActiveNoteBlock(view.state)
changeLanguageTo(view.state, view.dispatch, block, "text", true)
if (block.language.name !== "text") {
changeLanguageTo(view.state, view.dispatch, block, "text", true)
}
}
if (content.length <= 8) {
return