Image and link methods

Depends on #627.
It is not clear to me what this change is doing here for you to be able to comment on. It seems to be from [this PR](https://github.com/wymeditor/wymeditor/pull/613/files#diff-3).

Essentially, it is testing two different functions and in both of them there could be a case where there is no selection.