From c4e78a70cee7f44e0e440f19071f5b2a945954c7 Mon Sep 17 00:00:00 2001 From: Jonatan Heyman Date: Thu, 19 Jan 2023 00:18:18 +0100 Subject: [PATCH] Fix bug causing an endless loop with the lang auto detector continuously changing the language of the current block --- src/editor/language-detection/autodetect.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/editor/language-detection/autodetect.js b/src/editor/language-detection/autodetect.js index 2ba35a6..8758028 100644 --- a/src/editor/language-detection/autodetect.js +++ b/src/editor/language-detection/autodetect.js @@ -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