includes/clientside/tinymce/plugins/paste/js/pasteword.js
author Dan Fuhry <dan@enanocms.org>
Sat, 29 Jan 2011 15:31:15 -0500
changeset 1337 2ac4e08641fc
parent 1193 e3b94bd055dc
permissions -rw-r--r--
Fixed some variable issues in emailer
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
     3
var PasteWordDialog = {
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
     4
	init : function() {
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
     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
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
     7
		// Create iframe
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
     8
		el.innerHTML = '<iframe id="iframe" src="javascript:\'\';" frameBorder="0" style="border: 1px solid gray"></iframe>';
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
     9
		ifr = document.getElementById('iframe');
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    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
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    12
		// Force absolute CSS urls
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    13
		css = [ed.baseURI.toAbsolute("themes/" + ed.settings.theme + "/skins/" + ed.settings.skin + "/content.css")];
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    14
		css = css.concat(tinymce.explode(ed.settings.content_css) || []);
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    15
		tinymce.each(css, function(u) {
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    16
			cssHTML += '<link href="' + ed.documentBaseURI.toAbsolute('' + u) + '" rel="stylesheet" type="text/css" />';
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    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
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    19
		// Write content into iframe
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    20
		doc.open();
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    21
		doc.write('<html><head>' + cssHTML + '</head><body class="mceContentBody" spellcheck="false"></body></html>');
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    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
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    24
		doc.designMode = 'on';
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    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
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    27
		window.setTimeout(function() {
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    28
			ifr.contentWindow.focus();
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    29
		}, 10);
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    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
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    32
	insert : function() {
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    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
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    35
		tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h, wordContent : true});
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    36
		tinyMCEPopup.close();
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    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
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    39
	resize : function() {
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    40
		var vp = tinyMCEPopup.dom.getViewPort(window), el;
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    41
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    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
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    44
		if (el) {
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    45
			el.style.width  = (vp.w - 20) + 'px';
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    46
			el.style.height = (vp.h - 90) + 'px';
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    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
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    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
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 476
diff changeset
    51
tinyMCEPopup.onInit.add(PasteWordDialog.init, PasteWordDialog);