feat: Replaced margin resizers with "Editor width" options. You can set it globally from Preferences > Appearance or per-note from the note options menu (#2324)

This commit is contained in:
Aman Harwara
2023-05-04 17:42:16 +05:30
committed by GitHub
parent 488142683c
commit 9fbb845b1d
18 changed files with 403 additions and 84 deletions

View File

@@ -10,6 +10,7 @@ import {
InternalEventBus,
PrefKey,
ApplicationEvent,
EditorLineWidth,
} from '@standardnotes/snjs'
import { makeObservable, observable, action, computed, runInAction } from 'mobx'
import { WebApplication } from '../../Application/WebApplication'
@@ -358,6 +359,23 @@ export class NotesController extends AbstractViewController implements NotesCont
this.application.sync.sync().catch(console.error)
}
getEditorWidthForNote(note: SNNote) {
return (
note.editorWidth ?? this.application.getPreference(PrefKey.EditorLineWidth, PrefDefaults[PrefKey.EditorLineWidth])
)
}
async setNoteEditorWidth(note: SNNote, editorWidth: EditorLineWidth) {
await this.application.mutator.changeItem<NoteMutator>(
note,
(mutator) => {
mutator.editorWidth = editorWidth
},
false,
)
this.application.sync.sync().catch(console.error)
}
async addTagToSelectedNotes(tag: SNTag): Promise<void> {
const selectedNotes = this.getSelectedNotesList()
await Promise.all(