diff --git a/package.json b/package.json index 04c8f678f2..c2a44ee65d 100644 --- a/package.json +++ b/package.json @@ -172,7 +172,8 @@ "handlebars": "patches/handlebars.patch", "source-sans@3.46.0": "patches/source-sans@3.46.0.patch", "svgicons2svgfont": "patches/svgicons2svgfont.patch", - "tippy.js@6.3.7": "patches/tippy.js@6.3.7.patch" + "tippy.js@6.3.7": "patches/tippy.js@6.3.7.patch", + "textarea-caret@3.1.0": "patches/textarea-caret@3.1.0.patch" } }, "nyc": { diff --git a/patches/textarea-caret@3.1.0.patch b/patches/textarea-caret@3.1.0.patch new file mode 100644 index 0000000000..ceebb9a359 --- /dev/null +++ b/patches/textarea-caret@3.1.0.patch @@ -0,0 +1,20 @@ +diff --git a/index.js b/index.js +index 0b06d12bb550fbf8043645a8d680817909cb2b04..c94bbcbf0e65ecf370195f6f3b03a2be62012d0c 100644 +--- a/index.js ++++ b/index.js +@@ -65,7 +65,6 @@ function getCaretCoordinates(element, position, options) { + // The mirror div will replicate the textarea's style + var div = document.createElement('div'); + div.id = 'input-textarea-caret-position-mirror-div'; +- document.body.appendChild(div); + + var style = div.style; + var computed = window.getComputedStyle ? window.getComputedStyle(element) : element.currentStyle; // currentStyle for IE < 9 +@@ -113,6 +112,7 @@ function getCaretCoordinates(element, position, options) { + // For inputs, just '.' would be enough, but no need to bother. + span.textContent = element.value.substring(position) || '.'; // || because a completely empty faux span doesn't render at all + div.appendChild(span); ++ document.body.appendChild(div); + + var coordinates = { + top: span.offsetTop + parseInt(computed['borderTopWidth']), diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 707c5c5192..8edf1cb974 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,6 +17,9 @@ patchedDependencies: svgicons2svgfont: hash: d4mkid5oxxg6zfe7zsae2cikn4 path: patches/svgicons2svgfont.patch + textarea-caret@3.1.0: + hash: 4l2w4ru66ocl2j45eog5vet7ve + path: patches/textarea-caret@3.1.0.patch tippy.js@6.3.7: hash: mlbmk5pq4q6iuwarqu6solgeeq path: patches/tippy.js@6.3.7.patch @@ -258,7 +261,7 @@ importers: version: 4.1.1 textarea-caret: specifier: ^3.1.0 - version: 3.1.0 + version: 3.1.0(patch_hash=4l2w4ru66ocl2j45eog5vet7ve) tippy.js: specifier: ^6.3.7 version: 6.3.7(patch_hash=mlbmk5pq4q6iuwarqu6solgeeq) @@ -18586,7 +18589,7 @@ snapshots: text-hex@1.0.0: {} - textarea-caret@3.1.0: {} + textarea-caret@3.1.0(patch_hash=4l2w4ru66ocl2j45eog5vet7ve): {} thingies@1.21.0(tslib@2.8.1): dependencies: