How to get the font size and font family of the current selected text in TipTap? #5236
Replies: 2 comments
-
@THPubs |
Beta Was this translation helpful? Give feedback.
0 replies
-
I have an array of fonts (listOfFontFamilies) that I check against the selection : this.currentFontFamily = this.listOfFontFamilies.find(font => this.editor.isActive('textStyle', {fontFamily: font})) || ''; Also see the warning (https://tiptap.dev/docs/editor/extensions/functionality/fontfamily ) : Be aware that editor.isActive('textStyle', { fontFamily: 'Font Family' }) will return the font family as set by the browser's CSS rules and not as you would have expected when setting the font family. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In TipTap how to get the attributes like font size and font family onSelectionUpdate? I'm trying to set the selected font in the font selection dropdown.
Beta Was this translation helpful? Give feedback.
All reactions