Fixes in link.js: on edit of selection regex did not correctly identify media files and if OK pressed, link formatting was corrupted