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

@@ -281,6 +281,18 @@ export class AppState {
}
}
isGlobalSpellcheckEnabled(): boolean {
return this.application.getPreference(PrefKey.EditorSpellcheck, true);
}
async toggleGlobalSpellcheck() {
const currentValue = this.isGlobalSpellcheckEnabled();
return this.application.setPreference(
PrefKey.EditorSpellcheck,
!currentValue
);
}
private tagChangedNotifier(): IReactionDisposer {
return reaction(
() => this.tags.selectedUuid,

View File

@@ -378,6 +378,23 @@ export class NotesState {
this.selectedNotes = {};
}
getSpellcheckStateForNote(note: SNNote) {
return note.spellcheck != undefined
? note.spellcheck
: this.appState.isGlobalSpellcheckEnabled();
}
async toggleGlobalSpellcheckForNote(note: SNNote) {
await this.application.changeItem<NoteMutator>(
note.uuid,
(mutator) => {
mutator.toggleSpellcheck();
},
false
);
this.application.sync();
}
async addTagToSelectedNotes(tag: SNTag): Promise<void> {
const selectedNotes = Object.values(this.selectedNotes);
const parentChainTags = this.application.getTagParentChain(tag);