1

I'm trying to hide the cursor in draft-js. I want it to function as normal but the user not to be able to see the blinking cursor, is there any way of doing this in draft JS?

user3472360
  • 1,337
  • 1
  • 16
  • 29

1 Answers1

1

You can set the caret-color which is support by all modern browser nowadays: https://caniuse.com/?search=caret-color

    .public-DraftStyleDefault-block {
        caret-color: transparent;
    }
Dominic Bütow
  • 163
  • 1
  • 7
  • Is there any way to hide just the cursor and leave the text as the color it is? or is that what this does? – user3472360 Jul 19 '21 at 07:52
  • 1
    Found a better solution, `caret-color` and updated the answer! – Dominic Bütow Jul 19 '21 at 08:38
  • brilliant, thanks so much. one thing: overriding the CSS like that didn't work for me but it did work when i set blockStyleFn={() => "my-css-class"} in the Editor class and then define "my-css-class" in a separate css file – user3472360 Jul 19 '21 at 10:40