View.state.selection has selected content when input it not selected


I need to monitor selected content and react to it. I read view.state.selection.content() property. It works as expected except it’s not null / updated when contentediable loses focus / selection. So visually content is not selected but the model says that it is.

How can I get real selection?

Check view.hasFocus()?

It doesn’t work readOnly (preview) mode - hasFocus is always false but user can still select content