2020-08-19 03:39:41 +08:00
|
|
|
|
# BulletList
|
2020-08-20 21:33:16 +08:00
|
|
|
|
This extension enables you to use the `<ul>` HTML tag in the editor.
|
2020-08-19 03:39:41 +08:00
|
|
|
|
|
|
|
|
|
::: warning Restrictions
|
2020-08-20 21:33:16 +08:00
|
|
|
|
It’s intended to be used with the `ListItem` extension.
|
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
|
|
|
|
| ------ | ---- | ---------------- |
|
|
|
|
|
| bullet_list | none | Toggle a bullet list. |
|
|
|
|
|
|
2020-08-20 21:33:16 +08:00
|
|
|
|
## Keybindings
|
2020-08-19 03:39:41 +08:00
|
|
|
|
* `Control` + `Shift` + `8`
|
|
|
|
|
|
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.bullet_list() }" @click="commands.bullet_list">
|
|
|
|
|
Bullet List
|
|
|
|
|
</button>
|
|
|
|
|
</editor-menu-bar>
|
|
|
|
|
|
|
|
|
|
<editor-content :editor="editor" />
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { Editor, EditorContent, EditorMenuBar } from 'tiptap'
|
|
|
|
|
import { BulletList } from 'tiptap-extensions'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
EditorMenuBar,
|
|
|
|
|
EditorContent,
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
editor: new Editor({
|
|
|
|
|
extensions: [
|
|
|
|
|
new BulletList(),
|
|
|
|
|
],
|
|
|
|
|
content: `
|
|
|
|
|
<ul>
|
|
|
|
|
<li>A list item</li>
|
|
|
|
|
<li>And another one</li>
|
|
|
|
|
</ul>
|
|
|
|
|
`,
|
|
|
|
|
}),
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
beforeDestroy() {
|
|
|
|
|
this.editor.destroy()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
```
|