1
0

Edito tweaks (auto correct on)

This commit is contained in:
Zef Hemel
2022-05-09 10:45:36 +02:00
parent 7e221ce5aa
commit 35dc75d94e
2 changed files with 12 additions and 3 deletions
+8 -2
View File
@@ -439,7 +439,7 @@ export class Editor {
this.createEditorState(this.currentPage, editorView.state.sliceDoc())
);
if (editorView.contentDOM) {
editorView.contentDOM.spellcheck = true;
this.tweakEditorDOM(editorView.contentDOM);
}
this.restoreState(this.currentPage);
@@ -508,7 +508,7 @@ export class Editor {
let editorState = this.createEditorState(pageName, doc.text);
editorView.setState(editorState);
if (editorView.contentDOM) {
editorView.contentDOM.spellcheck = true;
this.tweakEditorDOM(editorView.contentDOM);
}
this.restoreState(pageName);
this.space.watchPage(pageName);
@@ -521,6 +521,12 @@ export class Editor {
await this.eventHook.dispatchEvent("editor:pageSwitched");
}
tweakEditorDOM(contentDOM: HTMLElement) {
contentDOM.spellcheck = true;
contentDOM.setAttribute("autocorrect", "on");
contentDOM.setAttribute("autocapitalize", "on");
}
private restoreState(pageName: string) {
let pageState = this.openPages.get(pageName);
const editorView = this.editorView!;
+4 -1
View File
@@ -54,7 +54,10 @@ export function editorSyscalls(editor: Editor): SysCallMapping {
await editor.reloadPage();
},
"editor.openUrl": async (ctx, url: string) => {
window.open(url, "_blank")!.focus();
let win = window.open(url, "_blank");
if (win) {
win.focus();
}
},
"editor.flashNotification": (ctx, message: string) => {
editor.flashNotification(message);