Factor out common editor functionality