annotate static/js/tiny_mce/plugins/paste/js/pasteword.js @ 511:5794e3414596
Converted production environment to a virtualenv; had to tweak some paths and the .wsgi file accordingly.
I also added packages in preparation for working with Celery, so I updated the requirements file according to production.
author |
Brian Neal <bgneal@gmail.com> |
date |
Sun, 11 Dec 2011 19:50:32 +0000 |
parents |
88b2b9cb8c1f |
children |
|
rev |
line source |
bgneal@312
|
1 tinyMCEPopup.requireLangPack();
|
bgneal@312
|
2
|
bgneal@312
|
3 var PasteWordDialog = {
|
bgneal@312
|
4 init : function() {
|
bgneal@312
|
5 var ed = tinyMCEPopup.editor, el = document.getElementById('iframecontainer'), ifr, doc, css, cssHTML = '';
|
bgneal@312
|
6
|
bgneal@312
|
7 // Create iframe
|
bgneal@312
|
8 el.innerHTML = '<iframe id="iframe" src="javascript:\'\';" frameBorder="0" style="border: 1px solid gray"></iframe>';
|
bgneal@312
|
9 ifr = document.getElementById('iframe');
|
bgneal@312
|
10 doc = ifr.contentWindow.document;
|
bgneal@312
|
11
|
bgneal@312
|
12 // Force absolute CSS urls
|
bgneal@312
|
13 css = [ed.baseURI.toAbsolute("themes/" + ed.settings.theme + "/skins/" + ed.settings.skin + "/content.css")];
|
bgneal@312
|
14 css = css.concat(tinymce.explode(ed.settings.content_css) || []);
|
bgneal@312
|
15 tinymce.each(css, function(u) {
|
bgneal@312
|
16 cssHTML += '<link href="' + ed.documentBaseURI.toAbsolute('' + u) + '" rel="stylesheet" type="text/css" />';
|
bgneal@312
|
17 });
|
bgneal@312
|
18
|
bgneal@312
|
19 // Write content into iframe
|
bgneal@312
|
20 doc.open();
|
bgneal@312
|
21 doc.write('<html><head>' + cssHTML + '</head><body class="mceContentBody" spellcheck="false"></body></html>');
|
bgneal@312
|
22 doc.close();
|
bgneal@312
|
23
|
bgneal@312
|
24 doc.designMode = 'on';
|
bgneal@312
|
25 this.resize();
|
bgneal@312
|
26
|
bgneal@312
|
27 window.setTimeout(function() {
|
bgneal@312
|
28 ifr.contentWindow.focus();
|
bgneal@312
|
29 }, 10);
|
bgneal@312
|
30 },
|
bgneal@312
|
31
|
bgneal@312
|
32 insert : function() {
|
bgneal@312
|
33 var h = document.getElementById('iframe').contentWindow.document.body.innerHTML;
|
bgneal@312
|
34
|
bgneal@312
|
35 tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h, wordContent : true});
|
bgneal@312
|
36 tinyMCEPopup.close();
|
bgneal@312
|
37 },
|
bgneal@312
|
38
|
bgneal@312
|
39 resize : function() {
|
bgneal@312
|
40 var vp = tinyMCEPopup.dom.getViewPort(window), el;
|
bgneal@312
|
41
|
bgneal@312
|
42 el = document.getElementById('iframe');
|
bgneal@312
|
43
|
bgneal@312
|
44 if (el) {
|
bgneal@312
|
45 el.style.width = (vp.w - 20) + 'px';
|
bgneal@312
|
46 el.style.height = (vp.h - 90) + 'px';
|
bgneal@312
|
47 }
|
bgneal@312
|
48 }
|
bgneal@312
|
49 };
|
bgneal@312
|
50
|
bgneal@312
|
51 tinyMCEPopup.onInit.add(PasteWordDialog.init, PasteWordDialog);
|