config.filebrowserWindowHeight = 600;\r
config.filebrowserWindowWidth = 801;\r
config.attachmentBrowserConnectorUrl = CKEDITOR.basePath + 'plugins/plinn_image/connectors/plinn/connector';\r
+ config.imageMaxDefaultDimension = 500 ; // image inserted will be cropped at this size.\r
config.extraPlugins = 'plinn_image';\r
};
\ No newline at end of file
switch (target.tagName) {
case 'IMG' :
var a = target.parentNode;
- window.parent.updateOrInsertImage(a.getAttribute('href', 2));
+ window.parent.updateOrInsertImage(a.getAttribute('href', 2), true);
break;
- case 'A' :
- if (target.name == 'suppr')
- var a = target.parentNode.parentNode.getElementsByTagName('a')[0];
- var href = a.getAttribute('href', 2);
- var imgPath = window.parent.editor.FCKConfig.EditorPath + href;
-
- var req = new XMLHttpRequest();
- req.open("POST", connUrl, false); // synchrone
- req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
- req.send("command=rm&path="+escape(imgPath));
- var doc = req.responseXML.documentElement;
- if (doc.tagName == 'done') {
- var slide = target.parentNode.parentNode;
- slide.parentNode.removeChild(slide);
- }
+// case 'A' :
+// if (target.name == 'suppr')
+// var a = target.parentNode.parentNode.getElementsByTagName('a')[0];
+// var href = a.getAttribute('href', 2);
+// var imgPath = window.parent.editor.FCKConfig.EditorPath + href;
+//
+// var req = new XMLHttpRequest();
+// req.open("POST", connUrl, false); // synchrone
+// req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
+// req.send("command=rm&path="+escape(imgPath));
+// var doc = req.responseXML.documentElement;
+// if (doc.tagName == 'done') {
+// var slide = target.parentNode.parentNode;
+// slide.parentNode.removeChild(slide);
+// }
}
-
}
addListener(window, 'load', _initBrowser);
-// (c) Benoît PIN 2006-2007
+// (c) Benoît PIN 2006-2011
// http://plinn.org
// Licence GPL
+var CKEDITOR = window.dialogArguments.CKEDITOR;
var editor = window.dialogArguments.editor;
var pluginPath = window.dialogArguments.pluginPath;
-//var FCK = editor.FCK ;
-//var FCKLang = editor.FCKLang ;
-//var FCKConfig = editor.FCKConfig ;
-//var FCKPlugins = editor.FCKPlugins;
-//var FCKDebug = editor.FCKDebug ;
window.onload = function() {
var mainFrame = window.frames['main'];
tabsFrame.location.href = tabsFrame.src;
}
-function updateOrInsertImage(url) {
- var getSizeUrl = url + '/getResizedImageSize';
+function updateOrInsertImage(url, relative) {
+ if (relative)
+ var getSizeUrl = window.location.protocol + '//' + window.location.host + '/' + editor.contentPath + '/' + url + '/getResizedImageSize';
+ else
+ var getSizeUrl = url + '/getResizedImageSize';
var req = new XMLHttpRequest();
req.open("POST", getSizeUrl, false); // synchrone
req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
- var boxSize = FCKConfig.ImageMaxDefaultDimension + '_' + FCKConfig.ImageMaxDefaultDimension;
+ var boxSize = editor.config.imageMaxDefaultDimension + '_' + editor.config.imageMaxDefaultDimension;
req.send("asXml:boolean=True&size=" + boxSize);
var doc = req.responseXML.documentElement;
var height = doc.getElementsByTagName('height')[0].firstChild.nodeValue;
- var img = FCK.CreateElement('img');
- img.src = url + '/getResizedImage?size=' + boxSize;
- img.width = width;
- img.height = height;
-
- //FCK.InsertElement(img);
+ var imgHtml = '<img src="' + url + '/getResizedImage?size=' + boxSize + '" ' +
+ 'width="' + width + '" ' +
+ 'height="' + height + '"' +
+ '/>';
+ var img = CKEDITOR.dom.element.createFromHtml(imgHtml);
+ editor.insertElement(img);
window.close();
}
\ No newline at end of file
win.dialogArguments = new Object();
win.dialogArguments.editor = editor;
win.dialogArguments.pluginPath = path;
+ win.dialogArguments.CKEDITOR = CKEDITOR;
}