Issue #2115Opened July 3, 2019by vish43950 reactions

[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)

vish4395July 3, 20190 reactions

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?

artfJuly 12, 20190 reactions

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.

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.