mirror of
https://github.com/marktext/marktext.git
synced 2025-05-17 01:10:41 +08:00
fix: fix snabbdom-to-html error, and already submit an issue to snabbdom-to-html
This commit is contained in:
parent
f7c52af8f4
commit
dcb50e3de2
@ -164,11 +164,10 @@ class ContentState {
|
|||||||
matches.forEach((m, i) => {
|
matches.forEach((m, i) => {
|
||||||
m.active = i === index
|
m.active = i === index
|
||||||
})
|
})
|
||||||
// console.log(startKey, endKey)
|
|
||||||
const startIndex = startKey ? blocks.findIndex(block => block.key === startKey) : 0
|
const startIndex = startKey ? blocks.findIndex(block => block.key === startKey) : 0
|
||||||
const endIndex = endKey ? blocks.findIndex(block => block.key === endKey) + 1 : blocks.length
|
const endIndex = endKey ? blocks.findIndex(block => block.key === endKey) + 1 : blocks.length
|
||||||
const needRenderBlocks = blocks.slice(startIndex, endIndex)
|
const needRenderBlocks = blocks.slice(startIndex, endIndex)
|
||||||
// console.log(JSON.stringify(needRenderBlocks, null, 2), startKey, endKey)
|
|
||||||
this.setNextRenderRange()
|
this.setNextRenderRange()
|
||||||
this.stateRender.partialRender(needRenderBlocks, cursor, activeBlocks, matches, startKey, endKey)
|
this.stateRender.partialRender(needRenderBlocks, cursor, activeBlocks, matches, startKey, endKey)
|
||||||
this.pre2CodeMirror(true, [...new Set([cursorOutMostBlock, ...needRenderBlocks])])
|
this.pre2CodeMirror(true, [...new Set([cursorOutMostBlock, ...needRenderBlocks])])
|
||||||
|
@ -433,7 +433,8 @@ class StateRender {
|
|||||||
} else {
|
} else {
|
||||||
result = [ text.substring(rStart, rEnd) ]
|
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
|
return result
|
||||||
}
|
}
|
||||||
// render token of text type to vdom.
|
// render token of text type to vdom.
|
||||||
|
@ -13,7 +13,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
label: 'Redo',
|
label: 'Redo',
|
||||||
accelerator: 'CmdOrCtrl+Y',
|
accelerator: 'Shift+CmdOrCtrl+Z',
|
||||||
click: (menuItem, browserWindow) => {
|
click: (menuItem, browserWindow) => {
|
||||||
actions.edit(browserWindow, 'redo')
|
actions.edit(browserWindow, 'redo')
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user