v1/web/themes/contrib/gin/dist/js/edit_form.js

16 lines
772 B
JavaScript

(Drupal => {
Drupal.behaviors.ginEditForm = {
attach: context => {
once("ginEditForm", ".region-content form.gin-node-edit-form", context).forEach((form => {
const sticky = context.querySelector(".gin-sticky"), newParent = context.querySelector(".region-sticky__items__inner");
if (newParent && 0 === newParent.querySelectorAll(".gin-sticky").length) {
newParent.appendChild(sticky);
const actionButtons = newParent.querySelectorAll("button, input, select, textarea");
actionButtons.length > 0 && actionButtons.forEach((el => {
el.setAttribute("form", form.getAttribute("id")), el.setAttribute("id", el.getAttribute("id") + "--gin-edit-form");
}));
}
}));
}
};
})(Drupal);