mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Fixing some issues IE (in compat mode of 8) had with the addmedia plugin
Expanding browser verification of the plugin by 50% (if compat mode of a browser counts as an additional browser) /me, sad for what was necessary --HG-- branch : dev
This commit is contained in:
@@ -23,9 +23,9 @@
|
||||
target:$("<%=String.Format("input#{0}Slug", !string.IsNullOrEmpty(Model.Prefix) ? Model.Prefix + "_" : "") %>"),
|
||||
url:"<%=Url.Slugify() %>",
|
||||
contentType:"<%=Model.RoutableAspect.ContentItem.ContentType %>",
|
||||
id:"<%=Model.RoutableAspect.ContentItem.Id %>",<%
|
||||
id:"<%=Model.RoutableAspect.ContentItem.Id %>"<%
|
||||
var container = Model.RoutableAspect.ContentItem.As<ICommonAspect>().Container;
|
||||
if (container != null) { %>
|
||||
if (container != null) { %>,
|
||||
containerId:<%=container.ContentItem.Id %><%
|
||||
} %>
|
||||
})
|
||||
|
@@ -1 +1 @@
|
||||
(function(){tinymce.PluginManager.requireLangPack("addmedia");tinymce.create('tinymce.plugins.Orchard.AddMedia',{init:function(ed,url){ed.addCommand('mceAddMedia',function(){ed.windowManager.open({file:url+'/addmedia.htm',width:550+parseInt(ed.getLang('addmedia.delta_width',0)),height:110+parseInt(ed.getLang('addmedia.delta_height',0)),inline:1},{plugin_url:url,})});ed.addButton('addmedia',{title:ed.getLang('addmedia.title'),cmd:'mceAddMedia',image:url+'/img/picture_add.png'})},createControl:function(n,cm){return null},getInfo:function(){return{longname:'Orchard AddMedia Plugin',author:'Nathan Heskew',authorurl:'http://orchardproject.net',infourl:'http://orchardproject.net',version:'0.1'}}});tinymce.PluginManager.add('addmedia',tinymce.plugins.Orchard.AddMedia)})();
|
||||
(function() { tinymce.PluginManager.requireLangPack("addmedia"); tinymce.create('tinymce.plugins.Orchard.AddMedia', { init: function(ed, url) { ed.addCommand('mceAddMedia', function() { ed.windowManager.open({ file: url + '/addmedia.htm', width: 550 + parseInt(ed.getLang('addmedia.delta_width', 0)), height: 110 + parseInt(ed.getLang('addmedia.delta_height', 0)), inline: 1 }, { plugin_url: url }) }); ed.addButton('addmedia', { title: ed.getLang('addmedia.title'), cmd: 'mceAddMedia', image: url + '/img/picture_add.png' }) }, createControl: function(n, cm) { return null }, getInfo: function() { return { longname: 'Orchard AddMedia Plugin', author: 'Nathan Heskew', authorurl: 'http://orchardproject.net', infourl: 'http://orchardproject.net', version: '0.1'} } }); tinymce.PluginManager.add('addmedia', tinymce.plugins.Orchard.AddMedia) })();
|
@@ -20,7 +20,7 @@
|
||||
height: 110 + parseInt(ed.getLang('addmedia.delta_height', 0)),
|
||||
inline: 1
|
||||
}, {
|
||||
plugin_url: url, // Plugin absolute URL
|
||||
plugin_url: url
|
||||
});
|
||||
});
|
||||
|
||||
|
@@ -10,43 +10,54 @@ var AddMediaDialog = {
|
||||
},
|
||||
|
||||
addMedia: function(form) {
|
||||
var iframeName = "addmedia__" + (new Date()).getTime()
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.name = iframeName;
|
||||
var iframeName = "addmedia__" + (new Date()).getTime();
|
||||
|
||||
var iframe;
|
||||
try {
|
||||
iframe = document.createElement("<iframe name=\"" + iframeName + "\" />"); // <- for some vowel browser
|
||||
} catch (ex) {
|
||||
iframe = document.createElement("iframe");
|
||||
iframe.name = iframeName;
|
||||
}
|
||||
iframe.src = "about:blank";
|
||||
|
||||
tinymce.DOM.setStyles(iframe, { display: "none" });
|
||||
var iframeLoadHandler = tinymce.dom.Event.add(iframe, 'load', function(ev) {
|
||||
var result = window.frames[iframeName].result, close = 0;
|
||||
if (result && result.url) {
|
||||
window.parent.AddMediaDialog.insertMedia(result.url);
|
||||
close = 1;
|
||||
} else if (result && result.error) {
|
||||
alert(tinyMCEPopup.getLang("addmedia_dlg.msg_error") + "\n\r\n\r" + result.error);
|
||||
} else {
|
||||
var somethingPotentiallyHorrible = "";
|
||||
try {
|
||||
somethingPotentiallyHorrible = window.frames[iframeName].document.getElementsByTagName("body")[0].innerHTML;
|
||||
} catch (ex) { // some browsers flip out trying to access anything in the iframe when there's an error. best we can do is guess at this point
|
||||
somethingPotentiallyHorrible = tinyMCEPopup.getLang("addmedia_dlg.msg_error_unknown");
|
||||
}
|
||||
if (somethingPotentiallyHorrible) {
|
||||
alert(tinyMCEPopup.getLang("addmedia_dlg.msg_error_unexpected") + "\n\r\n\r" + somethingPotentiallyHorrible);
|
||||
}
|
||||
}
|
||||
|
||||
//cleanup
|
||||
setTimeout(function() {
|
||||
tinymce.dom.Event.remove(iframe, 'load', iframeLoadHandler);
|
||||
tinymce.DOM.remove(iframe);
|
||||
iframe = null;
|
||||
if (close) window.parent.tinyMCEPopup.close();
|
||||
},
|
||||
var iframeLoadHandler = tinymce.dom.Event.add(iframe, 'load', function(ev) {
|
||||
try {
|
||||
var result = window.frames[iframeName].result, close = 0;
|
||||
|
||||
if (result && result.url) {
|
||||
window.parent.AddMediaDialog.insertMedia(result.url);
|
||||
close = 1;
|
||||
} else if (result && result.error) {
|
||||
alert(tinyMCEPopup.getLang("addmedia_dlg.msg_error") + "\n\r\n\r" + result.error);
|
||||
} else {
|
||||
var somethingPotentiallyHorrible = "";
|
||||
try {
|
||||
somethingPotentiallyHorrible = window.frames[iframeName].document.getElementsByTagName("body")[0].innerHTML;
|
||||
} catch (ex) { // some browsers flip out trying to access anything in the iframe when there's an error. best we can do is guess at this point
|
||||
somethingPotentiallyHorrible = tinyMCEPopup.getLang("addmedia_dlg.msg_error_unknown");
|
||||
}
|
||||
if (somethingPotentiallyHorrible) {
|
||||
alert(tinyMCEPopup.getLang("addmedia_dlg.msg_error_unexpected") + "\n\r\n\r" + somethingPotentiallyHorrible);
|
||||
}
|
||||
}
|
||||
|
||||
//cleanup
|
||||
setTimeout(function() {
|
||||
tinymce.dom.Event.remove(iframe, 'load', iframeLoadHandler);
|
||||
tinymce.DOM.remove(iframe);
|
||||
iframe = null;
|
||||
if (close) window.parent.tinyMCEPopup.close();
|
||||
},
|
||||
123);
|
||||
} catch (ex) {
|
||||
alert(ex.message);
|
||||
}
|
||||
});
|
||||
|
||||
form.target = iframeName;
|
||||
tinymce.DOM.add(document.body, iframe);
|
||||
form.target = iframe.name;
|
||||
},
|
||||
|
||||
insertMedia: function(url) {
|
||||
|
Reference in New Issue
Block a user