Added text editor code from discussion