includes/clientside/tinymce/plugins/safari/editor_plugin_src.js
author Dan
Sun, 20 Sep 2009 04:00:07 -0400
changeset 1118 e26e74d80c15
parent 778 57ce13805b6f
child 1193 e3b94bd055dc
permissions -rw-r--r--
Admin panel: added collapsible tables under GeneralConfig, with room for support on other pages.
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() {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
     9
	var Event = tinymce.dom.Event, grep = tinymce.grep, each = tinymce.each, inArray = tinymce.inArray, isOldWebKit = tinymce.isOldWebKit;
67bd3121a12e Replaced TinyMCE 2.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
543
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    58
			ed.onPaste.add(function(ed, e) {
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    59
				function removeStyles(e) {
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    60
					e = e.target;
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    61
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    62
					if (e.nodeType == 1) {
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    63
						e.style.cssText = '';
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    64
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    65
						each(ed.dom.select('*', e), function(e) {
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    66
							e.style.cssText = '';
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    67
						});
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    68
					}
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
				Event.add(ed.getDoc(), 'DOMNodeInserted', removeStyles);
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
				window.setTimeout(function() {
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    74
					Event.remove(ed.getDoc(), 'DOMNodeInserted', removeStyles);
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    75
				}, 0);
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    76
			});
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    77
476
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents: 459
diff changeset
    78
			ed.onKeyUp.add(function(ed, e) {
778
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    79
				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
    80
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents: 459
diff changeset
    81
				// 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
    82
				if (e.keyCode == 46 || e.keyCode == 8) {
543
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    83
					b = ed.getBody();
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
    84
					h = b.innerHTML;
778
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    85
					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
    86
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents: 459
diff changeset
    87
					// 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
    88
					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
    89
						// Inject paragrah and bogus br
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    90
						ed.setContent('<p><br mce_bogus="1" /></p>', {format : 'raw'});
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    91
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    92
						// Move caret before bogus br
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    93
						n = b.firstChild;
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    94
						r = s.getRng();
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    95
						r.setStart(n, 0);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    96
						r.setEnd(n, 0);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    97
						s.setRng(r);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
    98
					}
476
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents: 459
diff changeset
    99
				}
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents: 459
diff changeset
   100
			});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents: 459
diff changeset
   101
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
   102
			// 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
   103
			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
   104
				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
   105
67bd3121a12e Replaced TinyMCE 2.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
				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
   107
					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
   108
				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
   109
					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
   110
			});
67bd3121a12e Replaced TinyMCE 2.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
67bd3121a12e Replaced TinyMCE 2.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
			// 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
   113
			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
   114
				ed.getDoc().execCommand("InsertText", false, 'mce_marker');
778
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   115
				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
   116
				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
   117
				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
   118
			});
67bd3121a12e Replaced TinyMCE 2.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
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
   120
			ed.onKeyPress.add(function(ed, e) {
778
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   121
				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
   122
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   123
				if (e.keyCode == 13) {
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   124
					sel = ed.selection;
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   125
					se = sel.getNode();
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   126
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   127
					// 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
   128
					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
   129
						t._insertBR(ed);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   130
						Event.cancel(e);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   131
					}
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
					// Workaround for DIV elements produced by Safari
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   134
					if (li = dom.getParent(se, 'LI')) {
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   135
						lic = dom.getParent(li, 'OL,UL');
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   136
						doc = ed.getDoc();
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   137
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   138
						pa = dom.create('p');
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   139
						dom.add(pa, 'br', {mce_bogus : "1"});
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   140
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   141
						if (isEmpty(doc, li)) {
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   142
							// If list in list then use browser default behavior
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   143
							if (n = dom.getParent(lic.parentNode, 'LI,OL,UL'))
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   144
								return;
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   145
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   146
							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
   147
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   148
							// 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
   149
							r1 = doc.createRange();
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   150
							r1.setStartBefore(n);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   151
							r1.setEndBefore(li);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   152
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   153
							// 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
   154
							r2 = doc.createRange();
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   155
							r2.setStartAfter(li);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   156
							r2.setEndAfter(n);
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
							be = r1.cloneContents();
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   159
							af = r2.cloneContents();
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   160
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   161
							if (!isEmpty(doc, af))
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   162
								dom.insertAfter(af, n);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   163
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   164
							dom.insertAfter(pa, n);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   165
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   166
							if (!isEmpty(doc, be))
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   167
								dom.insertAfter(be, n);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   168
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   169
							dom.remove(n);
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
							n = pa.firstChild;
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   172
							r1 = doc.createRange();
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   173
							r1.setStartBefore(n);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   174
							r1.setEndBefore(n);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   175
							sel.setRng(r1);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   176
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   177
							return Event.cancel(e);
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
					}
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
   180
				}
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
   181
			});
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
   182
