--- /dev/null
+tinyMCEPopup.requireLangPack();\r
+\r
+var PasteWordDialog = {\r
+ init : function() {\r
+ var ed = tinyMCEPopup.editor, el = document.getElementById('iframecontainer'), ifr, doc, css, cssHTML = '';\r
+\r
+ // Create iframe\r
+ el.innerHTML = '<iframe id="iframe" src="javascript:\'\';" frameBorder="0" style="border: 1px solid gray"></iframe>';\r
+ ifr = document.getElementById('iframe');\r
+ doc = ifr.contentWindow.document;\r
+\r
+ // Force absolute CSS urls\r
+ css = [ed.baseURI.toAbsolute("themes/" + ed.settings.theme + "/skins/" + ed.settings.skin + "/content.css")];\r
+ css = css.concat(tinymce.explode(ed.settings.content_css) || []);\r
+ tinymce.each(css, function(u) {\r
+ cssHTML += '<link href="' + ed.documentBaseURI.toAbsolute('' + u) + '" rel="stylesheet" type="text/css" />';\r
+ });\r
+\r
+ // Write content into iframe\r
+ doc.open();\r
+ doc.write('<html><head>' + cssHTML + '</head><body class="mceContentBody" spellcheck="false"></body></html>');\r
+ doc.close();\r
+\r
+ doc.designMode = 'on';\r
+ this.resize();\r
+\r
+ window.setTimeout(function() {\r
+ ifr.contentWindow.focus();\r
+ }, 10);\r
+ },\r
+\r
+ insert : function() {\r
+ var h = document.getElementById('iframe').contentWindow.document.body.innerHTML;\r
+\r
+ tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h, wordContent : true});\r
+ tinyMCEPopup.close();\r
+ },\r
+\r
+ resize : function() {\r
+ var vp = tinyMCEPopup.dom.getViewPort(window), el;\r
+\r
+ el = document.getElementById('iframe');\r
+\r
+ if (el) {\r
+ el.style.width = (vp.w - 20) + 'px';\r
+ el.style.height = (vp.h - 90) + 'px';\r
+ }\r
+ }\r
+};\r
+\r
+tinyMCEPopup.onInit.add(PasteWordDialog.init, PasteWordDialog);\r