add a demo to the bullet list extension page
This commit is contained in:
12
docs/src/demos/Extensions/BulletList/index.spec.js
Normal file
12
docs/src/demos/Extensions/BulletList/index.spec.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
context('/api/extensions/bullet-list', () => {
|
||||||
|
before(() => {
|
||||||
|
cy.visit('/api/extensions/bullet-list')
|
||||||
|
})
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||||
|
editor.setContent('<p>Example Text</p>')
|
||||||
|
editor.selectAll()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
55
docs/src/demos/Extensions/BulletList/index.vue
Normal file
55
docs/src/demos/Extensions/BulletList/index.vue
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<template>
|
||||||
|
<div v-if="editor">
|
||||||
|
<!-- <button @click="editor.focus().bulletList()" :class="{ 'is-active': editor.isActive('bulletList') }">
|
||||||
|
bullet list
|
||||||
|
</button> -->
|
||||||
|
|
||||||
|
<editor-content :editor="editor" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { Editor } from '@tiptap/core'
|
||||||
|
import { EditorContent } from '@tiptap/vue'
|
||||||
|
import Document from '@tiptap/extension-document'
|
||||||
|
import Paragraph from '@tiptap/extension-paragraph'
|
||||||
|
import Text from '@tiptap/extension-text'
|
||||||
|
import BulletList from '@tiptap/extension-bullet-list'
|
||||||
|
import ListItem from '@tiptap/extension-list-item'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
EditorContent,
|
||||||
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
editor: null,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.editor = new Editor({
|
||||||
|
extensions: [
|
||||||
|
Document(),
|
||||||
|
Paragraph(),
|
||||||
|
Text(),
|
||||||
|
BulletList(),
|
||||||
|
ListItem(),
|
||||||
|
],
|
||||||
|
content: `
|
||||||
|
<ul>
|
||||||
|
<li>A list item</li>
|
||||||
|
<li>And another one</li>
|
||||||
|
</ul>
|
||||||
|
`,
|
||||||
|
})
|
||||||
|
|
||||||
|
window.editor = this.editor
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeDestroy() {
|
||||||
|
this.editor.destroy()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -18,47 +18,8 @@ It’s intended to be used with the `ListItem` extension.
|
|||||||
## Keyboard shortcuts
|
## Keyboard shortcuts
|
||||||
* `Control` + `Shift` + `8`
|
* `Control` + `Shift` + `8`
|
||||||
|
|
||||||
|
## Source Code
|
||||||
|
[packages/extension-bullet-list/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-bullet-list/)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
```markup
|
<demo name="Extensions/BulletList" highlight="3-5,17-18,37-38" />
|
||||||
<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: [
|
|
||||||
BulletList(),
|
|
||||||
],
|
|
||||||
content: `
|
|
||||||
<ul>
|
|
||||||
<li>A list item</li>
|
|
||||||
<li>And another one</li>
|
|
||||||
</ul>
|
|
||||||
`,
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
},
|
|
||||||
beforeDestroy() {
|
|
||||||
this.editor.destroy()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
```
|
|
||||||
|
|||||||
Reference in New Issue
Block a user