fix(code): set initial text

This commit is contained in:
Elian Doran 2025-05-10 19:19:03 +03:00
parent c84a390699
commit 0c9be9291b
No known key found for this signature in database

View File

@ -56,9 +56,13 @@ export default class AbstractCodeTypeWidget extends TypeWidget {
* @param {*} content the new content of the note.
*/
_update(note: { mime: string }, content: string) {
// // CodeMirror breaks pretty badly on null, so even though it shouldn't happen (guarded by a consistency check)
// // we provide fallback
// this.codeEditor.setValue(content || "");
this.codeEditor.dispatch({
changes: {
from: 0,
to: this.codeEditor.state.doc.length,
insert: content || "",
}
})
// this.codeEditor.clearHistory();
// let info = CodeMirror.findModeByMIME(note.mime);