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:
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user