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 12, 2020
1 parent c153a80 commit bc94f6f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 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 @@ -5,7 +5,7 @@ import { ToastType } from "../types";

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 @@ -154,6 +154,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 @@ -241,6 +243,7 @@ class BlockMenu extends React.Component<Props, State> {

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

const {
view,
Expand Down Expand Up @@ -466,7 +469,7 @@ class BlockMenu extends React.Component<Props, State> {
type="file"
ref={this.inputRef}
onChange={this.handleImagePicked}
accept="image/*"
accept="*"
/>
</VisuallyHidden>
)}
Expand Down
6 changes: 6 additions & 0 deletions src/menus/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ export default function blockMenuItems(
icon: ImageIcon,
keywords: "picture photo",
},
{
name: "file",
title: "File",
icon: ImageIcon,
keywords: "file doc pdf",
},
{
name: "link",
title: dictionary.link,
Expand Down
5 changes: 3 additions & 2 deletions src/nodes/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export default class Image extends Node {

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

0 comments on commit bc94f6f

Please sign in to comment.