From ed691f028e7a4db464b4d3209f15b608b3fc4132 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Fri, 17 Dec 2004 06:45:36 +0000 Subject: [PATCH] new stuff --- .../tiny_mce/plugins/flash/editor_plugin.js | 194 ++++++++++++++++++ .../jscripts/tiny_mce/plugins/flash/flash.htm | 116 +++++++++++ .../tiny_mce/plugins/flash/readme.txt | 23 +++ 3 files changed, 333 insertions(+) create mode 100644 www/extras/tinymce/jscripts/tiny_mce/plugins/flash/editor_plugin.js create mode 100644 www/extras/tinymce/jscripts/tiny_mce/plugins/flash/flash.htm create mode 100644 www/extras/tinymce/jscripts/tiny_mce/plugins/flash/readme.txt diff --git a/www/extras/tinymce/jscripts/tiny_mce/plugins/flash/editor_plugin.js b/www/extras/tinymce/jscripts/tiny_mce/plugins/flash/editor_plugin.js new file mode 100644 index 000000000..0743e7438 --- /dev/null +++ b/www/extras/tinymce/jscripts/tiny_mce/plugins/flash/editor_plugin.js @@ -0,0 +1,194 @@ +/* Import theme specific language pack */ +tinyMCE.importPluginLanguagePack('flash', 'uk,se,de'); + +function TinyMCE_flash_getControlHTML(control_name) { + switch (control_name) { + case "flash": + return ''; + } + return ""; +} + +/** + * Executes the mceFlash command. + */ +function TinyMCE_flash_execCommand(editor_id, element, command, user_interface, value) { + // Handle commands + switch (command) { + case "mceFlash": + var template = new Array(); + template['file'] = '../../plugins/flash/flash.htm'; // Relative to theme + template['width'] = 400; + template['height'] = 180; + var name = "", swffile = "", swfwidth = "", swfheight = "", mceDo = "insert"; + if (tinyMCE.selectedElement != null && tinyMCE.selectedElement.nodeName.toLowerCase() == "img"){ + tinyMCE.flashElement = tinyMCE.selectedElement; + if (tinyMCE.flashElement) { + name = tinyMCE.flashElement.getAttribute('name') ? tinyMCE.flashElement.getAttribute('name') : ""; + if (name!='mce_plugin_flash') + return; + swfwidth = tinyMCE.flashElement.getAttribute('width') ? tinyMCE.flashElement.getAttribute('width') : ""; + swfheight = tinyMCE.flashElement.getAttribute('height') ? tinyMCE.flashElement.getAttribute('height') : ""; + swffile = tinyMCE.flashElement.getAttribute('alt') ? tinyMCE.flashElement.getAttribute('alt') : ""; + mceDo = "update"; + } + } + tinyMCE.openWindow(template, {editor_id : editor_id, swffile : swffile, swfwidth : swfwidth, swfheight : swfheight, mceDo : mceDo}); + return true; + } + // Pass to next handler in chain + return false; +} + +/** + * Called when content cleanup is performed. + */ +function TinyMCE_flash_cleanup(type, content) { + // Handle custom cleanup + switch (type) { + // Called when editor is filled with content + case "insert_to_editor": + return TinyMCE_flash_mkCodeCleanup('insertToEditor', content); + + // Called when editor is pass out content + case "get_from_editor": + return TinyMCE_flash_mkCodeCleanup('getFromEditor', content); + } + + // Pass through to next handler in chain + return content; +} + +function TinyMCE_flash_handleNodeChange(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) { + function getAttrib(elm, name) { + return elm.getAttribute(name) ? elm.getAttribute(name) : ""; + } + + tinyMCE.switchClassSticky(editor_id + '_flash', 'mceButtonNormal'); + + do { + if (node.nodeName.toLowerCase() == "img" && getAttrib(node, 'name').indexOf('mce_plugin_flash') == 0) + tinyMCE.switchClassSticky(editor_id + '_flash', 'mceButtonSelected'); + } while ((node = node.parentNode)); + + return true; +} + +/* Custom cleanup functions for the Flash support */ + +/**/ +// added 2004 by Michael Keck +// why such a thing? +// - okay it's needed to have a weelformated code for better searching +// and replacement of some elements +function TinyMCE_flash_mkAttribOrder(content) { + var attribOrder = new Array( + 'src','href','target','width','height','face','size','maxlength','border','align','valign', + 'cellpadding','cellspacing','colspan','rowspan','bgcolor','background','color','class','style', + 'alt','title','name','id','classid','codebase','menu','quality','pluginspage','type','value', + 'checked','disabled','readonly','selected','method','enctype', + 'onmouseover','onmouseout','onclick','onfocus','onblur','onchange','noshade' + ); + var tagArray = new Array(); + tagArray = content.split('<'); + var orgTags = new Array(); + var newTags = new Array(); + tagCount = -1; + for (var i=1; i'); + tagCount++; + orgTags[tagCount] = '<' + tmpTag[0] + '>'; + } + } + for (var i=0; i')!=-1) { + savedSlash=' />'; + } + if (orgTags[i].indexOf(" ")!=-1) { + for (var j=0; j\n','gi'),'>'); + content = content.replace(new RegExp('\n<','gi'),'<'); + content = content.replace(new RegExp('','gi'),''); + content = content.replace(new RegExp('','gi'),''); + content = content.replace(new RegExp('','gi'),''); + content = content.replace(new RegExp(']*>','gi'),''); + content = content.replace(new RegExp('strong>','gi'),'b>'); + content = content.replace(new RegExp('em>','gi'),'em>'); + content = TinyMCE_flash_mkAttribOrder(content); +// a special order in attrib list is needed + swfObjSearch = new RegExp('' + + '' + + '' + + '' + + '','gi'); + swfObjReplace = '' + + '' + + ''; + content = content.replace(swfObjSearch,swfObjReplace); + switch(action) { + case 'insertToEditor': + objSearch = new RegExp('' + + '' + + '','gi'); + objReplace = '$3'; + content = content.replace(objSearch,objReplace); + break; + case 'getFromEditor': + objSearch = new RegExp('([^','gi'); + objReplace = '' + + '' + + ''; + content = content.replace(objSearch,objReplace); + break; + } + content = content.replace(new RegExp('\r\n','gi'),'\n'); + content = content.replace(new RegExp('>\n','gi'),'>'); + content = content.replace(new RegExp('\n<','gi'),'<'); + content = TinyMCE_flash_mkAttribOrder(content); + content = content.replace(new RegExp('\r\n','gi'),'\n'); + content = content.replace(new RegExp('>\n','gi'),'>'); + content = content.replace(new RegExp('\n<','gi'),'<'); + return content; +/**/ +} + diff --git a/www/extras/tinymce/jscripts/tiny_mce/plugins/flash/flash.htm b/www/extras/tinymce/jscripts/tiny_mce/plugins/flash/flash.htm new file mode 100644 index 000000000..49be5305b --- /dev/null +++ b/www/extras/tinymce/jscripts/tiny_mce/plugins/flash/flash.htm @@ -0,0 +1,116 @@ + + + + +{$lang_insert_flash} + + + + + +
+ + + + + + + + + + + + + + + +
{$lang_insert_flash}

+ + + + + + + + +
{$lang_insert_flash_file}: + +
{$lang_insert_flash_size}: + +  x  + +

+   +
+
+ + diff --git a/www/extras/tinymce/jscripts/tiny_mce/plugins/flash/readme.txt b/www/extras/tinymce/jscripts/tiny_mce/plugins/flash/readme.txt new file mode 100644 index 000000000..8866ee257 --- /dev/null +++ b/www/extras/tinymce/jscripts/tiny_mce/plugins/flash/readme.txt @@ -0,0 +1,23 @@ + FLASH plugin for TinyMCE +----------------------------- + +About: + This is the INSERT FLASH Dioalog contributed by Michael Keck. + This one supports popup windows and targets. + +Note: + The placeholder for Flash is called 'mce_plugin_flash' and needs a class 'mce_plugin_flash' in the 'css_-style'. + Do not name another image 'name="mce_plugin_flash"! + +Installation instructions: + * Copy the flash directory to the plugins directory of TinyMCE (/jscripts/tiny_mce/plugins). + * Add plugin to TinyMCE plugin option list example: plugins : "flash". + * Add this "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]" to extended_valid_elements option. + +Initialization example: + tinyMCE.init({ + theme : "advanced", + mode : "textareas", + plugins : "flash", + extended_valid_elements : "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]" + });