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-09-09 22:15:22 +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
|
|
|
|
|
| Command | Options | Description |
|
2020-08-19 03:39:41 +08:00
|
|
|
|
| ------ | ---- | ---------------- |
|
2020-08-21 03:25:15 +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: [
|
2020-09-09 16:58:10 +08:00
|
|
|
|
Strike(),
|
2020-08-19 03:39:41 +08:00
|
|
|
|
],
|
|
|
|
|
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>
|
|
|
|
|
```
|