refactor rich text handler API