tiptap/docs/src/docPages/api/extensions/underline.md
2020-09-10 10:21:24 +02:00

59 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Underline
Enables you to use the `<u>` HTML tag in the editor.
## Options
| Option | Type | Default | Description |
| ------ | ------ | ------- | -------------------------------------------- |
| class | string | | Add a custom class to the rendered HTML tag. |
## Commands
| Command | Options | Description |
| --------- | ------- | ------------------------ |
| underline | — | Mark text as underlined. |
## Keybindings
* Windows & Linux: `Control` + `U`
* macOS: `Command` + `U`
## Usage
```markup
<template>
<div>
<editor-menu-bar :editor="editor" v-slot="{ commands, isActive }">
<button type="button" :class="{ 'is-active': isActive.underline() }" @click="commands.underline">
Underline
</button>
</editor-menu-bar>
<editor-content :editor="editor" />
</div>
</template>
<script>
import { Editor, EditorContent, EditorMenuBar } from 'tiptap'
import { Underline } from 'tiptap-extensions'
export default {
components: {
EditorMenuBar,
EditorContent,
},
data() {
return {
editor: new Editor({
extensions: [
Underline(),
],
content: `
<p><u>This is underlined.</u></p>
<p style="text-decoration: underline">This as well.</p>
`,
}),
}
},
beforeDestroy() {
this.editor.destroy()
}
}
</script>
```