diff --git a/docs/general/faq.md b/docs/general/faq.md index 9d90ed22a..7a29608fd 100644 --- a/docs/general/faq.md +++ b/docs/general/faq.md @@ -24,4 +24,6 @@ If you have an element that is not going to be editable, you can choose between Slate's goal is to support all the modern browsers on both desktop and mobile devices. -However, right now Slate is in beta, so its support is not as full as it will later be. It's currently tested against the latest few versions of Chrome, Firefox and Safari on desktops. It isn't currently tested against Internet Explorer or Edge, or against mobile devices. If you want to add more browser or device support, we'd love for you to submit a pull request! +However, right now Slate is in beta and is community-driven, so its support is not as robust as it could be. It's currently tested against the latest few versions of Chrome, Firefox and Safari on desktops. It isn't currently tested against Internet Explorer or Edge, or against mobile devices. If you want to add more browser or device support, we'd love for you to submit a pull request! + +For older browsers, such as IE11, a lot of the now standard native APIs aren't available. Slate's position on this is that it is up to the user to bring polyfills (like https://polyfill.io) when needed for things like `el.closest`, etc. Otherwise we'd have to bundle and maintain lots of polyfills that others may not even need in the first place. diff --git a/packages/slate-react/src/utils/clone-fragment.js b/packages/slate-react/src/utils/clone-fragment.js index 56ce6cee5..27a2d282c 100644 --- a/packages/slate-react/src/utils/clone-fragment.js +++ b/packages/slate-react/src/utils/clone-fragment.js @@ -3,6 +3,7 @@ import TRANSFER_TYPES from '../constants/transfer-types' import getWindow from 'get-window' import findDOMNode from './find-dom-node' import removeAllRanges from './remove-all-ranges' +import { IS_IE } from 'slate-dev-environment' import { ZERO_WIDTH_SELECTOR, ZERO_WIDTH_ATTRIBUTE } from './find-point' const { FRAGMENT, HTML, TEXT } = TRANSFER_TYPES @@ -88,7 +89,11 @@ function cloneFragment(event, value, fragment = value.fragment) { // For browsers supporting it, we set the clipboard registers manually, // since the result is more predictable. - if (event.clipboardData && event.clipboardData.setData) { + // COMPAT: IE supports the setData method, but only in restricted sense. + // IE doesn't support arbitrary MIME types or common ones like 'text/plain'; + // it only accepts "Text" (which gets mapped to 'text/plain') and "Url" + // (mapped to 'text/url-list'); so, we should only enter block if !IS_IE + if (event.clipboardData && event.clipboardData.setData && !IS_IE) { event.preventDefault() event.clipboardData.setData(TEXT, div.textContent) event.clipboardData.setData(FRAGMENT, encoded)