rework textEditor

Concisify code for textEditor.