Disable hyperlink preventDefault()
Question
By default all html anchor elements have their click behaviour disabled (which is very useful of course).
However, I would like to make elements editable that requires some javascript behaviour on hyperlinks to still pass through. For example, editing the content of the various panels in a bootstrap tabs navbar:

I have found the following code snippets that set the related preventDefault() behaviour: FrameView and ComponentLinkView.
I tried unsetting the registered click events after loading GrapesJS using removeEventListener, but currently without any luck. Are there any suggestions on what I can try to disable this preventDefault() behaviour on specific elements. Or is it an idea to add the preventDefault only on elements with a href that does not start with a # for example?
Answers (1)
I solved it for now by adding an additional script to the component to listen for clicks on the li, which triggers directly the tab('show') call on the a.
$(document).find("li.nav-item").click(function() {
$(this).find('a').tab('show');
})
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2184
[QUESTION] Losing predefined media queries
Hi. I have a predefined json of a template which contains a set of html elements and styles which are parsed into the set of components upo...
Issue #2793
Extend Image Traits
Hello, i would like to extend the image type with some options, specially with a redirect option on click. I tried this solution after the...
Issue #2744
[QUESTION] Disable a block drag&drop
Hello everyone, I would like to make forbidden the drop of one block before another specific one. Context : i've create a new trait for som...
Issue #1485
How to prevent styling html components?
Im trying to create some templates, which should not be editable and styleable. So that when i drag in my blocks then should stay as define...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.