Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Commit

Permalink
First draft for files upload to S3
Browse files Browse the repository at this point in the history
  • Loading branch information
sahilchanchad committed Sep 10, 2020
1 parent 23d41bc commit 757eded
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
1 change: 0 additions & 1 deletion example/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ class Example extends React.Component {

handleChange = debounce(value => {
const text = value();
console.log(text);
localStorage.setItem("saved", text);
}, 250);

Expand Down
2 changes: 1 addition & 1 deletion src/commands/insertFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import uploadPlaceholderPlugin, {

const insertFiles = function(view, event, pos, files, options) {
// filter to only include image files
const images = files.filter(file => /image/i.test(file.type));
const images = files;
if (images.length === 0) return;

const {
Expand Down
5 changes: 4 additions & 1 deletion src/components/BlockMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ class BlockMenu extends React.Component<Props, State> {
switch (item.name) {
case "image":
return this.triggerImagePick();
case "file":
return this.triggerImagePick();
case "embed":
return this.triggerLinkInput(item);
case "link": {
Expand Down Expand Up @@ -239,6 +241,7 @@ class BlockMenu extends React.Component<Props, State> {

handleImagePicked = event => {
const files = getDataTransferFiles(event);
console.log(files);

const {
view,
Expand Down Expand Up @@ -459,7 +462,7 @@ class BlockMenu extends React.Component<Props, State> {
type="file"
ref={this.inputRef}
onChange={this.handleImagePicked}
accept="image/*"
accept="*"
/>
</VisuallyHidden>
</Wrapper>
Expand Down
6 changes: 6 additions & 0 deletions src/menus/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ export default function blockMenuItems(): MenuItem[] {
icon: ImageIcon,
keywords: "picture photo",
},
{
name: "file",
title: "File",
icon: ImageIcon,
keywords: "file doc pdf",
},
{
name: "link",
title: "Link",
Expand Down
7 changes: 4 additions & 3 deletions src/nodes/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ export default class Image extends Node {
component = options => {
const { theme } = options;
const { alt, src } = options.node.attrs;

console.log(src)
return (
<div className="image" contentEditable={false}>
<ImageZoom
{/* <ImageZoom
image={{
src,
alt,
Expand All @@ -179,7 +179,8 @@ export default class Image extends Node {
>
{alt}
</Caption>
)}
)} */}
<a href={src}>My Doc</a>
</div>
);
};
Expand Down

0 comments on commit 757eded

Please sign in to comment.