Initial implementation.

Taken from RichTextFX.