How do I pass resizable onMove function in data-gjs-resizable attribute
You can write content as Component Definition instead of the HTML string
Read full answer below ↓Question
onStart event is working fine while creating component but I want to add it while creating block. Here is my code:
const keyWidth = 'flex-basis';
const step = 0.1;
const minDim = 1;
const currentUnit = 1;
const resizerRight = {
tl: 0, tc: 0, tr: 0, cl: 0, bl: 0, br: 0, cr: 1, bc: 0, keyWidth, currentUnit, minDim, step }
const attrsToString = attrs => {
const result = [];
for (let key in attrs) {
let value = attrs[key];
const toParse = value instanceof Array || value instanceof Object;
value = toParse ? JSON.stringify(value) : value;
result.push(`${key}=${toParse ? `'${value}'` : `"${value}"`}`);
}
return result.length ? ` ${result.join(' ')}` : '';
}
const attrsCell = attrsToString(colAttr);
if (c.blocks.grid) {
bm.add('grid', {
label: `
<div class="gjs-block-label">Grid</div>
`,
category: 'Basic',
attributes: { class: 'gjs-fonts gjs-f-b3' },
content: `
<div class="container">
<div class="row" data-gjs-selectable="false" data-gjs-hoverable="false" data-gjs-droppable="false" >
<div ${attrsCell}></div>
<div ${attrsCell}></div>
<div ${attrsCell}></div>
</div>
</div>
`
});
}Answers (1)
You can write content as Component Definition instead of the HTML string
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3135
[Help Wanted] How to easily override existing component ?
For example, I want to add a double click event handler on the default video component to open the assets manager. My basic idea was to get...
Issue #3586
how to listen the components change in a component.
init() { this.listenTo(this.model,'change:components', this.handleComponentsChange); }, I develop a component, I try to listen the child co...
Issue #3237
Add Trait For wrapper
Hi @artf I've added trait for wrapper this way. How can I perform the init function for the same Here is the code @artf Could you please he...
Issue #2404
Question: how to observe children changes in component
Is there an easy way to subscribe/listen to changes in the components/children of my custom component type? Perhaps an event I can subscrib...
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 →Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.