~quam-plures-core/quam-plures/bug-614012

« back to all changes in this revision

Viewing changes to qp_plugins/tinymce_plugin/tiny_mce/plugins/paste/js/pasteword.js

  • Committer: yabs
  • Author(s): EdB
  • Date: 2010-07-23 07:41:42 UTC
  • mfrom: (7507.5.4 upgrade_tinymce_core)
  • Revision ID: yabs@innervisions.org.uk-20100723074142-1xhibhdhaibhq33m
Upgrade TinyMCE

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
tinyMCEPopup.requireLangPack();
2
 
 
3
 
function saveContent() {
4
 
        var html = document.getElementById("frmData").contentWindow.document.body.innerHTML;
5
 
 
6
 
        if (html == ''){
7
 
                tinyMCEPopup.close();
8
 
                return false;
9
 
        }
10
 
 
11
 
        tinyMCEPopup.execCommand('mcePasteWord', false, html);
12
 
        tinyMCEPopup.close();
13
 
}
14
 
 
15
 
function onLoadInit() {
16
 
        tinyMCEPopup.resizeToInnerSize();
17
 
 
18
 
        // Fix for endless reloading in FF
19
 
        window.setTimeout(createIFrame, 10);
20
 
}
21
 
 
22
 
function createIFrame() {
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>';
24
 
}
25
 
 
26
 
var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
27
 
 
28
 
function initIframe(doc) {
29
 
        var dir = tinyMCEPopup.editor.settings.directionality;
30
 
 
31
 
        doc.body.dir = dir;
32
 
 
33
 
        // Remove Gecko spellchecking
34
 
        if (tinymce.isGecko)
35
 
                doc.body.spellcheck = tinyMCEPopup.getParam("gecko_spellcheck");
36
 
 
37
 
        resizeInputs();
38
 
}
39
 
 
40
 
function resizeInputs() {
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
 
 
49
 
        var elm = document.getElementById('frmData');
50
 
        if (elm) {
51
 
                elm.style.height = Math.abs(wHeight) + 'px';
52
 
                elm.style.width  = Math.abs(wWidth) + 'px';
53
 
        }
54
 
}
55
 
 
56
 
tinyMCEPopup.onInit.add(onLoadInit);
 
1
tinyMCEPopup.requireLangPack();
 
2
 
 
3
var PasteWordDialog = {
 
4
        init : function() {
 
5
                var ed = tinyMCEPopup.editor, el = document.getElementById('iframecontainer'), ifr, doc, css, cssHTML = '';
 
6
 
 
7
                // Create iframe
 
8
                el.innerHTML = '<iframe id="iframe" src="javascript:\'\';" frameBorder="0" style="border: 1px solid gray"></iframe>';
 
9
                ifr = document.getElementById('iframe');
 
10
                doc = ifr.contentWindow.document;
 
11
 
 
12
                // Force absolute CSS urls
 
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
                });
 
18
 
 
19
                // Write content into iframe
 
20
                doc.open();
 
21
                doc.write('<html><head>' + cssHTML + '</head><body class="mceContentBody" spellcheck="false"></body></html>');
 
22
                doc.close();
 
23
 
 
24
                doc.designMode = 'on';
 
25
                this.resize();
 
26
 
 
27
                window.setTimeout(function() {
 
28
                        ifr.contentWindow.focus();
 
29
                }, 10);
 
30
        },
 
31
 
 
32
        insert : function() {
 
33
                var h = document.getElementById('iframe').contentWindow.document.body.innerHTML;
 
34
 
 
35
                tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h, wordContent : true});
 
36
                tinyMCEPopup.close();
 
37
        },
 
38
 
 
39
        resize : function() {
 
40
                var vp = tinyMCEPopup.dom.getViewPort(window), el;
 
41
 
 
42
                el = document.getElementById('iframe');
 
43
 
 
44
                if (el) {
 
45
                        el.style.width  = (vp.w - 20) + 'px';
 
46
                        el.style.height = (vp.h - 90) + 'px';
 
47
                }
 
48
        }
 
49
};
 
50
 
 
51
tinyMCEPopup.onInit.add(PasteWordDialog.init, PasteWordDialog);