From: Benoît Pin Date: Fri, 19 Aug 2011 08:02:40 +0000 (+0200) Subject: Insertion des images attachées migrée. X-Git-Tag: 3.6.1~8 X-Git-Url: https://scm.cri.mines-paristech.fr/git/ckeditor.git/commitdiff_plain/122c181a42e170ed382fae81244030a4bc67adf1?ds=inline;hp=ff15447525986336e81f8bc423a23047c732bbe1 Insertion des images attachées migrée. --- diff --git a/skins/ckeditor/config.js b/skins/ckeditor/config.js index 322d3f2..b9eb18c 100644 --- a/skins/ckeditor/config.js +++ b/skins/ckeditor/config.js @@ -33,5 +33,6 @@ CKEDITOR.editorConfig = function( config ) config.filebrowserWindowHeight = 600; config.filebrowserWindowWidth = 801; config.attachmentBrowserConnectorUrl = CKEDITOR.basePath + 'plugins/plinn_image/connectors/plinn/connector'; + config.imageMaxDefaultDimension = 500 ; // image inserted will be cropped at this size. config.extraPlugins = 'plinn_image'; }; \ No newline at end of file diff --git a/skins/ckeditor/plugins/plinn_image/dialog/embedded_images.html.pt b/skins/ckeditor/plugins/plinn_image/dialog/embedded_images.html.pt index 99e57aa..0034dd1 100644 --- a/skins/ckeditor/plugins/plinn_image/dialog/embedded_images.html.pt +++ b/skins/ckeditor/plugins/plinn_image/dialog/embedded_images.html.pt @@ -137,25 +137,24 @@ 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); diff --git a/skins/ckeditor/plugins/plinn_image/dialog/plinn_image.js b/skins/ckeditor/plugins/plinn_image/dialog/plinn_image.js index 7962d13..bb4883c 100644 --- a/skins/ckeditor/plugins/plinn_image/dialog/plinn_image.js +++ b/skins/ckeditor/plugins/plinn_image/dialog/plinn_image.js @@ -1,14 +1,10 @@ -// (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']; @@ -20,12 +16,15 @@ window.onload = function() { 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; @@ -33,11 +32,11 @@ function updateOrInsertImage(url) { 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 = ''; + var img = CKEDITOR.dom.element.createFromHtml(imgHtml); + editor.insertElement(img); window.close(); } \ No newline at end of file diff --git a/skins/ckeditor/plugins/plinn_image/plugin.js b/skins/ckeditor/plugins/plinn_image/plugin.js index df81531..022af4c 100644 --- a/skins/ckeditor/plugins/plinn_image/plugin.js +++ b/skins/ckeditor/plugins/plinn_image/plugin.js @@ -35,6 +35,7 @@ function openPlinnImageDialog(path, editor) { win.dialogArguments = new Object(); win.dialogArguments.editor = editor; win.dialogArguments.pluginPath = path; + win.dialogArguments.CKEDITOR = CKEDITOR; }