mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-25 12:39:03 +08:00
add some content to the link extension page
This commit is contained in:
parent
318172741b
commit
c85064d229
12
docs/src/demos/Extensions/Link/index.spec.js
Normal file
12
docs/src/demos/Extensions/Link/index.spec.js
Normal 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()
|
||||
})
|
||||
})
|
||||
})
|
46
docs/src/demos/Extensions/Link/index.vue
Normal file
46
docs/src/demos/Extensions/Link/index.vue
Normal 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>
|
@ -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="" />
|
Loading…
Reference in New Issue
Block a user