馃憢
Is there a way to create a placeholder element with children?
I've tried
const grid = new Muuri(el, {
dragEnabled: true,
dragPlaceholder: {
enabled: true,
createElement(item) {
const placeholder = document.createElement("div");
placeholder.className = "p-2";
placeholder.innerHTML = `<div class="bg-blue-100 rounded w-full h-full"></div>`;
return placeholder;
}
})
But it seems like the inner html is being cleared, the placeholder element is
<div class="muuri-item-placeholder p-2"></div>
Although looking at https://github.com/haltu/muuri/blob/49f562c7fd17f1c8177636b62e557624c5f2b81b/src/Item/ItemDragPlaceholder.js#L305 I can't find any instructions for "clearing" the placeholder element so I might be doing something else wrong.
Could you set up a live repro of this issue in e.g. codepen? To me it seems that you are doing everything as supposed to and there should be nothing in Muuri that clears the element's contents. Are you really really sure it does not work?
Here's a bit stripped down version of your example and it works: https://codepen.io/niklasramo/pen/mdPEwGz
@niklasramo sorry, I should've checked twice before opening the issue. I've force-refreshed my browser and it worked as expected. I think the problem was with me trying to use the previous (cached) version of the code.
Thank you for the great project and responding to my questions so fast!