add basic image extension
This commit is contained in:
45
docs/src/demos/Extensions/Image/index.vue
Normal file
45
docs/src/demos/Extensions/Image/index.vue
Normal file
@@ -0,0 +1,45 @@
|
||||
<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 Image from '@tiptap/extension-image'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
EditorContent,
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
editor: null,
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.editor = new Editor({
|
||||
extensions: [
|
||||
Document(),
|
||||
Paragraph(),
|
||||
Text(),
|
||||
Image(),
|
||||
],
|
||||
content: `
|
||||
<p>This is basic example of implementing images. Try to drop new images here. Reordering also works.</p>
|
||||
<img src="https://66.media.tumblr.com/dcd3d24b79d78a3ee0f9192246e727f1/tumblr_o00xgqMhPM1qak053o1_400.gif" />
|
||||
`,
|
||||
})
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
this.editor.destroy()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
16
docs/src/docPages/api/extensions/image.md
Normal file
16
docs/src/docPages/api/extensions/image.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Image
|
||||
|
||||
## Installation
|
||||
```bash
|
||||
# With npm
|
||||
npm install @tiptap/extension-image
|
||||
|
||||
# Or: With Yarn
|
||||
yarn add @tiptap/extension-image
|
||||
```
|
||||
|
||||
## Source code
|
||||
[packages/extension-image/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-image/)
|
||||
|
||||
## Usage
|
||||
<demo name="Extensions/Image" highlight="12,30" />
|
||||
@@ -132,6 +132,9 @@
|
||||
link: /api/extensions/history
|
||||
- title: HorizontalRule
|
||||
link: /api/extensions/horizontal-rule
|
||||
- title: Image
|
||||
link: /api/extensions/image
|
||||
draft: true
|
||||
- title: Italic
|
||||
link: /api/extensions/italic
|
||||
- title: Link
|
||||
@@ -163,6 +166,7 @@
|
||||
link: /api/extensions/text
|
||||
- title: Text Align
|
||||
link: /api/extensions/text-align
|
||||
draft: true
|
||||
# - title: TodoItem
|
||||
# link: /api/extensions/todo-item
|
||||
# draft: true
|
||||
|
||||
Reference in New Issue
Block a user