Skip to content

Commit

Permalink
force upload
Browse files Browse the repository at this point in the history
  • Loading branch information
michelson committed Aug 26, 2023
1 parent 999ebc9 commit 8fc7d2e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/dante3/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Editor Props
let image = new Image();
image.src = _URL.createObjectURL(file);
image.onload = function() {
const node = schema.nodes.ImageBlock.create({ src: image.src });
const node = schema.nodes.ImageBlock.create({ src: image.src, forceUpload: true });
const transaction = view.state.tr.insert(coordinates.pos, node);
view.dispatch(transaction);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/dante3/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "dante3",
"description": "Dante3 is a text editor built on top of TipTap",
"version": "1.2.9",
"version": "1.3.0",
"main": "package/Dante.cjs.js",
"jsnext:main": "package/Dante.es.js",
"module": "package/Dante.es.js",
Expand Down
1 change: 1 addition & 0 deletions packages/dante3/src/blocks/file.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ export const FileBlockConfig = (options = {}) => {
caption: { default: null },
direction: { default: "center" },
file: { default: null },
forceUpload: {default: false},
aspect_ratio: {
default: {
width: 200,
Expand Down
4 changes: 3 additions & 1 deletion packages/dante3/src/blocks/giphy/giphyBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ export const GiphyBlockConfig = (options = {}) => {
placeholder: "Search any gif on giphy",
key: "97g39PuUZ6Q49VdTRBvMYXRoKZYd1ScZ",
},
attributes: {},
attributes: {
forceUpload: {default: false}
},
};

return Object.assign(config, options);
Expand Down
2 changes: 1 addition & 1 deletion packages/dante3/src/blocks/image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export default function ImageBlock(props: any) {
img.src = imageUrl; //props.node.attrs.src;

// setImage(img.src)

// exit only when not blob and not forceUload
if (!img.src.includes("blob:") && !props.node.attrs.forceUpload) {
return;
Expand Down Expand Up @@ -294,6 +293,7 @@ export const ImageBlockConfig = (options = {}) => {
caption: { default: null },
direction: { default: "center" },
file: { default: null },
forceUpload: {default: false},
aspect_ratio: {
default: {
width: 200,
Expand Down

0 comments on commit 8fc7d2e

Please sign in to comment.