Edito tweaks (auto correct on)
parent
7e221ce5aa
commit
35dc75d94e
|
@ -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!;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue