abhas9 / vanilla-caret-js

Set and get Caret position (contenteditable or TextArea) using Vanilla JavaScript
https://abhas9.github.io/vanilla-caret-js/
MIT License
37 stars 2 forks source link

Doesn't seem to work with firefox #6

Closed ramast closed 2 years ago

ramast commented 2 years ago
Uncaught DOMException: Selection.getRangeAt: 0 is out of range [VanillaCaret.js:56]

    getPos VanillaCaret.js:56
    onEditorKeyUp App.js:101
    React 15
    bind_applyFunctionN self-hosted:1313
    dispatchDiscreteEvent self-hosted:1276
    React 4
    forEach self-hosted:4290
    React 4
    js index.js:7
    factory react refresh:6
    Webpack 3
abhas9 commented 2 years ago

I just tried the demo at https://abhas9.github.io/vanilla-caret-js/ in firefox and that seems to be working.

Do you have anything like jsfiddle where I can reproduce the issue? This looks like a usage/integration issue.

ramast commented 2 years ago

I've created one https://jsfiddle.net/5jk1sgfu/12/

abhas9 commented 2 years ago

Thanks. Can you try version 1.1.0 https://jsfiddle.net/awgs2khy/

ramast commented 2 years ago

Thanks Abhas, working perfectly fine now