Skip to content

Instantly share code, notes, and snippets.

@davidpmccormick
davidpmccormick / prismic-summary.js
Created October 25, 2023 10:30
Wraps the items from a Prismic repeating group field in a details/summary for easier re-ordering
let widgetGroups = document.querySelectorAll('.widget-Group');
[...widgetGroups].forEach(widgetGroup => {
let groupWrapper = widgetGroup.querySelector('.group-wrapper');
let standaloneTitle = groupWrapper.querySelector('[data-widget-key="standaloneTitle"] .ProseMirror').textContent;
let title = groupWrapper.querySelector('[data-widget-key="title"] .ProseMirror').textContent;
let tools = widgetGroup.querySelector('.tools');
tools.style.top = "0";
let detailsNode = document.createElement('details');