add content to the gapcursor page
This commit is contained in:
5
docs/src/demos/Extensions/Gapcursor/index.spec.js
Normal file
5
docs/src/demos/Extensions/Gapcursor/index.spec.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
context('/examples/gapcursor', () => {
|
||||||
|
before(() => {
|
||||||
|
cy.visit('/examples/gapcursor')
|
||||||
|
})
|
||||||
|
})
|
||||||
77
docs/src/demos/Extensions/Gapcursor/index.vue
Normal file
77
docs/src/demos/Extensions/Gapcursor/index.vue
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<editor-content :editor="editor" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { Editor, EditorContent } from '@tiptap/vue-starter-kit'
|
||||||
|
import Document from '@tiptap/extension-document'
|
||||||
|
import Paragraph from '@tiptap/extension-paragraph'
|
||||||
|
import Text from '@tiptap/extension-text'
|
||||||
|
import Gapcursor from '@tiptap/extension-focus'
|
||||||
|
import Image from '@tiptap/extension-image'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
EditorContent,
|
||||||
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
editor: null,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.editor = new Editor({
|
||||||
|
extensions: [
|
||||||
|
Document(),
|
||||||
|
Paragraph(),
|
||||||
|
Text(),
|
||||||
|
Image(),
|
||||||
|
Gapcursor(),
|
||||||
|
],
|
||||||
|
content: `
|
||||||
|
<p>Try to set the cursor behind the image!</p>
|
||||||
|
<img src="https://source.unsplash.com/8xznAGy4HcY/800x400" />
|
||||||
|
`,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeDestroy() {
|
||||||
|
this.editor.destroy()
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
/* Copied form the original prosemirror-gapcursor plugin by Marijn Haverbeke */
|
||||||
|
/* https://github.com/ProseMirror/prosemirror-gapcursor/blob/master/style/gapcursor.css */
|
||||||
|
|
||||||
|
.ProseMirror-gapcursor {
|
||||||
|
display: none;
|
||||||
|
pointer-events: none;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ProseMirror-gapcursor:after {
|
||||||
|
content: "";
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
top: -2px;
|
||||||
|
width: 20px;
|
||||||
|
border-top: 1px solid black;
|
||||||
|
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes ProseMirror-cursor-blink {
|
||||||
|
to {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ProseMirror-focused .ProseMirror-gapcursor {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,4 +1,7 @@
|
|||||||
# Gapcursor
|
# Gapcursor
|
||||||
|
This extension loads the [ProseMirror Gapcursor plugin](https://github.com/ProseMirror/prosemirror-gapcursor) by Marijn Haverbeke, which adds a gap for the cursor in places that don’t allow regular selection. For example, after a table at the end of a document.
|
||||||
|
|
||||||
|
Note that tiptap is renderless, but the dropcursor needs CSS for its appearance. The default CSS is added to the usage example below.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
```bash
|
```bash
|
||||||
@@ -9,15 +12,6 @@ npm install @tiptap/extension-gapcursor
|
|||||||
yarn add @tiptap/extension-gapcursor
|
yarn add @tiptap/extension-gapcursor
|
||||||
```
|
```
|
||||||
|
|
||||||
## Settings
|
|
||||||
*None*
|
|
||||||
|
|
||||||
## Commands
|
|
||||||
*None*
|
|
||||||
|
|
||||||
## Keyboard shortcuts
|
|
||||||
*None*
|
|
||||||
|
|
||||||
## Source code
|
## Source code
|
||||||
[packages/extension-gapcursor/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-gapcursor/)
|
[packages/extension-gapcursor/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-gapcursor/)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user