-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
The default value for the API parameter [language] is an empty string (''), which sets the editor to plaintext mode. When the [language] parameter is updated, the editor switches to the corresponding language mode. However, it appears that once a language is selected, it is not possible to revert the editor back to plaintext mode by setting [language] to an empty string ('').
Allowing users to switch back to plaintext mode is useful, especially when they test a language that turns out to be unsuitable for the editor’s content.
Ref forum: https://discuss.codemirror.net/t/switching-between-plaintext-and-a-language-throws-error/3104
Ref code-editor:
setLanguage(lang: string) {
if (!lang) {
return;
}
if (this.languages.length === 0) {
if (this.view) {
console.error('No supported languages. Please set the `languages` prop at first.');
}
return;
}
const langDesc = this._findLanguage(lang);
langDesc?.load().then(lang => {
this._dispatchEffects(this._languageConf.reconfigure([lang]));
});
}
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working