-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(font-control): uses native font enumeration (#804)
* refactor(font-control): uses native font enumeration slightly reduces jank when enumerating the font list.adds fuzzy searching to font list. updates electron. * refactor(font-control): moves font initialisation to modV setup Fixes bad SCSS rewrite from #583 * fix: scroll font-list to top when typing * fix: use font-family only
- Loading branch information
Showing
5 changed files
with
93 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const state = { | ||
defaultFonts: ["serif", "sans-serif", "cursive", "monospace"], | ||
localFonts: [] | ||
}; | ||
|
||
const getters = { | ||
fonts: state => [ | ||
...state.defaultFonts, | ||
...state.localFonts | ||
.filter( | ||
(value, index, self) => | ||
index === self.findIndex(t => t.family === value.family) | ||
) | ||
.map(font => font.family) | ||
.sort((a, b) => a.localeCompare(b)) | ||
] | ||
}; | ||
|
||
const mutations = { | ||
SET_LOCAL_FONTS(state, fonts = []) { | ||
state.localFonts = fonts; | ||
} | ||
}; | ||
|
||
export default { | ||
namespaced: true, | ||
state, | ||
getters, | ||
mutations | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters