Fix read only mode
parent
41d5743673
commit
d72983bde5
|
@ -197,7 +197,7 @@ export class Client implements ConfigContainer {
|
||||||
this.ui.render(this.parent);
|
this.ui.render(this.parent);
|
||||||
|
|
||||||
this.editorView = new EditorView({
|
this.editorView = new EditorView({
|
||||||
state: createEditorState(this, "", "", false),
|
state: createEditorState(this, "", "", true),
|
||||||
parent: document.getElementById("sb-editor")!,
|
parent: document.getElementById("sb-editor")!,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -499,6 +499,10 @@ export class Client implements ConfigContainer {
|
||||||
await this.navigate({ page: lastPage });
|
await this.navigate({ page: lastPage });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
console.log("Focusing editor");
|
||||||
|
this.focus();
|
||||||
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
async initSpace(): Promise<SpacePrimitives> {
|
async initSpace(): Promise<SpacePrimitives> {
|
||||||
|
@ -861,7 +865,6 @@ export class Client implements ConfigContainer {
|
||||||
|
|
||||||
rebuildEditorState() {
|
rebuildEditorState() {
|
||||||
const editorView = this.editorView;
|
const editorView = this.editorView;
|
||||||
console.log("Rebuilding editor state");
|
|
||||||
|
|
||||||
if (this.currentPage) {
|
if (this.currentPage) {
|
||||||
editorView.setState(
|
editorView.setState(
|
||||||
|
|
|
@ -80,7 +80,7 @@ export function createEditorState(
|
||||||
...client.ui.viewState.uiOptions.vimMode ? [vim({ status: true })] : [],
|
...client.ui.viewState.uiOptions.vimMode ? [vim({ status: true })] : [],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
...readOnly || client.ui.viewState.uiOptions.forcedROMode
|
...(readOnly || client.ui.viewState.uiOptions.forcedROMode)
|
||||||
? [EditorView.editable.of(false)]
|
? [EditorView.editable.of(false)]
|
||||||
: [],
|
: [],
|
||||||
],
|
],
|
||||||
|
|
|
@ -38,6 +38,7 @@ export class MainUI {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log("Delegated keydown", ev, "to editor");
|
console.log("Delegated keydown", ev, "to editor");
|
||||||
|
client.focus();
|
||||||
if (runScopeHandlers(client.editorView, ev, "editor")) {
|
if (runScopeHandlers(client.editorView, ev, "editor")) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue