mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
fix(ui): keep the voice highlight on layer rows
Toggle the count-line modifier with a directive that leaves other classes alone, so a re-render no longer clears gev-voice-focus.
This commit is contained in:
1 parent
231ac4b67b
commit
dc9d200725
4 files changed
+65
-4
No files matched your search
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* `v-class-toggle`: toggles each named class with `classList`, so classes other
|
||||
* code adds to the element (a voice highlight) survive a re-render. A `:class`
|
||||
* binding rewrites the whole `className` instead.
|
||||
*/
|
||||
const apply = (el, { value }) => {
|
||||
for (const [name, on] of Object.entries(value || {}))
|
||||
if (el.classList.contains(name) !== Boolean(on))
|
||||
el.classList.toggle(name, Boolean(on));
|
||||
};
|
||||
export const vClassToggle = { mounted: apply, updated: apply };
|
||||
Reference in new issue
Block a user