Option to pass function to override default dialogs

This also incorporates changes from my first pull request which added the ability to add links on images (see pull request #594)

```showLinkDialog : myShowLinkDialogFunction```