grapesjs icon indicating copy to clipboard operation
grapesjs copied to clipboard

[QUESTION] How to place a component at the end of the canvas.

Open froderf opened this issue 7 years ago • 6 comments

How can I put my footer at the end of the canvas?

I want the editor to not allow placing a block/widget below the footer.

example


<!-- only allow dragging/placing of widgets here -->

FOOTER
<!-- Should not have blocks/widgets below this -->

froderf avatar Jun 02 '19 12:06 froderf

You can use something like this

const footer = '<div style="padding: 100px">My footer</div>';
editor.getWrapper().getEl().insertAdjacentHTML('afterEnd', footer);

artf avatar Jun 12 '19 22:06 artf

@artf Do we have something like removeAdjacentHTML() editor.getWrapper().getEl().removeAdjacentHTML('afterEnd', footer);

because when we used

const footer = '<div style="padding: 100px">My footer</div>';
editor.getWrapper().getEl().insertAdjacentHTML('afterEnd', footer);

it keeps duplicating every after you reload the window.


I'm looking for a way to solve this but no luck :( Seems like a bug?

froderf avatar Jun 15 '19 04:06 froderf

Do we have something like removeAdjacentHTML()

getEl() gives you the HTMLElement instance so insertAdjacentHTML is from DOM API, not GrapesJS

it keeps duplicating every after you reload the window.

... can you create a reproducible demo?

artf avatar Jun 15 '19 09:06 artf

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jun 24 '20 23:06 lock[bot]

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jun 24 '20 23:06 lock[bot]

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jun 24 '20 23:06 lock[bot]