main.js
This commit is contained in:
parent
69656e0181
commit
c9dede920e
4 changed files with 133 additions and 26 deletions
29
src/lib/style.js
Normal file
29
src/lib/style.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import { applyStyleConfig } from 'src/services/style_setter/style_setter.js'
|
||||
|
||||
const APPEARANCE_SETTINGS_KEYS = new Set(
|
||||
[
|
||||
'sidebarColumnWidth',
|
||||
'contentColumnWidth',
|
||||
'notifsColumnWidth',
|
||||
'themeEditorMinWidth',
|
||||
'textSize',
|
||||
'navbarSize',
|
||||
'panelHeaderSize',
|
||||
'forcedRoundness',
|
||||
'emojiSize',
|
||||
'emojiReactionsScale',
|
||||
].map((x) => 'simple.' + x),
|
||||
)
|
||||
|
||||
export const piniaStylePlugin = ({ store, options }) => {
|
||||
if (store.$id === 'sync_config') {
|
||||
store.$onAction(({ name, args, after }) => {
|
||||
if (name === 'setPreference') {
|
||||
const { path } = args[0]
|
||||
if (APPEARANCE_SETTINGS_KEYS.has(path)) {
|
||||
after(() => applyStyleConfig(store.mergedConfig))
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue