[Question] How do I pass resizable onMove function in data-gjs-resizable attribute
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 #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...
Issue #2076
[QUESTION] How make a new component to allow laravel blade directives?
Hi, thanks for the nice work. I'll like to know if there is a way to use blade directives inside the code. I already add a new functionalit...
Issue #2061
[QUESTION] How to place a component at the end of the canvas.
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
Issue #1720
[QUESTION] How to add the button in custom traits
Hi, I try to add a button to my custom traits for my custom blocks but its not working fine as expected and also need to know how to call t...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.