浏览代码

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 年之前
父节点
当前提交
9720257bd0
共有 1 个文件被更改,包括 4 次插入2 次删除
  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];