Issue #482Opened November 3, 2017by krunal0390 reactions

Default asset manager in custom component

Question

Code SnippetTEXT
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()
          });
        }
});`

![sample](https://user-images.githubusercontent.com/11716808/32366985-61acb146-c078-11e7-86b0-c8f7fd4c5368.png)

Answers (3)

artfNovember 6, 20170 reactions

@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>`
})
krunal039November 6, 20170 reactions

@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?

artfNovember 6, 20170 reactions

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.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.