@mocanvas/editor · class
declare class UserPreferencesManagerReads preferences with the editor's defaults applied, and writes them back through whoever owns them.
Every getter resolves in the same order: the value the CurrentUser
carries, then the editor-level fallback passed to the constructor (for
colorScheme only), then USER_PREFERENCES_DEFAULTS. The controlled
user therefore always wins over an editor option — which is the point of
controlling it.
The getters read a signal, so calling them inside a computed or react
subscribes to preference changes.
On this page
Methods · 21
constructor(user: CurrentUser,getAnimationSpeed(): numberHow fast the editor animates; 0 means "do not animate".
A user who has expressed no preference inherits the operating system's,
the same way colorScheme: "system" does. Reduced motion is an
accessibility setting people set once, for every application, and an
editor that ignored it until it was told a second time would be reading
the setting and then disregarding it.
getAreKeyboardShortcutsEnabled(): booleangetColor(): stringgetColorScheme(): ColorSchemeThe scheme actually in force: the user's, else the editor's, else "system".
getEdgeScrollSpeed(): numbergetId(): UserIdgetIsDarkMode(): booleangetColorScheme with "system" resolved against the OS setting.
getIsDynamicResizeMode(): booleanAlias of getIsDynamicSizeMode. The preference is spelled
"dynamic resize mode" at some call sites and "dynamic size mode" at
others; both names read the one setting.
getIsDynamicSizeMode(): booleangetIsEnhancedA11yMode(): booleangetIsPasteAtCursorMode(): booleangetIsSnapMode(): booleangetIsWrapMode(): booleangetLocale(): stringgetName(): stringgetUserPreferences(): UserPreferencesStateThe raw preferences object, exactly as its owner holds it.
setColor(color: string): voidsetName(name: string): voidsetUserPreferences(next: UserPreferencesState): voidReplace the whole object.
updateUserPreferences(patch: Partial<UserPreferencesState>): voidMerge patch into the current preferences and hand the result to the owner.
Properties · 1
colorScheme?: ColorScheme | null)The editor-level fallback, used only when the user has no colorScheme of their own.
Mentioned here
mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.