Browse Source

Add IE11 opt-out of rich text pasting, and documentation notes

Thibaud Colas 7 years ago
parent
commit
4803ad1c43

+ 4 - 1
client/src/components/Draftail/index.js

@@ -2,6 +2,8 @@ import React from 'react';
 import ReactDOM from 'react-dom';
 import { DraftailEditor } from 'draftail';
 
+import { IS_IE11 } from '../../config/wagtailConfig';
+
 import Icon from '../Icon/Icon';
 
 import sources from './sources';
@@ -68,7 +70,8 @@ export const initEditor = (fieldName, options = {}) => {
       spellCheck={true}
       // If increasing above 4, we will need to add styles for the extra nesting levels.
       maxListNesting={4}
-      stripPastedStyles={false}
+      // Draft.js + IE 11 presents some issues with pasting rich text. Disable rich paste there.
+      stripPastedStyles={IS_IE11}
       {...options}
       blockTypes={blockTypes}
       inlineStyles={inlineStyles}

+ 2 - 0
client/src/config/wagtailConfig.js

@@ -4,3 +4,5 @@ export const ADMIN_URLS = global.wagtailConfig.ADMIN_URLS;
 
 // Maximum number of pages to load inside the explorer menu.
 export const MAX_EXPLORER_PAGES = 200;
+
+export const IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;

+ 5 - 0
docs/contributing/developing.rst

@@ -153,6 +153,11 @@ Safari         macOS          Last 2
 
 We aim for Wagtail to work in those environments. Our development standards ensure that the site is usable on other browsers **and will work on future browsers**. To test on IE, install virtual machines `made available by Microsoft <https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/>`_.
 
+IE 11 is gradually falling out of use, and specific features are unsupported in this browser:
+
+* Rich text copy-paste in the rich text editor.
+* Sticky toolbar in the rich text editor.
+
 Unsupported browsers / devices include:
 
 =============  =============  =============