In TinyMCE after Inline Popups, the IMCE still open like new window.
This patch fix this problem.
ps: sorry if patch in inappropriate form

Comments

emposha’s picture

StatusFileSize
new1.53 KB

Updated patch that fix TinyMCE dialog windows on enabled "Inline Popup".
Added custom SendTo function.

sun’s picture

Status: Active » Needs work

Hm... thanks for this patch - however, the coding style needs work. It doesn't look like the indentation is always correct.

+++ imce_wysiwyg/js/imce_wysiwyg.js
@@ -5,12 +5,36 @@
+    }); ¶
...
+    if (win !== 'undefined') {    ¶
...
+  }  ¶

@@ -22,4 +46,4 @@
-};
+};
\ No newline at end of file

1) Trailing white-space.

2) Missing newline at end of file.

Powered by Dreditor.

emposha’s picture

StatusFileSize
new1.53 KB

Thanks for correction,
1) indentation fixed
2) trailing white-spaces removed
3) Newline at end of file added

sun’s picture

+++ imce_wysiwyg/js/imce_wysiwyg.js
@@ -5,12 +5,36 @@
-    win.open(Drupal.settings.imce.url + encodeURIComponent(field_name), '', 'width=760,height=560,resizable=1');
...
+      win.open(Drupal.settings.imce.url + encodeURIComponent(field_name), '', 'width=760,height=560,inline=1",');

I do not understand the changes in this line.

+++ imce_wysiwyg/js/imce_wysiwyg.js
@@ -5,12 +5,36 @@
+  if (typeof (tinyMCE) != 'undefined' && typeof (tinyMCE.plugins.InlinePopups) != 'undefined') {

We can remove the parenthesis around the variables that are checked for their types.

+++ imce_wysiwyg/js/imce_wysiwyg.js
@@ -5,12 +5,36 @@
+      url : Drupal.settings.imce.url + encodeURIComponent(field_name) + encodeURIComponent('|sendto@imceTinyMCESendTo|params@'),

The trailing |params@ looks odd; could use an inline comment explaining why that is needed.

+++ imce_wysiwyg/js/imce_wysiwyg.js
@@ -5,12 +5,36 @@
+ * TinyMCE integration.

This only seems to be used for in inline popups mode, which should be clarified in the JSDoc.

+++ imce_wysiwyg/js/imce_wysiwyg.js
@@ -5,12 +5,36 @@
+var imceTinyMCESendTo = function (file, win) {
+  tinyMCE.activeEditor.windowManager.close(win);
+  winId = tinyMCE.activeEditor.windowManager.lastId.replace('_wrapper','');
+  $('#' + winId + '_ifr').focus();
+  $(tinyMCE.DOM.doc.activeElement.contentDocument).find('#src').val(file.url).change();
+  $(tinyMCE.DOM.doc.activeElement.contentDocument).find('#title').val(file.name);
+};

I looks odd to me that we have to do that manually. Normally, TinyMCE and/or the individual plugin provides helper methods for taking over those values (which is why the code only required to open a new window, passing some parameters, previously).

Let's investigate this some further.

+++ imce_wysiwyg/js/imce_wysiwyg.js
@@ -22,4 +46,4 @@
-};
+};

Different line-endings?

Powered by Dreditor.