mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-24 03:39:01 +08:00
Add Gapcursor demo for React
This commit is contained in:
parent
bee9f2bf7e
commit
23ce11f6cc
15
demos/src/Extensions/Gapcursor/React/index.html
Normal file
15
demos/src/Extensions/Gapcursor/React/index.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module">
|
||||
import setup from "../../../../setup/react.ts";
|
||||
import source from "@source";
|
||||
setup("Extensions/Gapcursor", source);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
20
demos/src/Extensions/Gapcursor/React/index.jsx
Normal file
20
demos/src/Extensions/Gapcursor/React/index.jsx
Normal file
@ -0,0 +1,20 @@
|
||||
import React from 'react'
|
||||
import { useEditor, EditorContent } from '@tiptap/react'
|
||||
import Document from '@tiptap/extension-document'
|
||||
import Paragraph from '@tiptap/extension-paragraph'
|
||||
import Text from '@tiptap/extension-text'
|
||||
import Gapcursor from '@tiptap/extension-gapcursor'
|
||||
import Image from '@tiptap/extension-image'
|
||||
import './styles.scss'
|
||||
|
||||
export default () => {
|
||||
const editor = useEditor({
|
||||
extensions: [Document, Paragraph, Text, Image, Gapcursor],
|
||||
content: `
|
||||
<p>Try to move the cursor after the image with your arrow keys! You should see a horizontal blinking cursor below the image. This is the gapcursor.</p>
|
||||
<img src="https://source.unsplash.com/8xznAGy4HcY/800x400" />
|
||||
`,
|
||||
})
|
||||
|
||||
return <EditorContent editor={editor} />
|
||||
}
|
7
demos/src/Extensions/Gapcursor/React/index.spec.js
Normal file
7
demos/src/Extensions/Gapcursor/React/index.spec.js
Normal file
@ -0,0 +1,7 @@
|
||||
context('/src/Examples/Gapcursor/React/', () => {
|
||||
before(() => {
|
||||
cy.visit('/src/Examples/Gapcursor/React/')
|
||||
})
|
||||
|
||||
// TODO: Write tests
|
||||
})
|
11
demos/src/Extensions/Gapcursor/React/styles.scss
Normal file
11
demos/src/Extensions/Gapcursor/React/styles.scss
Normal file
@ -0,0 +1,11 @@
|
||||
/* Basic editor styles */
|
||||
.ProseMirror {
|
||||
> * + * {
|
||||
margin-top: 0.75em;
|
||||
}
|
||||
|
||||
img {
|
||||
height: auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user