tiptap/docs/src/docPages/api/extensions/strike.md

59 lines
1.2 KiB
Markdown
Raw Normal View History

2020-08-19 03:39:41 +08:00
# Strike
2020-08-20 21:33:16 +08:00
Enables you to use the `<s>` HTML tag in the editor.
2020-08-19 03:39:41 +08:00
2020-08-20 21:33:16 +08:00
## Options
2020-08-19 03:39:41 +08:00
*None*
2020-08-20 21:33:16 +08:00
## Commands
| Command | Options | Description |
2020-08-19 03:39:41 +08:00
| ------ | ---- | ---------------- |
| strike | — | Mark text as strikethrough. |
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
* Windows & Linux: `Control` + `D`
* macOS: `Command` + `D`
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" :class="{ 'is-active': isActive.strike() }" @click="commands.strike">
Strike
</button>
</editor-menu-bar>
<editor-content :editor="editor" />
</div>
</template>
<script>
import { Editor, EditorContent, EditorMenuBar } from 'tiptap'
import { Strike } from 'tiptap-extensions'
export default {
components: {
EditorMenuBar,
EditorContent,
},
data() {
return {
editor: new Editor({
extensions: [
new Strike(),
],
content: `
<p><s>That's strikethrough.</s></p>
<p><del>This too.</del></p>
<p><strike>And this.</strike></p>
<p style="text-decoration: line-through">This as well.</p>
`,
}),
}
},
beforeDestroy() {
this.editor.destroy()
}
}
</script>
```