From aff137f891952aaa6ff581ad9edc39198f82abc7 Mon Sep 17 00:00:00 2001 From: michal Date: Fri, 24 Jun 2011 15:56:15 +0200 Subject: [PATCH 244/244] [#1198068] Confusing behavior with IMCE button implimentation --- plugins/imce/plugin.js | 24 ++++++++++++++++++++---- 1 files changed, 20 insertions(+), 4 deletions(-) diff --git a/plugins/imce/plugin.js b/plugins/imce/plugin.js index 5210020..bb4c507 100644 --- a/plugins/imce/plugin.js +++ b/plugins/imce/plugin.js @@ -34,26 +34,42 @@ For licensing, see LICENSE.html or http://ckeditor.com/license //function which receive imce response window.ckeditor_setFile = function (file, win) { - var cfunc = win.location.href.split('&'); + var cfunc = win.location.href.split('&'); for (var x in cfunc) { if (cfunc[x].match(/^CKEditorFuncNum=\d+$/)) { cfunc = cfunc[x].split('='); break; } } - + + CKEDITOR.tools.callFunction(cfunc[1], file); win.close(); }; + } } ); function setFile(file) { + var sel = this.getSelection(), + text = sel.getSelectedText(); //checking if it is image if (file.width != 0 && file.height != 0) { + if (text) + { + this.insertHtml('' + text + ''); + //this.insertHtml('' + file.name + ''); + }else{ this.insertHtml('' + file.name + ''); - } else { - this.insertHtml('' + file.name + ''); + } + } else { + if (text) + { + this.insertHtml('' + text + ''); + }else + { + this.insertHtml('' + file.name + ''); + } } } } )(); -- 1.7.4.msysgit.0