[question] How I can get AssetManger selected image from outside the editor
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 #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:...
Issue #2055
[QUESTION]: How to remove the components correctly?
I want to remove the components programmatically, the following is my code snippet. After the components have been removed, then undo the d...
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...
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.