超能刚哥

Results 63 comments of 超能刚哥

格式刷功能有一个实现思路:通过扩展控件添加一个按钮,在选择一段内容后,点击这个按钮调用`ContentUtils.getSelectionInlineStyle` 拿到所选区域的样式,再选择一段区域,点击另一个按钮调用`ContentUtils.toggleSelectionInlineStyle`来将前面的样式,应用到新的选区上。

升级一下braft-utils到最新版看看,另外你遍历设置样式的代码是怎么写的?

`ContentUtils.toggleSelectionInlineStyle`这个方法下一版本我做个优化吧,支持直接 传入数组

你这个遍历,每次改变的都是最开始的那个editorState,所以每次后一次遍历体都会覆盖掉前面的,试试下面的写法: ```js const nextEditorState = copyStyles.reduce((ediorState, style) => { const splitedStyle = style.split('-') return ContentUtils.toggleSelectionInlineStyle(editorState, splitedStyle[1], splitedStyle[0]) }, editorState) this.editorInstance.setValue(nextEditorState ) ```

这个问题issue里面有很多类似的记录,你搜一下看看------------------ 原始邮件 ------------------ 发件人: "MonkeyInWind" 发送时间: 2019年8月6日(星期二) 中午11:18 收件人: "margox/braft-editor"; 抄送: "Subscribed"; 主题: [margox/braft-editor] toHTML的时候报错 (#584) index.js:56 TypeError: Cannot read property 'getCurrentStack' of undefined at pushCurrentDebugStack (react-dom-server.browser.development.js:2464) at ReactDOMServerRenderer.read (react-dom-server.browser.development.js:3053)...

问题已确认,会尽快修复,预计今晚或者明天发布下一版

最新版本已经修复了这个问题,你试试看

我用你的方式试了一下2.1.4好像没有这个问题呢,你升级之后,有重启wepback dev server么