Skip to content

Commit 3ad3627

Browse files
committed
Add support for pasting text for uploaded file caption
1 parent 7e113c2 commit 3ad3627

File tree

8 files changed

+380
-6
lines changed

8 files changed

+380
-6
lines changed

components/Live.js

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Highlight, { defaultProps } from "prism-react-renderer";
33
import { LiveProvider, LiveEditor, LiveError, LivePreview } from "react-live";
44
import { mdx } from "@mdx-js/react";
55
import Dante, {
6+
FileBlockConfig,
67
ImageBlockConfig,
78
EmbedBlockConfig,
89
VideoBlockConfig,
@@ -53,6 +54,7 @@ export default function Live({ children, className, live, render }) {
5354
scope={{
5455
mdx,
5556
Dante,
57+
FileBlockConfig,
5658
ImageBlockConfig,
5759
EmbedBlockConfig,
5860
VideoBlockConfig,

packages/dante2/docs/widgets.mdx

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
---
23
title: Widgets
34
order: 2
@@ -90,13 +91,20 @@ Embed and Video widgets uses open framely you can override this by using your ow
9091
/>
9192
```
9293

93-
## Upload
94+
## Upload Image
9495

9596
```js live=true
9697
<Dante content={null} widgets={[ImageBlockConfig()]}
9798
/>
9899
```
99100

101+
## Upload File
102+
103+
```js live=true
104+
<Dante content={null} widgets={[FileBlockConfig()]}
105+
/>
106+
```
107+
100108
## Upload Url Callback
101109

102110
```js live=true

packages/dante2/src/editor/components/Dante/Dante.js

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {DanteImagePopoverConfig} from '../popovers/image.js'
1010
import {DanteAnchorPopoverConfig} from '../popovers/link.js'
1111
import {DanteInlineTooltipConfig} from '../popovers/addButton.js' //'Dante2/es/components/popovers/addButton.js'
1212
import {DanteTooltipConfig} from '../popovers/toolTip.js' //'Dante2/es/components/popovers/toolTip.js'
13+
import {FileBlockConfig} from '../blocks/file.js'
1314
import {ImageBlockConfig} from '../blocks/image.js'
1415
import {EmbedBlockConfig} from '../blocks/embed.js'
1516
import {VideoBlockConfig} from '../blocks/video.js'
@@ -191,6 +192,7 @@ Dante.defaultProps = {
191192

192193
widgets: [
193194
ImageBlockConfig(),
195+
FileBlockConfig(),
194196
EmbedBlockConfig(),
195197
VideoBlockConfig(),
196198
PlaceholderBlockConfig(),

packages/dante2/src/editor/components/Dante/index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ export {utils}
1818
import {LinkDecorator, PrismDraftDecorator} from '../decorators'
1919
export {LinkDecorator, PrismDraftDecorator}
2020

21+
import FileBlock, {FileBlockConfig} from '../blocks/file.js'
22+
export { FileBlock, FileBlockConfig}
23+
2124
import ImageBlock, {ImageBlockConfig} from '../blocks/image.js'
22-
export { ImageBlock, ImageBlockConfig}
25+
export { ImageBlock, ImageBlockConfig}
2326

2427
import EmbedBlock, {EmbedBlockConfig} from '../blocks/embed.js'
2528
export { EmbedBlock, EmbedBlockConfig}

0 commit comments

Comments
 (0)