write about the paragraph extension
This commit is contained in:
@@ -1,37 +1,5 @@
|
|||||||
context('/api/extensions/bold', () => {
|
context('/api/extensions/document', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.visit('/api/extensions/bold')
|
cy.visit('/api/extensions/document')
|
||||||
|
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
|
||||||
const { editor } = window
|
|
||||||
editor.setContent('<p>Example Text</p>')
|
|
||||||
editor.focus().selectAll()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('bold', () => {
|
|
||||||
it('the button should make the selected text bold', () => {
|
|
||||||
cy.get('.demo__preview button:first').click({ force: true })
|
|
||||||
cy.get('.ProseMirror').contains('strong', 'Example Text')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('the button should toggle the selected text bold', () => {
|
|
||||||
cy.get('.demo__preview button:first').dblclick({ force: true })
|
|
||||||
cy.get('.ProseMirror strong').should('not.exist')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('the keyboard shortcut should make the selected text bold', () => {
|
|
||||||
const shortcut = Cypress.platform === 'darwin' ? '{meta}b' : '{ctrl}b'
|
|
||||||
|
|
||||||
cy.get('.ProseMirror').type(shortcut, {force: true})
|
|
||||||
cy.get('.ProseMirror').contains('strong', 'Example Text')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('the keyboard shortcut should toggle the selected text bold', () => {
|
|
||||||
const shortcut = Cypress.platform === 'darwin' ? '{meta}b' : '{ctrl}b'
|
|
||||||
|
|
||||||
cy.get('.ProseMirror').type(shortcut, {force: true}).type(shortcut, {force: true})
|
|
||||||
cy.get('.ProseMirror strong').should('not.exist')
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
5
docs/src/demos/Extensions/Paragraph/index.spec.js
Normal file
5
docs/src/demos/Extensions/Paragraph/index.spec.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
context('/api/extensions/paragraph', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.visit('/api/extensions/paragraph')
|
||||||
|
})
|
||||||
|
})
|
||||||
44
docs/src/demos/Extensions/Paragraph/index.vue
Normal file
44
docs/src/demos/Extensions/Paragraph/index.vue
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<template>
|
||||||
|
<div v-if="editor">
|
||||||
|
<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'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
EditorContent,
|
||||||
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
editor: null,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.editor = new Editor({
|
||||||
|
extensions: [
|
||||||
|
new Document(),
|
||||||
|
new Paragraph(),
|
||||||
|
new Text(),
|
||||||
|
],
|
||||||
|
content: `
|
||||||
|
<p>The Paragraph extension is not required, but it’s very likely you want to use it. It’s needed to write paragraphs of text. 🤓</p>
|
||||||
|
`,
|
||||||
|
})
|
||||||
|
|
||||||
|
window.editor = this.editor
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeDestroy() {
|
||||||
|
this.editor.destroy()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -1,2 +1,17 @@
|
|||||||
# Paragraph
|
# Paragraph
|
||||||
Enables you to use paragraphs in the editor.
|
Enables you to use paragraphs in the editor.
|
||||||
|
|
||||||
|
## Options
|
||||||
|
*None*
|
||||||
|
|
||||||
|
## Commands
|
||||||
|
*None*
|
||||||
|
|
||||||
|
## Keybindings
|
||||||
|
*None*
|
||||||
|
|
||||||
|
## Source Code
|
||||||
|
[packages/extension-paragraph/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-paragraph/)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
<demo name="Extensions/Paragraph" highlight="11,29" />
|
||||||
|
|||||||
Reference in New Issue
Block a user