includes/clientside/tinymce/plugins/safari/editor_plugin_src.js
author Dan Fuhry <dan@enanocms.org>
Tue, 06 Jul 2010 00:59:06 -0400
changeset 1263 eb717f5c283f
parent 1193 e3b94bd055dc
permissions -rw-r--r--
Clean up that GLOBALS silliness.
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
/**
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
 * $Id: editor_plugin_src.js 264 2007-04-26 20:53:09Z spocke $
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
     3
 *
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
     4
 * @author Moxiecode
395
fa4c5ecb7c9a Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents: 335
diff changeset
     5
 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
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
 */
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
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
     8
(function() {
1193
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 778
diff changeset
     9
	var Event = tinymce.dom.Event, grep = tinymce.grep, each = tinymce.each, inArray = tinymce.inArray;
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
778
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    11
	function isEmpty(d, e, f) {
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    12
		var w, n;
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    13
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    14
		w = d.createTreeWalker(e, NodeFilter.SHOW_ALL, null, false);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    15
		while (n = w.nextNode()) {
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    16
			// Filter func
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    17
			if (f) {
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    18
				if (!f(n))
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    19
					return false;
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    20
			}
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    21
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    22
			// Non whitespace text node
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    23
			if (n.nodeType == 3 && n.nodeValue && /[^\s\u00a0]+/.test(n.nodeValue))
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    24
				return false;
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    25
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    26
			// Is non text element byt still content
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    27
			if (n.nodeType == 1 && /^(HR|IMG|TABLE)$/.test(n.nodeName))
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    28
				return false;
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    29
		}
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    30
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    31
		return true;
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    32
	};
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    33
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
	tinymce.create('tinymce.plugins.Safari', {
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
		init : function(ed) {
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
    36
			var t = this, dom;
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
    37
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
			// Ignore on non webkit
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
    39
			if (!tinymce.isWebKit)
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
    40
				return;
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
    41
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
    42
			t.editor = ed;
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
			t.webKitFontSizes = ['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', '-webkit-xxx-large'];
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
    44
			t.namedFontSizes = ['xx-small', 'x-small','small','medium','large','x-large', 'xx-large'];
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
    45
778
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    46
			// Safari CreateLink command will not work correctly on images that is aligned
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    47
			ed.addCommand('CreateLink', function(u, v) {
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    48
				var n = ed.selection.getNode(), dom = ed.dom, a;
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    49
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    50
				if (n && (/^(left|right)$/i.test(dom.getStyle(n, 'float', 1)) || /^(left|right)$/i.test(dom.getAttrib(n, 'align')))) {
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    51
					a = dom.create('a', {href : v}, n.cloneNode());
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    52
					n.parentNode.replaceChild(a, n);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    53
					ed.selection.select(a);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    54
				} else
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    55
					ed.getDoc().execCommand("CreateLink", false, v);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    56
			});
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
    57
1193
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 778
diff changeset
    58
/*
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 778
diff changeset
    59
			// WebKit generates spans out of thin air this patch used to remove them but it will also remove styles we want so it's disabled for now
543
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    60
			ed.onPaste.add(function(ed, e) {
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    61
				function removeStyles(e) {
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    62
					e = e.target;
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    63
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    64
					if (e.nodeType == 1) {
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    65
						e.style.cssText = '';
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    66
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    67
						each(ed.dom.select('*', e), function(e) {
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    68
							e.style.cssText = '';
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    69
						});
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    70
					}
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    71
				};
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    72
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    73
				Event.add(ed.getDoc(), 'DOMNodeInserted', removeStyles);
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    74
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    75
				window.setTimeout(function() {
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    76
					Event.remove(ed.getDoc(), 'DOMNodeInserted', removeStyles);
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    77
				}, 0);
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    78
			});
1193
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 778
diff changeset
    79
*/
476
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents: 459
diff changeset
    80
			ed.onKeyUp.add(function(ed, e) {
778
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    81
				var h, b, r, n, s;
476
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents: 459
diff changeset
    82
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents: 459
diff changeset
    83
				// If backspace or delete key
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents: 459
diff changeset
    84
				if (e.keyCode == 46 || e.keyCode == 8) {
543
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    85
					b = ed.getBody();
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    86
					h = b.innerHTML;
778
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    87
					s = ed.selection;
476
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents: 459
diff changeset
    88
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents: 459
diff changeset
    89
					// If there is no text content or images or hr elements then remove everything
778
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    90
					if (b.childNodes.length == 1 && !/<(img|hr)/.test(h) && tinymce.trim(h.replace(/<[^>]+>/g, '')).length == 0) {
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    91
						// Inject paragrah and bogus br
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    92
						ed.setContent('<p><br mce_bogus="1" /></p>', {format : 'raw'});
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    93
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    94
						// Move caret before bogus br
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    95
						n = b.firstChild;
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    96
						r = s.getRng();
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    97
						r.setStart(n, 0);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    98
						r.setEnd(n, 0);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    99
						s.setRng(r);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   100
					}
476
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents: 459
diff changeset
   101
				}
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents: 459
diff changeset
   102
			});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents: 459
diff changeset
   103
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
   104
			// Workaround for FormatBlock bug, http://bugs.webkit.org/show_bug.cgi?id=16004
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
   105
			ed.addCommand('FormatBlock', function(u, v) {
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
   106
				var dom = ed.dom, e = dom.getParent(ed.selection.getNode(), dom.isBlock);
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
   107
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
   108
				if (e)
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
   109
					dom.replace(dom.create(v), e, 1);
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
   110
				else
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
   111
					ed.getDoc().execCommand("FormatBlock", false, v);
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
   112
			});
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
   113
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
   114
			// Workaround for InsertHTML bug, http://bugs.webkit.org/show_bug.cgi?id=16382
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
   115
			ed.addCommand('mceInsertContent', function(u, v) {
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
   116
				ed.getDoc().execCommand("InsertText", false, 'mce_marker');
778
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   117
				ed.getBody().innerHTML = ed.getBody().innerHTML.replace(/mce_marker/g, ed.dom.processHTML(v) + '<span id="_mce_tmp">XX</span>');
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
   118
				ed.selection.select(ed.dom.get('_mce_tmp'));
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
   119
				ed.getDoc().execCommand("Delete", false, ' ');
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
   120
			});
1193
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 778
diff changeset
   121
	
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 778
diff changeset
   122
	/*		ed.onKeyDown.add(function(ed, e) {
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 778
diff changeset
   123
				// Ctrl+A select all will fail on WebKit since if you paste the contents you selected it will produce a odd div wrapper
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 778
diff changeset
   124
				if ((e.ctrlKey || e.metaKey) && e.keyCode == 65) {
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 778
diff changeset
   125
					ed.selection.select(ed.getBody(), 1);
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 778
diff changeset
   126
					return Event.cancel(e);
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 778
diff changeset
   127
				}
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 778
diff changeset
   128
			});*/
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
   129
395
fa4c5ecb7c9a Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents: 335
diff changeset
   130
			ed.onKeyPress.add(function(ed, e) {
778
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   131
				var se, li, lic, r1, r2, n, sel, doc, be, af, pa;
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   132
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   133
				if (e.keyCode == 13) {
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   134
					sel = ed.selection;
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   135
					se = sel.getNode();
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   136
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   137
					// Workaround for missing shift+enter support, http://bugs.webkit.org/show_bug.cgi?id=16973
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   138
					if (e.shiftKey || ed.settings.force_br_newlines && se.nodeName != 'LI') {
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   139
						t._insertBR(ed);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   140
						Event.cancel(e);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   141
					}
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   142
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   143
					// Workaround for DIV elements produced by Safari
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   144
					if (li = dom.getParent(se, 'LI')) {
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   145
						lic = dom.getParent(li, 'OL,UL');
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   146
						doc = ed.getDoc();
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   147
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   148
						pa = dom.create('p');
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   149
						dom.add(pa, 'br', {mce_bogus : "1"});
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   150
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   151
						if (isEmpty(doc, li)) {
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   152
							// If list in list then use browser default behavior
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   153
							if (n = dom.getParent(lic.parentNode, 'LI,OL,UL'))
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   154
								return;
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   155
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   156
							n = dom.getParent(lic, 'p,h1,h2,h3,h4,h5,h6,div') || lic;
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   157
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   158
							// Create range from the start of block element to the list item
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   159
							r1 = doc.createRange();
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   160
							r1.setStartBefore(n);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   161
							r1.setEndBefore(li);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   162
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   163
							// Create range after the list to the end of block element
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   164
							r2 = doc.createRange();
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   165
							r2.setStartAfter(li);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   166
							r2.setEndAfter(n);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   167
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   168
							be = r1.cloneContents();
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   169
							af = r2.cloneContents();
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   170
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   171
							if (!isEmpty(doc, af))
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   172
								dom.insertAfter(af, n);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   173
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   174
							dom.insertAfter(pa, n);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   175
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   176
							if (!isEmpty(doc, be))
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   177
								dom.insertAfter(be, n);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   178
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   179
							dom.remove(n);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   180
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   181
							n = pa.firstChild;
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   182
							r1 = doc.createRange();
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   183
							r1.setStartBefore(n);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   184
							r1.setEndBefore(n);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   185
							sel.setRng(r1);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   186
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   187
							return Event.cancel(e);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   188
						}
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   189
					}
395
fa4c5ecb7c9a Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents: 335
diff changeset
   190
				}
fa4c5ecb7c9a Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents: 335
diff changeset
   191
			});
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
   192
778
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   193
			// Safari doesn't place lists outside block elements
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   194
			ed.onExecCommand.add(function(ed, cmd) {
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   195
				var sel, dom, bl, bm;
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
   196
778
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   197
				if (cmd == 'InsertUnorderedList' || cmd == 'InsertOrderedList') {
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   198
					sel = ed.selection;
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   199
					dom = ed.dom;
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
   200
778
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   201
					if (bl = dom.getParent(sel.getNode(), function(n) {return /^(H[1-6]|P|ADDRESS|PRE)$/.test(n.nodeName);})) {
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   202
						bm = sel.getBookmark();
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   203
						dom.remove(bl, 1);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   204
						sel.moveToBookmark(bm);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   205
					}
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   206
				}
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
   207
			});
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
   208
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
   209
			// Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250
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
   210
			ed.onClick.add(function(ed, e) {
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
   211
				e = e.target;
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
   212
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
   213
				if (e.nodeName == 'IMG') {
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
   214
					t.selElm = e;
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
   215
					ed.selection.select(e);
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
   216
				} else
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
   217
					t.selElm = null;
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
   218
			});
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
   219
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
   220
			ed.onInit.add(function() {
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
   221
				t._fixWebKitSpans();
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
   222
			});
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
   223
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
   224
			ed.onSetContent.add(function() {
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
   225
				dom = ed.dom;
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
   226
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
   227
				// Convert strong,b,em,u,strike to spans
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
   228
				each(['strong','b','em','u','strike','sub','sup','a'], function(v) {
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
   229
					each(grep(dom.select(v)).reverse(), function(n) {
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
   230
						var nn = n.nodeName.toLowerCase(), st;
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
   231
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
   232
						// Convert anchors into images
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
   233
						if (nn == 'a') {
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
   234
							if (n.name)
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
   235
								dom.replace(dom.create('img', {mce_name : 'a', name : n.name, 'class' : 'mceItemAnchor'}), n);
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
   236
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
   237
							return;
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
   238
						}
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
   239
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
   240
						switch (nn) {
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
   241
							case 'b':
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
   242
							case 'strong':
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
   243
								if (nn == 'b')
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
   244
									nn = 'strong';
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
   245
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
   246
								st = 'font-weight: bold;';
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
   247
								break;
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
   248
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
   249
							case 'em':
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
   250
								st = 'font-style: italic;';
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
   251
								break;
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
   252
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
   253
							case 'u':
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
   254
								st = 'text-decoration: underline;';
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
   255
								break;
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
   256
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
   257
							case 'sub':
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
   258
								st = 'vertical-align: sub;';
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
   259
								break;
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
   260
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
   261
							case 'sup':
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
   262
								st = 'vertical-align: super;';
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
   263
								break;
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
   264
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
   265
							case 'strike':
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
   266
								st = 'text-decoration: line-through;';
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
   267
								break;
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
   268
						}
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
   269
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
   270
						dom.replace(dom.create('span', {mce_name : nn, style : st, 'class' : 'Apple-style-span'}), n, 1);
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
   271
					});
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
   272
				});
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
   273
			});
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
   274
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
   275
			ed.onPreProcess.add(function(ed, o) {
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
   276
				dom = ed.dom;
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
   277
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
   278
				each(grep(o.node.getElementsByTagName('span')).reverse(), function(n) {
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
   279
					var v, bg;
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
   280
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
   281
					if (o.get) {
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
   282
						if (dom.hasClass(n, 'Apple-style-span')) {
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
   283
							bg = n.style.backgroundColor;
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
   284
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
   285
							switch (dom.getAttrib(n, 'mce_name')) {
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
   286
								case 'font':
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
   287
									if (!ed.settings.convert_fonts_to_spans)
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
   288
										dom.setAttrib(n, 'style', '');
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
   289
									break;
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
   290
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
   291
								case 'strong':
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
   292
								case 'em':
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
   293
								case 'sub':
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
   294
								case 'sup':
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
   295
									dom.setAttrib(n, 'style', '');
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
   296
									break;
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
   297
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
   298
								case 'strike':
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
   299
								case 'u':
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
   300
									if (!ed.settings.inline_styles)
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
   301
										dom.setAttrib(n, 'style', '');
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
   302
									else
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
   303
										dom.setAttrib(n, 'mce_name', '');
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
   304
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
   305
									break;
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
   306
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
   307
								default:
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
   308
									if (!ed.settings.inline_styles)
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
   309
										dom.setAttrib(n, 'style', '');
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
   310
							}
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
   311
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
   312
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
   313
							if (bg)
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
   314
								n.style.backgroundColor = bg;
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
   315
						}
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
   316
					}
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
   317
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
   318
					if (dom.hasClass(n, 'mceItemRemoved'))
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
   319
						dom.remove(n, 1);
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
   320
				});
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
   321
			});
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
   322
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
   323
			ed.onPostProcess.add(function(ed, o) {
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
   324
				// Safari adds BR at end of all block elements
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
   325
				o.content = o.content.replace(/<br \/><\/(h[1-6]|div|p|address|pre)>/g, '</$1>');
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
   326
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
   327
				// Safari adds id="undefined" to HR elements
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
   328
				o.content = o.content.replace(/ id=\"undefined\"/g, '');
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
   329
			});
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
   330
		},
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
   331
543
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
   332
		getInfo : function() {
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
   333
			return {
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
   334
				longname : 'Safari compatibility',
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
   335
				author : 'Moxiecode Systems AB',
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
   336
				authorurl : 'http://tinymce.moxiecode.com',
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
   337
				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari',
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
   338
				version : tinymce.majorVersion + "." + tinymce.minorVersion
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
   339
			};
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
   340
		},
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
   341
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
   342
		// Internal methods
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
   343
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
   344
		_fixWebKitSpans : function() {
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
   345
			var t = this, ed = t.editor;
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
   346
1193
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 778
diff changeset
   347
			// Use mutator events on new WebKit
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 778
diff changeset
   348
			Event.add(ed.getDoc(), 'DOMNodeInserted', function(e) {
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 778
diff changeset
   349
				e = e.target;
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
   350
1193
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 778
diff changeset
   351
				if (e && e.nodeType == 1)
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 778
diff changeset
   352
					t._fixAppleSpan(e);
e3b94bd055dc TinyMCE: Bumped to v3.2.7
Dan
parents: 778
diff changeset
   353
			});
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
   354
		},
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
   355
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
   356
		_fixAppleSpan : function(e) {
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
   357
			var ed = this.editor, dom = ed.dom, fz = this.webKitFontSizes, fzn = this.namedFontSizes, s = ed.settings, st, p;
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
   358
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
   359
			if (dom.getAttrib(e, 'mce_fixed'))
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
   360
				return;
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
   361
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
   362
			// Handle Apple style spans
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
   363
			if (e.nodeName == 'SPAN' && e.className == 'Apple-style-span') {
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
   364
				st = e.style;
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
   365
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
   366
				if (!s.convert_fonts_to_spans) {
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
   367
					if (st.fontSize) {
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
   368
						dom.setAttrib(e, 'mce_name', 'font');
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
   369
						dom.setAttrib(e, 'size', inArray(fz, st.fontSize) + 1);
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
   370
					}
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
   371
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
   372
					if (st.fontFamily) {
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
   373
						dom.setAttrib(e, 'mce_name', 'font');
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
   374
						dom.setAttrib(e, 'face', st.fontFamily);
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
   375
					}
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
   376
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
   377
					if (st.color) {
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
   378
						dom.setAttrib(e, 'mce_name', 'font');
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
   379
						dom.setAttrib(e, 'color', dom.toHex(st.color));
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
   380
					}
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
   381
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
   382
					if (st.backgroundColor) {
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
   383
						dom.setAttrib(e, 'mce_name', 'font');
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
   384
						dom.setStyle(e, 'background-color', st.backgroundColor);
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
   385
					}
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
   386
				} else {
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
   387
					if (st.fontSize)
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
   388
						dom.setStyle(e, 'fontSize', fzn[inArray(fz, st.fontSize)]);
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
   389
				}
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
   390
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
   391
				if (st.fontWeight == 'bold')
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
   392
					dom.setAttrib(e, 'mce_name', 'strong');
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
   393
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
   394
				if (st.fontStyle == 'italic')
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
   395
					dom.setAttrib(e, 'mce_name', 'em');
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
   396
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
   397
				if (st.textDecoration == 'underline')
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
   398
					dom.setAttrib(e, 'mce_name', 'u');
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
   399
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
   400
				if (st.textDecoration == 'line-through')
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
   401
					dom.setAttrib(e, 'mce_name', 'strike');
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
   402
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
   403
				if (st.verticalAlign == 'super')
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
   404
					dom.setAttrib(e, 'mce_name', 'sup');
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
   405
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
   406
				if (st.verticalAlign == 'sub')
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
   407
					dom.setAttrib(e, 'mce_name', 'sub');
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
   408
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
   409
				dom.setAttrib(e, 'mce_fixed', '1');
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
   410
			}
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
   411
		},
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
   412
395
fa4c5ecb7c9a Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents: 335
diff changeset
   413
		_insertBR : function(ed) {
fa4c5ecb7c9a Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents: 335
diff changeset
   414
			var dom = ed.dom, s = ed.selection, r = s.getRng(), br;
fa4c5ecb7c9a Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents: 335
diff changeset
   415
fa4c5ecb7c9a Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents: 335
diff changeset
   416
			// Insert BR element
fa4c5ecb7c9a Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents: 335
diff changeset
   417
			r.insertNode(br = dom.create('br'));
fa4c5ecb7c9a Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents: 335
diff changeset
   418
fa4c5ecb7c9a Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents: 335
diff changeset
   419
			// Place caret after BR
fa4c5ecb7c9a Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents: 335
diff changeset
   420
			r.setStartAfter(br);
fa4c5ecb7c9a Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents: 335
diff changeset
   421
			r.setEndAfter(br);
fa4c5ecb7c9a Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents: 335
diff changeset
   422
			s.setRng(r);
fa4c5ecb7c9a Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents: 335
diff changeset
   423
fa4c5ecb7c9a Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents: 335
diff changeset
   424
			// Could not place caret after BR then insert an nbsp entity and move the caret
fa4c5ecb7c9a Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents: 335
diff changeset
   425
			if (s.getSel().focusNode == br.previousSibling) {
fa4c5ecb7c9a Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents: 335
diff changeset
   426
				s.select(dom.insertAfter(dom.doc.createTextNode('\u00a0'), br));
fa4c5ecb7c9a Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents: 335
diff changeset
   427
				s.collapse(1);
fa4c5ecb7c9a Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents: 335
diff changeset
   428
			}
fa4c5ecb7c9a Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents: 335
diff changeset
   429
fa4c5ecb7c9a Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents: 335
diff changeset
   430
			// Scroll to new position, scrollIntoView can't be used due to bug: http://bugs.webkit.org/show_bug.cgi?id=16117
fa4c5ecb7c9a Fixed splitting bug (really the same issue from stable) in get_pageid_from_url(); upgraded TinyMCE to version 3.0-stable
Dan
parents: 335
diff changeset
   431
			ed.getWin().scrollTo(0, dom.getPos(s.getRng().startContainer).y);
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
   432
		}
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
   433
	});
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
   434
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
   435
	// Register plugin
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
   436
	tinymce.PluginManager.add('safari', tinymce.plugins.Safari);
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
   437
})();
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
   438