X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Ftiny_mce%2Fplugins%2Fmedia%2Feditor_plugin_src.js;h=ea79db18a765137be9209c32b95dbaa3aebf8e21;hb=a8ce0eff2e9c97d6c0c878451f83a3759ec0d07f;hp=219d713f29fbc4af1b0ac274a87abf4f9b2a6342;hpb=2797e21fbf023037fc706d85ab314e609a0d3a07;p=citadel.git diff --git a/webcit/tiny_mce/plugins/media/editor_plugin_src.js b/webcit/tiny_mce/plugins/media/editor_plugin_src.js index 219d713f2..ea79db18a 100644 --- a/webcit/tiny_mce/plugins/media/editor_plugin_src.js +++ b/webcit/tiny_mce/plugins/media/editor_plugin_src.js @@ -24,6 +24,7 @@ ["Silverlight", "dfeaf541-f3e1-4c24-acac-99c30715084a", "application/x-silverlight-2"], ["Iframe"], ["Video"], + ["EmbeddedAudio"], ["Audio"] ]; @@ -250,6 +251,8 @@ id : data.id, style : data.style, align : data.align, + hspace : data.hspace, + vspace : data.vspace, src : self.editor.theme.url + '/img/trans.gif', 'class' : 'mceItemMedia mceItem' + self.getType(data.type).name, 'data-mce-json' : JSON.serialize(data, "'") @@ -494,6 +497,28 @@ data.params.src = ''; } + if (typeItem.name === 'EmbeddedAudio') { + embed = new Node('embed', 1); + embed.shortEnded = true; + embed.attr({ + id: node.attr('id'), + width: node.attr('width'), + height: node.attr('height'), + style : style, + type: node.attr('type') + }); + + for (name in data.params) + embed.attr(name, data.params[name]); + + tinymce.each(rootAttributes, function(name) { + if (data[name] && name != 'type') + embed.attr(name, data[name]); + }); + + data.params.src = ''; + } + // Do we have a params src then we can generate object if (data.params.src) { // Is flv movie add player for it @@ -512,8 +537,13 @@ }); tinymce.each(rootAttributes, function(name) { - if (data[name] && name != 'type') - object.attr(name, data[name]); + var value = data[name]; + + if (name == 'class' && value) + value = value.replace(/mceItem.+ ?/g, ''); + + if (value && name != 'type') + object.attr(name, value); }); // Add params @@ -596,8 +626,9 @@ } } - if (video || audio || object) - node.replace(video || audio || object); + var n = video || audio || object || embed; + if (n) + node.replace(n); else node.remove(); }, @@ -615,7 +646,8 @@ var object, embed, video, iframe, img, name, id, width, height, style, i, html, param, params, source, sources, data, type, lookup = this.lookup, matches, attrs, urlConverter = this.editor.settings.url_converter, - urlConverterScope = this.editor.settings.url_converter_scope; + urlConverterScope = this.editor.settings.url_converter_scope, + hspace, vspace, align, bgcolor; function getInnerHTML(node) { return new tinymce.html.Serializer({ @@ -624,6 +656,15 @@ }).serialize(node); }; + function lookupAttribute(o, attr) { + return lookup[(o.attr(attr) || '').toLowerCase()]; + } + + function lookupExtension(src) { + var ext = src.replace(/^.*\.([^.]+)$/, '$1'); + return lookup[ext.toLowerCase() || '']; + } + // If node isn't in document if (!node.parent) return; @@ -713,6 +754,11 @@ height = height || object.attr('height'); style = style || object.attr('style'); id = id || object.attr('id'); + hspace = hspace || object.attr('hspace'); + vspace = vspace || object.attr('vspace'); + align = align || object.attr('align'); + bgcolor = bgcolor || object.attr('bgcolor'); + data.name = object.attr('name'); // Get all object params params = object.getAll("param"); @@ -733,6 +779,10 @@ height = height || embed.attr('height'); style = style || embed.attr('style'); id = id || embed.attr('id'); + hspace = hspace || embed.attr('hspace'); + vspace = vspace || embed.attr('vspace'); + align = align || embed.attr('align'); + bgcolor = bgcolor || embed.attr('bgcolor'); // Get all embed attributes for (name in embed.attributes.map) { @@ -747,6 +797,10 @@ height = iframe.attr('height'); style = style || iframe.attr('style'); id = iframe.attr('id'); + hspace = iframe.attr('hspace'); + vspace = iframe.attr('vspace'); + align = iframe.attr('align'); + bgcolor = iframe.attr('bgcolor'); tinymce.each(rootAttributes, function(name) { img.attr(name, iframe.attr(name)); @@ -777,10 +831,15 @@ } if (object && !type) - type = (lookup[(object.attr('clsid') || '').toLowerCase()] || lookup[(object.attr('type') || '').toLowerCase()] || {}).name; + type = (lookupAttribute(object, 'clsid') || lookupAttribute(object, 'classid') || lookupAttribute(object, 'type') || {}).name; if (embed && !type) - type = (lookup[(embed.attr('type') || '').toLowerCase()] || {}).name; + type = (lookupAttribute(embed, 'type') || lookupExtension(data.params.src) || {}).name; + + // for embedded audio we preserve the original specified type + if (embed && type == 'EmbeddedAudio') { + data.params.type = embed.attr('type'); + } // Replace the video/object/embed element with a placeholder image containing the data node.replace(img); @@ -805,6 +864,11 @@ data.video_html = html; } + data.hspace = hspace; + data.vspace = vspace; + data.align = align; + data.bgcolor = bgcolor; + // Set width/height of placeholder img.attr({ id : id, @@ -812,6 +876,10 @@ style : style, width : width || (node.name == 'audio' ? "300" : "320"), height : height || (node.name == 'audio' ? "32" : "240"), + hspace : hspace, + vspace : vspace, + align : align, + bgcolor : bgcolor, "data-mce-json" : JSON.serialize(data, "'") }); } @@ -819,4 +887,4 @@ // Register plugin tinymce.PluginManager.add('media', tinymce.plugins.MediaPlugin); -})(); \ No newline at end of file +})();