summaryrefslogtreecommitdiff
path: root/public/javascripts/tiny_mce/plugins/paste/js/pasteword.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/javascripts/tiny_mce/plugins/paste/js/pasteword.js')
-rw-r--r--[-rwxr-xr-x]public/javascripts/tiny_mce/plugins/paste/js/pasteword.js79
1 files changed, 37 insertions, 42 deletions
diff --git a/public/javascripts/tiny_mce/plugins/paste/js/pasteword.js b/public/javascripts/tiny_mce/plugins/paste/js/pasteword.js
index 6701b99..a52731c 100755..100644
--- a/public/javascripts/tiny_mce/plugins/paste/js/pasteword.js
+++ b/public/javascripts/tiny_mce/plugins/paste/js/pasteword.js
@@ -1,56 +1,51 @@
1tinyMCEPopup.requireLangPack(); 1tinyMCEPopup.requireLangPack();
2 2
3function saveContent() { 3var PasteWordDialog = {
4 var html = document.getElementById("frmData").contentWindow.document.body.innerHTML; 4 init : function() {
5 var ed = tinyMCEPopup.editor, el = document.getElementById('iframecontainer'), ifr, doc, css, cssHTML = '';
5 6
6 if (html == ''){ 7 // Create iframe
7 tinyMCEPopup.close(); 8 el.innerHTML = '<iframe id="iframe" src="javascript:\'\';" frameBorder="0" style="border: 1px solid gray"></iframe>';
8 return false; 9 ifr = document.getElementById('iframe');
9 } 10 doc = ifr.contentWindow.document;
10
11 tinyMCEPopup.execCommand('mcePasteWord', false, html);
12 tinyMCEPopup.close();
13}
14 11
15function onLoadInit() { 12 // Force absolute CSS urls
16 tinyMCEPopup.resizeToInnerSize(); 13 css = [ed.baseURI.toAbsolute("themes/" + ed.settings.theme + "/skins/" + ed.settings.skin + "/content.css")];
14 css = css.concat(tinymce.explode(ed.settings.content_css) || []);
15 tinymce.each(css, function(u) {
16 cssHTML += '<link href="' + ed.documentBaseURI.toAbsolute('' + u) + '" rel="stylesheet" type="text/css" />';
17 });
17 18
18 // Fix for endless reloading in FF 19 // Write content into iframe
19 window.setTimeout(createIFrame, 10); 20 doc.open();
20} 21 doc.write('<html><head>' + cssHTML + '</head><body class="mceContentBody" spellcheck="false"></body></html>');
22 doc.close();
21 23
22function createIFrame() { 24 doc.designMode = 'on';
23 document.getElementById('iframecontainer').innerHTML = '<iframe id="frmData" name="frmData" class="sourceIframe" src="blank.htm" height="280" width="400" frameborder="0" style="background-color:#FFFFFF; width:100%;" dir="ltr" wrap="soft"></iframe>'; 25 this.resize();
24}
25 26
26var wHeight=0, wWidth=0, owHeight=0, owWidth=0; 27 window.setTimeout(function() {
28 ifr.contentWindow.focus();
29 }, 10);
30 },
27 31
28function initIframe(doc) { 32 insert : function() {
29 var dir = tinyMCEPopup.editor.settings.directionality; 33 var h = document.getElementById('iframe').contentWindow.document.body.innerHTML;
30 34
31 doc.body.dir = dir; 35 tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h, wordContent : true});
32 36 tinyMCEPopup.close();
33 // Remove Gecko spellchecking 37 },
34 if (tinymce.isGecko)
35 doc.body.spellcheck = tinyMCEPopup.getParam("gecko_spellcheck");
36 38
37 resizeInputs(); 39 resize : function() {
38} 40 var vp = tinyMCEPopup.dom.getViewPort(window), el;
39 41
40function resizeInputs() { 42 el = document.getElementById('iframe');
41 if (!tinymce.isIE) {
42 wHeight = self.innerHeight - 80;
43 wWidth = self.innerWidth - 18;
44 } else {
45 wHeight = document.body.clientHeight - 80;
46 wWidth = document.body.clientWidth - 18;
47 }
48 43
49 var elm = document.getElementById('frmData'); 44 if (el) {
50 if (elm) { 45 el.style.width = (vp.w - 20) + 'px';
51 elm.style.height = Math.abs(wHeight) + 'px'; 46 el.style.height = (vp.h - 90) + 'px';
52 elm.style.width = Math.abs(wWidth) + 'px'; 47 }
53 } 48 }
54} 49};
55 50
56tinyMCEPopup.onInit.add(onLoadInit); 51tinyMCEPopup.onInit.add(PasteWordDialog.init, PasteWordDialog);