margox / braft-editor

美观易用的React富文本编辑器,基于draft-js开发
MIT License
4.61k stars 593 forks source link

IE & Edge 中 使用 BraftEditor.createEditorState 初始化值无效 #605

Open LengYXin opened 5 years ago

LengYXin commented 5 years ago

在项目中使用编辑器 发现 IE 11 & Edge 使用 BraftEditor.createEditorState 初始化值无效。 clone github源码 启动项目 也是一样的效果。 如图 Chrome image IE & Edge image 自己排查代码中。还请大佬指点检查一下!

LengYXin commented 5 years ago

使用 draft-js 仓库 代码测试IE是没有问题的~

waterchestnut commented 5 years ago

遇到同样的问题

margox commented 5 years ago

控制台有报错么? 方便得话能不能帮忙跟踪一下是哪里出错了?我这边没得IE比较难调

LengYXin commented 5 years ago

控制台有报错么? 方便得话能不能帮忙跟踪一下是哪里出错了?我这边没得IE比较难调

控制台没有任何信息~ 我测试了draft-js的相同版本。IE 可以用。 简单的调试了一下 好像 是 draft-convert 这里出了问题~

waterchestnut commented 5 years ago

控制台有报错么? 方便得话能不能帮忙跟踪一下是哪里出错了?我这边没得IE比较难调

HTML初始文本中含有超链接会出现这样的问题,报错堆栈信息如下: "TypeError: 无法获取未定义或 null 引用的属性“name” at Anonymous function (eval code:562:7) at Anonymous function (eval code:560:24) at genFragment (eval code:411:5) at genFragment (eval code:412:5) at getChunkForHTML (eval code:464:3) at convertFromHTMLtoContentBlocks (eval code:510:3) at Anonymous function (eval code:607:5) at convertHTMLToEditorState (eval code:66:5) at external_draftjs.EditorState.createFrom (eval code:6658:115) at RichTextEditor (eval code:86:9)"

waterchestnut commented 5 years ago

控制台有报错么? 方便得话能不能帮忙跟踪一下是哪里出错了?我这边没得IE比较难调

braft-convert/dist/config.js文件中562、622行报错,超链接在IE11中获取的属性多了一个null: console.log(node,node.attributes)的日志输出如下: http://www.baidu.com/ [object NamedNodeMap] {

  0: { },
  1: { },
  2: null,
  __proto__: { },
  constructor: { },
  length: 2,
  Symbol()_15.n83xfxzpw4: undefined,
  Symbol()_16.n83xfxzpw4: undefined,
  Symbol()_l.n83xfxzpw4j: undefined,
  Symbol()_m.n83xfxzpw4j: undefined,
  Symbol(__immutablehash__)_17.n83xfxzpw4: undefined,
  Symbol(__immutablehash__)_18.n83xfxzpw4: undefined,
  Symbol(__immutablehash__)_19.n83xfxzpw4: undefined,
  Symbol(Call API)_14.n83xfxzpw4: undefined,
  Symbol(react.async_mode)_13.n83xfxzpw4: undefined,
  Symbol(react.concurrent_mode)_v.n83xfxzpw4j: undefined,
  Symbol(react.context)_u.n83xfxzpw4j: undefined,
  Symbol(react.element)_o.n83xfxzpw4j: undefined,
  Symbol(react.forward_ref)_w.n83xfxzpw4j: undefined,
  Symbol(react.fragment)_q.n83xfxzpw4j: undefined,
  Symbol(react.fundamental)_11.n83xfxzpw4: undefined,
  Symbol(react.lazy)_10.n83xfxzpw4: undefined,
  Symbol(react.memo)_z.n83xfxzpw4j: undefined,
  Symbol(react.portal)_p.n83xfxzpw4j: undefined,
  Symbol(react.profiler)_s.n83xfxzpw4j: undefined,
  Symbol(react.provider)_t.n83xfxzpw4j: undefined,
  Symbol(react.responder)_12.n83xfxzpw4: undefined,
  Symbol(react.strict_mode)_r.n83xfxzpw4j: undefined,
  Symbol(react.suspense)_x.n83xfxzpw4j: undefined,
  Symbol(react.suspense_list)_y.n83xfxzpw4j: undefined,
  Symbol(Symbol._hidden)_f.n83xfxzpvy1: { },
  Symbol(Symbol.observable)_n.n83xfxzpw4j: undefined,
  Symbol(Symbol.toStringTag)_6.n83xfxzpvy1: "NamedNodeMap"

}

LengYXin commented 5 years ago

控制台有报错么? 方便得话能不能帮忙跟踪一下是哪里出错了?我这边没得IE比较难调 Mac 本 装个 http://www.dayanzai.me/parallels-desktop.html 虚拟机 测试~ 我也是这么干的~ ~ 很无奈。IE11 和 Edge 得支持下~

jeffrey-liu2333 commented 5 years ago

一样的问题,这到底是什么情况

MonkeyInWind commented 4 years ago

+1

maitian0222 commented 4 years ago

+1