1 // (c) Benoît PIN 2006-2011
5 var CKEDITOR
= window
.dialogArguments
.CKEDITOR
;
6 var editor
= window
.dialogArguments
.editor
;
7 var pluginPath
= window
.dialogArguments
.pluginPath
;
9 window
.onload = function() {
10 var mainFrame
= window
.frames
['main'];
11 mainFrame
.src
= pluginPath
+ 'dialog/embedded_images.html';
12 mainFrame
.location
.href
= mainFrame
.src
;
14 var tabsFrame
= window
.frames
['tabs'];
15 tabsFrame
.src
= pluginPath
+ 'dialog/plinn_image_tabs.html';
16 tabsFrame
.location
.href
= tabsFrame
.src
;
19 function updateOrInsertImage(url
, relative
) {
21 var getSizeUrl
= window
.location
.protocol
+ '//' + window
.location
.host
+ '/' + editor
.contentPath
+ '/' + url
+ '/getResizedImageSize';
23 var getSizeUrl
= url
+ '/getResizedImageSize';
24 var req
= new XMLHttpRequest();
25 req
.open("POST", getSizeUrl
, false); // synchrone
26 req
.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
27 var boxSize
= editor
.config
.imageMaxDefaultDimension
+ '_' + editor
.config
.imageMaxDefaultDimension
;
28 req
.send("asXml:boolean=True&size=" + boxSize
);
29 var doc
= req
.responseXML
.documentElement
;
31 var width
= doc
.getElementsByTagName('width')[0].firstChild
.nodeValue
;
32 var height
= doc
.getElementsByTagName('height')[0].firstChild
.nodeValue
;
35 var imgHtml
= '<img src="' + url
+ '/getResizedImage?size=' + boxSize
+ '" ' +
36 'width="' + width
+ '" ' +
37 'height="' + height
+ '"' +
39 var img
= CKEDITOR
.dom
.element
.createFromHtml(imgHtml
);
40 editor
.insertElement(img
);