Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dragging and dropping work on firefox but not on chrome #31

Closed
MihaitaN opened this issue Sep 20, 2018 · 14 comments
Closed

Dragging and dropping work on firefox but not on chrome #31

MihaitaN opened this issue Sep 20, 2018 · 14 comments
Labels
Type: Bug The issue or pullrequest is related to a bug

Comments

@MihaitaN
Copy link

MihaitaN commented Sep 20, 2018

Hello, I have the following single file component on top of which I drop an image:
`


Test Text




<script> import { Editor } from 'tiptap' import { HardBreakNode, HeadingNode, ImageNode, BoldMark, CodeMark, ItalicMark, } from 'tiptap-extensions' </script>

export default {
components: {
'editor': Editor,
},
data() {
return {
extensions: [
new HardBreakNode(),
new HeadingNode({ maxLevel: 3 }),
new ImageNode(),
new BoldMark(),
new CodeMark(),
new ItalicMark(),
]
}
}
`
The dragging and dropping of an image works on firefox , but not on chrome.

On chrome I receive a Resource interpreted as Document but transferred with MIME type image/gif: "file:///home/mihaita/Pictures/giphy.gif". warning and then the browser proceeds to navigate to the dropped file file:///home/mihaita/Pictures/giphy.gif;

Any ideas what goes wrong?

@philippkuehn
Copy link
Contributor

Can you provide a minimal test repo or an example at codesandbox.io?

@MihaitaN
Copy link
Author

MihaitaN commented Sep 20, 2018

I can, hang on.

@MihaitaN
Copy link
Author

Here you go: https://codesandbox.io/s/7ylzoylj10

@philippkuehn
Copy link
Contributor

Hey I can‘t find any drag and drop code in your example. 👀

@MihaitaN
Copy link
Author

MihaitaN commented Sep 20, 2018

What do you mean? I just copied your example over from https://github.com/heyscrumpy/tiptap/blob/master/examples/Components/Routes/Images/index.vue .
It doesn't have any specific drag & drop logic, but I supposed the editor component already handles this.

Try opening the codesandbox on chrome and firefox and dragging and dropping an image from your machine onto the editor component (between Test & Text works best :) ).

On firefox the image gets loaded into the editor component, but chrome just opens a new tab with the image you dropped (it navigates to the file address on your machine).

PS: I'm using chrome 69.0.3497.100

@philippkuehn
Copy link
Contributor

Ah sorry, my fault 🙃

Hmm this is strange. Drop an image works fine on the official images example but not for your example on codesandbox. I'll check it out.

@philippkuehn philippkuehn added the Type: Bug The issue or pullrequest is related to a bug label Sep 21, 2018
@childonline
Copy link

Hey, it seems I stumbled over this exact same issue.

I'm also using chrome build 69.0.3497.100 and experiencing the same behavior.

The official image example does indeed work with chrome, but not when on localhost. Maybe it's something related to the build config of the examples page? I tried having a look, but couldn't find anything immediately obvious 😞 .

@childonline
Copy link

I just noticed this issue also present on prosemirror, you can replicate the drag & drop behavior over at http://prosemirror.net/examples/dino/ . 🙃 So this is tehnically a ProseMirror issue not a TipTap issue.

But what really baffles me is why it works on chrome on the official images example.

@philippkuehn
Copy link
Contributor

@childonline Yeah super strange. Didn't find anything until yet. The demo page setup is indeed different because I don't use the tiptap packages from npm. Instead I added some alias with webpack to grab these packages directly from the src folders of the repository. But I don't think that's what makes the difference.

@qyloxe
Copy link

qyloxe commented Sep 26, 2018

I would bet that it has something to do with headers, origin, feature detection, accept, https or anything else linked to browser-server context. Chrome has lately a "dark" history for implementation of those things and breaking many previously working use cases. Of course, it is done in the name of "security" so nobody should complain.

@philippkuehn
Copy link
Contributor

This is strange. In this sandbox I import a custom ImageNode extension (it's a copy from the image extension from tiptap-extensions) and it works fine. So it seems that something goes wrong in the build process? 🤷‍♂️

@childonline
Copy link

Yup, I can confirm, loading an identical "custom" ImageNode works on localhost aswell.

@philippkuehn
Copy link
Contributor

This is fixed in tiptap-extensions 0.16.3

@childonline
Copy link

thx, mate!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug The issue or pullrequest is related to a bug
Projects
None yet
Development

No branches or pull requests

4 participants