2020-08-19 03:39:41 +08:00
|
|
|
|
# HorizontalRule
|
2020-08-20 21:33:16 +08:00
|
|
|
|
Enables you to use the `<hr>` HTML tag in the editor.
|
2020-08-19 03:39:41 +08:00
|
|
|
|
|
2020-08-20 21:33:16 +08:00
|
|
|
|
## Options
|
2020-09-10 16:21:24 +08:00
|
|
|
|
| Option | Type | Default | Description |
|
|
|
|
|
| ------ | ------ | ------- | -------------------------------------------- |
|
|
|
|
|
| class | string | – | Add a custom class to the rendered HTML tag. |
|
2020-08-19 03:39:41 +08:00
|
|
|
|
|
2020-08-20 21:33:16 +08:00
|
|
|
|
## Commands
|
2020-09-10 16:21:24 +08:00
|
|
|
|
| Command | Options | Description |
|
|
|
|
|
| --------------- | ------- | ------------------------- |
|
|
|
|
|
| horizontal_rule | — | Create a horizontal rule. |
|
2020-08-19 03:39:41 +08:00
|
|
|
|
|
2020-08-20 21:33:16 +08:00
|
|
|
|
## Keybindings
|
2020-08-19 03:39:41 +08:00
|
|
|
|
*None*
|
|
|
|
|
|
2020-08-20 21:33:16 +08:00
|
|
|
|
## Usage
|
2020-08-19 03:39:41 +08:00
|
|
|
|
```markup
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<editor-menu-bar :editor="editor" v-slot="{ commands, isActive }">
|
|
|
|
|
<button type="button" @click="commands.horizontal_rule">
|
|
|
|
|
Horizontal Rule
|
|
|
|
|
</button>
|
|
|
|
|
</editor-menu-bar>
|
|
|
|
|
|
|
|
|
|
<editor-content :editor="editor" />
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { Editor, EditorContent, EditorMenuBar } from 'tiptap'
|
|
|
|
|
import { HorizontalRule } from 'tiptap-extensions'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
EditorMenuBar,
|
|
|
|
|
EditorContent,
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
editor: new Editor({
|
|
|
|
|
extensions: [
|
2020-09-09 16:58:10 +08:00
|
|
|
|
HorizontalRule(),
|
2020-08-19 03:39:41 +08:00
|
|
|
|
],
|
|
|
|
|
content: `
|
|
|
|
|
<p>Some text.</p>
|
|
|
|
|
<hr />
|
|
|
|
|
<p>Text again.</p>
|
|
|
|
|
`,
|
|
|
|
|
}),
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
beforeDestroy() {
|
|
|
|
|
this.editor.destroy()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
```
|