tiptap/docs/api/extensions/font-family.md
2021-11-09 11:56:27 +01:00

1.4 KiB
Raw Blame History

description
Doesnt have support for Comic Sans, but for all other fonts.

FontFamily

Version Downloads

This extension enables you to set the font family in the editor. It uses the TextStyle mark, which renders a <span> tag. The font family is applied as inline style, for example <span style="font-family: Arial">.

Installation

npm install @tiptap/extension-text-style @tiptap/extension-font-family

This extension requires the TextStyle mark.

Settings

types

A list of marks to which the font family attribute should be applied to.

Default: ['textStyle']

FontFamily.configure({
  types: ['textStyle'],
})

Commands

setFontFamily()

Applies the given font family as inline style.

editor.commands.setFontFamily('Inter')

unsetFontFamily()

Removes any font family.

editor.commands.unsetFontFamily()

Source code

packages/extension-font-family/

Usage

https://embed.tiptap.dev/preview/Extensions/FontFamily