Use beginEditBlock and endEditBlock for document cleanup (better undo/redo stack)