Loads asset manager, but assets not working
Question
I'm using the pencil icon to trigger the asset manager. The triggering works fine but when I click on any of the images, no change is reflected in my image component. It shows me the existing photo even if I select a different image.
domc.addType("image", {
model: {
initToolbar() {
typeImage.prototype.initToolbar.apply(this, arguments);
const tb = this.get("toolbar");
const tbExists = tb.some(item => item.command === "open-assets");
if (!tbExists) {
tb.unshift({
command: "open-assets",
label: toolbarIcon
});
this.set("toolbar", tb);
}
},
}
}
});
Answers (3)
Click on the image you want to be replaced, in developer console write the following code snippet:
editor.runCommand('open-assets', {
target: editor.getSelected()
});
You will see the selected image gets changed. The key here is target: editor.getSelected() , the selected image is treated as the target for the new image to take it's place. You need to trigger the above code when the pencil icon is clicked.
tb.unshift({
command: editor => editor.runCommand('open-assets', {
target: editor.getSelected(),
}),
label: toolbarIcon
});
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1719
Event while click on image from asset modal
Hello @artf , Hope you are doing well. I am working on asset-manager. I have total 5 images as a default asset-manager image. I want to do...
Issue #1493
[QUESTION] render() works on the first time but not on subsequent calls
Hello, I've created a custom component that shows images using background-image on a <div> instead of using an <img> element. It's mostly w...
Issue #1868
How to enable functionality only for specific image component, not all
I've enabled the fa fa-pencil icon into my image components, but I want it to be enabled only in specific image components, not all of them...
Issue #1891
Can't create new button component
I'm having a hard time creating a new component for a <button> element. What am I missing? Is something bugged out here? Works fine if I ch...
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.