Jelajahi Sumber

Fix TypeError in emoji insert function (#257)

In Chrome, text nodes are not "real" nodes, so they don't have a
`tagName` property.
Danilo Bargen 8 tahun lalu
induk
melakukan
9720257bd0
1 mengubah file dengan 4 tambahan dan 2 penghapusan
  1. 4 2
      src/directives/compose_area.ts

+ 4 - 2
src/directives/compose_area.ts

@@ -437,8 +437,10 @@ export default [
 
                     // In Chrome in right-to-left mode, our content editable
                     // area may contain a DIV element.
-                    const nestedDiv = composeDiv[0].childNodes.length === 1
-                        && composeDiv[0].childNodes[0].tagName.toLowerCase() === 'div';
+                    const childNodes = composeDiv[0].childNodes;
+                    const nestedDiv = childNodes.length === 1
+                        && childNodes[0].tagName !== undefined
+                        && childNodes[0].tagName.toLowerCase() === 'div';
                     let contentElement;
                     if (nestedDiv === true) {
                         contentElement = composeDiv[0].childNodes[0];