author | Dan Fuhry <dan@enanocms.org> |
Fri, 19 Nov 2010 03:30:35 -0500 | |
changeset 1329 | 61d87ee12e80 |
parent 1193 | e3b94bd055dc |
permissions | -rw-r--r-- |
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff
changeset
|
1 |
tinyMCEPopup.requireLangPack(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff
changeset
|
2 |
|
1193 | 3 |
var PasteWordDialog = { |
4 |
init : function() { |
|
5 |
var ed = tinyMCEPopup.editor, el = document.getElementById('iframecontainer'), ifr, doc, css, cssHTML = ''; |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff
changeset
|
6 |
|
1193 | 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; |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff
changeset
|
11 |
|
1193 | 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 |
}); |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff
changeset
|
18 |
|
1193 | 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(); |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff
changeset
|
23 |
|
1193 | 24 |
doc.designMode = 'on'; |
25 |
this.resize(); |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff
changeset
|
26 |
|
1193 | 27 |
window.setTimeout(function() { |
28 |
ifr.contentWindow.focus(); |
|
29 |
}, 10); |
|
30 |
}, |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff
changeset
|
31 |
|
1193 | 32 |
insert : function() { |
33 |
var h = document.getElementById('iframe').contentWindow.document.body.innerHTML; |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff
changeset
|
34 |
|
1193 | 35 |
tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h, wordContent : true}); |
36 |
tinyMCEPopup.close(); |
|
37 |
}, |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff
changeset
|
38 |
|
1193 | 39 |
resize : function() { |
40 |
var vp = tinyMCEPopup.dom.getViewPort(window), el; |
|
41 |
||
42 |
el = document.getElementById('iframe'); |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff
changeset
|
43 |
|
1193 | 44 |
if (el) { |
45 |
el.style.width = (vp.w - 20) + 'px'; |
|
46 |
el.style.height = (vp.h - 90) + 'px'; |
|
47 |
} |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff
changeset
|
48 |
} |
1193 | 49 |
}; |
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff
changeset
|
50 |
|
1193 | 51 |
tinyMCEPopup.onInit.add(PasteWordDialog.init, PasteWordDialog); |