From bf65ce34697668ecfa223c13ad6177f33498ef74 Mon Sep 17 00:00:00 2001 From: jedi Date: Thu, 6 Jun 2024 20:58:27 +0200 Subject: [PATCH] stash --- web/src/components/inputs/FormatedText.vue | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/web/src/components/inputs/FormatedText.vue b/web/src/components/inputs/FormatedText.vue index 339b6a4..02c131a 100644 --- a/web/src/components/inputs/FormatedText.vue +++ b/web/src/components/inputs/FormatedText.vue @@ -42,23 +42,23 @@ export default { calculateOffset(container, node, offset) { let position = 0; let found = false; - const walk = (node) => { - if (node === container) { + const walk = (elem) => { + if (elem === node) { found = true; return; } - if (node.nodeType === 3) { - position += node.length; + if (elem.nodeType === 3) { + position += elem.length; } else { - for (let i = 0; i < node.childNodes.length; i++) { - walk(node.childNodes[i]); + for (let i = 0; i < elem.childNodes.length; i++) { + walk(elem.childNodes[i]); if (found) { return; } } } }; - walk(node); + walk(container); return position + offset; } },