Skip to content

Instantly share code, notes, and snippets.

@bleroy
Created April 2, 2015 01:13
Show Gist options
  • Save bleroy/a967fb9a515952af7459 to your computer and use it in GitHub Desktop.
Save bleroy/a967fb9a515952af7459 to your computer and use it in GitHub Desktop.
CodePlex Issue #16624 Plain Text Attachments
# HG changeset patch
# User Zibings
# Date 1285341698 14400
# Node ID 657d4b68bfc8595e621b04145f5d9699f2ed6451
# Parent aecd221c2b15bef78139896f331ed9265a9df77c
Modifying TinyMCE 'addmedia' plugin to account for modal dialogs.
diff -r aecd221c2b15 -r 657d4b68bfc8 src/Orchard.Web/Modules/TinyMce/Scripts/plugins/addmedia/js/addmedia.js
--- a/src/Orchard.Web/Modules/TinyMce/Scripts/plugins/addmedia/js/addmedia.js Tue Sep 21 14:30:52 2010 -0700
+++ b/src/Orchard.Web/Modules/TinyMce/Scripts/plugins/addmedia/js/addmedia.js Fri Sep 24 11:21:38 2010 -0400
@@ -27,7 +27,12 @@
var result = window.frames[iframeName].result, close = 0;
if (result && result.url) {
- window.parent.AddMediaDialog.insertMedia(result.url);
+ if (window.parent && window.parent.AddMediaDialog) {
+ window.parent.AddMediaDialog.insertMedia(result.url);
+ } else {
+ AddMediaDialog.insertMedia(result.url);
+ }
+
close = 1;
} else if (result && result.error) {
alert(tinyMCEPopup.getLang("addmedia_dlg.msg_error") + "\n\r\n\r" + result.error);
@@ -48,7 +53,14 @@
tinymce.dom.Event.remove(iframe, 'load', iframeLoadHandler);
tinymce.DOM.remove(iframe);
iframe = null;
- if (close) window.parent.tinyMCEPopup.close();
+
+ if (close) {
+ if (window.parent && window.parent.tinyMCEPopup) {
+ window.parent.tinyMCEPopup.close();
+ } else {
+ tinyMCEPopup.close();
+ }
+ }
},
123);
} catch (ex) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment