add the strike extension documentation

This commit is contained in:
Hans Pagel
2020-09-10 11:53:03 +02:00
parent 236ad6e21a
commit 868ffb4d66
5 changed files with 72 additions and 46 deletions

View File

@@ -1,5 +1,5 @@
# Bold
This extension is used to render text in **bold**. If you pass `<strong>`, `<b>` tags, or text with inline `style` attributes setting the `font-weight` CSS rule in the editors initial content, they will all be rendered accordingly.
This extension is used to render text in **bold**. If you pass `<strong>`, `<b>` tags, or text with inline `style` attributes setting the `font-weight` CSS rule in the editors initial content, they all will be rendered accordingly.
Type `**two asterisks**` or `__two underlines__` and the it will be magically transformed to **bold** text while you type.

View File

@@ -1,5 +1,5 @@
# Italic
This extension is used to render text in *italic*. If you pass `<em>`, `<i>` tags, or text with inline `style` attributes setting `font-style: italic` in the editors initial content, they will all be rendered accordingly.
This extension is used to render text in *italic*. If you pass `<em>`, `<i>` tags, or text with inline `style` attributes setting `font-style: italic` in the editors initial content, they all will be rendered accordingly.
::: warning Restrictions
The extension will generate the corresponding `<em>` HTML tags when reading contents of the `Editor` instance. All text marked italic, regardless of the method will be normalized to `<em>` HTML tags.

View File

@@ -1,5 +1,11 @@
# Strike
Enables you to use the `<s>` HTML tag in the editor.
This extension is used to render ~~striked text~~. If you pass `<s>`, `<del>`, `<strike>` tags, or text with inline `style` attributes setting `text-decoration: line-through` in the editors initial content, they all will be rendered accordingly.
Type `~~two tildes~~` and the it will be magically ~~striked through~~ while you type.
::: warning Restrictions
The extension will generate the corresponding `<s>` HTML tags when reading contents of the `Editor` instance. All text striked through, regardless of the method will be normalized to `<s>` HTML tags.
:::
## Options
| Option | Type | Default | Description |
@@ -15,47 +21,8 @@ Enables you to use the `<s>` HTML tag in the editor.
* Windows & Linux: `Control` + `D`
* macOS: `Command` + `D`
## Source Code
[packages/extension-strike/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-strike/)
## Usage
```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: [
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>
```
<demo name="Extensions/Strike" highlight="3-5,17,36" />