Fix #538 and also make the editor preferences save to local storage, also add some example code and ensure the editor reflects the current selection