editors/rich: gardening
editors/rich: restore caret position only if editor has focus
editors/rich: onCaretOffsetUpdate event
fix focus handling
better state management