refactor richText widget as a plugin