Add tab reordering, sidebar resize and collapse, and outline panel
- Drag tabs to reorder; context menu to close, close others, close right - Resizable sidebar width (synced setting), collapsible with Mod+\ - Outline panel (Mod+Shift+O): right column on desktop, overlay on mobile - Mobile: title opens quick switcher, swipe left closes the drawer, 44px touch targets
This commit is contained in:
1 parent
91da6e116e
commit
64915a7b94
7 files changed
+322
-15
No files matched your search
@@ -12,7 +12,9 @@ export const CONTENT_WIDTHS = [
|
||||
{ label: '全宽', value: 0 },
|
||||
]
|
||||
|
||||
const DEFAULTS = { fontSize: 16, contentWidth: 760 }
|
||||
export const SIDEBAR_WIDTH = { min: 200, max: 480 }
|
||||
|
||||
const DEFAULTS = { fontSize: 16, contentWidth: 760, sidebarWidth: 260 }
|
||||
export type Settings = typeof DEFAULTS
|
||||
|
||||
const CACHE_KEY = 'rawmark.settings'
|
||||
@@ -29,6 +31,10 @@ function sanitize(raw: Record<string, unknown>): Settings {
|
||||
CONTENT_WIDTHS.map((w) => w.value),
|
||||
DEFAULTS.contentWidth,
|
||||
),
|
||||
sidebarWidth:
|
||||
Number.isInteger(raw.sidebarWidth) && (raw.sidebarWidth as number) >= SIDEBAR_WIDTH.min && (raw.sidebarWidth as number) <= SIDEBAR_WIDTH.max
|
||||
? (raw.sidebarWidth as number)
|
||||
: DEFAULTS.sidebarWidth,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +44,7 @@ function applied(next: Settings) {
|
||||
const root = document.documentElement.style
|
||||
root.setProperty('--rm-font-size', settings.fontSize + 'px')
|
||||
root.setProperty('--rm-content-width', settings.contentWidth ? settings.contentWidth + 'px' : 'none')
|
||||
root.setProperty('--rm-sidebar-width', settings.sidebarWidth + 'px')
|
||||
}
|
||||
|
||||
applied({ ...settings })
|
||||
|
||||
Reference in new issue
Block a user