fix minor bug

This commit is contained in:
David Bruant 2025-05-21 15:04:16 +02:00
parent 08e40f3607
commit 1d42b4d0eb
2 changed files with 8 additions and 4 deletions

View File

@ -385,7 +385,8 @@ const EACH = eachStartMarkerRegex.source
* @returns {void}
*/
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 = []

View File

@ -166,9 +166,10 @@ function consolidateMarkers(document){
...Array.from(document.getElementsByTagName('text:h'))
]
const consolidatedMarkers = []
for(const potentialMarkersContainer of potentialMarkersContainers) {
/** @type {{marker: string, index: number}[]} */
const consolidatedMarkers = []
/** @type {Text[]} */
let containerTextNodesInTreeOrder = [];
@ -245,13 +246,16 @@ function consolidateMarkers(document){
// Check if marker spans multiple nodes
if(startNode !== endNode) {
//console.log('startNode !== endNode', startNode.textContent, endNode.textContent)
const commonAncestor = findCommonAncestor(startNode, endNode)
/** @type {Node} */
let commonAncestorStartChild = startNode
while(commonAncestorStartChild.parentNode !== commonAncestor){
commonAncestorStartChild = commonAncestorStartChild.parentNode
}
/** @type {Node} */
let commonAncestorEndChild = endNode
while(commonAncestorEndChild.parentNode !== commonAncestor){
commonAncestorEndChild = commonAncestorEndChild.parentNode
@ -324,7 +328,6 @@ function consolidateMarkers(document){
}
}
//console.log('consolidatedMarkers', consolidatedMarkers)
}
/**