includes/clientside/tinymce/plugins/paste/js/pastetext.js
author Dan
Tue, 22 Dec 2009 13:09:59 -0500
changeset 1193 e3b94bd055dc
parent 335 67bd3121a12e
permissions -rw-r--r--
TinyMCE: Bumped to v3.2.7
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: 335
diff changeset
     3
var PasteTextDialog = {
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
     4
	init : function() {
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
     5
		this.resize();
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
     6
	},
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
     7
1193
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
     8
	insert : function() {
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
     9
		var h = tinyMCEPopup.dom.encode(document.getElementById('content').value), 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
    10
1193
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
    11
		// Convert linebreaks into paragraphs
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
    12
		if (document.getElementById('linebreaks').checked) {
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
    13
			lines = h.split(/\r?\n/);
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
    14
			if (lines.length > 1) {
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
    15
				h = '';
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
    16
				tinymce.each(lines, function(row) {
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
    17
					h += '<p>' + row + '</p>';
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
    18
				});
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
    19
			}
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
    20
		}
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
    21
1193
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
    22
		tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h});
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
    23
		tinyMCEPopup.close();
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
    24
	},
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
    25
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
    26
	resize : function() {
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
    27
		var vp = tinyMCEPopup.dom.getViewPort(window), el;
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
    28
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
    29
		el = document.getElementById('content');
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
    30
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
    31
		el.style.width  = (vp.w - 20) + 'px';
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
    32
		el.style.height = (vp.h - 90) + 'px';
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
    33
	}
1193
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
    34
};
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
    35
1193
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 335
diff changeset
    36
tinyMCEPopup.onInit.add(PasteTextDialog.init, PasteTextDialog);