Closed hitaloramon closed 1 year ago
hi @hitaloramon , I have the same problem, is your problem solved ?
Hi @sizhousama,
I managed to resolve it. I put the complete example, but what suits you is from line 9 to 25
@hitaloramon, I have the same issue but your link doesn't appear to work. Would you mind sharing your solution?
@mstevens625 link working
Thanks @hitaloramon, that helped tremendously.
I use it with ckfinder,this is my code,it do not work.
cmdm.add('open-assets', {
run(editor, sender, opts) {
// console.log(editor)
// console.log(editor)
console.log(editor);
console.log(sender);
console.log(opts)
var finder = new CKFinder();
finder.basePath = '/resource/ckfinder/';
finder.selectActionFunction = function(fileUrl, data) {
console.log(opts)
opts.target.set('src', fileUrl);
console.log(opts.target)
}
finder.selectActionData = '';
finder.popup();
}
});
This work
assetManager: {
custom: {
open(props) {
var finder = new CKFinder();
finder.basePath = '/resource/ckfinder/';
finder.selectActionFunction = function(fileUrl, data) {
// opts.target.set('src', fileUrl);
props.select(fileUrl);
props.close();
}
finder.selectActionData = '';
var api = finder.popup();
},
close(props) {
// finder.close();
}
}
},
Hi @artf,
I have a custom asset manager in my project that works normally when I add an image and use it to select an item. However in the style-bg plugin when I click the button to open select an image for the background my file manager opens and when I select the image nothing happens. Is there anything that needs to be done to work in the style-bg plugin?
Obs: I'm using the latest versions of grapejs and the style-bg plugin
editor.Commands.add('open-assets', { run(editor, sender, opts = {}) {... var image = 'path-img.jpg'; opts.target.set('src', image ); } })