Basically I need that the target="_blank" attribute would be added to all the external URLs inserted in the wagtail Draftail richtext editor:
In [2]: wagtail.__version__
Out[2]: '2.0.1'
EDIT-1: This is not a duplicate. wagtail version 2 uses completely different richtext editor.
The proposed answer suggests $('a[href^="http://"]').attr('target', '_blank') which would add the appropriate attribute to the all links on the page which contain http://. It's very suboptimal solution, as there may be many more links on the page which do not require such a treatment. Obviously there must be more adequate fix, especially because wagtail already differentiate Internal and External links on the editor UI (see attached image).
EDIT-2:
It seems that in the wagtail.core.rich_text.feature_registry.FeatureRegistry class there is a method, which to my best understanding assign different handler to the different URL type, however I don't see what these these handlers are, how they get called or how to modify them?
def register_link_type(self, link_type, handler):
self.link_types[link_type] = handler
