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

Don't add fileDragging extension is no file type is allowed. fixes #966 #965

Closed
wants to merge 1 commit into from
Closed

Don't add fileDragging extension is no file type is allowed. fixes #966 #965

wants to merge 1 commit into from

Conversation

goldensunliu
Copy link
Contributor

No description provided.

@goldensunliu goldensunliu changed the title Don't add fileDragging extension is no file type is allowed Don't add fileDragging extension is no file type is allowed. fixes #966 Feb 10, 2016
@goldensunliu
Copy link
Contributor Author

fixing.

@@ -19,14 +19,6 @@ describe('Drag and Drop TestCase', function () {
expect(editor.elements[0].className).toContain('medium-editor-dragover');
});

it('should add medium-editor-dragover class even when data is invalid', function () {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nmielnik what was the thoughts behind this behavior at the first place?
wouldn't be better to not do drag and drop at all when no files type is allowed? #966

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are 2 separate concepts with the drag-and-drop.

  1. Without the extension, drag and drop will cause the browser to open the file by navigating to the file or opening the file in a separate tab. When the extension is instantiated, it listens for the drop event over the editor and prevents the default action, which would be having the browser open the file.
  2. The allowedType specifies that for a certain file type, the code should have some special handling for inserting the file into the editor. Currently, we only have code that handles images, so 'image' is the only meaningful value to pass into this array.

So, allowedTypes should not affect whether the extension exists or not, since it is intended for a different purpose (the parameter is a bit confusing and probably named incorrectly, that's my fault and I hope to fix it for 6.0.0).

@nmielnik
Copy link
Member

In 6.0.0, we plan to remove the imageDragging option completely, and instead define a fileDragging option which will allow you to turn the extension on/off, as well as specify which type of files you want to allow custom logic to insert (if the extension is on).

Until then, the test cases are still valid, and since the allowedTypes property of the extension is intended for a different purpose, I don't think it should affect whether the extension disables the drag or drop events right now.

@goldensunliu
Copy link
Contributor Author

sounds good! I will remove this for now

@goldensunliu goldensunliu deleted the omit-file-dragging branch February 11, 2016 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants