refactor html processor for editor.Fixes #358,#360