fix: fix snabbdom-to-html error, and already submit an issue to snabbdom-to-html

This commit is contained in:
Jocs 2018-05-16 15:55:32 +08:00
parent f7c52af8f4
commit dcb50e3de2
3 changed files with 4 additions and 4 deletions

View File

@ -164,11 +164,10 @@ class ContentState {
matches.forEach((m, i) => {
m.active = i === index
})
// console.log(startKey, endKey)
const startIndex = startKey ? blocks.findIndex(block => block.key === startKey) : 0
const endIndex = endKey ? blocks.findIndex(block => block.key === endKey) + 1 : blocks.length
const needRenderBlocks = blocks.slice(startIndex, endIndex)
// console.log(JSON.stringify(needRenderBlocks, null, 2), startKey, endKey)
this.setNextRenderRange()
this.stateRender.partialRender(needRenderBlocks, cursor, activeBlocks, matches, startKey, endKey)
this.pre2CodeMirror(true, [...new Set([cursorOutMostBlock, ...needRenderBlocks])])

View File

@ -433,7 +433,8 @@ class StateRender {
} else {
result = [ text.substring(rStart, rEnd) ]
}
// fix snabbdom-to-html bug https://github.com/snabbdom/snabbdom-to-html/issues/41
if (result.length === 1 && result[0] === '') result.length = 0
return result
}
// render token of text type to vdom.

View File

@ -13,7 +13,7 @@ export default {
}
}, {
label: 'Redo',
accelerator: 'CmdOrCtrl+Y',
accelerator: 'Shift+CmdOrCtrl+Z',
click: (menuItem, browserWindow) => {
actions.edit(browserWindow, 'redo')
}