778
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   183
			// Safari doesn't place lists outside block elements
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   184
			ed.onExecCommand.add(function(ed, cmd) {
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   185
				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
   186
778
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   187
				if (cmd == 'InsertUnorderedList' || cmd == 'InsertOrderedList') {
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   188
					sel = ed.selection;
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   189
					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
   190
778
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   191
					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
   192
						bm = sel.getBookmark();
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   193
						dom.remove(bl, 1);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   194
						sel.moveToBookmark(bm);
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   195
					}
57ce13805b6f Upgraded TinyMCE to version 3.2.1.1
Dan
parents: 543
diff changeset
   196
				}
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
   197
			});
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   198
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   199
			// 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
   200
			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
   201
				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
   202
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   203
				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
   204
					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
   205
					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
   206
				} 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
   207
					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
   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
67bd3121a12e Replaced TinyMCE 2.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.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
   211
				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
   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 (isOldWebKit)
67bd3121a12e Replaced TinyMCE 2.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._patchSafari2x(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
   215
			});
67bd3121a12e Replaced TinyMCE 2.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
67bd3121a12e Replaced TinyMCE 2.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
			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
   218
				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
   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
				// 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
   221
				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
   222
					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
   223
						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
   224
67bd3121a12e Replaced TinyMCE 2.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
						// 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
   226
						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
   227
							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
   228
								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
   229
67bd3121a12e Replaced TinyMCE 2.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
							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
   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
67bd3121a12e Replaced TinyMCE 2.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
						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
   234
							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
   235
							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
   236
								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
   237
									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
   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
								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
   240
								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
   241
67bd3121a12e Replaced TinyMCE 2.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 '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
   243
								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
   244
								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
   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
							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
   247
								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
   248
								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
   249
67bd3121a12e Replaced TinyMCE 2.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
							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
   251
								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
   252
								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
   253
67bd3121a12e Replaced TinyMCE 2.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
							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
   255
								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
   256
								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
   257
67bd3121a12e Replaced TinyMCE 2.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
							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
   259
								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
   260
								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
   261
						}
67bd3121a12e Replaced TinyMCE 2.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
67bd3121a12e Replaced TinyMCE 2.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
						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
   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
				});
67bd3121a12e Replaced TinyMCE 2.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
			});
67bd3121a12e Replaced TinyMCE 2.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
67bd3121a12e Replaced TinyMCE 2.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
			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
   269
				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
   270
67bd3121a12e Replaced TinyMCE 2.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
				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
   272
					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
   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
					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
   275
						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
   276
							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
   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
							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
   279
								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
   280
									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
   281
										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
   282
									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
   283
67bd3121a12e Replaced TinyMCE 2.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
								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
   285
								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
   286
								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
   287
								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
   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 '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
   292
								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
   293
									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
   294
										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
   295
									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
   296
										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
   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
									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
   299
67bd3121a12e Replaced TinyMCE 2.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
								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
   301
									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
   302
										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
   303
							}
67bd3121a12e Replaced TinyMCE 2.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
67bd3121a12e Replaced TinyMCE 2.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
							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
   307
								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
   308
						}
67bd3121a12e Replaced TinyMCE 2.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
					}
67bd3121a12e Replaced TinyMCE 2.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
					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
   312
						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
   313
				});
67bd3121a12e Replaced TinyMCE 2.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
			});
67bd3121a12e Replaced TinyMCE 2.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
			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
   317
				// 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
   318
				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
   319
67bd3121a12e Replaced TinyMCE 2.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
				// 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
   321
				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
   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
		},
67bd3121a12e Replaced TinyMCE 2.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
543
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
   325
		getInfo : function() {
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
   326
			return {
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
   327
				longname : 'Safari compatibility',
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
   328
				author : 'Moxiecode Systems AB',
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
   329
				authorurl : 'http://tinymce.moxiecode.com',
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
   330
				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari',
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
   331
				version : tinymce.majorVersion + "." + tinymce.minorVersion
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
   332
			};
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
   333
		},
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
   334
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
   335
		// Internal methods
dffcbfbc4e59 Upgraded TinyMCE to version 3.0.8
Dan
parents: 476
diff changeset
   336
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
   337
		_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
   338
			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
   339
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   340
			if (!isOldWebKit) {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   341
				// Use mutator events on new 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
   342
				Event.add(ed.getDoc(), 'DOMNodeInserted', 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
   343
					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
   344
67bd3121a12e Replaced TinyMCE 2.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
					if (e && e.nodeType == 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
   346
						t._fixAppleSpan(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
   347
				});
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   348
			} 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
   349
				// Do post command processing in old WebKit since the browser crashes on Mutator events :(
67bd3121a12e Replaced TinyMCE 2.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
				ed.onExecCommand.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
   351
					each(ed.dom.select('span'), 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
   352
						t._fixAppleSpan(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
   353
					});
67bd3121a12e Replaced TinyMCE 2.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
					ed.nodeChanged();
67bd3121a12e Replaced TinyMCE 2.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
				});
