feat: per-note spellcheck (#815)

* feat: per-note spellcheck control

* fix: remove fill from svg

* feat: move spellcheck pref into defaults preferences section

* fix: use faded css class instead of opacity

* feat: plus editor 1.6.0
This commit is contained in:
Mo
2022-01-14 14:32:16 -06:00
committed by GitHub
parent 2b12f7f0e9
commit 063c3b2fee
15 changed files with 265 additions and 106 deletions

View File

@@ -201,6 +201,8 @@ export class NoteView extends PureViewCtrl<unknown, EditorState> {
this.editorValues.text = note.text;
}
this.reloadSpellcheck();
const isTemplateNoteInsertedToBeInteractableWithEditor =
source === PayloadSource.Constructor && note.dirty;
if (isTemplateNoteInsertedToBeInteractableWithEditor) {
@@ -694,29 +696,35 @@ export class NoteView extends PureViewCtrl<unknown, EditorState> {
this.application.sync();
}
async reloadPreferences() {
const monospaceFont = this.application.getPreference(
PrefKey.EditorMonospaceEnabled,
true
);
const spellcheck = this.application.getPreference(
PrefKey.EditorSpellcheck,
true
);
const marginResizersEnabled = this.application.getPreference(
PrefKey.EditorResizersEnabled,
true
);
async reloadSpellcheck() {
const spellcheck = this.appState.notes.getSpellcheckStateForNote(this.note);
if (spellcheck !== this.state.spellcheck) {
await this.setState({ textareaUnloading: true });
await this.setState({ textareaUnloading: false });
this.reloadFont();
await this.setState({
spellcheck,
});
}
}
async reloadPreferences() {
const monospaceFont = this.application.getPreference(
PrefKey.EditorMonospaceEnabled,
true
);
const marginResizersEnabled = this.application.getPreference(
PrefKey.EditorResizersEnabled,
true
);
await this.reloadSpellcheck();
await this.setState({
monospaceFont,
spellcheck,
marginResizersEnabled,
});