- _buildObj : function(o, n) {\r
- var ob, ed = this.editor, dom = ed.dom, p = this._parse(n.title), stc;\r
- \r
- stc = ed.getParam('media_strict', true) && o.type == 'application/x-shockwave-flash';\r
-\r
- p.width = o.width = dom.getAttrib(n, 'width') || 100;\r
- p.height = o.height = dom.getAttrib(n, 'height') || 100;\r
-\r
- if (p.src)\r
- p.src = ed.convertURL(p.src, 'src', n);\r
-\r
- if (stc) {\r
- ob = dom.create('span', {\r
- id : p.id,\r
- _mce_name : 'object',\r
- type : 'application/x-shockwave-flash',\r
- data : p.src,\r
- style : dom.getAttrib(n, 'style'),\r
- width : o.width,\r
- height : o.height\r
+ /**\r
+ * Converts a tinymce.html.Node image element to video/object/embed.\r
+ */\r
+ imgToObject : function(node, args) {\r
+ var self = this, editor = self.editor, video, object, embed, iframe, name, value, data,\r
+ source, sources, params, param, typeItem, i, item, mp4Source, replacement,\r
+ posterSrc, style, audio;\r
+\r
+ // Adds the flash player\r
+ function addPlayer(video_src, poster_src) {\r
+ var baseUri, flashVars, flashVarsOutput, params, flashPlayer;\r
+\r
+ flashPlayer = editor.getParam('flash_video_player_url', self.convertUrl(self.url + '/moxieplayer.swf'));\r
+ if (flashPlayer) {\r
+ baseUri = editor.documentBaseURI;\r
+ data.params.src = flashPlayer;\r
+\r
+ // Convert the movie url to absolute urls\r
+ if (editor.getParam('flash_video_player_absvideourl', true)) {\r
+ video_src = baseUri.toAbsolute(video_src || '', true);\r
+ poster_src = baseUri.toAbsolute(poster_src || '', true);\r
+ }\r
+\r
+ // Generate flash vars\r
+ flashVarsOutput = '';\r
+ flashVars = editor.getParam('flash_video_player_flashvars', {url : '$url', poster : '$poster'});\r
+ tinymce.each(flashVars, function(value, name) {\r
+ // Replace $url and $poster variables in flashvars value\r
+ value = value.replace(/\$url/, video_src || '');\r
+ value = value.replace(/\$poster/, poster_src || '');\r
+\r
+ if (value.length > 0)\r
+ flashVarsOutput += (flashVarsOutput ? '&' : '') + name + '=' + escape(value);\r
+ });\r
+\r
+ if (flashVarsOutput.length)\r
+ data.params.flashvars = flashVarsOutput;\r
+\r
+ params = editor.getParam('flash_video_player_params', {\r
+ allowfullscreen: true,\r
+ allowscriptaccess: true\r
+ });\r
+\r
+ tinymce.each(params, function(value, name) {\r
+ data.params[name] = "" + value;\r
+ });\r
+ }\r
+ };\r
+\r
+ data = node.attr('data-mce-json');\r
+ if (!data)\r
+ return;\r
+\r
+ data = JSON.parse(data);\r
+ typeItem = this.getType(node.attr('class'));\r
+\r
+ style = node.attr('data-mce-style')\r
+ if (!style) {\r
+ style = node.attr('style');\r
+\r
+ if (style)\r
+ style = editor.dom.serializeStyle(editor.dom.parseStyle(style, 'img'));\r
+ }\r
+\r
+ // Handle iframe\r
+ if (typeItem.name === 'Iframe') {\r
+ replacement = new Node('iframe', 1);\r
+\r
+ tinymce.each(rootAttributes, function(name) {\r
+ var value = node.attr(name);\r
+\r
+ if (name == 'class' && value)\r
+ value = value.replace(/mceItem.+ ?/g, '');\r
+\r
+ if (value && value.length > 0)\r
+ replacement.attr(name, value);\r