Default asset manager in custom component
Question
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 to use default asset manager to select image but not sure how to get selected image in custom component? below is code I have used
`
view: defaultType.view.extend({
init() {
this.listenTo(this.model, 'active', this.doStuff); // listen for active event
},
doStuff() {
editor.runCommand('open-assets', {
target: editor.getSelected()
});
}
});`
Answers (3)
@krunal039 Why do you need a custom component? Your template seems to be pretty simple, what about just a simple block?
editor.BlockManager.add('your-block', {
label: 'Custom Block',
content: `<div class="row-class">
<div class="column-class">
<img src="..." />
</div>
...
</div>`
})
@artf thanks for reply, we need user input for hover text, background image and text and hyperlink at bottom and thought to use custom component, but if we can prompt user to enter above then happy to create just block, can you pease guide me in correct direction, I am struggling since 4-5 days?
Try to create a block with your template, drag it inside the canvas and you will be able to change all that stuff
Related Questions and Answers
Continue research with similar issue discussions.
Issue #514
template/ Blocks/ Components
We have requirement to create custom templates for different areas and all templates has below 4 variables anchor link, anchor target, imag...
Issue #362
How to create custom link components that prompts users to type link/choose link similar to Images Component Modal
Image Components have logic to call Modal and prompt user's interaction for options/configuration of image url. Would like to do similar to...
Issue #935
[QUESTION] In creating a custom block how do you create it's corresponding settings?
I want to make a link that will let the user enter the url for it or to let him choose a link to another page which he already created.
Issue #1009
[Question] Richtext editor for trait
Is there way to have richtext box for trait. We want to user to insert rich text for trait and not sure how can we do it. We have below use...
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.