Removed direct access to document/editor from rendering

This is in preperation to move rendering to a seperate thread.