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:
@@ -5,6 +5,7 @@ import { DecryptedItem } from '../../Abstract/Item/Implementations/DecryptedItem
|
||||
import { ItemInterface } from '../../Abstract/Item/Interfaces/ItemInterface'
|
||||
import { DecryptedPayloadInterface } from '../../Abstract/Payload/Interfaces/DecryptedPayload'
|
||||
import { NoteContent, NoteContentSpecialized } from './NoteContent'
|
||||
import { EditorLineWidth } from '../UserPrefs'
|
||||
|
||||
export const isNote = (x: ItemInterface): x is SNNote => x.content_type === ContentType.Note
|
||||
|
||||
@@ -15,6 +16,7 @@ export class SNNote extends DecryptedItem<NoteContent> implements NoteContentSpe
|
||||
public readonly preview_plain: string
|
||||
public readonly preview_html: string
|
||||
public readonly spellcheck?: boolean
|
||||
public readonly editorWidth?: EditorLineWidth
|
||||
public readonly noteType?: NoteType
|
||||
public readonly authorizedForListed: boolean
|
||||
|
||||
@@ -30,6 +32,7 @@ export class SNNote extends DecryptedItem<NoteContent> implements NoteContentSpe
|
||||
this.preview_plain = String(this.payload.content.preview_plain || '')
|
||||
this.preview_html = String(this.payload.content.preview_html || '')
|
||||
this.spellcheck = this.payload.content.spellcheck
|
||||
this.editorWidth = this.payload.content.editorWidth
|
||||
this.noteType = this.payload.content.noteType
|
||||
this.editorIdentifier = this.payload.content.editorIdentifier
|
||||
this.authorizedForListed = this.payload.content.authorizedForListed || false
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { FeatureIdentifier, NoteType } from '@standardnotes/features'
|
||||
import { ItemContent } from '../../Abstract/Content/ItemContent'
|
||||
import { EditorLineWidth } from '../UserPrefs'
|
||||
|
||||
export interface NoteContentSpecialized {
|
||||
title: string
|
||||
@@ -8,6 +9,7 @@ export interface NoteContentSpecialized {
|
||||
preview_plain?: string
|
||||
preview_html?: string
|
||||
spellcheck?: boolean
|
||||
editorWidth?: EditorLineWidth
|
||||
noteType?: NoteType
|
||||
editorIdentifier?: FeatureIdentifier | string
|
||||
authorizedForListed?: boolean
|
||||
|
||||
@@ -5,6 +5,7 @@ import { NoteToNoteReference } from '../../Abstract/Reference/NoteToNoteReferenc
|
||||
import { ContentType } from '@standardnotes/common'
|
||||
import { ContentReferenceType } from '../../Abstract/Item'
|
||||
import { FeatureIdentifier, NoteType } from '@standardnotes/features'
|
||||
import { EditorLineWidth } from '../UserPrefs'
|
||||
|
||||
export class NoteMutator extends DecryptedItemMutator<NoteContent> {
|
||||
set title(title: string) {
|
||||
@@ -31,6 +32,10 @@ export class NoteMutator extends DecryptedItemMutator<NoteContent> {
|
||||
this.mutableContent.spellcheck = spellcheck
|
||||
}
|
||||
|
||||
set editorWidth(editorWidth: EditorLineWidth) {
|
||||
this.mutableContent.editorWidth = editorWidth
|
||||
}
|
||||
|
||||
set noteType(noteType: NoteType) {
|
||||
this.mutableContent.noteType = noteType
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ export enum PrefKey {
|
||||
EditorSpellcheck = 'spellcheck',
|
||||
EditorResizersEnabled = 'marginResizersEnabled',
|
||||
EditorLineHeight = 'editorLineHeight',
|
||||
EditorLineWidth = 'editorLineWidth',
|
||||
EditorFontSize = 'editorFontSize',
|
||||
SortNotesBy = 'sortBy',
|
||||
SortNotesReverse = 'sortReverse',
|
||||
@@ -65,6 +66,13 @@ export enum EditorLineHeight {
|
||||
Loose = 'Loose',
|
||||
}
|
||||
|
||||
export enum EditorLineWidth {
|
||||
Narrow = 'Narrow',
|
||||
Wide = 'Wide',
|
||||
Dynamic = 'Dynamic',
|
||||
FullWidth = 'FullWidth',
|
||||
}
|
||||
|
||||
export enum EditorFontSize {
|
||||
ExtraSmall = 'ExtraSmall',
|
||||
Small = 'Small',
|
||||
@@ -107,6 +115,7 @@ export type PrefValue = {
|
||||
[PrefKey.NewNoteTitleFormat]: NewNoteTitleFormat
|
||||
[PrefKey.CustomNoteTitleFormat]: string
|
||||
[PrefKey.EditorLineHeight]: EditorLineHeight
|
||||
[PrefKey.EditorLineWidth]: EditorLineWidth
|
||||
[PrefKey.EditorFontSize]: EditorFontSize
|
||||
[PrefKey.UpdateSavingStatusIndicator]: boolean
|
||||
[PrefKey.DarkMode]: boolean
|
||||
|
||||
Reference in New Issue
Block a user