Custom Resizer issue (or maybe how I'm saving/loading components)
Yeah, you're right. This happens just because functions are not serializable, therefore when grapesjs calls JSON.stringify(Component) are simply ripped off. The solution for your case is to override toJSON method in the custom Component
Read full answer below ↓Question
I'm trying to build a custom resizer for one of my components. It's a grid/column layout based on Flexbox and I want users to be able to resize one column (to a fixed width) and have the other columns fill up the remaining space. I already have a custom component for my column, so I added resizer configuration to it, including an updateTarget() function, and it works great. However, if I save that content, and then come back to it, the updateTarget() function never gets invoked. New components that I add to the canvas work fine, but existing ones do not. Here's my config: When I save the cont...
Answers (3)
Yeah, you're right. This happens just because functions are not serializable, therefore when grapesjs calls JSON.stringify(Component) are simply ripped off. The solution for your case is to override toJSON method in the custom Component
Thanks @artf that did the trick.
@thecodefish How do you change initial state of the Resizer properties? Where does this config go if I'm using the grapesjs-preset-webpage, simply under grapesjs.init{...}? I want to fix a minimum dimension for an image component specifically and disable a few of the corner points like tl, tc, tr.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1892
[Question] Flexbox column is not working correctly.
Hi @artf , We are using flexbox block. The problem is, when we are trying to resize the middle column it affects all other columns, like au...
Issue #460
When the component's view modifies the HTML, text components are no longer editable
I'm trying to build a custom component that contains some lorem ipsum text in the content, for editing once it's on the canvas. But I also...
Issue #1030
[Question] Firing events with custom components
I'm trying to build a plugin for Grapesjs with some custom components, and I'm having trouble with triggering events and interacting with t...
Issue #1988
bug on resize image
Hi ! I have some issues when i want resize an image. When i put an image and when i click one resizer handler, the image don't keep his hei...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.
Browse premium plugins →Related tutorials
In-depth guides on the same topic.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.