fix minor bug
This commit is contained in:
parent
08e40f3607
commit
1d42b4d0eb
@ -385,7 +385,8 @@ const EACH = eachStartMarkerRegex.source
|
|||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
export default function fillOdtElementTemplate(rootElement, compartment) {
|
export default function fillOdtElementTemplate(rootElement, compartment) {
|
||||||
//console.log('fillTemplatedOdtElement', rootElement.nodeType, rootElement.nodeName)
|
//console.log('fillTemplatedOdtElement', rootElement.nodeType, rootElement.nodeName, rootElement.textContent)
|
||||||
|
//console.log('fillTemplatedOdtElement', rootElement.childNodes[0].childNodes.length)
|
||||||
|
|
||||||
let currentlyOpenBlocks = []
|
let currentlyOpenBlocks = []
|
||||||
|
|
||||||
|
|||||||
@ -166,9 +166,10 @@ function consolidateMarkers(document){
|
|||||||
...Array.from(document.getElementsByTagName('text:h'))
|
...Array.from(document.getElementsByTagName('text:h'))
|
||||||
]
|
]
|
||||||
|
|
||||||
|
for(const potentialMarkersContainer of potentialMarkersContainers) {
|
||||||
|
/** @type {{marker: string, index: number}[]} */
|
||||||
const consolidatedMarkers = []
|
const consolidatedMarkers = []
|
||||||
|
|
||||||
for(const potentialMarkersContainer of potentialMarkersContainers) {
|
|
||||||
/** @type {Text[]} */
|
/** @type {Text[]} */
|
||||||
let containerTextNodesInTreeOrder = [];
|
let containerTextNodesInTreeOrder = [];
|
||||||
|
|
||||||
@ -245,13 +246,16 @@ function consolidateMarkers(document){
|
|||||||
|
|
||||||
// Check if marker spans multiple nodes
|
// Check if marker spans multiple nodes
|
||||||
if(startNode !== endNode) {
|
if(startNode !== endNode) {
|
||||||
|
//console.log('startNode !== endNode', startNode.textContent, endNode.textContent)
|
||||||
const commonAncestor = findCommonAncestor(startNode, endNode)
|
const commonAncestor = findCommonAncestor(startNode, endNode)
|
||||||
|
|
||||||
|
/** @type {Node} */
|
||||||
let commonAncestorStartChild = startNode
|
let commonAncestorStartChild = startNode
|
||||||
while(commonAncestorStartChild.parentNode !== commonAncestor){
|
while(commonAncestorStartChild.parentNode !== commonAncestor){
|
||||||
commonAncestorStartChild = commonAncestorStartChild.parentNode
|
commonAncestorStartChild = commonAncestorStartChild.parentNode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @type {Node} */
|
||||||
let commonAncestorEndChild = endNode
|
let commonAncestorEndChild = endNode
|
||||||
while(commonAncestorEndChild.parentNode !== commonAncestor){
|
while(commonAncestorEndChild.parentNode !== commonAncestor){
|
||||||
commonAncestorEndChild = commonAncestorEndChild.parentNode
|
commonAncestorEndChild = commonAncestorEndChild.parentNode
|
||||||
@ -324,7 +328,6 @@ function consolidateMarkers(document){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//console.log('consolidatedMarkers', consolidatedMarkers)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user