Skip to content

Commit

Permalink
Fix paste module to support Microsoft Edge (codex-team#640)
Browse files Browse the repository at this point in the history
  • Loading branch information
gohabereg authored Mar 8, 2019
1 parent d9bb7ff commit b2d85d3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
6 changes: 3 additions & 3 deletions dist/editor.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Changelog

### 2.11.6

- `Fix` *Paste* — Polyfill for Microsoft Edge

### 2.11.5

- `Fix` *RectangeSelection* — Redesign of the scrolling zones
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@editorjs/editorjs",
"version": "2.11.5",
"version": "2.11.6",
"description": "Editor.js — Native JS, based on API and Open Source",
"main": "dist/editor.js",
"types": "./types/index.d.ts",
Expand Down
9 changes: 8 additions & 1 deletion src/components/modules/paste.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,14 @@ export default class Paste extends Module {
public async processDataTransfer(dataTransfer: DataTransfer, isDragNDrop = false): Promise<void> {
const { Sanitizer } = this.Editor;

if (dataTransfer.types.includes('Files')) {
const types = dataTransfer.types;

/**
* In Microsoft Edge types is DOMStringList. So 'contains' is used to check if 'Files' type included
*/
const includesFiles = types.includes ? types.includes('Files') : (types as any).contains('Files');

if (includesFiles) {
await this.processFiles(dataTransfer.files);
return;
}
Expand Down

0 comments on commit b2d85d3

Please sign in to comment.