code for automatic selection of editor type in page editor