template/ Blocks/ Components
Question
We have requirement to create custom templates for different areas and all templates has below 4 variables anchor link, anchor target, image source, image hover text, title. We want to create one custom component and it will provide mechanism to select variables via traits. Is there way to provide template via block and use that under custom component rather than generation template in component?
We want to decouple component and block so block will provide template(i.e attached image) and component will replace placeholder with user selected values?
Answers (2)
Well, with data-gjs-* attribute you can even use objects (JSONs)
content: '<div class="cls" data-gjs-attrobj='{"valid":"json"}'></div>',
but, for bigger templates, I'd recommend block definition via an object instead
content: {
// Just model's properties
draggable: false,
traits: ...
...
// It's ok also using a string, components: `<div ...>...`
components: [{
type: 'text',
content: 'Text here'
}, ...
]
},
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.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #482
Default asset manager in custom component
I am in process to create custom component for below template and we want to have user enter text,link,hover text and select image and want...
Issue #455
Need help: Ask for user input for text/imageurl/hyperlink
we are building template where it will render div with background image and on hover it will display some text, also there will be hyper li...
Issue #1464
Customizing the Component Position
First of all thank you guys for this awesome library, And I have one Clarification that is how do i customize the drop position example if...
Issue #1965
Custom content type
@artf Instead of using plugins js files, can we create our own content using html as I have done below. Is it a correct way to do it? Sorry...
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.