add a check to "r" in getRangeText.
Issue fixed: when editor is just loaded but unfocused, as in basic sample, click on "link" control will throw an error: Uncaught TypeError: Cannot read property 'toString' of null.