Custom format font-family has double double quotes on getFormat
See original GitHub issueHi,
There is a formatting issue with quill.getFormat(quill.selection.savedRange)
If you declare a custom font-family, the format retrieve by the getFormat method as describe before is surrounded by 2 double quotes, like this :
I could modify it with a .replace(/"/g, '')
to use it manually, but, the ql-picker
are broken because I don’t have the hand on it, it takes a select
and replace it by is own cooked version using the format object to handle the “selected” item.
Here is my custom font-family declaration if needed :
const Parchment = Quill.import('parchment')
const getConf = (scopeName: string, whitelistValue: string[]): any => {
return {
scope: Parchment.Scope[scopeName],
whitelist: whitelistValue
}
}
const customFontFamily = new Parchment.Attributor.Style(
'customFontFamily', 'font-family', getConf('INLINE', availableFonts)
)
Quill.register(customFontFamily, true)
Notes :
-
All my other custom formats works fine I’ve got lineHeightStyle, letterSpacingStyle, colorStyle, bottomSpaceStyle, customSize, textAlignStyle
-
I’ve tried different way to format the inline style On the default content loaded to the editor I’ve tried to declare the font-family with simple quotes or without any quotes.
-
availableFonts My
availableFonts
variable is an array of strings declared with single quoted string like
export const availableFonts = [
'Memimas-Bold',
'Neutraface Display Bold',
'MrsEavesRoman',
'GeosansLight',
'Neutraface Display Medium',
'TriplexSansLight',
'MrsEavesBold',
'Caviar Dreams',
'Amandine',
'Annabel Script',
'Comiquita Sans',
...
]
- I did research on issues By searching in issues I found some topics a bit similar (but not precisely related to this case) so it could be a know issue actually.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
there are actually many issues with font names: font families got wiped out, font names with digits don’t apply etc. Those parts of the code need more improvements
@jhchen @benbro Up.