includes/clientside/tinymce/plugins/media/editor_plugin_src.js
changeset 1193 e3b94bd055dc
parent 778 57ce13805b6f
--- a/includes/clientside/tinymce/plugins/media/editor_plugin_src.js	Mon Dec 21 15:41:05 2009 -0500
+++ b/includes/clientside/tinymce/plugins/media/editor_plugin_src.js	Tue Dec 22 13:09:59 2009 -0500
@@ -1,5 +1,5 @@
 /**
- * $Id: editor_plugin_src.js 952 2008-11-03 17:56:04Z spocke $
+ * $Id: editor_plugin_src.js 1222 2009-09-03 17:26:47Z spocke $
  *
  * @author Moxiecode
  * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
@@ -61,7 +61,7 @@
 				if (ed.settings.content_css !== false)
 					ed.dom.loadCSS(url + "/css/content.css");
 
-				if (ed.theme.onResolveName) {
+				if (ed.theme && ed.theme.onResolveName) {
 					ed.theme.onResolveName.add(function(th, o) {
 						if (o.name == 'img') {
 							each(lo, function(v, k) {
@@ -165,14 +165,14 @@
 				o.content = o.content.replace(/_mce_value=/g, 'value=');
 			});
 
-			if (ed.getParam('media_use_script')) {
-				function getAttr(s, n) {
-					n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s);
+			function getAttr(s, n) {
+				n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s);
 
-					return n ? ed.dom.decode(n[1]) : '';
-				};
+				return n ? ed.dom.decode(n[1]) : '';
+			};
 
-				ed.onPostProcess.add(function(ed, o) {
+			ed.onPostProcess.add(function(ed, o) {
+				if (ed.getParam('media_use_script')) {
 					o.content = o.content.replace(/<img[^>]+>/g, function(im) {
 						var cl = getAttr(im, 'class');
 
@@ -185,8 +185,8 @@
 
 						return im;
 					});
-				});
-			}
+				}
+			});
 		},
 
 		getInfo : function() {
@@ -233,16 +233,20 @@
 
 			if (stc) {
 				ob = dom.create('span', {
+					id : p.id,
 					mce_name : 'object',
 					type : 'application/x-shockwave-flash',
 					data : p.src,
+					style : dom.getAttrib(n, 'style'),
 					width : o.width,
 					height : o.height
 				});
 			} else {
 				ob = dom.create('span', {
+					id : p.id,
 					mce_name : 'object',
 					classid : "clsid:" + o.classid,
+					style : dom.getAttrib(n, 'style'),
 					codebase : o.codebase,
 					width : o.width,
 					height : o.height
@@ -250,9 +254,9 @@
 			}
 
 			each (p, function(v, k) {
-				if (!/^(width|height|codebase|classid|_cx|_cy)$/.test(k)) {
+				if (!/^(width|height|codebase|classid|id|_cx|_cy)$/.test(k)) {
 					// Use url instead of src in IE for Windows media
-					if (o.type == 'application/x-mplayer2' && k == 'src')
+					if (o.type == 'application/x-mplayer2' && k == 'src' && !p.url)
 						k = 'url';
 
 					if (v)
@@ -261,7 +265,7 @@
 			});
 
 			if (!stc)
-				dom.add(ob, 'span', tinymce.extend({mce_name : 'embed', type : o.type}, p));
+				dom.add(ob, 'span', tinymce.extend({mce_name : 'embed', type : o.type, style : dom.getAttrib(n, 'style')}, p));
 
 			return ob;
 		},
@@ -337,13 +341,14 @@
 		_createImg : function(cl, n) {
 			var im, dom = this.editor.dom, pa = {}, ti = '', args;
 
-			args = ['id', 'name', 'width', 'height', 'bgcolor', 'align', 'flashvars', 'src', 'wmode', 'allowfullscreen', 'quality'];	
+			args = ['id', 'name', 'width', 'height', 'bgcolor', 'align', 'flashvars', 'src', 'wmode', 'allowfullscreen', 'quality', 'data'];	
 
 			// Create image
 			im = dom.create('img', {
 				src : this.url + '/img/trans.gif',
 				width : dom.getAttrib(n, 'width') || 100,
 				height : dom.getAttrib(n, 'height') || 100,
+				style : dom.getAttrib(n, 'style'),
 				'class' : cl
 			});
 
@@ -367,6 +372,12 @@
 				delete pa.movie;
 			}
 
+			// No src try data
+			if (!pa.src) {
+				pa.src = pa.data;
+				delete pa.data;
+			}
+
 			// Merge with embed args
 			n = dom.select('.mceItemEmbed', n)[0];
 			if (n) {