tiptap/docs/api/marks/text-style.md

31 lines
1.1 KiB
Markdown
Raw Normal View History

---
description: Useless extension, just adds <span> tags (required by other extensions though).
2021-10-16 04:48:57 +08:00
icon: palette-line
---
2020-11-06 23:39:30 +08:00
# TextStyle
2021-01-25 17:35:52 +08:00
[![Version](https://img.shields.io/npm/v/@tiptap/extension-text-style.svg?label=version)](https://www.npmjs.com/package/@tiptap/extension-text-style)
[![Downloads](https://img.shields.io/npm/dm/@tiptap/extension-text-style.svg)](https://npmcharts.com/compare/@tiptap/extension-text-style?minimal=true)
This mark renders a `<span>` HTML tag and enables you to add a list of styling related attributes, for example font-family, font-size, or color. The extension doesnt add any styling attribute by default, but other extensions use it as the foundation, for example [`FontFamily`](/api/extensions/font-family) or [`Color`](/api/extensions/color).
2020-11-06 21:46:59 +08:00
## Installation
```bash
npm install @tiptap/extension-text-style
```
2020-11-12 23:36:29 +08:00
## Commands
2021-10-02 05:25:07 +08:00
### removeEmptyTextStyle()
Remove `<span>` tags without an inline style.
```js
editor.command.removeEmptyTextStyle()
```
2020-11-12 23:36:29 +08:00
2020-11-06 21:46:59 +08:00
## Source code
2021-04-21 21:31:11 +08:00
[packages/extension-text-style/](https://github.com/ueberdosis/tiptap/blob/main/packages/extension-text-style/)
2020-11-06 21:46:59 +08:00
## Usage
2021-10-19 00:01:47 +08:00
https://embed.tiptap.dev/preview/Marks/TextStyle