add some content to the link extension page

This commit is contained in:
Hans Pagel 2020-09-23 12:39:09 +02:00
parent 318172741b
commit c85064d229
3 changed files with 73 additions and 0 deletions

View File

@ -0,0 +1,12 @@
context('/api/extensions/link', () => {
before(() => {
cy.visit('/api/extensions/link')
})
beforeEach(() => {
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.setContent('<p>Example Text</p>')
editor.selectAll()
})
})
})

View File

@ -0,0 +1,46 @@
<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'
// import Link from '@tiptap/extension-link'
export default {
components: {
EditorContent,
},
data() {
return {
editor: null,
}
},
mounted() {
this.editor = new Editor({
extensions: [
Document(),
Paragraph(),
Text(),
// Link(),
],
content: `
<p>
Try to add some links to the <a href="https://en.wikipedia.org/wiki/World_Wide_Web">world wide web</a>. By default every link will get a <code>rel="noopener noreferrer nofollow"</code> attribute.
</p>
`,
})
},
beforeDestroy() {
this.editor.destroy()
}
}
</script>

View File

@ -15,3 +15,18 @@ yarn add @tiptap/extension-link
| ----------- | ------- | ------- | -------------------------------------------- |
| class | string | | Add a custom class to the rendered HTML tag. |
| openOnClick | Boolean | true | Specifies if links will be opened on click. |
## Commands
| Command | Options | Description |
| ------- | ------- | ----------------------- |
| link | — | Link the selected text. |
## Keyboard shortcuts
* Windows & Linux: `Control` + `K`
* macOS: `Command` + `K`
## Source code
[packages/extension-link/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-link/)
## Usage
<demo name="Extensions/Link" highlight="" />