forked from a64f7bb4-7358-4778-9fbe-3b882c34cc1d/v1
16 lines
772 B
JavaScript
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); |