define(function () {

  function LinkPlugin (Quill) {

    function Link (href) {
      if (href) {
        href += ''
        document.execCommand('createLink', false, href)
      } else document.execCommand('unlink', false, null)
    }

    /**
     * Quill.link.getState() determines if a link exists in the selection.
     * Differs significantly from document.queryCommandState('createLink').
     *
     * @return Boolean
     */
    Link.getState = function () {
      return Quill.selection.contains('a')
    }

    Link.isEnabled = function () {
      return !Quill.selection.contains('a')
    }

    Quill.sanitizer
      .addElements('a')
      .addAttributes({
        a: ['href']
      })
      .addProtocols({
        a: { href: ['http', 'https', 'mailto'] }
      })

    return Link
  }
  LinkPlugin.plugin = 'link'

  return LinkPlugin
})
@@ -313,24 +313,62 @@
 election
-.
 %0A     *
+ or the selection is a child of a link.
  Differs
@@ -386,16 +386,23 @@
 tly from
+%0A     *
  documen
@@ -521,16 +521,61 @@
  return 
+!!Quill.selection.childOf(/%5Ea$/i) %7C%7C%0A        
 Quill.se

Change behaviour of link.getState( )