X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Ftiny_mce%2Fplugins%2Fadvimage%2Feditor_plugin_src.js;h=d2678cbcf2ed8b5fa3cbc9a5fa9d0aab05f73fd2;hb=b05f4eef4014db3885787ef15107cba93c932ac9;hp=fbfd6541e2d3650bd51957014a255b0ed07f23e2;hpb=932f4feaa7b2afe4553e5e669e2312614d3f6140;p=citadel.git diff --git a/webcit/tiny_mce/plugins/advimage/editor_plugin_src.js b/webcit/tiny_mce/plugins/advimage/editor_plugin_src.js old mode 100755 new mode 100644 index fbfd6541e..d2678cbcf --- a/webcit/tiny_mce/plugins/advimage/editor_plugin_src.js +++ b/webcit/tiny_mce/plugins/advimage/editor_plugin_src.js @@ -1,148 +1,50 @@ /** - * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ + * editor_plugin_src.js * - * @author Moxiecode - * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. + * Copyright 2009, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://tinymce.moxiecode.com/license + * Contributing: http://tinymce.moxiecode.com/contributing */ -/* Import plugin specific language pack */ -tinyMCE.importPluginLanguagePack('advimage'); - -var TinyMCE_AdvancedImagePlugin = { - getInfo : function() { - return { - longname : 'Advanced image', - author : 'Moxiecode Systems AB', - authorurl : 'http://tinymce.moxiecode.com', - infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage', - version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion - }; - }, - - getControlHTML : function(cn) { - switch (cn) { - case "image": - return tinyMCE.getButtonHTML(cn, 'lang_image_desc', '{$themeurl}/images/image.gif', 'mceAdvImage'); - } - - return ""; - }, - - execCommand : function(editor_id, element, command, user_interface, value) { - switch (command) { - case "mceAdvImage": - var template = new Array(); - - template['file'] = '../../plugins/advimage/image.htm'; - template['width'] = 480; - template['height'] = 380; - - // Language specific width and height addons - template['width'] += tinyMCE.getLang('lang_advimage_delta_width', 0); - template['height'] += tinyMCE.getLang('lang_advimage_delta_height', 0); - - var inst = tinyMCE.getInstanceById(editor_id); - var elm = inst.getFocusElement(); - - if (elm != null && tinyMCE.getAttrib(elm, 'class').indexOf('mceItem') != -1) - return true; - - tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"}); - - return true; +(function() { + tinymce.create('tinymce.plugins.AdvancedImagePlugin', { + init : function(ed, url) { + // Register commands + ed.addCommand('mceAdvImage', function() { + // Internal image object like a flash placeholder + if (ed.dom.getAttrib(ed.selection.getNode(), 'class', '').indexOf('mceItem') != -1) + return; + + ed.windowManager.open({ + file : url + '/image.htm', + width : 480 + parseInt(ed.getLang('advimage.delta_width', 0)), + height : 385 + parseInt(ed.getLang('advimage.delta_height', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + // Register buttons + ed.addButton('image', { + title : 'advimage.image_desc', + cmd : 'mceAdvImage' + }); + }, + + getInfo : function() { + return { + longname : 'Advanced image', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; } + }); - return false; - }, - - cleanup : function(type, content) { - switch (type) { - case "insert_to_editor_dom": - var imgs = content.getElementsByTagName("img"), src, i; - for (i=0; i