67bd3121a12e Replaced TinyMCE 2.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
			}
67bd3121a12e Replaced TinyMCE 2.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
67bd3121a12e Replaced TinyMCE 2.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
		_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
   361
			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
   362
67bd3121a12e Replaced TinyMCE 2.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 (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
   364
				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
   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
			// 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
   367
			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
   368
				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
   369
67bd3121a12e Replaced TinyMCE 2.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
				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
   371
					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
   372
						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
   373
						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
   374
					}
67bd3121a12e Replaced TinyMCE 2.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
					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
   377
						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
   378
						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
   379
					}
67bd3121a12e Replaced TinyMCE 2.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
					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
   382
						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
   383
						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
   384
					}
67bd3121a12e Replaced TinyMCE 2.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
					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
   387
						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
   388
						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
   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
				} 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
   391
					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
   392
						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
   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
67bd3121a12e Replaced TinyMCE 2.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
				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
   396
					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
   397
67bd3121a12e Replaced TinyMCE 2.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
				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
   399
					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
   400
67bd3121a12e Replaced TinyMCE 2.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
				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
   402
					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
   403
67bd3121a12e Replaced TinyMCE 2.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
				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
   405
					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
   406
67bd3121a12e Replaced TinyMCE 2.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
				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
   408
					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
   409
67bd3121a12e Replaced TinyMCE 2.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
				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
   411
					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
   412
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   413
				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
   414
			}
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   415
		},
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   416
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   417
		_patchSafari2x : 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
   418
			var t = this, setContent, getNode, dom = ed.dom, lr;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   419
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   420
			// Inline dialogs
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   421
			if (ed.windowManager.onBeforeOpen) {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   422
				ed.windowManager.onBeforeOpen.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
   423
					r = ed.selection.getRng();
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   424
				});
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   425
			}
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   426
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   427
			// Fake select on 2.x
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   428
			ed.selection.select = 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
   429
				this.getSel().setBaseAndExtent(n, 0, 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
   430
			};
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   431
67bd3121a12e Replaced TinyMCE 2.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
			getNode = ed.selection.getNode;
67bd3121a12e Replaced TinyMCE 2.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
			ed.selection.getNode = 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
   434
				return t.selElm || getNode.call(this);
67bd3121a12e Replaced TinyMCE 2.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
			};
67bd3121a12e Replaced TinyMCE 2.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
67bd3121a12e Replaced TinyMCE 2.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
			// Fake range on Safari 2.x
67bd3121a12e Replaced TinyMCE 2.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
			ed.selection.getRng = 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
   439
				var t = this, s = t.getSel(), d = ed.getDoc(), r, rb, ra, di;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   440
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   441
				// Fake range on Safari 2.x
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   442
				if (s.anchorNode) {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   443
					r = d.createRange();
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   444
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   445
					try {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   446
						// Setup before range
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   447
						rb = d.createRange();
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   448
						rb.setStart(s.anchorNode, s.anchorOffset);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   449
						rb.collapse(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
   450
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   451
						// Setup after range
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   452
						ra = d.createRange();
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   453
						ra.setStart(s.focusNode, s.focusOffset);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   454
						ra.collapse(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
   455
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   456
						// Setup start/end points by comparing locations
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   457
						di = rb.compareBoundaryPoints(rb.START_TO_END, ra) < 0;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   458
						r.setStart(di ? s.anchorNode : s.focusNode, di ? s.anchorOffset : s.focusOffset);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   459
						r.setEnd(di ? s.focusNode : s.anchorNode, di ? s.focusOffset : s.anchorOffset);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   460
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   461
						lr = r;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   462
					} catch (ex) {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   463
						// Sometimes fails, at least we tried to do it by the book. I hope Safari 2.x will go disappear soooon!!!
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   464
					}
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   465
				}
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   466
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   467
				return r || lr;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   468
			};
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   469
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   470
			// Fix setContent so it works
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   471
			setContent = ed.selection.setContent;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   472
			ed.selection.setContent = function(h, s) {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   473
				var r = this.getRng(), 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
   474
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   475
				try {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   476
					setContent.call(this, h, s);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   477
				} catch (ex) {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   478
					// Workaround for Safari 2.x
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   479
					b = dom.create('body');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   480
					b.innerHTML = h;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   481
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   482
					each(b.childNodes, 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
   483
						r.insertNode(n.cloneNode(true));
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   484
					});
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   485
				}
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   486
			};
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
   487
		},
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
   488
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
   489
		_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
   490
			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
   491
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
   492
			// 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
   493
			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
   494
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
   495
			// 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
   496
			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
   497
			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
   498
			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
   499
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
   500
			// 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
   501
			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
   502
				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
   503
				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
   504
			}
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
   505
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
   506
			// 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
   507
			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
   508
		}
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   509
	});
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   510
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   511
	// 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
   512
	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
   513
})();
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
diff changeset
   514