logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git
commit: 4d3d07515163bfba4304bd22f9ed7f90d32cea28
parent 665faf892a418fa1e7aeda1d1c82d926a2ed4f3a
Author: Henry Jameson <me@hjkos.com>
Date:   Sun, 21 Jul 2024 23:45:21 +0300

fix font selector losing list of local fonts when selecting one

Diffstat:

Msrc/components/font_control/font_control.js5+++--
Msrc/components/font_control/font_control.vue2+-
Msrc/modules/interface.js3++-
3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/components/font_control/font_control.js b/src/components/font_control/font_control.js @@ -50,10 +50,11 @@ export default { return typeof this.modelValue !== 'undefined' }, localFontsList () { - return this.$store.state.interface.localFonts?.values() + console.log('FONTLIST', this.$store.state.interface.localFonts?.values()) + return this.$store.state.interface.localFonts }, localFontsSize () { - return this.$store.state.interface.localFonts?.size + return this.$store.state.interface.localFonts?.length } } } diff --git a/src/components/font_control/font_control.vue b/src/components/font_control/font_control.vue @@ -82,7 +82,7 @@ </button> <Select :id="name + '-local-font-switcher'" - :model-value="modelValue.family" + :model-value="modelValue?.family" class="custom-font" @update:modelValue="v => $emit('update:modelValue', { ...(modelValue || {}), family: v })" > diff --git a/src/modules/interface.js b/src/modules/interface.js @@ -112,7 +112,8 @@ const interfaceMod = { state.lastTimeline = value }, setFontsList (state, value) { - state.localFonts = new Set(value.map(font => font.family)) + // Set is used here so that we filter out duplicate fonts (possibly same font but with different weight) + state.localFonts = [...(new Set(value.map(font => font.family))).values()] } }, actions: {