How I can get AssetManger selected image from outside the editor
I found the solution It helps me to use asset manager for changing the image field outside the editor. Is this is the right way to use it?
Read full answer below ↓Question
Hello, I want to get selected image from AssetManger model. Thank You.
Answers (2)
I found the solution
function getGrapeJsAssetManager(editor,targetElem,targetInput){
editor.runCommand('open-assets', {
target: targetElem,
onSelect: function onSelect(t) {
targetElem.attr('src',t.id);
targetInput.val(t.id);
},
onClick: function onSelect(t) {
targetElem.attr('src',t.id);
targetInput.val(t.id);
}
});
}
It helps me to use asset manager for changing the image field outside the editor. Is this is the right way to use it?
Yes, but probably I'd remove onClick function as it's already done by onSelect
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3347
How can I get Uncompressed JS code for me to edit?
Hi, thank you for reviewing my problem. I want to use my own JSEditor to edit html、css and js. 1、First, I use getHtml, getCss, getJs to dis...
Issue #3328
How can I update the nodeValue (text value) of components by inputs forms
Hello. Grapesjs is a great tool. Thanks for it. I want to update the text value of a component by inputs, how can I do that?? if a user fil...
Issue #2770
[QUESTION] Set selected element
Hello, is there a way to select an element after added to the body? When i add a link, i want to open the Component Settings immediately. H...
Issue #1814
[Question]: How to fire event which triggers component:selected with my component
I want to select my component whenever it is dragged from blocks to canvas and rendered, I have tried with registering events on component:...
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.