We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4fe68e9 commit 6a1b153Copy full SHA for 6a1b153
packages/editor/src/lib/Editor.svelte
@@ -108,7 +108,7 @@
108
}
109
110
state = EditorState.create({
111
- doc: file.contents,
+ doc: '\n',
112
extensions: [
113
...extensions,
114
...(lang || []),
@@ -118,6 +118,7 @@
118
});
119
120
editor_states.set(file.name, state);
121
+ select_state(file.name);
122
123
124
@@ -135,13 +136,11 @@
135
136
137
function select_state(selected_name: string | null) {
138
const state =
- (selected_name && editor_states.get(selected_name)) ||
139
- EditorState.create({
140
- doc: '',
141
- extensions: [EditorState.readOnly.of(true)]
142
- });
+ (selected_name && editor_states.get(selected_name))
143
144
- editor_view.setState(state);
+ if (state) {
+ editor_view.setState(state);
+ }
145
146
147
$effect(() => {
0 commit comments