How to default the external link tab in RichTextBlock link modal in Wagtail admin?

38 Views Asked by At

I'm using Wagtail CMS and noticed that when I try to add a link in a RichTextBlock in the Wagtail admin interface, the link modal defaults to the internal link tab. However, I want it to default to the external link tab instead.

I've explored some of the Wagtail source code and found client/src/entrypoints/admin/page-chooser-modal.js, which seems to handle the switching of tabs in the link modal. However, I'm unsure how to modify this to make the external link tab the default.

I've also looked at the templates wagtailadmin/chooser/_link_types.html and wagtailadmin/chooser/browse.html. It seems like browse.html renders content for internal links by default. While I could potentially modify this template to render external links, it seems like the data for external links needs to be passed from a view, so simply changing the template might not be sufficient.

I saw the ModalWorkflow in chooserModal.js file, but it seems to open up a new modal. However, I'm trying to find a way to reference the currently open modal and choose the external link tab there. Is there a way to accomplish this?

Am I looking in the right places to achieve this customization? If not, where should I be looking, and how can I default the link modal to the external link tab?

0

There are 0 best solutions below