Refactor editor.js to reduce duplication of editor setup

Part of #93

This reduces the duplication in code that creates the both the normal-
and the config-node dialogs.

It also identifies the key points that credentials handling should
be introduced.