Fix read only mode

pull/1224/head
Zef Hemel 2025-01-20 23:28:14 +01:00
parent 41d5743673
commit d72983bde5
3 changed files with 7 additions and 3 deletions

View File

@ -197,7 +197,7 @@ export class Client implements ConfigContainer {
this.ui.render(this.parent);
this.editorView = new EditorView({
state: createEditorState(this, "", "", false),
state: createEditorState(this, "", "", true),
parent: document.getElementById("sb-editor")!,
});
@ -499,6 +499,10 @@ export class Client implements ConfigContainer {
await this.navigate({ page: lastPage });
}
}
setTimeout(() => {
console.log("Focusing editor");
this.focus();
}, 100);
}
async initSpace(): Promise<SpacePrimitives> {
@ -861,7 +865,6 @@ export class Client implements ConfigContainer {
rebuildEditorState() {
const editorView = this.editorView;
console.log("Rebuilding editor state");
if (this.currentPage) {
editorView.setState(

View File

@ -80,7 +80,7 @@ export function createEditorState(
...client.ui.viewState.uiOptions.vimMode ? [vim({ status: true })] : [],
],
[
...readOnly || client.ui.viewState.uiOptions.forcedROMode
...(readOnly || client.ui.viewState.uiOptions.forcedROMode)
? [EditorView.editable.of(false)]
: [],
],

View File

@ -38,6 +38,7 @@ export class MainUI {
return;
}
console.log("Delegated keydown", ev, "to editor");
client.focus();
if (runScopeHandlers(client.editorView, ev, "editor")) {
ev.preventDefault();
}