storypioneers / kirby-wysiwyg

WYSIWYG panel field for Kirby CMS
Other
125 stars 16 forks source link

Anchors broken in 2.2.2 #22

Closed dgdsp closed 8 years ago

dgdsp commented 8 years ago

unfortunately the intended behaviour of anchors and anchor previews is broken in 2.2.2.: links are opened directly instead of being intercepted by medium-editor, resulting in a barely usable anchor button.

dgdsp commented 8 years ago

culprit: https://github.com/getkirby/panel/blob/develop/assets/js/src/app.js#L36

monkey patch:

    // event delegation for all clicks on links
    $(document).on('click', 'a', function(e) {      

      var link = $(this);
      var href = link.attr('href') || "";

      // medium-editor anchor preview
      if(link.is('.medium-editor-toolbar-anchor-preview-inner')) {
        return false;
      } else if(link.is('[data-dropdown]') || href.match(/^#/)) {
        return true;
      } else {

        if(link.is('[data-modal]')) {
          app.modal.open(link.attr('href'));
          return false;
        } else if(link.is('[target]')) {
          return true;
        } else {
          app.content.open(href);        
          return false;
        }

      }

    });
dgdsp commented 8 years ago

fixed in dev-branch