My own file manager doesn't work in elrte
Hi,
I need to help with integration of my own file/image manager.
I call it this way:
fmOpen : function(callback) {
window.open('/-/file-manager/?dir=&id=<?= $val['name']; ?>', '_blank', 'left=100, top=100, width=640, height=480');
}
Dialog window open, but if I choose any image/file, I call this function:
function vlozFile(cesta, id, texy, file) {
window.opener("<a href='" + cesta + "' onclick='window.open(this.href); return false;' title='" + file + "'>" + file + "</a>");
window.close();
}
... nothing happend :(
Can someone help me with this? Has elRTE any function for inserting html this way? I've tried function insertHtml, but console was against it.
Replies (3)
RE: My own file manager doesn't work in elrte
-
Added by Troex Nevelin 12 months ago
This will not work like this, you need to call callback(url); from fmOpen function, where url is url to your selected file.
RE: My own file manager doesn't work in elrte
-
Added by J B 12 months ago
I see, but even if I try this
fmOpen : function(callback) {
url = '/img/__manager/logo_becorp.png';
callback(url);
}
nothing happend when I clicked on the icon with folder in toolbar.
And I have one more question. I use the same kind of manager for files and for images, but they're different only in small settings. So I need start image manager when user click on the icon of image and file manager when user click on the icon with folder.
I found this function elRTE.prototype.ui.prototype.buttons.image = function(rte, name) in elrte.js, put there this code
window.open('/-/file-manager/?dir=&id=<?= $val['name']; ?>&type=img', '_blank', 'left=100, top=100, width=640, height=480'); // similiar to up, but there is one more parameter &type=img - btw. this is the different between file manager and image manager.
and when user click on the icon with image, new window is open, but when user choose the image, it doesn't insert into editor. (this is the same problem like with files. Just, when I choose file or image from my own manager, it doesn't insert into editor.)
please, any ideas?
RE: My own file manager doesn't work in elrte
-
Added by Troex Nevelin 12 months ago
J B wrote:
I see, but even if I try this [...] nothing happend when I clicked on the icon with folder in toolbar.
Nothing will happen, the icon on toolbar is only for calling (opening) file manager, if you want to insert image than use image insert dialog, that is where your callback will be called.
About your second question...
If you want different behavior for FM button in toolbar, than better define your own button instead of hacking elRTE.
(1-3/3)