{# Image picker grid for the TipTap editor. Loaded into a `` via htmx by the post / page admin edit pages. Each card carries `data-*` attributes that the editor's client-side script reads to build a markdown image link, then inserts it at the cursor. Pagination uses htmx swap-into-this-container so an operator can page through without closing the dialog. Tab support: if any plugin contributes via `register_image_picker_tab`, a tab nav appears with "Library" always first, then contributed tabs in the order the hook returns them. When no plugin contributes, the single-pane shape is rendered with no extra chrome, preserving the existing UX exactly. #} {% set _picker_tabs = image_picker_tabs() %}
{# Picker is scoped to the current site by URL (P2 #78); the post / page editor that opens this dialog is itself site-scoped, so the picker always loads the right corpus. #} {% if _picker_tabs %} {# Tab nav: Library (built-in) + each contributed tab. Tab styling lives in the scoped
{% for tab in _picker_tabs %} {% endfor %}
{# Library pane (always present). #}
{% include "admin/_attachments_picker_library.html" %}
{# Contributed plugin panes. #} {% for tab in _picker_tabs %} {% endfor %} {% else %} {# No plugin tabs: render the library grid directly, same shape as before this tab mechanism was added. #} {% include "admin/_attachments_picker_library.html" %} {% endif %}