author | Dan Fuhry <dan@enanocms.org> |
Fri, 19 Nov 2010 03:30:35 -0500 | |
changeset 1329 | 61d87ee12e80 |
parent 1193 | e3b94bd055dc |
permissions | -rw-r--r-- |
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:
117
diff
changeset
|
1 |
var tinymce = { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2 |
majorVersion : '3', |
1193 | 3 |
minorVersion : '2.7', |
4 |
releaseDate : '2009-09-22', |
|
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:
117
diff
changeset
|
5 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6 |
_init : function() { |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7 |
var t = this, d = document, w = window, na = navigator, ua = na.userAgent, i, nl, n, base, p, v; |
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:
117
diff
changeset
|
8 |
|
543 | 9 |
t.isOpera = w.opera && opera.buildNumber; |
1193 | 10 |
|
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:
117
diff
changeset
|
11 |
t.isWebKit = /WebKit/.test(ua); |
1193 | 12 |
|
543 | 13 |
t.isIE = !t.isWebKit && !t.isOpera && (/MSIE/gi).test(ua) && (/Explorer/gi).test(na.appName); |
1193 | 14 |
|
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:
117
diff
changeset
|
15 |
t.isIE6 = t.isIE && /MSIE [56]/.test(ua); |
1193 | 16 |
|
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:
117
diff
changeset
|
17 |
t.isGecko = !t.isWebKit && /Gecko/.test(ua); |
1193 | 18 |
|
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:
117
diff
changeset
|
19 |
t.isMac = ua.indexOf('Mac') != -1; |
1193 | 20 |
|
778 | 21 |
t.isAir = /adobeair/i.test(ua); |
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:
117
diff
changeset
|
22 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
23 |
// TinyMCE .NET webcontrol might be setting the values for TinyMCE |
543 | 24 |
if (w.tinyMCEPreInit) { |
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:
117
diff
changeset
|
25 |
t.suffix = tinyMCEPreInit.suffix; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
26 |
t.baseURL = tinyMCEPreInit.base; |
543 | 27 |
t.query = tinyMCEPreInit.query; |
1 | 28 |
return; |
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:
117
diff
changeset
|
29 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
30 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
31 |
// Get suffix and base |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
32 |
t.suffix = ''; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
33 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
34 |
// If base element found, add that infront of baseURL |
543 | 35 |
nl = d.getElementsByTagName('base'); |
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:
117
diff
changeset
|
36 |
for (i=0; i<nl.length; i++) { |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
37 |
if (v = nl[i].href) { |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
38 |
// Host only value like http://site.com or http://site.com:8008 |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
39 |
if (/^https?:\/\/[^\/]+$/.test(v)) |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
40 |
v += '/'; |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
41 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
42 |
base = v ? v.match(/.*\//)[0] : ''; // Get only directory |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
43 |
} |
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:
117
diff
changeset
|
44 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
45 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
46 |
function getBase(n) { |
1193 | 47 |
if (n.src && /tiny_mce(|_gzip|_jquery|_prototype)(_dev|_src)?.js/.test(n.src)) { |
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:
117
diff
changeset
|
48 |
if (/_(src|dev)\.js/g.test(n.src)) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
49 |
t.suffix = '_src'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
50 |
|
543 | 51 |
if ((p = n.src.indexOf('?')) != -1) |
52 |
t.query = n.src.substring(p + 1); |
|
53 |
||
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:
117
diff
changeset
|
54 |
t.baseURL = n.src.substring(0, n.src.lastIndexOf('/')); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
55 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
56 |
// If path to script is relative and a base href was found add that one infront |
1193 | 57 |
// the src property will always be an absolute one on non IE browsers and IE 8 |
58 |
// so this logic will basically only be executed on older IE versions |
|
59 |
if (base && t.baseURL.indexOf('://') == -1 && t.baseURL.indexOf('/') !== 0) |
|
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:
117
diff
changeset
|
60 |
t.baseURL = base + t.baseURL; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
61 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
62 |
return t.baseURL; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
63 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
64 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
65 |
return 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:
117
diff
changeset
|
66 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
67 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
68 |
// Check document |
543 | 69 |
nl = d.getElementsByTagName('script'); |
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:
117
diff
changeset
|
70 |
for (i=0; i<nl.length; i++) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
71 |
if (getBase(nl[i])) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
72 |
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:
117
diff
changeset
|
73 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
74 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
75 |
// Check head |
543 | 76 |
n = d.getElementsByTagName('head')[0]; |
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:
117
diff
changeset
|
77 |
if (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:
117
diff
changeset
|
78 |
nl = n.getElementsByTagName('script'); |
1 | 79 |
for (i=0; i<nl.length; i++) { |
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:
117
diff
changeset
|
80 |
if (getBase(nl[i])) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
81 |
return; |
1 | 82 |
} |
83 |
} |
|
84 |
||
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:
117
diff
changeset
|
85 |
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:
117
diff
changeset
|
86 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
87 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
88 |
is : function(o, t) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
89 |
var n = typeof(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:
117
diff
changeset
|
90 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
91 |
if (!t) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
92 |
return n != 'undefined'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
93 |
|
1193 | 94 |
if (t == 'array' && (o.hasOwnProperty && o instanceof Array)) |
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:
117
diff
changeset
|
95 |
return 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:
117
diff
changeset
|
96 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
97 |
return n == t; |
1 | 98 |
}, |
99 |
||
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:
117
diff
changeset
|
100 |
each : function(o, cb, 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:
117
diff
changeset
|
101 |
var n, l; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
102 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
103 |
if (!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:
117
diff
changeset
|
104 |
return 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:
117
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:
117
diff
changeset
|
106 |
s = s || 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:
117
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:
117
diff
changeset
|
108 |
if (typeof(o.length) != 'undefined') { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
109 |
// Indexed arrays, needed for 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:
117
diff
changeset
|
110 |
for (n=0, l = o.length; n<l; 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:
117
diff
changeset
|
111 |
if (cb.call(s, o[n], n, o) === 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:
117
diff
changeset
|
112 |
return 0; |
1 | 113 |
} |
114 |
} else { |
|
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:
117
diff
changeset
|
115 |
// Hashtables |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
116 |
for (n in 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:
117
diff
changeset
|
117 |
if (o.hasOwnProperty(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:
117
diff
changeset
|
118 |
if (cb.call(s, o[n], n, o) === 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:
117
diff
changeset
|
119 |
return 0; |
1 | 120 |
} |
121 |
} |
|
122 |
} |
|
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:
117
diff
changeset
|
123 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
124 |
return 1; |
1 | 125 |
}, |
126 |
||
1193 | 127 |
|
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:
117
diff
changeset
|
128 |
map : function(a, f) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
129 |
var 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:
117
diff
changeset
|
130 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
131 |
tinymce.each(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:
117
diff
changeset
|
132 |
o.push(f(v)); |
1 | 133 |
}); |
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:
117
diff
changeset
|
134 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
135 |
return o; |
1 | 136 |
}, |
137 |
||
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:
117
diff
changeset
|
138 |
grep : function(a, f) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
139 |
var 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:
117
diff
changeset
|
140 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
141 |
tinymce.each(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:
117
diff
changeset
|
142 |
if (!f || f(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:
117
diff
changeset
|
143 |
o.push(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:
117
diff
changeset
|
144 |
}); |
1 | 145 |
|
146 |
return o; |
|
147 |
}, |
|
148 |
||
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:
117
diff
changeset
|
149 |
inArray : function(a, 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:
117
diff
changeset
|
150 |
var i, l; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
151 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
152 |
if (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:
117
diff
changeset
|
153 |
for (i = 0, l = a.length; i < l; i++) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
154 |
if (a[i] === 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:
117
diff
changeset
|
155 |
return i; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
156 |
} |
1 | 157 |
} |
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:
117
diff
changeset
|
158 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
159 |
return -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:
117
diff
changeset
|
160 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
161 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
162 |
extend : function(o, 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:
117
diff
changeset
|
163 |
var i, a = arguments; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
164 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
165 |
for (i=1; i<a.length; i++) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
166 |
e = a[i]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
167 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
168 |
tinymce.each(e, function(v, 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:
117
diff
changeset
|
169 |
if (typeof(v) !== 'undefined') |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
170 |
o[n] = 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:
117
diff
changeset
|
171 |
}); |
1 | 172 |
} |
173 |
||
174 |
return o; |
|
175 |
}, |
|
176 |
||
1193 | 177 |
|
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:
117
diff
changeset
|
178 |
trim : function(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:
117
diff
changeset
|
179 |
return (s ? '' + s : '').replace(/^\s*|\s*$/g, ''); |
1 | 180 |
}, |
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:
117
diff
changeset
|
182 |
create : function(s, 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:
117
diff
changeset
|
183 |
var t = this, sp, ns, cn, scn, c, de = 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:
117
diff
changeset
|
184 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
185 |
// Parse : <prefix> <class>:<super class> |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
186 |
s = /^((static) )?([\w.]+)(:([\w.]+))?/.exec(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:
117
diff
changeset
|
187 |
cn = s[3].match(/(^|\.)(\w+)$/i)[2]; // Class 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:
117
diff
changeset
|
188 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
189 |
// Create namespace for new class |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
190 |
ns = t.createNS(s[3].replace(/\.\w+$/, '')); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
191 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
192 |
// Class already exists |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
193 |
if (ns[cn]) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
194 |
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:
117
diff
changeset
|
195 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
196 |
// Make pure static class |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
197 |
if (s[2] == 'static') { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
198 |
ns[cn] = 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:
117
diff
changeset
|
199 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
200 |
if (this.onCreate) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
201 |
this.onCreate(s[2], s[3], ns[cn]); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
202 |
|
1 | 203 |
return; |
204 |
} |
|
205 |
||
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:
117
diff
changeset
|
206 |
// Create default constructor |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
207 |
if (!p[cn]) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
208 |
p[cn] = 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:
117
diff
changeset
|
209 |
de = 1; |
1 | 210 |
} |
211 |
||
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:
117
diff
changeset
|
212 |
// Add constructor and methods |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
213 |
ns[cn] = p[cn]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
214 |
t.extend(ns[cn].prototype, 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:
117
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:
117
diff
changeset
|
216 |
// Extend |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
217 |
if (s[5]) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
218 |
sp = t.resolve(s[5]).prototype; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
219 |
scn = s[5].match(/\.(\w+)$/i)[1]; // Class 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:
117
diff
changeset
|
220 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
221 |
// Extend constructor |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
222 |
c = ns[cn]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
223 |
if (de) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
224 |
// Add passthrough constructor |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
225 |
ns[cn] = 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:
117
diff
changeset
|
226 |
return sp[scn].apply(this, arguments); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
227 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
228 |
} 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:
117
diff
changeset
|
229 |
// Add inherit constructor |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
230 |
ns[cn] = 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:
117
diff
changeset
|
231 |
this.parent = sp[scn]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
232 |
return c.apply(this, arguments); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
233 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
234 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
235 |
ns[cn].prototype[cn] = ns[cn]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
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:
117
diff
changeset
|
237 |
// Add super methods |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
238 |
t.each(sp, function(f, n) { |
543 | 239 |
ns[cn].prototype[n] = sp[n]; |
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:
117
diff
changeset
|
240 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
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:
117
diff
changeset
|
242 |
// Add overridden methods |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
243 |
t.each(p, function(f, 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:
117
diff
changeset
|
244 |
// Extend methods if needed |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
245 |
if (sp[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:
117
diff
changeset
|
246 |
ns[cn].prototype[n] = 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:
117
diff
changeset
|
247 |
this.parent = sp[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:
117
diff
changeset
|
248 |
return f.apply(this, arguments); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
249 |
}; |
1 | 250 |
} else { |
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:
117
diff
changeset
|
251 |
if (n != cn) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
252 |
ns[cn].prototype[n] = f; |
1 | 253 |
} |
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:
117
diff
changeset
|
254 |
}); |
1 | 255 |
} |
256 |
||
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:
117
diff
changeset
|
257 |
// Add static methods |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
258 |
t.each(p['static'], function(f, 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:
117
diff
changeset
|
259 |
ns[cn][n] = f; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
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:
117
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:
117
diff
changeset
|
262 |
if (this.onCreate) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
263 |
this.onCreate(s[2], s[3], ns[cn].prototype); |
1 | 264 |
}, |
265 |
||
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:
117
diff
changeset
|
266 |
walk : function(o, f, n, 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:
117
diff
changeset
|
267 |
s = s || 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:
117
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:
117
diff
changeset
|
269 |
if (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:
117
diff
changeset
|
270 |
if (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:
117
diff
changeset
|
271 |
o = o[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:
117
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:
117
diff
changeset
|
273 |
tinymce.each(o, function(o, i) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
274 |
if (f.call(s, o, i, n) === 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:
117
diff
changeset
|
275 |
return 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:
117
diff
changeset
|
276 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
277 |
tinymce.walk(o, f, n, 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:
117
diff
changeset
|
278 |
}); |
1 | 279 |
} |
280 |
}, |
|
281 |
||
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:
117
diff
changeset
|
282 |
createNS : function(n, 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:
117
diff
changeset
|
283 |
var i, 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:
117
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:
117
diff
changeset
|
285 |
o = o || window; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
286 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
287 |
n = n.split('.'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
288 |
for (i=0; i<n.length; i++) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
289 |
v = n[i]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
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:
117
diff
changeset
|
291 |
if (!o[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:
117
diff
changeset
|
292 |
o[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:
117
diff
changeset
|
293 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
294 |
o = o[v]; |
1 | 295 |
} |
296 |
||
297 |
return o; |
|
298 |
}, |
|
299 |
||
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:
117
diff
changeset
|
300 |
resolve : function(n, 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:
117
diff
changeset
|
301 |
var i, l; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
302 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
303 |
o = o || window; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
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:
117
diff
changeset
|
305 |
n = n.split('.'); |
1193 | 306 |
for (i = 0, l = n.length; i < l; i++) { |
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:
117
diff
changeset
|
307 |
o = o[n[i]]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
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:
117
diff
changeset
|
309 |
if (!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:
117
diff
changeset
|
310 |
break; |
1 | 311 |
} |
312 |
||
313 |
return o; |
|
314 |
}, |
|
315 |
||
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:
117
diff
changeset
|
316 |
addUnload : function(f, s) { |
543 | 317 |
var t = this, w = window; |
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:
117
diff
changeset
|
318 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
319 |
f = {func : f, scope : s || 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:
117
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:
117
diff
changeset
|
321 |
if (!t.unloads) { |
543 | 322 |
function unload() { |
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:
117
diff
changeset
|
323 |
var li = t.unloads, o, 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:
117
diff
changeset
|
324 |
|
543 | 325 |
if (li) { |
326 |
// Call unload handlers |
|
327 |
for (n in li) { |
|
328 |
o = li[n]; |
|
329 |
||
330 |
if (o && o.func) |
|
331 |
o.func.call(o.scope, 1); // Send in one arg to distinct unload and user destroy |
|
332 |
} |
|
333 |
||
334 |
// Detach unload function |
|
335 |
if (w.detachEvent) { |
|
336 |
w.detachEvent('onbeforeunload', fakeUnload); |
|
337 |
w.detachEvent('onunload', unload); |
|
338 |
} else if (w.removeEventListener) |
|
339 |
w.removeEventListener('unload', unload, false); |
|
340 |
||
341 |
// Destroy references |
|
1193 | 342 |
t.unloads = o = li = w = unload = 0; |
543 | 343 |
|
344 |
// Run garbarge collector on IE |
|
345 |
if (window.CollectGarbage) |
|
346 |
window.CollectGarbage(); |
|
347 |
} |
|
348 |
}; |
|
349 |
||
350 |
function fakeUnload() { |
|
351 |
var d = document; |
|
352 |
||
353 |
// Is there things still loading, then do some magic |
|
354 |
if (d.readyState == 'interactive') { |
|
355 |
function stop() { |
|
356 |
// Prevent memory leak |
|
357 |
d.detachEvent('onstop', stop); |
|
358 |
||
359 |
// Call unload handler |
|
1193 | 360 |
if (unload) |
361 |
unload(); |
|
362 |
||
363 |
d = 0; |
|
543 | 364 |
}; |
365 |
||
366 |
// Fire unload when the currently loading page is stopped |
|
1193 | 367 |
if (d) |
368 |
d.attachEvent('onstop', stop); |
|
543 | 369 |
|
370 |
// Remove onstop listener after a while to prevent the unload function |
|
371 |
// to execute if the user presses cancel in an onbeforeunload |
|
372 |
// confirm dialog and then presses the browser stop button |
|
373 |
window.setTimeout(function() { |
|
1193 | 374 |
if (d) |
375 |
d.detachEvent('onstop', stop); |
|
543 | 376 |
}, 0); |
377 |
} |
|
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:
117
diff
changeset
|
378 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
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:
117
diff
changeset
|
380 |
// Attach unload handler |
543 | 381 |
if (w.attachEvent) { |
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:
117
diff
changeset
|
382 |
w.attachEvent('onunload', unload); |
543 | 383 |
w.attachEvent('onbeforeunload', fakeUnload); |
384 |
} else if (w.addEventListener) |
|
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:
117
diff
changeset
|
385 |
w.addEventListener('unload', unload, 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:
117
diff
changeset
|
386 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
387 |
// Setup initial unload handler array |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
388 |
t.unloads = [f]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
389 |
} 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:
117
diff
changeset
|
390 |
t.unloads.push(f); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
391 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
392 |
return f; |
1 | 393 |
}, |
394 |
||
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:
117
diff
changeset
|
395 |
removeUnload : function(f) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
396 |
var u = this.unloads, r = 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:
117
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:
117
diff
changeset
|
398 |
tinymce.each(u, function(o, i) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
399 |
if (o && o.func == f) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
400 |
u.splice(i, 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:
117
diff
changeset
|
401 |
r = f; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
402 |
return 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:
117
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:
117
diff
changeset
|
404 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
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:
117
diff
changeset
|
406 |
return r; |
543 | 407 |
}, |
408 |
||
409 |
explode : function(s, d) { |
|
410 |
return s ? tinymce.map(s.split(d || ','), tinymce.trim) : s; |
|
411 |
}, |
|
412 |
||
413 |
_addVer : function(u) { |
|
414 |
var v; |
|
415 |
||
416 |
if (!this.query) |
|
417 |
return u; |
|
418 |
||
419 |
v = (u.indexOf('?') == -1 ? '?' : '&') + this.query; |
|
420 |
||
421 |
if (u.indexOf('#') == -1) |
|
422 |
return u + v; |
|
423 |
||
424 |
return u.replace('#', v + '#'); |
|
1 | 425 |
} |
426 |
||
427 |
}; |
|
428 |
||
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:
117
diff
changeset
|
429 |
// Required for GZip AJAX loading |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
430 |
window.tinymce = tinymce; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
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:
117
diff
changeset
|
432 |
// Initialize the API |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
433 |
tinymce._init(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
434 |
tinymce.create('tinymce.util.Dispatcher', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
435 |
scope : 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:
117
diff
changeset
|
436 |
listeners : 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:
117
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:
117
diff
changeset
|
438 |
Dispatcher : function(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:
117
diff
changeset
|
439 |
this.scope = s || 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:
117
diff
changeset
|
440 |
this.listeners = []; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
441 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
442 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
443 |
add : function(cb, 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:
117
diff
changeset
|
444 |
this.listeners.push({cb : cb, scope : s || this.scope}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
445 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
446 |
return cb; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
447 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
448 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
449 |
addToTop : function(cb, 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:
117
diff
changeset
|
450 |
this.listeners.unshift({cb : cb, scope : s || this.scope}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
451 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
452 |
return cb; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
453 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
454 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
455 |
remove : function(cb) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
456 |
var l = this.listeners, o = 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:
117
diff
changeset
|
457 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
458 |
tinymce.each(l, function(c, i) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
459 |
if (cb == c.cb) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
460 |
o = cb; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
461 |
l.splice(i, 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:
117
diff
changeset
|
462 |
return 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:
117
diff
changeset
|
463 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
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:
117
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:
117
diff
changeset
|
466 |
return 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:
117
diff
changeset
|
467 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
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:
117
diff
changeset
|
469 |
dispatch : function() { |
543 | 470 |
var s, a = arguments, i, li = this.listeners, c; |
471 |
||
472 |
// Needs to be a real loop since the listener count might change while looping |
|
473 |
// And this is also more efficient |
|
474 |
for (i = 0; i<li.length; i++) { |
|
475 |
c = li[i]; |
|
476 |
s = c.cb.apply(c.scope, a); |
|
477 |
||
478 |
if (s === false) |
|
479 |
break; |
|
480 |
} |
|
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:
117
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:
117
diff
changeset
|
482 |
return s; |
1 | 483 |
} |
484 |
||
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:
117
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:
117
diff
changeset
|
486 |
(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:
117
diff
changeset
|
487 |
var each = tinymce.each; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
488 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
489 |
tinymce.create('tinymce.util.URI', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
490 |
URI : function(u, 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:
117
diff
changeset
|
491 |
var t = this, o, a, 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:
117
diff
changeset
|
492 |
|
1193 | 493 |
// Trim whitespace |
494 |
u = tinymce.trim(u); |
|
495 |
||
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:
117
diff
changeset
|
496 |
// Default settings |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
497 |
s = t.settings = 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:
117
diff
changeset
|
498 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
499 |
// Strange app protocol or local anchor |
1193 | 500 |
if (/^(mailto|tel|news|javascript|about|data):/i.test(u) || /^\s*#/.test(u)) { |
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:
117
diff
changeset
|
501 |
t.source = 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:
117
diff
changeset
|
502 |
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:
117
diff
changeset
|
503 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
504 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
505 |
// Absolute path with no host, fake host and protocol |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
506 |
if (u.indexOf('/') === 0 && u.indexOf('//') !== 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:
117
diff
changeset
|
507 |
u = (s.base_uri ? s.base_uri.protocol || 'http' : 'http') + '://mce_host' + 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:
117
diff
changeset
|
508 |
|
1193 | 509 |
// Relative path http:// or protocol relative //path |
510 |
if (!/^\w*:?\/\//.test(u)) |
|
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:
117
diff
changeset
|
511 |
u = (s.base_uri.protocol || 'http') + '://mce_host' + t.toAbsPath(s.base_uri.path, 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:
117
diff
changeset
|
512 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
513 |
// Parse URL (Credits goes to Steave, http://blog.stevenlevithan.com/archives/parseuri) |
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
|
514 |
u = u.replace(/@@/g, '(mce_at)'); // Zope 3 workaround, they use @@something |
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:
117
diff
changeset
|
515 |
u = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(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:
117
diff
changeset
|
516 |
each(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], function(v, i) { |
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
|
517 |
var s = u[i]; |
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
|
518 |
|
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
|
519 |
// Zope 3 workaround, they use @@something |
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
|
520 |
if (s) |
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
|
521 |
s = s.replace(/\(mce_at\)/g, '@@'); |
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
|
522 |
|
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
|
523 |
t[v] = s; |
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:
117
diff
changeset
|
524 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
525 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
526 |
if (b = s.base_uri) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
527 |
if (!t.protocol) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
528 |
t.protocol = b.protocol; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
529 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
530 |
if (!t.userInfo) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
531 |
t.userInfo = b.userInfo; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
532 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
533 |
if (!t.port && t.host == 'mce_host') |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
534 |
t.port = b.port; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
535 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
536 |
if (!t.host || t.host == 'mce_host') |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
537 |
t.host = b.host; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
538 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
539 |
t.source = ''; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
540 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
541 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
542 |
//t.path = t.path || '/'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
543 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
544 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
545 |
setPath : function(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:
117
diff
changeset
|
546 |
var t = 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:
117
diff
changeset
|
547 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
548 |
p = /^(.*?)\/?(\w+)?$/.exec(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:
117
diff
changeset
|
549 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
550 |
// Update path parts |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
551 |
t.path = p[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:
117
diff
changeset
|
552 |
t.directory = p[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:
117
diff
changeset
|
553 |
t.file = p[2]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
554 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
555 |
// Rebuild source |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
556 |
t.source = ''; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
557 |
t.getURI(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
558 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
559 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
560 |
toRelative : function(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:
117
diff
changeset
|
561 |
var t = this, 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:
117
diff
changeset
|
562 |
|
778 | 563 |
if (u === "./") |
564 |
return u; |
|
565 |
||
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:
117
diff
changeset
|
566 |
u = new tinymce.util.URI(u, {base_uri : t}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
567 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
568 |
// Not on same domain/port or protocol |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
569 |
if ((u.host != 'mce_host' && t.host != u.host && u.host) || t.port != u.port || t.protocol != u.protocol) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
570 |
return u.getURI(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
571 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
572 |
o = t.toRelPath(t.path, u.path); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
573 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
574 |
// Add query |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
575 |
if (u.query) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
576 |
o += '?' + u.query; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
577 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
578 |
// Add anchor |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
579 |
if (u.anchor) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
580 |
o += '#' + u.anchor; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
581 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
582 |
return 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:
117
diff
changeset
|
583 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
584 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
585 |
toAbsolute : function(u, nh) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
586 |
var u = new tinymce.util.URI(u, {base_uri : 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:
117
diff
changeset
|
587 |
|
1193 | 588 |
return u.getURI(this.host == u.host && this.protocol == u.protocol ? nh : 0); |
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:
117
diff
changeset
|
589 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
590 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
591 |
toRelPath : function(base, path) { |
778 | 592 |
var items, bp = 0, out = '', i, l; |
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:
117
diff
changeset
|
593 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
594 |
// Split the paths |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
595 |
base = base.substring(0, base.lastIndexOf('/')); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
596 |
base = base.split('/'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
597 |
items = path.split('/'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
598 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
599 |
if (base.length >= items.length) { |
778 | 600 |
for (i = 0, l = base.length; i < l; i++) { |
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:
117
diff
changeset
|
601 |
if (i >= items.length || base[i] != items[i]) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
602 |
bp = i + 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:
117
diff
changeset
|
603 |
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:
117
diff
changeset
|
604 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
605 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
606 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
607 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
608 |
if (base.length < items.length) { |
778 | 609 |
for (i = 0, l = items.length; i < l; i++) { |
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:
117
diff
changeset
|
610 |
if (i >= base.length || base[i] != items[i]) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
611 |
bp = i + 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:
117
diff
changeset
|
612 |
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:
117
diff
changeset
|
613 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
614 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
615 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
616 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
617 |
if (bp == 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:
117
diff
changeset
|
618 |
return path; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
619 |
|
778 | 620 |
for (i = 0, l = base.length - (bp - 1); i < l; i++) |
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:
117
diff
changeset
|
621 |
out += "../"; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
622 |
|
778 | 623 |
for (i = bp - 1, l = items.length; i < l; i++) { |
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:
117
diff
changeset
|
624 |
if (i != bp - 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:
117
diff
changeset
|
625 |
out += "/" + items[i]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
626 |
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:
117
diff
changeset
|
627 |
out += items[i]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
628 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
629 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
630 |
return out; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
631 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
632 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
633 |
toAbsPath : function(base, path) { |
1193 | 634 |
var i, nb = 0, o = [], tr, outPath; |
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:
117
diff
changeset
|
635 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
636 |
// Split paths |
1193 | 637 |
tr = /\/$/.test(path) ? '/' : ''; |
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:
117
diff
changeset
|
638 |
base = base.split('/'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
639 |
path = path.split('/'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
640 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
641 |
// Remove empty chunks |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
642 |
each(base, function(k) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
643 |
if (k) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
644 |
o.push(k); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
645 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
646 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
647 |
base = 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:
117
diff
changeset
|
648 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
649 |
// Merge relURLParts chunks |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
650 |
for (i = path.length - 1, o = []; i >= 0; i--) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
651 |
// Ignore empty or . |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
652 |
if (path[i].length == 0 || path[i] == ".") |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
653 |
continue; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
654 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
655 |
// Is parent |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
656 |
if (path[i] == '..') { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
657 |
nb++; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
658 |
continue; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
659 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
660 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
661 |
// Move up |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
662 |
if (nb > 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:
117
diff
changeset
|
663 |
nb--; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
664 |
continue; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
665 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
666 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
667 |
o.push(path[i]); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
668 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
669 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
670 |
i = base.length - nb; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
671 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
672 |
// If /a/b/c or / |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
673 |
if (i <= 0) |
1193 | 674 |
outPath = o.reverse().join('/'); |
675 |
else |
|
676 |
outPath = base.slice(0, i).join('/') + '/' + o.reverse().join('/'); |
|
677 |
||
678 |
// Add front / if it's needed |
|
679 |
if (outPath.indexOf('/') !== 0) |
|
680 |
outPath = '/' + outPath; |
|
681 |
||
682 |
// Add traling / if it's needed |
|
683 |
if (tr && outPath.lastIndexOf('/') !== outPath.length - 1) |
|
684 |
outPath += tr; |
|
685 |
||
686 |
return outPath; |
|
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:
117
diff
changeset
|
687 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
688 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
689 |
getURI : function(nh) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
690 |
var s, t = 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:
117
diff
changeset
|
691 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
692 |
// Rebuild source |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
693 |
if (!t.source || nh) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
694 |
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:
117
diff
changeset
|
695 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
696 |
if (!nh) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
697 |
if (t.protocol) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
698 |
s += t.protocol + '://'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
699 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
700 |
if (t.userInfo) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
701 |
s += t.userInfo + '@'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
702 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
703 |
if (t.host) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
704 |
s += t.host; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
705 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
706 |
if (t.port) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
707 |
s += ':' + t.port; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
708 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
709 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
710 |
if (t.path) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
711 |
s += t.path; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
712 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
713 |
if (t.query) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
714 |
s += '?' + t.query; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
715 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
716 |
if (t.anchor) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
717 |
s += '#' + t.anchor; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
718 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
719 |
t.source = 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:
117
diff
changeset
|
720 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
721 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
722 |
return t.source; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
723 |
} |
1193 | 724 |
}); |
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:
117
diff
changeset
|
725 |
})(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
726 |
(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:
117
diff
changeset
|
727 |
var each = tinymce.each; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
728 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
729 |
tinymce.create('static tinymce.util.Cookie', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
730 |
getHash : 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:
117
diff
changeset
|
731 |
var v = this.get(n), 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:
117
diff
changeset
|
732 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
733 |
if (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:
117
diff
changeset
|
734 |
each(v.split('&'), 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:
117
diff
changeset
|
735 |
v = v.split('='); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
736 |
h = 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:
117
diff
changeset
|
737 |
h[unescape(v[0])] = unescape(v[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:
117
diff
changeset
|
738 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
739 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
740 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
741 |
return 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:
117
diff
changeset
|
742 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
743 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
744 |
setHash : function(n, v, e, p, d, 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:
117
diff
changeset
|
745 |
var 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:
117
diff
changeset
|
746 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
747 |
each(v, function(v, k) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
748 |
o += (!o ? '' : '&') + escape(k) + '=' + escape(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:
117
diff
changeset
|
749 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
750 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
751 |
this.set(n, o, e, p, d, 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:
117
diff
changeset
|
752 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
753 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
754 |
get : function(n) { |
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
|
755 |
var c = document.cookie, e, p = n + "=", b; |
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
|
756 |
|
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
|
757 |
// Strict mode |
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
|
758 |
if (!c) |
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
|
759 |
return; |
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
|
760 |
|
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
|
761 |
b = c.indexOf("; " + p); |
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:
117
diff
changeset
|
762 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
763 |
if (b == -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:
117
diff
changeset
|
764 |
b = c.indexOf(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:
117
diff
changeset
|
765 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
766 |
if (b != 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:
117
diff
changeset
|
767 |
return 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:
117
diff
changeset
|
768 |
} 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:
117
diff
changeset
|
769 |
b += 2; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
770 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
771 |
e = c.indexOf(";", 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:
117
diff
changeset
|
772 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
773 |
if (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:
117
diff
changeset
|
774 |
e = c.length; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
775 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
776 |
return unescape(c.substring(b + p.length, 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:
117
diff
changeset
|
777 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
778 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
779 |
set : function(n, v, e, p, d, 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:
117
diff
changeset
|
780 |
document.cookie = n + "=" + escape(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:
117
diff
changeset
|
781 |
((e) ? "; expires=" + e.toGMTString() : "") + |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
782 |
((p) ? "; path=" + escape(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:
117
diff
changeset
|
783 |
((d) ? "; domain=" + d : "") + |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
784 |
((s) ? "; secure" : ""); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
785 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
786 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
787 |
remove : function(n, 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:
117
diff
changeset
|
788 |
var d = new Date(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
789 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
790 |
d.setTime(d.getTime() - 1000); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
791 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
792 |
this.set(n, '', d, p, d); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
793 |
} |
1193 | 794 |
}); |
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:
117
diff
changeset
|
795 |
})(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
796 |
tinymce.create('static tinymce.util.JSON', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
797 |
serialize : function(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:
117
diff
changeset
|
798 |
var i, v, s = tinymce.util.JSON.serialize, t; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
799 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
800 |
if (o == 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:
117
diff
changeset
|
801 |
return '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:
117
diff
changeset
|
802 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
803 |
t = typeof 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:
117
diff
changeset
|
804 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
805 |
if (t == 'string') { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
806 |
v = '\bb\tt\nn\ff\rr\""\'\'\\\\'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
807 |
|
778 | 808 |
return '"' + o.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g, function(a, b) { |
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:
117
diff
changeset
|
809 |
i = v.indexOf(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:
117
diff
changeset
|
810 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
811 |
if (i + 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:
117
diff
changeset
|
812 |
return '\\' + v.charAt(i + 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:
117
diff
changeset
|
813 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
814 |
a = b.charCodeAt().toString(16); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
815 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
816 |
return '\\u' + '0000'.substring(a.length) + 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:
117
diff
changeset
|
817 |
}) + '"'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
818 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
819 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
820 |
if (t == 'object') { |
1193 | 821 |
if (o.hasOwnProperty && o instanceof Array) { |
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:
117
diff
changeset
|
822 |
for (i=0, v = '['; i<o.length; i++) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
823 |
v += (i > 0 ? ',' : '') + s(o[i]); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
824 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
825 |
return 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:
117
diff
changeset
|
826 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
827 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
828 |
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:
117
diff
changeset
|
829 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
830 |
for (i in 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:
117
diff
changeset
|
831 |
v += typeof o[i] != 'function' ? (v.length > 1 ? ',"' : '"') + i + '":' + s(o[i]) : ''; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
832 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
833 |
return 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:
117
diff
changeset
|
834 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
835 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
836 |
return '' + 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:
117
diff
changeset
|
837 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
838 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
839 |
parse : function(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:
117
diff
changeset
|
840 |
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:
117
diff
changeset
|
841 |
return eval('(' + 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:
117
diff
changeset
|
842 |
} 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:
117
diff
changeset
|
843 |
// Ignore |
1 | 844 |
} |
845 |
} |
|
846 |
||
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:
117
diff
changeset
|
847 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
848 |
tinymce.create('static tinymce.util.XHR', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
849 |
send : function(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:
117
diff
changeset
|
850 |
var x, t, w = window, c = 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:
117
diff
changeset
|
851 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
852 |
// Default settings |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
853 |
o.scope = o.scope || 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:
117
diff
changeset
|
854 |
o.success_scope = o.success_scope || o.scope; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
855 |
o.error_scope = o.error_scope || o.scope; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
856 |
o.async = o.async === false ? false : 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:
117
diff
changeset
|
857 |
o.data = o.data || ''; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
858 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
859 |
function get(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:
117
diff
changeset
|
860 |
x = 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:
117
diff
changeset
|
861 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
862 |
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:
117
diff
changeset
|
863 |
x = new ActiveXObject(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:
117
diff
changeset
|
864 |
} 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:
117
diff
changeset
|
865 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
866 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
867 |
return 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:
117
diff
changeset
|
868 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
869 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
870 |
x = w.XMLHttpRequest ? new XMLHttpRequest() : get('Microsoft.XMLHTTP') || get('Msxml2.XMLHTTP'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
871 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
872 |
if (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:
117
diff
changeset
|
873 |
if (x.overrideMimeType) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
874 |
x.overrideMimeType(o.content_type); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
875 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
876 |
x.open(o.type || (o.data ? 'POST' : 'GET'), o.url, o.async); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
877 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
878 |
if (o.content_type) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
879 |
x.setRequestHeader('Content-Type', o.content_type); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
880 |
|
1193 | 881 |
x.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); |
882 |
||
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:
117
diff
changeset
|
883 |
x.send(o.data); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
884 |
|
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
885 |
function ready() { |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
886 |
if (!o.async || x.readyState == 4 || c++ > 10000) { |
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:
117
diff
changeset
|
887 |
if (o.success && c < 10000 && x.status == 200) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
888 |
o.success.call(o.success_scope, '' + x.responseText, x, 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:
117
diff
changeset
|
889 |
else if (o.error) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
890 |
o.error.call(o.error_scope, c > 10000 ? 'TIMED_OUT' : 'GENERAL', x, 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:
117
diff
changeset
|
891 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
892 |
x = null; |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
893 |
} else |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
894 |
w.setTimeout(ready, 10); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
895 |
}; |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
896 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
897 |
// Syncronous request |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
898 |
if (!o.async) |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
899 |
return ready(); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
900 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
901 |
// Wait for response, onReadyStateChange can not be used since it leaks memory in IE |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
902 |
t = w.setTimeout(ready, 10); |
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:
117
diff
changeset
|
903 |
} |
1193 | 904 |
} |
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:
117
diff
changeset
|
905 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
906 |
(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:
117
diff
changeset
|
907 |
var extend = tinymce.extend, JSON = tinymce.util.JSON, XHR = tinymce.util.XHR; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
908 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
909 |
tinymce.create('tinymce.util.JSONRequest', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
910 |
JSONRequest : function(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:
117
diff
changeset
|
911 |
this.settings = extend({ |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
912 |
}, 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:
117
diff
changeset
|
913 |
this.count = 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:
117
diff
changeset
|
914 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
915 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
916 |
send : function(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:
117
diff
changeset
|
917 |
var ecb = o.error, scb = o.success; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
918 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
919 |
o = extend(this.settings, 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:
117
diff
changeset
|
920 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
921 |
o.success = function(c, 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:
117
diff
changeset
|
922 |
c = JSON.parse(c); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
923 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
924 |
if (typeof(c) == 'undefined') { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
925 |
c = { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
926 |
error : 'JSON Parse error.' |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
927 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
928 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
929 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
930 |
if (c.error) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
931 |
ecb.call(o.error_scope || o.scope, c.error, 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:
117
diff
changeset
|
932 |
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:
117
diff
changeset
|
933 |
scb.call(o.success_scope || o.scope, c.result); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
934 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
935 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
936 |
o.error = function(ty, 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:
117
diff
changeset
|
937 |
ecb.call(o.error_scope || o.scope, ty, 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:
117
diff
changeset
|
938 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
939 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
940 |
o.data = JSON.serialize({ |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
941 |
id : o.id || 'c' + (this.count++), |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
942 |
method : o.method, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
943 |
params : o.params |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
944 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
945 |
|
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
946 |
// JSON content type for Ruby on rails. Bug: #1883287 |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
947 |
o.content_type = 'application/json'; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
948 |
|
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:
117
diff
changeset
|
949 |
XHR.send(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:
117
diff
changeset
|
950 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
951 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
952 |
'static' : { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
953 |
sendRPC : function(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:
117
diff
changeset
|
954 |
return new tinymce.util.JSONRequest().send(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:
117
diff
changeset
|
955 |
} |
1 | 956 |
} |
1193 | 957 |
}); |
958 |
}());(function(tinymce) { |
|
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:
117
diff
changeset
|
959 |
// Shorten names |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
960 |
var each = tinymce.each, is = tinymce.is; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
961 |
var isWebKit = tinymce.isWebKit, isIE = tinymce.isIE; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
962 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
963 |
tinymce.create('tinymce.dom.DOMUtils', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
964 |
doc : 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:
117
diff
changeset
|
965 |
root : 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:
117
diff
changeset
|
966 |
files : 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:
117
diff
changeset
|
967 |
pixelStyles : /^(top|left|bottom|right|width|height|borderWidth)$/, |
778 | 968 |
props : { |
969 |
"for" : "htmlFor", |
|
970 |
"class" : "className", |
|
971 |
className : "className", |
|
972 |
checked : "checked", |
|
973 |
disabled : "disabled", |
|
974 |
maxlength : "maxLength", |
|
975 |
readonly : "readOnly", |
|
976 |
selected : "selected", |
|
977 |
value : "value", |
|
978 |
id : "id", |
|
979 |
name : "name", |
|
980 |
type : "type" |
|
981 |
}, |
|
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:
117
diff
changeset
|
982 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
983 |
DOMUtils : function(d, 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:
117
diff
changeset
|
984 |
var t = 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:
117
diff
changeset
|
985 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
986 |
t.doc = d; |
543 | 987 |
t.win = window; |
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:
117
diff
changeset
|
988 |
t.files = {}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
989 |
t.cssFlicker = 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:
117
diff
changeset
|
990 |
t.counter = 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:
117
diff
changeset
|
991 |
t.boxModel = !tinymce.isIE || d.compatMode == "CSS1Compat"; |
543 | 992 |
t.stdMode = d.documentMode === 8; |
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:
117
diff
changeset
|
993 |
|
1193 | 994 |
t.settings = s = tinymce.extend({ |
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:
117
diff
changeset
|
995 |
keep_values : false, |
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
|
996 |
hex_colors : 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
|
997 |
process_html : 1 |
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:
117
diff
changeset
|
998 |
}, 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:
117
diff
changeset
|
999 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1000 |
// Fix IE6SP2 flicker and check it failed for pre SP2 |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1001 |
if (tinymce.isIE6) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1002 |
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:
117
diff
changeset
|
1003 |
d.execCommand('BackgroundImageCache', false, 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:
117
diff
changeset
|
1004 |
} catch (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:
117
diff
changeset
|
1005 |
t.cssFlicker = 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:
117
diff
changeset
|
1006 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1007 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1008 |
|
543 | 1009 |
tinymce.addUnload(t.destroy, t); |
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:
117
diff
changeset
|
1010 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1011 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1012 |
getRoot : 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:
117
diff
changeset
|
1013 |
var t = this, s = t.settings; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1014 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1015 |
return (s && t.get(s.root_element)) || t.doc.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:
117
diff
changeset
|
1016 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1017 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1018 |
getViewPort : function(w) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1019 |
var d, 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:
117
diff
changeset
|
1020 |
|
543 | 1021 |
w = !w ? this.win : w; |
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:
117
diff
changeset
|
1022 |
d = w.document; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1023 |
b = this.boxModel ? d.documentElement : d.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:
117
diff
changeset
|
1024 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1025 |
// Returns viewport size excluding scrollbars |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1026 |
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:
117
diff
changeset
|
1027 |
x : w.pageXOffset || b.scrollLeft, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1028 |
y : w.pageYOffset || b.scrollTop, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1029 |
w : w.innerWidth || b.clientWidth, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1030 |
h : w.innerHeight || b.clientHeight |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1031 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1032 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1033 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1034 |
getRect : function(e) { |
778 | 1035 |
var p, t = this, sr; |
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:
117
diff
changeset
|
1036 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1037 |
e = t.get(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:
117
diff
changeset
|
1038 |
p = t.getPos(e); |
778 | 1039 |
sr = t.getSize(e); |
1040 |
||
1041 |
return { |
|
1042 |
x : p.x, |
|
1043 |
y : p.y, |
|
1044 |
w : sr.w, |
|
1045 |
h : sr.h |
|
1046 |
}; |
|
1047 |
}, |
|
1048 |
||
1049 |
getSize : function(e) { |
|
1050 |
var t = this, w, h; |
|
1051 |
||
1052 |
e = t.get(e); |
|
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
|
1053 |
w = t.getStyle(e, 'width'); |
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
|
1054 |
h = t.getStyle(e, 'height'); |
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
|
1055 |
|
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
|
1056 |
// Non pixel value, then force offset/clientWidth |
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
|
1057 |
if (w.indexOf('px') === -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
|
1058 |
w = 0; |
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
|
1059 |
|
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
|
1060 |
// Non pixel value, then force offset/clientWidth |
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
|
1061 |
if (h.indexOf('px') === -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
|
1062 |
h = 0; |
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:
117
diff
changeset
|
1063 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1064 |
return { |
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
|
1065 |
w : parseInt(w) || e.offsetWidth || e.clientWidth, |
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
|
1066 |
h : parseInt(h) || e.offsetHeight || e.clientHeight |
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:
117
diff
changeset
|
1067 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1068 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1069 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1070 |
getParent : function(n, f, r) { |
1193 | 1071 |
return this.getParents(n, f, r, false); |
1072 |
}, |
|
1073 |
||
1074 |
getParents : function(n, f, r, c) { |
|
1075 |
var t = this, na, se = t.settings, o = []; |
|
1076 |
||
1077 |
n = t.get(n); |
|
1078 |
c = c === undefined; |
|
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:
117
diff
changeset
|
1079 |
|
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
|
1080 |
if (se.strict_root) |
1193 | 1081 |
r = r || t.getRoot(); |
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:
117
diff
changeset
|
1082 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1083 |
// Wrap node name as func |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1084 |
if (is(f, 'string')) { |
1193 | 1085 |
na = f; |
1086 |
||
1087 |
if (f === '*') { |
|
1088 |
f = function(n) {return n.nodeType == 1;}; |
|
1089 |
} else { |
|
1090 |
f = function(n) { |
|
1091 |
return t.is(n, na); |
|
1092 |
}; |
|
1093 |
} |
|
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:
117
diff
changeset
|
1094 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1095 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1096 |
while (n) { |
1193 | 1097 |
if (n == r || !n.nodeType || n.nodeType === 9) |
1098 |
break; |
|
1099 |
||
1100 |
if (!f || f(n)) { |
|
1101 |
if (c) |
|
1102 |
o.push(n); |
|
1103 |
else |
|
1104 |
return n; |
|
1105 |
} |
|
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:
117
diff
changeset
|
1106 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1107 |
n = n.parentNode; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1108 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1109 |
|
1193 | 1110 |
return c ? o : null; |
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:
117
diff
changeset
|
1111 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1112 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1113 |
get : function(e) { |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
1114 |
var n; |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
1115 |
|
543 | 1116 |
if (e && this.doc && typeof(e) == 'string') { |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
1117 |
n = e; |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
1118 |
e = this.doc.getElementById(e); |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
1119 |
|
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
1120 |
// IE and Opera returns meta elements when they match the specified input ID, but getElementsByName seems to do the trick |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
1121 |
if (e && e.id !== n) |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
1122 |
return this.doc.getElementsByName(n)[1]; |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
1123 |
} |
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:
117
diff
changeset
|
1124 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1125 |
return 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:
117
diff
changeset
|
1126 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1127 |
|
1193 | 1128 |
getNext : function(node, selector) { |
1129 |
return this._findSib(node, selector, 'nextSibling'); |
|
1130 |
}, |
|
1131 |
||
1132 |
getPrev : function(node, selector) { |
|
1133 |
return this._findSib(node, selector, 'previousSibling'); |
|
1134 |
}, |
|
1135 |
||
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:
117
diff
changeset
|
1136 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1137 |
select : function(pa, s) { |
1193 | 1138 |
var t = this; |
1139 |
||
1140 |
return tinymce.dom.Sizzle(pa, t.get(s) || t.get(t.settings.root_element) || t.doc, []); |
|
1141 |
}, |
|
1142 |
||
1143 |
is : function(n, patt) { |
|
1144 |
return tinymce.dom.Sizzle.matches(patt, n.nodeType ? [n] : n).length > 0; |
|
1145 |
}, |
|
1146 |
||
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:
117
diff
changeset
|
1147 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1148 |
add : function(p, n, a, h, c) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1149 |
var t = 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:
117
diff
changeset
|
1150 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1151 |
return this.run(p, function(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:
117
diff
changeset
|
1152 |
var e, k; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1153 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1154 |
e = is(n, 'string') ? t.doc.createElement(n) : n; |
778 | 1155 |
t.setAttribs(e, a); |
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:
117
diff
changeset
|
1156 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1157 |
if (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:
117
diff
changeset
|
1158 |
if (h.nodeType) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1159 |
e.appendChild(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:
117
diff
changeset
|
1160 |
else |
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
|
1161 |
t.setHTML(e, h); |
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:
117
diff
changeset
|
1162 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1163 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1164 |
return !c ? p.appendChild(e) : 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:
117
diff
changeset
|
1165 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1166 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1167 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1168 |
create : function(n, a, 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:
117
diff
changeset
|
1169 |
return this.add(this.doc.createElement(n), n, a, h, 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:
117
diff
changeset
|
1170 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1171 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1172 |
createHTML : function(n, a, 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:
117
diff
changeset
|
1173 |
var o = '', t = this, k; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1174 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1175 |
o += '<' + 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:
117
diff
changeset
|
1176 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1177 |
for (k in 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:
117
diff
changeset
|
1178 |
if (a.hasOwnProperty(k)) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1179 |
o += ' ' + k + '="' + t.encode(a[k]) + '"'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1180 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1181 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1182 |
if (tinymce.is(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:
117
diff
changeset
|
1183 |
return o + '>' + h + '</' + 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:
117
diff
changeset
|
1184 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1185 |
return 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:
117
diff
changeset
|
1186 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1187 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1188 |
remove : function(n, k) { |
1193 | 1189 |
var t = this; |
1190 |
||
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:
117
diff
changeset
|
1191 |
return this.run(n, function(n) { |
1193 | 1192 |
var p, g, i; |
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:
117
diff
changeset
|
1193 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1194 |
p = n.parentNode; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1195 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1196 |
if (!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:
117
diff
changeset
|
1197 |
return 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:
117
diff
changeset
|
1198 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1199 |
if (k) { |
1193 | 1200 |
for (i = n.childNodes.length - 1; i >= 0; i--) |
1201 |
t.insertAfter(n.childNodes[i], n); |
|
1202 |
||
1203 |
//each(n.childNodes, function(c) { |
|
1204 |
// p.insertBefore(c.cloneNode(true), n); |
|
1205 |
//}); |
|
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:
117
diff
changeset
|
1206 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1207 |
|
543 | 1208 |
// Fix IE psuedo leak |
1193 | 1209 |
if (t.fixPsuedoLeaks) { |
543 | 1210 |
p = n.cloneNode(true); |
1193 | 1211 |
k = 'IELeakGarbageBin'; |
1212 |
g = t.get(k) || t.add(t.doc.body, 'div', {id : k, style : 'display:none'}); |
|
1213 |
g.appendChild(n); |
|
1214 |
g.innerHTML = ''; |
|
543 | 1215 |
|
1216 |
return p; |
|
1193 | 1217 |
} |
543 | 1218 |
|
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:
117
diff
changeset
|
1219 |
return p.removeChild(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:
117
diff
changeset
|
1220 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1221 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1222 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1223 |
setStyle : function(n, na, v) { |
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
|
1224 |
var t = this; |
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
|
1225 |
|
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
|
1226 |
return t.run(n, function(e) { |
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:
117
diff
changeset
|
1227 |
var s, i; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1228 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1229 |
s = 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:
117
diff
changeset
|
1230 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1231 |
// Camelcase it, if needed |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1232 |
na = na.replace(/-(\D)/g, function(a, 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:
117
diff
changeset
|
1233 |
return b.toUpperCase(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1234 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1235 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1236 |
// Default px suffix on these |
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
|
1237 |
if (t.pixelStyles.test(na) && (tinymce.is(v, 'number') || /^[\-0-9\.]+$/.test(v))) |
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:
117
diff
changeset
|
1238 |
v += 'px'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1239 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1240 |
switch (na) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1241 |
case 'opacity': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1242 |
// IE specific opacity |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1243 |
if (isIE) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1244 |
s.filter = v === '' ? '' : "alpha(opacity=" + (v * 100) + ")"; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1245 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1246 |
if (!n.currentStyle || !n.currentStyle.hasLayout) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1247 |
s.display = 'inline-block'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1248 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1249 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1250 |
// Fix for older browsers |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1251 |
s[na] = s['-moz-opacity'] = s['-khtml-opacity'] = v || ''; |
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:
117
diff
changeset
|
1252 |
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:
117
diff
changeset
|
1253 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1254 |
case 'float': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1255 |
isIE ? s.styleFloat = v : s.cssFloat = 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:
117
diff
changeset
|
1256 |
break; |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1257 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1258 |
default: |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1259 |
s[na] = v || ''; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1260 |
} |
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
|
1261 |
|
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
|
1262 |
// Force update of the style data |
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
|
1263 |
if (t.settings.update_styles) |
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
|
1264 |
t.setAttrib(e, 'mce_style'); |
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:
117
diff
changeset
|
1265 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1266 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1267 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1268 |
getStyle : function(n, na, c) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1269 |
n = this.get(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:
117
diff
changeset
|
1270 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1271 |
if (!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:
117
diff
changeset
|
1272 |
return 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:
117
diff
changeset
|
1273 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1274 |
// Gecko |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1275 |
if (this.doc.defaultView && c) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1276 |
// Remove camelcase |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1277 |
na = na.replace(/[A-Z]/g, function(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:
117
diff
changeset
|
1278 |
return '-' + 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:
117
diff
changeset
|
1279 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1280 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1281 |
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:
117
diff
changeset
|
1282 |
return this.doc.defaultView.getComputedStyle(n, null).getPropertyValue(na); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1283 |
} 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:
117
diff
changeset
|
1284 |
// Old safari might fail |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1285 |
return 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:
117
diff
changeset
|
1286 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1287 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1288 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1289 |
// Camelcase it, if needed |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1290 |
na = na.replace(/-(\D)/g, function(a, 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:
117
diff
changeset
|
1291 |
return b.toUpperCase(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1292 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1293 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1294 |
if (na == 'float') |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1295 |
na = isIE ? 'styleFloat' : 'cssFloat'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1296 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1297 |
// IE & Opera |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1298 |
if (n.currentStyle && c) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1299 |
return n.currentStyle[na]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1300 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1301 |
return n.style[na]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1302 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1303 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1304 |
setStyles : function(e, o) { |
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
|
1305 |
var t = this, s = t.settings, ol; |
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
|
1306 |
|
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
|
1307 |
ol = s.update_styles; |
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
|
1308 |
s.update_styles = 0; |
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:
117
diff
changeset
|
1309 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1310 |
each(o, function(v, 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:
117
diff
changeset
|
1311 |
t.setStyle(e, n, 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:
117
diff
changeset
|
1312 |
}); |
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
|
1313 |
|
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
|
1314 |
// Update style info |
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
|
1315 |
s.update_styles = ol; |
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
|
1316 |
if (s.update_styles) |
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
|
1317 |
t.setAttrib(e, s.cssText); |
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:
117
diff
changeset
|
1318 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1319 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1320 |
setAttrib : function(e, n, 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:
117
diff
changeset
|
1321 |
var t = 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:
117
diff
changeset
|
1322 |
|
778 | 1323 |
// Whats the point |
1324 |
if (!e || !n) |
|
1325 |
return; |
|
1326 |
||
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
|
1327 |
// Strict XML mode |
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
|
1328 |
if (t.settings.strict) |
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
|
1329 |
n = n.toLowerCase(); |
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
|
1330 |
|
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:
117
diff
changeset
|
1331 |
return this.run(e, 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:
117
diff
changeset
|
1332 |
var s = t.settings; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1333 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1334 |
switch (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:
117
diff
changeset
|
1335 |
case "style": |
778 | 1336 |
if (!is(v, 'string')) { |
1337 |
each(v, function(v, n) { |
|
1338 |
t.setStyle(e, n, v); |
|
1339 |
}); |
|
1340 |
||
1341 |
return; |
|
1342 |
} |
|
1343 |
||
543 | 1344 |
// No mce_style for elements with these since they might get resized by the user |
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:
117
diff
changeset
|
1345 |
if (s.keep_values) { |
543 | 1346 |
if (v && !t._isRes(v)) |
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:
117
diff
changeset
|
1347 |
e.setAttribute('mce_style', v, 2); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1348 |
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:
117
diff
changeset
|
1349 |
e.removeAttribute('mce_style', 2); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1350 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1351 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1352 |
e.style.cssText = 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:
117
diff
changeset
|
1353 |
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:
117
diff
changeset
|
1354 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1355 |
case "class": |
543 | 1356 |
e.className = v || ''; // Fix IE null bug |
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:
117
diff
changeset
|
1357 |
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:
117
diff
changeset
|
1358 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1359 |
case "src": |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1360 |
case "href": |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1361 |
if (s.keep_values) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1362 |
if (s.url_converter) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1363 |
v = s.url_converter.call(s.url_converter_scope || t, v, n, 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:
117
diff
changeset
|
1364 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1365 |
t.setAttrib(e, 'mce_' + n, v, 2); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1366 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1367 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1368 |
break; |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1369 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1370 |
case "shape": |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1371 |
e.setAttribute('mce_style', v); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1372 |
break; |
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:
117
diff
changeset
|
1373 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1374 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1375 |
if (is(v) && v !== null && v.length !== 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:
117
diff
changeset
|
1376 |
e.setAttribute(n, '' + v, 2); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1377 |
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:
117
diff
changeset
|
1378 |
e.removeAttribute(n, 2); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1379 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1380 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1381 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1382 |
setAttribs : function(e, 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:
117
diff
changeset
|
1383 |
var t = 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:
117
diff
changeset
|
1384 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1385 |
return this.run(e, 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:
117
diff
changeset
|
1386 |
each(o, function(v, 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:
117
diff
changeset
|
1387 |
t.setAttrib(e, n, 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:
117
diff
changeset
|
1388 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1389 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1390 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1391 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1392 |
getAttrib : function(e, n, dv) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1393 |
var v, t = 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:
117
diff
changeset
|
1394 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1395 |
e = t.get(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:
117
diff
changeset
|
1396 |
|
543 | 1397 |
if (!e || e.nodeType !== 1) |
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:
117
diff
changeset
|
1398 |
return 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:
117
diff
changeset
|
1399 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1400 |
if (!is(dv)) |
778 | 1401 |
dv = ''; |
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:
117
diff
changeset
|
1402 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1403 |
// Try the mce variant for these |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1404 |
if (/^(src|href|style|coords|shape)$/.test(n)) { |
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
|
1405 |
v = e.getAttribute("mce_" + n); |
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:
117
diff
changeset
|
1406 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1407 |
if (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:
117
diff
changeset
|
1408 |
return 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:
117
diff
changeset
|
1409 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1410 |
|
778 | 1411 |
if (isIE && t.props[n]) { |
1412 |
v = e[t.props[n]]; |
|
1413 |
v = v && v.nodeValue ? v.nodeValue : v; |
|
1414 |
} |
|
1415 |
||
1416 |
if (!v) |
|
1417 |
v = e.getAttribute(n, 2); |
|
1418 |
||
1193 | 1419 |
// Check boolean attribs |
1420 |
if (/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(n)) { |
|
1421 |
if (e[t.props[n]] === true && v === '') |
|
1422 |
return n; |
|
1423 |
||
1424 |
return v ? n : ''; |
|
1425 |
} |
|
1426 |
||
1427 |
// Inner input elements will override attributes on form elements |
|
1428 |
if (e.nodeName === "FORM" && e.getAttributeNode(n)) |
|
1429 |
return e.getAttributeNode(n).nodeValue; |
|
1430 |
||
778 | 1431 |
if (n === 'style') { |
1432 |
v = v || e.style.cssText; |
|
1433 |
||
1434 |
if (v) { |
|
1435 |
v = t.serializeStyle(t.parseStyle(v)); |
|
1436 |
||
1437 |
if (t.settings.keep_values && !t._isRes(v)) |
|
1438 |
e.setAttribute('mce_style', v); |
|
1439 |
} |
|
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:
117
diff
changeset
|
1440 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1441 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1442 |
// Remove Apple and WebKit stuff |
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
|
1443 |
if (isWebKit && n === "class" && v) |
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:
117
diff
changeset
|
1444 |
v = v.replace(/(apple|webkit)\-[a-z\-]+/gi, ''); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1445 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1446 |
// Handle IE issues |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1447 |
if (isIE) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1448 |
switch (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:
117
diff
changeset
|
1449 |
case 'rowspan': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1450 |
case 'colspan': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1451 |
// IE returns 1 as default value |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1452 |
if (v === 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:
117
diff
changeset
|
1453 |
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:
117
diff
changeset
|
1454 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1455 |
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:
117
diff
changeset
|
1456 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1457 |
case 'size': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1458 |
// IE returns +0 as default value for size |
1193 | 1459 |
if (v === '+0' || v === 20 || v === 0) |
778 | 1460 |
v = ''; |
1461 |
||
1462 |
break; |
|
1463 |
||
1464 |
case 'width': |
|
1465 |
case 'height': |
|
1466 |
case 'vspace': |
|
1467 |
case 'checked': |
|
1468 |
case 'disabled': |
|
1469 |
case 'readonly': |
|
1470 |
if (v === 0) |
|
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:
117
diff
changeset
|
1471 |
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:
117
diff
changeset
|
1472 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1473 |
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:
117
diff
changeset
|
1474 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1475 |
case 'hspace': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1476 |
// IE returns -1 as default value |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1477 |
if (v === -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:
117
diff
changeset
|
1478 |
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:
117
diff
changeset
|
1479 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1480 |
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:
117
diff
changeset
|
1481 |
|
778 | 1482 |
case 'maxlength': |
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:
117
diff
changeset
|
1483 |
case 'tabindex': |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1484 |
// IE returns default value |
778 | 1485 |
if (v === 32768 || v === 2147483647 || v === '32768') |
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:
117
diff
changeset
|
1486 |
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:
117
diff
changeset
|
1487 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1488 |
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:
117
diff
changeset
|
1489 |
|
1193 | 1490 |
case 'multiple': |
778 | 1491 |
case 'compact': |
1492 |
case 'noshade': |
|
1493 |
case 'nowrap': |
|
1494 |
if (v === 65535) |
|
1495 |
return n; |
|
1496 |
||
1497 |
return dv; |
|
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1498 |
|
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
|
1499 |
case 'shape': |
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
|
1500 |
v = v.toLowerCase(); |
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
|
1501 |
break; |
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
|
1502 |
|
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:
117
diff
changeset
|
1503 |
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:
117
diff
changeset
|
1504 |
// IE has odd anonymous function for event attributes |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1505 |
if (n.indexOf('on') === 0 && v) |
1193 | 1506 |
v = ('' + v).replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/, '$1'); |
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:
117
diff
changeset
|
1507 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1508 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1509 |
|
778 | 1510 |
return (v !== undefined && v !== null && v !== '') ? '' + v : dv; |
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:
117
diff
changeset
|
1511 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1512 |
|
1193 | 1513 |
getPos : function(n, ro) { |
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
|
1514 |
var t = this, x = 0, y = 0, e, d = t.doc, r; |
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:
117
diff
changeset
|
1515 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1516 |
n = t.get(n); |
1193 | 1517 |
ro = ro || d.body; |
1518 |
||
1519 |
if (n) { |
|
1520 |
// Use getBoundingClientRect on IE, Opera has it but it's not perfect |
|
1521 |
if (isIE && !t.stdMode) { |
|
1522 |
n = n.getBoundingClientRect(); |
|
1523 |
e = t.boxModel ? d.documentElement : d.body; |
|
1524 |
x = t.getStyle(t.select('html')[0], 'borderWidth'); // Remove border |
|
1525 |
x = (x == 'medium' || t.boxModel && !t.isIE6) && 2 || x; |
|
1526 |
n.top += t.win.self != t.win.top ? 2 : 0; // IE adds some strange extra cord if used in a frameset |
|
1527 |
||
1528 |
return {x : n.left + e.scrollLeft - x, y : n.top + e.scrollTop - x}; |
|
1529 |
} |
|
1530 |
||
1531 |
r = n; |
|
1532 |
while (r && r != ro && r.nodeType) { |
|
1533 |
x += r.offsetLeft || 0; |
|
1534 |
y += r.offsetTop || 0; |
|
1535 |
r = r.offsetParent; |
|
1536 |
} |
|
1537 |
||
1538 |
r = n.parentNode; |
|
1539 |
while (r && r != ro && r.nodeType) { |
|
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1540 |
x -= r.scrollLeft || 0; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1541 |
y -= r.scrollTop || 0; |
1193 | 1542 |
r = r.parentNode; |
1543 |
} |
|
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:
117
diff
changeset
|
1544 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1545 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1546 |
return {x : x, y : y}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1547 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1548 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1549 |
parseStyle : function(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:
117
diff
changeset
|
1550 |
var t = this, s = t.settings, 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:
117
diff
changeset
|
1551 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1552 |
if (!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:
117
diff
changeset
|
1553 |
return 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:
117
diff
changeset
|
1554 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1555 |
function compress(p, s, ot) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1556 |
var t, r, b, l; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1557 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1558 |
// Get values and check it it needs compressing |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1559 |
t = o[p + '-top' + 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:
117
diff
changeset
|
1560 |
if (!t) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1561 |
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:
117
diff
changeset
|
1562 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1563 |
r = o[p + '-right' + 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:
117
diff
changeset
|
1564 |
if (t != 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:
117
diff
changeset
|
1565 |
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:
117
diff
changeset
|
1566 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1567 |
b = o[p + '-bottom' + 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:
117
diff
changeset
|
1568 |
if (r != 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:
117
diff
changeset
|
1569 |
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:
117
diff
changeset
|
1570 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1571 |
l = o[p + '-left' + 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:
117
diff
changeset
|
1572 |
if (b != l) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1573 |
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:
117
diff
changeset
|
1574 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1575 |
// Compress |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1576 |
o[ot] = l; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1577 |
delete o[p + '-top' + 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:
117
diff
changeset
|
1578 |
delete o[p + '-right' + 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:
117
diff
changeset
|
1579 |
delete o[p + '-bottom' + 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:
117
diff
changeset
|
1580 |
delete o[p + '-left' + 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:
117
diff
changeset
|
1581 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1582 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1583 |
function compress2(ta, a, b, c) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1584 |
var t; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1585 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1586 |
t = o[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:
117
diff
changeset
|
1587 |
if (!t) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1588 |
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:
117
diff
changeset
|
1589 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1590 |
t = o[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:
117
diff
changeset
|
1591 |
if (!t) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1592 |
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:
117
diff
changeset
|
1593 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1594 |
t = o[c]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1595 |
if (!t) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1596 |
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:
117
diff
changeset
|
1597 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1598 |
// Compress |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1599 |
o[ta] = o[a] + ' ' + o[b] + ' ' + o[c]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1600 |
delete o[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:
117
diff
changeset
|
1601 |
delete o[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:
117
diff
changeset
|
1602 |
delete o[c]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1603 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1604 |
|
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1605 |
st = st.replace(/&(#?[a-z0-9]+);/g, '&$1_MCE_SEMI_'); // Protect entities |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1606 |
|
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:
117
diff
changeset
|
1607 |
each(st.split(';'), 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:
117
diff
changeset
|
1608 |
var sv, ur = []; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1609 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1610 |
if (v) { |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1611 |
v = v.replace(/_MCE_SEMI_/g, ';'); // Restore entities |
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:
117
diff
changeset
|
1612 |
v = v.replace(/url\([^\)]+\)/g, function(v) {ur.push(v);return 'url(' + ur.length + ')';}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1613 |
v = v.split(':'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1614 |
sv = tinymce.trim(v[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:
117
diff
changeset
|
1615 |
sv = sv.replace(/url\(([^\)]+)\)/g, function(a, b) {return ur[parseInt(b) - 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:
117
diff
changeset
|
1616 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1617 |
sv = sv.replace(/rgb\([^\)]+\)/g, 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:
117
diff
changeset
|
1618 |
return t.toHex(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:
117
diff
changeset
|
1619 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1620 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1621 |
if (s.url_converter) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1622 |
sv = sv.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g, function(x, c) { |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1623 |
return 'url(' + s.url_converter.call(s.url_converter_scope || t, t.decode(c), 'style', null) + ')'; |
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:
117
diff
changeset
|
1624 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1625 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1626 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1627 |
o[tinymce.trim(v[0]).toLowerCase()] = sv; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1628 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1629 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1630 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1631 |
compress("border", "", "border"); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1632 |
compress("border", "-width", "border-width"); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1633 |
compress("border", "-color", "border-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:
117
diff
changeset
|
1634 |
compress("border", "-style", "border-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:
117
diff
changeset
|
1635 |
compress("padding", "", "padding"); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1636 |
compress("margin", "", "margin"); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1637 |
compress2('border', 'border-width', 'border-style', 'border-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:
117
diff
changeset
|
1638 |
|
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
|
1639 |
if (isIE) { |
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
|
1640 |
// Remove pointless border |
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
|
1641 |
if (o.border == 'medium none') |
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
|
1642 |
o.border = ''; |
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
|
1643 |
} |
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
|
1644 |
|
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:
117
diff
changeset
|
1645 |
return 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:
117
diff
changeset
|
1646 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1647 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1648 |
serializeStyle : function(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:
117
diff
changeset
|
1649 |
var 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:
117
diff
changeset
|
1650 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1651 |
each(o, function(v, k) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1652 |
if (k && v) { |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1653 |
if (tinymce.isGecko && k.indexOf('-moz-') === 0) |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1654 |
return; |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1655 |
|
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:
117
diff
changeset
|
1656 |
switch (k) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1657 |
case '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:
117
diff
changeset
|
1658 |
case 'background-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:
117
diff
changeset
|
1659 |
v = v.toLowerCase(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1660 |
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:
117
diff
changeset
|
1661 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1662 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1663 |
s += (s ? ' ' : '') + k + ': ' + 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:
117
diff
changeset
|
1664 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1665 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1666 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1667 |
return 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:
117
diff
changeset
|
1668 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1669 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1670 |
loadCSS : function(u) { |
1193 | 1671 |
var t = this, d = t.doc, head; |
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:
117
diff
changeset
|
1672 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1673 |
if (!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:
117
diff
changeset
|
1674 |
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:
117
diff
changeset
|
1675 |
|
1193 | 1676 |
head = t.select('head')[0]; |
1677 |
||
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:
117
diff
changeset
|
1678 |
each(u.split(','), function(u) { |
1193 | 1679 |
var link; |
1680 |
||
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:
117
diff
changeset
|
1681 |
if (t.files[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:
117
diff
changeset
|
1682 |
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:
117
diff
changeset
|
1683 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1684 |
t.files[u] = true; |
1193 | 1685 |
link = t.create('link', {rel : 'stylesheet', href : tinymce._addVer(u)}); |
1686 |
||
1687 |
// IE 8 has a bug where dynamically loading stylesheets would produce a 1 item remaining bug |
|
1688 |
// This fix seems to resolve that issue by realcing the document ones a stylesheet finishes loading |
|
1689 |
// It's ugly but it seems to work fine. |
|
1690 |
if (isIE && d.documentMode) { |
|
1691 |
link.onload = function() { |
|
1692 |
d.recalc(); |
|
1693 |
link.onload = null; |
|
1694 |
}; |
|
1695 |
} |
|
1696 |
||
1697 |
head.appendChild(link); |
|
1698 |
}); |
|
1699 |
}, |
|
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:
117
diff
changeset
|
1700 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1701 |
addClass : function(e, c) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1702 |
return this.run(e, 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:
117
diff
changeset
|
1703 |
var 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:
117
diff
changeset
|
1704 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1705 |
if (!c) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1706 |
return 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:
117
diff
changeset
|
1707 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1708 |
if (this.hasClass(e, c)) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1709 |
return e.className; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1710 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1711 |
o = this.removeClass(e, c); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1712 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1713 |
return e.className = (o != '' ? (o + ' ') : '') + c; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1714 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1715 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1716 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1717 |
removeClass : function(e, c) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1718 |
var t = this, re; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1719 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1720 |
return t.run(e, 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:
117
diff
changeset
|
1721 |
var 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:
117
diff
changeset
|
1722 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1723 |
if (t.hasClass(e, c)) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1724 |
if (!re) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1725 |
re = new RegExp("(^|\\s+)" + c + "(\\s+|$)", "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:
117
diff
changeset
|
1726 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1727 |
v = e.className.replace(re, ' '); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1728 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1729 |
return e.className = tinymce.trim(v != ' ' ? 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:
117
diff
changeset
|
1730 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1731 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1732 |
return e.className; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1733 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1734 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1735 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1736 |
hasClass : function(n, c) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1737 |
n = this.get(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:
117
diff
changeset
|
1738 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1739 |
if (!n || !c) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1740 |
return 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:
117
diff
changeset
|
1741 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1742 |
return (' ' + n.className + ' ').indexOf(' ' + c + ' ') !== -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:
117
diff
changeset
|
1743 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1744 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1745 |
show : 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:
117
diff
changeset
|
1746 |
return this.setStyle(e, 'display', 'block'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1747 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1748 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1749 |
hide : 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:
117
diff
changeset
|
1750 |
return this.setStyle(e, 'display', 'none'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1751 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1752 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1753 |
isHidden : 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:
117
diff
changeset
|
1754 |
e = this.get(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:
117
diff
changeset
|
1755 |
|
778 | 1756 |
return !e || e.style.display == 'none' || this.getStyle(e, 'display') == 'none'; |
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:
117
diff
changeset
|
1757 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1758 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1759 |
uniqueId : function(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:
117
diff
changeset
|
1760 |
return (!p ? 'mce_' : p) + (this.counter++); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1761 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1762 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1763 |
setHTML : function(e, 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:
117
diff
changeset
|
1764 |
var t = 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:
117
diff
changeset
|
1765 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1766 |
return this.run(e, function(e) { |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1767 |
var x, i, nl, n, p, x; |
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
|
1768 |
|
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:
117
diff
changeset
|
1769 |
h = t.processHTML(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:
117
diff
changeset
|
1770 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1771 |
if (isIE) { |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1772 |
function set() { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1773 |
try { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1774 |
// IE will remove comments from the beginning |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1775 |
// unless you padd the contents with something |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1776 |
e.innerHTML = '<br />' + h; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1777 |
e.removeChild(e.firstChild); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1778 |
} catch (ex) { |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
1779 |
// IE sometimes produces an unknown runtime error on innerHTML if it's an block element within a block element for example a div inside a p |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
1780 |
// This seems to fix this problem |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
1781 |
|
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
1782 |
// Remove all child nodes |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
1783 |
while (e.firstChild) |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
1784 |
e.firstChild.removeNode(); |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
1785 |
|
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
1786 |
// Create new div with HTML contents and a BR infront to keep comments |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1787 |
x = t.create('div'); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1788 |
x.innerHTML = '<br />' + h; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1789 |
|
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
1790 |
// Add all children from div to target |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1791 |
each (x.childNodes, function(n, i) { |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
1792 |
// Skip br element |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
1793 |
if (i) |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1794 |
e.appendChild(n); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1795 |
}); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1796 |
} |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1797 |
}; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1798 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1799 |
// IE has a serious bug when it comes to paragraphs it can produce an invalid |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1800 |
// DOM tree if contents like this <p><ul><li>Item 1</li></ul></p> is inserted |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1801 |
// It seems to be that IE doesn't like a root block element placed inside another root block element |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1802 |
if (t.settings.fix_ie_paragraphs) |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1803 |
h = h.replace(/<p><\/p>|<p([^>]+)><\/p>|<p[^\/+]\/>/gi, '<p$1 mce_keep="true"> </p>'); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1804 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1805 |
set(); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1806 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1807 |
if (t.settings.fix_ie_paragraphs) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1808 |
// Check for odd paragraphs this is a sign of a broken DOM |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1809 |
nl = e.getElementsByTagName("p"); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1810 |
for (i = nl.length - 1, x = 0; i >= 0; i--) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1811 |
n = nl[i]; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1812 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1813 |
if (!n.hasChildNodes()) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1814 |
if (!n.mce_keep) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1815 |
x = 1; // Is broken |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1816 |
break; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1817 |
} |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1818 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1819 |
n.removeAttribute('mce_keep'); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1820 |
} |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1821 |
} |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1822 |
} |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1823 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1824 |
// Time to fix the madness IE left us |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1825 |
if (x) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1826 |
// So if we replace the p elements with divs and mark them and then replace them back to paragraphs |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1827 |
// after we use innerHTML we can fix the DOM tree |
1193 | 1828 |
h = h.replace(/<p ([^>]+)>|<p>/ig, '<div $1 mce_tmp="1">'); |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1829 |
h = h.replace(/<\/p>/g, '</div>'); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1830 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1831 |
// Set the new HTML with DIVs |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1832 |
set(); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1833 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1834 |
// Replace all DIV elements with he mce_tmp attibute back to paragraphs |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1835 |
// This is needed since IE has a annoying bug see above for details |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1836 |
// This is a slow process but it has to be done. :( |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1837 |
if (t.settings.fix_ie_paragraphs) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1838 |
nl = e.getElementsByTagName("DIV"); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1839 |
for (i = nl.length - 1; i >= 0; i--) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1840 |
n = nl[i]; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1841 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1842 |
// Is it a temp div |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1843 |
if (n.mce_tmp) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1844 |
// Create new paragraph |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1845 |
p = t.doc.createElement('p'); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1846 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1847 |
// Copy all attributes |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1848 |
n.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi, function(a, b) { |
543 | 1849 |
var v; |
1850 |
||
1851 |
if (b !== 'mce_tmp') { |
|
1852 |
v = n.getAttribute(b); |
|
1853 |
||
1854 |
if (!v && b === 'class') |
|
1855 |
v = n.className; |
|
1856 |
||
1857 |
p.setAttribute(b, v); |
|
1858 |
} |
|
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1859 |
}); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1860 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1861 |
// Append all children to new paragraph |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1862 |
for (x = 0; x<n.childNodes.length; x++) |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1863 |
p.appendChild(n.childNodes[x].cloneNode(true)); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1864 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1865 |
// Replace div with new paragraph |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1866 |
n.swapNode(p); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1867 |
} |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1868 |
} |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
1869 |
} |
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
|
1870 |
} |
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:
117
diff
changeset
|
1871 |
} 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:
117
diff
changeset
|
1872 |
e.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:
117
diff
changeset
|
1873 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1874 |
return 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:
117
diff
changeset
|
1875 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1876 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1877 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1878 |
processHTML : function(h) { |
1193 | 1879 |
var t = this, s = t.settings, codeBlocks = []; |
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:
117
diff
changeset
|
1880 |
|
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
|
1881 |
if (!s.process_html) |
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
|
1882 |
return h; |
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
|
1883 |
|
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:
117
diff
changeset
|
1884 |
// Convert strong and em to b and i in FF since it can't handle them |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1885 |
if (tinymce.isGecko) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1886 |
h = h.replace(/<(\/?)strong>|<strong( [^>]+)>/gi, '<$1b$2>'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1887 |
h = h.replace(/<(\/?)em>|<em( [^>]+)>/gi, '<$1i$2>'); |
778 | 1888 |
} else if (isIE) { |
543 | 1889 |
h = h.replace(/'/g, '''); // IE can't handle apos |
778 | 1890 |
h = h.replace(/\s+(disabled|checked|readonly|selected)\s*=\s*[\"\']?(false|0)[\"\']?/gi, ''); // IE doesn't handle default values correct |
1891 |
} |
|
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:
117
diff
changeset
|
1892 |
|
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
|
1893 |
// Fix some issues |
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
|
1894 |
h = h.replace(/<a( )([^>]+)\/>|<a\/>/gi, '<a$1$2></a>'); // Force open |
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
|
1895 |
|
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:
117
diff
changeset
|
1896 |
// Store away src and href in mce_src and mce_href since browsers mess them up |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1897 |
if (s.keep_values) { |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1898 |
// Wrap scripts and styles in comments for serialization purposes |
1193 | 1899 |
if (/<script|noscript|style/i.test(h)) { |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1900 |
function trim(s) { |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1901 |
// Remove prefix and suffix code for element |
778 | 1902 |
s = s.replace(/(<!--\[CDATA\[|\]\]-->)/g, '\n'); |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1903 |
s = s.replace(/^[\r\n]*|[\r\n]*$/g, ''); |
778 | 1904 |
s = s.replace(/^\s*(\/\/\s*<!--|\/\/\s*<!\[CDATA\[|<!--|<!\[CDATA\[)[\r\n]*/g, ''); |
1905 |
s = s.replace(/\s*(\/\/\s*\]\]>|\/\/\s*-->|\]\]>|-->|\]\]-->)\s*$/g, ''); |
|
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1906 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1907 |
return s; |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1908 |
}; |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1909 |
|
1193 | 1910 |
// Wrap the script contents in CDATA and keep them from executing |
1911 |
h = h.replace(/<script([^>]+|)>([\s\S]*?)<\/script>/gi, function(v, attribs, text) { |
|
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1912 |
// Force type attribute |
1193 | 1913 |
if (!attribs) |
1914 |
attribs = ' type="text/javascript"'; |
|
1915 |
||
1916 |
// Convert the src attribute of the scripts |
|
1917 |
attribs = attribs.replace(/src=\"([^\"]+)\"?/i, function(a, url) { |
|
1918 |
if (s.url_converter) |
|
1919 |
url = t.encode(s.url_converter.call(s.url_converter_scope || t, t.decode(url), 'src', 'script')); |
|
1920 |
||
1921 |
return 'mce_src="' + url + '"'; |
|
1922 |
}); |
|
1923 |
||
1924 |
// Wrap text contents |
|
1925 |
if (tinymce.trim(text)) { |
|
1926 |
codeBlocks.push(trim(text)); |
|
1927 |
text = '<!--\nMCE_SCRIPT:' + (codeBlocks.length - 1) + '\n// -->'; |
|
1928 |
} |
|
1929 |
||
1930 |
return '<mce:script' + attribs + '>' + text + '</mce:script>'; |
|
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1931 |
}); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1932 |
|
1193 | 1933 |
// Wrap style elements |
1934 |
h = h.replace(/<style([^>]+|)>([\s\S]*?)<\/style>/gi, function(v, attribs, text) { |
|
1935 |
// Wrap text contents |
|
1936 |
if (text) { |
|
1937 |
codeBlocks.push(trim(text)); |
|
1938 |
text = '<!--\nMCE_SCRIPT:' + (codeBlocks.length - 1) + '\n-->'; |
|
1939 |
} |
|
1940 |
||
1941 |
return '<mce:style' + attribs + '>' + text + '</mce:style><style ' + attribs + ' mce_bogus="1">' + text + '</style>'; |
|
1942 |
}); |
|
1943 |
||
1944 |
// Wrap noscript elements |
|
1945 |
h = h.replace(/<noscript([^>]+|)>([\s\S]*?)<\/noscript>/g, function(v, attribs, text) { |
|
1946 |
return '<mce:noscript' + attribs + '><!--' + t.encode(text).replace(/--/g, '--') + '--></mce:noscript>'; |
|
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1947 |
}); |
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
|
1948 |
} |
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
|
1949 |
|
778 | 1950 |
h = h.replace(/<!\[CDATA\[([\s\S]+)\]\]>/g, '<!--[CDATA[$1]]-->'); |
1951 |
||
1193 | 1952 |
// Remove false bool attributes and force attributes into xhtml style attr="attr" |
1953 |
h = h.replace(/<([\w:]+) [^>]*(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)[^>]*>/gi, function(val) { |
|
1954 |
function handle(val, name, value) { |
|
1955 |
// Remove false/0 attribs |
|
1956 |
if (value === 'false' || value === '0') |
|
1957 |
return ''; |
|
1958 |
||
1959 |
return ' ' + name + '="' + name + '"'; |
|
1960 |
}; |
|
1961 |
||
1962 |
val = val.replace(/ (checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)=[\"]([^\"]+)[\"]/gi, handle); // W3C |
|
1963 |
val = val.replace(/ (checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)=[\']([^\']+)[\']/gi, handle); // W3C |
|
1964 |
val = val.replace(/ (checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)=([^\s\"\'>]+)/gi, handle); // IE |
|
1965 |
val = val.replace(/ (checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)([\s>])/gi, ' $1="$1"$2'); // Force attr="attr" |
|
1966 |
||
1967 |
return val; |
|
1968 |
}); |
|
1969 |
||
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:
117
diff
changeset
|
1970 |
// Process all tags with src, href or style |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1971 |
h = h.replace(/<([\w:]+) [^>]*(src|href|style|shape|coords)[^>]*>/gi, function(a, n) { |
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:
117
diff
changeset
|
1972 |
function handle(m, b, c) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1973 |
var u = c; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1974 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1975 |
// Tag already got a mce_ version |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1976 |
if (a.indexOf('mce_' + b) != -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:
117
diff
changeset
|
1977 |
return m; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1978 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1979 |
if (b == 'style') { |
543 | 1980 |
// No mce_style for elements with these since they might get resized by the user |
1981 |
if (t._isRes(c)) |
|
1982 |
return m; |
|
1983 |
||
1193 | 1984 |
// Parse and serialize the style to convert for example uppercase styles like "BORDER: 1px" |
1985 |
u = t.encode(t.serializeStyle(t.parseStyle(u))); |
|
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1986 |
} else if (b != 'coords' && b != 'shape') { |
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:
117
diff
changeset
|
1987 |
if (s.url_converter) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1988 |
u = t.encode(s.url_converter.call(s.url_converter_scope || t, t.decode(c), b, 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:
117
diff
changeset
|
1989 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1990 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1991 |
return ' ' + b + '="' + c + '" mce_' + b + '="' + 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:
117
diff
changeset
|
1992 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
1993 |
|
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1994 |
a = a.replace(/ (src|href|style|coords|shape)=[\"]([^\"]+)[\"]/gi, handle); // W3C |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1995 |
a = a.replace(/ (src|href|style|coords|shape)=[\']([^\']+)[\']/gi, handle); // W3C |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1996 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
1997 |
return a.replace(/ (src|href|style|coords|shape)=([^\s\"\'>]+)/gi, handle); // IE |
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:
117
diff
changeset
|
1998 |
}); |
1193 | 1999 |
|
2000 |
// Restore script blocks |
|
2001 |
h = h.replace(/MCE_SCRIPT:([0-9]+)/g, function(val, idx) { |
|
2002 |
return codeBlocks[idx]; |
|
2003 |
}); |
|
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:
117
diff
changeset
|
2004 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2005 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2006 |
return 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:
117
diff
changeset
|
2007 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2008 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2009 |
getOuterHTML : 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:
117
diff
changeset
|
2010 |
var d; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2011 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2012 |
e = this.get(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:
117
diff
changeset
|
2013 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2014 |
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:
117
diff
changeset
|
2015 |
return 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:
117
diff
changeset
|
2016 |
|
1193 | 2017 |
if (e.outerHTML !== undefined) |
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:
117
diff
changeset
|
2018 |
return e.outerHTML; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2019 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2020 |
d = (e.ownerDocument || this.doc).createElement("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:
117
diff
changeset
|
2021 |
d.appendChild(e.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:
117
diff
changeset
|
2022 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2023 |
return d.innerHTML; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2024 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2025 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2026 |
setOuterHTML : function(e, h, d) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2027 |
var t = 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:
117
diff
changeset
|
2028 |
|
1193 | 2029 |
function setHTML(e, h, d) { |
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:
117
diff
changeset
|
2030 |
var n, tp; |
1193 | 2031 |
|
2032 |
tp = d.createElement("body"); |
|
2033 |
tp.innerHTML = h; |
|
2034 |
||
2035 |
n = tp.lastChild; |
|
2036 |
while (n) { |
|
2037 |
t.insertAfter(n.cloneNode(true), e); |
|
2038 |
n = n.previousSibling; |
|
2039 |
} |
|
2040 |
||
2041 |
t.remove(e); |
|
2042 |
}; |
|
2043 |
||
2044 |
return this.run(e, function(e) { |
|
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:
117
diff
changeset
|
2045 |
e = t.get(e); |
1193 | 2046 |
|
2047 |
// Only set HTML on elements |
|
2048 |
if (e.nodeType == 1) { |
|
2049 |
d = d || e.ownerDocument || t.doc; |
|
2050 |
||
2051 |
if (isIE) { |
|
2052 |
try { |
|
2053 |
// Try outerHTML for IE it sometimes produces an unknown runtime error |
|
2054 |
if (isIE && e.nodeType == 1) |
|
2055 |
e.outerHTML = h; |
|
2056 |
else |
|
2057 |
setHTML(e, h, d); |
|
2058 |
} catch (ex) { |
|
2059 |
// Fix for unknown runtime error |
|
2060 |
setHTML(e, h, d); |
|
2061 |
} |
|
2062 |
} else |
|
2063 |
setHTML(e, h, d); |
|
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:
117
diff
changeset
|
2064 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2065 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2066 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2067 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2068 |
decode : function(s) { |
778 | 2069 |
var e, n, v; |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
2070 |
|
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
2071 |
// Look for entities to decode |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
2072 |
if (/&[^;]+;/.test(s)) { |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
2073 |
// Decode the entities using a div element not super efficient but less code |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
2074 |
e = this.doc.createElement("div"); |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
2075 |
e.innerHTML = s; |
778 | 2076 |
n = e.firstChild; |
2077 |
v = ''; |
|
2078 |
||
2079 |
if (n) { |
|
2080 |
do { |
|
2081 |
v += n.nodeValue; |
|
2082 |
} while (n.nextSibling); |
|
2083 |
} |
|
2084 |
||
2085 |
return v || s; |
|
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
2086 |
} |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
2087 |
|
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
2088 |
return s; |
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:
117
diff
changeset
|
2089 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2090 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2091 |
encode : function(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:
117
diff
changeset
|
2092 |
return s ? ('' + s).replace(/[<>&\"]/g, function (c, 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:
117
diff
changeset
|
2093 |
switch (c) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2094 |
case '&': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2095 |
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:
117
diff
changeset
|
2096 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2097 |
case '"': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2098 |
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:
117
diff
changeset
|
2099 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2100 |
case '<': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2101 |
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:
117
diff
changeset
|
2102 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2103 |
case '>': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2104 |
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:
117
diff
changeset
|
2105 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2106 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2107 |
return c; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2108 |
}) : 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:
117
diff
changeset
|
2109 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2110 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2111 |
insertAfter : function(n, 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:
117
diff
changeset
|
2112 |
var t = 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:
117
diff
changeset
|
2113 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2114 |
r = t.get(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:
117
diff
changeset
|
2115 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2116 |
return this.run(n, 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:
117
diff
changeset
|
2117 |
var p, ns; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2118 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2119 |
p = r.parentNode; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2120 |
ns = r.nextSibling; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2121 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2122 |
if (ns) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2123 |
p.insertBefore(n, ns); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2124 |
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:
117
diff
changeset
|
2125 |
p.appendChild(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:
117
diff
changeset
|
2126 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2127 |
return 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:
117
diff
changeset
|
2128 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2129 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2130 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2131 |
isBlock : 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:
117
diff
changeset
|
2132 |
if (n.nodeType && n.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:
117
diff
changeset
|
2133 |
return 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:
117
diff
changeset
|
2134 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2135 |
n = n.nodeName || 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:
117
diff
changeset
|
2136 |
|
1193 | 2137 |
return /^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TH|TBODY|TR|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n); |
2138 |
}, |
|
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:
117
diff
changeset
|
2139 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2140 |
replace : function(n, o, k) { |
1193 | 2141 |
var t = this; |
2142 |
||
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:
117
diff
changeset
|
2143 |
if (is(o, 'array')) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2144 |
n = 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:
117
diff
changeset
|
2145 |
|
1193 | 2146 |
return t.run(o, function(o) { |
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:
117
diff
changeset
|
2147 |
if (k) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2148 |
each(o.childNodes, function(c) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2149 |
n.appendChild(c.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:
117
diff
changeset
|
2150 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2151 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2152 |
|
543 | 2153 |
// Fix IE psuedo leak for elements since replacing elements if fairly common |
2154 |
// Will break parentNode for some unknown reason |
|
1193 | 2155 |
if (t.fixPsuedoLeaks && o.nodeType === 1) { |
543 | 2156 |
o.parentNode.insertBefore(n, o); |
1193 | 2157 |
t.remove(o); |
543 | 2158 |
return n; |
1193 | 2159 |
} |
543 | 2160 |
|
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:
117
diff
changeset
|
2161 |
return o.parentNode.replaceChild(n, 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:
117
diff
changeset
|
2162 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2163 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2164 |
|
1193 | 2165 |
findCommonAncestor : function(a, b) { |
2166 |
var ps = a, pe; |
|
2167 |
||
2168 |
while (ps) { |
|
2169 |
pe = b; |
|
2170 |
||
2171 |
while (pe && ps != pe) |
|
2172 |
pe = pe.parentNode; |
|
2173 |
||
2174 |
if (ps == pe) |
|
2175 |
break; |
|
2176 |
||
2177 |
ps = ps.parentNode; |
|
2178 |
} |
|
2179 |
||
2180 |
if (!ps && a.ownerDocument) |
|
2181 |
return a.ownerDocument.documentElement; |
|
2182 |
||
2183 |
return ps; |
|
2184 |
}, |
|
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:
117
diff
changeset
|
2185 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2186 |
toHex : function(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:
117
diff
changeset
|
2187 |
var c = /^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(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:
117
diff
changeset
|
2188 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2189 |
function hex(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:
117
diff
changeset
|
2190 |
s = parseInt(s).toString(16); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2191 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2192 |
return s.length > 1 ? s : '0' + s; // 0 -> 00 |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2193 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2194 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2195 |
if (c) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2196 |
s = '#' + hex(c[1]) + hex(c[2]) + hex(c[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:
117
diff
changeset
|
2197 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2198 |
return 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:
117
diff
changeset
|
2199 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2200 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2201 |
return 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:
117
diff
changeset
|
2202 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2203 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2204 |
getClasses : function() { |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
2205 |
var t = this, cl = [], i, lo = {}, f = t.settings.class_filter, ov; |
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:
117
diff
changeset
|
2206 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2207 |
if (t.classes) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2208 |
return t.classes; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2209 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2210 |
function addClasses(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:
117
diff
changeset
|
2211 |
// IE style imports |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2212 |
each(s.imports, function(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:
117
diff
changeset
|
2213 |
addClasses(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:
117
diff
changeset
|
2214 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2215 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2216 |
each(s.cssRules || s.rules, function(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:
117
diff
changeset
|
2217 |
// Real type or fake it on IE |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2218 |
switch (r.type || 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:
117
diff
changeset
|
2219 |
// Rule |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2220 |
case 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:
117
diff
changeset
|
2221 |
if (r.selectorText) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2222 |
each(r.selectorText.split(','), 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:
117
diff
changeset
|
2223 |
v = v.replace(/^\s*|\s*$|^\s\./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:
117
diff
changeset
|
2224 |
|
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
2225 |
// Is internal or it doesn't contain a class |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
2226 |
if (/\.mce/.test(v) || !/\.[\w\-]+$/.test(v)) |
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:
117
diff
changeset
|
2227 |
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:
117
diff
changeset
|
2228 |
|
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
2229 |
// Remove everything but class name |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
2230 |
ov = v; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
2231 |
v = v.replace(/.*\.([a-z0-9_\-]+).*/i, '$1'); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
2232 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
2233 |
// Filter classes |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
2234 |
if (f && !(v = f(v, ov))) |
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:
117
diff
changeset
|
2235 |
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:
117
diff
changeset
|
2236 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2237 |
if (!lo[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:
117
diff
changeset
|
2238 |
cl.push({'class' : 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:
117
diff
changeset
|
2239 |
lo[v] = 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:
117
diff
changeset
|
2240 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2241 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2242 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2243 |
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:
117
diff
changeset
|
2244 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2245 |
// Import |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2246 |
case 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:
117
diff
changeset
|
2247 |
addClasses(r.styleSheet); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2248 |
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:
117
diff
changeset
|
2249 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2250 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2251 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2252 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2253 |
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:
117
diff
changeset
|
2254 |
each(t.doc.styleSheets, addClasses); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2255 |
} 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:
117
diff
changeset
|
2256 |
// Ignore |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2257 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2258 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2259 |
if (cl.length > 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:
117
diff
changeset
|
2260 |
t.classes = cl; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2261 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2262 |
return cl; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2263 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2264 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2265 |
run : function(e, f, 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:
117
diff
changeset
|
2266 |
var t = this, 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:
117
diff
changeset
|
2267 |
|
543 | 2268 |
if (t.doc && typeof(e) === 'string') |
778 | 2269 |
e = t.get(e); |
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:
117
diff
changeset
|
2270 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2271 |
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:
117
diff
changeset
|
2272 |
return 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:
117
diff
changeset
|
2273 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2274 |
s = s || 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:
117
diff
changeset
|
2275 |
if (!e.nodeType && (e.length || e.length === 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:
117
diff
changeset
|
2276 |
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:
117
diff
changeset
|
2277 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2278 |
each(e, function(e, i) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2279 |
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:
117
diff
changeset
|
2280 |
if (typeof(e) == 'string') |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2281 |
e = t.doc.getElementById(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:
117
diff
changeset
|
2282 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2283 |
o.push(f.call(s, e, i)); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2284 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2285 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2286 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2287 |
return 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:
117
diff
changeset
|
2288 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2289 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2290 |
return f.call(s, e); |
543 | 2291 |
}, |
2292 |
||
2293 |
getAttribs : function(n) { |
|
2294 |
var o; |
|
2295 |
||
2296 |
n = this.get(n); |
|
2297 |
||
2298 |
if (!n) |
|
2299 |
return []; |
|
2300 |
||
2301 |
if (isIE) { |
|
2302 |
o = []; |
|
2303 |
||
2304 |
// Object will throw exception in IE |
|
2305 |
if (n.nodeName == 'OBJECT') |
|
2306 |
return n.attributes; |
|
2307 |
||
1193 | 2308 |
// IE doesn't keep the selected attribute if you clone option elements |
2309 |
if (n.nodeName === 'OPTION' && this.getAttrib(n, 'selected')) |
|
2310 |
o.push({specified : 1, nodeName : 'selected'}); |
|
2311 |
||
543 | 2312 |
// It's crazy that this is faster in IE but it's because it returns all attributes all the time |
1193 | 2313 |
n.cloneNode(false).outerHTML.replace(/<\/?[\w:]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=\w+|>/gi, '').replace(/[\w:]+/gi, function(a) { |
2314 |
o.push({specified : 1, nodeName : a}); |
|
543 | 2315 |
}); |
2316 |
||
2317 |
return o; |
|
2318 |
} |
|
2319 |
||
2320 |
return n.attributes; |
|
2321 |
}, |
|
2322 |
||
2323 |
destroy : function(s) { |
|
2324 |
var t = this; |
|
2325 |
||
1193 | 2326 |
if (t.events) |
2327 |
t.events.destroy(); |
|
2328 |
||
2329 |
t.win = t.doc = t.root = t.events = null; |
|
543 | 2330 |
|
2331 |
// Manual destroy then remove unload handler |
|
2332 |
if (!s) |
|
2333 |
tinymce.removeUnload(t.destroy); |
|
2334 |
}, |
|
2335 |
||
1193 | 2336 |
createRng : function() { |
2337 |
var d = this.doc; |
|
2338 |
||
2339 |
return d.createRange ? d.createRange() : new tinymce.dom.Range(this); |
|
2340 |
}, |
|
2341 |
||
2342 |
split : function(pe, e, re) { |
|
2343 |
var t = this, r = t.createRng(), bef, aft, pa; |
|
2344 |
||
2345 |
// W3C valid browsers tend to leave empty nodes to the left/right side of the contents, this makes sence |
|
2346 |
// but we don't want that in our code since it serves no purpose |
|
2347 |
// For example if this is chopped: |
|
2348 |
// <p>text 1<span><b>CHOP</b></span>text 2</p> |
|
2349 |
// would produce: |
|
2350 |
// <p>text 1<span></span></p><b>CHOP</b><p><span></span>text 2</p> |
|
2351 |
// this function will then trim of empty edges and produce: |
|
2352 |
// <p>text 1</p><b>CHOP</b><p>text 2</p> |
|
2353 |
function trimEdge(n, na) { |
|
2354 |
n = n[na]; |
|
2355 |
||
2356 |
if (n && n[na] && n[na].nodeType == 1 && isEmpty(n[na])) |
|
2357 |
t.remove(n[na]); |
|
2358 |
}; |
|
2359 |
||
2360 |
function isEmpty(n) { |
|
2361 |
n = t.getOuterHTML(n); |
|
2362 |
n = n.replace(/<(img|hr|table)/gi, '-'); // Keep these convert them to - chars |
|
2363 |
n = n.replace(/<[^>]+>/g, ''); // Remove all tags |
|
2364 |
||
2365 |
return n.replace(/[ \t\r\n]+| | /g, '') == ''; |
|
2366 |
}; |
|
2367 |
||
2368 |
// Added until Gecko can create real HTML documents using implementation.createHTMLDocument |
|
2369 |
// this is to future proof it if Gecko decides to implement the error checking for range methods. |
|
2370 |
function nodeIndex(n) { |
|
2371 |
var i = 0; |
|
2372 |
||
2373 |
while (n.previousSibling) { |
|
2374 |
i++; |
|
2375 |
n = n.previousSibling; |
|
2376 |
} |
|
2377 |
||
2378 |
return i; |
|
2379 |
}; |
|
2380 |
||
2381 |
if (pe && e) { |
|
2382 |
// Get before chunk |
|
2383 |
r.setStart(pe.parentNode, nodeIndex(pe)); |
|
2384 |
r.setEnd(e.parentNode, nodeIndex(e)); |
|
2385 |
bef = r.extractContents(); |
|
2386 |
||
2387 |
// Get after chunk |
|
2388 |
r = t.createRng(); |
|
2389 |
r.setStart(e.parentNode, nodeIndex(e) + 1); |
|
2390 |
r.setEnd(pe.parentNode, nodeIndex(pe) + 1); |
|
2391 |
aft = r.extractContents(); |
|
2392 |
||
2393 |
// Insert chunks and remove parent |
|
2394 |
pa = pe.parentNode; |
|
2395 |
||
2396 |
// Remove right side edge of the before contents |
|
2397 |
trimEdge(bef, 'lastChild'); |
|
2398 |
||
2399 |
if (!isEmpty(bef)) |
|
2400 |
pa.insertBefore(bef, pe); |
|
2401 |
||
2402 |
if (re) |
|
2403 |
pa.replaceChild(re, e); |
|
2404 |
else |
|
2405 |
pa.insertBefore(e, pe); |
|
2406 |
||
2407 |
// Remove left site edge of the after contents |
|
2408 |
trimEdge(aft, 'firstChild'); |
|
2409 |
||
2410 |
if (!isEmpty(aft)) |
|
2411 |
pa.insertBefore(aft, pe); |
|
2412 |
||
2413 |
t.remove(pe); |
|
2414 |
||
2415 |
return re || e; |
|
2416 |
} |
|
2417 |
}, |
|
2418 |
||
2419 |
bind : function(target, name, func, scope) { |
|
2420 |
var t = this; |
|
2421 |
||
2422 |
if (!t.events) |
|
2423 |
t.events = new tinymce.dom.EventUtils(); |
|
2424 |
||
2425 |
return t.events.add(target, name, func, scope || this); |
|
2426 |
}, |
|
2427 |
||
2428 |
unbind : function(target, name, func) { |
|
2429 |
var t = this; |
|
2430 |
||
2431 |
if (!t.events) |
|
2432 |
t.events = new tinymce.dom.EventUtils(); |
|
2433 |
||
2434 |
return t.events.remove(target, name, func); |
|
2435 |
}, |
|
2436 |
||
2437 |
||
2438 |
_findSib : function(node, selector, name) { |
|
2439 |
var t = this, f = selector; |
|
2440 |
||
2441 |
if (node) { |
|
2442 |
// If expression make a function of it using is |
|
2443 |
if (is(f, 'string')) { |
|
2444 |
f = function(node) { |
|
2445 |
return t.is(node, selector); |
|
2446 |
}; |
|
2447 |
} |
|
2448 |
||
2449 |
// Loop all siblings |
|
2450 |
for (node = node[name]; node; node = node[name]) { |
|
2451 |
if (f(node)) |
|
2452 |
return node; |
|
2453 |
} |
|
2454 |
} |
|
2455 |
||
2456 |
return null; |
|
2457 |
}, |
|
2458 |
||
543 | 2459 |
_isRes : function(c) { |
2460 |
// Is live resizble element |
|
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
2461 |
return /^(top|left|bottom|right|width|height)/i.test(c) || /;\s*(top|left|bottom|right|width|height)/i.test(c); |
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:
117
diff
changeset
|
2462 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2463 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2464 |
/* |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2465 |
walk : function(n, f, 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:
117
diff
changeset
|
2466 |
var d = this.doc, w; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2467 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2468 |
if (d.createTreeWalker) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2469 |
w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, 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:
117
diff
changeset
|
2470 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2471 |
while ((n = w.nextNode()) != 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:
117
diff
changeset
|
2472 |
f.call(s || this, 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:
117
diff
changeset
|
2473 |
} 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:
117
diff
changeset
|
2474 |
tinymce.walk(n, f, 'childNodes', 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:
117
diff
changeset
|
2475 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2476 |
*/ |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2477 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2478 |
/* |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2479 |
toRGB : function(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:
117
diff
changeset
|
2480 |
var c = /^\s*?#([0-9A-F]{2})([0-9A-F]{1,2})([0-9A-F]{2})?\s*?$/.exec(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:
117
diff
changeset
|
2481 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2482 |
if (c) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2483 |
// #FFF -> #FFFFFF |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2484 |
if (!is(c[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:
117
diff
changeset
|
2485 |
c[3] = c[2] = c[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:
117
diff
changeset
|
2486 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2487 |
return "rgb(" + parseInt(c[1], 16) + "," + parseInt(c[2], 16) + "," + parseInt(c[3], 16) + ")"; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2488 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2489 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2490 |
return 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:
117
diff
changeset
|
2491 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
2492 |
*/ |
1193 | 2493 |
}); |
2494 |
||
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
|
2495 |
tinymce.DOM = new tinymce.dom.DOMUtils(document, {process_html : 0}); |
1193 | 2496 |
})(tinymce); |
2497 |
(function(ns) { |
|
2498 |
// Traverse constants |
|
2499 |
var EXTRACT = 0, CLONE = 1, DELETE = 2, extend = tinymce.extend; |
|
2500 |
||
2501 |
function indexOf(child, parent) { |
|
2502 |
var i, node; |
|
2503 |
||
2504 |
if (child.parentNode != parent) |
|
2505 |
return -1; |
|
2506 |
||
2507 |
for (node = parent.firstChild, i = 0; node != child; node = node.nextSibling) |
|
2508 |
i++; |
|
2509 |
||
2510 |
return i; |
|
2511 |
}; |
|
2512 |
||
2513 |
function nodeIndex(n) { |
|
2514 |
var i = 0; |
|
2515 |
||
2516 |
while (n.previousSibling) { |
|
2517 |
i++; |
|
2518 |
n = n.previousSibling; |
|
2519 |
} |
|
2520 |
||
2521 |
return i; |
|
2522 |
}; |
|
2523 |
||
2524 |
function getSelectedNode(container, offset) { |
|
2525 |
var child; |
|
2526 |
||
2527 |
if (container.nodeType == 3 /* TEXT_NODE */) |
|
2528 |
return container; |
|
2529 |
||
2530 |
if (offset < 0) |
|
2531 |
return container; |
|
2532 |
||
2533 |
child = container.firstChild; |
|
2534 |
while (child != null && offset > 0) { |
|
2535 |
--offset; |
|
2536 |
child = child.nextSibling; |
|
2537 |
} |
|
2538 |
||
2539 |
if (child != null) |
|
2540 |
return child; |
|
2541 |
||
2542 |
return container; |
|
2543 |
}; |
|
2544 |
||
2545 |
// Range constructor |
|
2546 |
function Range(dom) { |
|
2547 |
var d = dom.doc; |
|
2548 |
||
2549 |
extend(this, { |
|
2550 |
dom : dom, |
|
2551 |
||
2552 |
// Inital states |
|
2553 |
startContainer : d, |
|
2554 |
startOffset : 0, |
|
2555 |
endContainer : d, |
|
2556 |
endOffset : 0, |
|
2557 |
collapsed : true, |
|
2558 |
commonAncestorContainer : d, |
|
2559 |
||
2560 |
// Range constants |
|
2561 |
START_TO_START : 0, |
|
2562 |
START_TO_END : 1, |
|
2563 |
END_TO_END : 2, |
|
2564 |
END_TO_START : 3 |
|
2565 |
}); |
|
2566 |
}; |
|
2567 |
||
2568 |
// Add range methods |
|
2569 |
extend(Range.prototype, { |
|
2570 |
setStart : function(n, o) { |
|
2571 |
this._setEndPoint(true, n, o); |
|
2572 |
}, |
|
2573 |
||
2574 |
setEnd : function(n, o) { |
|
2575 |
this._setEndPoint(false, n, o); |
|
2576 |
}, |
|
2577 |
||
2578 |
setStartBefore : function(n) { |
|
2579 |
this.setStart(n.parentNode, nodeIndex(n)); |
|
2580 |
}, |
|
2581 |
||
2582 |
setStartAfter : function(n) { |
|
2583 |
this.setStart(n.parentNode, nodeIndex(n) + 1); |
|
2584 |
}, |
|
2585 |
||
2586 |
setEndBefore : function(n) { |
|
2587 |
this.setEnd(n.parentNode, nodeIndex(n)); |
|
2588 |
}, |
|
2589 |
||
2590 |
setEndAfter : function(n) { |
|
2591 |
this.setEnd(n.parentNode, nodeIndex(n) + 1); |
|
2592 |
}, |
|
2593 |
||
2594 |
collapse : function(ts) { |
|
2595 |
var t = this; |
|
2596 |
||
2597 |
if (ts) { |
|
2598 |
t.endContainer = t.startContainer; |
|
2599 |
t.endOffset = t.startOffset; |
|
2600 |
} else { |
|
2601 |
t.startContainer = t.endContainer; |
|
2602 |
t.startOffset = t.endOffset; |
|
2603 |
} |
|
2604 |
||
2605 |
t.collapsed = true; |
|
2606 |
}, |
|
2607 |
||
2608 |
selectNode : function(n) { |
|
2609 |
this.setStartBefore(n); |
|
2610 |
this.setEndAfter(n); |
|
2611 |
}, |
|
2612 |
||
2613 |
selectNodeContents : function(n) { |
|
2614 |
this.setStart(n, 0); |
|
2615 |
this.setEnd(n, n.nodeType === 1 ? n.childNodes.length : n.nodeValue.length); |
|
2616 |
}, |
|
2617 |
||
2618 |
compareBoundaryPoints : function(h, r) { |
|
2619 |
var t = this, sc = t.startContainer, so = t.startOffset, ec = t.endContainer, eo = t.endOffset; |
|
2620 |
||
2621 |
// Check START_TO_START |
|
2622 |
if (h === 0) |
|
2623 |
return t._compareBoundaryPoints(sc, so, sc, so); |
|
2624 |
||
2625 |
// Check START_TO_END |
|
2626 |
if (h === 1) |
|
2627 |
return t._compareBoundaryPoints(sc, so, ec, eo); |
|
2628 |
||
2629 |
// Check END_TO_END |
|
2630 |
if (h === 2) |
|
2631 |
return t._compareBoundaryPoints(ec, eo, ec, eo); |
|
2632 |
||
2633 |
// Check END_TO_START |
|
2634 |
if (h === 3) |
|
2635 |
return t._compareBoundaryPoints(ec, eo, sc, so); |
|
2636 |
}, |
|
2637 |
||
2638 |
deleteContents : function() { |
|
2639 |
this._traverse(DELETE); |
|
2640 |
}, |
|
2641 |
||
2642 |
extractContents : function() { |
|
2643 |
return this._traverse(EXTRACT); |
|
2644 |
}, |
|
2645 |
||
2646 |
cloneContents : function() { |
|
2647 |
return this._traverse(CLONE); |
|
2648 |
}, |
|
2649 |
||
2650 |
insertNode : function(n) { |
|
2651 |
var t = this, nn, o; |
|
2652 |
||
2653 |
// Node is TEXT_NODE or CDATA |
|
2654 |
if (n.nodeType === 3 || n.nodeType === 4) { |
|
2655 |
nn = t.startContainer.splitText(t.startOffset); |
|
2656 |
t.startContainer.parentNode.insertBefore(n, nn); |
|
2657 |
} else { |
|
2658 |
// Insert element node |
|
2659 |
if (t.startContainer.childNodes.length > 0) |
|
2660 |
o = t.startContainer.childNodes[t.startOffset]; |
|
2661 |
||
2662 |
t.startContainer.insertBefore(n, o); |
|
2663 |
} |
|
2664 |
}, |
|
2665 |
||
2666 |
surroundContents : function(n) { |
|
2667 |
var t = this, f = t.extractContents(); |
|
2668 |
||
2669 |
t.insertNode(n); |
|
2670 |
n.appendChild(f); |
|
2671 |
t.selectNode(n); |
|
2672 |
}, |
|
2673 |
||
2674 |
cloneRange : function() { |
|
2675 |
var t = this; |
|
2676 |
||
2677 |
return extend(new Range(t.dom), { |
|
2678 |
startContainer : t.startContainer, |
|
2679 |
startOffset : t.startOffset, |
|
2680 |
endContainer : t.endContainer, |
|
2681 |
endOffset : t.endOffset, |
|
2682 |
collapsed : t.collapsed, |
|
2683 |
commonAncestorContainer : t.commonAncestorContainer |
|
2684 |
}); |
|
2685 |
}, |
|
2686 |
||
2687 |
/* |
|
2688 |
detach : function() { |
|
2689 |
// Not implemented |
|
2690 |
}, |
|
2691 |
*/ |
|
2692 |
// Internal methods |
|
2693 |
||
2694 |
_isCollapsed : function() { |
|
2695 |
return (this.startContainer == this.endContainer && this.startOffset == this.endOffset); |
|
2696 |
}, |
|
2697 |
||
2698 |
_compareBoundaryPoints : function (containerA, offsetA, containerB, offsetB) { |
|
2699 |
var c, offsetC, n, cmnRoot, childA, childB; |
|
2700 |
||
2701 |
// In the first case the boundary-points have the same container. A is before B |
|
2702 |
// if its offset is less than the offset of B, A is equal to B if its offset is |
|
2703 |
// equal to the offset of B, and A is after B if its offset is greater than the |
|
2704 |
// offset of B. |
|
2705 |
if (containerA == containerB) { |
|
2706 |
if (offsetA == offsetB) { |
|
2707 |
return 0; // equal |
|
2708 |
} else if (offsetA < offsetB) { |
|
2709 |
return -1; // before |
|
2710 |
} else { |
|
2711 |
return 1; // after |
|
2712 |
} |
|
2713 |
} |
|
2714 |
||
2715 |
// In the second case a child node C of the container of A is an ancestor |
|
2716 |
// container of B. In this case, A is before B if the offset of A is less than or |
|
2717 |
// equal to the index of the child node C and A is after B otherwise. |
|
2718 |
c = containerB; |
|
2719 |
while (c && c.parentNode != containerA) { |
|
2720 |
c = c.parentNode; |
|
2721 |
} |
|
2722 |
if (c) { |
|
2723 |
offsetC = 0; |
|
2724 |
n = containerA.firstChild; |
|
2725 |
||
2726 |
while (n != c && offsetC < offsetA) { |
|
2727 |
offsetC++; |
|
2728 |
n = n.nextSibling; |
|
2729 |
} |
|
2730 |
||
2731 |
if (offsetA <= offsetC) { |
|
2732 |
return -1; // before |
|
2733 |
} else { |
|
2734 |
return 1; // after |
|
2735 |
} |
|
2736 |
} |
|
2737 |
||
2738 |
// In the third case a child node C of the container of B is an ancestor container |
|
2739 |
// of A. In this case, A is before B if the index of the child node C is less than |
|
2740 |
// the offset of B and A is after B otherwise. |
|
2741 |
c = containerA; |
|
2742 |
while (c && c.parentNode != containerB) { |
|
2743 |
c = c.parentNode; |
|
2744 |
} |
|
2745 |
||
2746 |
if (c) { |
|
2747 |
offsetC = 0; |
|
2748 |
n = containerB.firstChild; |
|
2749 |
||
2750 |
while (n != c && offsetC < offsetB) { |
|
2751 |
offsetC++; |
|
2752 |
n = n.nextSibling; |
|
2753 |
} |
|
2754 |
||
2755 |
if (offsetC < offsetB) { |
|
2756 |
return -1; // before |
|
2757 |
} else { |
|
2758 |
return 1; // after |
|
2759 |
} |
|
2760 |
} |
|
2761 |
||
2762 |
// In the fourth case, none of three other cases hold: the containers of A and B |
|
2763 |
// are siblings or descendants of sibling nodes. In this case, A is before B if |
|
2764 |
// the container of A is before the container of B in a pre-order traversal of the |
|
2765 |
// Ranges' context tree and A is after B otherwise. |
|
2766 |
cmnRoot = this.dom.findCommonAncestor(containerA, containerB); |
|
2767 |
childA = containerA; |
|
2768 |
||
2769 |
while (childA && childA.parentNode != cmnRoot) { |
|
2770 |
childA = childA.parentNode; |
|
2771 |
} |
|
2772 |
||
2773 |
if (!childA) { |
|
2774 |
childA = cmnRoot; |
|
2775 |
} |
|
2776 |
||
2777 |
childB = containerB; |
|
2778 |
while (childB && childB.parentNode != cmnRoot) { |
|
2779 |
childB = childB.parentNode; |
|
2780 |
} |
|
2781 |
||
2782 |
if (!childB) { |
|
2783 |
childB = cmnRoot; |
|
2784 |
} |
|
2785 |
||
2786 |
if (childA == childB) { |
|
2787 |
return 0; // equal |
|
2788 |
} |
|
2789 |
||
2790 |
n = cmnRoot.firstChild; |
|
2791 |
while (n) { |
|
2792 |
if (n == childA) { |
|
2793 |
return -1; // before |
|
2794 |
} |
|
2795 |
||
2796 |
if (n == childB) { |
|
2797 |
return 1; // after |
|
2798 |
} |
|
2799 |
||
2800 |
n = n.nextSibling; |
|
2801 |
} |
|
2802 |
}, |
|
2803 |
||
2804 |
_setEndPoint : function(st, n, o) { |
|
2805 |
var t = this, ec, sc; |
|
2806 |
||
2807 |
if (st) { |
|
2808 |
t.startContainer = n; |
|
2809 |
t.startOffset = o; |
|
2810 |
} else { |
|
2811 |
t.endContainer = n; |
|
2812 |
t.endOffset = o; |
|
2813 |
} |
|
2814 |
||
2815 |
// If one boundary-point of a Range is set to have a root container |
|
2816 |
// other than the current one for the Range, the Range is collapsed to |
|
2817 |
// the new position. This enforces the restriction that both boundary- |
|
2818 |
// points of a Range must have the same root container. |
|
2819 |
ec = t.endContainer; |
|
2820 |
while (ec.parentNode) |
|
2821 |
ec = ec.parentNode; |
|
2822 |
||
2823 |
sc = t.startContainer; |
|
2824 |
while (sc.parentNode) |
|
2825 |
sc = sc.parentNode; |
|
2826 |
||
2827 |
if (sc != ec) { |
|
2828 |
t.collapse(st); |
|
2829 |
} else { |
|
2830 |
// The start position of a Range is guaranteed to never be after the |
|
2831 |
// end position. To enforce this restriction, if the start is set to |
|
2832 |
// be at a position after the end, the Range is collapsed to that |
|
2833 |
// position. |
|
2834 |
if (t._compareBoundaryPoints(t.startContainer, t.startOffset, t.endContainer, t.endOffset) > 0) |
|
2835 |
t.collapse(st); |
|
2836 |
} |
|
2837 |
||
2838 |
t.collapsed = t._isCollapsed(); |
|
2839 |
t.commonAncestorContainer = t.dom.findCommonAncestor(t.startContainer, t.endContainer); |
|
2840 |
}, |
|
2841 |
||
2842 |
// This code is heavily "inspired" by the Apache Xerces implementation. I hope they don't mind. :) |
|
2843 |
||
2844 |
_traverse : function(how) { |
|
2845 |
var t = this, c, endContainerDepth = 0, startContainerDepth = 0, p, depthDiff, startNode, endNode, sp, ep; |
|
2846 |
||
2847 |
if (t.startContainer == t.endContainer) |
|
2848 |
return t._traverseSameContainer(how); |
|
2849 |
||
2850 |
for (c = t.endContainer, p = c.parentNode; p != null; c = p, p = p.parentNode) { |
|
2851 |
if (p == t.startContainer) |
|
2852 |
return t._traverseCommonStartContainer(c, how); |
|
2853 |
||
2854 |
++endContainerDepth; |
|
2855 |
} |
|
2856 |
||
2857 |
for (c = t.startContainer, p = c.parentNode; p != null; c = p, p = p.parentNode) { |
|
2858 |
if (p == t.endContainer) |
|
2859 |
return t._traverseCommonEndContainer(c, how); |
|
2860 |
||
2861 |
++startContainerDepth; |
|
2862 |
} |
|
2863 |
||
2864 |
depthDiff = startContainerDepth - endContainerDepth; |
|
2865 |
||
2866 |
startNode = t.startContainer; |
|
2867 |
while (depthDiff > 0) { |
|
2868 |
startNode = startNode.parentNode; |
|
2869 |
depthDiff--; |
|
2870 |
} |
|
2871 |
||
2872 |
endNode = t.endContainer; |
|
2873 |
while (depthDiff < 0) { |
|
2874 |
endNode = endNode.parentNode; |
|
2875 |
depthDiff++; |
|
2876 |
} |
|
2877 |
||
2878 |
// ascend the ancestor hierarchy until we have a common parent. |
|
2879 |
for (sp = startNode.parentNode, ep = endNode.parentNode; sp != ep; sp = sp.parentNode, ep = ep.parentNode) { |
|
2880 |
startNode = sp; |
|
2881 |
endNode = ep; |
|
2882 |
} |
|
2883 |
||
2884 |
return t._traverseCommonAncestors(startNode, endNode, how); |
|
2885 |
}, |
|
2886 |
||
2887 |
_traverseSameContainer : function(how) { |
|
2888 |
var t = this, frag, s, sub, n, cnt, sibling, xferNode; |
|
2889 |
||
2890 |
if (how != DELETE) |
|
2891 |
frag = t.dom.doc.createDocumentFragment(); |
|
2892 |
||
2893 |
// If selection is empty, just return the fragment |
|
2894 |
if (t.startOffset == t.endOffset) |
|
2895 |
return frag; |
|
2896 |
||
2897 |
// Text node needs special case handling |
|
2898 |
if (t.startContainer.nodeType == 3 /* TEXT_NODE */) { |
|
2899 |
// get the substring |
|
2900 |
s = t.startContainer.nodeValue; |
|
2901 |
sub = s.substring(t.startOffset, t.endOffset); |
|
2902 |
||
2903 |
// set the original text node to its new value |
|
2904 |
if (how != CLONE) { |
|
2905 |
t.startContainer.deleteData(t.startOffset, t.endOffset - t.startOffset); |
|
2906 |
||
2907 |
// Nothing is partially selected, so collapse to start point |
|
2908 |
t.collapse(true); |
|
2909 |
} |
|
2910 |
||
2911 |
if (how == DELETE) |
|
2912 |
return null; |
|
2913 |
||
2914 |
frag.appendChild(t.dom.doc.createTextNode(sub)); |
|
2915 |
return frag; |
|
2916 |
} |
|
2917 |
||
2918 |
// Copy nodes between the start/end offsets. |
|
2919 |
n = getSelectedNode(t.startContainer, t.startOffset); |
|
2920 |
cnt = t.endOffset - t.startOffset; |
|
2921 |
||
2922 |
while (cnt > 0) { |
|
2923 |
sibling = n.nextSibling; |
|
2924 |
xferNode = t._traverseFullySelected(n, how); |
|
2925 |
||
2926 |
if (frag) |
|
2927 |
frag.appendChild( xferNode ); |
|
2928 |
||
2929 |
--cnt; |
|
2930 |
n = sibling; |
|
2931 |
} |
|
2932 |
||
2933 |
// Nothing is partially selected, so collapse to start point |
|
2934 |
if (how != CLONE) |
|
2935 |
t.collapse(true); |
|
2936 |
||
2937 |
return frag; |
|
2938 |
}, |
|
2939 |
||
2940 |
_traverseCommonStartContainer : function(endAncestor, how) { |
|
2941 |
var t = this, frag, n, endIdx, cnt, sibling, xferNode; |
|
2942 |
||
2943 |
if (how != DELETE) |
|
2944 |
frag = t.dom.doc.createDocumentFragment(); |
|
2945 |
||
2946 |
n = t._traverseRightBoundary(endAncestor, how); |
|
2947 |
||
2948 |
if (frag) |
|
2949 |
frag.appendChild(n); |
|
2950 |
||
2951 |
endIdx = indexOf(endAncestor, t.startContainer); |
|
2952 |
cnt = endIdx - t.startOffset; |
|
2953 |
||
2954 |
if (cnt <= 0) { |
|
2955 |
// Collapse to just before the endAncestor, which |
|
2956 |
// is partially selected. |
|
2957 |
if (how != CLONE) { |
|
2958 |
t.setEndBefore(endAncestor); |
|
2959 |
t.collapse(false); |
|
2960 |
} |
|
2961 |
||
2962 |
return frag; |
|
2963 |
} |
|
2964 |
||
2965 |
n = endAncestor.previousSibling; |
|
2966 |
while (cnt > 0) { |
|
2967 |
sibling = n.previousSibling; |
|
2968 |
xferNode = t._traverseFullySelected(n, how); |
|
2969 |
||
2970 |
if (frag) |
|
2971 |
frag.insertBefore(xferNode, frag.firstChild); |
|
2972 |
||
2973 |
--cnt; |
|
2974 |
n = sibling; |
|
2975 |
} |
|
2976 |
||
2977 |
// Collapse to just before the endAncestor, which |
|
2978 |
// is partially selected. |
|
2979 |
if (how != CLONE) { |
|
2980 |
t.setEndBefore(endAncestor); |
|
2981 |
t.collapse(false); |
|
2982 |
} |
|
2983 |
||
2984 |
return frag; |
|
2985 |
}, |
|
2986 |
||
2987 |
_traverseCommonEndContainer : function(startAncestor, how) { |
|
2988 |
var t = this, frag, startIdx, n, cnt, sibling, xferNode; |
|
2989 |
||
2990 |
if (how != DELETE) |
|
2991 |
frag = t.dom.doc.createDocumentFragment(); |
|
2992 |
||
2993 |
n = t._traverseLeftBoundary(startAncestor, how); |
|
2994 |
if (frag) |
|
2995 |
frag.appendChild(n); |
|
2996 |
||
2997 |
startIdx = indexOf(startAncestor, t.endContainer); |
|
2998 |
++startIdx; // Because we already traversed it.... |
|
2999 |
||
3000 |
cnt = t.endOffset - startIdx; |
|
3001 |
n = startAncestor.nextSibling; |
|
3002 |
while (cnt > 0) { |
|
3003 |
sibling = n.nextSibling; |
|
3004 |
xferNode = t._traverseFullySelected(n, how); |
|
3005 |
||
3006 |
if (frag) |
|
3007 |
frag.appendChild(xferNode); |
|
3008 |
||
3009 |
--cnt; |
|
3010 |
n = sibling; |
|
3011 |
} |
|
3012 |
||
3013 |
if (how != CLONE) { |
|
3014 |
t.setStartAfter(startAncestor); |
|
3015 |
t.collapse(true); |
|
3016 |
} |
|
3017 |
||
3018 |
return frag; |
|
3019 |
}, |
|
3020 |
||
3021 |
_traverseCommonAncestors : function(startAncestor, endAncestor, how) { |
|
3022 |
var t = this, n, frag, commonParent, startOffset, endOffset, cnt, sibling, nextSibling; |
|
3023 |
||
3024 |
if (how != DELETE) |
|
3025 |
frag = t.dom.doc.createDocumentFragment(); |
|
3026 |
||
3027 |
n = t._traverseLeftBoundary(startAncestor, how); |
|
3028 |
if (frag) |
|
3029 |
frag.appendChild(n); |
|
3030 |
||
3031 |
commonParent = startAncestor.parentNode; |
|
3032 |
startOffset = indexOf(startAncestor, commonParent); |
|
3033 |
endOffset = indexOf(endAncestor, commonParent); |
|
3034 |
++startOffset; |
|
3035 |
||
3036 |
cnt = endOffset - startOffset; |
|
3037 |
sibling = startAncestor.nextSibling; |
|
3038 |
||
3039 |
while (cnt > 0) { |
|
3040 |
nextSibling = sibling.nextSibling; |
|
3041 |
n = t._traverseFullySelected(sibling, how); |
|
3042 |
||
3043 |
if (frag) |
|
3044 |
frag.appendChild(n); |
|
3045 |
||
3046 |
sibling = nextSibling; |
|
3047 |
--cnt; |
|
3048 |
} |
|
3049 |
||
3050 |
n = t._traverseRightBoundary(endAncestor, how); |
|
3051 |
||
3052 |
if (frag) |
|
3053 |
frag.appendChild(n); |
|
3054 |
||
3055 |
if (how != CLONE) { |
|
3056 |
t.setStartAfter(startAncestor); |
|
3057 |
t.collapse(true); |
|
3058 |
} |
|
3059 |
||
3060 |
return frag; |
|
3061 |
}, |
|
3062 |
||
3063 |
_traverseRightBoundary : function(root, how) { |
|
3064 |
var t = this, next = getSelectedNode(t.endContainer, t.endOffset - 1), parent, clonedParent, prevSibling, clonedChild, clonedGrandParent; |
|
3065 |
var isFullySelected = next != t.endContainer; |
|
3066 |
||
3067 |
if (next == root) |
|
3068 |
return t._traverseNode(next, isFullySelected, false, how); |
|
3069 |
||
3070 |
parent = next.parentNode; |
|
3071 |
clonedParent = t._traverseNode(parent, false, false, how); |
|
3072 |
||
3073 |
while (parent != null) { |
|
3074 |
while (next != null) { |
|
3075 |
prevSibling = next.previousSibling; |
|
3076 |
clonedChild = t._traverseNode(next, isFullySelected, false, how); |
|
3077 |
||
3078 |
if (how != DELETE) |
|
3079 |
clonedParent.insertBefore(clonedChild, clonedParent.firstChild); |
|
3080 |
||
3081 |
isFullySelected = true; |
|
3082 |
next = prevSibling; |
|
3083 |
} |
|
3084 |
||
3085 |
if (parent == root) |
|
3086 |
return clonedParent; |
|
3087 |
||
3088 |
next = parent.previousSibling; |
|
3089 |
parent = parent.parentNode; |
|
3090 |
||
3091 |
clonedGrandParent = t._traverseNode(parent, false, false, how); |
|
3092 |
||
3093 |
if (how != DELETE) |
|
3094 |
clonedGrandParent.appendChild(clonedParent); |
|
3095 |
||
3096 |
clonedParent = clonedGrandParent; |
|
3097 |
} |
|
3098 |
||
3099 |
// should never occur |
|
3100 |
return null; |
|
3101 |
}, |
|
3102 |
||
3103 |
_traverseLeftBoundary : function(root, how) { |
|
3104 |
var t = this, next = getSelectedNode(t.startContainer, t.startOffset); |
|
3105 |
var isFullySelected = next != t.startContainer, parent, clonedParent, nextSibling, clonedChild, clonedGrandParent; |
|
3106 |
||
3107 |
if (next == root) |
|
3108 |
return t._traverseNode(next, isFullySelected, true, how); |
|
3109 |
||
3110 |
parent = next.parentNode; |
|
3111 |
clonedParent = t._traverseNode(parent, false, true, how); |
|
3112 |
||
3113 |
while (parent != null) { |
|
3114 |
while (next != null) { |
|
3115 |
nextSibling = next.nextSibling; |
|
3116 |
clonedChild = t._traverseNode(next, isFullySelected, true, how); |
|
3117 |
||
3118 |
if (how != DELETE) |
|
3119 |
clonedParent.appendChild(clonedChild); |
|
3120 |
||
3121 |
isFullySelected = true; |
|
3122 |
next = nextSibling; |
|
3123 |
} |
|
3124 |
||
3125 |
if (parent == root) |
|
3126 |
return clonedParent; |
|
3127 |
||
3128 |
next = parent.nextSibling; |
|
3129 |
parent = parent.parentNode; |
|
3130 |
||
3131 |
clonedGrandParent = t._traverseNode(parent, false, true, how); |
|
3132 |
||
3133 |
if (how != DELETE) |
|
3134 |
clonedGrandParent.appendChild(clonedParent); |
|
3135 |
||
3136 |
clonedParent = clonedGrandParent; |
|
3137 |
} |
|
3138 |
||
3139 |
// should never occur |
|
3140 |
return null; |
|
3141 |
}, |
|
3142 |
||
3143 |
_traverseNode : function(n, isFullySelected, isLeft, how) { |
|
3144 |
var t = this, txtValue, newNodeValue, oldNodeValue, offset, newNode; |
|
3145 |
||
3146 |
if (isFullySelected) |
|
3147 |
return t._traverseFullySelected(n, how); |
|
3148 |
||
3149 |
if (n.nodeType == 3 /* TEXT_NODE */) { |
|
3150 |
txtValue = n.nodeValue; |
|
3151 |
||
3152 |
if (isLeft) { |
|
3153 |
offset = t.startOffset; |
|
3154 |
newNodeValue = txtValue.substring(offset); |
|
3155 |
oldNodeValue = txtValue.substring(0, offset); |
|
3156 |
} else { |
|
3157 |
offset = t.endOffset; |
|
3158 |
newNodeValue = txtValue.substring(0, offset); |
|
3159 |
oldNodeValue = txtValue.substring(offset); |
|
3160 |
} |
|
3161 |
||
3162 |
if (how != CLONE) |
|
3163 |
n.nodeValue = oldNodeValue; |
|
3164 |
||
3165 |
if (how == DELETE) |
|
3166 |
return null; |
|
3167 |
||
3168 |
newNode = n.cloneNode(false); |
|
3169 |
newNode.nodeValue = newNodeValue; |
|
3170 |
||
3171 |
return newNode; |
|
3172 |
} |
|
3173 |
||
3174 |
if (how == DELETE) |
|
3175 |
return null; |
|
3176 |
||
3177 |
return n.cloneNode(false); |
|
3178 |
}, |
|
3179 |
||
3180 |
_traverseFullySelected : function(n, how) { |
|
3181 |
var t = this; |
|
3182 |
||
3183 |
if (how != DELETE) |
|
3184 |
return how == CLONE ? n.cloneNode(true) : n; |
|
3185 |
||
3186 |
n.parentNode.removeChild(n); |
|
3187 |
return null; |
|
3188 |
} |
|
3189 |
}); |
|
3190 |
||
3191 |
ns.Range = Range; |
|
3192 |
})(tinymce.dom); |
|
3193 |
(function() { |
|
3194 |
function Selection(selection) { |
|
3195 |
var t = this, invisibleChar = '\uFEFF', range, lastIERng; |
|
3196 |
||
3197 |
function compareRanges(rng1, rng2) { |
|
3198 |
if (rng1 && rng2) { |
|
3199 |
// Both are control ranges and the selected element matches |
|
3200 |
if (rng1.item && rng2.item && rng1.item(0) === rng2.item(0)) |
|
3201 |
return 1; |
|
3202 |
||
3203 |
// Both are text ranges and the range matches |
|
3204 |
if (rng1.isEqual && rng2.isEqual && rng2.isEqual(rng1)) |
|
3205 |
return 1; |
|
3206 |
} |
|
3207 |
||
3208 |
return 0; |
|
3209 |
}; |
|
3210 |
||
3211 |
function getRange() { |
|
3212 |
var dom = selection.dom, ieRange = selection.getRng(), domRange = dom.createRng(), startPos, endPos, element, sc, ec, collapsed; |
|
3213 |
||
3214 |
function findIndex(element) { |
|
3215 |
var nl = element.parentNode.childNodes, i; |
|
3216 |
||
3217 |
for (i = nl.length - 1; i >= 0; i--) { |
|
3218 |
if (nl[i] == element) |
|
3219 |
return i; |
|
3220 |
} |
|
3221 |
||
3222 |
return -1; |
|
3223 |
}; |
|
3224 |
||
3225 |
function findEndPoint(start) { |
|
3226 |
var rng = ieRange.duplicate(), parent, i, nl, n, offset = 0, index = 0, pos, tmpRng; |
|
3227 |
||
3228 |
// Insert marker character |
|
3229 |
rng.collapse(start); |
|
3230 |
parent = rng.parentElement(); |
|
3231 |
rng.pasteHTML(invisibleChar); // Needs to be a pasteHTML instead of .text = since IE has a bug with nodeValue |
|
3232 |
||
3233 |
// Find marker character |
|
3234 |
nl = parent.childNodes; |
|
3235 |
for (i = 0; i < nl.length; i++) { |
|
3236 |
n = nl[i]; |
|
3237 |
||
3238 |
// Calculate node index excluding text node fragmentation |
|
3239 |
if (i > 0 && (n.nodeType !== 3 || nl[i - 1].nodeType !== 3)) |
|
3240 |
index++; |
|
3241 |
||
3242 |
// If text node then calculate offset |
|
3243 |
if (n.nodeType === 3) { |
|
3244 |
// Look for marker |
|
3245 |
pos = n.nodeValue.indexOf(invisibleChar); |
|
3246 |
if (pos !== -1) { |
|
3247 |
offset += pos; |
|
3248 |
break; |
|
3249 |
} |
|
3250 |
||
3251 |
offset += n.nodeValue.length; |
|
3252 |
} else |
|
3253 |
offset = 0; |
|
3254 |
} |
|
3255 |
||
3256 |
// Remove marker character |
|
3257 |
rng.moveStart('character', -1); |
|
3258 |
rng.text = ''; |
|
3259 |
||
3260 |
return {index : index, offset : offset, parent : parent}; |
|
3261 |
}; |
|
3262 |
||
3263 |
// If selection is outside the current document just return an empty range |
|
3264 |
element = ieRange.item ? ieRange.item(0) : ieRange.parentElement(); |
|
3265 |
if (element.ownerDocument != dom.doc) |
|
3266 |
return domRange; |
|
3267 |
||
3268 |
// Handle control selection or text selection of a image |
|
3269 |
if (ieRange.item || !element.hasChildNodes()) { |
|
3270 |
domRange.setStart(element.parentNode, findIndex(element)); |
|
3271 |
domRange.setEnd(domRange.startContainer, domRange.startOffset + 1); |
|
3272 |
||
3273 |
return domRange; |
|
3274 |
} |
|
3275 |
||
3276 |
// Check collapsed state |
|
3277 |
collapsed = selection.isCollapsed(); |
|
3278 |
||
3279 |
// Find start and end pos index and offset |
|
3280 |
startPos = findEndPoint(true); |
|
3281 |
endPos = findEndPoint(false); |
|
3282 |
||
3283 |
// Normalize the elements to avoid fragmented dom |
|
3284 |
startPos.parent.normalize(); |
|
3285 |
endPos.parent.normalize(); |
|
3286 |
||
3287 |
// Set start container and offset |
|
3288 |
sc = startPos.parent.childNodes[Math.min(startPos.index, startPos.parent.childNodes.length - 1)]; |
|
3289 |
||
3290 |
if (sc.nodeType != 3) |
|
3291 |
domRange.setStart(startPos.parent, startPos.index); |
|
3292 |
else |
|
3293 |
domRange.setStart(startPos.parent.childNodes[startPos.index], startPos.offset); |
|
3294 |
||
3295 |
// Set end container and offset |
|
3296 |
ec = endPos.parent.childNodes[Math.min(endPos.index, endPos.parent.childNodes.length - 1)]; |
|
3297 |
||
3298 |
if (ec.nodeType != 3) { |
|
3299 |
if (!collapsed) |
|
3300 |
endPos.index++; |
|
3301 |
||
3302 |
domRange.setEnd(endPos.parent, endPos.index); |
|
3303 |
} else |
|
3304 |
domRange.setEnd(endPos.parent.childNodes[endPos.index], endPos.offset); |
|
3305 |
||
3306 |
// If not collapsed then make sure offsets are valid |
|
3307 |
if (!collapsed) { |
|
3308 |
sc = domRange.startContainer; |
|
3309 |
if (sc.nodeType == 1) |
|
3310 |
domRange.setStart(sc, Math.min(domRange.startOffset, sc.childNodes.length)); |
|
3311 |
||
3312 |
ec = domRange.endContainer; |
|
3313 |
if (ec.nodeType == 1) |
|
3314 |
domRange.setEnd(ec, Math.min(domRange.endOffset, ec.childNodes.length)); |
|
3315 |
} |
|
3316 |
||
3317 |
// Restore selection to new range |
|
3318 |
t.addRange(domRange); |
|
3319 |
||
3320 |
return domRange; |
|
3321 |
}; |
|
3322 |
||
3323 |
this.addRange = function(rng) { |
|
3324 |
var ieRng, body = selection.dom.doc.body, startPos, endPos, sc, so, ec, eo; |
|
3325 |
||
3326 |
// Setup some shorter versions |
|
3327 |
sc = rng.startContainer; |
|
3328 |
so = rng.startOffset; |
|
3329 |
ec = rng.endContainer; |
|
3330 |
eo = rng.endOffset; |
|
3331 |
ieRng = body.createTextRange(); |
|
3332 |
||
3333 |
// Find element |
|
3334 |
sc = sc.nodeType == 1 ? sc.childNodes[Math.min(so, sc.childNodes.length - 1)] : sc; |
|
3335 |
ec = ec.nodeType == 1 ? ec.childNodes[Math.min(so == eo ? eo : eo - 1, ec.childNodes.length - 1)] : ec; |
|
3336 |
||
3337 |
// Single element selection |
|
3338 |
if (sc == ec && sc.nodeType == 1) { |
|
3339 |
// Make control selection for some elements |
|
3340 |
if (/^(IMG|TABLE)$/.test(sc.nodeName) && so != eo) { |
|
3341 |
ieRng = body.createControlRange(); |
|
3342 |
ieRng.addElement(sc); |
|
3343 |
} else { |
|
3344 |
ieRng = body.createTextRange(); |
|
3345 |
||
3346 |
// Padd empty elements with invisible character |
|
3347 |
if (!sc.hasChildNodes() && sc.canHaveHTML) |
|
3348 |
sc.innerHTML = invisibleChar; |
|
3349 |
||
3350 |
// Select element contents |
|
3351 |
ieRng.moveToElementText(sc); |
|
3352 |
||
3353 |
// If it's only containing a padding remove it so the caret remains |
|
3354 |
if (sc.innerHTML == invisibleChar) { |
|
3355 |
ieRng.collapse(true); |
|
3356 |
sc.removeChild(sc.firstChild); |
|
3357 |
} |
|
3358 |
} |
|
3359 |
||
3360 |
if (so == eo) |
|
3361 |
ieRng.collapse(eo <= rng.endContainer.childNodes.length - 1); |
|
3362 |
||
3363 |
ieRng.select(); |
|
3364 |
||
3365 |
return; |
|
3366 |
} |
|
3367 |
||
3368 |
function getCharPos(container, offset) { |
|
3369 |
var nodeVal, rng, pos; |
|
3370 |
||
3371 |
if (container.nodeType != 3) |
|
3372 |
return -1; |
|
3373 |
||
3374 |
nodeVal = container.nodeValue; |
|
3375 |
rng = body.createTextRange(); |
|
3376 |
||
3377 |
// Insert marker at offset position |
|
3378 |
container.nodeValue = nodeVal.substring(0, offset) + invisibleChar + nodeVal.substring(offset); |
|
3379 |
||
3380 |
// Find char pos of marker and remove it |
|
3381 |
rng.moveToElementText(container.parentNode); |
|
3382 |
rng.findText(invisibleChar); |
|
3383 |
pos = Math.abs(rng.moveStart('character', -0xFFFFF)); |
|
3384 |
container.nodeValue = nodeVal; |
|
3385 |
||
3386 |
return pos; |
|
3387 |
}; |
|
3388 |
||
3389 |
// Collapsed range |
|
3390 |
if (rng.collapsed) { |
|
3391 |
pos = getCharPos(sc, so); |
|
3392 |
||
3393 |
ieRng = body.createTextRange(); |
|
3394 |
ieRng.move('character', pos); |
|
3395 |
ieRng.select(); |
|
3396 |
||
3397 |
return; |
|
3398 |
} else { |
|
3399 |
// If same text container |
|
3400 |
if (sc == ec && sc.nodeType == 3) { |
|
3401 |
startPos = getCharPos(sc, so); |
|
3402 |
||
3403 |
ieRng = body.createTextRange(); |
|
3404 |
ieRng.move('character', startPos); |
|
3405 |
ieRng.moveEnd('character', eo - so); |
|
3406 |
ieRng.select(); |
|
3407 |
||
3408 |
return; |
|
3409 |
} |
|
3410 |
||
3411 |
// Get caret positions |
|
3412 |
startPos = getCharPos(sc, so); |
|
3413 |
endPos = getCharPos(ec, eo); |
|
3414 |
ieRng = body.createTextRange(); |
|
3415 |
||
3416 |
// Move start of range to start character position or start element |
|
3417 |
if (startPos == -1) { |
|
3418 |
ieRng.moveToElementText(sc); |
|
3419 |
startPos = 0; |
|
3420 |
} else |
|
3421 |
ieRng.move('character', startPos); |
|
3422 |
||
3423 |
// Move end of range to end character position or end element |
|
3424 |
tmpRng = body.createTextRange(); |
|
3425 |
||
3426 |
if (endPos == -1) |
|
3427 |
tmpRng.moveToElementText(ec); |
|
3428 |
else |
|
3429 |
tmpRng.move('character', endPos); |
|
3430 |
||
3431 |
ieRng.setEndPoint('EndToEnd', tmpRng); |
|
3432 |
ieRng.select(); |
|
3433 |
||
3434 |
return; |
|
3435 |
} |
|
3436 |
}; |
|
3437 |
||
3438 |
this.getRangeAt = function() { |
|
3439 |
// Setup new range if the cache is empty |
|
3440 |
if (!range || !compareRanges(lastIERng, selection.getRng())) { |
|
3441 |
range = getRange(); |
|
3442 |
||
3443 |
// Store away text range for next call |
|
3444 |
lastIERng = selection.getRng(); |
|
3445 |
} |
|
3446 |
||
3447 |
// Return cached range |
|
3448 |
return range; |
|
3449 |
}; |
|
3450 |
||
3451 |
this.destroy = function() { |
|
3452 |
// Destroy cached range and last IE range to avoid memory leaks |
|
3453 |
lastIERng = range = null; |
|
3454 |
}; |
|
3455 |
}; |
|
3456 |
||
3457 |
// Expose the selection object |
|
3458 |
tinymce.dom.TridentSelection = Selection; |
|
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:
117
diff
changeset
|
3459 |
})(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
3460 |
|
1193 | 3461 |
/* |
3462 |
* Sizzle CSS Selector Engine - v1.0 |
|
3463 |
* Copyright 2009, The Dojo Foundation |
|
3464 |
* Released under the MIT, BSD, and GPL Licenses. |
|
3465 |
* More information: http://sizzlejs.com/ |
|
3466 |
*/ |
|
3467 |
(function(){ |
|
3468 |
||
3469 |
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g, |
|
3470 |
done = 0, |
|
3471 |
toString = Object.prototype.toString, |
|
3472 |
hasDuplicate = false; |
|
3473 |
||
3474 |
var Sizzle = function(selector, context, results, seed) { |
|
3475 |
results = results || []; |
|
3476 |
var origContext = context = context || document; |
|
3477 |
||
3478 |
if ( context.nodeType !== 1 && context.nodeType !== 9 ) { |
|
3479 |
return []; |
|
3480 |
} |
|
3481 |
||
3482 |
if ( !selector || typeof selector !== "string" ) { |
|
3483 |
return results; |
|
3484 |
} |
|
3485 |
||
3486 |
var parts = [], m, set, checkSet, check, mode, extra, prune = true, contextXML = isXML(context); |
|
3487 |
||
3488 |
// Reset the position of the chunker regexp (start from head) |
|
3489 |
chunker.lastIndex = 0; |
|
3490 |
||
3491 |
while ( (m = chunker.exec(selector)) !== null ) { |
|
3492 |
parts.push( m[1] ); |
|
3493 |
||
3494 |
if ( m[2] ) { |
|
3495 |
extra = RegExp.rightContext; |
|
3496 |
break; |
|
3497 |
} |
|
3498 |
} |
|
3499 |
||
3500 |
if ( parts.length > 1 && origPOS.exec( selector ) ) { |
|
3501 |
if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { |
|
3502 |
set = posProcess( parts[0] + parts[1], context ); |
|
3503 |
} else { |
|
3504 |
set = Expr.relative[ parts[0] ] ? |
|
3505 |
[ context ] : |
|
3506 |
Sizzle( parts.shift(), context ); |
|
3507 |
||
3508 |
while ( parts.length ) { |
|
3509 |
selector = parts.shift(); |
|
3510 |
||
3511 |
if ( Expr.relative[ selector ] ) |
|
3512 |
selector += parts.shift(); |
|
3513 |
||
3514 |
set = posProcess( selector, set ); |
|
3515 |
} |
|
3516 |
} |
|
3517 |
} else { |
|
3518 |
// Take a shortcut and set the context if the root selector is an ID |
|
3519 |
// (but not if it'll be faster if the inner selector is an ID) |
|
3520 |
if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && |
|
3521 |
Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { |
|
3522 |
var ret = Sizzle.find( parts.shift(), context, contextXML ); |
|
3523 |
context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0]; |
|
3524 |
} |
|
3525 |
||
3526 |
if ( context ) { |
|
3527 |
var ret = seed ? |
|
3528 |
{ expr: parts.pop(), set: makeArray(seed) } : |
|
3529 |
Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); |
|
3530 |
set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set; |
|
3531 |
||
3532 |
if ( parts.length > 0 ) { |
|
3533 |
checkSet = makeArray(set); |
|
3534 |
} else { |
|
3535 |
prune = false; |
|
3536 |
} |
|
3537 |
||
3538 |
while ( parts.length ) { |
|
3539 |
var cur = parts.pop(), pop = cur; |
|
3540 |
||
3541 |
if ( !Expr.relative[ cur ] ) { |
|
3542 |
cur = ""; |
|
3543 |
} else { |
|
3544 |
pop = parts.pop(); |
|
3545 |
} |
|
3546 |
||
3547 |
if ( pop == null ) { |
|
3548 |
pop = context; |
|
3549 |
} |
|
3550 |
||
3551 |
Expr.relative[ cur ]( checkSet, pop, contextXML ); |
|
3552 |
} |
|
3553 |
} else { |
|
3554 |
checkSet = parts = []; |
|
3555 |
} |
|
3556 |
} |
|
3557 |
||
3558 |
if ( !checkSet ) { |
|
3559 |
checkSet = set; |
|
3560 |
} |
|
3561 |
||
3562 |
if ( !checkSet ) { |
|
3563 |
throw "Syntax error, unrecognized expression: " + (cur || selector); |
|
3564 |
} |
|
3565 |
||
3566 |
if ( toString.call(checkSet) === "[object Array]" ) { |
|
3567 |
if ( !prune ) { |
|
3568 |
results.push.apply( results, checkSet ); |
|
3569 |
} else if ( context && context.nodeType === 1 ) { |
|
3570 |
for ( var i = 0; checkSet[i] != null; i++ ) { |
|
3571 |
if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) { |
|
3572 |
results.push( set[i] ); |
|
3573 |
} |
|
3574 |
} |
|
3575 |
} else { |
|
3576 |
for ( var i = 0; checkSet[i] != null; i++ ) { |
|
3577 |
if ( checkSet[i] && checkSet[i].nodeType === 1 ) { |
|
3578 |
results.push( set[i] ); |
|
3579 |
} |
|
3580 |
} |
|
3581 |
} |
|
3582 |
} else { |
|
3583 |
makeArray( checkSet, results ); |
|
3584 |
} |
|
3585 |
||
3586 |
if ( extra ) { |
|
3587 |
Sizzle( extra, origContext, results, seed ); |
|
3588 |
Sizzle.uniqueSort( results ); |
|
3589 |
} |
|
3590 |
||
3591 |
return results; |
|
3592 |
}; |
|
3593 |
||
3594 |
Sizzle.uniqueSort = function(results){ |
|
3595 |
if ( sortOrder ) { |
|
3596 |
hasDuplicate = false; |
|
3597 |
results.sort(sortOrder); |
|
3598 |
||
3599 |
if ( hasDuplicate ) { |
|
3600 |
for ( var i = 1; i < results.length; i++ ) { |
|
3601 |
if ( results[i] === results[i-1] ) { |
|
3602 |
results.splice(i--, 1); |
|
3603 |
} |
|
3604 |
} |
|
3605 |
} |
|
3606 |
} |
|
3607 |
}; |
|
3608 |
||
3609 |
Sizzle.matches = function(expr, set){ |
|
3610 |
return Sizzle(expr, null, null, set); |
|
3611 |
}; |
|
3612 |
||
3613 |
Sizzle.find = function(expr, context, isXML){ |
|
3614 |
var set, match; |
|
3615 |
||
3616 |
if ( !expr ) { |
|
3617 |
return []; |
|
3618 |
} |
|
3619 |
||
3620 |
for ( var i = 0, l = Expr.order.length; i < l; i++ ) { |
|
3621 |
var type = Expr.order[i], match; |
|
3622 |
||
3623 |
if ( (match = Expr.match[ type ].exec( expr )) ) { |
|
3624 |
var left = RegExp.leftContext; |
|
3625 |
||
3626 |
if ( left.substr( left.length - 1 ) !== "\\" ) { |
|
3627 |
match[1] = (match[1] || "").replace(/\\/g, ""); |
|
3628 |
set = Expr.find[ type ]( match, context, isXML ); |
|
3629 |
if ( set != null ) { |
|
3630 |
expr = expr.replace( Expr.match[ type ], "" ); |
|
3631 |
break; |
|
3632 |
} |
|
3633 |
} |
|
3634 |
} |
|
3635 |
} |
|
3636 |
||
3637 |
if ( !set ) { |
|
3638 |
set = context.getElementsByTagName("*"); |
|
3639 |
} |
|
3640 |
||
3641 |
return {set: set, expr: expr}; |
|
3642 |
}; |
|
3643 |
||
3644 |
Sizzle.filter = function(expr, set, inplace, not){ |
|
3645 |
var old = expr, result = [], curLoop = set, match, anyFound, |
|
3646 |
isXMLFilter = set && set[0] && isXML(set[0]); |
|
3647 |
||
3648 |
while ( expr && set.length ) { |
|
3649 |
for ( var type in Expr.filter ) { |
|
3650 |
if ( (match = Expr.match[ type ].exec( expr )) != null ) { |
|
3651 |
var filter = Expr.filter[ type ], found, item; |
|
3652 |
anyFound = false; |
|
3653 |
||
3654 |
if ( curLoop == result ) { |
|
3655 |
result = []; |
|
3656 |
} |
|
3657 |
||
3658 |
if ( Expr.preFilter[ type ] ) { |
|
3659 |
match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); |
|
3660 |
||
3661 |
if ( !match ) { |
|
3662 |
anyFound = found = true; |
|
3663 |
} else if ( match === true ) { |
|
3664 |
continue; |
|
3665 |
} |
|
3666 |
} |
|
3667 |
||
3668 |
if ( match ) { |
|
3669 |
for ( var i = 0; (item = curLoop[i]) != null; i++ ) { |
|
3670 |
if ( item ) { |
|
3671 |
found = filter( item, match, i, curLoop ); |
|
3672 |
var pass = not ^ !!found; |
|
3673 |
||
3674 |
if ( inplace && found != null ) { |
|
3675 |
if ( pass ) { |
|
3676 |
anyFound = true; |
|
3677 |
} else { |
|
3678 |
curLoop[i] = false; |
|
3679 |
} |
|
3680 |
} else if ( pass ) { |
|
3681 |
result.push( item ); |
|
3682 |
anyFound = true; |
|
3683 |
} |
|
3684 |
} |
|
3685 |
} |
|
3686 |
} |
|
3687 |
||
3688 |
if ( found !== undefined ) { |
|
3689 |
if ( !inplace ) { |
|
3690 |
curLoop = result; |
|
3691 |
} |
|
3692 |
||
3693 |
expr = expr.replace( Expr.match[ type ], "" ); |
|
3694 |
||
3695 |
if ( !anyFound ) { |
|
3696 |
return []; |
|
3697 |
} |
|
3698 |
||
3699 |
break; |
|
3700 |
} |
|
3701 |
} |
|
3702 |
} |
|
3703 |
||
3704 |
// Improper expression |
|
3705 |
if ( expr == old ) { |
|
3706 |
if ( anyFound == null ) { |
|
3707 |
throw "Syntax error, unrecognized expression: " + expr; |
|
3708 |
} else { |
|
3709 |
break; |
|
3710 |
} |
|
3711 |
} |
|
3712 |
||
3713 |
old = expr; |
|
3714 |
} |
|
3715 |
||
3716 |
return curLoop; |
|
3717 |
}; |
|
3718 |
||
3719 |
var Expr = Sizzle.selectors = { |
|
3720 |
order: [ "ID", "NAME", "TAG" ], |
|
3721 |
match: { |
|
3722 |
ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/, |
|
3723 |
CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/, |
|
3724 |
NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/, |
|
3725 |
ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, |
|
3726 |
TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/, |
|
3727 |
CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, |
|
3728 |
POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, |
|
3729 |
PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/ |
|
3730 |
}, |
|
3731 |
attrMap: { |
|
3732 |
"class": "className", |
|
3733 |
"for": "htmlFor" |
|
3734 |
}, |
|
3735 |
attrHandle: { |
|
3736 |
href: function(elem){ |
|
3737 |
return elem.getAttribute("href"); |
|
3738 |
} |
|
3739 |
}, |
|
3740 |
relative: { |
|
3741 |
"+": function(checkSet, part, isXML){ |
|
3742 |
var isPartStr = typeof part === "string", |
|
3743 |
isTag = isPartStr && !/\W/.test(part), |
|
3744 |
isPartStrNotTag = isPartStr && !isTag; |
|
3745 |
||
3746 |
if ( isTag && !isXML ) { |
|
3747 |
part = part.toUpperCase(); |
|
3748 |
} |
|
3749 |
||
3750 |
for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { |
|
3751 |
if ( (elem = checkSet[i]) ) { |
|
3752 |
while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} |
|
3753 |
||
3754 |
checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ? |
|
3755 |
elem || false : |
|
3756 |
elem === part; |
|
3757 |
} |
|
3758 |
} |
|
3759 |
||
3760 |
if ( isPartStrNotTag ) { |
|
3761 |
Sizzle.filter( part, checkSet, true ); |
|
3762 |
} |
|
3763 |
}, |
|
3764 |
">": function(checkSet, part, isXML){ |
|
3765 |
var isPartStr = typeof part === "string"; |
|
3766 |
||
3767 |
if ( isPartStr && !/\W/.test(part) ) { |
|
3768 |
part = isXML ? part : part.toUpperCase(); |
|
3769 |
||
3770 |
for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
|
3771 |
var elem = checkSet[i]; |
|
3772 |
if ( elem ) { |
|
3773 |
var parent = elem.parentNode; |
|
3774 |
checkSet[i] = parent.nodeName === part ? parent : false; |
|
3775 |
} |
|
3776 |
} |
|
3777 |
} else { |
|
3778 |
for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
|
3779 |
var elem = checkSet[i]; |
|
3780 |
if ( elem ) { |
|
3781 |
checkSet[i] = isPartStr ? |
|
3782 |
elem.parentNode : |
|
3783 |
elem.parentNode === part; |
|
3784 |
} |
|
3785 |
} |
|
3786 |
||
3787 |
if ( isPartStr ) { |
|
3788 |
Sizzle.filter( part, checkSet, true ); |
|
3789 |
} |
|
3790 |
} |
|
3791 |
}, |
|
3792 |
"": function(checkSet, part, isXML){ |
|
3793 |
var doneName = done++, checkFn = dirCheck; |
|
3794 |
||
3795 |
if ( !part.match(/\W/) ) { |
|
3796 |
var nodeCheck = part = isXML ? part : part.toUpperCase(); |
|
3797 |
checkFn = dirNodeCheck; |
|
3798 |
} |
|
3799 |
||
3800 |
checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); |
|
3801 |
}, |
|
3802 |
"~": function(checkSet, part, isXML){ |
|
3803 |
var doneName = done++, checkFn = dirCheck; |
|
3804 |
||
3805 |
if ( typeof part === "string" && !part.match(/\W/) ) { |
|
3806 |
var nodeCheck = part = isXML ? part : part.toUpperCase(); |
|
3807 |
checkFn = dirNodeCheck; |
|
3808 |
} |
|
3809 |
||
3810 |
checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); |
|
3811 |
} |
|
3812 |
}, |
|
3813 |
find: { |
|
3814 |
ID: function(match, context, isXML){ |
|
3815 |
if ( typeof context.getElementById !== "undefined" && !isXML ) { |
|
3816 |
var m = context.getElementById(match[1]); |
|
3817 |
return m ? [m] : []; |
|
3818 |
} |
|
3819 |
}, |
|
3820 |
NAME: function(match, context, isXML){ |
|
3821 |
if ( typeof context.getElementsByName !== "undefined" ) { |
|
3822 |
var ret = [], results = context.getElementsByName(match[1]); |
|
3823 |
||
3824 |
for ( var i = 0, l = results.length; i < l; i++ ) { |
|
3825 |
if ( results[i].getAttribute("name") === match[1] ) { |
|
3826 |
ret.push( results[i] ); |
|
3827 |
} |
|
3828 |
} |
|
3829 |
||
3830 |
return ret.length === 0 ? null : ret; |
|
3831 |
} |
|
3832 |
}, |
|
3833 |
TAG: function(match, context){ |
|
3834 |
return context.getElementsByTagName(match[1]); |
|
3835 |
} |
|
3836 |
}, |
|
3837 |
preFilter: { |
|
3838 |
CLASS: function(match, curLoop, inplace, result, not, isXML){ |
|
3839 |
match = " " + match[1].replace(/\\/g, "") + " "; |
|
3840 |
||
3841 |
if ( isXML ) { |
|
3842 |
return match; |
|
3843 |
} |
|
3844 |
||
3845 |
for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { |
|
3846 |
if ( elem ) { |
|
3847 |
if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) { |
|
3848 |
if ( !inplace ) |
|
3849 |
result.push( elem ); |
|
3850 |
} else if ( inplace ) { |
|
3851 |
curLoop[i] = false; |
|
3852 |
} |
|
3853 |
} |
|
3854 |
} |
|
3855 |
||
3856 |
return false; |
|
3857 |
}, |
|
3858 |
ID: function(match){ |
|
3859 |
return match[1].replace(/\\/g, ""); |
|
3860 |
}, |
|
3861 |
TAG: function(match, curLoop){ |
|
3862 |
for ( var i = 0; curLoop[i] === false; i++ ){} |
|
3863 |
return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase(); |
|
3864 |
}, |
|
3865 |
CHILD: function(match){ |
|
3866 |
if ( match[1] == "nth" ) { |
|
3867 |
// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' |
|
3868 |
var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( |
|
3869 |
match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" || |
|
3870 |
!/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); |
|
3871 |
||
3872 |
// calculate the numbers (first)n+(last) including if they are negative |
|
3873 |
match[2] = (test[1] + (test[2] || 1)) - 0; |
|
3874 |
match[3] = test[3] - 0; |
|
3875 |
} |
|
3876 |
||
3877 |
// TODO: Move to normal caching system |
|
3878 |
match[0] = done++; |
|
3879 |
||
3880 |
return match; |
|
3881 |
}, |
|
3882 |
ATTR: function(match, curLoop, inplace, result, not, isXML){ |
|
3883 |
var name = match[1].replace(/\\/g, ""); |
|
3884 |
||
3885 |
if ( !isXML && Expr.attrMap[name] ) { |
|
3886 |
match[1] = Expr.attrMap[name]; |
|
3887 |
} |
|
3888 |
||
3889 |
if ( match[2] === "~=" ) { |
|
3890 |
match[4] = " " + match[4] + " "; |
|
3891 |
} |
|
3892 |
||
3893 |
return match; |
|
3894 |
}, |
|
3895 |
PSEUDO: function(match, curLoop, inplace, result, not){ |
|
3896 |
if ( match[1] === "not" ) { |
|
3897 |
// If we're dealing with a complex expression, or a simple one |
|
3898 |
if ( match[3].match(chunker).length > 1 || /^\w/.test(match[3]) ) { |
|
3899 |
match[3] = Sizzle(match[3], null, null, curLoop); |
|
3900 |
} else { |
|
3901 |
var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); |
|
3902 |
if ( !inplace ) { |
|
3903 |
result.push.apply( result, ret ); |
|
3904 |
} |
|
3905 |
return false; |
|
3906 |
} |
|
3907 |
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { |
|
3908 |
return true; |
|
3909 |
} |
|
3910 |
||
3911 |
return match; |
|
3912 |
}, |
|
3913 |
POS: function(match){ |
|
3914 |
match.unshift( true ); |
|
3915 |
return match; |
|
3916 |
} |
|
3917 |
}, |
|
3918 |
filters: { |
|
3919 |
enabled: function(elem){ |
|
3920 |
return elem.disabled === false && elem.type !== "hidden"; |
|
3921 |
}, |
|
3922 |
disabled: function(elem){ |
|
3923 |
return elem.disabled === true; |
|
3924 |
}, |
|
3925 |
checked: function(elem){ |
|
3926 |
return elem.checked === true; |
|
3927 |
}, |
|
3928 |
selected: function(elem){ |
|
3929 |
// Accessing this property makes selected-by-default |
|
3930 |
// options in Safari work properly |
|
3931 |
elem.parentNode.selectedIndex; |
|
3932 |
return elem.selected === true; |
|
3933 |
}, |
|
3934 |
parent: function(elem){ |
|
3935 |
return !!elem.firstChild; |
|
3936 |
}, |
|
3937 |
empty: function(elem){ |
|
3938 |
return !elem.firstChild; |
|
3939 |
}, |
|
3940 |
has: function(elem, i, match){ |
|
3941 |
return !!Sizzle( match[3], elem ).length; |
|
3942 |
}, |
|
3943 |
header: function(elem){ |
|
3944 |
return /h\d/i.test( elem.nodeName ); |
|
3945 |
}, |
|
3946 |
text: function(elem){ |
|
3947 |
return "text" === elem.type; |
|
3948 |
}, |
|
3949 |
radio: function(elem){ |
|
3950 |
return "radio" === elem.type; |
|
3951 |
}, |
|
3952 |
checkbox: function(elem){ |
|
3953 |
return "checkbox" === elem.type; |
|
3954 |
}, |
|
3955 |
file: function(elem){ |
|
3956 |
return "file" === elem.type; |
|
3957 |
}, |
|
3958 |
password: function(elem){ |
|
3959 |
return "password" === elem.type; |
|
3960 |
}, |
|
3961 |
submit: function(elem){ |
|
3962 |
return "submit" === elem.type; |
|
3963 |
}, |
|
3964 |
image: function(elem){ |
|
3965 |
return "image" === elem.type; |
|
3966 |
}, |
|
3967 |
reset: function(elem){ |
|
3968 |
return "reset" === elem.type; |
|
3969 |
}, |
|
3970 |
button: function(elem){ |
|
3971 |
return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON"; |
|
3972 |
}, |
|
3973 |
input: function(elem){ |
|
3974 |
return /input|select|textarea|button/i.test(elem.nodeName); |
|
3975 |
} |
|
3976 |
}, |
|
3977 |
setFilters: { |
|
3978 |
first: function(elem, i){ |
|
3979 |
return i === 0; |
|
3980 |
}, |
|
3981 |
last: function(elem, i, match, array){ |
|
3982 |
return i === array.length - 1; |
|
3983 |
}, |
|
3984 |
even: function(elem, i){ |
|
3985 |
return i % 2 === 0; |
|
3986 |
}, |
|
3987 |
odd: function(elem, i){ |
|
3988 |
return i % 2 === 1; |
|
3989 |
}, |
|
3990 |
lt: function(elem, i, match){ |
|
3991 |
return i < match[3] - 0; |
|
3992 |
}, |
|
3993 |
gt: function(elem, i, match){ |
|
3994 |
return i > match[3] - 0; |
|
3995 |
}, |
|
3996 |
nth: function(elem, i, match){ |
|
3997 |
return match[3] - 0 == i; |
|
3998 |
}, |
|
3999 |
eq: function(elem, i, match){ |
|
4000 |
return match[3] - 0 == i; |
|
4001 |
} |
|
4002 |
}, |
|
4003 |
filter: { |
|
4004 |
PSEUDO: function(elem, match, i, array){ |
|
4005 |
var name = match[1], filter = Expr.filters[ name ]; |
|
4006 |
||
4007 |
if ( filter ) { |
|
4008 |
return filter( elem, i, match, array ); |
|
4009 |
} else if ( name === "contains" ) { |
|
4010 |
return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0; |
|
4011 |
} else if ( name === "not" ) { |
|
4012 |
var not = match[3]; |
|
4013 |
||
4014 |
for ( var i = 0, l = not.length; i < l; i++ ) { |
|
4015 |
if ( not[i] === elem ) { |
|
4016 |
return false; |
|
4017 |
} |
|
4018 |
} |
|
4019 |
||
4020 |
return true; |
|
4021 |
} |
|
4022 |
}, |
|
4023 |
CHILD: function(elem, match){ |
|
4024 |
var type = match[1], node = elem; |
|
4025 |
switch (type) { |
|
4026 |
case 'only': |
|
4027 |
case 'first': |
|
4028 |
while (node = node.previousSibling) { |
|
4029 |
if ( node.nodeType === 1 ) return false; |
|
4030 |
} |
|
4031 |
if ( type == 'first') return true; |
|
4032 |
node = elem; |
|
4033 |
case 'last': |
|
4034 |
while (node = node.nextSibling) { |
|
4035 |
if ( node.nodeType === 1 ) return false; |
|
4036 |
} |
|
4037 |
return true; |
|
4038 |
case 'nth': |
|
4039 |
var first = match[2], last = match[3]; |
|
4040 |
||
4041 |
if ( first == 1 && last == 0 ) { |
|
4042 |
return true; |
|
4043 |
} |
|
4044 |
||
4045 |
var doneName = match[0], |
|
4046 |
parent = elem.parentNode; |
|
4047 |
||
4048 |
if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { |
|
4049 |
var count = 0; |
|
4050 |
for ( node = parent.firstChild; node; node = node.nextSibling ) { |
|
4051 |
if ( node.nodeType === 1 ) { |
|
4052 |
node.nodeIndex = ++count; |
|
4053 |
} |
|
4054 |
} |
|
4055 |
parent.sizcache = doneName; |
|
4056 |
} |
|
4057 |
||
4058 |
var diff = elem.nodeIndex - last; |
|
4059 |
if ( first == 0 ) { |
|
4060 |
return diff == 0; |
|
4061 |
} else { |
|
4062 |
return ( diff % first == 0 && diff / first >= 0 ); |
|
4063 |
} |
|
4064 |
} |
|
4065 |
}, |
|
4066 |
ID: function(elem, match){ |
|
4067 |
return elem.nodeType === 1 && elem.getAttribute("id") === match; |
|
4068 |
}, |
|
4069 |
TAG: function(elem, match){ |
|
4070 |
return (match === "*" && elem.nodeType === 1) || elem.nodeName === match; |
|
4071 |
}, |
|
4072 |
CLASS: function(elem, match){ |
|
4073 |
return (" " + (elem.className || elem.getAttribute("class")) + " ") |
|
4074 |
.indexOf( match ) > -1; |
|
4075 |
}, |
|
4076 |
ATTR: function(elem, match){ |
|
4077 |
var name = match[1], |
|
4078 |
result = Expr.attrHandle[ name ] ? |
|
4079 |
Expr.attrHandle[ name ]( elem ) : |
|
4080 |
elem[ name ] != null ? |
|
4081 |
elem[ name ] : |
|
4082 |
elem.getAttribute( name ), |
|
4083 |
value = result + "", |
|
4084 |
type = match[2], |
|
4085 |
check = match[4]; |
|
4086 |
||
4087 |
return result == null ? |
|
4088 |
type === "!=" : |
|
4089 |
type === "=" ? |
|
4090 |
value === check : |
|
4091 |
type === "*=" ? |
|
4092 |
value.indexOf(check) >= 0 : |
|
4093 |
type === "~=" ? |
|
4094 |
(" " + value + " ").indexOf(check) >= 0 : |
|
4095 |
!check ? |
|
4096 |
value && result !== false : |
|
4097 |
type === "!=" ? |
|
4098 |
value != check : |
|
4099 |
type === "^=" ? |
|
4100 |
value.indexOf(check) === 0 : |
|
4101 |
type === "$=" ? |
|
4102 |
value.substr(value.length - check.length) === check : |
|
4103 |
type === "|=" ? |
|
4104 |
value === check || value.substr(0, check.length + 1) === check + "-" : |
|
4105 |
false; |
|
4106 |
}, |
|
4107 |
POS: function(elem, match, i, array){ |
|
4108 |
var name = match[2], filter = Expr.setFilters[ name ]; |
|
4109 |
||
4110 |
if ( filter ) { |
|
4111 |
return filter( elem, i, match, array ); |
|
4112 |
} |
|
4113 |
} |
|
4114 |
} |
|
4115 |
}; |
|
4116 |
||
4117 |
var origPOS = Expr.match.POS; |
|
4118 |
||
4119 |
for ( var type in Expr.match ) { |
|
4120 |
Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source ); |
|
4121 |
} |
|
4122 |
||
4123 |
var makeArray = function(array, results) { |
|
4124 |
array = Array.prototype.slice.call( array ); |
|
4125 |
||
4126 |
if ( results ) { |
|
4127 |
results.push.apply( results, array ); |
|
4128 |
return results; |
|
4129 |
} |
|
4130 |
||
4131 |
return array; |
|
4132 |
}; |
|
4133 |
||
4134 |
// Perform a simple check to determine if the browser is capable of |
|
4135 |
// converting a NodeList to an array using builtin methods. |
|
4136 |
try { |
|
4137 |
Array.prototype.slice.call( document.documentElement.childNodes ); |
|
4138 |
||
4139 |
// Provide a fallback method if it does not work |
|
4140 |
} catch(e){ |
|
4141 |
makeArray = function(array, results) { |
|
4142 |
var ret = results || []; |
|
4143 |
||
4144 |
if ( toString.call(array) === "[object Array]" ) { |
|
4145 |
Array.prototype.push.apply( ret, array ); |
|
4146 |
} else { |
|
4147 |
if ( typeof array.length === "number" ) { |
|
4148 |
for ( var i = 0, l = array.length; i < l; i++ ) { |
|
4149 |
ret.push( array[i] ); |
|
4150 |
} |
|
4151 |
} else { |
|
4152 |
for ( var i = 0; array[i]; i++ ) { |
|
4153 |
ret.push( array[i] ); |
|
4154 |
} |
|
4155 |
} |
|
4156 |
} |
|
4157 |
||
4158 |
return ret; |
|
4159 |
}; |
|
4160 |
} |
|
4161 |
||
4162 |
var sortOrder; |
|
4163 |
||
4164 |
if ( document.documentElement.compareDocumentPosition ) { |
|
4165 |
sortOrder = function( a, b ) { |
|
4166 |
var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; |
|
4167 |
if ( ret === 0 ) { |
|
4168 |
hasDuplicate = true; |
|
4169 |
} |
|
4170 |
return ret; |
|
4171 |
}; |
|
4172 |
} else if ( "sourceIndex" in document.documentElement ) { |
|
4173 |
sortOrder = function( a, b ) { |
|
4174 |
var ret = a.sourceIndex - b.sourceIndex; |
|
4175 |
if ( ret === 0 ) { |
|
4176 |
hasDuplicate = true; |
|
4177 |
} |
|
4178 |
return ret; |
|
4179 |
}; |
|
4180 |
} else if ( document.createRange ) { |
|
4181 |
sortOrder = function( a, b ) { |
|
4182 |
var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); |
|
4183 |
aRange.setStart(a, 0); |
|
4184 |
aRange.setEnd(a, 0); |
|
4185 |
bRange.setStart(b, 0); |
|
4186 |
bRange.setEnd(b, 0); |
|
4187 |
var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange); |
|
4188 |
if ( ret === 0 ) { |
|
4189 |
hasDuplicate = true; |
|
4190 |
} |
|
4191 |
return ret; |
|
4192 |
}; |
|
4193 |
} |
|
4194 |
||
4195 |
// Check to see if the browser returns elements by name when |
|
4196 |
// querying by getElementById (and provide a workaround) |
|
4197 |
(function(){ |
|
4198 |
// We're going to inject a fake input element with a specified name |
|
4199 |
var form = document.createElement("div"), |
|
4200 |
id = "script" + (new Date).getTime(); |
|
4201 |
form.innerHTML = "<a name='" + id + "'/>"; |
|
4202 |
||
4203 |
// Inject it into the root element, check its status, and remove it quickly |
|
4204 |
var root = document.documentElement; |
|
4205 |
root.insertBefore( form, root.firstChild ); |
|
4206 |
||
4207 |
// The workaround has to do additional checks after a getElementById |
|
4208 |
// Which slows things down for other browsers (hence the branching) |
|
4209 |
if ( !!document.getElementById( id ) ) { |
|
4210 |
Expr.find.ID = function(match, context, isXML){ |
|
4211 |
if ( typeof context.getElementById !== "undefined" && !isXML ) { |
|
4212 |
var m = context.getElementById(match[1]); |
|
4213 |
return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; |
|
4214 |
} |
|
4215 |
}; |
|
4216 |
||
4217 |
Expr.filter.ID = function(elem, match){ |
|
4218 |
var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); |
|
4219 |
return elem.nodeType === 1 && node && node.nodeValue === match; |
|
4220 |
}; |
|
4221 |
} |
|
4222 |
||
4223 |
root.removeChild( form ); |
|
4224 |
})(); |
|
4225 |
||
4226 |
(function(){ |
|
4227 |
// Check to see if the browser returns only elements |
|
4228 |
// when doing getElementsByTagName("*") |
|
4229 |
||
4230 |
// Create a fake element |
|
4231 |
var div = document.createElement("div"); |
|
4232 |
div.appendChild( document.createComment("") ); |
|
4233 |
||
4234 |
// Make sure no comments are found |
|
4235 |
if ( div.getElementsByTagName("*").length > 0 ) { |
|
4236 |
Expr.find.TAG = function(match, context){ |
|
4237 |
var results = context.getElementsByTagName(match[1]); |
|
4238 |
||
4239 |
// Filter out possible comments |
|
4240 |
if ( match[1] === "*" ) { |
|
4241 |
var tmp = []; |
|
4242 |
||
4243 |
for ( var i = 0; results[i]; i++ ) { |
|
4244 |
if ( results[i].nodeType === 1 ) { |
|
4245 |
tmp.push( results[i] ); |
|
4246 |
} |
|
4247 |
} |
|
4248 |
||
4249 |
results = tmp; |
|
4250 |
} |
|
4251 |
||
4252 |
return results; |
|
4253 |
}; |
|
4254 |
} |
|
4255 |
||
4256 |
// Check to see if an attribute returns normalized href attributes |
|
4257 |
div.innerHTML = "<a href='#'></a>"; |
|
4258 |
if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && |
|
4259 |
div.firstChild.getAttribute("href") !== "#" ) { |
|
4260 |
Expr.attrHandle.href = function(elem){ |
|
4261 |
return elem.getAttribute("href", 2); |
|
4262 |
}; |
|
4263 |
} |
|
4264 |
})(); |
|
4265 |
||
4266 |
if ( document.querySelectorAll ) (function(){ |
|
4267 |
var oldSizzle = Sizzle, div = document.createElement("div"); |
|
4268 |
div.innerHTML = "<p class='TEST'></p>"; |
|
4269 |
||
4270 |
// Safari can't handle uppercase or unicode characters when |
|
4271 |
// in quirks mode. |
|
4272 |
if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { |
|
4273 |
return; |
|
4274 |
} |
|
4275 |
||
4276 |
Sizzle = function(query, context, extra, seed){ |
|
4277 |
context = context || document; |
|
4278 |
||
4279 |
// Only use querySelectorAll on non-XML documents |
|
4280 |
// (ID selectors don't work in non-HTML documents) |
|
4281 |
if ( !seed && context.nodeType === 9 && !isXML(context) ) { |
|
4282 |
try { |
|
4283 |
return makeArray( context.querySelectorAll(query), extra ); |
|
4284 |
} catch(e){} |
|
4285 |
} |
|
4286 |
||
4287 |
return oldSizzle(query, context, extra, seed); |
|
4288 |
}; |
|
4289 |
||
4290 |
for ( var prop in oldSizzle ) { |
|
4291 |
Sizzle[ prop ] = oldSizzle[ prop ]; |
|
4292 |
} |
|
4293 |
})(); |
|
4294 |
||
4295 |
if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){ |
|
4296 |
var div = document.createElement("div"); |
|
4297 |
div.innerHTML = "<div class='test e'></div><div class='test'></div>"; |
|
4298 |
||
4299 |
// Opera can't find a second classname (in 9.6) |
|
4300 |
if ( div.getElementsByClassName("e").length === 0 ) |
|
4301 |
return; |
|
4302 |
||
4303 |
// Safari caches class attributes, doesn't catch changes (in 3.2) |
|
4304 |
div.lastChild.className = "e"; |
|
4305 |
||
4306 |
if ( div.getElementsByClassName("e").length === 1 ) |
|
4307 |
return; |
|
4308 |
||
4309 |
Expr.order.splice(1, 0, "CLASS"); |
|
4310 |
Expr.find.CLASS = function(match, context, isXML) { |
|
4311 |
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { |
|
4312 |
return context.getElementsByClassName(match[1]); |
|
4313 |
} |
|
4314 |
}; |
|
4315 |
})(); |
|
4316 |
||
4317 |
function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { |
|
4318 |
var sibDir = dir == "previousSibling" && !isXML; |
|
4319 |
for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
|
4320 |
var elem = checkSet[i]; |
|
4321 |
if ( elem ) { |
|
4322 |
if ( sibDir && elem.nodeType === 1 ){ |
|
4323 |
elem.sizcache = doneName; |
|
4324 |
elem.sizset = i; |
|
4325 |
} |
|
4326 |
elem = elem[dir]; |
|
4327 |
var match = false; |
|
4328 |
||
4329 |
while ( elem ) { |
|
4330 |
if ( elem.sizcache === doneName ) { |
|
4331 |
match = checkSet[elem.sizset]; |
|
4332 |
break; |
|
4333 |
} |
|
4334 |
||
4335 |
if ( elem.nodeType === 1 && !isXML ){ |
|
4336 |
elem.sizcache = doneName; |
|
4337 |
elem.sizset = i; |
|
4338 |
} |
|
4339 |
||
4340 |
if ( elem.nodeName === cur ) { |
|
4341 |
match = elem; |
|
4342 |
break; |
|
4343 |
} |
|
4344 |
||
4345 |
elem = elem[dir]; |
|
4346 |
} |
|
4347 |
||
4348 |
checkSet[i] = match; |
|
4349 |
} |
|
4350 |
} |
|
4351 |
} |
|
4352 |
||
4353 |
function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { |
|
4354 |
var sibDir = dir == "previousSibling" && !isXML; |
|
4355 |
for ( var i = 0, l = checkSet.length; i < l; i++ ) { |
|
4356 |
var elem = checkSet[i]; |
|
4357 |
if ( elem ) { |
|
4358 |
if ( sibDir && elem.nodeType === 1 ) { |
|
4359 |
elem.sizcache = doneName; |
|
4360 |
elem.sizset = i; |
|
4361 |
} |
|
4362 |
elem = elem[dir]; |
|
4363 |
var match = false; |
|
4364 |
||
4365 |
while ( elem ) { |
|
4366 |
if ( elem.sizcache === doneName ) { |
|
4367 |
match = checkSet[elem.sizset]; |
|
4368 |
break; |
|
4369 |
} |
|
4370 |
||
4371 |
if ( elem.nodeType === 1 ) { |
|
4372 |
if ( !isXML ) { |
|
4373 |
elem.sizcache = doneName; |
|
4374 |
elem.sizset = i; |
|
4375 |
} |
|
4376 |
if ( typeof cur !== "string" ) { |
|
4377 |
if ( elem === cur ) { |
|
4378 |
match = true; |
|
4379 |
break; |
|
4380 |
} |
|
4381 |
||
4382 |
} else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { |
|
4383 |
match = elem; |
|
4384 |
break; |
|
4385 |
} |
|
4386 |
} |
|
4387 |
||
4388 |
elem = elem[dir]; |
|
4389 |
} |
|
4390 |
||
4391 |
checkSet[i] = match; |
|
4392 |
} |
|
4393 |
} |
|
4394 |
} |
|
4395 |
||
4396 |
var contains = document.compareDocumentPosition ? function(a, b){ |
|
4397 |
return a.compareDocumentPosition(b) & 16; |
|
4398 |
} : function(a, b){ |
|
4399 |
return a !== b && (a.contains ? a.contains(b) : true); |
|
4400 |
}; |
|
4401 |
||
4402 |
var isXML = function(elem){ |
|
4403 |
return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || |
|
4404 |
!!elem.ownerDocument && elem.ownerDocument.documentElement.nodeName !== "HTML"; |
|
4405 |
}; |
|
4406 |
||
4407 |
var posProcess = function(selector, context){ |
|
4408 |
var tmpSet = [], later = "", match, |
|
4409 |
root = context.nodeType ? [context] : context; |
|
4410 |
||
4411 |
// Position selectors must be done after the filter |
|
4412 |
// And so must :not(positional) so we move all PSEUDOs to the end |
|
4413 |
while ( (match = Expr.match.PSEUDO.exec( selector )) ) { |
|
4414 |
later += match[0]; |
|
4415 |
selector = selector.replace( Expr.match.PSEUDO, "" ); |
|
4416 |
} |
|
4417 |
||
4418 |
selector = Expr.relative[selector] ? selector + "*" : selector; |
|
4419 |
||
4420 |
for ( var i = 0, l = root.length; i < l; i++ ) { |
|
4421 |
Sizzle( selector, root[i], tmpSet ); |
|
4422 |
} |
|
4423 |
||
4424 |
return Sizzle.filter( later, tmpSet ); |
|
4425 |
}; |
|
4426 |
||
4427 |
// EXPOSE |
|
4428 |
||
4429 |
window.tinymce.dom.Sizzle = Sizzle; |
|
4430 |
||
4431 |
})(); |
|
4432 |
||
4433 |
(function(tinymce) { |
|
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:
117
diff
changeset
|
4434 |
// Shorten names |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4435 |
var each = tinymce.each, DOM = tinymce.DOM, isIE = tinymce.isIE, isWebKit = tinymce.isWebKit, Event; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4436 |
|
1193 | 4437 |
tinymce.create('tinymce.dom.EventUtils', { |
4438 |
EventUtils : function() { |
|
4439 |
this.inits = []; |
|
4440 |
this.events = []; |
|
4441 |
}, |
|
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:
117
diff
changeset
|
4442 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4443 |
add : function(o, n, f, 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:
117
diff
changeset
|
4444 |
var cb, t = this, el = t.events, 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:
117
diff
changeset
|
4445 |
|
1193 | 4446 |
if (n instanceof Array) { |
4447 |
r = []; |
|
4448 |
||
4449 |
each(n, function(n) { |
|
4450 |
r.push(t.add(o, n, f, s)); |
|
4451 |
}); |
|
4452 |
||
4453 |
return r; |
|
4454 |
} |
|
4455 |
||
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:
117
diff
changeset
|
4456 |
// Handle array |
1193 | 4457 |
if (o && o.hasOwnProperty && o instanceof Array) { |
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:
117
diff
changeset
|
4458 |
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:
117
diff
changeset
|
4459 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4460 |
each(o, function(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:
117
diff
changeset
|
4461 |
o = DOM.get(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:
117
diff
changeset
|
4462 |
r.push(t.add(o, n, f, 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:
117
diff
changeset
|
4463 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4464 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4465 |
return 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:
117
diff
changeset
|
4466 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4467 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4468 |
o = DOM.get(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:
117
diff
changeset
|
4469 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4470 |
if (!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:
117
diff
changeset
|
4471 |
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:
117
diff
changeset
|
4472 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4473 |
// Setup event callback |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4474 |
cb = function(e) { |
1193 | 4475 |
// Is all events disabled |
4476 |
if (t.disabled) |
|
4477 |
return; |
|
4478 |
||
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:
117
diff
changeset
|
4479 |
e = e || window.event; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4480 |
|
1193 | 4481 |
// Patch in target, preventDefault and stopPropagation in IE it's W3C valid |
4482 |
if (e && isIE) { |
|
4483 |
if (!e.target) |
|
4484 |
e.target = e.srcElement; |
|
4485 |
||
4486 |
// Patch in preventDefault, stopPropagation methods for W3C compatibility |
|
4487 |
tinymce.extend(e, t._stoppers); |
|
4488 |
} |
|
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:
117
diff
changeset
|
4489 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4490 |
if (!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:
117
diff
changeset
|
4491 |
return f(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:
117
diff
changeset
|
4492 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4493 |
return f.call(s, 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:
117
diff
changeset
|
4494 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4495 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4496 |
if (n == 'unload') { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4497 |
tinymce.unloads.unshift({func : cb}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4498 |
return cb; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4499 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4500 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4501 |
if (n == 'init') { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4502 |
if (t.domLoaded) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4503 |
cb(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4504 |
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:
117
diff
changeset
|
4505 |
t.inits.push(cb); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4506 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4507 |
return cb; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4508 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4509 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4510 |
// Store away listener reference |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4511 |
el.push({ |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4512 |
obj : 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:
117
diff
changeset
|
4513 |
name : 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:
117
diff
changeset
|
4514 |
func : f, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4515 |
cfunc : cb, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4516 |
scope : 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:
117
diff
changeset
|
4517 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4518 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4519 |
t._add(o, n, cb); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4520 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4521 |
return f; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4522 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4523 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4524 |
remove : function(o, n, f) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4525 |
var t = this, a = t.events, s = false, 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:
117
diff
changeset
|
4526 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4527 |
// Handle array |
1193 | 4528 |
if (o && o.hasOwnProperty && o instanceof Array) { |
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:
117
diff
changeset
|
4529 |
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:
117
diff
changeset
|
4530 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4531 |
each(o, function(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:
117
diff
changeset
|
4532 |
o = DOM.get(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:
117
diff
changeset
|
4533 |
r.push(t.remove(o, n, f)); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4534 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4535 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4536 |
return 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:
117
diff
changeset
|
4537 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4538 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4539 |
o = DOM.get(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:
117
diff
changeset
|
4540 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4541 |
each(a, function(e, i) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4542 |
if (e.obj == o && e.name == n && (!f || (e.func == f || e.cfunc == f))) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4543 |
a.splice(i, 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:
117
diff
changeset
|
4544 |
t._remove(o, n, e.cfunc); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4545 |
s = 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:
117
diff
changeset
|
4546 |
return 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:
117
diff
changeset
|
4547 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4548 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4549 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4550 |
return 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:
117
diff
changeset
|
4551 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4552 |
|
543 | 4553 |
clear : function(o) { |
4554 |
var t = this, a = t.events, i, e; |
|
4555 |
||
4556 |
if (o) { |
|
4557 |
o = DOM.get(o); |
|
4558 |
||
4559 |
for (i = a.length - 1; i >= 0; i--) { |
|
4560 |
e = a[i]; |
|
4561 |
||
4562 |
if (e.obj === o) { |
|
4563 |
t._remove(e.obj, e.name, e.cfunc); |
|
4564 |
e.obj = e.cfunc = null; |
|
4565 |
a.splice(i, 1); |
|
4566 |
} |
|
4567 |
} |
|
4568 |
} |
|
4569 |
}, |
|
4570 |
||
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:
117
diff
changeset
|
4571 |
cancel : 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:
117
diff
changeset
|
4572 |
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:
117
diff
changeset
|
4573 |
return 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:
117
diff
changeset
|
4574 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4575 |
this.stop(e); |
1193 | 4576 |
|
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:
117
diff
changeset
|
4577 |
return this.prevent(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:
117
diff
changeset
|
4578 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4579 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4580 |
stop : 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:
117
diff
changeset
|
4581 |
if (e.stopPropagation) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4582 |
e.stopPropagation(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4583 |
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:
117
diff
changeset
|
4584 |
e.cancelBubble = 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:
117
diff
changeset
|
4585 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4586 |
return 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:
117
diff
changeset
|
4587 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4588 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4589 |
prevent : 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:
117
diff
changeset
|
4590 |
if (e.preventDefault) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4591 |
e.preventDefault(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4592 |
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:
117
diff
changeset
|
4593 |
e.returnValue = 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:
117
diff
changeset
|
4594 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4595 |
return 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:
117
diff
changeset
|
4596 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4597 |
|
1193 | 4598 |
destroy : function() { |
4599 |
var t = this; |
|
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:
117
diff
changeset
|
4600 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4601 |
each(t.events, function(e, i) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4602 |
t._remove(e.obj, e.name, e.cfunc); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4603 |
e.obj = e.cfunc = 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:
117
diff
changeset
|
4604 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4605 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4606 |
t.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:
117
diff
changeset
|
4607 |
t = 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:
117
diff
changeset
|
4608 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4609 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4610 |
_add : function(o, n, f) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4611 |
if (o.attachEvent) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4612 |
o.attachEvent('on' + n, f); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4613 |
else if (o.addEventListener) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4614 |
o.addEventListener(n, f, 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:
117
diff
changeset
|
4615 |
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:
117
diff
changeset
|
4616 |
o['on' + n] = f; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4617 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4618 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4619 |
_remove : function(o, n, f) { |
543 | 4620 |
if (o) { |
4621 |
try { |
|
4622 |
if (o.detachEvent) |
|
4623 |
o.detachEvent('on' + n, f); |
|
4624 |
else if (o.removeEventListener) |
|
4625 |
o.removeEventListener(n, f, false); |
|
4626 |
else |
|
4627 |
o['on' + n] = null; |
|
4628 |
} catch (ex) { |
|
4629 |
// Might fail with permission denined on IE so we just ignore that |
|
4630 |
} |
|
4631 |
} |
|
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:
117
diff
changeset
|
4632 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4633 |
|
1193 | 4634 |
_pageInit : function(win) { |
4635 |
var t = this; |
|
4636 |
||
4637 |
// Keep it from running more than once |
|
4638 |
if (t.domLoaded) |
|
778 | 4639 |
return; |
4640 |
||
1193 | 4641 |
t.domLoaded = true; |
4642 |
||
4643 |
each(t.inits, function(c) { |
|
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:
117
diff
changeset
|
4644 |
c(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4645 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4646 |
|
1193 | 4647 |
t.inits = []; |
4648 |
}, |
|
4649 |
||
4650 |
_wait : function(win) { |
|
4651 |
var t = this, doc = win.document; |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4652 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4653 |
// No need since the document is already loaded |
1193 | 4654 |
if (win.tinyMCE_GZ && tinyMCE_GZ.loaded) { |
4655 |
t.domLoaded = 1; |
|
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:
117
diff
changeset
|
4656 |
return; |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
4657 |
} |
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:
117
diff
changeset
|
4658 |
|
1193 | 4659 |
// Use IE method |
4660 |
if (doc.attachEvent) { |
|
4661 |
doc.attachEvent("onreadystatechange", function() { |
|
4662 |
if (doc.readyState === "complete") { |
|
4663 |
doc.detachEvent("onreadystatechange", arguments.callee); |
|
4664 |
t._pageInit(win); |
|
4665 |
} |
|
4666 |
}); |
|
4667 |
||
4668 |
if (doc.documentElement.doScroll && win == win.top) { |
|
4669 |
(function() { |
|
4670 |
if (t.domLoaded) |
|
4671 |
return; |
|
4672 |
||
4673 |
try { |
|
4674 |
// If IE is used, use the trick by Diego Perini |
|
4675 |
// http://javascript.nwbox.com/IEContentLoaded/ |
|
4676 |
doc.documentElement.doScroll("left"); |
|
4677 |
} catch (ex) { |
|
4678 |
setTimeout(arguments.callee, 0); |
|
4679 |
return; |
|
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:
117
diff
changeset
|
4680 |
} |
1193 | 4681 |
|
4682 |
t._pageInit(win); |
|
4683 |
})(); |
|
4684 |
} |
|
4685 |
} else if (doc.addEventListener) { |
|
4686 |
t._add(win, 'DOMContentLoaded', function() { |
|
4687 |
t._pageInit(win); |
|
4688 |
}); |
|
4689 |
} |
|
4690 |
||
4691 |
t._add(win, 'load', function() { |
|
4692 |
t._pageInit(win); |
|
4693 |
}); |
|
4694 |
}, |
|
4695 |
||
4696 |
_stoppers : { |
|
4697 |
preventDefault : function() { |
|
4698 |
this.returnValue = false; |
|
4699 |
}, |
|
4700 |
||
4701 |
stopPropagation : function() { |
|
4702 |
this.cancelBubble = true; |
|
4703 |
} |
|
4704 |
} |
|
4705 |
}); |
|
4706 |
||
4707 |
Event = tinymce.dom.Event = new tinymce.dom.EventUtils(); |
|
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:
117
diff
changeset
|
4708 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4709 |
// Dispatch DOM content loaded event for IE and Safari |
1193 | 4710 |
Event._wait(window); |
4711 |
||
4712 |
tinymce.addUnload(function() { |
|
4713 |
Event.destroy(); |
|
4714 |
}); |
|
4715 |
})(tinymce); |
|
4716 |
(function(tinymce) { |
|
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:
117
diff
changeset
|
4717 |
var each = tinymce.each; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4718 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4719 |
tinymce.create('tinymce.dom.Element', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4720 |
Element : function(id, 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:
117
diff
changeset
|
4721 |
var t = this, dom, el; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4722 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4723 |
s = 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:
117
diff
changeset
|
4724 |
t.id = id; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4725 |
t.dom = dom = s.dom || tinymce.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:
117
diff
changeset
|
4726 |
t.settings = 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:
117
diff
changeset
|
4727 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4728 |
// Only IE leaks DOM references, this is a lot faster |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4729 |
if (!tinymce.isIE) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4730 |
el = t.dom.get(t.id); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4731 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4732 |
each([ |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4733 |
'getPos', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4734 |
'getRect', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4735 |
'getParent', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4736 |
'add', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4737 |
'setStyle', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4738 |
'getStyle', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4739 |
'setStyles', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4740 |
'setAttrib', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4741 |
'setAttribs', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4742 |
'getAttrib', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4743 |
'addClass', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4744 |
'removeClass', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4745 |
'hasClass', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4746 |
'getOuterHTML', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4747 |
'setOuterHTML', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4748 |
'remove', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4749 |
'show', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4750 |
'hide', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4751 |
'isHidden', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4752 |
'setHTML', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4753 |
'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:
117
diff
changeset
|
4754 |
], function(k) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4755 |
t[k] = function() { |
1193 | 4756 |
var a = [id], i; |
4757 |
||
4758 |
for (i = 0; i < arguments.length; i++) |
|
4759 |
a.push(arguments[i]); |
|
4760 |
||
4761 |
a = dom[k].apply(dom, a); |
|
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:
117
diff
changeset
|
4762 |
t.update(k); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4763 |
|
1193 | 4764 |
return a; |
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:
117
diff
changeset
|
4765 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4766 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4767 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4768 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4769 |
on : function(n, f, 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:
117
diff
changeset
|
4770 |
return tinymce.dom.Event.add(this.id, n, f, 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:
117
diff
changeset
|
4771 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4772 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4773 |
getXY : 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:
117
diff
changeset
|
4774 |
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:
117
diff
changeset
|
4775 |
x : parseInt(this.getStyle('left')), |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4776 |
y : parseInt(this.getStyle('top')) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4777 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4778 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4779 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4780 |
getSize : 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:
117
diff
changeset
|
4781 |
var n = this.dom.get(this.id); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4782 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4783 |
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:
117
diff
changeset
|
4784 |
w : parseInt(this.getStyle('width') || n.clientWidth), |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4785 |
h : parseInt(this.getStyle('height') || n.clientHeight) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4786 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4787 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4788 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4789 |
moveTo : function(x, y) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4790 |
this.setStyles({left : x, top : y}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4791 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4792 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4793 |
moveBy : function(x, y) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4794 |
var p = this.getXY(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4795 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4796 |
this.moveTo(p.x + x, p.y + y); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4797 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4798 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4799 |
resizeTo : function(w, 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:
117
diff
changeset
|
4800 |
this.setStyles({width : w, height : 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:
117
diff
changeset
|
4801 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4802 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4803 |
resizeBy : function(w, 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:
117
diff
changeset
|
4804 |
var s = this.getSize(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4805 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4806 |
this.resizeTo(s.w + w, s.h + 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:
117
diff
changeset
|
4807 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4808 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4809 |
update : function(k) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4810 |
var t = this, b, dom = t.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:
117
diff
changeset
|
4811 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4812 |
if (tinymce.isIE6 && t.settings.blocker) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4813 |
k = k || ''; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4814 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4815 |
// Ignore getters |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4816 |
if (k.indexOf('get') === 0 || k.indexOf('has') === 0 || k.indexOf('is') === 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:
117
diff
changeset
|
4817 |
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:
117
diff
changeset
|
4818 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4819 |
// Remove blocker on remove |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4820 |
if (k == 'remove') { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4821 |
dom.remove(t.blocker); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4822 |
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:
117
diff
changeset
|
4823 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4824 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4825 |
if (!t.blocker) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4826 |
t.blocker = dom.uniqueId(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4827 |
b = dom.add(t.settings.container || dom.getRoot(), 'iframe', {id : t.blocker, style : 'position:absolute;', frameBorder : 0, src : 'javascript:""'}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4828 |
dom.setStyle(b, 'opacity', 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:
117
diff
changeset
|
4829 |
} 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:
117
diff
changeset
|
4830 |
b = dom.get(t.blocker); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4831 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4832 |
dom.setStyle(b, 'left', t.getStyle('left', 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:
117
diff
changeset
|
4833 |
dom.setStyle(b, 'top', t.getStyle('top', 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:
117
diff
changeset
|
4834 |
dom.setStyle(b, 'width', t.getStyle('width', 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:
117
diff
changeset
|
4835 |
dom.setStyle(b, 'height', t.getStyle('height', 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:
117
diff
changeset
|
4836 |
dom.setStyle(b, 'display', t.getStyle('display', 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:
117
diff
changeset
|
4837 |
dom.setStyle(b, 'zIndex', parseInt(t.getStyle('zIndex', 1) || 0) - 1); |
1 | 4838 |
} |
4839 |
} |
|
1193 | 4840 |
}); |
4841 |
})(tinymce); |
|
4842 |
(function(tinymce) { |
|
543 | 4843 |
function trimNl(s) { |
4844 |
return s.replace(/[\n\r]+/g, ''); |
|
4845 |
}; |
|
4846 |
||
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:
117
diff
changeset
|
4847 |
// Shorten names |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4848 |
var is = tinymce.is, isIE = tinymce.isIE, each = tinymce.each; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4849 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4850 |
tinymce.create('tinymce.dom.Selection', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4851 |
Selection : function(dom, win, serializer) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4852 |
var t = 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:
117
diff
changeset
|
4853 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4854 |
t.dom = 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:
117
diff
changeset
|
4855 |
t.win = win; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4856 |
t.serializer = serializer; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4857 |
|
778 | 4858 |
// Add events |
4859 |
each([ |
|
4860 |
'onBeforeSetContent', |
|
4861 |
'onBeforeGetContent', |
|
4862 |
'onSetContent', |
|
4863 |
'onGetContent' |
|
4864 |
], function(e) { |
|
4865 |
t[e] = new tinymce.util.Dispatcher(t); |
|
4866 |
}); |
|
4867 |
||
1193 | 4868 |
// No W3C Range support |
4869 |
if (!t.win.getSelection) |
|
4870 |
t.tridentSel = new tinymce.dom.TridentSelection(t); |
|
4871 |
||
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:
117
diff
changeset
|
4872 |
// Prevent leaks |
543 | 4873 |
tinymce.addUnload(t.destroy, t); |
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:
117
diff
changeset
|
4874 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4875 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4876 |
getContent : function(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:
117
diff
changeset
|
4877 |
var t = this, r = t.getRng(), e = t.dom.create("body"), se = t.getSel(), wb, wa, 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:
117
diff
changeset
|
4878 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4879 |
s = 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:
117
diff
changeset
|
4880 |
wb = wa = ''; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4881 |
s.get = 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:
117
diff
changeset
|
4882 |
s.format = s.format || 'html'; |
778 | 4883 |
t.onBeforeGetContent.dispatch(t, s); |
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:
117
diff
changeset
|
4884 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4885 |
if (s.format == 'text') |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4886 |
return t.isCollapsed() ? '' : (r.text || (se.toString ? se.toString() : '')); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4887 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4888 |
if (r.cloneContents) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4889 |
n = r.cloneContents(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4890 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4891 |
if (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:
117
diff
changeset
|
4892 |
e.appendChild(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:
117
diff
changeset
|
4893 |
} else if (is(r.item) || is(r.htmlText)) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4894 |
e.innerHTML = r.item ? r.item(0).outerHTML : r.htmlText; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4895 |
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:
117
diff
changeset
|
4896 |
e.innerHTML = r.toString(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4897 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4898 |
// Keep whitespace before and after |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4899 |
if (/^\s/.test(e.innerHTML)) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4900 |
wb = ' '; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4901 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4902 |
if (/\s+$/.test(e.innerHTML)) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4903 |
wa = ' '; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4904 |
|
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
|
4905 |
s.getInner = true; |
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
|
4906 |
|
778 | 4907 |
s.content = t.isCollapsed() ? '' : wb + t.serializer.serialize(e, s) + wa; |
4908 |
t.onGetContent.dispatch(t, s); |
|
4909 |
||
4910 |
return s.content; |
|
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:
117
diff
changeset
|
4911 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4912 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4913 |
setContent : function(h, s) { |
778 | 4914 |
var t = this, r = t.getRng(), c, d = t.win.document; |
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4915 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4916 |
s = s || {format : 'html'}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4917 |
s.set = true; |
778 | 4918 |
h = s.content = t.dom.processHTML(h); |
4919 |
||
4920 |
// Dispatch before set content event |
|
4921 |
t.onBeforeSetContent.dispatch(t, s); |
|
4922 |
h = s.content; |
|
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:
117
diff
changeset
|
4923 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4924 |
if (r.insertNode) { |
778 | 4925 |
// Make caret marker since insertNode places the caret in the beginning of text after insert |
4926 |
h += '<span id="__caret">_</span>'; |
|
4927 |
||
4928 |
// Delete and insert new node |
|
4929 |
r.deleteContents(); |
|
4930 |
r.insertNode(t.getRng().createContextualFragment(h)); |
|
4931 |
||
4932 |
// Move to caret marker |
|
4933 |
c = t.dom.get('__caret'); |
|
4934 |
||
4935 |
// Make sure we wrap it compleatly, Opera fails with a simple select call |
|
4936 |
r = d.createRange(); |
|
4937 |
r.setStartBefore(c); |
|
4938 |
r.setEndAfter(c); |
|
4939 |
t.setRng(r); |
|
4940 |
||
4941 |
// Delete the marker, and hopefully the caret gets placed in the right location |
|
1193 | 4942 |
// Removed this since it seems to remove in FF and simply deleting it |
4943 |
// doesn't seem to affect the caret position in any browser |
|
4944 |
//d.execCommand('Delete', false, null); |
|
4945 |
||
4946 |
// Remove the caret position |
|
778 | 4947 |
t.dom.remove('__caret'); |
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:
117
diff
changeset
|
4948 |
} else { |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
4949 |
if (r.item) { |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
4950 |
// Delete content and get caret text selection |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
4951 |
d.execCommand('Delete', false, null); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
4952 |
r = t.getRng(); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
4953 |
} |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
4954 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
4955 |
r.pasteHTML(h); |
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:
117
diff
changeset
|
4956 |
} |
778 | 4957 |
|
4958 |
// Dispatch set content event |
|
4959 |
t.onSetContent.dispatch(t, s); |
|
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:
117
diff
changeset
|
4960 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4961 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4962 |
getStart : 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:
117
diff
changeset
|
4963 |
var t = this, r = t.getRng(), 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:
117
diff
changeset
|
4964 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4965 |
if (isIE) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4966 |
if (r.item) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4967 |
return r.item(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:
117
diff
changeset
|
4968 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4969 |
r = r.duplicate(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4970 |
r.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:
117
diff
changeset
|
4971 |
e = r.parentElement(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4972 |
|
543 | 4973 |
if (e && e.nodeName == 'BODY') |
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:
117
diff
changeset
|
4974 |
return e.firstChild; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4975 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4976 |
return 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:
117
diff
changeset
|
4977 |
} 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:
117
diff
changeset
|
4978 |
e = r.startContainer; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4979 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4980 |
if (e.nodeName == '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:
117
diff
changeset
|
4981 |
return e.firstChild; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4982 |
|
1193 | 4983 |
return t.dom.getParent(e, '*'); |
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:
117
diff
changeset
|
4984 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4985 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4986 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4987 |
getEnd : 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:
117
diff
changeset
|
4988 |
var t = this, r = t.getRng(), 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:
117
diff
changeset
|
4989 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4990 |
if (isIE) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4991 |
if (r.item) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4992 |
return r.item(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:
117
diff
changeset
|
4993 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4994 |
r = r.duplicate(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4995 |
r.collapse(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:
117
diff
changeset
|
4996 |
e = r.parentElement(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
4997 |
|
543 | 4998 |
if (e && e.nodeName == 'BODY') |
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:
117
diff
changeset
|
4999 |
return e.lastChild; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5000 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5001 |
return 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:
117
diff
changeset
|
5002 |
} 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:
117
diff
changeset
|
5003 |
e = r.endContainer; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5004 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5005 |
if (e.nodeName == '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:
117
diff
changeset
|
5006 |
return e.lastChild; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5007 |
|
1193 | 5008 |
return t.dom.getParent(e, '*'); |
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:
117
diff
changeset
|
5009 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5010 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5011 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5012 |
getBookmark : function(si) { |
543 | 5013 |
var t = this, r = t.getRng(), tr, sx, sy, vp = t.dom.getViewPort(t.win), e, sp, bp, le, c = -0xFFFFFF, s, ro = t.dom.getRoot(), wb = 0, wa = 0, nv; |
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:
117
diff
changeset
|
5014 |
sx = vp.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:
117
diff
changeset
|
5015 |
sy = vp.y; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5016 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5017 |
// Simple bookmark fast but not as persistent |
1193 | 5018 |
if (si) |
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:
117
diff
changeset
|
5019 |
return {rng : r, scrollX : sx, scrollY : sy}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5020 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5021 |
// Handle IE |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5022 |
if (isIE) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5023 |
// Control selection |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5024 |
if (r.item) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5025 |
e = r.item(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:
117
diff
changeset
|
5026 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5027 |
each(t.dom.select(e.nodeName), function(n, i) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5028 |
if (e == 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:
117
diff
changeset
|
5029 |
sp = i; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5030 |
return 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:
117
diff
changeset
|
5031 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5032 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5033 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5034 |
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:
117
diff
changeset
|
5035 |
tag : e.nodeName, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5036 |
index : sp, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5037 |
scrollX : sx, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5038 |
scrollY : sy |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5039 |
}; |
1 | 5040 |
} |
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:
117
diff
changeset
|
5041 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5042 |
// Text selection |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5043 |
tr = t.dom.doc.body.createTextRange(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5044 |
tr.moveToElementText(ro); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5045 |
tr.collapse(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:
117
diff
changeset
|
5046 |
bp = Math.abs(tr.move('character', c)); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5047 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5048 |
tr = r.duplicate(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5049 |
tr.collapse(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:
117
diff
changeset
|
5050 |
sp = Math.abs(tr.move('character', c)); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5051 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5052 |
tr = r.duplicate(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5053 |
tr.collapse(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:
117
diff
changeset
|
5054 |
le = Math.abs(tr.move('character', c)) - sp; |
1 | 5055 |
|
5056 |
return { |
|
5057 |
start : sp - bp, |
|
5058 |
length : le, |
|
5059 |
scrollX : sx, |
|
5060 |
scrollY : sy |
|
5061 |
}; |
|
5062 |
} |
|
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:
117
diff
changeset
|
5063 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5064 |
// Handle W3C |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5065 |
e = t.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:
117
diff
changeset
|
5066 |
s = t.getSel(); |
1 | 5067 |
|
5068 |
if (!s) |
|
5069 |
return null; |
|
5070 |
||
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:
117
diff
changeset
|
5071 |
// Image selection |
1 | 5072 |
if (e && e.nodeName == 'IMG') { |
5073 |
return { |
|
5074 |
scrollX : sx, |
|
5075 |
scrollY : sy |
|
5076 |
}; |
|
5077 |
} |
|
5078 |
||
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:
117
diff
changeset
|
5079 |
// Text selection |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5080 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5081 |
function getPos(r, sn, en) { |
543 | 5082 |
var w = t.dom.doc.createTreeWalker(r, NodeFilter.SHOW_TEXT, null, false), n, p = 0, d = {}; |
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:
117
diff
changeset
|
5083 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5084 |
while ((n = w.nextNode()) != 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:
117
diff
changeset
|
5085 |
if (n == sn) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5086 |
d.start = 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:
117
diff
changeset
|
5087 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5088 |
if (n == en) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5089 |
d.end = 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:
117
diff
changeset
|
5090 |
return d; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5091 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5092 |
|
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
5093 |
p += trimNl(n.nodeValue || '').length; |
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:
117
diff
changeset
|
5094 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5095 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5096 |
return 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:
117
diff
changeset
|
5097 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5098 |
|
1 | 5099 |
// Caret or selection |
5100 |
if (s.anchorNode == s.focusNode && s.anchorOffset == s.focusOffset) { |
|
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:
117
diff
changeset
|
5101 |
e = getPos(ro, s.anchorNode, s.focusNode); |
1 | 5102 |
|
5103 |
if (!e) |
|
5104 |
return {scrollX : sx, scrollY : sy}; |
|
5105 |
||
543 | 5106 |
// Count whitespace before |
5107 |
trimNl(s.anchorNode.nodeValue || '').replace(/^\s+/, function(a) {wb = a.length;}); |
|
5108 |
||
1 | 5109 |
return { |
543 | 5110 |
start : Math.max(e.start + s.anchorOffset - wb, 0), |
5111 |
end : Math.max(e.end + s.focusOffset - wb, 0), |
|
1 | 5112 |
scrollX : sx, |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
5113 |
scrollY : sy, |
543 | 5114 |
beg : s.anchorOffset - wb == 0 |
1 | 5115 |
}; |
5116 |
} else { |
|
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:
117
diff
changeset
|
5117 |
e = getPos(ro, r.startContainer, r.endContainer); |
1 | 5118 |
|
543 | 5119 |
// Count whitespace before start and end container |
5120 |
//(r.startContainer.nodeValue || '').replace(/^\s+/, function(a) {wb = a.length;}); |
|
5121 |
//(r.endContainer.nodeValue || '').replace(/^\s+/, function(a) {wa = a.length;}); |
|
5122 |
||
1 | 5123 |
if (!e) |
5124 |
return {scrollX : sx, scrollY : sy}; |
|
5125 |
||
5126 |
return { |
|
543 | 5127 |
start : Math.max(e.start + r.startOffset - wb, 0), |
5128 |
end : Math.max(e.end + r.endOffset - wa, 0), |
|
1 | 5129 |
scrollX : sx, |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
5130 |
scrollY : sy, |
543 | 5131 |
beg : r.startOffset - wb == 0 |
1 | 5132 |
}; |
5133 |
} |
|
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:
117
diff
changeset
|
5134 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5135 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5136 |
moveToBookmark : function(b) { |
543 | 5137 |
var t = this, r = t.getRng(), s = t.getSel(), ro = t.dom.getRoot(), sd, nvl, nv; |
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:
117
diff
changeset
|
5138 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5139 |
function getPos(r, sp, ep) { |
543 | 5140 |
var w = t.dom.doc.createTreeWalker(r, NodeFilter.SHOW_TEXT, null, false), n, p = 0, d = {}, o, v, wa, wb; |
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:
117
diff
changeset
|
5141 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5142 |
while ((n = w.nextNode()) != null) { |
543 | 5143 |
wa = wb = 0; |
5144 |
||
5145 |
nv = n.nodeValue || ''; |
|
5146 |
//nv.replace(/^\s+[^\s]/, function(a) {wb = a.length - 1;}); |
|
5147 |
//nv.replace(/[^\s]\s+$/, function(a) {wa = a.length - 1;}); |
|
5148 |
||
5149 |
nvl = trimNl(nv).length; |
|
5150 |
p += nvl; |
|
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:
117
diff
changeset
|
5151 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5152 |
if (p >= sp && !d.startNode) { |
543 | 5153 |
o = sp - (p - nvl); |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
5154 |
|
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
5155 |
// Fix for odd quirk in FF |
543 | 5156 |
if (b.beg && o >= nvl) |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
5157 |
continue; |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
5158 |
|
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:
117
diff
changeset
|
5159 |
d.startNode = n; |
543 | 5160 |
d.startOffset = o + wb; |
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:
117
diff
changeset
|
5161 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5162 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5163 |
if (p >= ep) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5164 |
d.endNode = n; |
543 | 5165 |
d.endOffset = ep - (p - nvl) + wb; |
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:
117
diff
changeset
|
5166 |
return d; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5167 |
} |
1 | 5168 |
} |
5169 |
||
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:
117
diff
changeset
|
5170 |
return 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:
117
diff
changeset
|
5171 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5172 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5173 |
if (!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:
117
diff
changeset
|
5174 |
return 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:
117
diff
changeset
|
5175 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5176 |
t.win.scrollTo(b.scrollX, b.scrollY); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5177 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5178 |
// Handle explorer |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5179 |
if (isIE) { |
1193 | 5180 |
t.tridentSel.destroy(); |
5181 |
||
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:
117
diff
changeset
|
5182 |
// Handle simple |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5183 |
if (r = b.rng) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5184 |
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:
117
diff
changeset
|
5185 |
r.select(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5186 |
} 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:
117
diff
changeset
|
5187 |
// Ignore |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5188 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5189 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5190 |
return 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:
117
diff
changeset
|
5191 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5192 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5193 |
t.win.focus(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5194 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5195 |
// Handle control bookmark |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5196 |
if (b.tag) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5197 |
r = ro.createControlRange(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5198 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5199 |
each(t.dom.select(b.tag), function(n, i) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5200 |
if (i == b.index) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5201 |
r.addElement(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:
117
diff
changeset
|
5202 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5203 |
} 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:
117
diff
changeset
|
5204 |
// Try/catch needed since this operation breaks when TinyMCE is placed in hidden divs/tabs |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5205 |
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:
117
diff
changeset
|
5206 |
// Incorrect bookmark |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5207 |
if (b.start < 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:
117
diff
changeset
|
5208 |
return 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:
117
diff
changeset
|
5209 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5210 |
r = s.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:
117
diff
changeset
|
5211 |
r.moveToElementText(ro); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5212 |
r.collapse(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:
117
diff
changeset
|
5213 |
r.moveStart('character', b.start); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5214 |
r.moveEnd('character', b.length); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5215 |
} catch (ex2) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5216 |
return 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:
117
diff
changeset
|
5217 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5218 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5219 |
|
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
|
5220 |
try { |
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
|
5221 |
r.select(); |
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
|
5222 |
} catch (ex) { |
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
|
5223 |
// Needed for some odd IE bug #1843306 |
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
|
5224 |
} |
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:
117
diff
changeset
|
5225 |
|
1 | 5226 |
return true; |
5227 |
} |
|
5228 |
||
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:
117
diff
changeset
|
5229 |
// Handle W3C |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5230 |
if (!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:
117
diff
changeset
|
5231 |
return 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:
117
diff
changeset
|
5232 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5233 |
// Handle simple |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5234 |
if (b.rng) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5235 |
s.removeAllRanges(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5236 |
s.addRange(b.rng); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5237 |
} 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:
117
diff
changeset
|
5238 |
if (is(b.start) && is(b.end)) { |
1 | 5239 |
try { |
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:
117
diff
changeset
|
5240 |
sd = getPos(ro, b.start, b.end); |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
5241 |
|
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:
117
diff
changeset
|
5242 |
if (sd) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5243 |
r = t.dom.doc.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:
117
diff
changeset
|
5244 |
r.setStart(sd.startNode, sd.startOffset); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5245 |
r.setEnd(sd.endNode, sd.endOffset); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5246 |
s.removeAllRanges(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5247 |
s.addRange(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:
117
diff
changeset
|
5248 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5249 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5250 |
if (!tinymce.isOpera) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5251 |
t.win.focus(); |
1 | 5252 |
} catch (ex) { |
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:
117
diff
changeset
|
5253 |
// Ignore |
1 | 5254 |
} |
5255 |
} |
|
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:
117
diff
changeset
|
5256 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5257 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5258 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5259 |
select : function(n, c) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5260 |
var t = this, r = t.getRng(), s = t.getSel(), b, fn, ln, d = t.win.document; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5261 |
|
1193 | 5262 |
function find(n, start) { |
5263 |
var walker, o; |
|
5264 |
||
5265 |
if (n) { |
|
5266 |
walker = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false); |
|
5267 |
||
5268 |
// Find first/last non empty text node |
|
5269 |
while (n = walker.nextNode()) { |
|
5270 |
o = n; |
|
5271 |
||
5272 |
if (tinymce.trim(n.nodeValue).length != 0) { |
|
5273 |
if (start) |
|
5274 |
return n; |
|
5275 |
else |
|
5276 |
o = n; |
|
5277 |
} |
|
5278 |
} |
|
5279 |
} |
|
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:
117
diff
changeset
|
5280 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5281 |
return 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:
117
diff
changeset
|
5282 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5283 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5284 |
if (isIE) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5285 |
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:
117
diff
changeset
|
5286 |
b = d.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:
117
diff
changeset
|
5287 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5288 |
if (/^(IMG|TABLE)$/.test(n.nodeName)) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5289 |
r = b.createControlRange(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5290 |
r.addElement(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:
117
diff
changeset
|
5291 |
} 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:
117
diff
changeset
|
5292 |
r = b.createTextRange(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5293 |
r.moveToElementText(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:
117
diff
changeset
|
5294 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5295 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5296 |
r.select(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5297 |
} 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:
117
diff
changeset
|
5298 |
// Throws illigal agrument in IE some times |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5299 |
} |
1 | 5300 |
} else { |
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:
117
diff
changeset
|
5301 |
if (c) { |
1193 | 5302 |
fn = find(n, 1) || t.dom.select('br:first', n)[0]; |
5303 |
ln = find(n, 0) || t.dom.select('br:last', n)[0]; |
|
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:
117
diff
changeset
|
5304 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5305 |
if (fn && ln) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5306 |
r = d.createRange(); |
1193 | 5307 |
|
5308 |
if (fn.nodeName == 'BR') |
|
5309 |
r.setStartBefore(fn); |
|
5310 |
else |
|
5311 |
r.setStart(fn, 0); |
|
5312 |
||
5313 |
if (ln.nodeName == 'BR') |
|
5314 |
r.setEndBefore(ln); |
|
5315 |
else |
|
5316 |
r.setEnd(ln, ln.nodeValue.length); |
|
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:
117
diff
changeset
|
5317 |
} 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:
117
diff
changeset
|
5318 |
r.selectNode(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:
117
diff
changeset
|
5319 |
} 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:
117
diff
changeset
|
5320 |
r.selectNode(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:
117
diff
changeset
|
5321 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5322 |
t.setRng(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:
117
diff
changeset
|
5323 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5324 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5325 |
return 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:
117
diff
changeset
|
5326 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5327 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5328 |
isCollapsed : function() { |
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
|
5329 |
var t = this, r = t.getRng(), s = t.getSel(); |
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:
117
diff
changeset
|
5330 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5331 |
if (!r || r.item) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5332 |
return 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:
117
diff
changeset
|
5333 |
|
778 | 5334 |
return !s || r.boundingWidth == 0 || r.collapsed; |
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:
117
diff
changeset
|
5335 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5336 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5337 |
collapse : function(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:
117
diff
changeset
|
5338 |
var t = this, r = t.getRng(), 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:
117
diff
changeset
|
5339 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5340 |
// Control range on IE |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5341 |
if (r.item) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5342 |
n = r.item(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:
117
diff
changeset
|
5343 |
r = this.win.document.body.createTextRange(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5344 |
r.moveToElementText(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:
117
diff
changeset
|
5345 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5346 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5347 |
r.collapse(!!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:
117
diff
changeset
|
5348 |
t.setRng(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:
117
diff
changeset
|
5349 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5350 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5351 |
getSel : 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:
117
diff
changeset
|
5352 |
var t = this, w = this.win; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5353 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5354 |
return w.getSelection ? w.getSelection() : w.document.selection; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5355 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5356 |
|
1193 | 5357 |
getRng : function(w3c) { |
5358 |
var t = this, s, r; |
|
5359 |
||
5360 |
// Found tridentSel object then we need to use that one |
|
5361 |
if (w3c && t.tridentSel) |
|
5362 |
return t.tridentSel.getRangeAt(0); |
|
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:
117
diff
changeset
|
5363 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5364 |
try { |
1193 | 5365 |
if (s = t.getSel()) |
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
|
5366 |
r = s.rangeCount > 0 ? s.getRangeAt(0) : (s.createRange ? s.createRange() : t.win.document.createRange()); |
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:
117
diff
changeset
|
5367 |
} 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:
117
diff
changeset
|
5368 |
// IE throws unspecified error here if TinyMCE is placed in a frame/iframe |
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
|
5369 |
} |
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
|
5370 |
|
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
|
5371 |
// No range found then create an empty one |
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
|
5372 |
// This can occur when the editor is placed in a hidden container element on Gecko |
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
|
5373 |
// Or on IE when there was an exception |
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
|
5374 |
if (!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
|
5375 |
r = isIE ? t.win.document.body.createTextRange() : t.win.document.createRange(); |
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:
117
diff
changeset
|
5376 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5377 |
return 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:
117
diff
changeset
|
5378 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5379 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5380 |
setRng : function(r) { |
1193 | 5381 |
var s, t = this; |
5382 |
||
5383 |
if (!t.tridentSel) { |
|
5384 |
s = t.getSel(); |
|
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
|
5385 |
|
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
|
5386 |
if (s) { |
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
|
5387 |
s.removeAllRanges(); |
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
|
5388 |
s.addRange(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
|
5389 |
} |
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
|
5390 |
} else { |
1193 | 5391 |
// Is W3C Range |
5392 |
if (r.cloneRange) { |
|
5393 |
t.tridentSel.addRange(r); |
|
5394 |
return; |
|
5395 |
} |
|
5396 |
||
5397 |
// Is IE specific range |
|
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
|
5398 |
try { |
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
|
5399 |
r.select(); |
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
|
5400 |
} catch (ex) { |
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
|
5401 |
// Needed for some odd IE bug #1843306 |
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
|
5402 |
} |
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
|
5403 |
} |
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:
117
diff
changeset
|
5404 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5405 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5406 |
setNode : 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:
117
diff
changeset
|
5407 |
var t = 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:
117
diff
changeset
|
5408 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5409 |
t.setContent(t.dom.getOuterHTML(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:
117
diff
changeset
|
5410 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5411 |
return 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:
117
diff
changeset
|
5412 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5413 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5414 |
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:
117
diff
changeset
|
5415 |
var t = this, r = t.getRng(), s = t.getSel(), 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:
117
diff
changeset
|
5416 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5417 |
if (!isIE) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5418 |
// Range maybe lost after the editor is made visible again |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5419 |
if (!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:
117
diff
changeset
|
5420 |
return t.dom.getRoot(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5421 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5422 |
e = r.commonAncestorContainer; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5423 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5424 |
// Handle selection a image or other control like element such as anchors |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5425 |
if (!r.collapsed) { |
778 | 5426 |
// If the anchor node is a element instead of a text node then return this element |
5427 |
if (tinymce.isWebKit && s.anchorNode && s.anchorNode.nodeType == 1) |
|
5428 |
return s.anchorNode.childNodes[s.anchorOffset]; |
|
5429 |
||
5430 |
if (r.startContainer == r.endContainer) { |
|
5431 |
if (r.startOffset - r.endOffset < 2) { |
|
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:
117
diff
changeset
|
5432 |
if (r.startContainer.hasChildNodes()) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5433 |
e = r.startContainer.childNodes[r.startOffset]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5434 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5435 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5436 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5437 |
|
1193 | 5438 |
return t.dom.getParent(e, '*'); |
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:
117
diff
changeset
|
5439 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5440 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5441 |
return r.item ? r.item(0) : r.parentElement(); |
543 | 5442 |
}, |
5443 |
||
1193 | 5444 |
getSelectedBlocks : function(st, en) { |
5445 |
var t = this, dom = t.dom, sb, eb, n, bl = []; |
|
5446 |
||
5447 |
sb = dom.getParent(st || t.getStart(), dom.isBlock); |
|
5448 |
eb = dom.getParent(en || t.getEnd(), dom.isBlock); |
|
5449 |
||
5450 |
if (sb) |
|
5451 |
bl.push(sb); |
|
5452 |
||
5453 |
if (sb && eb && sb != eb) { |
|
5454 |
n = sb; |
|
5455 |
||
5456 |
while ((n = n.nextSibling) && n != eb) { |
|
5457 |
if (dom.isBlock(n)) |
|
5458 |
bl.push(n); |
|
5459 |
} |
|
5460 |
} |
|
5461 |
||
5462 |
if (eb && sb != eb) |
|
5463 |
bl.push(eb); |
|
5464 |
||
5465 |
return bl; |
|
5466 |
}, |
|
5467 |
||
543 | 5468 |
destroy : function(s) { |
5469 |
var t = this; |
|
5470 |
||
5471 |
t.win = null; |
|
5472 |
||
1193 | 5473 |
if (t.tridentSel) |
5474 |
t.tridentSel.destroy(); |
|
5475 |
||
543 | 5476 |
// Manual destroy then remove unload handler |
5477 |
if (!s) |
|
5478 |
tinymce.removeUnload(t.destroy); |
|
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:
117
diff
changeset
|
5479 |
} |
1193 | 5480 |
}); |
5481 |
})(tinymce); |
|
5482 |
(function(tinymce) { |
|
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:
117
diff
changeset
|
5483 |
tinymce.create('tinymce.dom.XMLWriter', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5484 |
node : 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:
117
diff
changeset
|
5485 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5486 |
XMLWriter : function(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:
117
diff
changeset
|
5487 |
// Get XML document |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5488 |
function getXML() { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5489 |
var i = document.implementation; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5490 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5491 |
if (!i || !i.createDocument) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5492 |
// Try IE objects |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5493 |
try {return new ActiveXObject('MSXML2.DOMDocument');} 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:
117
diff
changeset
|
5494 |
try {return new ActiveXObject('Microsoft.XmlDom');} 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:
117
diff
changeset
|
5495 |
} 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:
117
diff
changeset
|
5496 |
return i.createDocument('', '', 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:
117
diff
changeset
|
5497 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5498 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5499 |
this.doc = getXML(); |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5500 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5501 |
// Since Opera and WebKit doesn't escape > into > we need to do it our self to normalize the output for all browsers |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5502 |
this.valid = tinymce.isOpera || tinymce.isWebKit; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5503 |
|
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:
117
diff
changeset
|
5504 |
this.reset(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5505 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5506 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5507 |
reset : 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:
117
diff
changeset
|
5508 |
var t = this, d = t.doc; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5509 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5510 |
if (d.firstChild) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5511 |
d.removeChild(d.firstChild); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5512 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5513 |
t.node = d.appendChild(d.createElement("html")); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5514 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5515 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5516 |
writeStartElement : 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:
117
diff
changeset
|
5517 |
var t = 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:
117
diff
changeset
|
5518 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5519 |
t.node = t.node.appendChild(t.doc.createElement(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:
117
diff
changeset
|
5520 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5521 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5522 |
writeAttribute : function(n, v) { |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5523 |
if (this.valid) |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5524 |
v = v.replace(/>/g, '%MCGT%'); |
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:
117
diff
changeset
|
5525 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5526 |
this.node.setAttribute(n, 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:
117
diff
changeset
|
5527 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5528 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5529 |
writeEndElement : 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:
117
diff
changeset
|
5530 |
this.node = this.node.parentNode; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5531 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5532 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5533 |
writeFullEndElement : 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:
117
diff
changeset
|
5534 |
var t = this, n = t.node; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5535 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5536 |
n.appendChild(t.doc.createTextNode("")); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5537 |
t.node = n.parentNode; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5538 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5539 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5540 |
writeText : function(v) { |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5541 |
if (this.valid) |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5542 |
v = v.replace(/>/g, '%MCGT%'); |
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:
117
diff
changeset
|
5543 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5544 |
this.node.appendChild(this.doc.createTextNode(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:
117
diff
changeset
|
5545 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5546 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5547 |
writeCDATA : function(v) { |
1193 | 5548 |
this.node.appendChild(this.doc.createCDATASection(v)); |
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:
117
diff
changeset
|
5549 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5550 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5551 |
writeComment : function(v) { |
778 | 5552 |
// Fix for bug #2035694 |
5553 |
if (tinymce.isIE) |
|
5554 |
v = v.replace(/^\-|\-$/g, ' '); |
|
5555 |
||
543 | 5556 |
this.node.appendChild(this.doc.createComment(v.replace(/\-\-/g, ' '))); |
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:
117
diff
changeset
|
5557 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5558 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5559 |
getContent : 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:
117
diff
changeset
|
5560 |
var 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:
117
diff
changeset
|
5561 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5562 |
h = this.doc.xml || new XMLSerializer().serializeToString(this.doc); |
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
|
5563 |
h = h.replace(/<\?[^?]+\?>|<html>|<\/html>|<html\/>|<!DOCTYPE[^>]+>/g, ''); |
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:
117
diff
changeset
|
5564 |
h = h.replace(/ ?\/>/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:
117
diff
changeset
|
5565 |
|
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5566 |
if (this.valid) |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5567 |
h = h.replace(/\%MCGT%/g, '>'); |
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:
117
diff
changeset
|
5568 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5569 |
return 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:
117
diff
changeset
|
5570 |
} |
1193 | 5571 |
}); |
5572 |
})(tinymce); |
|
5573 |
(function(tinymce) { |
|
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5574 |
tinymce.create('tinymce.dom.StringWriter', { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5575 |
str : null, |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5576 |
tags : null, |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5577 |
count : 0, |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5578 |
settings : null, |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5579 |
indent : null, |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5580 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5581 |
StringWriter : function(s) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5582 |
this.settings = tinymce.extend({ |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5583 |
indent_char : ' ', |
1193 | 5584 |
indentation : 0 |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5585 |
}, s); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5586 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5587 |
this.reset(); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5588 |
}, |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5589 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5590 |
reset : function() { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5591 |
this.indent = ''; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5592 |
this.str = ""; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5593 |
this.tags = []; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5594 |
this.count = 0; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5595 |
}, |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5596 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5597 |
writeStartElement : function(n) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5598 |
this._writeAttributesEnd(); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5599 |
this.writeRaw('<' + n); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5600 |
this.tags.push(n); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5601 |
this.inAttr = true; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5602 |
this.count++; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5603 |
this.elementCount = this.count; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5604 |
}, |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5605 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5606 |
writeAttribute : function(n, v) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5607 |
var t = this; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5608 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5609 |
t.writeRaw(" " + t.encode(n) + '="' + t.encode(v) + '"'); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5610 |
}, |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5611 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5612 |
writeEndElement : function() { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5613 |
var n; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5614 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5615 |
if (this.tags.length > 0) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5616 |
n = this.tags.pop(); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5617 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5618 |
if (this._writeAttributesEnd(1)) |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5619 |
this.writeRaw('</' + n + '>'); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5620 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5621 |
if (this.settings.indentation > 0) |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5622 |
this.writeRaw('\n'); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5623 |
} |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5624 |
}, |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5625 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5626 |
writeFullEndElement : function() { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5627 |
if (this.tags.length > 0) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5628 |
this._writeAttributesEnd(); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5629 |
this.writeRaw('</' + this.tags.pop() + '>'); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5630 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5631 |
if (this.settings.indentation > 0) |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5632 |
this.writeRaw('\n'); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5633 |
} |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5634 |
}, |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5635 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5636 |
writeText : function(v) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5637 |
this._writeAttributesEnd(); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5638 |
this.writeRaw(this.encode(v)); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5639 |
this.count++; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5640 |
}, |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5641 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5642 |
writeCDATA : function(v) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5643 |
this._writeAttributesEnd(); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5644 |
this.writeRaw('<![CDATA[' + v + ']]>'); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5645 |
this.count++; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5646 |
}, |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5647 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5648 |
writeComment : function(v) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5649 |
this._writeAttributesEnd(); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5650 |
this.writeRaw('<!-- ' + v + '-->'); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5651 |
this.count++; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5652 |
}, |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5653 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5654 |
writeRaw : function(v) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5655 |
this.str += v; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5656 |
}, |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5657 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5658 |
encode : function(s) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5659 |
return s.replace(/[<>&"]/g, function(v) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5660 |
switch (v) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5661 |
case '<': |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5662 |
return '<'; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5663 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5664 |
case '>': |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5665 |
return '>'; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5666 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5667 |
case '&': |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5668 |
return '&'; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5669 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5670 |
case '"': |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5671 |
return '"'; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5672 |
} |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5673 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5674 |
return v; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5675 |
}); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5676 |
}, |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5677 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5678 |
getContent : function() { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5679 |
return this.str; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5680 |
}, |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5681 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5682 |
_writeAttributesEnd : function(s) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5683 |
if (!this.inAttr) |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5684 |
return; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5685 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5686 |
this.inAttr = false; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5687 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5688 |
if (s && this.elementCount == this.count) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5689 |
this.writeRaw(' />'); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5690 |
return false; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5691 |
} |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5692 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5693 |
this.writeRaw('>'); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5694 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5695 |
return true; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5696 |
} |
1193 | 5697 |
}); |
5698 |
})(tinymce); |
|
5699 |
(function(tinymce) { |
|
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:
117
diff
changeset
|
5700 |
// Shorten names |
543 | 5701 |
var extend = tinymce.extend, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher, isIE = tinymce.isIE, isGecko = tinymce.isGecko; |
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:
117
diff
changeset
|
5702 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5703 |
function wildcardToRE(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:
117
diff
changeset
|
5704 |
return s.replace(/([?+*])/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:
117
diff
changeset
|
5705 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5706 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5707 |
tinymce.create('tinymce.dom.Serializer', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5708 |
Serializer : function(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:
117
diff
changeset
|
5709 |
var t = 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:
117
diff
changeset
|
5710 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5711 |
t.key = 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:
117
diff
changeset
|
5712 |
t.onPreProcess = new Dispatcher(t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5713 |
t.onPostProcess = new Dispatcher(t); |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
5714 |
|
1193 | 5715 |
try { |
5716 |
t.writer = new tinymce.dom.XMLWriter(); |
|
5717 |
} catch (ex) { |
|
5718 |
// IE might throw exception if ActiveX is disabled so we then switch to the slightly slower StringWriter |
|
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
5719 |
t.writer = new tinymce.dom.StringWriter(); |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
5720 |
} |
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:
117
diff
changeset
|
5721 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5722 |
// Default settings |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5723 |
t.settings = s = extend({ |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5724 |
dom : tinymce.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:
117
diff
changeset
|
5725 |
valid_nodes : 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:
117
diff
changeset
|
5726 |
node_filter : 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:
117
diff
changeset
|
5727 |
attr_filter : 0, |
1193 | 5728 |
invalid_attrs : /^(mce_|_moz_|sizset|sizcache)/, |
5729 |
closed : /^(br|hr|input|meta|img|link|param|area)$/, |
|
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:
117
diff
changeset
|
5730 |
entity_encoding : 'named', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5731 |
entities : '160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5732 |
valid_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:
117
diff
changeset
|
5733 |
extended_valid_elements : 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:
117
diff
changeset
|
5734 |
valid_child_elements : 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:
117
diff
changeset
|
5735 |
invalid_elements : 0, |
1193 | 5736 |
fix_table_elements : 1, |
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:
117
diff
changeset
|
5737 |
fix_list_elements : 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:
117
diff
changeset
|
5738 |
fix_content_duplication : 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:
117
diff
changeset
|
5739 |
convert_fonts_to_spans : 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:
117
diff
changeset
|
5740 |
font_size_classes : 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:
117
diff
changeset
|
5741 |
font_size_style_values : 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:
117
diff
changeset
|
5742 |
apply_source_formatting : 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:
117
diff
changeset
|
5743 |
indent_mode : 'simple', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5744 |
indent_char : '\t', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5745 |
indent_levels : 1, |
778 | 5746 |
remove_linebreaks : 1, |
5747 |
remove_redundant_brs : 1, |
|
5748 |
element_format : 'xhtml' |
|
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:
117
diff
changeset
|
5749 |
}, 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:
117
diff
changeset
|
5750 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5751 |
t.dom = s.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:
117
diff
changeset
|
5752 |
|
778 | 5753 |
if (s.remove_redundant_brs) { |
5754 |
t.onPostProcess.add(function(se, o) { |
|
1193 | 5755 |
// Remove single BR at end of block elements since they get rendered |
5756 |
o.content = o.content.replace(/(<br \/>\s*)+<\/(p|h[1-6]|div|li)>/gi, function(a, b, c) { |
|
5757 |
// Check if it's a single element |
|
5758 |
if (/^<br \/>\s*<\//.test(a)) |
|
5759 |
return '</' + c + '>'; |
|
5760 |
||
5761 |
return a; |
|
5762 |
}); |
|
778 | 5763 |
}); |
5764 |
} |
|
5765 |
||
5766 |
// Remove XHTML element endings i.e. produce crap :) XHTML is better |
|
5767 |
if (s.element_format == 'html') { |
|
5768 |
t.onPostProcess.add(function(se, o) { |
|
5769 |
o.content = o.content.replace(/<([^>]+) \/>/g, '<$1>'); |
|
5770 |
}); |
|
5771 |
} |
|
5772 |
||
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:
117
diff
changeset
|
5773 |
if (s.fix_list_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:
117
diff
changeset
|
5774 |
t.onPreProcess.add(function(se, 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:
117
diff
changeset
|
5775 |
var nl, x, a = ['ol', 'ul'], i, n, p, r = /^(OL|UL)$/, np; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5776 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5777 |
function prevNode(e, 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:
117
diff
changeset
|
5778 |
var a = n.split(','), i; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5779 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5780 |
while ((e = e.previousSibling) != 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:
117
diff
changeset
|
5781 |
for (i=0; i<a.length; i++) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5782 |
if (e.nodeName == a[i]) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5783 |
return 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:
117
diff
changeset
|
5784 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5785 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5786 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5787 |
return 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:
117
diff
changeset
|
5788 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5789 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5790 |
for (x=0; x<a.length; 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:
117
diff
changeset
|
5791 |
nl = t.dom.select(a[x], o.node); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5792 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5793 |
for (i=0; i<nl.length; i++) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5794 |
n = nl[i]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5795 |
p = n.parentNode; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5796 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5797 |
if (r.test(p.nodeName)) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5798 |
np = prevNode(n, 'LI'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5799 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5800 |
if (!np) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5801 |
np = t.dom.create('li'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5802 |
np.innerHTML = ' '; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5803 |
np.appendChild(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:
117
diff
changeset
|
5804 |
p.insertBefore(np, p.firstChild); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5805 |
} 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:
117
diff
changeset
|
5806 |
np.appendChild(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:
117
diff
changeset
|
5807 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5808 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5809 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5810 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5811 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5812 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5813 |
if (s.fix_table_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:
117
diff
changeset
|
5814 |
t.onPreProcess.add(function(se, o) { |
1193 | 5815 |
// Since Opera will crash if you attach the node to a dynamic document we need to brrowser sniff a specific build |
5816 |
// so Opera users with an older version will have to live with less compaible output not much we can do here |
|
5817 |
if (!tinymce.isOpera || opera.buildNumber() >= 1767) { |
|
5818 |
each(t.dom.select('p table', o.node).reverse(), function(n) { |
|
5819 |
var parent = t.dom.getParent(n.parentNode, 'table,p'); |
|
5820 |
||
5821 |
if (parent.nodeName != 'TABLE') { |
|
5822 |
try { |
|
5823 |
t.dom.split(parent, n); |
|
5824 |
} catch (ex) { |
|
5825 |
// IE can sometimes fire an unknown runtime error so we just ignore it |
|
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5826 |
} |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
5827 |
} |
1193 | 5828 |
}); |
5829 |
} |
|
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:
117
diff
changeset
|
5830 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5831 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5832 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5833 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5834 |
setEntities : function(s) { |
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
|
5835 |
var t = this, a, i, l = {}, re = '', v; |
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:
117
diff
changeset
|
5836 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5837 |
// No need to setup more than once |
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
|
5838 |
if (t.entityLookup) |
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:
117
diff
changeset
|
5839 |
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:
117
diff
changeset
|
5840 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5841 |
// Build regex and lookup array |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5842 |
a = s.split(','); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5843 |
for (i = 0; i < a.length; i += 2) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5844 |
v = a[i]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5845 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5846 |
// Don't add default & " etc. |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5847 |
if (v == 34 || v == 38 || v == 60 || v == 62) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5848 |
continue; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5849 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5850 |
l[String.fromCharCode(a[i])] = a[i + 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:
117
diff
changeset
|
5851 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5852 |
v = parseInt(a[i]).toString(16); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5853 |
re += '\\u' + '0000'.substring(v.length) + 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:
117
diff
changeset
|
5854 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5855 |
|
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
|
5856 |
if (!re) { |
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
|
5857 |
t.settings.entity_encoding = 'raw'; |
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
|
5858 |
return; |
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
|
5859 |
} |
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
|
5860 |
|
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
|
5861 |
t.entitiesRE = new RegExp('[' + re + ']', 'g'); |
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
|
5862 |
t.entityLookup = l; |
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:
117
diff
changeset
|
5863 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5864 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5865 |
setValidChildRules : function(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:
117
diff
changeset
|
5866 |
this.childRules = 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:
117
diff
changeset
|
5867 |
this.addValidChildRules(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:
117
diff
changeset
|
5868 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5869 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5870 |
addValidChildRules : function(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:
117
diff
changeset
|
5871 |
var t = this, inst, intr, bloc; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5872 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5873 |
if (!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:
117
diff
changeset
|
5874 |
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:
117
diff
changeset
|
5875 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5876 |
inst = 'A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5877 |
intr = 'A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5878 |
bloc = 'H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5879 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5880 |
each(s.split(','), function(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:
117
diff
changeset
|
5881 |
var p = s.split(/\[|\]/), re; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5882 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5883 |
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:
117
diff
changeset
|
5884 |
each(p[1].split('|'), 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:
117
diff
changeset
|
5885 |
if (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:
117
diff
changeset
|
5886 |
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:
117
diff
changeset
|
5887 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5888 |
switch (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:
117
diff
changeset
|
5889 |
case '%itrans': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5890 |
v = intr; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5891 |
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:
117
diff
changeset
|
5892 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5893 |
case '%itrans_na': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5894 |
v = intr.substring(2); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5895 |
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:
117
diff
changeset
|
5896 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5897 |
case '%istrict': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5898 |
v = inst; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5899 |
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:
117
diff
changeset
|
5900 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5901 |
case '%istrict_na': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5902 |
v = inst.substring(2); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5903 |
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:
117
diff
changeset
|
5904 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5905 |
case '%btrans': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5906 |
v = bloc; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5907 |
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:
117
diff
changeset
|
5908 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5909 |
case '%bstrict': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5910 |
v = bloc; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5911 |
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:
117
diff
changeset
|
5912 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5913 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5914 |
s += 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:
117
diff
changeset
|
5915 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5916 |
re = new RegExp('^(' + s.toLowerCase() + ')$', 'i'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5917 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5918 |
each(p[0].split('/'), function(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:
117
diff
changeset
|
5919 |
t.childRules = t.childRules || {}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5920 |
t.childRules[s] = re; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5921 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5922 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5923 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5924 |
// Build regex |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5925 |
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:
117
diff
changeset
|
5926 |
each(t.childRules, function(v, k) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5927 |
if (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:
117
diff
changeset
|
5928 |
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:
117
diff
changeset
|
5929 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5930 |
s += k; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5931 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5932 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5933 |
t.parentElementsRE = new RegExp('^(' + s.toLowerCase() + ')$', 'i'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5934 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5935 |
/*console.debug(t.parentElementsRE.toString()); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5936 |
each(t.childRules, 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:
117
diff
changeset
|
5937 |
console.debug(v.toString()); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5938 |
});*/ |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5939 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5940 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5941 |
setRules : function(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:
117
diff
changeset
|
5942 |
var t = 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:
117
diff
changeset
|
5943 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5944 |
t._setup(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5945 |
t.rules = {}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5946 |
t.wildRules = []; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5947 |
t.validElements = {}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5948 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5949 |
return t.addRules(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:
117
diff
changeset
|
5950 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5951 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5952 |
addRules : function(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:
117
diff
changeset
|
5953 |
var t = this, dr; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5954 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5955 |
if (!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:
117
diff
changeset
|
5956 |
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:
117
diff
changeset
|
5957 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5958 |
t._setup(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5959 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5960 |
each(s.split(','), function(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:
117
diff
changeset
|
5961 |
var p = s.split(/\[|\]/), tn = p[0].split('/'), ra, at, wat, va = []; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5962 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5963 |
// Extend with default rules |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5964 |
if (dr) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5965 |
at = tinymce.extend([], dr.attribs); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5966 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5967 |
// Parse attributes |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5968 |
if (p.length > 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:
117
diff
changeset
|
5969 |
each(p[1].split('|'), function(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:
117
diff
changeset
|
5970 |
var ar = {}, i; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5971 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5972 |
at = at || []; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5973 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5974 |
// Parse attribute rule |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5975 |
s = s.replace(/::/g, '~'); |
543 | 5976 |
s = /^([!\-])?([\w*.?~_\-]+|)([=:<])?(.+)?$/.exec(s); |
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:
117
diff
changeset
|
5977 |
s[2] = s[2].replace(/~/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:
117
diff
changeset
|
5978 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5979 |
// Add required attributes |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5980 |
if (s[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:
117
diff
changeset
|
5981 |
ra = ra || []; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5982 |
ra.push(s[2]); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5983 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5984 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5985 |
// Remove inherited attributes |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5986 |
if (s[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:
117
diff
changeset
|
5987 |
for (i = 0; i <at.length; i++) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5988 |
if (at[i].name == s[2]) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5989 |
at.splice(i, 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:
117
diff
changeset
|
5990 |
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:
117
diff
changeset
|
5991 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5992 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5993 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5994 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5995 |
switch (s[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:
117
diff
changeset
|
5996 |
// Add default attrib values |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5997 |
case '=': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5998 |
ar.defaultVal = s[4] || ''; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
5999 |
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:
117
diff
changeset
|
6000 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6001 |
// Add forced attrib values |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6002 |
case ':': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6003 |
ar.forcedVal = s[4]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6004 |
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:
117
diff
changeset
|
6005 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6006 |
// Add validation values |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6007 |
case '<': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6008 |
ar.validVals = s[4].split('?'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6009 |
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:
117
diff
changeset
|
6010 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6011 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6012 |
if (/[*.?]/.test(s[2])) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6013 |
wat = wat || []; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6014 |
ar.nameRE = new RegExp('^' + wildcardToRE(s[2]) + '$'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6015 |
wat.push(ar); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6016 |
} 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:
117
diff
changeset
|
6017 |
ar.name = s[2]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6018 |
at.push(ar); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6019 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6020 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6021 |
va.push(s[2]); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6022 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6023 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6024 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6025 |
// Handle element names |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6026 |
each(tn, function(s, i) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6027 |
var pr = s.charAt(0), x = 1, ru = {}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6028 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6029 |
// Extend with default rule data |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6030 |
if (dr) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6031 |
if (dr.noEmpty) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6032 |
ru.noEmpty = dr.noEmpty; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6033 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6034 |
if (dr.fullEnd) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6035 |
ru.fullEnd = dr.fullEnd; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6036 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6037 |
if (dr.padd) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6038 |
ru.padd = dr.padd; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6039 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6040 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6041 |
// Handle prefixes |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6042 |
switch (pr) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6043 |
case '-': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6044 |
ru.noEmpty = 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:
117
diff
changeset
|
6045 |
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:
117
diff
changeset
|
6046 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6047 |
case '+': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6048 |
ru.fullEnd = 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:
117
diff
changeset
|
6049 |
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:
117
diff
changeset
|
6050 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6051 |
case '#': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6052 |
ru.padd = 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:
117
diff
changeset
|
6053 |
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:
117
diff
changeset
|
6054 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6055 |
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:
117
diff
changeset
|
6056 |
x = 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:
117
diff
changeset
|
6057 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6058 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6059 |
tn[i] = s = s.substring(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:
117
diff
changeset
|
6060 |
t.validElements[s] = 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:
117
diff
changeset
|
6061 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6062 |
// Add element name or element regex |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6063 |
if (/[*.?]/.test(tn[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:
117
diff
changeset
|
6064 |
ru.nameRE = new RegExp('^' + wildcardToRE(tn[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:
117
diff
changeset
|
6065 |
t.wildRules = t.wildRules || {}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6066 |
t.wildRules.push(ru); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6067 |
} 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:
117
diff
changeset
|
6068 |
ru.name = tn[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:
117
diff
changeset
|
6069 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6070 |
// Store away default rule |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6071 |
if (tn[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:
117
diff
changeset
|
6072 |
dr = ru; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6073 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6074 |
t.rules[s] = ru; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6075 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6076 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6077 |
ru.attribs = at; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6078 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6079 |
if (ra) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6080 |
ru.requiredAttribs = ra; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6081 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6082 |
if (wat) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6083 |
// Build valid attributes regexp |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6084 |
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:
117
diff
changeset
|
6085 |
each(va, 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:
117
diff
changeset
|
6086 |
if (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:
117
diff
changeset
|
6087 |
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:
117
diff
changeset
|
6088 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6089 |
s += '(' + wildcardToRE(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:
117
diff
changeset
|
6090 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6091 |
ru.validAttribsRE = new RegExp('^' + s.toLowerCase() + '$'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6092 |
ru.wildAttribs = wat; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6093 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6094 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6095 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6096 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6097 |
// Build valid elements regexp |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6098 |
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:
117
diff
changeset
|
6099 |
each(t.validElements, function(v, k) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6100 |
if (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:
117
diff
changeset
|
6101 |
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:
117
diff
changeset
|
6102 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6103 |
if (k != '@') |
543 | 6104 |
s += k; |
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:
117
diff
changeset
|
6105 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6106 |
t.validElementsRE = new RegExp('^(' + wildcardToRE(s.toLowerCase()) + ')$'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6107 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6108 |
//console.debug(t.validElementsRE.toString()); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6109 |
//console.dir(t.rules); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6110 |
//console.dir(t.wildRules); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6111 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6112 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6113 |
findRule : 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:
117
diff
changeset
|
6114 |
var t = this, rl = t.rules, i, 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:
117
diff
changeset
|
6115 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6116 |
t._setup(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6117 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6118 |
// Exact match |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6119 |
r = rl[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:
117
diff
changeset
|
6120 |
if (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:
117
diff
changeset
|
6121 |
return 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:
117
diff
changeset
|
6122 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6123 |
// Try wildcards |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6124 |
rl = t.wildRules; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6125 |
for (i = 0; i < rl.length; i++) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6126 |
if (rl[i].nameRE.test(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:
117
diff
changeset
|
6127 |
return rl[i]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6128 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6129 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6130 |
return 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:
117
diff
changeset
|
6131 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6132 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6133 |
findAttribRule : function(ru, 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:
117
diff
changeset
|
6134 |
var i, wa = ru.wildAttribs; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6135 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6136 |
for (i = 0; i < wa.length; i++) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6137 |
if (wa[i].nameRE.test(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:
117
diff
changeset
|
6138 |
return wa[i]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6139 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6140 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6141 |
return 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:
117
diff
changeset
|
6142 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6143 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6144 |
serialize : function(n, o) { |
1193 | 6145 |
var h, t = this, doc, oldDoc, impl, selected; |
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:
117
diff
changeset
|
6146 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6147 |
t._setup(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6148 |
o = 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:
117
diff
changeset
|
6149 |
o.format = o.format || 'html'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6150 |
t.processObj = o; |
1193 | 6151 |
|
6152 |
// IE looses the selected attribute on option elements so we need to store it |
|
6153 |
// See: http://support.microsoft.com/kb/829907 |
|
6154 |
if (isIE) { |
|
6155 |
selected = []; |
|
6156 |
each(n.getElementsByTagName('option'), function(n) { |
|
6157 |
var v = t.dom.getAttrib(n, 'selected'); |
|
6158 |
||
6159 |
selected.push(v ? v : null); |
|
6160 |
}); |
|
6161 |
} |
|
6162 |
||
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:
117
diff
changeset
|
6163 |
n = n.cloneNode(true); |
1193 | 6164 |
|
6165 |
// IE looses the selected attribute on option elements so we need to restore it |
|
6166 |
if (isIE) { |
|
6167 |
each(n.getElementsByTagName('option'), function(n, i) { |
|
6168 |
t.dom.setAttrib(n, 'selected', selected[i]); |
|
6169 |
}); |
|
6170 |
} |
|
6171 |
||
6172 |
// Nodes needs to be attached to something in WebKit/Opera |
|
6173 |
// Older builds of Opera crashes if you attach the node to an document created dynamically |
|
6174 |
// and since we can't feature detect a crash we need to sniff the acutal build number |
|
6175 |
// This fix will make DOM ranges and make Sizzle happy! |
|
6176 |
impl = n.ownerDocument.implementation; |
|
6177 |
if (impl.createHTMLDocument && (tinymce.isOpera && opera.buildNumber() >= 1767)) { |
|
6178 |
// Create an empty HTML document |
|
6179 |
doc = impl.createHTMLDocument(""); |
|
6180 |
||
6181 |
// Add the element or it's children if it's a body element to the new document |
|
6182 |
each(n.nodeName == 'BODY' ? n.childNodes : [n], function(node) { |
|
6183 |
doc.body.appendChild(doc.importNode(node, true)); |
|
6184 |
}); |
|
6185 |
||
6186 |
// Grab first child or body element for serialization |
|
6187 |
if (n.nodeName != 'BODY') |
|
6188 |
n = doc.body.firstChild; |
|
6189 |
else |
|
6190 |
n = doc.body; |
|
6191 |
||
6192 |
// set the new document in DOMUtils so createElement etc works |
|
6193 |
oldDoc = t.dom.doc; |
|
6194 |
t.dom.doc = doc; |
|
6195 |
} |
|
6196 |
||
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:
117
diff
changeset
|
6197 |
t.key = '' + (parseInt(t.key) + 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:
117
diff
changeset
|
6198 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6199 |
// Pre process |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6200 |
if (!o.no_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:
117
diff
changeset
|
6201 |
o.node = 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:
117
diff
changeset
|
6202 |
t.onPreProcess.dispatch(t, 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:
117
diff
changeset
|
6203 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6204 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6205 |
// Serialize HTML DOM into a string |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6206 |
t.writer.reset(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6207 |
t._serializeNode(n, o.getInner); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6208 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6209 |
// Post process |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6210 |
o.content = t.writer.getContent(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6211 |
|
1193 | 6212 |
// Restore the old document if it was changed |
6213 |
if (oldDoc) |
|
6214 |
t.dom.doc = oldDoc; |
|
6215 |
||
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:
117
diff
changeset
|
6216 |
if (!o.no_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:
117
diff
changeset
|
6217 |
t.onPostProcess.dispatch(t, 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:
117
diff
changeset
|
6218 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6219 |
t._postProcess(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:
117
diff
changeset
|
6220 |
o.node = 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:
117
diff
changeset
|
6221 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6222 |
return tinymce.trim(o.content); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6223 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6224 |
|
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
|
6225 |
// Internal functions |
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
|
6226 |
|
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
|
6227 |
_postProcess : function(o) { |
543 | 6228 |
var t = this, s = t.settings, h = o.content, sc = [], p; |
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
|
6229 |
|
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:
117
diff
changeset
|
6230 |
if (o.format == 'html') { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6231 |
// Protect some 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:
117
diff
changeset
|
6232 |
p = t._protect({ |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6233 |
content : 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:
117
diff
changeset
|
6234 |
patterns : [ |
543 | 6235 |
{pattern : /(<script[^>]*>)(.*?)(<\/script>)/g}, |
1193 | 6236 |
{pattern : /(<noscript[^>]*>)(.*?)(<\/noscript>)/g}, |
543 | 6237 |
{pattern : /(<style[^>]*>)(.*?)(<\/style>)/g}, |
778 | 6238 |
{pattern : /(<pre[^>]*>)(.*?)(<\/pre>)/g, encode : 1}, |
6239 |
{pattern : /(<!--\[CDATA\[)(.*?)(\]\]-->)/g} |
|
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:
117
diff
changeset
|
6240 |
] |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6241 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6242 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6243 |
h = p.content; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6244 |
|
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
|
6245 |
// Entity encode |
543 | 6246 |
if (s.entity_encoding !== 'raw') |
6247 |
h = t._encode(h); |
|
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
|
6248 |
|
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
|
6249 |
// Use BR instead of padded P elements inside editor and use <p> </p> outside editor |
543 | 6250 |
/* if (o.set) |
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
|
6251 |
h = h.replace(/<p>\s+( | |\u00a0|<br \/>)\s+<\/p>/g, '<p><br /></p>'); |
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
|
6252 |
else |
543 | 6253 |
h = h.replace(/<p>\s+( | |\u00a0|<br \/>)\s+<\/p>/g, '<p>$1</p>');*/ |
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
|
6254 |
|
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:
117
diff
changeset
|
6255 |
// Since Gecko and Safari keeps whitespace in the DOM we need to |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6256 |
// remove it inorder to match other browsers. But I think Gecko and Safari is right. |
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
|
6257 |
// This process is only done when getting contents out from the editor. |
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
|
6258 |
if (!o.set) { |
543 | 6259 |
// We need to replace paragraph whitespace with an nbsp before indentation to keep the \u00a0 char |
6260 |
h = h.replace(/<p>\s+<\/p>|<p([^>]+)>\s+<\/p>/g, s.entity_encoding == 'numeric' ? '<p$1> </p>' : '<p$1> </p>'); |
|
6261 |
||
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
|
6262 |
if (s.remove_linebreaks) { |
543 | 6263 |
h = h.replace(/\r?\n|\r/g, ' '); |
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
|
6264 |
h = h.replace(/(<[^>]+>)\s+/g, '$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
|
6265 |
h = h.replace(/\s+(<\/[^>]+>)/g, ' $1'); |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
6266 |
h = h.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object) ([^>]+)>\s+/g, '<$1 $2>'); // Trim block start |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
6267 |
h = h.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>\s+/g, '<$1>'); // Trim block start |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
6268 |
h = h.replace(/\s+<\/(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>/g, '</$1>'); // Trim block end |
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
|
6269 |
} |
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
|
6270 |
|
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
|
6271 |
// Simple indentation |
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
|
6272 |
if (s.apply_source_formatting && s.indent_mode == 'simple') { |
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
|
6273 |
// Add line breaks before and after block elements |
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
|
6274 |
h = h.replace(/<(\/?)(ul|hr|table|meta|link|tbody|tr|object|body|head|html|map)(|[^>]+)>\s*/g, '\n<$1$2$3>\n'); |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
6275 |
h = h.replace(/\s*<(p|h[1-6]|blockquote|div|title|style|pre|script|td|li|area)(|[^>]+)>/g, '\n<$1$2>'); |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
6276 |
h = h.replace(/<\/(p|h[1-6]|blockquote|div|title|style|pre|script|td|li)>\s*/g, '</$1>\n'); |
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
|
6277 |
h = h.replace(/\n\n/g, '\n'); |
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
|
6278 |
} |
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:
117
diff
changeset
|
6279 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6280 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6281 |
h = t._unprotect(h, p); |
543 | 6282 |
|
778 | 6283 |
// Restore CDATA sections |
6284 |
h = h.replace(/<!--\[CDATA\[([\s\S]+)\]\]-->/g, '<![CDATA[$1]]>'); |
|
6285 |
||
543 | 6286 |
// Restore the \u00a0 character if raw mode is enabled |
6287 |
if (s.entity_encoding == 'raw') |
|
6288 |
h = h.replace(/<p> <\/p>|<p([^>]+)> <\/p>/g, '<p$1>\u00a0</p>'); |
|
1193 | 6289 |
|
6290 |
// Restore noscript elements |
|
6291 |
h = h.replace(/<noscript([^>]+|)>([\s\S]*?)<\/noscript>/g, function(v, attribs, text) { |
|
6292 |
return '<noscript' + attribs + '>' + t.dom.decode(text.replace(/<!--|-->/g, '')) + '</noscript>'; |
|
6293 |
}); |
|
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:
117
diff
changeset
|
6294 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6295 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6296 |
o.content = 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:
117
diff
changeset
|
6297 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6298 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6299 |
_serializeNode : function(n, inn) { |
1193 | 6300 |
var t = this, s = t.settings, w = t.writer, hc, el, cn, i, l, a, at, no, v, nn, ru, ar, iv, closed; |
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:
117
diff
changeset
|
6301 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6302 |
if (!s.node_filter || s.node_filter(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:
117
diff
changeset
|
6303 |
switch (n.nodeType) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6304 |
case 1: // Element |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6305 |
if (n.hasAttribute ? n.hasAttribute('mce_bogus') : n.getAttribute('mce_bogus')) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6306 |
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:
117
diff
changeset
|
6307 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6308 |
iv = 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:
117
diff
changeset
|
6309 |
hc = n.hasChildNodes(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6310 |
nn = n.getAttribute('mce_name') || n.nodeName.toLowerCase(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6311 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6312 |
// Add correct prefix on IE |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6313 |
if (isIE) { |
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
|
6314 |
if (n.scopeName !== 'HTML' && n.scopeName !== 'html') |
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:
117
diff
changeset
|
6315 |
nn = n.scopeName + ':' + 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:
117
diff
changeset
|
6316 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6317 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6318 |
// Remove mce prefix on IE needed for the abbr element |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6319 |
if (nn.indexOf('mce:') === 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:
117
diff
changeset
|
6320 |
nn = nn.substring(4); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6321 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6322 |
// Check if valid |
1193 | 6323 |
if (!t.validElementsRE || !t.validElementsRE.test(nn) || (t.invalidElementsRE && t.invalidElementsRE.test(nn)) || inn) { |
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:
117
diff
changeset
|
6324 |
iv = 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:
117
diff
changeset
|
6325 |
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:
117
diff
changeset
|
6326 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6327 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6328 |
if (isIE) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6329 |
// Fix IE content duplication (DOM can have multiple copies of the same node) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6330 |
if (s.fix_content_duplication) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6331 |
if (n.mce_serialized == t.key) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6332 |
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:
117
diff
changeset
|
6333 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6334 |
n.mce_serialized = t.key; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6335 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6336 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6337 |
// IE sometimes adds a / infront of the node 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:
117
diff
changeset
|
6338 |
if (nn.charAt(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:
117
diff
changeset
|
6339 |
nn = nn.substring(1); |
543 | 6340 |
} else if (isGecko) { |
6341 |
// Ignore br elements |
|
6342 |
if (n.nodeName === 'BR' && n.getAttribute('type') == '_moz') |
|
6343 |
return; |
|
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:
117
diff
changeset
|
6344 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6345 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6346 |
// Check if valid child |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6347 |
if (t.childRules) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6348 |
if (t.parentElementsRE.test(t.elementName)) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6349 |
if (!t.childRules[t.elementName].test(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:
117
diff
changeset
|
6350 |
iv = 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:
117
diff
changeset
|
6351 |
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:
117
diff
changeset
|
6352 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6353 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6354 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6355 |
t.elementName = 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:
117
diff
changeset
|
6356 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6357 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6358 |
ru = t.findRule(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:
117
diff
changeset
|
6359 |
nn = ru.name || nn; |
1193 | 6360 |
closed = s.closed.test(nn); |
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:
117
diff
changeset
|
6361 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6362 |
// Skip empty nodes or empty node name in IE |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6363 |
if ((!hc && ru.noEmpty) || (isIE && !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:
117
diff
changeset
|
6364 |
iv = 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:
117
diff
changeset
|
6365 |
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:
117
diff
changeset
|
6366 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6367 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6368 |
// Check required |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6369 |
if (ru.requiredAttribs) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6370 |
a = ru.requiredAttribs; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6371 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6372 |
for (i = a.length - 1; i >= 0; i--) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6373 |
if (this.dom.getAttrib(n, a[i]) !== '') |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6374 |
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:
117
diff
changeset
|
6375 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6376 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6377 |
// None of the required was there |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6378 |
if (i == -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:
117
diff
changeset
|
6379 |
iv = 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:
117
diff
changeset
|
6380 |
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:
117
diff
changeset
|
6381 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6382 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6383 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6384 |
w.writeStartElement(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:
117
diff
changeset
|
6385 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6386 |
// Add ordered attributes |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6387 |
if (ru.attribs) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6388 |
for (i=0, at = ru.attribs, l = at.length; i<l; i++) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6389 |
a = at[i]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6390 |
v = t._getAttrib(n, 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:
117
diff
changeset
|
6391 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6392 |
if (v !== 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:
117
diff
changeset
|
6393 |
w.writeAttribute(a.name, 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:
117
diff
changeset
|
6394 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6395 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6396 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6397 |
// Add wild attributes |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6398 |
if (ru.validAttribsRE) { |
1193 | 6399 |
at = t.dom.getAttribs(n); |
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:
117
diff
changeset
|
6400 |
for (i=at.length-1; i>-1; i--) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6401 |
no = at[i]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6402 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6403 |
if (no.specified) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6404 |
a = no.nodeName.toLowerCase(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6405 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6406 |
if (s.invalid_attrs.test(a) || !ru.validAttribsRE.test(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:
117
diff
changeset
|
6407 |
continue; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6408 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6409 |
ar = t.findAttribRule(ru, 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:
117
diff
changeset
|
6410 |
v = t._getAttrib(n, ar, 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:
117
diff
changeset
|
6411 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6412 |
if (v !== 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:
117
diff
changeset
|
6413 |
w.writeAttribute(a, 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:
117
diff
changeset
|
6414 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6415 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6416 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6417 |
|
1193 | 6418 |
// Write text from script |
6419 |
if (nn === 'script' && tinymce.trim(n.innerHTML)) { |
|
6420 |
w.writeText('// '); // Padd it with a comment so it will parse on older browsers |
|
6421 |
w.writeCDATA(n.innerHTML.replace(/<!--|-->|<\[CDATA\[|\]\]>/g, '')); // Remove comments and cdata stuctures |
|
6422 |
hc = false; |
|
6423 |
break; |
|
6424 |
} |
|
6425 |
||
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:
117
diff
changeset
|
6426 |
// Padd empty nodes with a |
778 | 6427 |
if (ru.padd) { |
6428 |
// If it has only one bogus child, padd it anyway workaround for <td><br /></td> bug |
|
6429 |
if (hc && (cn = n.firstChild) && cn.nodeType === 1 && n.childNodes.length === 1) { |
|
6430 |
if (cn.hasAttribute ? cn.hasAttribute('mce_bogus') : cn.getAttribute('mce_bogus')) |
|
6431 |
w.writeText('\u00a0'); |
|
6432 |
} else if (!hc) |
|
6433 |
w.writeText('\u00a0'); // No children then padd it |
|
6434 |
} |
|
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:
117
diff
changeset
|
6435 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6436 |
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:
117
diff
changeset
|
6437 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6438 |
case 3: // Text |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6439 |
// Check if valid child |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6440 |
if (t.childRules && t.parentElementsRE.test(t.elementName)) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6441 |
if (!t.childRules[t.elementName].test(n.nodeName)) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6442 |
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:
117
diff
changeset
|
6443 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6444 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6445 |
return w.writeText(n.nodeValue); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6446 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6447 |
case 4: // CDATA |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6448 |
return w.writeCDATA(n.nodeValue); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6449 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6450 |
case 8: // Comment |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6451 |
return w.writeComment(n.nodeValue); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6452 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6453 |
} else if (n.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:
117
diff
changeset
|
6454 |
hc = n.hasChildNodes(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6455 |
|
1193 | 6456 |
if (hc && !closed) { |
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:
117
diff
changeset
|
6457 |
cn = n.firstChild; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6458 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6459 |
while (cn) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6460 |
t._serializeNode(cn); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6461 |
t.elementName = 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:
117
diff
changeset
|
6462 |
cn = cn.nextSibling; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6463 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6464 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6465 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6466 |
// Write element end |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6467 |
if (!iv) { |
1193 | 6468 |
if (!closed) |
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:
117
diff
changeset
|
6469 |
w.writeFullEndElement(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6470 |
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:
117
diff
changeset
|
6471 |
w.writeEndElement(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6472 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6473 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6474 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6475 |
_protect : function(o) { |
543 | 6476 |
var t = this; |
6477 |
||
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:
117
diff
changeset
|
6478 |
o.items = o.items || []; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6479 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6480 |
function enc(s) { |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
6481 |
return s.replace(/[\r\n\\]/g, function(c) { |
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:
117
diff
changeset
|
6482 |
if (c === '\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:
117
diff
changeset
|
6483 |
return '\\n'; |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
6484 |
else if (c === '\\') |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
6485 |
return '\\\\'; |
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:
117
diff
changeset
|
6486 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6487 |
return '\\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:
117
diff
changeset
|
6488 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6489 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6490 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6491 |
function dec(s) { |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
6492 |
return s.replace(/\\[\\rn]/g, function(c) { |
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:
117
diff
changeset
|
6493 |
if (c === '\\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:
117
diff
changeset
|
6494 |
return '\n'; |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
6495 |
else if (c === '\\\\') |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
6496 |
return '\\'; |
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:
117
diff
changeset
|
6497 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6498 |
return '\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:
117
diff
changeset
|
6499 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6500 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6501 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6502 |
each(o.patterns, function(p) { |
543 | 6503 |
o.content = dec(enc(o.content).replace(p.pattern, function(x, a, b, c) { |
6504 |
b = dec(b); |
|
6505 |
||
6506 |
if (p.encode) |
|
6507 |
b = t._encode(b); |
|
6508 |
||
6509 |
o.items.push(b); |
|
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
|
6510 |
return a + '<!--mce:' + (o.items.length - 1) + '-->' + c; |
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:
117
diff
changeset
|
6511 |
})); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6512 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6513 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6514 |
return 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:
117
diff
changeset
|
6515 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6516 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6517 |
_unprotect : function(h, 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:
117
diff
changeset
|
6518 |
h = h.replace(/\<!--mce:([0-9]+)--\>/g, function(a, 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:
117
diff
changeset
|
6519 |
return o.items[parseInt(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:
117
diff
changeset
|
6520 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6521 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6522 |
o.items = []; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6523 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6524 |
return 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:
117
diff
changeset
|
6525 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6526 |
|
543 | 6527 |
_encode : function(h) { |
6528 |
var t = this, s = t.settings, l; |
|
6529 |
||
6530 |
// Entity encode |
|
6531 |
if (s.entity_encoding !== 'raw') { |
|
6532 |
if (s.entity_encoding.indexOf('named') != -1) { |
|
6533 |
t.setEntities(s.entities); |
|
6534 |
l = t.entityLookup; |
|
6535 |
||
6536 |
h = h.replace(t.entitiesRE, function(a) { |
|
6537 |
var v; |
|
6538 |
||
6539 |
if (v = l[a]) |
|
6540 |
a = '&' + v + ';'; |
|
6541 |
||
6542 |
return a; |
|
6543 |
}); |
|
6544 |
} |
|
6545 |
||
6546 |
if (s.entity_encoding.indexOf('numeric') != -1) { |
|
6547 |
h = h.replace(/[\u007E-\uFFFF]/g, function(a) { |
|
6548 |
return '&#' + a.charCodeAt(0) + ';'; |
|
6549 |
}); |
|
6550 |
} |
|
6551 |
} |
|
6552 |
||
6553 |
return h; |
|
6554 |
}, |
|
6555 |
||
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:
117
diff
changeset
|
6556 |
_setup : 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:
117
diff
changeset
|
6557 |
var t = this, s = this.settings; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6558 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6559 |
if (t.done) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6560 |
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:
117
diff
changeset
|
6561 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6562 |
t.done = 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:
117
diff
changeset
|
6563 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6564 |
t.setRules(s.valid_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:
117
diff
changeset
|
6565 |
t.addRules(s.extended_valid_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:
117
diff
changeset
|
6566 |
t.addValidChildRules(s.valid_child_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:
117
diff
changeset
|
6567 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6568 |
if (s.invalid_elements) |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
6569 |
t.invalidElementsRE = new RegExp('^(' + wildcardToRE(s.invalid_elements.replace(/,/g, '|').toLowerCase()) + ')$'); |
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:
117
diff
changeset
|
6570 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6571 |
if (s.attrib_value_filter) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6572 |
t.attribValueFilter = s.attribValueFilter; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6573 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6574 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6575 |
_getAttrib : function(n, a, na) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6576 |
var i, 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:
117
diff
changeset
|
6577 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6578 |
na = na || a.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:
117
diff
changeset
|
6579 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6580 |
if (a.forcedVal && (v = a.forcedVal)) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6581 |
if (v === '{$uid}') |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6582 |
return this.dom.uniqueId(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6583 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6584 |
return 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:
117
diff
changeset
|
6585 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6586 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6587 |
v = this.dom.getAttrib(n, na); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6588 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6589 |
switch (na) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6590 |
case 'rowspan': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6591 |
case 'colspan': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6592 |
// Whats the point? Remove usless attribute value |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6593 |
if (v == '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:
117
diff
changeset
|
6594 |
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:
117
diff
changeset
|
6595 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6596 |
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:
117
diff
changeset
|
6597 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6598 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6599 |
if (this.attribValueFilter) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6600 |
v = this.attribValueFilter(na, v, 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:
117
diff
changeset
|
6601 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6602 |
if (a.validVals) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6603 |
for (i = a.validVals.length - 1; i >= 0; i--) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6604 |
if (v == a.validVals[i]) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6605 |
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:
117
diff
changeset
|
6606 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6607 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6608 |
if (i == -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:
117
diff
changeset
|
6609 |
return 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:
117
diff
changeset
|
6610 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6611 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6612 |
if (v === '' && typeof(a.defaultVal) != 'undefined') { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6613 |
v = a.defaultVal; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6614 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6615 |
if (v === '{$uid}') |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6616 |
return this.dom.uniqueId(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6617 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6618 |
return 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:
117
diff
changeset
|
6619 |
} 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:
117
diff
changeset
|
6620 |
// Remove internal mceItemXX classes when content is extracted from 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:
117
diff
changeset
|
6621 |
if (na == 'class' && this.processObj.get) |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
6622 |
v = v.replace(/\s?mceItem\w+\s?/g, ''); |
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:
117
diff
changeset
|
6623 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6624 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6625 |
if (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:
117
diff
changeset
|
6626 |
return 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:
117
diff
changeset
|
6627 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6628 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6629 |
return 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:
117
diff
changeset
|
6630 |
} |
1193 | 6631 |
}); |
6632 |
})(tinymce); |
|
6633 |
(function(tinymce) { |
|
778 | 6634 |
var each = tinymce.each, Event = tinymce.dom.Event; |
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:
117
diff
changeset
|
6635 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6636 |
tinymce.create('tinymce.dom.ScriptLoader', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6637 |
ScriptLoader : function(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:
117
diff
changeset
|
6638 |
this.settings = 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:
117
diff
changeset
|
6639 |
this.queue = []; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6640 |
this.lookup = {}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6641 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6642 |
|
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
6643 |
isDone : function(u) { |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
6644 |
return this.lookup[u] ? this.lookup[u].state == 2 : 0; |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
6645 |
}, |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
6646 |
|
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:
117
diff
changeset
|
6647 |
markDone : function(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:
117
diff
changeset
|
6648 |
this.lookup[u] = {state : 2, url : 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:
117
diff
changeset
|
6649 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6650 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6651 |
add : function(u, cb, s, pr) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6652 |
var t = this, lo = t.lookup, 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:
117
diff
changeset
|
6653 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6654 |
if (o = lo[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:
117
diff
changeset
|
6655 |
// Is loaded fire callback |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6656 |
if (cb && o.state == 2) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6657 |
cb.call(s || 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:
117
diff
changeset
|
6658 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6659 |
return 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:
117
diff
changeset
|
6660 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6661 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6662 |
o = {state : 0, url : u, func : cb, scope : s || 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:
117
diff
changeset
|
6663 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6664 |
if (pr) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6665 |
t.queue.unshift(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:
117
diff
changeset
|
6666 |
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:
117
diff
changeset
|
6667 |
t.queue.push(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:
117
diff
changeset
|
6668 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6669 |
lo[u] = 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:
117
diff
changeset
|
6670 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6671 |
return 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:
117
diff
changeset
|
6672 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6673 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6674 |
load : function(u, cb, s) { |
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
|
6675 |
var t = this, o; |
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
|
6676 |
|
543 | 6677 |
if (o = t.lookup[u]) { |
6678 |
// Is loaded fire callback |
|
6679 |
if (cb && o.state == 2) |
|
6680 |
cb.call(s || t); |
|
6681 |
||
6682 |
return o; |
|
6683 |
} |
|
6684 |
||
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
|
6685 |
function loadScript(u) { |
778 | 6686 |
if (Event.domLoaded || t.settings.strict_mode) { |
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
|
6687 |
tinymce.util.XHR.send({ |
543 | 6688 |
url : tinymce._addVer(u), |
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
|
6689 |
error : t.settings.error, |
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
|
6690 |
async : false, |
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
|
6691 |
success : function(co) { |
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
|
6692 |
t.eval(co); |
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
|
6693 |
} |
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
|
6694 |
}); |
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
|
6695 |
} else |
543 | 6696 |
document.write('<script type="text/javascript" src="' + tinymce._addVer(u) + '"></script>'); |
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
|
6697 |
}; |
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:
117
diff
changeset
|
6698 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6699 |
if (!tinymce.is(u, 'string')) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6700 |
each(u, function(u) { |
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
|
6701 |
loadScript(u); |
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:
117
diff
changeset
|
6702 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6703 |
|
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
|
6704 |
if (cb) |
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
|
6705 |
cb.call(s || t); |
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
|
6706 |
} else { |
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
|
6707 |
loadScript(u); |
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
|
6708 |
|
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
|
6709 |
if (cb) |
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
|
6710 |
cb.call(s || t); |
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
|
6711 |
} |
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:
117
diff
changeset
|
6712 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6713 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6714 |
loadQueue : function(cb, 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:
117
diff
changeset
|
6715 |
var t = 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:
117
diff
changeset
|
6716 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6717 |
if (!t.queueLoading) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6718 |
t.queueLoading = 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:
117
diff
changeset
|
6719 |
t.queueCallbacks = []; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6720 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6721 |
t.loadScripts(t.queue, 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:
117
diff
changeset
|
6722 |
t.queueLoading = 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:
117
diff
changeset
|
6723 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6724 |
if (cb) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6725 |
cb.call(s || t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6726 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6727 |
each(t.queueCallbacks, function(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:
117
diff
changeset
|
6728 |
o.func.call(o.scope); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6729 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6730 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6731 |
} else if (cb) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6732 |
t.queueCallbacks.push({func : cb, scope : s || t}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6733 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6734 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6735 |
eval : function(co) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6736 |
var w = window; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6737 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6738 |
// Evaluate script |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6739 |
if (!w.execScript) { |
1 | 6740 |
try { |
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:
117
diff
changeset
|
6741 |
eval.call(w, co); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6742 |
} 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:
117
diff
changeset
|
6743 |
eval(co, w); // Firefox 3.0a8 |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6744 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6745 |
} 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:
117
diff
changeset
|
6746 |
w.execScript(co); // IE |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6747 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6748 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6749 |
loadScripts : function(sc, cb, 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:
117
diff
changeset
|
6750 |
var t = this, lo = t.lookup; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6751 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6752 |
function done(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:
117
diff
changeset
|
6753 |
o.state = 2; // Has been loaded |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6754 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6755 |
// Run callback |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6756 |
if (o.func) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6757 |
o.func.call(o.scope || t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6758 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6759 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6760 |
function allDone() { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6761 |
var l; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6762 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6763 |
// Check if all files are loaded |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6764 |
l = sc.length; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6765 |
each(sc, function(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:
117
diff
changeset
|
6766 |
o = lo[o.url]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6767 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6768 |
if (o.state === 2) {// It has finished loading |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6769 |
done(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:
117
diff
changeset
|
6770 |
l--; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6771 |
} 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:
117
diff
changeset
|
6772 |
load(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:
117
diff
changeset
|
6773 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6774 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6775 |
// They are all loaded |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6776 |
if (l === 0 && cb) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6777 |
cb.call(s || t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6778 |
cb = 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:
117
diff
changeset
|
6779 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6780 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6781 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6782 |
function load(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:
117
diff
changeset
|
6783 |
if (o.state > 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:
117
diff
changeset
|
6784 |
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:
117
diff
changeset
|
6785 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6786 |
o.state = 1; // Is loading |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6787 |
|
778 | 6788 |
tinymce.dom.ScriptLoader.loadScript(o.url, function() { |
6789 |
done(o); |
|
6790 |
allDone(); |
|
6791 |
}); |
|
6792 |
||
6793 |
/* |
|
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:
117
diff
changeset
|
6794 |
tinymce.util.XHR.send({ |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6795 |
url : o.url, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6796 |
error : t.settings.error, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6797 |
success : function(co) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6798 |
t.eval(co); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6799 |
done(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:
117
diff
changeset
|
6800 |
allDone(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6801 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6802 |
}); |
778 | 6803 |
*/ |
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:
117
diff
changeset
|
6804 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6805 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6806 |
each(sc, function(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:
117
diff
changeset
|
6807 |
var u = o.url; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6808 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6809 |
// Add to queue if needed |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6810 |
if (!lo[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:
117
diff
changeset
|
6811 |
lo[u] = 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:
117
diff
changeset
|
6812 |
t.queue.push(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:
117
diff
changeset
|
6813 |
} 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:
117
diff
changeset
|
6814 |
o = lo[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:
117
diff
changeset
|
6815 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6816 |
// Is already loading or has been loaded |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6817 |
if (o.state > 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:
117
diff
changeset
|
6818 |
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:
117
diff
changeset
|
6819 |
|
778 | 6820 |
if (!Event.domLoaded && !t.settings.strict_mode) { |
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:
117
diff
changeset
|
6821 |
var ix, ol = ''; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6822 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6823 |
// Add onload 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:
117
diff
changeset
|
6824 |
if (cb || o.func) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6825 |
o.state = 1; // Is loading |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6826 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6827 |
ix = tinymce.dom.ScriptLoader._addOnLoad(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:
117
diff
changeset
|
6828 |
done(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:
117
diff
changeset
|
6829 |
allDone(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6830 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6831 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6832 |
if (tinymce.isIE) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6833 |
ol = ' onreadystatechange="'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6834 |
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:
117
diff
changeset
|
6835 |
ol = ' onload="'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6836 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6837 |
ol += 'tinymce.dom.ScriptLoader._onLoad(this,\'' + u + '\',' + ix + ');"'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6838 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6839 |
|
543 | 6840 |
document.write('<script type="text/javascript" src="' + tinymce._addVer(u) + '"' + ol + '></script>'); |
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:
117
diff
changeset
|
6841 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6842 |
if (!o.func) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6843 |
done(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:
117
diff
changeset
|
6844 |
} 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:
117
diff
changeset
|
6845 |
load(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:
117
diff
changeset
|
6846 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6847 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6848 |
allDone(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6849 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6850 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6851 |
// Static methods |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6852 |
'static' : { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6853 |
_addOnLoad : function(f) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6854 |
var t = 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:
117
diff
changeset
|
6855 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6856 |
t._funcs = t._funcs || []; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6857 |
t._funcs.push(f); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6858 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6859 |
return t._funcs.length - 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:
117
diff
changeset
|
6860 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6861 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6862 |
_onLoad : function(e, u, ix) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6863 |
if (!tinymce.isIE || e.readyState == 'complete') |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6864 |
this._funcs[ix].call(this); |
778 | 6865 |
}, |
6866 |
||
6867 |
loadScript : function(u, cb) { |
|
6868 |
var id = tinymce.DOM.uniqueId(), e; |
|
6869 |
||
6870 |
function done() { |
|
6871 |
Event.clear(id); |
|
6872 |
tinymce.DOM.remove(id); |
|
6873 |
||
6874 |
if (cb) { |
|
6875 |
cb.call(document, u); |
|
6876 |
cb = 0; |
|
6877 |
} |
|
6878 |
}; |
|
6879 |
||
6880 |
if (tinymce.isIE) { |
|
6881 |
/* Event.add(e, 'readystatechange', function(e) { |
|
6882 |
if (e.target && e.target.readyState == 'complete') |
|
6883 |
done(); |
|
6884 |
});*/ |
|
6885 |
||
6886 |
tinymce.util.XHR.send({ |
|
6887 |
url : tinymce._addVer(u), |
|
6888 |
async : false, |
|
6889 |
success : function(co) { |
|
6890 |
window.execScript(co); |
|
6891 |
done(); |
|
6892 |
} |
|
6893 |
}); |
|
6894 |
} else { |
|
6895 |
e = tinymce.DOM.create('script', {id : id, type : 'text/javascript', src : tinymce._addVer(u)}); |
|
6896 |
Event.add(e, 'load', done); |
|
6897 |
||
6898 |
// Check for head or body |
|
6899 |
(document.getElementsByTagName('head')[0] || document.body).appendChild(e); |
|
6900 |
} |
|
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:
117
diff
changeset
|
6901 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6902 |
} |
1193 | 6903 |
}); |
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:
117
diff
changeset
|
6904 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6905 |
// Global script loader |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6906 |
tinymce.ScriptLoader = new tinymce.dom.ScriptLoader(); |
1193 | 6907 |
})(tinymce); |
6908 |
(function(tinymce) { |
|
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:
117
diff
changeset
|
6909 |
// Shorten class names |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6910 |
var DOM = tinymce.DOM, is = tinymce.is; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6911 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6912 |
tinymce.create('tinymce.ui.Control', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6913 |
Control : function(id, 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:
117
diff
changeset
|
6914 |
this.id = id; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6915 |
this.settings = s = 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:
117
diff
changeset
|
6916 |
this.rendered = 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:
117
diff
changeset
|
6917 |
this.onRender = new tinymce.util.Dispatcher(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:
117
diff
changeset
|
6918 |
this.classPrefix = ''; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6919 |
this.scope = s.scope || 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:
117
diff
changeset
|
6920 |
this.disabled = 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:
117
diff
changeset
|
6921 |
this.active = 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:
117
diff
changeset
|
6922 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6923 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6924 |
setDisabled : function(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:
117
diff
changeset
|
6925 |
var 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:
117
diff
changeset
|
6926 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6927 |
if (s != this.disabled) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6928 |
e = DOM.get(this.id); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6929 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6930 |
// Add accessibility title for unavailable actions |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6931 |
if (e && this.settings.unavailable_prefix) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6932 |
if (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:
117
diff
changeset
|
6933 |
this.prevTitle = e.title; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6934 |
e.title = this.settings.unavailable_prefix + ": " + e.title; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6935 |
} 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:
117
diff
changeset
|
6936 |
e.title = this.prevTitle; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6937 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6938 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6939 |
this.setState('Disabled', 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:
117
diff
changeset
|
6940 |
this.setState('Enabled', !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:
117
diff
changeset
|
6941 |
this.disabled = 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:
117
diff
changeset
|
6942 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6943 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6944 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6945 |
isDisabled : 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:
117
diff
changeset
|
6946 |
return this.disabled; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6947 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6948 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6949 |
setActive : function(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:
117
diff
changeset
|
6950 |
if (s != this.active) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6951 |
this.setState('Active', 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:
117
diff
changeset
|
6952 |
this.active = 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:
117
diff
changeset
|
6953 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6954 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6955 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6956 |
isActive : 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:
117
diff
changeset
|
6957 |
return this.active; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6958 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6959 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6960 |
setState : function(c, 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:
117
diff
changeset
|
6961 |
var n = DOM.get(this.id); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6962 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6963 |
c = this.classPrefix + c; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6964 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6965 |
if (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:
117
diff
changeset
|
6966 |
DOM.addClass(n, c); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6967 |
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:
117
diff
changeset
|
6968 |
DOM.removeClass(n, c); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6969 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6970 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6971 |
isRendered : 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:
117
diff
changeset
|
6972 |
return this.rendered; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6973 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6974 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6975 |
renderHTML : 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:
117
diff
changeset
|
6976 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6977 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6978 |
renderTo : function(n) { |
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
|
6979 |
DOM.setHTML(n, this.renderHTML()); |
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:
117
diff
changeset
|
6980 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6981 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6982 |
postRender : 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:
117
diff
changeset
|
6983 |
var t = this, 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:
117
diff
changeset
|
6984 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6985 |
// Set pending states |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6986 |
if (is(t.disabled)) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6987 |
b = t.disabled; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6988 |
t.disabled = -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:
117
diff
changeset
|
6989 |
t.setDisabled(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:
117
diff
changeset
|
6990 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6991 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6992 |
if (is(t.active)) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6993 |
b = t.active; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6994 |
t.active = -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:
117
diff
changeset
|
6995 |
t.setActive(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:
117
diff
changeset
|
6996 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6997 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
6998 |
|
543 | 6999 |
remove : function() { |
7000 |
DOM.remove(this.id); |
|
7001 |
this.destroy(); |
|
7002 |
}, |
|
7003 |
||
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:
117
diff
changeset
|
7004 |
destroy : function() { |
543 | 7005 |
tinymce.dom.Event.clear(this.id); |
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:
117
diff
changeset
|
7006 |
} |
1193 | 7007 |
}); |
7008 |
})(tinymce);tinymce.create('tinymce.ui.Container:tinymce.ui.Control', { |
|
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:
117
diff
changeset
|
7009 |
Container : function(id, 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:
117
diff
changeset
|
7010 |
this.parent(id, s); |
1193 | 7011 |
|
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:
117
diff
changeset
|
7012 |
this.controls = []; |
1193 | 7013 |
|
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:
117
diff
changeset
|
7014 |
this.lookup = {}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7015 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7016 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7017 |
add : function(c) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7018 |
this.lookup[c.id] = c; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7019 |
this.controls.push(c); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7020 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7021 |
return c; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7022 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7023 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7024 |
get : 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:
117
diff
changeset
|
7025 |
return this.lookup[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:
117
diff
changeset
|
7026 |
} |
1193 | 7027 |
}); |
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:
117
diff
changeset
|
7028 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7029 |
tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', { |
543 | 7030 |
Separator : function(id, s) { |
7031 |
this.parent(id, s); |
|
7032 |
this.classPrefix = 'mceSeparator'; |
|
7033 |
}, |
|
7034 |
||
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:
117
diff
changeset
|
7035 |
renderHTML : function() { |
543 | 7036 |
return tinymce.DOM.createHTML('span', {'class' : this.classPrefix}); |
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:
117
diff
changeset
|
7037 |
} |
1193 | 7038 |
}); |
7039 |
(function(tinymce) { |
|
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:
117
diff
changeset
|
7040 |
var is = tinymce.is, DOM = tinymce.DOM, each = tinymce.each, walk = tinymce.walk; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7041 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7042 |
tinymce.create('tinymce.ui.MenuItem:tinymce.ui.Control', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7043 |
MenuItem : function(id, 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:
117
diff
changeset
|
7044 |
this.parent(id, 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:
117
diff
changeset
|
7045 |
this.classPrefix = 'mceMenuItem'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7046 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7047 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7048 |
setSelected : function(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:
117
diff
changeset
|
7049 |
this.setState('Selected', 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:
117
diff
changeset
|
7050 |
this.selected = 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:
117
diff
changeset
|
7051 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7052 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7053 |
isSelected : 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:
117
diff
changeset
|
7054 |
return this.selected; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7055 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7056 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7057 |
postRender : 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:
117
diff
changeset
|
7058 |
var t = 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:
117
diff
changeset
|
7059 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7060 |
t.parent(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7061 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7062 |
// Set pending state |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7063 |
if (is(t.selected)) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7064 |
t.setSelected(t.selected); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7065 |
} |
1193 | 7066 |
}); |
7067 |
})(tinymce); |
|
7068 |
(function(tinymce) { |
|
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:
117
diff
changeset
|
7069 |
var is = tinymce.is, DOM = tinymce.DOM, each = tinymce.each, walk = tinymce.walk; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7070 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7071 |
tinymce.create('tinymce.ui.Menu:tinymce.ui.MenuItem', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7072 |
Menu : function(id, 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:
117
diff
changeset
|
7073 |
var t = 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:
117
diff
changeset
|
7074 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7075 |
t.parent(id, 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:
117
diff
changeset
|
7076 |
t.items = {}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7077 |
t.collapsed = 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:
117
diff
changeset
|
7078 |
t.menuCount = 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:
117
diff
changeset
|
7079 |
t.onAddItem = new tinymce.util.Dispatcher(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:
117
diff
changeset
|
7080 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7081 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7082 |
expand : function(d) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7083 |
var t = 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:
117
diff
changeset
|
7084 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7085 |
if (d) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7086 |
walk(t, function(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:
117
diff
changeset
|
7087 |
if (o.expand) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7088 |
o.expand(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7089 |
}, 'items', t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7090 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7091 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7092 |
t.collapsed = 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:
117
diff
changeset
|
7093 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7094 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7095 |
collapse : function(d) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7096 |
var t = 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:
117
diff
changeset
|
7097 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7098 |
if (d) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7099 |
walk(t, function(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:
117
diff
changeset
|
7100 |
if (o.collapse) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7101 |
o.collapse(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7102 |
}, 'items', t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7103 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7104 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7105 |
t.collapsed = 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:
117
diff
changeset
|
7106 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7107 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7108 |
isCollapsed : 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:
117
diff
changeset
|
7109 |
return this.collapsed; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7110 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7111 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7112 |
add : function(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:
117
diff
changeset
|
7113 |
if (!o.settings) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7114 |
o = new tinymce.ui.MenuItem(o.id || DOM.uniqueId(), 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:
117
diff
changeset
|
7115 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7116 |
this.onAddItem.dispatch(this, 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:
117
diff
changeset
|
7117 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7118 |
return this.items[o.id] = 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:
117
diff
changeset
|
7119 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7120 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7121 |
addSeparator : 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:
117
diff
changeset
|
7122 |
return this.add({separator : 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:
117
diff
changeset
|
7123 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7124 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7125 |
addMenu : function(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:
117
diff
changeset
|
7126 |
if (!o.collapse) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7127 |
o = this.createMenu(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:
117
diff
changeset
|
7128 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7129 |
this.menuCount++; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7130 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7131 |
return this.add(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:
117
diff
changeset
|
7132 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7133 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7134 |
hasMenus : 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:
117
diff
changeset
|
7135 |
return this.menuCount !== 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:
117
diff
changeset
|
7136 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7137 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7138 |
remove : function(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:
117
diff
changeset
|
7139 |
delete this.items[o.id]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7140 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7141 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7142 |
removeAll : 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:
117
diff
changeset
|
7143 |
var t = 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:
117
diff
changeset
|
7144 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7145 |
walk(t, function(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:
117
diff
changeset
|
7146 |
if (o.removeAll) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7147 |
o.removeAll(); |
543 | 7148 |
else |
7149 |
o.remove(); |
|
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:
117
diff
changeset
|
7150 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7151 |
o.destroy(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7152 |
}, 'items', t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7153 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7154 |
t.items = {}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7155 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7156 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7157 |
createMenu : function(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:
117
diff
changeset
|
7158 |
var m = new tinymce.ui.Menu(o.id || DOM.uniqueId(), 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:
117
diff
changeset
|
7159 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7160 |
m.onAddItem.add(this.onAddItem.dispatch, this.onAddItem); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7161 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7162 |
return m; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7163 |
} |
1193 | 7164 |
}); |
7165 |
})(tinymce);(function(tinymce) { |
|
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:
117
diff
changeset
|
7166 |
var is = tinymce.is, DOM = tinymce.DOM, each = tinymce.each, Event = tinymce.dom.Event, Element = tinymce.dom.Element; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7167 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7168 |
tinymce.create('tinymce.ui.DropMenu:tinymce.ui.Menu', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7169 |
DropMenu : function(id, 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:
117
diff
changeset
|
7170 |
s = s || {}; |
543 | 7171 |
s.container = s.container || DOM.doc.body; |
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:
117
diff
changeset
|
7172 |
s.offset_x = s.offset_x || 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:
117
diff
changeset
|
7173 |
s.offset_y = s.offset_y || 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:
117
diff
changeset
|
7174 |
s.vp_offset_x = s.vp_offset_x || 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:
117
diff
changeset
|
7175 |
s.vp_offset_y = s.vp_offset_y || 0; |
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
|
7176 |
|
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
|
7177 |
if (is(s.icons) && !s.icons) |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
7178 |
s['class'] += ' mceNoIcons'; |
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
|
7179 |
|
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:
117
diff
changeset
|
7180 |
this.parent(id, s); |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
7181 |
this.onShowMenu = new tinymce.util.Dispatcher(this); |
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:
117
diff
changeset
|
7182 |
this.onHideMenu = new tinymce.util.Dispatcher(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:
117
diff
changeset
|
7183 |
this.classPrefix = 'mceMenu'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7184 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7185 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7186 |
createMenu : function(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:
117
diff
changeset
|
7187 |
var t = this, cs = t.settings, m; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7188 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7189 |
s.container = s.container || cs.container; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7190 |
s.parent = t; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7191 |
s.constrain = s.constrain || cs.constrain; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7192 |
s['class'] = s['class'] || cs['class']; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7193 |
s.vp_offset_x = s.vp_offset_x || cs.vp_offset_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:
117
diff
changeset
|
7194 |
s.vp_offset_y = s.vp_offset_y || cs.vp_offset_y; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7195 |
m = new tinymce.ui.DropMenu(s.id || DOM.uniqueId(), 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:
117
diff
changeset
|
7196 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7197 |
m.onAddItem.add(t.onAddItem.dispatch, t.onAddItem); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7198 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7199 |
return m; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7200 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7201 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7202 |
update : 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:
117
diff
changeset
|
7203 |
var t = this, s = t.settings, tb = DOM.get('menu_' + t.id + '_tbl'), co = DOM.get('menu_' + t.id + '_co'), tw, th; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7204 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7205 |
tw = s.max_width ? Math.min(tb.clientWidth, s.max_width) : tb.clientWidth; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7206 |
th = s.max_height ? Math.min(tb.clientHeight, s.max_height) : tb.clientHeight; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7207 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7208 |
if (!DOM.boxModel) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7209 |
t.element.setStyles({width : tw + 2, height : th + 2}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7210 |
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:
117
diff
changeset
|
7211 |
t.element.setStyles({width : tw, height : th}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7212 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7213 |
if (s.max_width) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7214 |
DOM.setStyle(co, 'width', tw); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7215 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7216 |
if (s.max_height) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7217 |
DOM.setStyle(co, 'height', th); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7218 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7219 |
if (tb.clientHeight < s.max_height) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7220 |
DOM.setStyle(co, 'overflow', 'hidden'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7221 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7222 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7223 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7224 |
showMenu : function(x, y, px) { |
543 | 7225 |
var t = this, s = t.settings, co, vp = DOM.getViewPort(), w, h, mx, my, ot = 2, dm, tb, cp = t.classPrefix; |
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:
117
diff
changeset
|
7226 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7227 |
t.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:
117
diff
changeset
|
7228 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7229 |
if (t.isMenuVisible) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7230 |
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:
117
diff
changeset
|
7231 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7232 |
if (!t.rendered) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7233 |
co = DOM.add(t.settings.container, t.renderNode()); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7234 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7235 |
each(t.items, function(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:
117
diff
changeset
|
7236 |
o.postRender(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7237 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7238 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7239 |
t.element = new Element('menu_' + t.id, {blocker : 1, container : s.container}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7240 |
} 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:
117
diff
changeset
|
7241 |
co = DOM.get('menu_' + t.id); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7242 |
|
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
7243 |
// Move layer out of sight unless it's Opera since it scrolls to top of page due to an bug |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
7244 |
if (!tinymce.isOpera) |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
7245 |
DOM.setStyles(co, {left : -0xFFFF , top : -0xFFFF}); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
7246 |
|
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:
117
diff
changeset
|
7247 |
DOM.show(co); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7248 |
t.update(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7249 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7250 |
x += s.offset_x || 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:
117
diff
changeset
|
7251 |
y += s.offset_y || 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:
117
diff
changeset
|
7252 |
vp.w -= 4; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7253 |
vp.h -= 4; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7254 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7255 |
// Move inside viewport if not submenu |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7256 |
if (s.constrain) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7257 |
w = co.clientWidth - ot; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7258 |
h = co.clientHeight - ot; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7259 |
mx = vp.x + vp.w; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7260 |
my = vp.y + vp.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:
117
diff
changeset
|
7261 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7262 |
if ((x + s.vp_offset_x + w) > mx) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7263 |
x = px ? px - w : Math.max(0, (mx - s.vp_offset_x) - w); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7264 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7265 |
if ((y + s.vp_offset_y + h) > my) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7266 |
y = Math.max(0, (my - s.vp_offset_y) - 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:
117
diff
changeset
|
7267 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7268 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7269 |
DOM.setStyles(co, {left : x , top : y}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7270 |
t.element.update(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7271 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7272 |
t.isMenuVisible = 1; |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7273 |
t.mouseClickFunc = Event.add(co, 'click', function(e) { |
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:
117
diff
changeset
|
7274 |
var m; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7275 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7276 |
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:
117
diff
changeset
|
7277 |
|
1193 | 7278 |
if (e && (e = DOM.getParent(e, 'tr')) && !DOM.hasClass(e, cp + 'ItemSub')) { |
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:
117
diff
changeset
|
7279 |
m = t.items[e.id]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7280 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7281 |
if (m.isDisabled()) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7282 |
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:
117
diff
changeset
|
7283 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7284 |
dm = t; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7285 |
|
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7286 |
while (dm) { |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7287 |
if (dm.hideMenu) |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7288 |
dm.hideMenu(); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7289 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7290 |
dm = dm.settings.parent; |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7291 |
} |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7292 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7293 |
if (m.settings.onclick) |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7294 |
m.settings.onclick(e); |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
7295 |
|
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:
117
diff
changeset
|
7296 |
return Event.cancel(e); // Cancel to fix onbeforeunload problem |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7297 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7298 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7299 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7300 |
if (t.hasMenus()) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7301 |
t.mouseOverFunc = Event.add(co, 'mouseover', 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:
117
diff
changeset
|
7302 |
var m, r, mi; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7303 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7304 |
e = e.target; |
1193 | 7305 |
if (e && (e = DOM.getParent(e, 'tr'))) { |
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:
117
diff
changeset
|
7306 |
m = t.items[e.id]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7307 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7308 |
if (t.lastMenu) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7309 |
t.lastMenu.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:
117
diff
changeset
|
7310 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7311 |
if (m.isDisabled()) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7312 |
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:
117
diff
changeset
|
7313 |
|
543 | 7314 |
if (e && DOM.hasClass(e, cp + 'ItemSub')) { |
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:
117
diff
changeset
|
7315 |
//p = DOM.getPos(s.container); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7316 |
r = DOM.getRect(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:
117
diff
changeset
|
7317 |
m.showMenu((r.x + r.w - ot), r.y - ot, r.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:
117
diff
changeset
|
7318 |
t.lastMenu = m; |
543 | 7319 |
DOM.addClass(DOM.get(m.id).firstChild, cp + 'ItemActive'); |
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:
117
diff
changeset
|
7320 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7321 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7322 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7323 |
} |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
7324 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
7325 |
t.onShowMenu.dispatch(t); |
543 | 7326 |
|
7327 |
if (s.keyboard_focus) { |
|
7328 |
Event.add(co, 'keydown', t._keyHandler, t); |
|
7329 |
DOM.select('a', 'menu_' + t.id)[0].focus(); // Select first link |
|
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7330 |
t._focusIdx = 0; |
543 | 7331 |
} |
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:
117
diff
changeset
|
7332 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7333 |
|
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
|
7334 |
hideMenu : function(c) { |
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:
117
diff
changeset
|
7335 |
var t = this, co = DOM.get('menu_' + t.id), 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:
117
diff
changeset
|
7336 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7337 |
if (!t.isMenuVisible) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7338 |
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:
117
diff
changeset
|
7339 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7340 |
Event.remove(co, 'mouseover', t.mouseOverFunc); |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7341 |
Event.remove(co, 'click', t.mouseClickFunc); |
543 | 7342 |
Event.remove(co, 'keydown', t._keyHandler); |
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:
117
diff
changeset
|
7343 |
DOM.hide(co); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7344 |
t.isMenuVisible = 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:
117
diff
changeset
|
7345 |
|
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
|
7346 |
if (!c) |
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
|
7347 |
t.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
|
7348 |
|
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:
117
diff
changeset
|
7349 |
if (t.element) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7350 |
t.element.hide(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7351 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7352 |
if (e = DOM.get(t.id)) |
543 | 7353 |
DOM.removeClass(e.firstChild, t.classPrefix + 'ItemActive'); |
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:
117
diff
changeset
|
7354 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7355 |
t.onHideMenu.dispatch(t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7356 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7357 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7358 |
add : function(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:
117
diff
changeset
|
7359 |
var t = this, co; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7360 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7361 |
o = t.parent(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:
117
diff
changeset
|
7362 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7363 |
if (t.isRendered && (co = DOM.get('menu_' + t.id))) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7364 |
t._add(DOM.select('tbody', co)[0], 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:
117
diff
changeset
|
7365 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7366 |
return 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:
117
diff
changeset
|
7367 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7368 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7369 |
collapse : function(d) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7370 |
this.parent(d); |
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
|
7371 |
this.hideMenu(1); |
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:
117
diff
changeset
|
7372 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7373 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7374 |
remove : function(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:
117
diff
changeset
|
7375 |
DOM.remove(o.id); |
543 | 7376 |
this.destroy(); |
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:
117
diff
changeset
|
7377 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7378 |
return this.parent(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:
117
diff
changeset
|
7379 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7380 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7381 |
destroy : 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:
117
diff
changeset
|
7382 |
var t = this, co = DOM.get('menu_' + t.id); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7383 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7384 |
Event.remove(co, 'mouseover', t.mouseOverFunc); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7385 |
Event.remove(co, 'click', t.mouseClickFunc); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7386 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7387 |
if (t.element) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7388 |
t.element.remove(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7389 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7390 |
DOM.remove(co); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7391 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7392 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7393 |
renderNode : 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:
117
diff
changeset
|
7394 |
var t = this, s = t.settings, n, tb, co, w; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7395 |
|
543 | 7396 |
w = DOM.create('div', {id : 'menu_' + t.id, 'class' : s['class'], 'style' : 'position:absolute;left:0;top:0;z-index:200000'}); |
7397 |
co = DOM.add(w, 'div', {id : 'menu_' + t.id + '_co', 'class' : t.classPrefix + (s['class'] ? ' ' + s['class'] : '')}); |
|
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:
117
diff
changeset
|
7398 |
t.element = new Element('menu_' + t.id, {blocker : 1, container : s.container}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7399 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7400 |
if (s.menu_line) |
543 | 7401 |
DOM.add(co, 'span', {'class' : t.classPrefix + 'Line'}); |
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:
117
diff
changeset
|
7402 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7403 |
// n = DOM.add(co, 'div', {id : 'menu_' + t.id + '_co', 'class' : 'mceMenuContainer'}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7404 |
n = DOM.add(co, 'table', {id : 'menu_' + t.id + '_tbl', border : 0, cellPadding : 0, cellSpacing : 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:
117
diff
changeset
|
7405 |
tb = DOM.add(n, 'tbody'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7406 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7407 |
each(t.items, function(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:
117
diff
changeset
|
7408 |
t._add(tb, 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:
117
diff
changeset
|
7409 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7410 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7411 |
t.rendered = 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:
117
diff
changeset
|
7412 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7413 |
return w; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7414 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7415 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7416 |
// Internal functions |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7417 |
|
543 | 7418 |
_keyHandler : function(e) { |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7419 |
var t = this, kc = e.keyCode; |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7420 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7421 |
function focus(d) { |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7422 |
var i = t._focusIdx + d, e = DOM.select('a', 'menu_' + t.id)[i]; |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7423 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7424 |
if (e) { |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7425 |
t._focusIdx = i; |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7426 |
e.focus(); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7427 |
} |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7428 |
}; |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7429 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7430 |
switch (kc) { |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7431 |
case 38: |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7432 |
focus(-1); // Select first link |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7433 |
return; |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7434 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7435 |
case 40: |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7436 |
focus(1); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7437 |
return; |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7438 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7439 |
case 13: |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7440 |
return; |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7441 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7442 |
case 27: |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7443 |
return this.hideMenu(); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7444 |
} |
543 | 7445 |
}, |
7446 |
||
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:
117
diff
changeset
|
7447 |
_add : function(tb, o) { |
778 | 7448 |
var n, s = o.settings, a, ro, it, cp = this.classPrefix, ic; |
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:
117
diff
changeset
|
7449 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7450 |
if (s.separator) { |
543 | 7451 |
ro = DOM.add(tb, 'tr', {id : o.id, 'class' : cp + 'ItemSeparator'}); |
7452 |
DOM.add(ro, 'td', {'class' : cp + 'ItemSeparator'}); |
|
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:
117
diff
changeset
|
7453 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7454 |
if (n = ro.previousSibling) |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
7455 |
DOM.addClass(n, 'mceLast'); |
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:
117
diff
changeset
|
7456 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7457 |
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:
117
diff
changeset
|
7458 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7459 |
|
543 | 7460 |
n = ro = DOM.add(tb, 'tr', {id : o.id, 'class' : cp + 'Item ' + cp + 'ItemEnabled'}); |
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:
117
diff
changeset
|
7461 |
n = it = DOM.add(n, 'td'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7462 |
n = a = DOM.add(n, 'a', {href : 'javascript:;', onclick : "return false;", onmousedown : 'return 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:
117
diff
changeset
|
7463 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7464 |
DOM.addClass(it, s['class']); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7465 |
// n = DOM.add(n, 'span', {'class' : 'item'}); |
778 | 7466 |
|
7467 |
ic = DOM.add(n, 'span', {'class' : 'mceIcon' + (s.icon ? ' mce_' + s.icon : '')}); |
|
7468 |
||
7469 |
if (s.icon_src) |
|
7470 |
DOM.add(ic, 'img', {src : s.icon_src}); |
|
7471 |
||
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
7472 |
n = DOM.add(n, s.element || 'span', {'class' : 'mceText', title : o.settings.title}, o.settings.title); |
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:
117
diff
changeset
|
7473 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7474 |
if (o.settings.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:
117
diff
changeset
|
7475 |
DOM.setAttrib(n, 'style', o.settings.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:
117
diff
changeset
|
7476 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7477 |
if (tb.childNodes.length == 1) |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
7478 |
DOM.addClass(ro, 'mceFirst'); |
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:
117
diff
changeset
|
7479 |
|
543 | 7480 |
if ((n = ro.previousSibling) && DOM.hasClass(n, cp + 'ItemSeparator')) |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
7481 |
DOM.addClass(ro, 'mceFirst'); |
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:
117
diff
changeset
|
7482 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7483 |
if (o.collapse) |
543 | 7484 |
DOM.addClass(ro, cp + 'ItemSub'); |
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:
117
diff
changeset
|
7485 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7486 |
if (n = ro.previousSibling) |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
7487 |
DOM.removeClass(n, 'mceLast'); |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
7488 |
|
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
7489 |
DOM.addClass(ro, 'mceLast'); |
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:
117
diff
changeset
|
7490 |
} |
1193 | 7491 |
}); |
7492 |
})(tinymce);(function(tinymce) { |
|
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:
117
diff
changeset
|
7493 |
var DOM = tinymce.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:
117
diff
changeset
|
7494 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7495 |
tinymce.create('tinymce.ui.Button:tinymce.ui.Control', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7496 |
Button : function(id, 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:
117
diff
changeset
|
7497 |
this.parent(id, 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:
117
diff
changeset
|
7498 |
this.classPrefix = 'mceButton'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7499 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7500 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7501 |
renderHTML : function() { |
543 | 7502 |
var cp = this.classPrefix, s = this.settings, h, l; |
7503 |
||
7504 |
l = DOM.encode(s.label || ''); |
|
7505 |
h = '<a id="' + this.id + '" href="javascript:;" class="' + cp + ' ' + cp + 'Enabled ' + s['class'] + (l ? ' ' + cp + 'Labeled' : '') +'" onmousedown="return false;" onclick="return false;" title="' + DOM.encode(s.title) + '">'; |
|
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:
117
diff
changeset
|
7506 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7507 |
if (s.image) |
543 | 7508 |
h += '<img class="mceIcon" src="' + s.image + '" />' + l + '</a>'; |
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:
117
diff
changeset
|
7509 |
else |
543 | 7510 |
h += '<span class="mceIcon ' + s['class'] + '"></span>' + (l ? '<span class="' + cp + 'Label">' + l + '</span>' : '') + '</a>'; |
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:
117
diff
changeset
|
7511 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7512 |
return 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:
117
diff
changeset
|
7513 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7514 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7515 |
postRender : 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:
117
diff
changeset
|
7516 |
var t = this, s = t.settings; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7517 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7518 |
tinymce.dom.Event.add(t.id, 'click', 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:
117
diff
changeset
|
7519 |
if (!t.isDisabled()) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7520 |
return s.onclick.call(s.scope, 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:
117
diff
changeset
|
7521 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7522 |
} |
1193 | 7523 |
}); |
7524 |
})(tinymce); |
|
7525 |
(function(tinymce) { |
|
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:
117
diff
changeset
|
7526 |
var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7527 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7528 |
tinymce.create('tinymce.ui.ListBox:tinymce.ui.Control', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7529 |
ListBox : function(id, 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:
117
diff
changeset
|
7530 |
var t = 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:
117
diff
changeset
|
7531 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7532 |
t.parent(id, s); |
1193 | 7533 |
|
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:
117
diff
changeset
|
7534 |
t.items = []; |
1193 | 7535 |
|
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:
117
diff
changeset
|
7536 |
t.onChange = new Dispatcher(t); |
1193 | 7537 |
|
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:
117
diff
changeset
|
7538 |
t.onPostRender = new Dispatcher(t); |
1193 | 7539 |
|
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:
117
diff
changeset
|
7540 |
t.onAdd = new Dispatcher(t); |
1193 | 7541 |
|
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:
117
diff
changeset
|
7542 |
t.onRenderMenu = new tinymce.util.Dispatcher(this); |
1193 | 7543 |
|
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:
117
diff
changeset
|
7544 |
t.classPrefix = 'mceListBox'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7545 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7546 |
|
778 | 7547 |
select : function(va) { |
7548 |
var t = this, fv, f; |
|
7549 |
||
7550 |
if (va == undefined) |
|
7551 |
return t.selectByIndex(-1); |
|
7552 |
||
7553 |
// Is string or number make function selector |
|
7554 |
if (va && va.call) |
|
7555 |
f = va; |
|
7556 |
else { |
|
7557 |
f = function(v) { |
|
7558 |
return v == va; |
|
7559 |
}; |
|
7560 |
} |
|
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:
117
diff
changeset
|
7561 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7562 |
// Do we need to do something? |
778 | 7563 |
if (va != t.selectedValue) { |
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:
117
diff
changeset
|
7564 |
// Find item |
778 | 7565 |
each(t.items, function(o, i) { |
7566 |
if (f(o.value)) { |
|
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:
117
diff
changeset
|
7567 |
fv = 1; |
778 | 7568 |
t.selectByIndex(i); |
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:
117
diff
changeset
|
7569 |
return 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:
117
diff
changeset
|
7570 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7571 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7572 |
|
778 | 7573 |
if (!fv) |
7574 |
t.selectByIndex(-1); |
|
7575 |
} |
|
7576 |
}, |
|
7577 |
||
7578 |
selectByIndex : function(idx) { |
|
7579 |
var t = this, e, o; |
|
7580 |
||
7581 |
if (idx != t.selectedIndex) { |
|
7582 |
e = DOM.get(t.id + '_text'); |
|
7583 |
o = t.items[idx]; |
|
7584 |
||
7585 |
if (o) { |
|
7586 |
t.selectedValue = o.value; |
|
7587 |
t.selectedIndex = idx; |
|
7588 |
DOM.setHTML(e, DOM.encode(o.title)); |
|
7589 |
DOM.removeClass(e, 'mceTitle'); |
|
7590 |
} else { |
|
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:
117
diff
changeset
|
7591 |
DOM.setHTML(e, DOM.encode(t.settings.title)); |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
7592 |
DOM.addClass(e, 'mceTitle'); |
778 | 7593 |
t.selectedValue = t.selectedIndex = null; |
7594 |
} |
|
7595 |
||
7596 |
e = 0; |
|
1193 | 7597 |
} |
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:
117
diff
changeset
|
7598 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7599 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7600 |
add : function(n, v, 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:
117
diff
changeset
|
7601 |
var t = 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:
117
diff
changeset
|
7602 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7603 |
o = 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:
117
diff
changeset
|
7604 |
o = tinymce.extend(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:
117
diff
changeset
|
7605 |
title : 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:
117
diff
changeset
|
7606 |
value : 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:
117
diff
changeset
|
7607 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7608 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7609 |
t.items.push(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:
117
diff
changeset
|
7610 |
t.onAdd.dispatch(t, 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:
117
diff
changeset
|
7611 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7612 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7613 |
getLength : 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:
117
diff
changeset
|
7614 |
return this.items.length; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7615 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7616 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7617 |
renderHTML : function() { |
543 | 7618 |
var h = '', t = this, s = t.settings, cp = t.classPrefix; |
7619 |
||
7620 |
h = '<table id="' + t.id + '" cellpadding="0" cellspacing="0" class="' + cp + ' ' + cp + 'Enabled' + (s['class'] ? (' ' + s['class']) : '') + '"><tbody><tr>'; |
|
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
7621 |
h += '<td>' + DOM.createHTML('a', {id : t.id + '_text', href : 'javascript:;', 'class' : 'mceText', onclick : "return false;", onmousedown : 'return false;'}, DOM.encode(t.settings.title)) + '</td>'; |
543 | 7622 |
h += '<td>' + DOM.createHTML('a', {id : t.id + '_open', tabindex : -1, href : 'javascript:;', 'class' : 'mceOpen', onclick : "return false;", onmousedown : 'return false;'}, '<span></span>') + '</td>'; |
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:
117
diff
changeset
|
7623 |
h += '</tr></tbody></table>'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7624 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7625 |
return 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:
117
diff
changeset
|
7626 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7627 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7628 |
showMenu : 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:
117
diff
changeset
|
7629 |
var t = this, p1, p2, e = DOM.get(this.id), m; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7630 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7631 |
if (t.isDisabled() || t.items.length == 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:
117
diff
changeset
|
7632 |
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:
117
diff
changeset
|
7633 |
|
543 | 7634 |
if (t.menu && t.menu.isMenuVisible) |
7635 |
return t.hideMenu(); |
|
7636 |
||
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:
117
diff
changeset
|
7637 |
if (!t.isMenuRendered) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7638 |
t.renderMenu(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7639 |
t.isMenuRendered = 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:
117
diff
changeset
|
7640 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7641 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7642 |
p1 = DOM.getPos(this.settings.menu_container); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7643 |
p2 = DOM.getPos(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:
117
diff
changeset
|
7644 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7645 |
m = t.menu; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7646 |
m.settings.offset_x = p2.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:
117
diff
changeset
|
7647 |
m.settings.offset_y = p2.y; |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7648 |
m.settings.keyboard_focus = !tinymce.isOpera; // Opera is buggy when it comes to auto focus |
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:
117
diff
changeset
|
7649 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7650 |
// Select in menu |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7651 |
if (t.oldID) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7652 |
m.items[t.oldID].setSelected(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:
117
diff
changeset
|
7653 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7654 |
each(t.items, function(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:
117
diff
changeset
|
7655 |
if (o.value === t.selectedValue) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7656 |
m.items[o.id].setSelected(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:
117
diff
changeset
|
7657 |
t.oldID = o.id; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7658 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7659 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7660 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7661 |
m.showMenu(0, e.clientHeight); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7662 |
|
543 | 7663 |
Event.add(DOM.doc, 'mousedown', t.hideMenu, t); |
7664 |
DOM.addClass(t.id, t.classPrefix + 'Selected'); |
|
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7665 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7666 |
//DOM.get(t.id + '_text').focus(); |
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:
117
diff
changeset
|
7667 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7668 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7669 |
hideMenu : 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:
117
diff
changeset
|
7670 |
var t = 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:
117
diff
changeset
|
7671 |
|
543 | 7672 |
// Prevent double toogles by canceling the mouse click event to the button |
7673 |
if (e && e.type == "mousedown" && (e.target.id == t.id + '_text' || e.target.id == t.id + '_open')) |
|
7674 |
return; |
|
7675 |
||
1193 | 7676 |
if (!e || !DOM.getParent(e.target, '.mceMenu')) { |
543 | 7677 |
DOM.removeClass(t.id, t.classPrefix + 'Selected'); |
7678 |
Event.remove(DOM.doc, 'mousedown', t.hideMenu, t); |
|
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:
117
diff
changeset
|
7679 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7680 |
if (t.menu) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7681 |
t.menu.hideMenu(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7682 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7683 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7684 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7685 |
renderMenu : 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:
117
diff
changeset
|
7686 |
var t = this, m; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7687 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7688 |
m = t.settings.control_manager.createDropMenu(t.id + '_menu', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7689 |
menu_line : 1, |
543 | 7690 |
'class' : t.classPrefix + 'Menu mceNoIcons', |
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:
117
diff
changeset
|
7691 |
max_width : 150, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7692 |
max_height : 150 |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7693 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7694 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7695 |
m.onHideMenu.add(t.hideMenu, t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7696 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7697 |
m.add({ |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7698 |
title : t.settings.title, |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7699 |
'class' : 'mceMenuItemTitle', |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7700 |
onclick : function() { |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7701 |
if (t.settings.onselect('') !== false) |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7702 |
t.select(''); // Must be runned after |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7703 |
} |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7704 |
}); |
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:
117
diff
changeset
|
7705 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7706 |
each(t.items, function(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:
117
diff
changeset
|
7707 |
o.id = DOM.uniqueId(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7708 |
o.onclick = 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:
117
diff
changeset
|
7709 |
if (t.settings.onselect(o.value) !== 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:
117
diff
changeset
|
7710 |
t.select(o.value); // Must be runned after |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7711 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7712 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7713 |
m.add(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:
117
diff
changeset
|
7714 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7715 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7716 |
t.onRenderMenu.dispatch(t, m); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7717 |
t.menu = m; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7718 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7719 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7720 |
postRender : function() { |
543 | 7721 |
var t = this, cp = t.classPrefix; |
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:
117
diff
changeset
|
7722 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7723 |
Event.add(t.id, 'click', t.showMenu, t); |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7724 |
Event.add(t.id + '_text', 'focus', function(e) { |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7725 |
if (!t._focused) { |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7726 |
t.keyDownHandler = Event.add(t.id + '_text', 'keydown', function(e) { |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7727 |
var idx = -1, v, kc = e.keyCode; |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7728 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7729 |
// Find current index |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7730 |
each(t.items, function(v, i) { |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7731 |
if (t.selectedValue == v.value) |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7732 |
idx = i; |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7733 |
}); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7734 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7735 |
// Move up/down |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7736 |
if (kc == 38) |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7737 |
v = t.items[idx - 1]; |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7738 |
else if (kc == 40) |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7739 |
v = t.items[idx + 1]; |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7740 |
else if (kc == 13) { |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7741 |
// Fake select on enter |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7742 |
v = t.selectedValue; |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7743 |
t.selectedValue = null; // Needs to be null to fake change |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7744 |
t.settings.onselect(v); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7745 |
return Event.cancel(e); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7746 |
} |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7747 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7748 |
if (v) { |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7749 |
t.hideMenu(); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7750 |
t.select(v.value); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7751 |
} |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7752 |
}); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7753 |
} |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7754 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7755 |
t._focused = 1; |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7756 |
}); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
7757 |
Event.add(t.id + '_text', 'blur', function() {Event.remove(t.id + '_text', 'keydown', t.keyDownHandler); t._focused = 0;}); |
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:
117
diff
changeset
|
7758 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7759 |
// Old IE doesn't have hover on all 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:
117
diff
changeset
|
7760 |
if (tinymce.isIE6 || !DOM.boxModel) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7761 |
Event.add(t.id, 'mouseover', function() { |
543 | 7762 |
if (!DOM.hasClass(t.id, cp + 'Disabled')) |
7763 |
DOM.addClass(t.id, cp + 'Hover'); |
|
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:
117
diff
changeset
|
7764 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7765 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7766 |
Event.add(t.id, 'mouseout', function() { |
543 | 7767 |
if (!DOM.hasClass(t.id, cp + 'Disabled')) |
7768 |
DOM.removeClass(t.id, cp + 'Hover'); |
|
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:
117
diff
changeset
|
7769 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7770 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7771 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7772 |
t.onPostRender.dispatch(t, DOM.get(t.id)); |
543 | 7773 |
}, |
7774 |
||
7775 |
destroy : function() { |
|
7776 |
this.parent(); |
|
7777 |
||
7778 |
Event.clear(this.id + '_text'); |
|
1193 | 7779 |
Event.clear(this.id + '_open'); |
7780 |
} |
|
7781 |
}); |
|
7782 |
})(tinymce);(function(tinymce) { |
|
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:
117
diff
changeset
|
7783 |
var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7784 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7785 |
tinymce.create('tinymce.ui.NativeListBox:tinymce.ui.ListBox', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7786 |
NativeListBox : function(id, 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:
117
diff
changeset
|
7787 |
this.parent(id, 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:
117
diff
changeset
|
7788 |
this.classPrefix = 'mceNativeListBox'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7789 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7790 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7791 |
setDisabled : function(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:
117
diff
changeset
|
7792 |
DOM.get(this.id).disabled = 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:
117
diff
changeset
|
7793 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7794 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7795 |
isDisabled : 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:
117
diff
changeset
|
7796 |
return DOM.get(this.id).disabled; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7797 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7798 |
|
778 | 7799 |
select : function(va) { |
7800 |
var t = this, fv, f; |
|
7801 |
||
7802 |
if (va == undefined) |
|
7803 |
return t.selectByIndex(-1); |
|
7804 |
||
7805 |
// Is string or number make function selector |
|
7806 |
if (va && va.call) |
|
7807 |
f = va; |
|
7808 |
else { |
|
7809 |
f = function(v) { |
|
7810 |
return v == va; |
|
7811 |
}; |
|
7812 |
} |
|
7813 |
||
7814 |
// Do we need to do something? |
|
7815 |
if (va != t.selectedValue) { |
|
7816 |
// Find item |
|
7817 |
each(t.items, function(o, i) { |
|
7818 |
if (f(o.value)) { |
|
7819 |
fv = 1; |
|
7820 |
t.selectByIndex(i); |
|
7821 |
return false; |
|
7822 |
} |
|
7823 |
}); |
|
7824 |
||
7825 |
if (!fv) |
|
7826 |
t.selectByIndex(-1); |
|
7827 |
} |
|
7828 |
}, |
|
7829 |
||
7830 |
selectByIndex : function(idx) { |
|
7831 |
DOM.get(this.id).selectedIndex = idx + 1; |
|
7832 |
this.selectedValue = this.items[idx] ? this.items[idx].value : null; |
|
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:
117
diff
changeset
|
7833 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7834 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7835 |
add : function(n, v, 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:
117
diff
changeset
|
7836 |
var o, t = 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:
117
diff
changeset
|
7837 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7838 |
a = 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:
117
diff
changeset
|
7839 |
a.value = 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:
117
diff
changeset
|
7840 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7841 |
if (t.isRendered()) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7842 |
DOM.add(DOM.get(this.id), 'option', a, 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:
117
diff
changeset
|
7843 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7844 |
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:
117
diff
changeset
|
7845 |
title : 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:
117
diff
changeset
|
7846 |
value : 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:
117
diff
changeset
|
7847 |
attribs : 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:
117
diff
changeset
|
7848 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7849 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7850 |
t.items.push(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:
117
diff
changeset
|
7851 |
t.onAdd.dispatch(t, 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:
117
diff
changeset
|
7852 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7853 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7854 |
getLength : 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:
117
diff
changeset
|
7855 |
return DOM.get(this.id).options.length - 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:
117
diff
changeset
|
7856 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7857 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7858 |
renderHTML : 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:
117
diff
changeset
|
7859 |
var h, t = 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:
117
diff
changeset
|
7860 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7861 |
h = DOM.createHTML('option', {value : ''}, '-- ' + t.settings.title + ' --'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7862 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7863 |
each(t.items, function(it) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7864 |
h += DOM.createHTML('option', {value : it.value}, it.title); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7865 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7866 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7867 |
h = DOM.createHTML('select', {id : t.id, 'class' : 'mceNativeListBox'}, 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:
117
diff
changeset
|
7868 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7869 |
return 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:
117
diff
changeset
|
7870 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7871 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7872 |
postRender : 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:
117
diff
changeset
|
7873 |
var t = this, ch; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7874 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7875 |
t.rendered = 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:
117
diff
changeset
|
7876 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7877 |
function onChange(e) { |
778 | 7878 |
var v = t.items[e.target.selectedIndex - 1]; |
7879 |
||
7880 |
if (v && (v = v.value)) { |
|
7881 |
t.onChange.dispatch(t, v); |
|
7882 |
||
7883 |
if (t.settings.onselect) |
|
7884 |
t.settings.onselect(v); |
|
7885 |
} |
|
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:
117
diff
changeset
|
7886 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7887 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7888 |
Event.add(t.id, 'change', onChange); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7889 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7890 |
// Accessibility keyhandler |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7891 |
Event.add(t.id, 'keydown', 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:
117
diff
changeset
|
7892 |
var bf; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7893 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7894 |
Event.remove(t.id, 'change', ch); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7895 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7896 |
bf = Event.add(t.id, 'blur', 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:
117
diff
changeset
|
7897 |
Event.add(t.id, 'change', onChange); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7898 |
Event.remove(t.id, 'blur', bf); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7899 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7900 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7901 |
if (e.keyCode == 13 || e.keyCode == 32) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7902 |
onChange(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:
117
diff
changeset
|
7903 |
return Event.cancel(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:
117
diff
changeset
|
7904 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7905 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7906 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7907 |
t.onPostRender.dispatch(t, DOM.get(t.id)); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7908 |
} |
1193 | 7909 |
}); |
7910 |
})(tinymce);(function(tinymce) { |
|
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:
117
diff
changeset
|
7911 |
var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7912 |
|
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
|
7913 |
tinymce.create('tinymce.ui.MenuButton:tinymce.ui.Button', { |
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
|
7914 |
MenuButton : function(id, s) { |
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:
117
diff
changeset
|
7915 |
this.parent(id, s); |
1193 | 7916 |
|
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:
117
diff
changeset
|
7917 |
this.onRenderMenu = new tinymce.util.Dispatcher(this); |
1193 | 7918 |
|
543 | 7919 |
s.menu_container = s.menu_container || DOM.doc.body; |
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:
117
diff
changeset
|
7920 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7921 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7922 |
showMenu : 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:
117
diff
changeset
|
7923 |
var t = this, p1, p2, e = DOM.get(t.id), m; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7924 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7925 |
if (t.isDisabled()) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7926 |
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:
117
diff
changeset
|
7927 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7928 |
if (!t.isMenuRendered) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7929 |
t.renderMenu(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7930 |
t.isMenuRendered = 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:
117
diff
changeset
|
7931 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7932 |
|
543 | 7933 |
if (t.isMenuVisible) |
7934 |
return t.hideMenu(); |
|
7935 |
||
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:
117
diff
changeset
|
7936 |
p1 = DOM.getPos(t.settings.menu_container); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7937 |
p2 = DOM.getPos(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:
117
diff
changeset
|
7938 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7939 |
m = t.menu; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7940 |
m.settings.offset_x = p2.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:
117
diff
changeset
|
7941 |
m.settings.offset_y = p2.y; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7942 |
m.settings.vp_offset_x = p2.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:
117
diff
changeset
|
7943 |
m.settings.vp_offset_y = p2.y; |
543 | 7944 |
m.settings.keyboard_focus = t._focused; |
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:
117
diff
changeset
|
7945 |
m.showMenu(0, e.clientHeight); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7946 |
|
543 | 7947 |
Event.add(DOM.doc, 'mousedown', t.hideMenu, t); |
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
|
7948 |
t.setState('Selected', 1); |
543 | 7949 |
|
7950 |
t.isMenuVisible = 1; |
|
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:
117
diff
changeset
|
7951 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7952 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7953 |
renderMenu : 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:
117
diff
changeset
|
7954 |
var t = this, m; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7955 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7956 |
m = t.settings.control_manager.createDropMenu(t.id + '_menu', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7957 |
menu_line : 1, |
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
|
7958 |
'class' : this.classPrefix + 'Menu', |
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
|
7959 |
icons : t.settings.icons |
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:
117
diff
changeset
|
7960 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7961 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7962 |
m.onHideMenu.add(t.hideMenu, t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7963 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7964 |
t.onRenderMenu.dispatch(t, m); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7965 |
t.menu = m; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7966 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7967 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7968 |
hideMenu : 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:
117
diff
changeset
|
7969 |
var t = 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:
117
diff
changeset
|
7970 |
|
543 | 7971 |
// Prevent double toogles by canceling the mouse click event to the button |
7972 |
if (e && e.type == "mousedown" && DOM.getParent(e.target, function(e) {return e.id === t.id || e.id === t.id + '_open';})) |
|
7973 |
return; |
|
7974 |
||
1193 | 7975 |
if (!e || !DOM.getParent(e.target, '.mceMenu')) { |
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
|
7976 |
t.setState('Selected', 0); |
543 | 7977 |
Event.remove(DOM.doc, 'mousedown', t.hideMenu, t); |
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:
117
diff
changeset
|
7978 |
if (t.menu) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7979 |
t.menu.hideMenu(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7980 |
} |
543 | 7981 |
|
7982 |
t.isMenuVisible = 0; |
|
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:
117
diff
changeset
|
7983 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
7984 |
|
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
|
7985 |
postRender : function() { |
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
|
7986 |
var t = this, s = t.settings; |
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
|
7987 |
|
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
|
7988 |
Event.add(t.id, 'click', function() { |
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
|
7989 |
if (!t.isDisabled()) { |
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
|
7990 |
if (s.onclick) |
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
|
7991 |
s.onclick(t.value); |
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
|
7992 |
|
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
|
7993 |
t.showMenu(); |
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
|
7994 |
} |
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
|
7995 |
}); |
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
|
7996 |
} |
1193 | 7997 |
}); |
7998 |
})(tinymce); |
|
7999 |
(function(tinymce) { |
|
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
|
8000 |
var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each; |
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
|
8001 |
|
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
|
8002 |
tinymce.create('tinymce.ui.SplitButton:tinymce.ui.MenuButton', { |
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
|
8003 |
SplitButton : function(id, s) { |
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
|
8004 |
this.parent(id, s); |
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
|
8005 |
this.classPrefix = 'mceSplitButton'; |
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
|
8006 |
}, |
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
|
8007 |
|
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:
117
diff
changeset
|
8008 |
renderHTML : 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:
117
diff
changeset
|
8009 |
var h, t = this, s = t.settings, h1; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8010 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8011 |
h = '<tbody><tr>'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8012 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8013 |
if (s.image) |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8014 |
h1 = DOM.createHTML('img ', {src : s.image, 'class' : 'mceAction ' + s['class']}); |
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:
117
diff
changeset
|
8015 |
else |
543 | 8016 |
h1 = DOM.createHTML('span', {'class' : 'mceAction ' + s['class']}, ''); |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8017 |
|
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8018 |
h += '<td>' + DOM.createHTML('a', {id : t.id + '_action', href : 'javascript:;', 'class' : 'mceAction ' + s['class'], onclick : "return false;", onmousedown : 'return false;', title : s.title}, h1) + '</td>'; |
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:
117
diff
changeset
|
8019 |
|
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8020 |
h1 = DOM.createHTML('span', {'class' : 'mceOpen ' + s['class']}); |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8021 |
h += '<td>' + DOM.createHTML('a', {id : t.id + '_open', href : 'javascript:;', 'class' : 'mceOpen ' + s['class'], onclick : "return false;", onmousedown : 'return false;', title : s.title}, h1) + '</td>'; |
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:
117
diff
changeset
|
8022 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8023 |
h += '</tr></tbody>'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8024 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8025 |
return DOM.createHTML('table', {id : t.id, 'class' : 'mceSplitButton mceSplitButtonEnabled ' + s['class'], cellpadding : '0', cellspacing : '0', onmousedown : 'return false;', title : s.title}, 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:
117
diff
changeset
|
8026 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8027 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8028 |
postRender : 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:
117
diff
changeset
|
8029 |
var t = this, s = t.settings; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8030 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8031 |
if (s.onclick) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8032 |
Event.add(t.id + '_action', 'click', 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:
117
diff
changeset
|
8033 |
if (!t.isDisabled()) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8034 |
s.onclick(t.value); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8035 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8036 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8037 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8038 |
Event.add(t.id + '_open', 'click', t.showMenu, t); |
543 | 8039 |
Event.add(t.id + '_open', 'focus', function() {t._focused = 1;}); |
8040 |
Event.add(t.id + '_open', 'blur', function() {t._focused = 0;}); |
|
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:
117
diff
changeset
|
8041 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8042 |
// Old IE doesn't have hover on all 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:
117
diff
changeset
|
8043 |
if (tinymce.isIE6 || !DOM.boxModel) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8044 |
Event.add(t.id, 'mouseover', 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:
117
diff
changeset
|
8045 |
if (!DOM.hasClass(t.id, 'mceSplitButtonDisabled')) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8046 |
DOM.addClass(t.id, 'mceSplitButtonHover'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8047 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8048 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8049 |
Event.add(t.id, 'mouseout', 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:
117
diff
changeset
|
8050 |
if (!DOM.hasClass(t.id, 'mceSplitButtonDisabled')) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8051 |
DOM.removeClass(t.id, 'mceSplitButtonHover'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8052 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8053 |
} |
543 | 8054 |
}, |
8055 |
||
8056 |
destroy : function() { |
|
8057 |
this.parent(); |
|
8058 |
||
8059 |
Event.clear(this.id + '_action'); |
|
8060 |
Event.clear(this.id + '_open'); |
|
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:
117
diff
changeset
|
8061 |
} |
1193 | 8062 |
}); |
8063 |
})(tinymce); |
|
8064 |
(function(tinymce) { |
|
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:
117
diff
changeset
|
8065 |
var DOM = tinymce.DOM, Event = tinymce.dom.Event, is = tinymce.is, each = tinymce.each; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8066 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8067 |
tinymce.create('tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8068 |
ColorSplitButton : function(id, 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:
117
diff
changeset
|
8069 |
var t = 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:
117
diff
changeset
|
8070 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8071 |
t.parent(id, 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:
117
diff
changeset
|
8072 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8073 |
t.settings = s = tinymce.extend({ |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8074 |
colors : '000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8075 |
grid_width : 8, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8076 |
default_color : '#888888' |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8077 |
}, t.settings); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8078 |
|
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
8079 |
t.onShowMenu = new tinymce.util.Dispatcher(t); |
1193 | 8080 |
|
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
8081 |
t.onHideMenu = new tinymce.util.Dispatcher(t); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
8082 |
|
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:
117
diff
changeset
|
8083 |
t.value = s.default_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:
117
diff
changeset
|
8084 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8085 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8086 |
showMenu : function() { |
543 | 8087 |
var t = this, r, p, e, p2; |
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:
117
diff
changeset
|
8088 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8089 |
if (t.isDisabled()) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8090 |
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:
117
diff
changeset
|
8091 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8092 |
if (!t.isMenuRendered) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8093 |
t.renderMenu(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8094 |
t.isMenuRendered = 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:
117
diff
changeset
|
8095 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8096 |
|
543 | 8097 |
if (t.isMenuVisible) |
8098 |
return t.hideMenu(); |
|
8099 |
||
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:
117
diff
changeset
|
8100 |
e = DOM.get(t.id); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8101 |
DOM.show(t.id + '_menu'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8102 |
DOM.addClass(e, 'mceSplitButtonSelected'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8103 |
p2 = DOM.getPos(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:
117
diff
changeset
|
8104 |
DOM.setStyles(t.id + '_menu', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8105 |
left : p2.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:
117
diff
changeset
|
8106 |
top : p2.y + e.clientHeight, |
543 | 8107 |
zIndex : 200000 |
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:
117
diff
changeset
|
8108 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8109 |
e = 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:
117
diff
changeset
|
8110 |
|
543 | 8111 |
Event.add(DOM.doc, 'mousedown', t.hideMenu, t); |
1193 | 8112 |
t.onShowMenu.dispatch(t); |
543 | 8113 |
|
8114 |
if (t._focused) { |
|
8115 |
t._keyHandler = Event.add(t.id + '_menu', 'keydown', function(e) { |
|
8116 |
if (e.keyCode == 27) |
|
8117 |
t.hideMenu(); |
|
8118 |
}); |
|
8119 |
||
8120 |
DOM.select('a', t.id + '_menu')[0].focus(); // Select first link |
|
8121 |
} |
|
8122 |
||
8123 |
t.isMenuVisible = 1; |
|
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:
117
diff
changeset
|
8124 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8125 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8126 |
hideMenu : 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:
117
diff
changeset
|
8127 |
var t = 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:
117
diff
changeset
|
8128 |
|
543 | 8129 |
// Prevent double toogles by canceling the mouse click event to the button |
8130 |
if (e && e.type == "mousedown" && DOM.getParent(e.target, function(e) {return e.id === t.id + '_open';})) |
|
8131 |
return; |
|
8132 |
||
1193 | 8133 |
if (!e || !DOM.getParent(e.target, '.mceSplitButtonMenu')) { |
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:
117
diff
changeset
|
8134 |
DOM.removeClass(t.id, 'mceSplitButtonSelected'); |
543 | 8135 |
Event.remove(DOM.doc, 'mousedown', t.hideMenu, t); |
8136 |
Event.remove(t.id + '_menu', 'keydown', t._keyHandler); |
|
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:
117
diff
changeset
|
8137 |
DOM.hide(t.id + '_menu'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8138 |
} |
543 | 8139 |
|
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
8140 |
t.onHideMenu.dispatch(t); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
8141 |
|
543 | 8142 |
t.isMenuVisible = 0; |
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:
117
diff
changeset
|
8143 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8144 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8145 |
renderMenu : 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:
117
diff
changeset
|
8146 |
var t = this, m, i = 0, s = t.settings, n, tb, tr, w; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8147 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8148 |
w = DOM.add(s.menu_container, 'div', {id : t.id + '_menu', 'class' : s['menu_class'] + ' ' + s['class'], style : 'position:absolute;left:0;top:-1000px;'}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8149 |
m = DOM.add(w, 'div', {'class' : s['class'] + ' mceSplitButtonMenu'}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8150 |
DOM.add(m, 'span', {'class' : 'mceMenuLine'}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8151 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8152 |
n = DOM.add(m, 'table', {'class' : 'mceColorSplitMenu'}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8153 |
tb = DOM.add(n, 'tbody'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8154 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8155 |
// Generate color grid |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8156 |
i = 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:
117
diff
changeset
|
8157 |
each(is(s.colors, 'array') ? s.colors : s.colors.split(','), function(c) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8158 |
c = c.replace(/^#/, ''); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8159 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8160 |
if (!i--) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8161 |
tr = DOM.add(tb, 'tr'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8162 |
i = s.grid_width - 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:
117
diff
changeset
|
8163 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8164 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8165 |
n = DOM.add(tr, 'td'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8166 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8167 |
n = DOM.add(n, '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:
117
diff
changeset
|
8168 |
href : 'javascript:;', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8169 |
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:
117
diff
changeset
|
8170 |
backgroundColor : '#' + c |
543 | 8171 |
}, |
8172 |
mce_color : '#' + c |
|
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:
117
diff
changeset
|
8173 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8174 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8175 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8176 |
if (s.more_colors_func) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8177 |
n = DOM.add(tb, 'tr'); |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8178 |
n = DOM.add(n, 'td', {colspan : s.grid_width, 'class' : 'mceMoreColors'}); |
543 | 8179 |
n = DOM.add(n, 'a', {id : t.id + '_more', href : 'javascript:;', onclick : 'return false;', 'class' : 'mceMoreColors'}, s.more_colors_title); |
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:
117
diff
changeset
|
8180 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8181 |
Event.add(n, 'click', 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:
117
diff
changeset
|
8182 |
s.more_colors_func.call(s.more_colors_scope || 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:
117
diff
changeset
|
8183 |
return Event.cancel(e); // Cancel to fix onbeforeunload problem |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8184 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8185 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8186 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8187 |
DOM.addClass(m, 'mceColorSplitMenu'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8188 |
|
543 | 8189 |
Event.add(t.id + '_menu', 'click', function(e) { |
8190 |
var c; |
|
8191 |
||
8192 |
e = e.target; |
|
8193 |
||
8194 |
if (e.nodeName == 'A' && (c = e.getAttribute('mce_color'))) |
|
8195 |
t.setColor(c); |
|
8196 |
||
8197 |
return Event.cancel(e); // Prevent IE auto save warning |
|
8198 |
}); |
|
8199 |
||
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:
117
diff
changeset
|
8200 |
return w; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8201 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8202 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8203 |
setColor : function(c) { |
543 | 8204 |
var t = this; |
8205 |
||
8206 |
DOM.setStyle(t.id + '_preview', 'backgroundColor', c); |
|
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:
117
diff
changeset
|
8207 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8208 |
t.value = c; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8209 |
t.hideMenu(); |
543 | 8210 |
t.settings.onselect(c); |
8211 |
}, |
|
8212 |
||
8213 |
postRender : function() { |
|
8214 |
var t = this, id = t.id; |
|
8215 |
||
8216 |
t.parent(); |
|
8217 |
DOM.add(id + '_action', 'div', {id : id + '_preview', 'class' : 'mceColorPreview'}); |
|
778 | 8218 |
DOM.setStyle(t.id + '_preview', 'backgroundColor', t.value); |
543 | 8219 |
}, |
8220 |
||
8221 |
destroy : function() { |
|
8222 |
this.parent(); |
|
8223 |
||
8224 |
Event.clear(this.id + '_menu'); |
|
8225 |
Event.clear(this.id + '_more'); |
|
8226 |
DOM.remove(this.id + '_menu'); |
|
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:
117
diff
changeset
|
8227 |
} |
1193 | 8228 |
}); |
8229 |
})(tinymce); |
|
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:
117
diff
changeset
|
8230 |
tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8231 |
renderHTML : function() { |
543 | 8232 |
var t = this, h = '', c, co, dom = tinymce.DOM, s = t.settings, i, pr, nx, cl; |
8233 |
||
8234 |
cl = t.controls; |
|
8235 |
for (i=0; i<cl.length; i++) { |
|
8236 |
// Get current control, prev control, next control and if the control is a list box or not |
|
8237 |
co = cl[i]; |
|
8238 |
pr = cl[i - 1]; |
|
8239 |
nx = cl[i + 1]; |
|
8240 |
||
8241 |
// Add toolbar start |
|
8242 |
if (i === 0) { |
|
8243 |
c = 'mceToolbarStart'; |
|
8244 |
||
8245 |
if (co.Button) |
|
8246 |
c += ' mceToolbarStartButton'; |
|
8247 |
else if (co.SplitButton) |
|
8248 |
c += ' mceToolbarStartSplitButton'; |
|
8249 |
else if (co.ListBox) |
|
8250 |
c += ' mceToolbarStartListBox'; |
|
8251 |
||
8252 |
h += dom.createHTML('td', {'class' : c}, dom.createHTML('span', null, '<!-- IE -->')); |
|
8253 |
} |
|
8254 |
||
8255 |
// Add toolbar end before list box and after the previous button |
|
8256 |
// This is to fix the o2k7 editor skins |
|
8257 |
if (pr && co.ListBox) { |
|
8258 |
if (pr.Button || pr.SplitButton) |
|
8259 |
h += dom.createHTML('td', {'class' : 'mceToolbarEnd'}, dom.createHTML('span', null, '<!-- IE -->')); |
|
8260 |
} |
|
8261 |
||
8262 |
// Render control HTML |
|
8263 |
||
8264 |
// IE 8 quick fix, needed to propertly generate a hit area for anchors |
|
8265 |
if (dom.stdMode) |
|
8266 |
h += '<td style="position: relative">' + co.renderHTML() + '</td>'; |
|
8267 |
else |
|
8268 |
h += '<td>' + co.renderHTML() + '</td>'; |
|
8269 |
||
8270 |
// Add toolbar start after list box and before the next button |
|
8271 |
// This is to fix the o2k7 editor skins |
|
8272 |
if (nx && co.ListBox) { |
|
8273 |
if (nx.Button || nx.SplitButton) |
|
8274 |
h += dom.createHTML('td', {'class' : 'mceToolbarStart'}, dom.createHTML('span', null, '<!-- IE -->')); |
|
8275 |
} |
|
8276 |
} |
|
8277 |
||
8278 |
c = 'mceToolbarEnd'; |
|
8279 |
||
8280 |
if (co.Button) |
|
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:
117
diff
changeset
|
8281 |
c += ' mceToolbarEndButton'; |
543 | 8282 |
else if (co.SplitButton) |
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:
117
diff
changeset
|
8283 |
c += ' mceToolbarEndSplitButton'; |
543 | 8284 |
else if (co.ListBox) |
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:
117
diff
changeset
|
8285 |
c += ' mceToolbarEndListBox'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8286 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8287 |
h += dom.createHTML('td', {'class' : c}, dom.createHTML('span', null, '<!-- IE -->')); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8288 |
|
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
|
8289 |
return dom.createHTML('table', {id : t.id, 'class' : 'mceToolbar' + (s['class'] ? ' ' + s['class'] : ''), cellpadding : '0', cellspacing : '0', align : t.settings.align || ''}, '<tbody><tr>' + h + '</tr></tbody>'); |
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:
117
diff
changeset
|
8290 |
} |
1193 | 8291 |
}); |
8292 |
(function(tinymce) { |
|
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:
117
diff
changeset
|
8293 |
var Dispatcher = tinymce.util.Dispatcher, each = tinymce.each; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8294 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8295 |
tinymce.create('tinymce.AddOnManager', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8296 |
items : [], |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8297 |
urls : {}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8298 |
lookup : {}, |
1193 | 8299 |
|
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:
117
diff
changeset
|
8300 |
onAdd : new Dispatcher(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:
117
diff
changeset
|
8301 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8302 |
get : 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:
117
diff
changeset
|
8303 |
return this.lookup[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:
117
diff
changeset
|
8304 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8305 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8306 |
requireLangPack : function(n) { |
778 | 8307 |
var u, s = tinymce.EditorManager.settings; |
8308 |
||
8309 |
if (s && s.language) { |
|
8310 |
u = this.urls[n] + '/langs/' + s.language + '.js'; |
|
8311 |
||
8312 |
if (!tinymce.dom.Event.domLoaded && !s.strict_mode) |
|
8313 |
tinymce.ScriptLoader.load(u); |
|
8314 |
else |
|
8315 |
tinymce.ScriptLoader.add(u); |
|
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:
117
diff
changeset
|
8316 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8317 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8318 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8319 |
add : function(id, 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:
117
diff
changeset
|
8320 |
this.items.push(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:
117
diff
changeset
|
8321 |
this.lookup[id] = 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:
117
diff
changeset
|
8322 |
this.onAdd.dispatch(this, id, 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:
117
diff
changeset
|
8323 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8324 |
return 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:
117
diff
changeset
|
8325 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8326 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8327 |
load : function(n, u, cb, s) { |
543 | 8328 |
var t = this; |
8329 |
||
8330 |
if (t.urls[n]) |
|
8331 |
return; |
|
8332 |
||
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:
117
diff
changeset
|
8333 |
if (u.indexOf('/') != 0 && u.indexOf('://') == -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:
117
diff
changeset
|
8334 |
u = tinymce.baseURL + '/' + 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:
117
diff
changeset
|
8335 |
|
543 | 8336 |
t.urls[n] = u.substring(0, u.lastIndexOf('/')); |
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:
117
diff
changeset
|
8337 |
tinymce.ScriptLoader.add(u, cb, 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:
117
diff
changeset
|
8338 |
} |
1193 | 8339 |
}); |
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:
117
diff
changeset
|
8340 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8341 |
// Create plugin and theme managers |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8342 |
tinymce.PluginManager = new tinymce.AddOnManager(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8343 |
tinymce.ThemeManager = new tinymce.AddOnManager(); |
1193 | 8344 |
}(tinymce)); |
8345 |
||
8346 |
(function(tinymce) { |
|
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:
117
diff
changeset
|
8347 |
// Shorten names |
543 | 8348 |
var each = tinymce.each, extend = tinymce.extend, DOM = tinymce.DOM, Event = tinymce.dom.Event, ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager, explode = tinymce.explode; |
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:
117
diff
changeset
|
8349 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8350 |
tinymce.create('static tinymce.EditorManager', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8351 |
editors : {}, |
1193 | 8352 |
|
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:
117
diff
changeset
|
8353 |
i18n : {}, |
1193 | 8354 |
|
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:
117
diff
changeset
|
8355 |
activeEditor : 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:
117
diff
changeset
|
8356 |
|
543 | 8357 |
preInit : function() { |
8358 |
var t = this, lo = window.location; |
|
8359 |
||
8360 |
// Setup some URLs where the editor API is located and where the document is |
|
8361 |
tinymce.documentBaseURL = lo.href.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, ''); |
|
8362 |
if (!/[\/\\]$/.test(tinymce.documentBaseURL)) |
|
8363 |
tinymce.documentBaseURL += '/'; |
|
8364 |
||
8365 |
tinymce.baseURL = new tinymce.util.URI(tinymce.documentBaseURL).toAbsolute(tinymce.baseURL); |
|
8366 |
tinymce.EditorManager.baseURI = new tinymce.util.URI(tinymce.baseURL); |
|
8367 |
||
8368 |
// Add before unload listener |
|
8369 |
// This was required since IE was leaking memory if you added and removed beforeunload listeners |
|
8370 |
// with attachEvent/detatchEvent so this only adds one listener and instances can the attach to the onBeforeUnload event |
|
8371 |
t.onBeforeUnload = new tinymce.util.Dispatcher(t); |
|
8372 |
||
8373 |
// Must be on window or IE will leak if the editor is placed in frame or iframe |
|
8374 |
Event.add(window, 'beforeunload', function(e) { |
|
8375 |
t.onBeforeUnload.dispatch(t, e); |
|
8376 |
}); |
|
8377 |
}, |
|
8378 |
||
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:
117
diff
changeset
|
8379 |
init : function(s) { |
778 | 8380 |
var t = this, pl, sl = tinymce.ScriptLoader, c, e, el = [], ed; |
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:
117
diff
changeset
|
8381 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8382 |
function execCallback(se, n, 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:
117
diff
changeset
|
8383 |
var f = se[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:
117
diff
changeset
|
8384 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8385 |
if (!f) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8386 |
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:
117
diff
changeset
|
8387 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8388 |
if (tinymce.is(f, 'string')) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8389 |
s = f.replace(/\.\w+$/, ''); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8390 |
s = s ? tinymce.resolve(s) : 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:
117
diff
changeset
|
8391 |
f = tinymce.resolve(f); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8392 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8393 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8394 |
return f.apply(s || this, Array.prototype.slice.call(arguments, 2)); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8395 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8396 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8397 |
s = extend({ |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8398 |
theme : "simple", |
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
|
8399 |
language : "en", |
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
|
8400 |
strict_loading_mode : document.contentType == 'application/xhtml+xml' |
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:
117
diff
changeset
|
8401 |
}, 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:
117
diff
changeset
|
8402 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8403 |
t.settings = 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:
117
diff
changeset
|
8404 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8405 |
// If page not loaded and strict mode isn't enabled then load them |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8406 |
if (!Event.domLoaded && !s.strict_loading_mode) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8407 |
// Load language |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8408 |
if (s.language) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8409 |
sl.add(tinymce.baseURL + '/langs/' + s.language + '.js'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8410 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8411 |
// Load theme |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
8412 |
if (s.theme && s.theme.charAt(0) != '-' && !ThemeManager.urls[s.theme]) |
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:
117
diff
changeset
|
8413 |
ThemeManager.load(s.theme, 'themes/' + s.theme + '/editor_template' + tinymce.suffix + '.js'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8414 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8415 |
// Load plugins |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8416 |
if (s.plugins) { |
543 | 8417 |
pl = explode(s.plugins); |
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:
117
diff
changeset
|
8418 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8419 |
// Load rest if plugins |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8420 |
each(pl, function(v) { |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
8421 |
if (v && v.charAt(0) != '-' && !PluginManager.urls[v]) { |
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:
117
diff
changeset
|
8422 |
// Skip safari plugin for other browsers |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8423 |
if (!tinymce.isWebKit && v == '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:
117
diff
changeset
|
8424 |
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:
117
diff
changeset
|
8425 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8426 |
PluginManager.load(v, 'plugins/' + v + '/editor_plugin' + tinymce.suffix + '.js'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8427 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8428 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8429 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8430 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8431 |
sl.loadQueue(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8432 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8433 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8434 |
// Legacy call |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8435 |
Event.add(document, 'init', 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:
117
diff
changeset
|
8436 |
var l, co; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8437 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8438 |
execCallback(s, 'onpageload'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8439 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8440 |
// Verify that it's a valid browser |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8441 |
if (s.browsers) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8442 |
l = 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:
117
diff
changeset
|
8443 |
|
543 | 8444 |
each(explode(s.browsers), function(v) { |
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:
117
diff
changeset
|
8445 |
switch (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:
117
diff
changeset
|
8446 |
case 'ie': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8447 |
case 'msie': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8448 |
if (tinymce.isIE) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8449 |
l = 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:
117
diff
changeset
|
8450 |
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:
117
diff
changeset
|
8451 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8452 |
case 'gecko': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8453 |
if (tinymce.isGecko) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8454 |
l = 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:
117
diff
changeset
|
8455 |
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:
117
diff
changeset
|
8456 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8457 |
case '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:
117
diff
changeset
|
8458 |
case '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:
117
diff
changeset
|
8459 |
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:
117
diff
changeset
|
8460 |
l = 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:
117
diff
changeset
|
8461 |
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:
117
diff
changeset
|
8462 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8463 |
case 'opera': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8464 |
if (tinymce.isOpera) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8465 |
l = 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:
117
diff
changeset
|
8466 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8467 |
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:
117
diff
changeset
|
8468 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8469 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8470 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8471 |
// Not a valid one |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8472 |
if (!l) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8473 |
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:
117
diff
changeset
|
8474 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8475 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8476 |
switch (s.mode) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8477 |
case "exact": |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8478 |
l = s.elements || ''; |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8479 |
|
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8480 |
if(l.length > 0) { |
543 | 8481 |
each(explode(l), function(v) { |
778 | 8482 |
if (DOM.get(v)) { |
8483 |
ed = new tinymce.Editor(v, s); |
|
8484 |
el.push(ed); |
|
8485 |
ed.render(1); |
|
8486 |
} else { |
|
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8487 |
c = 0; |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8488 |
|
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8489 |
each(document.forms, function(f) { |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8490 |
each(f.elements, function(e) { |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8491 |
if (e.name === v) { |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8492 |
v = 'mce_editor_' + c; |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8493 |
DOM.setAttrib(e, 'id', v); |
778 | 8494 |
|
8495 |
ed = new tinymce.Editor(v, s); |
|
8496 |
el.push(ed); |
|
8497 |
ed.render(1); |
|
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8498 |
} |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8499 |
}); |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
8500 |
}); |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8501 |
} |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8502 |
}); |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8503 |
} |
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:
117
diff
changeset
|
8504 |
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:
117
diff
changeset
|
8505 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8506 |
case "textareas": |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
8507 |
case "specific_textareas": |
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:
117
diff
changeset
|
8508 |
function hasClass(n, c) { |
543 | 8509 |
return c.constructor === RegExp ? c.test(n.className) : DOM.hasClass(n, c); |
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:
117
diff
changeset
|
8510 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8511 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8512 |
each(DOM.select('textarea'), 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:
117
diff
changeset
|
8513 |
if (s.editor_deselector && hasClass(v, s.editor_deselector)) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8514 |
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:
117
diff
changeset
|
8515 |
|
543 | 8516 |
if (!s.editor_selector || hasClass(v, s.editor_selector)) { |
8517 |
// Can we use the name |
|
8518 |
e = DOM.get(v.name); |
|
8519 |
if (!v.id && !e) |
|
8520 |
v.id = v.name; |
|
8521 |
||
8522 |
// Generate unique name if missing or already exists |
|
8523 |
if (!v.id || t.get(v.id)) |
|
8524 |
v.id = DOM.uniqueId(); |
|
8525 |
||
778 | 8526 |
ed = new tinymce.Editor(v.id, s); |
8527 |
el.push(ed); |
|
8528 |
ed.render(1); |
|
543 | 8529 |
} |
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:
117
diff
changeset
|
8530 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8531 |
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:
117
diff
changeset
|
8532 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8533 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8534 |
// Call onInit when all editors are initialized |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8535 |
if (s.oninit) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8536 |
l = co = 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:
117
diff
changeset
|
8537 |
|
778 | 8538 |
each (el, function(ed) { |
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:
117
diff
changeset
|
8539 |
co++; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8540 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8541 |
if (!ed.initialized) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8542 |
// Wait for it |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8543 |
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:
117
diff
changeset
|
8544 |
l++; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8545 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8546 |
// All done |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8547 |
if (l == co) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8548 |
execCallback(s, 'oninit'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8549 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8550 |
} 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:
117
diff
changeset
|
8551 |
l++; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8552 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8553 |
// All done |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8554 |
if (l == co) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8555 |
execCallback(s, 'oninit'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8556 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8557 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8558 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8559 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8560 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8561 |
get : function(id) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8562 |
return this.editors[id]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8563 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8564 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8565 |
getInstanceById : function(id) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8566 |
return this.get(id); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8567 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8568 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8569 |
add : 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:
117
diff
changeset
|
8570 |
this.editors[e.id] = 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:
117
diff
changeset
|
8571 |
this._setActive(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:
117
diff
changeset
|
8572 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8573 |
return 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:
117
diff
changeset
|
8574 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8575 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8576 |
remove : 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:
117
diff
changeset
|
8577 |
var t = 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:
117
diff
changeset
|
8578 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8579 |
// Not in the collection |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8580 |
if (!t.editors[e.id]) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8581 |
return 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:
117
diff
changeset
|
8582 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8583 |
delete t.editors[e.id]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8584 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8585 |
// Select another editor since the active one was removed |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8586 |
if (t.activeEditor == e) { |
1193 | 8587 |
t._setActive(null); |
8588 |
||
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:
117
diff
changeset
|
8589 |
each(t.editors, 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:
117
diff
changeset
|
8590 |
t._setActive(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:
117
diff
changeset
|
8591 |
return false; // 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:
117
diff
changeset
|
8592 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8593 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8594 |
|
543 | 8595 |
e.destroy(); |
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:
117
diff
changeset
|
8596 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8597 |
return 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:
117
diff
changeset
|
8598 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8599 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8600 |
execCommand : function(c, u, v) { |
543 | 8601 |
var t = this, ed = t.get(v), w; |
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:
117
diff
changeset
|
8602 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8603 |
// Manager commands |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8604 |
switch (c) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8605 |
case "mceFocus": |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8606 |
ed.focus(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8607 |
return 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:
117
diff
changeset
|
8608 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8609 |
case "mceAddEditor": |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8610 |
case "mceAddControl": |
543 | 8611 |
if (!t.get(v)) |
8612 |
new tinymce.Editor(v, t.settings).render(); |
|
8613 |
||
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:
117
diff
changeset
|
8614 |
return 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:
117
diff
changeset
|
8615 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8616 |
case "mceAddFrameControl": |
543 | 8617 |
w = v.window; |
8618 |
||
8619 |
// Add tinyMCE global instance and tinymce namespace to specified window |
|
8620 |
w.tinyMCE = tinyMCE; |
|
8621 |
w.tinymce = tinymce; |
|
8622 |
||
8623 |
tinymce.DOM.doc = w.document; |
|
8624 |
tinymce.DOM.win = w; |
|
8625 |
||
8626 |
ed = new tinymce.Editor(v.element_id, v); |
|
8627 |
ed.render(); |
|
8628 |
||
8629 |
// Fix IE memory leaks |
|
8630 |
if (tinymce.isIE) { |
|
8631 |
function clr() { |
|
8632 |
ed.destroy(); |
|
8633 |
w.detachEvent('onunload', clr); |
|
8634 |
w = w.tinyMCE = w.tinymce = null; // IE leak |
|
8635 |
}; |
|
8636 |
||
8637 |
w.attachEvent('onunload', clr); |
|
8638 |
} |
|
8639 |
||
8640 |
v.page_window = null; |
|
8641 |
||
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:
117
diff
changeset
|
8642 |
return 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:
117
diff
changeset
|
8643 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8644 |
case "mceRemoveEditor": |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8645 |
case "mceRemoveControl": |
778 | 8646 |
if (ed) |
8647 |
ed.remove(); |
|
8648 |
||
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:
117
diff
changeset
|
8649 |
return 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:
117
diff
changeset
|
8650 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8651 |
case 'mceToggleEditor': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8652 |
if (!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:
117
diff
changeset
|
8653 |
t.execCommand('mceAddControl', 0, v); |
1 | 8654 |
return true; |
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:
117
diff
changeset
|
8655 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8656 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8657 |
if (ed.isHidden()) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8658 |
ed.show(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8659 |
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:
117
diff
changeset
|
8660 |
ed.hide(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8661 |
|
1 | 8662 |
return true; |
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:
117
diff
changeset
|
8663 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8664 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8665 |
// Run command on active 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:
117
diff
changeset
|
8666 |
if (t.activeEditor) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8667 |
return t.activeEditor.execCommand(c, 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:
117
diff
changeset
|
8668 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8669 |
return 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:
117
diff
changeset
|
8670 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8671 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8672 |
execInstanceCommand : function(id, c, 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:
117
diff
changeset
|
8673 |
var ed = this.get(id); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8674 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8675 |
if (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:
117
diff
changeset
|
8676 |
return ed.execCommand(c, 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:
117
diff
changeset
|
8677 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8678 |
return 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:
117
diff
changeset
|
8679 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8680 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8681 |
triggerSave : 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:
117
diff
changeset
|
8682 |
each(this.editors, 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:
117
diff
changeset
|
8683 |
e.save(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8684 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8685 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8686 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8687 |
addI18n : function(p, 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:
117
diff
changeset
|
8688 |
var lo, i18n = this.i18n; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8689 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8690 |
if (!tinymce.is(p, 'string')) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8691 |
each(p, function(o, lc) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8692 |
each(o, function(o, 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:
117
diff
changeset
|
8693 |
each(o, function(o, k) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8694 |
if (g === 'common') |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8695 |
i18n[lc + '.' + k] = 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:
117
diff
changeset
|
8696 |
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:
117
diff
changeset
|
8697 |
i18n[lc + '.' + g + '.' + k] = 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:
117
diff
changeset
|
8698 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8699 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8700 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8701 |
} 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:
117
diff
changeset
|
8702 |
each(o, function(o, k) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8703 |
i18n[p + '.' + k] = 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:
117
diff
changeset
|
8704 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8705 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8706 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8707 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8708 |
// Private methods |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8709 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8710 |
_setActive : 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:
117
diff
changeset
|
8711 |
this.selectedInstance = this.activeEditor = 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:
117
diff
changeset
|
8712 |
} |
1193 | 8713 |
}); |
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:
117
diff
changeset
|
8714 |
|
543 | 8715 |
tinymce.EditorManager.preInit(); |
1193 | 8716 |
})(tinymce); |
8717 |
||
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:
117
diff
changeset
|
8718 |
var tinyMCE = window.tinyMCE = tinymce.EditorManager; |
1193 | 8719 |
(function(tinymce) { |
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:
117
diff
changeset
|
8720 |
var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, Dispatcher = tinymce.util.Dispatcher; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8721 |
var each = tinymce.each, isGecko = tinymce.isGecko, isIE = tinymce.isIE, isWebKit = 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:
117
diff
changeset
|
8722 |
var is = tinymce.is, ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager, EditorManager = tinymce.EditorManager; |
543 | 8723 |
var inArray = tinymce.inArray, grep = tinymce.grep, explode = tinymce.explode; |
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:
117
diff
changeset
|
8724 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8725 |
tinymce.create('tinymce.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:
117
diff
changeset
|
8726 |
Editor : function(id, 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:
117
diff
changeset
|
8727 |
var t = 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:
117
diff
changeset
|
8728 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8729 |
t.id = t.editorId = id; |
1193 | 8730 |
|
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:
117
diff
changeset
|
8731 |
t.execCommands = {}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8732 |
t.queryStateCommands = {}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8733 |
t.queryValueCommands = {}; |
1193 | 8734 |
|
8735 |
t.isNotDirty = false; |
|
8736 |
||
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:
117
diff
changeset
|
8737 |
t.plugins = {}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8738 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8739 |
// Add events to the 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:
117
diff
changeset
|
8740 |
each([ |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8741 |
'onPreInit', |
1193 | 8742 |
|
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:
117
diff
changeset
|
8743 |
'onBeforeRenderUI', |
1193 | 8744 |
|
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:
117
diff
changeset
|
8745 |
'onPostRender', |
1193 | 8746 |
|
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:
117
diff
changeset
|
8747 |
'onInit', |
1193 | 8748 |
|
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:
117
diff
changeset
|
8749 |
'onRemove', |
1193 | 8750 |
|
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:
117
diff
changeset
|
8751 |
'onActivate', |
1193 | 8752 |
|
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:
117
diff
changeset
|
8753 |
'onDeactivate', |
1193 | 8754 |
|
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:
117
diff
changeset
|
8755 |
'onClick', |
1193 | 8756 |
|
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:
117
diff
changeset
|
8757 |
'onEvent', |
1193 | 8758 |
|
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:
117
diff
changeset
|
8759 |
'onMouseUp', |
1193 | 8760 |
|
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:
117
diff
changeset
|
8761 |
'onMouseDown', |
1193 | 8762 |
|
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:
117
diff
changeset
|
8763 |
'onDblClick', |
1193 | 8764 |
|
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:
117
diff
changeset
|
8765 |
'onKeyDown', |
1193 | 8766 |
|
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:
117
diff
changeset
|
8767 |
'onKeyUp', |
1193 | 8768 |
|
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:
117
diff
changeset
|
8769 |
'onKeyPress', |
1193 | 8770 |
|
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:
117
diff
changeset
|
8771 |
'onContextMenu', |
1193 | 8772 |
|
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:
117
diff
changeset
|
8773 |
'onSubmit', |
1193 | 8774 |
|
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:
117
diff
changeset
|
8775 |
'onReset', |
1193 | 8776 |
|
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:
117
diff
changeset
|
8777 |
'onPaste', |
1193 | 8778 |
|
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:
117
diff
changeset
|
8779 |
'onPreProcess', |
1193 | 8780 |
|
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:
117
diff
changeset
|
8781 |
'onPostProcess', |
1193 | 8782 |
|
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:
117
diff
changeset
|
8783 |
'onBeforeSetContent', |
1193 | 8784 |
|
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:
117
diff
changeset
|
8785 |
'onBeforeGetContent', |
1193 | 8786 |
|
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:
117
diff
changeset
|
8787 |
'onSetContent', |
1193 | 8788 |
|
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:
117
diff
changeset
|
8789 |
'onGetContent', |
1193 | 8790 |
|
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:
117
diff
changeset
|
8791 |
'onLoadContent', |
1193 | 8792 |
|
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:
117
diff
changeset
|
8793 |
'onSaveContent', |
1193 | 8794 |
|
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:
117
diff
changeset
|
8795 |
'onNodeChange', |
1193 | 8796 |
|
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:
117
diff
changeset
|
8797 |
'onChange', |
1193 | 8798 |
|
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:
117
diff
changeset
|
8799 |
'onBeforeExecCommand', |
1193 | 8800 |
|
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:
117
diff
changeset
|
8801 |
'onExecCommand', |
1193 | 8802 |
|
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:
117
diff
changeset
|
8803 |
'onUndo', |
1193 | 8804 |
|
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:
117
diff
changeset
|
8805 |
'onRedo', |
1193 | 8806 |
|
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:
117
diff
changeset
|
8807 |
'onVisualAid', |
1193 | 8808 |
|
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:
117
diff
changeset
|
8809 |
'onSetProgressState' |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8810 |
], 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:
117
diff
changeset
|
8811 |
t[e] = new Dispatcher(t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8812 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8813 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8814 |
t.settings = s = extend({ |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8815 |
id : id, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8816 |
language : 'en', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8817 |
docs_language : 'en', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8818 |
theme : 'simple', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8819 |
skin : '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:
117
diff
changeset
|
8820 |
delta_width : 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:
117
diff
changeset
|
8821 |
delta_height : 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:
117
diff
changeset
|
8822 |
popup_css : '', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8823 |
plugins : '', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8824 |
document_base_url : tinymce.documentBaseURL, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8825 |
add_form_submit_trigger : 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:
117
diff
changeset
|
8826 |
submit_patch : 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:
117
diff
changeset
|
8827 |
add_unload_trigger : 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:
117
diff
changeset
|
8828 |
convert_urls : 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:
117
diff
changeset
|
8829 |
relative_urls : 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:
117
diff
changeset
|
8830 |
remove_script_host : 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:
117
diff
changeset
|
8831 |
table_inline_editing : 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:
117
diff
changeset
|
8832 |
object_resizing : 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:
117
diff
changeset
|
8833 |
cleanup : 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:
117
diff
changeset
|
8834 |
accessibility_focus : 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:
117
diff
changeset
|
8835 |
custom_shortcuts : 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:
117
diff
changeset
|
8836 |
custom_undo_redo_keyboard_shortcuts : 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:
117
diff
changeset
|
8837 |
custom_undo_redo_restore_selection : 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:
117
diff
changeset
|
8838 |
custom_undo_redo : 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:
117
diff
changeset
|
8839 |
doctype : '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8840 |
visual_table_class : 'mceItemTable', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8841 |
visual : 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:
117
diff
changeset
|
8842 |
inline_styles : 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:
117
diff
changeset
|
8843 |
convert_fonts_to_spans : 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:
117
diff
changeset
|
8844 |
font_size_style_values : '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:
117
diff
changeset
|
8845 |
apply_source_formatting : 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:
117
diff
changeset
|
8846 |
directionality : 'ltr', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8847 |
forced_root_block : 'p', |
1193 | 8848 |
valid_elements : '@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u,#p,-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,-blockquote[cite],-table[border|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],object[classid|width|height|codebase|*],param[name|value],embed[type|width|height|src|*],script[src|type],map[name],area[shape|coords|href|alt|target],bdo,button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|valign|width],dfn,fieldset,form[action|accept|accept-charset|enctype|method],input[accept|alt|checked|disabled|maxlength|name|readonly|size|src|type|value|tabindex|accesskey],kbd,label[for],legend,noscript,optgroup[label|disabled],option[disabled|label|selected|value],q[cite],samp,select[disabled|multiple|name|size],small,textarea[cols|rows|disabled|name|readonly],tt,var,big', |
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:
117
diff
changeset
|
8849 |
hidden_input : 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:
117
diff
changeset
|
8850 |
padd_empty_editor : 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:
117
diff
changeset
|
8851 |
render_ui : 1, |
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
|
8852 |
init_theme : 1, |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8853 |
force_p_newlines : 1, |
778 | 8854 |
indentation : '30px', |
1193 | 8855 |
keep_styles : 1, |
8856 |
fix_table_elements : 1, |
|
8857 |
removeformat_selector : 'span,b,strong,em,i,font,u,strike' |
|
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:
117
diff
changeset
|
8858 |
}, 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:
117
diff
changeset
|
8859 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8860 |
t.documentBaseURI = new tinymce.util.URI(s.document_base_url || tinymce.documentBaseURL, { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8861 |
base_uri : tinyMCE.baseURI |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8862 |
}); |
1193 | 8863 |
|
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:
117
diff
changeset
|
8864 |
t.baseURI = EditorManager.baseURI; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8865 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8866 |
// Call setup |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8867 |
t.execCallback('setup', t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8868 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8869 |
|
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
8870 |
render : function(nst) { |
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:
117
diff
changeset
|
8871 |
var t = this, s = t.settings, id = t.id, sl = tinymce.ScriptLoader; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8872 |
|
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8873 |
// Page is not loaded yet, wait for it |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8874 |
if (!Event.domLoaded) { |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8875 |
Event.add(document, 'init', function() { |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8876 |
t.render(); |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8877 |
}); |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8878 |
return; |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8879 |
} |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8880 |
|
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
8881 |
// Force strict loading mode if render us called by user and not internally |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
8882 |
if (!nst) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
8883 |
s.strict_loading_mode = 1; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
8884 |
tinyMCE.settings = s; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
8885 |
} |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
8886 |
|
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
|
8887 |
// Element not found, then skip initialization |
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
|
8888 |
if (!t.getElement()) |
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
|
8889 |
return; |
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
|
8890 |
|
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
|
8891 |
if (s.strict_loading_mode) { |
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
|
8892 |
sl.settings.strict_mode = s.strict_loading_mode; |
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
|
8893 |
tinymce.DOM.settings.strict = 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
|
8894 |
} |
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
|
8895 |
|
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:
117
diff
changeset
|
8896 |
// Add hidden input for non input elements inside form 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:
117
diff
changeset
|
8897 |
if (!/TEXTAREA|INPUT/i.test(t.getElement().nodeName) && s.hidden_input && DOM.getParent(id, 'form')) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8898 |
DOM.insertAfter(DOM.create('input', {type : 'hidden', name : id}), id); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8899 |
|
1193 | 8900 |
if (tinymce.WindowManager) |
8901 |
t.windowManager = new tinymce.WindowManager(t); |
|
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:
117
diff
changeset
|
8902 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8903 |
if (s.encoding == 'xml') { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8904 |
t.onGetContent.add(function(ed, o) { |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
8905 |
if (o.save) |
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:
117
diff
changeset
|
8906 |
o.content = DOM.encode(o.content); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8907 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8908 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8909 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8910 |
if (s.add_form_submit_trigger) { |
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
|
8911 |
t.onSubmit.addToTop(function() { |
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:
117
diff
changeset
|
8912 |
if (t.initialized) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8913 |
t.save(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8914 |
t.isNotDirty = 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:
117
diff
changeset
|
8915 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8916 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8917 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8918 |
|
1193 | 8919 |
if (s.add_unload_trigger) { |
543 | 8920 |
t._beforeUnload = tinyMCE.onBeforeUnload.add(function() { |
8921 |
if (t.initialized && !t.destroyed && !t.isHidden()) |
|
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
8922 |
t.save({format : 'raw', no_events : true}); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
8923 |
}); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
8924 |
} |
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:
117
diff
changeset
|
8925 |
|
543 | 8926 |
tinymce.addUnload(t.destroy, t); |
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:
117
diff
changeset
|
8927 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8928 |
if (s.submit_patch) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8929 |
t.onBeforeRenderUI.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:
117
diff
changeset
|
8930 |
var n = t.getElement().form; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8931 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8932 |
if (!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:
117
diff
changeset
|
8933 |
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:
117
diff
changeset
|
8934 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8935 |
// Already patched |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8936 |
if (n._mceOldSubmit) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8937 |
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:
117
diff
changeset
|
8938 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8939 |
// Check page uses id="submit" or name="submit" for it's submit button |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
8940 |
if (!n.submit.nodeType && !n.submit.length) { |
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:
117
diff
changeset
|
8941 |
t.formElement = 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:
117
diff
changeset
|
8942 |
n._mceOldSubmit = n.submit; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8943 |
n.submit = 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:
117
diff
changeset
|
8944 |
// Save all instances |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8945 |
EditorManager.triggerSave(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8946 |
t.isNotDirty = 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:
117
diff
changeset
|
8947 |
|
1193 | 8948 |
return t.formElement._mceOldSubmit(t.formElement); |
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:
117
diff
changeset
|
8949 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8950 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8951 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8952 |
n = 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:
117
diff
changeset
|
8953 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8954 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8955 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8956 |
// Load scripts |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8957 |
function loadScripts() { |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
8958 |
if (s.language) |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
8959 |
sl.add(tinymce.baseURL + '/langs/' + s.language + '.js'); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
8960 |
|
1193 | 8961 |
if (s.theme && s.theme.charAt(0) != '-' && !ThemeManager.urls[s.theme]) |
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:
117
diff
changeset
|
8962 |
ThemeManager.load(s.theme, 'themes/' + s.theme + '/editor_template' + tinymce.suffix + '.js'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8963 |
|
543 | 8964 |
each(explode(s.plugins), function(p) { |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
8965 |
if (p && p.charAt(0) != '-' && !PluginManager.urls[p]) { |
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:
117
diff
changeset
|
8966 |
// Skip safari plugin for other browsers |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8967 |
if (!isWebKit && p == '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:
117
diff
changeset
|
8968 |
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:
117
diff
changeset
|
8969 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8970 |
PluginManager.load(p, 'plugins/' + p + '/editor_plugin' + tinymce.suffix + '.js'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8971 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8972 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8973 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8974 |
// Init when que is loaded |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8975 |
sl.loadQueue(function() { |
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
|
8976 |
if (!t.removed) |
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
|
8977 |
t.init(); |
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:
117
diff
changeset
|
8978 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8979 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8980 |
|
1193 | 8981 |
loadScripts(); |
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:
117
diff
changeset
|
8982 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8983 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8984 |
init : function() { |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
8985 |
var n, t = this, s = t.settings, w, h, e = t.getElement(), o, ti, u, bi, bc, re; |
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:
117
diff
changeset
|
8986 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8987 |
EditorManager.add(t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8988 |
|
1193 | 8989 |
if (s.theme) { |
8990 |
s.theme = s.theme.replace(/-/, ''); |
|
8991 |
o = ThemeManager.get(s.theme); |
|
8992 |
t.theme = new o(); |
|
8993 |
||
8994 |
if (t.theme.init && s.init_theme) |
|
8995 |
t.theme.init(t, ThemeManager.urls[s.theme] || tinymce.documentBaseURL.replace(/\/$/, '')); |
|
8996 |
} |
|
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:
117
diff
changeset
|
8997 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
8998 |
// Create all plugins |
543 | 8999 |
each(explode(s.plugins.replace(/\-/g, '')), function(p) { |
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:
117
diff
changeset
|
9000 |
var c = PluginManager.get(p), u = PluginManager.urls[p] || tinymce.documentBaseURL.replace(/\/$/, ''), po; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9001 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9002 |
if (c) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9003 |
po = new c(t, 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:
117
diff
changeset
|
9004 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9005 |
t.plugins[p] = po; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9006 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9007 |
if (po.init) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9008 |
po.init(t, u); |
1 | 9009 |
} |
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:
117
diff
changeset
|
9010 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9011 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9012 |
// Setup popup CSS path(s) |
778 | 9013 |
if (s.popup_css !== false) { |
9014 |
if (s.popup_css) |
|
9015 |
s.popup_css = t.documentBaseURI.toAbsolute(s.popup_css); |
|
9016 |
else |
|
9017 |
s.popup_css = t.baseURI.toAbsolute("themes/" + s.theme + "/skins/" + s.skin + "/dialog.css"); |
|
9018 |
} |
|
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:
117
diff
changeset
|
9019 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9020 |
if (s.popup_css_add) |
543 | 9021 |
s.popup_css += ',' + t.documentBaseURI.toAbsolute(s.popup_css_add); |
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:
117
diff
changeset
|
9022 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9023 |
t.controlManager = new tinymce.ControlManager(t); |
1193 | 9024 |
|
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:
117
diff
changeset
|
9025 |
t.undoManager = new tinymce.UndoManager(t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9026 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9027 |
// Pass 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:
117
diff
changeset
|
9028 |
t.undoManager.onAdd.add(function(um, l) { |
543 | 9029 |
if (!l.initial) |
9030 |
return t.onChange.dispatch(t, l, um); |
|
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:
117
diff
changeset
|
9031 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9032 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9033 |
t.undoManager.onUndo.add(function(um, l) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9034 |
return t.onUndo.dispatch(t, l, um); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9035 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9036 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9037 |
t.undoManager.onRedo.add(function(um, l) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9038 |
return t.onRedo.dispatch(t, l, um); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9039 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9040 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9041 |
if (s.custom_undo_redo) { |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9042 |
t.onExecCommand.add(function(ed, cmd, ui, val, a) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9043 |
if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint' && (!a || !a.skip_undo)) |
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:
117
diff
changeset
|
9044 |
t.undoManager.add(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9045 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9046 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9047 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9048 |
t.onExecCommand.add(function(ed, c) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9049 |
// Don't refresh the select lists until caret move |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9050 |
if (!/^(FontName|FontSize)$/.test(c)) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9051 |
t.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:
117
diff
changeset
|
9052 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9053 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9054 |
// Remove ghost selections on images and tables in Gecko |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9055 |
if (isGecko) { |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9056 |
function repaint(a, o) { |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9057 |
if (!o || !o.initial) |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9058 |
t.execCommand('mceRepaint'); |
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:
117
diff
changeset
|
9059 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9060 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9061 |
t.onUndo.add(repaint); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9062 |
t.onRedo.add(repaint); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9063 |
t.onSetContent.add(repaint); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9064 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9065 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9066 |
// Enables users to override the control factory |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9067 |
t.onBeforeRenderUI.dispatch(t, t.controlManager); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9068 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9069 |
// Measure box |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9070 |
if (s.render_ui) { |
543 | 9071 |
w = s.width || e.style.width || e.offsetWidth; |
9072 |
h = s.height || e.style.height || e.offsetHeight; |
|
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:
117
diff
changeset
|
9073 |
t.orgDisplay = e.style.display; |
543 | 9074 |
re = /^[0-9\.]+(|px)$/i; |
9075 |
||
9076 |
if (re.test('' + w)) |
|
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:
117
diff
changeset
|
9077 |
w = Math.max(parseInt(w) + (o.deltaWidth || 0), 100); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9078 |
|
543 | 9079 |
if (re.test('' + h)) |
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:
117
diff
changeset
|
9080 |
h = Math.max(parseInt(h) + (o.deltaHeight || 0), 100); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9081 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9082 |
// Render UI |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9083 |
o = t.theme.renderUI({ |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9084 |
targetNode : 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:
117
diff
changeset
|
9085 |
width : w, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9086 |
height : 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:
117
diff
changeset
|
9087 |
deltaWidth : s.delta_width, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9088 |
deltaHeight : s.delta_height |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9089 |
}); |
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
|
9090 |
|
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
|
9091 |
t.editorContainer = o.editorContainer; |
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:
117
diff
changeset
|
9092 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9093 |
|
1193 | 9094 |
|
9095 |
// User specified a document.domain value |
|
9096 |
if (document.domain && location.hostname != document.domain) |
|
9097 |
tinymce.relaxedDomain = document.domain; |
|
9098 |
||
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:
117
diff
changeset
|
9099 |
// Resize 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:
117
diff
changeset
|
9100 |
DOM.setStyles(o.sizeContainer || o.editorContainer, { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9101 |
width : w, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9102 |
height : 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:
117
diff
changeset
|
9103 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9104 |
|
778 | 9105 |
h = (o.iframeHeight || h) + (typeof(h) == 'number' ? (o.deltaHeight || 0) : ''); |
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
|
9106 |
if (h < 100) |
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
|
9107 |
h = 100; |
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
|
9108 |
|
1193 | 9109 |
t.iframeHTML = s.doctype + '<html><head xmlns="http://www.w3.org/1999/xhtml">'; |
9110 |
||
9111 |
// We only need to override paths if we have to |
|
9112 |
// IE has a bug where it remove site absolute urls to relative ones if this is specified |
|
9113 |
if (s.document_base_url != tinymce.documentBaseURL) |
|
9114 |
t.iframeHTML += '<base href="' + t.documentBaseURI.getURI() + '" />'; |
|
9115 |
||
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9116 |
t.iframeHTML += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9117 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9118 |
if (tinymce.relaxedDomain) |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9119 |
t.iframeHTML += '<script type="text/javascript">document.domain = "' + tinymce.relaxedDomain + '";</script>'; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9120 |
|
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9121 |
bi = s.body_id || 'tinymce'; |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9122 |
if (bi.indexOf('=') != -1) { |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9123 |
bi = t.getParam('body_id', '', 'hash'); |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9124 |
bi = bi[t.id] || bi; |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9125 |
} |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9126 |
|
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9127 |
bc = s.body_class || ''; |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9128 |
if (bc.indexOf('=') != -1) { |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9129 |
bc = t.getParam('body_class', '', 'hash'); |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9130 |
bc = bc[t.id] || ''; |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9131 |
} |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9132 |
|
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9133 |
t.iframeHTML += '</head><body id="' + bi + '" class="mceContentBody ' + bc + '"></body></html>'; |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9134 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9135 |
// Domain relaxing enabled, then set document domain |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9136 |
if (tinymce.relaxedDomain) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9137 |
// We need to write the contents here in IE since multiple writes messes up refresh button and back button |
778 | 9138 |
if (isIE || (tinymce.isOpera && parseFloat(opera.version()) >= 9.5)) |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9139 |
u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";var ed = window.parent.tinyMCE.get("' + t.id + '");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()'; |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9140 |
else if (tinymce.isOpera) |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9141 |
u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";document.close();ed.setupIframe();})()'; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9142 |
} |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9143 |
|
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
|
9144 |
// Create iframe |
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
|
9145 |
n = DOM.add(o.iframeContainer, 'iframe', { |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9146 |
id : t.id + "_ifr", |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9147 |
src : u || 'javascript:""', // Workaround for HTTPS warning in IE6/7 |
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
|
9148 |
frameBorder : '0', |
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
|
9149 |
style : { |
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
|
9150 |
width : '100%', |
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
|
9151 |
height : h |
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
|
9152 |
} |
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
|
9153 |
}); |
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
|
9154 |
|
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
|
9155 |
t.contentAreaContainer = o.iframeContainer; |
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
|
9156 |
DOM.get(o.editorContainer).style.display = t.orgDisplay; |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9157 |
DOM.get(t.id).style.display = 'none'; |
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
|
9158 |
|
1193 | 9159 |
if (!isIE || !tinymce.relaxedDomain) |
9160 |
t.setupIframe(); |
|
9161 |
||
9162 |
e = n = o = null; // Cleanup |
|
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:
117
diff
changeset
|
9163 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9164 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9165 |
setupIframe : function() { |
543 | 9166 |
var t = this, s = t.settings, e = DOM.get(t.id), d = t.getDoc(), h, b; |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9167 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9168 |
// Setup iframe body |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9169 |
if (!isIE || !tinymce.relaxedDomain) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9170 |
d.open(); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9171 |
d.write(t.iframeHTML); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9172 |
d.close(); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9173 |
} |
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:
117
diff
changeset
|
9174 |
|
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
|
9175 |
// Design mode needs to be added here Ctrl+A will fail otherwise |
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
|
9176 |
if (!isIE) { |
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
|
9177 |
try { |
778 | 9178 |
if (!s.readonly) |
9179 |
d.designMode = 'On'; |
|
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
|
9180 |
} catch (ex) { |
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
|
9181 |
// Will fail on Gecko if the editor is placed in an hidden container 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
|
9182 |
// The design mode will be set ones the editor is focused |
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
|
9183 |
} |
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
|
9184 |
} |
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
|
9185 |
|
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:
117
diff
changeset
|
9186 |
// IE needs to use contentEditable or it will display non secure items for HTTPS |
543 | 9187 |
if (isIE) { |
9188 |
// It will not steal focus if we hide it while setting contentEditable |
|
9189 |
b = t.getBody(); |
|
9190 |
DOM.hide(b); |
|
778 | 9191 |
|
9192 |
if (!s.readonly) |
|
9193 |
b.contentEditable = true; |
|
9194 |
||
543 | 9195 |
DOM.show(b); |
9196 |
} |
|
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:
117
diff
changeset
|
9197 |
|
1193 | 9198 |
t.dom = new tinymce.dom.DOMUtils(t.getDoc(), { |
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:
117
diff
changeset
|
9199 |
keep_values : 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:
117
diff
changeset
|
9200 |
url_converter : t.convertURL, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9201 |
url_converter_scope : t, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9202 |
hex_colors : s.force_hex_style_colors, |
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
|
9203 |
class_filter : s.class_filter, |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9204 |
update_styles : 1, |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9205 |
fix_ie_paragraphs : 1 |
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:
117
diff
changeset
|
9206 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9207 |
|
1193 | 9208 |
t.serializer = new tinymce.dom.Serializer(extend(s, { |
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:
117
diff
changeset
|
9209 |
valid_elements : s.verify_html === false ? '*[*]' : s.valid_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:
117
diff
changeset
|
9210 |
dom : t.dom |
1193 | 9211 |
})); |
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:
117
diff
changeset
|
9212 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9213 |
t.selection = new tinymce.dom.Selection(t.dom, t.getWin(), t.serializer); |
1193 | 9214 |
|
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:
117
diff
changeset
|
9215 |
t.forceBlocks = new tinymce.ForceBlocks(t, { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9216 |
forced_root_block : s.forced_root_block |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9217 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9218 |
t.editorCommands = new tinymce.EditorCommands(t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9219 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9220 |
// Pass 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:
117
diff
changeset
|
9221 |
t.serializer.onPreProcess.add(function(se, 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:
117
diff
changeset
|
9222 |
return t.onPreProcess.dispatch(t, o, se); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9223 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9224 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9225 |
t.serializer.onPostProcess.add(function(se, 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:
117
diff
changeset
|
9226 |
return t.onPostProcess.dispatch(t, o, se); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9227 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9228 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9229 |
t.onPreInit.dispatch(t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9230 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9231 |
if (!s.gecko_spellcheck) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9232 |
t.getBody().spellcheck = 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:
117
diff
changeset
|
9233 |
|
778 | 9234 |
if (!s.readonly) |
9235 |
t._addEvents(); |
|
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:
117
diff
changeset
|
9236 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9237 |
t.controlManager.onPostRender.dispatch(t, t.controlManager); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9238 |
t.onPostRender.dispatch(t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9239 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9240 |
if (s.directionality) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9241 |
t.getBody().dir = s.directionality; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9242 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9243 |
if (s.nowrap) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9244 |
t.getBody().style.whiteSpace = "nowrap"; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9245 |
|
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9246 |
if (s.custom_elements) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9247 |
function handleCustom(ed, o) { |
543 | 9248 |
each(explode(s.custom_elements), function(v) { |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9249 |
var n; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9250 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9251 |
if (v.indexOf('~') === 0) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9252 |
v = v.substring(1); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9253 |
n = 'span'; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9254 |
} else |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9255 |
n = 'div'; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9256 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9257 |
o.content = o.content.replace(new RegExp('<(' + v + ')([^>]*)>', 'g'), '<' + n + ' mce_name="$1"$2>'); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9258 |
o.content = o.content.replace(new RegExp('</(' + v + ')>', 'g'), '</' + n + '>'); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9259 |
}); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9260 |
}; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9261 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9262 |
t.onBeforeSetContent.add(handleCustom); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9263 |
t.onPostProcess.add(function(ed, o) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9264 |
if (o.set) |
1193 | 9265 |
handleCustom(ed, o); |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9266 |
}); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9267 |
} |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9268 |
|
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:
117
diff
changeset
|
9269 |
if (s.handle_node_change_callback) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9270 |
t.onNodeChange.add(function(ed, cm, 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:
117
diff
changeset
|
9271 |
t.execCallback('handle_node_change_callback', t.id, n, -1, -1, true, t.selection.isCollapsed()); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9272 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9273 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9274 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9275 |
if (s.save_callback) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9276 |
t.onSaveContent.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:
117
diff
changeset
|
9277 |
var h = t.execCallback('save_callback', t.id, o.content, t.getBody()); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9278 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9279 |
if (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:
117
diff
changeset
|
9280 |
o.content = 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:
117
diff
changeset
|
9281 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9282 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9283 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9284 |
if (s.onchange_callback) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9285 |
t.onChange.add(function(ed, l) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9286 |
t.execCallback('onchange_callback', t, l); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9287 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9288 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9289 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9290 |
if (s.convert_newlines_to_brs) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9291 |
t.onBeforeSetContent.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:
117
diff
changeset
|
9292 |
if (o.initial) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9293 |
o.content = o.content.replace(/\r?\n/g, '<br />'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9294 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9295 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9296 |
|
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
|
9297 |
if (s.fix_nesting && isIE) { |
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
|
9298 |
t.onBeforeSetContent.add(function(ed, o) { |
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
|
9299 |
o.content = t._fixNesting(o.content); |
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
|
9300 |
}); |
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
|
9301 |
} |
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
|
9302 |
|
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:
117
diff
changeset
|
9303 |
if (s.preformatted) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9304 |
t.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:
117
diff
changeset
|
9305 |
o.content = o.content.replace(/^\s*<pre.*?>/, ''); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9306 |
o.content = o.content.replace(/<\/pre>\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:
117
diff
changeset
|
9307 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9308 |
if (o.set) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9309 |
o.content = '<pre class="mceItemHidden">' + o.content + '</pre>'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9310 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9311 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9312 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9313 |
if (s.verify_css_classes) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9314 |
t.serializer.attribValueFilter = function(n, 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:
117
diff
changeset
|
9315 |
var s, cl; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9316 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9317 |
if (n == 'class') { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9318 |
// Build regexp for classes |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9319 |
if (!t.classesRE) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9320 |
cl = t.dom.getClasses(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9321 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9322 |
if (cl.length > 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:
117
diff
changeset
|
9323 |
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:
117
diff
changeset
|
9324 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9325 |
each (cl, function(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:
117
diff
changeset
|
9326 |
s += (s ? '|' : '') + o['class']; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9327 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9328 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9329 |
t.classesRE = new RegExp('(' + s + ')', 'gi'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9330 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9331 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9332 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9333 |
return !t.classesRE || /(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(v) || t.classesRE.test(v) ? 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:
117
diff
changeset
|
9334 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9335 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9336 |
return 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:
117
diff
changeset
|
9337 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9338 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9339 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9340 |
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:
117
diff
changeset
|
9341 |
t._convertFonts(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9342 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9343 |
if (s.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:
117
diff
changeset
|
9344 |
t._convertInlineElements(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9345 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9346 |
if (s.cleanup_callback) { |
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
|
9347 |
t.onBeforeSetContent.add(function(ed, o) { |
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
|
9348 |
o.content = t.execCallback('cleanup_callback', 'insert_to_editor', o.content, o); |
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:
117
diff
changeset
|
9349 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9350 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9351 |
t.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:
117
diff
changeset
|
9352 |
if (o.set) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9353 |
t.execCallback('cleanup_callback', 'insert_to_editor_dom', o.node, 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:
117
diff
changeset
|
9354 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9355 |
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:
117
diff
changeset
|
9356 |
t.execCallback('cleanup_callback', 'get_from_editor_dom', o.node, 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:
117
diff
changeset
|
9357 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9358 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9359 |
t.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:
117
diff
changeset
|
9360 |
if (o.set) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9361 |
o.content = t.execCallback('cleanup_callback', 'insert_to_editor', o.content, 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:
117
diff
changeset
|
9362 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9363 |
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:
117
diff
changeset
|
9364 |
o.content = t.execCallback('cleanup_callback', 'get_from_editor', o.content, 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:
117
diff
changeset
|
9365 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9366 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9367 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9368 |
if (s.save_callback) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9369 |
t.onGetContent.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:
117
diff
changeset
|
9370 |
if (o.save) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9371 |
o.content = t.execCallback('save_callback', t.id, o.content, t.getBody()); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9372 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9373 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9374 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9375 |
if (s.handle_event_callback) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9376 |
t.onEvent.add(function(ed, e, 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:
117
diff
changeset
|
9377 |
if (t.execCallback('handle_event_callback', e, ed, o) === 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:
117
diff
changeset
|
9378 |
Event.cancel(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:
117
diff
changeset
|
9379 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9380 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9381 |
|
1193 | 9382 |
// Add visual aids when new contents is added |
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:
117
diff
changeset
|
9383 |
t.onSetContent.add(function() { |
1193 | 9384 |
t.addVisual(t.getBody()); |
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:
117
diff
changeset
|
9385 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9386 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9387 |
// Remove empty contents |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9388 |
if (s.padd_empty_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:
117
diff
changeset
|
9389 |
t.onPostProcess.add(function(ed, o) { |
778 | 9390 |
o.content = o.content.replace(/^(<p[^>]*>( | |\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/, ''); |
9391 |
}); |
|
9392 |
} |
|
9393 |
||
1193 | 9394 |
if (isGecko) { |
9395 |
// Fix gecko link bug, when a link is placed at the end of block elements there is |
|
9396 |
// no way to move the caret behind the link. This fix adds a bogus br element after the link |
|
9397 |
function fixLinks(ed, o) { |
|
9398 |
each(ed.dom.select('a'), function(n) { |
|
9399 |
var pn = n.parentNode; |
|
9400 |
||
9401 |
if (ed.dom.isBlock(pn) && pn.lastChild === n) |
|
9402 |
ed.dom.add(pn, 'br', {'mce_bogus' : 1}); |
|
9403 |
}); |
|
9404 |
}; |
|
9405 |
||
9406 |
t.onExecCommand.add(function(ed, cmd) { |
|
9407 |
if (cmd === 'CreateLink') |
|
9408 |
fixLinks(ed); |
|
9409 |
}); |
|
9410 |
||
9411 |
t.onSetContent.add(t.selection.onSetContent.add(fixLinks)); |
|
9412 |
||
9413 |
if (!s.readonly) { |
|
9414 |
try { |
|
9415 |
// Design mode must be set here once again to fix a bug where |
|
9416 |
// Ctrl+A/Delete/Backspace didn't work if the editor was added using mceAddControl then removed then added again |
|
9417 |
d.designMode = 'Off'; |
|
9418 |
d.designMode = 'On'; |
|
9419 |
} catch (ex) { |
|
9420 |
// Will fail on Gecko if the editor is placed in an hidden container element |
|
9421 |
// The design mode will be set ones the editor is focused |
|
9422 |
} |
|
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
|
9423 |
} |
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
|
9424 |
} |
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
|
9425 |
|
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
|
9426 |
// A small timeout was needed since firefox will remove. Bug: #1838304 |
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
|
9427 |
setTimeout(function () { |
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
|
9428 |
if (t.removed) |
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
|
9429 |
return; |
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
|
9430 |
|
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
|
9431 |
t.load({initial : true, format : (s.cleanup_on_startup ? 'html' : 'raw')}); |
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
|
9432 |
t.startContent = t.getContent({format : 'raw'}); |
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
|
9433 |
t.undoManager.add({initial : true}); |
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
|
9434 |
t.initialized = true; |
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
|
9435 |
|
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
|
9436 |
t.onInit.dispatch(t); |
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
|
9437 |
t.execCallback('setupcontent_callback', t.id, t.getBody(), t.getDoc()); |
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
|
9438 |
t.execCallback('init_instance_callback', t); |
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
|
9439 |
t.focus(true); |
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
|
9440 |
t.nodeChanged({initial : 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
|
9441 |
|
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
|
9442 |
// Load specified content CSS last |
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
|
9443 |
if (s.content_css) { |
543 | 9444 |
tinymce.each(explode(s.content_css), function(u) { |
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
|
9445 |
t.dom.loadCSS(t.documentBaseURI.toAbsolute(u)); |
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
|
9446 |
}); |
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
|
9447 |
} |
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
|
9448 |
|
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
|
9449 |
// Handle auto focus |
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
|
9450 |
if (s.auto_focus) { |
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
|
9451 |
setTimeout(function () { |
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
|
9452 |
var ed = EditorManager.get(s.auto_focus); |
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
|
9453 |
|
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
|
9454 |
ed.selection.select(ed.getBody(), 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
|
9455 |
ed.selection.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
|
9456 |
ed.getWin().focus(); |
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
|
9457 |
}, 100); |
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
|
9458 |
} |
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
|
9459 |
}, 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
|
9460 |
|
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:
117
diff
changeset
|
9461 |
e = 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:
117
diff
changeset
|
9462 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9463 |
|
1193 | 9464 |
|
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:
117
diff
changeset
|
9465 |
focus : function(sf) { |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
9466 |
var oed, t = this, ce = t.settings.content_editable; |
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:
117
diff
changeset
|
9467 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9468 |
if (!sf) { |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
9469 |
// Is not content editable or the selection is outside the area in IE |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
9470 |
// the IE statement is needed to avoid bluring if element selections inside layers since |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
9471 |
// the layer is like it's own document in IE |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
9472 |
if (!ce && (!isIE || t.selection.getNode().ownerDocument != t.getDoc())) |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
9473 |
t.getWin().focus(); |
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:
117
diff
changeset
|
9474 |
|
1193 | 9475 |
} |
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:
117
diff
changeset
|
9476 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9477 |
if (EditorManager.activeEditor != t) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9478 |
if ((oed = EditorManager.activeEditor) != 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:
117
diff
changeset
|
9479 |
oed.onDeactivate.dispatch(oed, t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9480 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9481 |
t.onActivate.dispatch(t, oed); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9482 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9483 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9484 |
EditorManager._setActive(t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9485 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9486 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9487 |
execCallback : 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:
117
diff
changeset
|
9488 |
var t = this, f = t.settings[n], 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:
117
diff
changeset
|
9489 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9490 |
if (!f) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9491 |
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:
117
diff
changeset
|
9492 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9493 |
// Look through lookup |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9494 |
if (t.callbackLookup && (s = t.callbackLookup[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:
117
diff
changeset
|
9495 |
f = s.func; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9496 |
s = s.scope; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9497 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9498 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9499 |
if (is(f, 'string')) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9500 |
s = f.replace(/\.\w+$/, ''); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9501 |
s = s ? tinymce.resolve(s) : 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:
117
diff
changeset
|
9502 |
f = tinymce.resolve(f); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9503 |
t.callbackLookup = t.callbackLookup || {}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9504 |
t.callbackLookup[n] = {func : f, scope : 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:
117
diff
changeset
|
9505 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9506 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9507 |
return f.apply(s || t, Array.prototype.slice.call(arguments, 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:
117
diff
changeset
|
9508 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9509 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9510 |
translate : function(s) { |
778 | 9511 |
var c = this.settings.language || 'en', i18n = EditorManager.i18n; |
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:
117
diff
changeset
|
9512 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9513 |
if (!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:
117
diff
changeset
|
9514 |
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:
117
diff
changeset
|
9515 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9516 |
return i18n[c + '.' + s] || s.replace(/{\#([^}]+)\}/g, function(a, 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:
117
diff
changeset
|
9517 |
return i18n[c + '.' + b] || '{#' + 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:
117
diff
changeset
|
9518 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9519 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9520 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9521 |
getLang : function(n, dv) { |
778 | 9522 |
return EditorManager.i18n[(this.settings.language || 'en') + '.' + n] || (is(dv) ? dv : '{#' + n + '}'); |
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:
117
diff
changeset
|
9523 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9524 |
|
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9525 |
getParam : function(n, dv, ty) { |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9526 |
var tr = tinymce.trim, v = is(this.settings[n]) ? this.settings[n] : dv, o; |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9527 |
|
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9528 |
if (ty === 'hash') { |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9529 |
o = {}; |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9530 |
|
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9531 |
if (is(v, 'string')) { |
543 | 9532 |
each(v.indexOf('=') > 0 ? v.split(/[;,](?![^=;,]*(?:[;,]|$))/) : v.split(','), function(v) { |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9533 |
v = v.split('='); |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9534 |
|
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9535 |
if (v.length > 1) |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9536 |
o[tr(v[0])] = tr(v[1]); |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9537 |
else |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9538 |
o[tr(v[0])] = tr(v); |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9539 |
}); |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9540 |
} else |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9541 |
o = v; |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9542 |
|
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9543 |
return o; |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9544 |
} |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9545 |
|
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9546 |
return v; |
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:
117
diff
changeset
|
9547 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9548 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9549 |
nodeChanged : function(o) { |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9550 |
var t = this, s = t.selection, n = s.getNode() || t.getBody(); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9551 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9552 |
// Fix for bug #1896577 it seems that this can not be fired while the editor is loading |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9553 |
if (t.initialized) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9554 |
t.onNodeChange.dispatch( |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9555 |
t, |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9556 |
o ? o.controlManager || t.controlManager : t.controlManager, |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9557 |
isIE && n.ownerDocument != t.getDoc() ? t.getBody() : n, // Fix for IE initial state |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9558 |
s.isCollapsed(), |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9559 |
o |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9560 |
); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9561 |
} |
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:
117
diff
changeset
|
9562 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9563 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9564 |
addButton : function(n, 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:
117
diff
changeset
|
9565 |
var t = 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:
117
diff
changeset
|
9566 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9567 |
t.buttons = t.buttons || {}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9568 |
t.buttons[n] = 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:
117
diff
changeset
|
9569 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9570 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9571 |
addCommand : function(n, f, 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:
117
diff
changeset
|
9572 |
this.execCommands[n] = {func : f, scope : s || 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:
117
diff
changeset
|
9573 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9574 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9575 |
addQueryStateHandler : function(n, f, 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:
117
diff
changeset
|
9576 |
this.queryStateCommands[n] = {func : f, scope : s || 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:
117
diff
changeset
|
9577 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9578 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9579 |
addQueryValueHandler : function(n, f, 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:
117
diff
changeset
|
9580 |
this.queryValueCommands[n] = {func : f, scope : s || 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:
117
diff
changeset
|
9581 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9582 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9583 |
addShortcut : function(pa, desc, cmd_func, sc) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9584 |
var t = this, c; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9585 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9586 |
if (!t.settings.custom_shortcuts) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9587 |
return 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:
117
diff
changeset
|
9588 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9589 |
t.shortcuts = t.shortcuts || {}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9590 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9591 |
if (is(cmd_func, 'string')) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9592 |
c = cmd_func; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9593 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9594 |
cmd_func = 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:
117
diff
changeset
|
9595 |
t.execCommand(c, false, 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:
117
diff
changeset
|
9596 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9597 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9598 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9599 |
if (is(cmd_func, 'object')) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9600 |
c = cmd_func; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9601 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9602 |
cmd_func = 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:
117
diff
changeset
|
9603 |
t.execCommand(c[0], c[1], c[2]); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9604 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9605 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9606 |
|
543 | 9607 |
each(explode(pa), function(pa) { |
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:
117
diff
changeset
|
9608 |
var 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:
117
diff
changeset
|
9609 |
func : cmd_func, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9610 |
scope : sc || 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:
117
diff
changeset
|
9611 |
desc : desc, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9612 |
alt : 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:
117
diff
changeset
|
9613 |
ctrl : 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:
117
diff
changeset
|
9614 |
shift : 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:
117
diff
changeset
|
9615 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9616 |
|
543 | 9617 |
each(explode(pa, '+'), function(v) { |
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:
117
diff
changeset
|
9618 |
switch (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:
117
diff
changeset
|
9619 |
case 'alt': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9620 |
case 'ctrl': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9621 |
case 'shift': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9622 |
o[v] = 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:
117
diff
changeset
|
9623 |
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:
117
diff
changeset
|
9624 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9625 |
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:
117
diff
changeset
|
9626 |
o.charCode = v.charCodeAt(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:
117
diff
changeset
|
9627 |
o.keyCode = v.toUpperCase().charCodeAt(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:
117
diff
changeset
|
9628 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9629 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9630 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9631 |
t.shortcuts[(o.ctrl ? 'ctrl' : '') + ',' + (o.alt ? 'alt' : '') + ',' + (o.shift ? 'shift' : '') + ',' + o.keyCode] = 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:
117
diff
changeset
|
9632 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9633 |
|
1 | 9634 |
return true; |
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:
117
diff
changeset
|
9635 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9636 |
|
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
|
9637 |
execCommand : function(cmd, ui, val, a) { |
543 | 9638 |
var t = this, s = 0, o, st; |
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:
117
diff
changeset
|
9639 |
|
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
|
9640 |
if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd) && (!a || !a.skip_focus)) |
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:
117
diff
changeset
|
9641 |
t.focus(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9642 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9643 |
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:
117
diff
changeset
|
9644 |
t.onBeforeExecCommand.dispatch(t, cmd, ui, val, 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:
117
diff
changeset
|
9645 |
if (o.terminate) |
1 | 9646 |
return false; |
9647 |
||
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
9648 |
// Command callback |
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
|
9649 |
if (t.execCallback('execcommand_callback', t.id, t.selection.getNode(), cmd, ui, val)) { |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9650 |
t.onExecCommand.dispatch(t, cmd, ui, val, a); |
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:
117
diff
changeset
|
9651 |
return 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:
117
diff
changeset
|
9652 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9653 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9654 |
// Registred commands |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9655 |
if (o = t.execCommands[cmd]) { |
543 | 9656 |
st = o.func.call(o.scope, ui, val); |
9657 |
||
9658 |
// Fall through on true |
|
9659 |
if (st !== true) { |
|
9660 |
t.onExecCommand.dispatch(t, cmd, ui, val, a); |
|
9661 |
return st; |
|
9662 |
} |
|
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:
117
diff
changeset
|
9663 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9664 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9665 |
// Plugin commands |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9666 |
each(t.plugins, function(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:
117
diff
changeset
|
9667 |
if (p.execCommand && p.execCommand(cmd, ui, val)) { |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9668 |
t.onExecCommand.dispatch(t, cmd, ui, val, a); |
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:
117
diff
changeset
|
9669 |
s = 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:
117
diff
changeset
|
9670 |
return 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:
117
diff
changeset
|
9671 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9672 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9673 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9674 |
if (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:
117
diff
changeset
|
9675 |
return 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:
117
diff
changeset
|
9676 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9677 |
// Theme commands |
1193 | 9678 |
if (t.theme && t.theme.execCommand && t.theme.execCommand(cmd, ui, val)) { |
9679 |
t.onExecCommand.dispatch(t, cmd, ui, val, a); |
|
9680 |
return true; |
|
9681 |
} |
|
9682 |
||
9683 |
// Execute global commands |
|
9684 |
if (tinymce.GlobalCommands.execCommand(t, cmd, ui, val)) { |
|
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9685 |
t.onExecCommand.dispatch(t, cmd, ui, val, a); |
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:
117
diff
changeset
|
9686 |
return 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:
117
diff
changeset
|
9687 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9688 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9689 |
// Editor commands |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9690 |
if (t.editorCommands.execCommand(cmd, ui, val)) { |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9691 |
t.onExecCommand.dispatch(t, cmd, ui, val, a); |
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:
117
diff
changeset
|
9692 |
return 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:
117
diff
changeset
|
9693 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9694 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9695 |
// Browser commands |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9696 |
t.getDoc().execCommand(cmd, ui, val); |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9697 |
t.onExecCommand.dispatch(t, cmd, ui, val, a); |
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:
117
diff
changeset
|
9698 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9699 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9700 |
queryCommandState : function(c) { |
543 | 9701 |
var t = this, o, s; |
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:
117
diff
changeset
|
9702 |
|
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
|
9703 |
// Is hidden then return undefined |
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
|
9704 |
if (t._isHidden()) |
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
|
9705 |
return; |
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
|
9706 |
|
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:
117
diff
changeset
|
9707 |
// Registred commands |
543 | 9708 |
if (o = t.queryStateCommands[c]) { |
9709 |
s = o.func.call(o.scope); |
|
9710 |
||
9711 |
// Fall though on true |
|
9712 |
if (s !== true) |
|
9713 |
return s; |
|
9714 |
} |
|
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:
117
diff
changeset
|
9715 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9716 |
// Registred commands |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9717 |
o = t.editorCommands.queryCommandState(c); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9718 |
if (o !== -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:
117
diff
changeset
|
9719 |
return 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:
117
diff
changeset
|
9720 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9721 |
// Browser commands |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9722 |
try { |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9723 |
return this.getDoc().queryCommandState(c); |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9724 |
} catch (ex) { |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9725 |
// Fails sometimes see bug: 1896577 |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9726 |
} |
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:
117
diff
changeset
|
9727 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9728 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9729 |
queryCommandValue : function(c) { |
543 | 9730 |
var t = this, o, s; |
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:
117
diff
changeset
|
9731 |
|
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
|
9732 |
// Is hidden then return undefined |
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
|
9733 |
if (t._isHidden()) |
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
|
9734 |
return; |
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
|
9735 |
|
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:
117
diff
changeset
|
9736 |
// Registred commands |
543 | 9737 |
if (o = t.queryValueCommands[c]) { |
9738 |
s = o.func.call(o.scope); |
|
9739 |
||
9740 |
// Fall though on true |
|
9741 |
if (s !== true) |
|
9742 |
return s; |
|
9743 |
} |
|
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:
117
diff
changeset
|
9744 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9745 |
// Registred commands |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9746 |
o = t.editorCommands.queryCommandValue(c); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9747 |
if (is(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:
117
diff
changeset
|
9748 |
return 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:
117
diff
changeset
|
9749 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9750 |
// Browser commands |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9751 |
try { |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9752 |
return this.getDoc().queryCommandValue(c); |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9753 |
} catch (ex) { |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9754 |
// Fails sometimes see bug: 1896577 |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9755 |
} |
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:
117
diff
changeset
|
9756 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9757 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9758 |
show : 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:
117
diff
changeset
|
9759 |
var t = 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:
117
diff
changeset
|
9760 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9761 |
DOM.show(t.getContainer()); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9762 |
DOM.hide(t.id); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9763 |
t.load(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9764 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9765 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9766 |
hide : function() { |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9767 |
var t = this, d = t.getDoc(); |
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:
117
diff
changeset
|
9768 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9769 |
// Fixed bug where IE has a blinking cursor left from the editor |
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
|
9770 |
if (isIE && d) |
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
|
9771 |
d.execCommand('SelectAll'); |
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:
117
diff
changeset
|
9772 |
|
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9773 |
// We must save before we hide so Safari doesn't crash |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9774 |
t.save(); |
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:
117
diff
changeset
|
9775 |
DOM.hide(t.getContainer()); |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9776 |
DOM.setStyle(t.id, 'display', t.orgDisplay); |
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:
117
diff
changeset
|
9777 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9778 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9779 |
isHidden : 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:
117
diff
changeset
|
9780 |
return !DOM.isHidden(this.id); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9781 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9782 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9783 |
setProgressState : function(b, ti, 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:
117
diff
changeset
|
9784 |
this.onSetProgressState.dispatch(this, b, ti, 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:
117
diff
changeset
|
9785 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9786 |
return 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:
117
diff
changeset
|
9787 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9788 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9789 |
load : function(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:
117
diff
changeset
|
9790 |
var t = this, e = t.getElement(), 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:
117
diff
changeset
|
9791 |
|
778 | 9792 |
if (e) { |
9793 |
o = o || {}; |
|
9794 |
o.load = true; |
|
9795 |
||
1193 | 9796 |
// Double encode existing entities in the value |
778 | 9797 |
h = t.setContent(is(e.value) ? e.value : e.innerHTML, o); |
9798 |
o.element = e; |
|
9799 |
||
9800 |
if (!o.no_events) |
|
9801 |
t.onLoadContent.dispatch(t, o); |
|
9802 |
||
9803 |
o.element = e = null; |
|
9804 |
||
9805 |
return h; |
|
9806 |
} |
|
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:
117
diff
changeset
|
9807 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9808 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9809 |
save : function(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:
117
diff
changeset
|
9810 |
var t = this, e = t.getElement(), h, f; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9811 |
|
778 | 9812 |
if (!e || !t.initialized) |
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
|
9813 |
return; |
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
|
9814 |
|
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:
117
diff
changeset
|
9815 |
o = 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:
117
diff
changeset
|
9816 |
o.save = 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:
117
diff
changeset
|
9817 |
|
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
9818 |
// Add undo level will trigger onchange event |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
9819 |
if (!o.no_events) { |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
9820 |
t.undoManager.typing = 0; |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
9821 |
t.undoManager.add(); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
9822 |
} |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
9823 |
|
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:
117
diff
changeset
|
9824 |
o.element = 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:
117
diff
changeset
|
9825 |
h = o.content = t.getContent(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:
117
diff
changeset
|
9826 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9827 |
if (!o.no_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:
117
diff
changeset
|
9828 |
t.onSaveContent.dispatch(t, 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:
117
diff
changeset
|
9829 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9830 |
h = o.content; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9831 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9832 |
if (!/TEXTAREA|INPUT/i.test(e.nodeName)) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9833 |
e.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:
117
diff
changeset
|
9834 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9835 |
// Update hidden form element |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9836 |
if (f = DOM.getParent(t.id, 'form')) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9837 |
each(f.elements, 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:
117
diff
changeset
|
9838 |
if (e.name == t.id) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9839 |
e.value = 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:
117
diff
changeset
|
9840 |
return 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:
117
diff
changeset
|
9841 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9842 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9843 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9844 |
} 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:
117
diff
changeset
|
9845 |
e.value = 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:
117
diff
changeset
|
9846 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9847 |
o.element = e = 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:
117
diff
changeset
|
9848 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9849 |
return 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:
117
diff
changeset
|
9850 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9851 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9852 |
setContent : function(h, 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:
117
diff
changeset
|
9853 |
var t = 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:
117
diff
changeset
|
9854 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9855 |
o = 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:
117
diff
changeset
|
9856 |
o.format = o.format || 'html'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9857 |
o.set = 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:
117
diff
changeset
|
9858 |
o.content = 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:
117
diff
changeset
|
9859 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9860 |
if (!o.no_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:
117
diff
changeset
|
9861 |
t.onBeforeSetContent.dispatch(t, 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:
117
diff
changeset
|
9862 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9863 |
// Padd empty content in Gecko and Safari. Commands will otherwise fail on the content |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9864 |
// It will also be impossible to place the caret in the editor unless there is a BR element present |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9865 |
if (!tinymce.isIE && (h.length === 0 || /^\s+$/.test(h))) { |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
9866 |
o.content = t.dom.setHTML(t.getBody(), '<br mce_bogus="1" />'); |
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:
117
diff
changeset
|
9867 |
o.format = 'raw'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9868 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9869 |
|
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
|
9870 |
o.content = t.dom.setHTML(t.getBody(), tinymce.trim(o.content)); |
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:
117
diff
changeset
|
9871 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9872 |
if (o.format != 'raw' && t.settings.cleanup) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9873 |
o.getInner = 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:
117
diff
changeset
|
9874 |
o.content = t.dom.setHTML(t.getBody(), t.serializer.serialize(t.getBody(), 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:
117
diff
changeset
|
9875 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9876 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9877 |
if (!o.no_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:
117
diff
changeset
|
9878 |
t.onSetContent.dispatch(t, 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:
117
diff
changeset
|
9879 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9880 |
return o.content; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9881 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9882 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9883 |
getContent : function(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:
117
diff
changeset
|
9884 |
var t = this, 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:
117
diff
changeset
|
9885 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9886 |
o = 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:
117
diff
changeset
|
9887 |
o.format = o.format || 'html'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9888 |
o.get = 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:
117
diff
changeset
|
9889 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9890 |
if (!o.no_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:
117
diff
changeset
|
9891 |
t.onBeforeGetContent.dispatch(t, 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:
117
diff
changeset
|
9892 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9893 |
if (o.format != 'raw' && t.settings.cleanup) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9894 |
o.getInner = 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:
117
diff
changeset
|
9895 |
h = t.serializer.serialize(t.getBody(), 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:
117
diff
changeset
|
9896 |
} 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:
117
diff
changeset
|
9897 |
h = t.getBody().innerHTML; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9898 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9899 |
h = h.replace(/^\s*|\s*$/g, ''); |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
9900 |
o.content = h; |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
9901 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
9902 |
if (!o.no_events) |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
9903 |
t.onGetContent.dispatch(t, o); |
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:
117
diff
changeset
|
9904 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9905 |
return o.content; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9906 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9907 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9908 |
isDirty : 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:
117
diff
changeset
|
9909 |
var t = 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:
117
diff
changeset
|
9910 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9911 |
return tinymce.trim(t.startContent) != tinymce.trim(t.getContent({format : 'raw', no_events : 1})) && !t.isNotDirty; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9912 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9913 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9914 |
getContainer : 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:
117
diff
changeset
|
9915 |
var t = 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:
117
diff
changeset
|
9916 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9917 |
if (!t.container) |
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
|
9918 |
t.container = DOM.get(t.editorContainer || t.id + '_parent'); |
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:
117
diff
changeset
|
9919 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9920 |
return t.container; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9921 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9922 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9923 |
getContentAreaContainer : 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:
117
diff
changeset
|
9924 |
return this.contentAreaContainer; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9925 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9926 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9927 |
getElement : 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:
117
diff
changeset
|
9928 |
return DOM.get(this.settings.content_element || this.id); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9929 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9930 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9931 |
getWin : function() { |
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
|
9932 |
var t = this, e; |
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
|
9933 |
|
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
|
9934 |
if (!t.contentWindow) { |
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
|
9935 |
e = DOM.get(t.id + "_ifr"); |
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
|
9936 |
|
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
|
9937 |
if (e) |
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
|
9938 |
t.contentWindow = e.contentWindow; |
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
|
9939 |
} |
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:
117
diff
changeset
|
9940 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9941 |
return t.contentWindow; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9942 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9943 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9944 |
getDoc : function() { |
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
|
9945 |
var t = this, w; |
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
|
9946 |
|
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
|
9947 |
if (!t.contentDocument) { |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
9948 |
w = t.getWin(); |
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
|
9949 |
|
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
|
9950 |
if (w) |
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
|
9951 |
t.contentDocument = w.document; |
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
|
9952 |
} |
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:
117
diff
changeset
|
9953 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9954 |
return t.contentDocument; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9955 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9956 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9957 |
getBody : 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:
117
diff
changeset
|
9958 |
return this.bodyElement || this.getDoc().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:
117
diff
changeset
|
9959 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9960 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9961 |
convertURL : function(u, n, 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:
117
diff
changeset
|
9962 |
var t = this, s = t.settings; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9963 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9964 |
// Use callback instead |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9965 |
if (s.urlconverter_callback) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9966 |
return t.execCallback('urlconverter_callback', u, e, true, 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:
117
diff
changeset
|
9967 |
|
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9968 |
// Don't convert link href since thats the CSS files that gets loaded into the editor also skip local file URLs |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
9969 |
if (!s.convert_urls || (e && e.nodeName == 'LINK') || u.indexOf('file:') === 0) |
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:
117
diff
changeset
|
9970 |
return 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:
117
diff
changeset
|
9971 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9972 |
// Convert to relative |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9973 |
if (s.relative_urls) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9974 |
return t.documentBaseURI.toRelative(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:
117
diff
changeset
|
9975 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9976 |
// Convert to absolute |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9977 |
u = t.documentBaseURI.toAbsolute(u, s.remove_script_host); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9978 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9979 |
return 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:
117
diff
changeset
|
9980 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9981 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9982 |
addVisual : 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:
117
diff
changeset
|
9983 |
var t = this, s = t.settings; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9984 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9985 |
e = e || t.getBody(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9986 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9987 |
if (!is(t.hasVisual)) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9988 |
t.hasVisual = s.visual; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9989 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9990 |
each(t.dom.select('table,a', e), 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:
117
diff
changeset
|
9991 |
var 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:
117
diff
changeset
|
9992 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9993 |
switch (e.nodeName) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9994 |
case 'TABLE': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9995 |
v = t.dom.getAttrib(e, 'border'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9996 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9997 |
if (!v || v == '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:
117
diff
changeset
|
9998 |
if (t.hasVisual) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
9999 |
t.dom.addClass(e, s.visual_table_class); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10000 |
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:
117
diff
changeset
|
10001 |
t.dom.removeClass(e, s.visual_table_class); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10002 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10003 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10004 |
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:
117
diff
changeset
|
10005 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10006 |
case '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:
117
diff
changeset
|
10007 |
v = t.dom.getAttrib(e, '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:
117
diff
changeset
|
10008 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10009 |
if (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:
117
diff
changeset
|
10010 |
if (t.hasVisual) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10011 |
t.dom.addClass(e, 'mceItemAnchor'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10012 |
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:
117
diff
changeset
|
10013 |
t.dom.removeClass(e, 'mceItemAnchor'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10014 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10015 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10016 |
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:
117
diff
changeset
|
10017 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10018 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10019 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10020 |
t.onVisualAid.dispatch(t, e, t.hasVisual); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10021 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10022 |
|
543 | 10023 |
remove : function() { |
10024 |
var t = this, e = t.getContainer(); |
|
10025 |
||
10026 |
t.removed = 1; // Cancels post remove event execution |
|
10027 |
t.hide(); |
|
10028 |
||
10029 |
t.execCallback('remove_instance_callback', t); |
|
10030 |
t.onRemove.dispatch(t); |
|
10031 |
||
10032 |
// Clear all execCommand listeners this is required to avoid errors if the editor was removed inside another command |
|
10033 |
t.onExecCommand.listeners = []; |
|
10034 |
||
10035 |
EditorManager.remove(t); |
|
10036 |
DOM.remove(e); |
|
10037 |
}, |
|
10038 |
||
10039 |
destroy : function(s) { |
|
10040 |
var t = this; |
|
10041 |
||
10042 |
// One time is enough |
|
10043 |
if (t.destroyed) |
|
10044 |
return; |
|
10045 |
||
10046 |
if (!s) { |
|
10047 |
tinymce.removeUnload(t.destroy); |
|
10048 |
tinyMCE.onBeforeUnload.remove(t._beforeUnload); |
|
10049 |
||
10050 |
// Manual destroy |
|
1193 | 10051 |
if (t.theme && t.theme.destroy) |
543 | 10052 |
t.theme.destroy(); |
10053 |
||
10054 |
// Destroy controls, selection and dom |
|
10055 |
t.controlManager.destroy(); |
|
10056 |
t.selection.destroy(); |
|
10057 |
t.dom.destroy(); |
|
10058 |
||
10059 |
// Remove all events |
|
10060 |
||
10061 |
// Don't clear the window or document if content editable |
|
10062 |
// is enabled since other instances might still be present |
|
10063 |
if (!t.settings.content_editable) { |
|
10064 |
Event.clear(t.getWin()); |
|
10065 |
Event.clear(t.getDoc()); |
|
10066 |
} |
|
10067 |
||
10068 |
Event.clear(t.getBody()); |
|
10069 |
Event.clear(t.formElement); |
|
10070 |
} |
|
10071 |
||
10072 |
if (t.formElement) { |
|
10073 |
t.formElement.submit = t.formElement._mceOldSubmit; |
|
10074 |
t.formElement._mceOldSubmit = null; |
|
10075 |
} |
|
10076 |
||
10077 |
t.contentAreaContainer = t.formElement = t.container = t.settings.content_element = t.bodyElement = t.contentDocument = t.contentWindow = null; |
|
10078 |
||
10079 |
if (t.selection) |
|
10080 |
t.selection = t.selection.win = t.selection.dom = t.selection.dom.doc = null; |
|
10081 |
||
10082 |
t.destroyed = 1; |
|
10083 |
}, |
|
10084 |
||
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:
117
diff
changeset
|
10085 |
// Internal functions |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10086 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10087 |
_addEvents : 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:
117
diff
changeset
|
10088 |
// 'focus', 'blur', 'dblclick', 'beforedeactivate', submit, reset |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10089 |
var t = this, i, s = t.settings, lo = { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10090 |
mouseup : 'onMouseUp', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10091 |
mousedown : 'onMouseDown', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10092 |
click : 'onClick', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10093 |
keyup : 'onKeyUp', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10094 |
keydown : 'onKeyDown', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10095 |
keypress : 'onKeyPress', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10096 |
submit : 'onSubmit', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10097 |
reset : 'onReset', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10098 |
contextmenu : 'onContextMenu', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10099 |
dblclick : 'onDblClick', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10100 |
paste : 'onPaste' // Doesn't work in all browsers yet |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10101 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10102 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10103 |
function eventHandler(e, 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:
117
diff
changeset
|
10104 |
var ty = e.type; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10105 |
|
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
|
10106 |
// Don't fire events when it's removed |
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
|
10107 |
if (t.removed) |
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
|
10108 |
return; |
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
|
10109 |
|
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:
117
diff
changeset
|
10110 |
// Generic event handler |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10111 |
if (t.onEvent.dispatch(t, e, o) !== 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:
117
diff
changeset
|
10112 |
// Specific event handler |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10113 |
t[lo[e.fakeType || e.type]].dispatch(t, e, 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:
117
diff
changeset
|
10114 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10115 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10116 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10117 |
// Add DOM 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:
117
diff
changeset
|
10118 |
each(lo, function(v, k) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10119 |
switch (k) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10120 |
case 'contextmenu': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10121 |
if (tinymce.isOpera) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10122 |
// Fake contextmenu on Opera |
1193 | 10123 |
t.dom.bind(t.getBody(), 'mousedown', function(e) { |
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:
117
diff
changeset
|
10124 |
if (e.ctrlKey) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10125 |
e.fakeType = 'contextmenu'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10126 |
eventHandler(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:
117
diff
changeset
|
10127 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10128 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10129 |
} else |
1193 | 10130 |
t.dom.bind(t.getBody(), k, eventHandler); |
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:
117
diff
changeset
|
10131 |
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:
117
diff
changeset
|
10132 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10133 |
case 'paste': |
1193 | 10134 |
t.dom.bind(t.getBody(), k, function(e) { |
10135 |
eventHandler(e); |
|
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:
117
diff
changeset
|
10136 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10137 |
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:
117
diff
changeset
|
10138 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10139 |
case 'submit': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10140 |
case 'reset': |
1193 | 10141 |
t.dom.bind(t.getElement().form || DOM.getParent(t.id, 'form'), k, eventHandler); |
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:
117
diff
changeset
|
10142 |
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:
117
diff
changeset
|
10143 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10144 |
default: |
1193 | 10145 |
t.dom.bind(s.content_editable ? t.getBody() : t.getDoc(), k, eventHandler); |
10146 |
} |
|
10147 |
}); |
|
10148 |
||
10149 |
t.dom.bind(s.content_editable ? t.getBody() : (isGecko ? t.getDoc() : t.getWin()), 'focus', function(e) { |
|
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:
117
diff
changeset
|
10150 |
t.focus(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:
117
diff
changeset
|
10151 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10152 |
|
1193 | 10153 |
|
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:
117
diff
changeset
|
10154 |
// Fixes bug where a specified document_base_uri could result in broken 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:
117
diff
changeset
|
10155 |
// This will also fix drag drop of images in Gecko |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10156 |
if (tinymce.isGecko) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10157 |
// Convert all images to absolute URLs |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10158 |
/* t.onSetContent.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:
117
diff
changeset
|
10159 |
each(ed.dom.select('img'), 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:
117
diff
changeset
|
10160 |
var 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:
117
diff
changeset
|
10161 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10162 |
if (v = e.getAttribute('mce_src')) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10163 |
e.src = t.documentBaseURI.toAbsolute(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:
117
diff
changeset
|
10164 |
}) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10165 |
});*/ |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10166 |
|
1193 | 10167 |
t.dom.bind(t.getDoc(), 'DOMNodeInserted', function(e) { |
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:
117
diff
changeset
|
10168 |
var 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:
117
diff
changeset
|
10169 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10170 |
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:
117
diff
changeset
|
10171 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10172 |
if (e.nodeType === 1 && e.nodeName === 'IMG' && (v = e.getAttribute('mce_src'))) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10173 |
e.src = t.documentBaseURI.toAbsolute(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:
117
diff
changeset
|
10174 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10175 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10176 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10177 |
// Set various midas options in Gecko |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10178 |
if (isGecko) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10179 |
function setOpts() { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10180 |
var t = this, d = t.getDoc(), s = t.settings; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10181 |
|
778 | 10182 |
if (isGecko && !s.readonly) { |
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
|
10183 |
if (t._isHidden()) { |
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
|
10184 |
try { |
543 | 10185 |
if (!s.content_editable) |
10186 |
d.designMode = 'On'; |
|
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
|
10187 |
} catch (ex) { |
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
|
10188 |
// Fails if it's hidden |
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
|
10189 |
} |
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
|
10190 |
} |
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
|
10191 |
|
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:
117
diff
changeset
|
10192 |
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:
117
diff
changeset
|
10193 |
// Try new Gecko method |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10194 |
d.execCommand("styleWithCSS", 0, 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:
117
diff
changeset
|
10195 |
} catch (ex) { |
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
|
10196 |
// Use old method |
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
|
10197 |
if (!t._isHidden()) |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
10198 |
try {d.execCommand("useCSS", 0, true);} catch (ex) {} |
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:
117
diff
changeset
|
10199 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10200 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10201 |
if (!s.table_inline_editing) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10202 |
try {d.execCommand('enableInlineTableEditing', false, false);} 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:
117
diff
changeset
|
10203 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10204 |
if (!s.object_resizing) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10205 |
try {d.execCommand('enableObjectResizing', false, false);} 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:
117
diff
changeset
|
10206 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10207 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10208 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10209 |
t.onBeforeExecCommand.add(setOpts); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10210 |
t.onMouseDown.add(setOpts); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10211 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10212 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10213 |
// Add node change handlers |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10214 |
t.onMouseUp.add(t.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:
117
diff
changeset
|
10215 |
t.onClick.add(t.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:
117
diff
changeset
|
10216 |
t.onKeyUp.add(function(ed, e) { |
778 | 10217 |
var c = e.keyCode; |
10218 |
||
10219 |
if ((c >= 33 && c <= 36) || (c >= 37 && c <= 40) || c == 13 || c == 45 || c == 46 || c == 8 || (tinymce.isMac && (c == 91 || c == 93)) || e.ctrlKey) |
|
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:
117
diff
changeset
|
10220 |
t.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:
117
diff
changeset
|
10221 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10222 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10223 |
// Add reset handler |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10224 |
t.onReset.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:
117
diff
changeset
|
10225 |
t.setContent(t.startContent, {format : 'raw'}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10226 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10227 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10228 |
// Add shortcuts |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10229 |
if (s.custom_shortcuts) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10230 |
if (s.custom_undo_redo_keyboard_shortcuts) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10231 |
t.addShortcut('ctrl+z', t.getLang('undo_desc'), 'Undo'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10232 |
t.addShortcut('ctrl+y', t.getLang('redo_desc'), 'Redo'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10233 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10234 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10235 |
// Add default shortcuts for gecko |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10236 |
if (isGecko) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10237 |
t.addShortcut('ctrl+b', t.getLang('bold_desc'), '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:
117
diff
changeset
|
10238 |
t.addShortcut('ctrl+i', t.getLang('italic_desc'), '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:
117
diff
changeset
|
10239 |
t.addShortcut('ctrl+u', t.getLang('underline_desc'), '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:
117
diff
changeset
|
10240 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10241 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10242 |
// BlockFormat shortcuts keys |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10243 |
for (i=1; i<=6; i++) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10244 |
t.addShortcut('ctrl+' + i, '', ['FormatBlock', false, '<h' + i + '>']); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10245 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10246 |
t.addShortcut('ctrl+7', '', ['FormatBlock', false, '<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:
117
diff
changeset
|
10247 |
t.addShortcut('ctrl+8', '', ['FormatBlock', false, '<div>']); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10248 |
t.addShortcut('ctrl+9', '', ['FormatBlock', false, '<address>']); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10249 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10250 |
function find(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:
117
diff
changeset
|
10251 |
var v = 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:
117
diff
changeset
|
10252 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10253 |
if (!e.altKey && !e.ctrlKey && !e.metaKey) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10254 |
return 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:
117
diff
changeset
|
10255 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10256 |
each(t.shortcuts, function(o) { |
778 | 10257 |
if (tinymce.isMac && o.ctrl != e.metaKey) |
10258 |
return; |
|
10259 |
else if (!tinymce.isMac && o.ctrl != e.ctrlKey) |
|
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:
117
diff
changeset
|
10260 |
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:
117
diff
changeset
|
10261 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10262 |
if (o.alt != e.altKey) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10263 |
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:
117
diff
changeset
|
10264 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10265 |
if (o.shift != e.shiftKey) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10266 |
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:
117
diff
changeset
|
10267 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10268 |
if (e.keyCode == o.keyCode || (e.charCode && e.charCode == o.charCode)) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10269 |
v = 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:
117
diff
changeset
|
10270 |
return 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:
117
diff
changeset
|
10271 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10272 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10273 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10274 |
return 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:
117
diff
changeset
|
10275 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10276 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10277 |
t.onKeyUp.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:
117
diff
changeset
|
10278 |
var o = find(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:
117
diff
changeset
|
10279 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10280 |
if (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:
117
diff
changeset
|
10281 |
return Event.cancel(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:
117
diff
changeset
|
10282 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10283 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10284 |
t.onKeyPress.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:
117
diff
changeset
|
10285 |
var o = find(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:
117
diff
changeset
|
10286 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10287 |
if (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:
117
diff
changeset
|
10288 |
return Event.cancel(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:
117
diff
changeset
|
10289 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10290 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10291 |
t.onKeyDown.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:
117
diff
changeset
|
10292 |
var o = find(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:
117
diff
changeset
|
10293 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10294 |
if (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:
117
diff
changeset
|
10295 |
o.func.call(o.scope); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10296 |
return Event.cancel(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:
117
diff
changeset
|
10297 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10298 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10299 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10300 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10301 |
if (tinymce.isIE) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10302 |
// Fix so resize will only update the width and height attributes not the styles of an image |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10303 |
// It will also block mceItemNoResize items |
1193 | 10304 |
t.dom.bind(t.getDoc(), 'controlselect', function(e) { |
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:
117
diff
changeset
|
10305 |
var re = t.resizeInfo, cb; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10306 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10307 |
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:
117
diff
changeset
|
10308 |
|
543 | 10309 |
// Don't do this action for non image elements |
10310 |
if (e.nodeName !== 'IMG') |
|
10311 |
return; |
|
10312 |
||
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:
117
diff
changeset
|
10313 |
if (re) |
1193 | 10314 |
t.dom.unbind(re.node, re.ev, re.cb); |
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:
117
diff
changeset
|
10315 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10316 |
if (!t.dom.hasClass(e, 'mceItemNoResize')) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10317 |
ev = 'resizeend'; |
1193 | 10318 |
cb = t.dom.bind(e, ev, function(e) { |
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:
117
diff
changeset
|
10319 |
var 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:
117
diff
changeset
|
10320 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10321 |
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:
117
diff
changeset
|
10322 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10323 |
if (v = t.dom.getStyle(e, 'width')) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10324 |
t.dom.setAttrib(e, 'width', v.replace(/[^0-9%]+/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:
117
diff
changeset
|
10325 |
t.dom.setStyle(e, 'width', ''); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10326 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10327 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10328 |
if (v = t.dom.getStyle(e, 'height')) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10329 |
t.dom.setAttrib(e, 'height', v.replace(/[^0-9%]+/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:
117
diff
changeset
|
10330 |
t.dom.setStyle(e, 'height', ''); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10331 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10332 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10333 |
} 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:
117
diff
changeset
|
10334 |
ev = 'resizestart'; |
1193 | 10335 |
cb = t.dom.bind(e, 'resizestart', Event.cancel, Event); |
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:
117
diff
changeset
|
10336 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10337 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10338 |
re = t.resizeInfo = { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10339 |
node : 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:
117
diff
changeset
|
10340 |
ev : ev, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10341 |
cb : cb |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10342 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10343 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10344 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10345 |
t.onKeyDown.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:
117
diff
changeset
|
10346 |
switch (e.keyCode) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10347 |
case 8: |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10348 |
// Fix IE control + backspace browser bug |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10349 |
if (t.selection.getRng().item) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10350 |
t.selection.getRng().item(0).removeNode(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10351 |
return Event.cancel(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:
117
diff
changeset
|
10352 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10353 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10354 |
}); |
1193 | 10355 |
|
10356 |
/*if (t.dom.boxModel) { |
|
10357 |
t.getBody().style.height = '100%'; |
|
10358 |
||
10359 |
Event.add(t.getWin(), 'resize', function(e) { |
|
10360 |
var docElm = t.getDoc().documentElement; |
|
10361 |
||
10362 |
docElm.style.height = (docElm.offsetHeight - 10) + 'px'; |
|
10363 |
}); |
|
10364 |
}*/ |
|
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:
117
diff
changeset
|
10365 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10366 |
|
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
|
10367 |
if (tinymce.isOpera) { |
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
|
10368 |
t.onClick.add(function(ed, e) { |
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
|
10369 |
Event.prevent(e); |
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
|
10370 |
}); |
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
|
10371 |
} |
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
|
10372 |
|
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:
117
diff
changeset
|
10373 |
// Add custom undo/redo handlers |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10374 |
if (s.custom_undo_redo) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10375 |
function addUndo() { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10376 |
t.undoManager.typing = 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:
117
diff
changeset
|
10377 |
t.undoManager.add(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10378 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10379 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10380 |
// Add undo level on editor blur |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10381 |
if (tinymce.isIE) { |
1193 | 10382 |
t.dom.bind(t.getWin(), 'blur', function(e) { |
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:
117
diff
changeset
|
10383 |
var 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:
117
diff
changeset
|
10384 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10385 |
// Check added for fullscreen bug |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10386 |
if (t.selection) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10387 |
n = t.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:
117
diff
changeset
|
10388 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10389 |
// Add undo level is selection was lost to another document |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10390 |
if (!t.removed && n.ownerDocument && n.ownerDocument != t.getDoc()) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10391 |
addUndo(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10392 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10393 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10394 |
} else { |
1193 | 10395 |
t.dom.bind(t.getDoc(), 'blur', function() { |
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
|
10396 |
if (t.selection && !t.removed) |
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:
117
diff
changeset
|
10397 |
addUndo(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10398 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10399 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10400 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10401 |
t.onMouseDown.add(addUndo); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10402 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10403 |
t.onKeyUp.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:
117
diff
changeset
|
10404 |
if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45 || e.ctrlKey) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10405 |
t.undoManager.typing = 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:
117
diff
changeset
|
10406 |
t.undoManager.add(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10407 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10408 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10409 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10410 |
t.onKeyDown.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:
117
diff
changeset
|
10411 |
// Is caracter positon keys |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10412 |
if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10413 |
if (t.undoManager.typing) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10414 |
t.undoManager.add(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10415 |
t.undoManager.typing = 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:
117
diff
changeset
|
10416 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10417 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10418 |
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:
117
diff
changeset
|
10419 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10420 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10421 |
if (!t.undoManager.typing) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10422 |
t.undoManager.add(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10423 |
t.undoManager.typing = 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:
117
diff
changeset
|
10424 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10425 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10426 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10427 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10428 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10429 |
_convertInlineElements : function() { |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
10430 |
var t = this, s = t.settings, dom = t.dom, v, e, na, st, sp; |
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:
117
diff
changeset
|
10431 |
|
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
|
10432 |
function convert(ed, o) { |
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:
117
diff
changeset
|
10433 |
if (!s.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:
117
diff
changeset
|
10434 |
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:
117
diff
changeset
|
10435 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10436 |
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:
117
diff
changeset
|
10437 |
each(t.dom.select('table,u,strike', o.node), 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:
117
diff
changeset
|
10438 |
switch (n.nodeName) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10439 |
case 'TABLE': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10440 |
if (v = dom.getAttrib(n, 'height')) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10441 |
dom.setStyle(n, 'height', 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:
117
diff
changeset
|
10442 |
dom.setAttrib(n, 'height', ''); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10443 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10444 |
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:
117
diff
changeset
|
10445 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10446 |
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:
117
diff
changeset
|
10447 |
case 'STRIKE': |
543 | 10448 |
//sp = dom.create('span', {style : dom.getAttrib(n, 'style')}); |
10449 |
n.style.textDecoration = n.nodeName == 'U' ? 'underline' : 'line-through'; |
|
10450 |
dom.setAttrib(n, 'mce_style', ''); |
|
10451 |
dom.setAttrib(n, 'mce_name', '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:
117
diff
changeset
|
10452 |
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:
117
diff
changeset
|
10453 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10454 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10455 |
} else if (o.set) { |
543 | 10456 |
each(t.dom.select('table,span', o.node).reverse(), function(n) { |
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:
117
diff
changeset
|
10457 |
if (n.nodeName == 'TABLE') { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10458 |
if (v = dom.getStyle(n, 'height')) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10459 |
dom.setAttrib(n, 'height', v.replace(/[^0-9%]+/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:
117
diff
changeset
|
10460 |
} 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:
117
diff
changeset
|
10461 |
// Convert spans to 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:
117
diff
changeset
|
10462 |
if (n.style.textDecoration == 'underline') |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
10463 |
na = 'u'; |
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
|
10464 |
else if (n.style.textDecoration == 'line-through') |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
10465 |
na = 'strike'; |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
10466 |
else |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
10467 |
na = ''; |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
10468 |
|
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
10469 |
if (na) { |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
10470 |
n.style.textDecoration = ''; |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
10471 |
dom.setAttrib(n, 'mce_style', ''); |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
10472 |
|
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
10473 |
e = dom.create(na, { |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
10474 |
style : dom.getAttrib(n, 'style') |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
10475 |
}); |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
10476 |
|
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
10477 |
dom.replace(e, n, 1); |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
10478 |
} |
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:
117
diff
changeset
|
10479 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10480 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10481 |
} |
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
|
10482 |
}; |
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
|
10483 |
|
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
|
10484 |
t.onPreProcess.add(convert); |
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
|
10485 |
|
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
|
10486 |
if (!s.cleanup_on_startup) { |
543 | 10487 |
t.onSetContent.add(function(ed, o) { |
10488 |
if (o.initial) |
|
10489 |
convert(t, {node : t.getBody(), set : 1}); |
|
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
|
10490 |
}); |
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
|
10491 |
} |
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:
117
diff
changeset
|
10492 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10493 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10494 |
_convertFonts : function() { |
543 | 10495 |
var t = this, s = t.settings, dom = t.dom, fz, fzn, sl, cl; |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
10496 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
10497 |
// No need |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
10498 |
if (!s.inline_styles) |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
10499 |
return; |
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:
117
diff
changeset
|
10500 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10501 |
// Font pt values and font size names |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10502 |
fz = [8, 10, 12, 14, 18, 24, 36]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10503 |
fzn = ['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:
117
diff
changeset
|
10504 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10505 |
if (sl = s.font_size_style_values) |
543 | 10506 |
sl = explode(sl); |
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:
117
diff
changeset
|
10507 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10508 |
if (cl = s.font_size_classes) |
543 | 10509 |
cl = explode(cl); |
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:
117
diff
changeset
|
10510 |
|
778 | 10511 |
function process(no) { |
543 | 10512 |
var n, sp, nl, x; |
10513 |
||
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
10514 |
// Keep unit tests happy |
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:
117
diff
changeset
|
10515 |
if (!s.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:
117
diff
changeset
|
10516 |
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:
117
diff
changeset
|
10517 |
|
778 | 10518 |
nl = t.dom.select('font', no); |
10519 |
for (x = nl.length - 1; x >= 0; x--) { |
|
10520 |
n = nl[x]; |
|
10521 |
||
10522 |
sp = dom.create('span', { |
|
10523 |
style : dom.getAttrib(n, 'style'), |
|
10524 |
'class' : dom.getAttrib(n, 'class') |
|
10525 |
}); |
|
10526 |
||
10527 |
dom.setStyles(sp, { |
|
10528 |
fontFamily : dom.getAttrib(n, 'face'), |
|
10529 |
color : dom.getAttrib(n, 'color'), |
|
10530 |
backgroundColor : n.style.backgroundColor |
|
10531 |
}); |
|
10532 |
||
10533 |
if (n.size) { |
|
10534 |
if (sl) |
|
10535 |
dom.setStyle(sp, 'fontSize', sl[parseInt(n.size) - 1]); |
|
10536 |
else |
|
10537 |
dom.setAttrib(sp, 'class', cl[parseInt(n.size) - 1]); |
|
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
10538 |
} |
778 | 10539 |
|
10540 |
dom.setAttrib(sp, 'mce_style', ''); |
|
10541 |
dom.replace(sp, n, 1); |
|
10542 |
} |
|
10543 |
}; |
|
10544 |
||
10545 |
// Run on cleanup |
|
10546 |
t.onPreProcess.add(function(ed, o) { |
|
10547 |
if (o.get) |
|
10548 |
process(o.node); |
|
10549 |
}); |
|
10550 |
||
10551 |
t.onSetContent.add(function(ed, o) { |
|
10552 |
if (o.initial) |
|
10553 |
process(o.node); |
|
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:
117
diff
changeset
|
10554 |
}); |
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
|
10555 |
}, |
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
|
10556 |
|
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
|
10557 |
_isHidden : function() { |
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
|
10558 |
var s; |
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
|
10559 |
|
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
|
10560 |
if (!isGecko) |
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
|
10561 |
return 0; |
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
|
10562 |
|
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
|
10563 |
// Weird, wheres that cursor selection? |
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
|
10564 |
s = this.selection.getSel(); |
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
|
10565 |
return (!s || !s.rangeCount || s.rangeCount == 0); |
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
|
10566 |
}, |
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
|
10567 |
|
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
10568 |
// Fix for bug #1867292 |
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
|
10569 |
_fixNesting : function(s) { |
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
|
10570 |
var d = [], i; |
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
|
10571 |
|
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
|
10572 |
s = s.replace(/<(\/)?([^\s>]+)[^>]*?>/g, function(a, b, c) { |
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
|
10573 |
var e; |
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
|
10574 |
|
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
|
10575 |
// Handle end 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
|
10576 |
if (b === '/') { |
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
|
10577 |
if (!d.length) |
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
|
10578 |
return ''; |
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
|
10579 |
|
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
|
10580 |
if (c !== d[d.length - 1].tag) { |
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
|
10581 |
for (i=d.length - 1; i>=0; i--) { |
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
|
10582 |
if (d[i].tag === c) { |
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
|
10583 |
d[i].close = 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
|
10584 |
break; |
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
|
10585 |
} |
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
|
10586 |
} |
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
|
10587 |
|
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
|
10588 |
return ''; |
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
|
10589 |
} else { |
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
|
10590 |
d.pop(); |
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
|
10591 |
|
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
|
10592 |
if (d.length && d[d.length - 1].close) { |
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
|
10593 |
a = a + '</' + d[d.length - 1].tag + '>'; |
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
|
10594 |
d.pop(); |
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
|
10595 |
} |
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
|
10596 |
} |
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
|
10597 |
} else { |
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
|
10598 |
// Ignore these |
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
|
10599 |
if (/^(br|hr|input|meta|img|link|param)$/i.test(c)) |
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
|
10600 |
return a; |
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
|
10601 |
|
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
|
10602 |
// Ignore closed ones |
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
|
10603 |
if (/\/>$/.test(a)) |
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
|
10604 |
return a; |
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
|
10605 |
|
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
|
10606 |
d.push({tag : c}); // Push start 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
|
10607 |
} |
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
|
10608 |
|
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
|
10609 |
return a; |
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
|
10610 |
}); |
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
|
10611 |
|
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
|
10612 |
// End all open tags |
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
|
10613 |
for (i=d.length - 1; i>=0; i--) |
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
|
10614 |
s += '</' + d[i].tag + '>'; |
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
|
10615 |
|
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
|
10616 |
return s; |
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:
117
diff
changeset
|
10617 |
} |
1193 | 10618 |
}); |
10619 |
})(tinymce); |
|
10620 |
(function(tinymce) { |
|
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:
117
diff
changeset
|
10621 |
var each = tinymce.each, isIE = tinymce.isIE, isGecko = tinymce.isGecko, isOpera = tinymce.isOpera, isWebKit = 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:
117
diff
changeset
|
10622 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10623 |
tinymce.create('tinymce.EditorCommands', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10624 |
EditorCommands : 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:
117
diff
changeset
|
10625 |
this.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:
117
diff
changeset
|
10626 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10627 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10628 |
execCommand : function(cmd, ui, val) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10629 |
var t = this, ed = t.editor, f; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10630 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10631 |
switch (cmd) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10632 |
// Ignore these |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10633 |
case 'mceResetDesignMode': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10634 |
case 'mceBeginUndoLevel': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10635 |
return 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:
117
diff
changeset
|
10636 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10637 |
// Ignore these |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10638 |
case 'unlink': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10639 |
t.UnLink(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10640 |
return 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:
117
diff
changeset
|
10641 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10642 |
// Bundle these together |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10643 |
case 'JustifyLeft': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10644 |
case 'JustifyCenter': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10645 |
case 'JustifyRight': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10646 |
case 'JustifyFull': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10647 |
t.mceJustify(cmd, cmd.substring(7).toLowerCase()); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10648 |
return 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:
117
diff
changeset
|
10649 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10650 |
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:
117
diff
changeset
|
10651 |
f = this[cmd]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10652 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10653 |
if (f) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10654 |
f.call(this, ui, val); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10655 |
return 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:
117
diff
changeset
|
10656 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10657 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10658 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10659 |
return 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:
117
diff
changeset
|
10660 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10661 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10662 |
Indent : function() { |
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
|
10663 |
var ed = this.editor, d = ed.dom, s = ed.selection, e, iv, iu; |
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
|
10664 |
|
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
|
10665 |
// Setup indent level |
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
|
10666 |
iv = ed.settings.indentation; |
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
|
10667 |
iu = /[a-z%]+$/i.exec(iv); |
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
|
10668 |
iv = parseInt(iv); |
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:
117
diff
changeset
|
10669 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10670 |
if (ed.settings.inline_styles && (!this.queryStateInsertUnorderedList() && !this.queryStateInsertOrderedList())) { |
1193 | 10671 |
each(s.getSelectedBlocks(), function(e) { |
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
|
10672 |
d.setStyle(e, 'paddingLeft', (parseInt(e.style.paddingLeft || 0) + iv) + iu); |
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:
117
diff
changeset
|
10673 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10674 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10675 |
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:
117
diff
changeset
|
10676 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10677 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10678 |
ed.getDoc().execCommand('Indent', false, 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:
117
diff
changeset
|
10679 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10680 |
if (isIE) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10681 |
d.getParent(s.getNode(), 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:
117
diff
changeset
|
10682 |
if (n.nodeName == 'BLOCKQUOTE') { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10683 |
n.dir = n.style.cssText = ''; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10684 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10685 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10686 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10687 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10688 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10689 |
Outdent : function() { |
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
|
10690 |
var ed = this.editor, d = ed.dom, s = ed.selection, e, v, iv, iu; |
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
|
10691 |
|
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
|
10692 |
// Setup indent level |
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
|
10693 |
iv = ed.settings.indentation; |
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
|
10694 |
iu = /[a-z%]+$/i.exec(iv); |
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
|
10695 |
iv = parseInt(iv); |
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:
117
diff
changeset
|
10696 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10697 |
if (ed.settings.inline_styles && (!this.queryStateInsertUnorderedList() && !this.queryStateInsertOrderedList())) { |
1193 | 10698 |
each(s.getSelectedBlocks(), function(e) { |
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
|
10699 |
v = Math.max(0, parseInt(e.style.paddingLeft || 0) - iv); |
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
|
10700 |
d.setStyle(e, 'paddingLeft', v ? v + iu : ''); |
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:
117
diff
changeset
|
10701 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10702 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10703 |
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:
117
diff
changeset
|
10704 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10705 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10706 |
ed.getDoc().execCommand('Outdent', false, 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:
117
diff
changeset
|
10707 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10708 |
|
1193 | 10709 |
/* |
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:
117
diff
changeset
|
10710 |
mceSetAttribute : 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:
117
diff
changeset
|
10711 |
var ed = this.editor, d = ed.dom, 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:
117
diff
changeset
|
10712 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10713 |
if (e = d.getParent(ed.selection.getNode(), d.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:
117
diff
changeset
|
10714 |
d.setAttrib(e, v.name, v.value); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10715 |
}, |
1193 | 10716 |
*/ |
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:
117
diff
changeset
|
10717 |
mceSetContent : 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:
117
diff
changeset
|
10718 |
this.editor.setContent(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:
117
diff
changeset
|
10719 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10720 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10721 |
mceToggleVisualAid : 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:
117
diff
changeset
|
10722 |
var ed = this.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:
117
diff
changeset
|
10723 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10724 |
ed.hasVisual = !ed.hasVisual; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10725 |
ed.addVisual(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10726 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10727 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10728 |
mceReplaceContent : 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:
117
diff
changeset
|
10729 |
var s = this.editor.selection; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10730 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10731 |
s.setContent(v.replace(/\{\$selection\}/g, s.getContent({format : 'text'}))); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10732 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10733 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10734 |
mceInsertLink : function(u, v) { |
1193 | 10735 |
var ed = this.editor, s = ed.selection, e = ed.dom.getParent(s.getNode(), 'a'); |
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:
117
diff
changeset
|
10736 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10737 |
if (tinymce.is(v, 'string')) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10738 |
v = {href : 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:
117
diff
changeset
|
10739 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10740 |
function set(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:
117
diff
changeset
|
10741 |
each(v, function(v, k) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10742 |
ed.dom.setAttrib(e, k, 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:
117
diff
changeset
|
10743 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10744 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10745 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10746 |
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:
117
diff
changeset
|
10747 |
ed.execCommand('CreateLink', false, 'javascript:mctmp(0);'); |
1193 | 10748 |
each(ed.dom.select('a[href=javascript:mctmp(0);]'), function(e) { |
10749 |
set(e); |
|
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:
117
diff
changeset
|
10750 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10751 |
} 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:
117
diff
changeset
|
10752 |
if (v.href) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10753 |
set(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:
117
diff
changeset
|
10754 |
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:
117
diff
changeset
|
10755 |
ed.dom.remove(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:
117
diff
changeset
|
10756 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10757 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10758 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10759 |
UnLink : 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:
117
diff
changeset
|
10760 |
var ed = this.editor, s = ed.selection; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10761 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10762 |
if (s.isCollapsed()) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10763 |
s.select(s.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:
117
diff
changeset
|
10764 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10765 |
ed.getDoc().execCommand('unlink', false, 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:
117
diff
changeset
|
10766 |
s.collapse(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:
117
diff
changeset
|
10767 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10768 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10769 |
FontName : 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:
117
diff
changeset
|
10770 |
var t = this, ed = t.editor, s = ed.selection, 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:
117
diff
changeset
|
10771 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10772 |
if (!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:
117
diff
changeset
|
10773 |
if (s.isCollapsed()) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10774 |
s.select(s.getNode()); |
778 | 10775 |
} else { |
10776 |
if (ed.settings.convert_fonts_to_spans) |
|
10777 |
t._applyInlineStyle('span', {style : {fontFamily : v}}); |
|
10778 |
else |
|
10779 |
ed.getDoc().execCommand('FontName', false, v); |
|
10780 |
} |
|
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:
117
diff
changeset
|
10781 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10782 |
|
543 | 10783 |
FontSize : function(u, v) { |
778 | 10784 |
var ed = this.editor, s = ed.settings, fc, fs; |
10785 |
||
10786 |
// Use style options instead |
|
10787 |
if (s.convert_fonts_to_spans && v >= 1 && v <= 7) { |
|
10788 |
fs = tinymce.explode(s.font_size_style_values); |
|
10789 |
fc = tinymce.explode(s.font_size_classes); |
|
10790 |
||
10791 |
if (fc) |
|
10792 |
v = fc[v - 1] || v; |
|
10793 |
else |
|
10794 |
v = fs[v - 1] || v; |
|
10795 |
} |
|
10796 |
||
10797 |
if (v >= 1 && v <= 7) |
|
10798 |
ed.getDoc().execCommand('FontSize', false, v); |
|
10799 |
else |
|
10800 |
this._applyInlineStyle('span', {style : {fontSize : v}}); |
|
543 | 10801 |
}, |
10802 |
||
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:
117
diff
changeset
|
10803 |
queryCommandValue : function(c) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10804 |
var f = this['queryValue' + c]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10805 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10806 |
if (f) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10807 |
return f.call(this, c); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10808 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10809 |
return 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:
117
diff
changeset
|
10810 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10811 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10812 |
queryCommandState : function(cmd) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10813 |
var f; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10814 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10815 |
switch (cmd) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10816 |
// Bundle these together |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10817 |
case 'JustifyLeft': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10818 |
case 'JustifyCenter': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10819 |
case 'JustifyRight': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10820 |
case 'JustifyFull': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10821 |
return this.queryStateJustify(cmd, cmd.substring(7).toLowerCase()); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10822 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10823 |
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:
117
diff
changeset
|
10824 |
if (f = this['queryState' + cmd]) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10825 |
return f.call(this, cmd); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10826 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10827 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10828 |
return -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:
117
diff
changeset
|
10829 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10830 |
|
543 | 10831 |
_queryState : function(c) { |
10832 |
try { |
|
10833 |
return this.editor.getDoc().queryCommandState(c); |
|
10834 |
} catch (ex) { |
|
10835 |
// Ignore exception |
|
10836 |
} |
|
10837 |
}, |
|
10838 |
||
10839 |
_queryVal : function(c) { |
|
10840 |
try { |
|
10841 |
return this.editor.getDoc().queryCommandValue(c); |
|
10842 |
} catch (ex) { |
|
10843 |
// Ignore exception |
|
10844 |
} |
|
10845 |
}, |
|
10846 |
||
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:
117
diff
changeset
|
10847 |
queryValueFontSize : 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:
117
diff
changeset
|
10848 |
var ed = this.editor, v = 0, 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:
117
diff
changeset
|
10849 |
|
1193 | 10850 |
if (p = ed.dom.getParent(ed.selection.getNode(), 'span')) |
778 | 10851 |
v = p.style.fontSize; |
10852 |
||
10853 |
if (!v && (isOpera || isWebKit)) { |
|
1193 | 10854 |
if (p = ed.dom.getParent(ed.selection.getNode(), 'font')) |
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:
117
diff
changeset
|
10855 |
v = p.size; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10856 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10857 |
return 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:
117
diff
changeset
|
10858 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10859 |
|
778 | 10860 |
return v || this._queryVal('FontSize'); |
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:
117
diff
changeset
|
10861 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10862 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10863 |
queryValueFontName : 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:
117
diff
changeset
|
10864 |
var ed = this.editor, v = 0, 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:
117
diff
changeset
|
10865 |
|
1193 | 10866 |
if (p = ed.dom.getParent(ed.selection.getNode(), 'font')) |
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:
117
diff
changeset
|
10867 |
v = p.face; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10868 |
|
1193 | 10869 |
if (p = ed.dom.getParent(ed.selection.getNode(), 'span')) |
778 | 10870 |
v = p.style.fontFamily.replace(/, /g, ',').replace(/[\'\"]/g, '').toLowerCase(); |
10871 |
||
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:
117
diff
changeset
|
10872 |
if (!v) |
543 | 10873 |
v = this._queryVal('FontName'); |
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:
117
diff
changeset
|
10874 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10875 |
return 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:
117
diff
changeset
|
10876 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10877 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10878 |
mceJustify : function(c, 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:
117
diff
changeset
|
10879 |
var ed = this.editor, se = ed.selection, n = se.getNode(), nn = n.nodeName, bl, nb, dom = ed.dom, rm; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10880 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10881 |
if (ed.settings.inline_styles && this.queryStateJustify(c, 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:
117
diff
changeset
|
10882 |
rm = 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:
117
diff
changeset
|
10883 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10884 |
bl = dom.getParent(n, ed.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:
117
diff
changeset
|
10885 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10886 |
if (nn == '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:
117
diff
changeset
|
10887 |
if (v == 'full') |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10888 |
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:
117
diff
changeset
|
10889 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10890 |
if (rm) { |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
10891 |
if (v == 'center') |
778 | 10892 |
dom.setStyle(bl || n.parentNode, 'textAlign', ''); |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
10893 |
|
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:
117
diff
changeset
|
10894 |
dom.setStyle(n, 'float', ''); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10895 |
this.mceRepaint(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10896 |
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:
117
diff
changeset
|
10897 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10898 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10899 |
if (v == 'center') { |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
10900 |
// Do not change table elements |
778 | 10901 |
if (bl && /^(TD|TH)$/.test(bl.nodeName)) |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
10902 |
bl = 0; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
10903 |
|
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:
117
diff
changeset
|
10904 |
if (!bl || bl.childNodes.length > 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:
117
diff
changeset
|
10905 |
nb = dom.create('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:
117
diff
changeset
|
10906 |
nb.appendChild(n.cloneNode(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:
117
diff
changeset
|
10907 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10908 |
if (bl) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10909 |
dom.insertAfter(nb, bl); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10910 |
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:
117
diff
changeset
|
10911 |
dom.insertAfter(nb, 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:
117
diff
changeset
|
10912 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10913 |
dom.remove(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:
117
diff
changeset
|
10914 |
n = nb.firstChild; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10915 |
bl = nb; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10916 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10917 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10918 |
dom.setStyle(bl, 'textAlign', 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:
117
diff
changeset
|
10919 |
dom.setStyle(n, 'float', ''); |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
10920 |
} else { |
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:
117
diff
changeset
|
10921 |
dom.setStyle(n, 'float', v); |
778 | 10922 |
dom.setStyle(bl || n.parentNode, 'textAlign', ''); |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
10923 |
} |
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:
117
diff
changeset
|
10924 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10925 |
this.mceRepaint(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10926 |
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:
117
diff
changeset
|
10927 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10928 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10929 |
// Handle the alignment outselfs, less quirks in all browsers |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10930 |
if (ed.settings.inline_styles && ed.settings.forced_root_block) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10931 |
if (rm) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10932 |
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:
117
diff
changeset
|
10933 |
|
1193 | 10934 |
each(se.getSelectedBlocks(dom.getParent(se.getStart(), dom.isBlock), dom.getParent(se.getEnd(), dom.isBlock)), function(e) { |
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:
117
diff
changeset
|
10935 |
dom.setAttrib(e, 'align', ''); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10936 |
dom.setStyle(e, 'textAlign', v == 'full' ? 'justify' : 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:
117
diff
changeset
|
10937 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10938 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10939 |
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:
117
diff
changeset
|
10940 |
} else if (!rm) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10941 |
ed.getDoc().execCommand(c, false, 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:
117
diff
changeset
|
10942 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10943 |
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:
117
diff
changeset
|
10944 |
if (rm) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10945 |
dom.getParent(ed.selection.getNode(), 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:
117
diff
changeset
|
10946 |
if (n.style && n.style.textAlign) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10947 |
dom.setStyle(n, 'textAlign', ''); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10948 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10949 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10950 |
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:
117
diff
changeset
|
10951 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10952 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10953 |
each(dom.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:
117
diff
changeset
|
10954 |
var v = n.align; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10955 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10956 |
if (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:
117
diff
changeset
|
10957 |
if (v == 'full') |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10958 |
v = 'justify'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10959 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10960 |
dom.setStyle(n, 'textAlign', 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:
117
diff
changeset
|
10961 |
dom.setAttrib(n, 'align', ''); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10962 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10963 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10964 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10965 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10966 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10967 |
mceSetCSSClass : 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:
117
diff
changeset
|
10968 |
this.mceSetStyleInfo(0, {command : 'setattrib', name : 'class', value : 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:
117
diff
changeset
|
10969 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10970 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10971 |
getSelectedElement : 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:
117
diff
changeset
|
10972 |
var t = this, ed = t.editor, dom = ed.dom, se = ed.selection, r = se.getRng(), r1, r2, sc, ec, so, eo, e, sp, ep, re; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10973 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10974 |
if (se.isCollapsed() || r.item) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10975 |
return se.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:
117
diff
changeset
|
10976 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10977 |
// Setup regexp |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10978 |
re = ed.settings.merge_styles_invalid_parents; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10979 |
if (tinymce.is(re, 'string')) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10980 |
re = new RegExp(re, 'i'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10981 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10982 |
if (isIE) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10983 |
r1 = r.duplicate(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10984 |
r1.collapse(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:
117
diff
changeset
|
10985 |
sc = r1.parentElement(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10986 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10987 |
r2 = r.duplicate(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10988 |
r2.collapse(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:
117
diff
changeset
|
10989 |
ec = r2.parentElement(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10990 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10991 |
if (sc != ec) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10992 |
r1.move('character', 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:
117
diff
changeset
|
10993 |
sc = r1.parentElement(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10994 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10995 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10996 |
if (sc == ec) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10997 |
r1 = r.duplicate(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10998 |
r1.moveToElementText(sc); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
10999 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11000 |
if (r1.compareEndPoints('StartToStart', r) == 0 && r1.compareEndPoints('EndToEnd', r) == 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:
117
diff
changeset
|
11001 |
return re && re.test(sc.nodeName) ? null : sc; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11002 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11003 |
} 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:
117
diff
changeset
|
11004 |
function getParent(n) { |
1193 | 11005 |
return dom.getParent(n, '*'); |
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:
117
diff
changeset
|
11006 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11007 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11008 |
sc = r.startContainer; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11009 |
ec = r.endContainer; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11010 |
so = r.startOffset; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11011 |
eo = r.endOffset; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11012 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11013 |
if (!r.collapsed) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11014 |
if (sc == ec) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11015 |
if (so - eo < 2) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11016 |
if (sc.hasChildNodes()) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11017 |
sp = sc.childNodes[so]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11018 |
return re && re.test(sp.nodeName) ? null : sp; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11019 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11020 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11021 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11022 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11023 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11024 |
if (sc.nodeType != 3 || ec.nodeType != 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:
117
diff
changeset
|
11025 |
return 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:
117
diff
changeset
|
11026 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11027 |
if (so == 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:
117
diff
changeset
|
11028 |
sp = getParent(sc); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11029 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11030 |
if (sp && sp.firstChild != sc) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11031 |
sp = 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:
117
diff
changeset
|
11032 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11033 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11034 |
if (so == sc.nodeValue.length) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11035 |
e = sc.nextSibling; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11036 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11037 |
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:
117
diff
changeset
|
11038 |
sp = sc.nextSibling; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11039 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11040 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11041 |
if (eo == 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:
117
diff
changeset
|
11042 |
e = ec.previousSibling; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11043 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11044 |
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:
117
diff
changeset
|
11045 |
ep = 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:
117
diff
changeset
|
11046 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11047 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11048 |
if (eo == ec.nodeValue.length) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11049 |
ep = getParent(ec); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11050 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11051 |
if (ep && ep.lastChild != ec) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11052 |
ep = 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:
117
diff
changeset
|
11053 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11054 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11055 |
// Same element |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11056 |
if (sp == ep) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11057 |
return re && sp && re.test(sp.nodeName) ? null : sp; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11058 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11059 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11060 |
return 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:
117
diff
changeset
|
11061 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11062 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11063 |
mceSetStyleInfo : 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:
117
diff
changeset
|
11064 |
var t = this, ed = t.editor, d = ed.getDoc(), dom = ed.dom, e, b, s = ed.selection, nn = v.wrapper || 'span', b = s.getBookmark(), re; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11065 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11066 |
function set(n, 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:
117
diff
changeset
|
11067 |
if (n.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:
117
diff
changeset
|
11068 |
switch (v.command) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11069 |
case 'setattrib': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11070 |
return dom.setAttrib(n, v.name, v.value); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11071 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11072 |
case 'setstyle': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11073 |
return dom.setStyle(n, v.name, v.value); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11074 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11075 |
case 'removeformat': |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11076 |
return dom.setAttrib(n, 'class', ''); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11077 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11078 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11079 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11080 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11081 |
// Setup regexp |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11082 |
re = ed.settings.merge_styles_invalid_parents; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11083 |
if (tinymce.is(re, 'string')) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11084 |
re = new RegExp(re, 'i'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11085 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11086 |
// Set style info on selected element |
778 | 11087 |
if ((e = t.getSelectedElement()) && !ed.settings.force_span_wrappers) |
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:
117
diff
changeset
|
11088 |
set(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:
117
diff
changeset
|
11089 |
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:
117
diff
changeset
|
11090 |
// Generate wrappers and set styles on them |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11091 |
d.execCommand('FontName', false, '__'); |
1193 | 11092 |
each(dom.select('span,font'), function(n) { |
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:
117
diff
changeset
|
11093 |
var sp, 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:
117
diff
changeset
|
11094 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11095 |
if (dom.getAttrib(n, 'face') == '__' || n.style.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:
117
diff
changeset
|
11096 |
sp = dom.create(nn, {mce_new : '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:
117
diff
changeset
|
11097 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11098 |
set(sp); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11099 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11100 |
each (n.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:
117
diff
changeset
|
11101 |
sp.appendChild(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:
117
diff
changeset
|
11102 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11103 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11104 |
dom.replace(sp, 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:
117
diff
changeset
|
11105 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11106 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11107 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11108 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11109 |
// Remove wrappers inside new ones |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11110 |
each(dom.select(nn).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:
117
diff
changeset
|
11111 |
var p = n.parentNode; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11112 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11113 |
// Check if it's an old span in a new wrapper |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11114 |
if (!dom.getAttrib(n, 'mce_new')) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11115 |
// Find new wrapper |
1193 | 11116 |
p = dom.getParent(n, '*[mce_new]'); |
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:
117
diff
changeset
|
11117 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11118 |
if (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:
117
diff
changeset
|
11119 |
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:
117
diff
changeset
|
11120 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11121 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11122 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11123 |
// Merge wrappers with parent wrappers |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11124 |
each(dom.select(nn).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:
117
diff
changeset
|
11125 |
var p = n.parentNode; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11126 |
|
543 | 11127 |
if (!p || !dom.getAttrib(n, 'mce_new')) |
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:
117
diff
changeset
|
11128 |
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:
117
diff
changeset
|
11129 |
|
778 | 11130 |
if (ed.settings.force_span_wrappers && p.nodeName != 'SPAN') |
11131 |
return; |
|
11132 |
||
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:
117
diff
changeset
|
11133 |
// Has parent of the same type and only child |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11134 |
if (p.nodeName == nn.toUpperCase() && p.childNodes.length == 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:
117
diff
changeset
|
11135 |
return dom.remove(p, 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:
117
diff
changeset
|
11136 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11137 |
// Has parent that is more suitable to have the class and only child |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11138 |
if (n.nodeType == 1 && (!re || !re.test(p.nodeName)) && p.childNodes.length == 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:
117
diff
changeset
|
11139 |
set(p); // Set style info on parent instead |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11140 |
dom.setAttrib(n, 'class', ''); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11141 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11142 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11143 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11144 |
// Remove empty wrappers |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11145 |
each(dom.select(nn).reverse(), function(n) { |
543 | 11146 |
if (dom.getAttrib(n, 'mce_new') || (dom.getAttribs(n).length <= 1 && n.className === '')) { |
11147 |
if (!dom.getAttrib(n, 'class') && !dom.getAttrib(n, 'style')) |
|
11148 |
return dom.remove(n, 1); |
|
11149 |
||
11150 |
dom.setAttrib(n, 'mce_new', ''); // Remove mce_new marker |
|
11151 |
} |
|
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:
117
diff
changeset
|
11152 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11153 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11154 |
s.moveToBookmark(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:
117
diff
changeset
|
11155 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11156 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11157 |
queryStateJustify : function(c, 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:
117
diff
changeset
|
11158 |
var ed = this.editor, n = ed.selection.getNode(), 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:
117
diff
changeset
|
11159 |
|
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11160 |
if (n && n.nodeName == 'IMG') { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11161 |
if (dom.getStyle(n, 'float') == v) |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11162 |
return 1; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11163 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11164 |
return n.parentNode.style.textAlign == v; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11165 |
} |
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:
117
diff
changeset
|
11166 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11167 |
n = dom.getParent(ed.selection.getStart(), 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:
117
diff
changeset
|
11168 |
return n.nodeType == 1 && n.style.textAlign; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11169 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11170 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11171 |
if (v == 'full') |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11172 |
v = 'justify'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11173 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11174 |
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:
117
diff
changeset
|
11175 |
return (n && n.style.textAlign == 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:
117
diff
changeset
|
11176 |
|
543 | 11177 |
return this._queryState(c); |
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:
117
diff
changeset
|
11178 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11179 |
|
778 | 11180 |
ForeColor : function(ui, v) { |
11181 |
var ed = this.editor; |
|
11182 |
||
11183 |
if (ed.settings.convert_fonts_to_spans) { |
|
11184 |
this._applyInlineStyle('span', {style : {color : v}}); |
|
11185 |
return; |
|
11186 |
} else |
|
11187 |
ed.getDoc().execCommand('ForeColor', false, v); |
|
11188 |
}, |
|
11189 |
||
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:
117
diff
changeset
|
11190 |
HiliteColor : function(ui, val) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11191 |
var t = this, ed = t.editor, d = ed.getDoc(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11192 |
|
778 | 11193 |
if (ed.settings.convert_fonts_to_spans) { |
11194 |
this._applyInlineStyle('span', {style : {backgroundColor : val}}); |
|
11195 |
return; |
|
11196 |
} |
|
11197 |
||
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:
117
diff
changeset
|
11198 |
function set(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:
117
diff
changeset
|
11199 |
if (!isGecko) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11200 |
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:
117
diff
changeset
|
11201 |
|
1 | 11202 |
try { |
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:
117
diff
changeset
|
11203 |
// Try new Gecko method |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11204 |
d.execCommand("styleWithCSS", 0, 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:
117
diff
changeset
|
11205 |
} 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:
117
diff
changeset
|
11206 |
// Use old |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11207 |
d.execCommand("useCSS", 0, !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:
117
diff
changeset
|
11208 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11209 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11210 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11211 |
if (isGecko || isOpera) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11212 |
set(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:
117
diff
changeset
|
11213 |
d.execCommand('hilitecolor', false, val); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11214 |
set(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:
117
diff
changeset
|
11215 |
} 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:
117
diff
changeset
|
11216 |
d.execCommand('BackColor', false, val); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11217 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11218 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11219 |
FormatBlock : function(ui, val) { |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11220 |
var t = this, ed = t.editor, s = ed.selection, dom = ed.dom, bl, nb, b; |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11221 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11222 |
function isBlock(n) { |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11223 |
return /^(P|DIV|H[1-6]|ADDRESS|BLOCKQUOTE|PRE)$/.test(n.nodeName); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11224 |
}; |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11225 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11226 |
bl = dom.getParent(s.getNode(), function(n) { |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11227 |
return isBlock(n); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11228 |
}); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11229 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11230 |
// IE has an issue where it removes the parent div if you change format on the paragrah in <div><p>Content</p></div> |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11231 |
// FF and Opera doesn't change parent DIV elements if you switch format |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11232 |
if (bl) { |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11233 |
if ((isIE && isBlock(bl.parentNode)) || bl.nodeName == 'DIV') { |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11234 |
// Rename block element |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11235 |
nb = ed.dom.create(val); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11236 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11237 |
each(dom.getAttribs(bl), function(v) { |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11238 |
dom.setAttrib(nb, v.nodeName, dom.getAttrib(bl, v.nodeName)); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11239 |
}); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11240 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11241 |
b = s.getBookmark(); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11242 |
dom.replace(nb, bl, 1); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11243 |
s.moveToBookmark(b); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11244 |
ed.nodeChanged(); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11245 |
return; |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11246 |
} |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11247 |
} |
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:
117
diff
changeset
|
11248 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11249 |
val = ed.settings.forced_root_block ? (val || '<p>') : val; |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11250 |
|
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:
117
diff
changeset
|
11251 |
if (val.indexOf('<') == -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:
117
diff
changeset
|
11252 |
val = '<' + val + '>'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11253 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11254 |
if (tinymce.isGecko) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11255 |
val = val.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi, '$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:
117
diff
changeset
|
11256 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11257 |
ed.getDoc().execCommand('FormatBlock', false, val); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11258 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11259 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11260 |
mceCleanup : 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:
117
diff
changeset
|
11261 |
var ed = this.editor, s = ed.selection, b = s.getBookmark(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11262 |
ed.setContent(ed.getContent()); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11263 |
s.moveToBookmark(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:
117
diff
changeset
|
11264 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11265 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11266 |
mceRemoveNode : function(ui, val) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11267 |
var ed = this.editor, s = ed.selection, b, n = val || s.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:
117
diff
changeset
|
11268 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11269 |
// Make sure that the body node isn't removed |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11270 |
if (n == ed.getBody()) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11271 |
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:
117
diff
changeset
|
11272 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11273 |
b = s.getBookmark(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11274 |
ed.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:
117
diff
changeset
|
11275 |
s.moveToBookmark(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:
117
diff
changeset
|
11276 |
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:
117
diff
changeset
|
11277 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11278 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11279 |
mceSelectNodeDepth : function(ui, val) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11280 |
var ed = this.editor, s = ed.selection, c = 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:
117
diff
changeset
|
11281 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11282 |
ed.dom.getParent(s.getNode(), 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:
117
diff
changeset
|
11283 |
if (n.nodeType == 1 && c++ == val) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11284 |
s.select(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:
117
diff
changeset
|
11285 |
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:
117
diff
changeset
|
11286 |
return 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:
117
diff
changeset
|
11287 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11288 |
}, ed.getBody()); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11289 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11290 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11291 |
mceSelectNode : 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:
117
diff
changeset
|
11292 |
this.editor.selection.select(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:
117
diff
changeset
|
11293 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11294 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11295 |
mceInsertContent : function(ui, val) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11296 |
this.editor.selection.setContent(val); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11297 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11298 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11299 |
mceInsertRawHTML : function(ui, val) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11300 |
var ed = this.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:
117
diff
changeset
|
11301 |
|
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11302 |
ed.selection.setContent('tiny_mce_marker'); |
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:
117
diff
changeset
|
11303 |
ed.setContent(ed.getContent().replace(/tiny_mce_marker/g, val)); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11304 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11305 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11306 |
mceRepaint : 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:
117
diff
changeset
|
11307 |
var s, b, e = this.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:
117
diff
changeset
|
11308 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11309 |
if (tinymce.isGecko) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11310 |
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:
117
diff
changeset
|
11311 |
s = e.selection; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11312 |
b = s.getBookmark(true); |
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
|
11313 |
|
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
|
11314 |
if (s.getSel()) |
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
|
11315 |
s.getSel().selectAllChildren(e.getBody()); |
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
|
11316 |
|
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:
117
diff
changeset
|
11317 |
s.collapse(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:
117
diff
changeset
|
11318 |
s.moveToBookmark(b); |
1 | 11319 |
} catch (ex) { |
11320 |
// Ignore |
|
11321 |
} |
|
11322 |
} |
|
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:
117
diff
changeset
|
11323 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11324 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11325 |
queryStateUnderline : function() { |
543 | 11326 |
var ed = this.editor, n = ed.selection.getNode(); |
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:
117
diff
changeset
|
11327 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11328 |
if (n && n.nodeName == '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:
117
diff
changeset
|
11329 |
return 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:
117
diff
changeset
|
11330 |
|
543 | 11331 |
return this._queryState('Underline'); |
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:
117
diff
changeset
|
11332 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11333 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11334 |
queryStateOutdent : 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:
117
diff
changeset
|
11335 |
var ed = this.editor, 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:
117
diff
changeset
|
11336 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11337 |
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:
117
diff
changeset
|
11338 |
if ((n = ed.dom.getParent(ed.selection.getStart(), ed.dom.isBlock)) && parseInt(n.style.paddingLeft) > 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:
117
diff
changeset
|
11339 |
return 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:
117
diff
changeset
|
11340 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11341 |
if ((n = ed.dom.getParent(ed.selection.getEnd(), ed.dom.isBlock)) && parseInt(n.style.paddingLeft) > 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:
117
diff
changeset
|
11342 |
return true; |
778 | 11343 |
} |
11344 |
||
11345 |
return this.queryStateInsertUnorderedList() || this.queryStateInsertOrderedList() || (!ed.settings.inline_styles && !!ed.dom.getParent(ed.selection.getNode(), 'BLOCKQUOTE')); |
|
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:
117
diff
changeset
|
11346 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11347 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11348 |
queryStateInsertUnorderedList : 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:
117
diff
changeset
|
11349 |
return this.editor.dom.getParent(this.editor.selection.getNode(), 'UL'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11350 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11351 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11352 |
queryStateInsertOrderedList : 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:
117
diff
changeset
|
11353 |
return this.editor.dom.getParent(this.editor.selection.getNode(), 'OL'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11354 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11355 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11356 |
queryStatemceBlockQuote : 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:
117
diff
changeset
|
11357 |
return !!this.editor.dom.getParent(this.editor.selection.getStart(), function(n) {return n.nodeName === 'BLOCKQUOTE';}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11358 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11359 |
|
778 | 11360 |
_applyInlineStyle : function(na, at, op) { |
1193 | 11361 |
var t = this, ed = t.editor, dom = ed.dom, bm, lo = {}, kh, found; |
778 | 11362 |
|
11363 |
na = na.toUpperCase(); |
|
11364 |
||
11365 |
if (op && op.check_classes && at['class']) |
|
11366 |
op.check_classes.push(at['class']); |
|
11367 |
||
1193 | 11368 |
function removeEmpty() { |
778 | 11369 |
each(dom.select(na).reverse(), function(n) { |
11370 |
var c = 0; |
|
11371 |
||
11372 |
// Check if there is any attributes |
|
11373 |
each(dom.getAttribs(n), function(an) { |
|
11374 |
if (an.nodeName.substring(0, 1) != '_' && dom.getAttrib(n, an.nodeName) != '') { |
|
11375 |
//console.log(dom.getOuterHTML(n), dom.getAttrib(n, an.nodeName)); |
|
11376 |
c++; |
|
11377 |
} |
|
11378 |
}); |
|
11379 |
||
11380 |
// No attributes then remove the element and keep the children |
|
11381 |
if (c == 0) |
|
11382 |
dom.remove(n, 1); |
|
11383 |
}); |
|
1193 | 11384 |
}; |
11385 |
||
11386 |
function replaceFonts() { |
|
11387 |
var bm; |
|
11388 |
||
11389 |
each(dom.select('span,font'), function(n) { |
|
11390 |
if (n.style.fontFamily == 'mceinline' || n.face == 'mceinline') { |
|
11391 |
if (!bm) |
|
11392 |
bm = ed.selection.getBookmark(); |
|
11393 |
||
11394 |
at._mce_new = '1'; |
|
11395 |
dom.replace(dom.create(na, at), n, 1); |
|
11396 |
} |
|
11397 |
}); |
|
11398 |
||
11399 |
// Remove redundant elements |
|
11400 |
each(dom.select(na + '[_mce_new]'), function(n) { |
|
11401 |
function removeStyle(n) { |
|
11402 |
if (n.nodeType == 1) { |
|
11403 |
each(at.style, function(v, k) { |
|
11404 |
dom.setStyle(n, k, ''); |
|
11405 |
}); |
|
11406 |
||
11407 |
// Remove spans with the same class or marked classes |
|
11408 |
if (at['class'] && n.className && op) { |
|
11409 |
each(op.check_classes, function(c) { |
|
11410 |
if (dom.hasClass(n, c)) |
|
11411 |
dom.removeClass(n, c); |
|
11412 |
}); |
|
11413 |
} |
|
11414 |
} |
|
11415 |
}; |
|
11416 |
||
11417 |
// Remove specified style information from child elements |
|
11418 |
each(dom.select(na, n), removeStyle); |
|
11419 |
||
11420 |
// Remove the specified style information on parent if current node is only child (IE) |
|
11421 |
if (n.parentNode && n.parentNode.nodeType == 1 && n.parentNode.childNodes.length == 1) |
|
11422 |
removeStyle(n.parentNode); |
|
11423 |
||
11424 |
// Remove the child elements style info if a parent already has it |
|
11425 |
dom.getParent(n.parentNode, function(pn) { |
|
11426 |
if (pn.nodeType == 1) { |
|
11427 |
if (at.style) { |
|
11428 |
each(at.style, function(v, k) { |
|
11429 |
var sv; |
|
11430 |
||
11431 |
if (!lo[k] && (sv = dom.getStyle(pn, k))) { |
|
11432 |
if (sv === v) |
|
11433 |
dom.setStyle(n, k, ''); |
|
11434 |
||
11435 |
lo[k] = 1; |
|
11436 |
} |
|
11437 |
}); |
|
11438 |
} |
|
11439 |
||
11440 |
// Remove spans with the same class or marked classes |
|
11441 |
if (at['class'] && pn.className && op) { |
|
11442 |
each(op.check_classes, function(c) { |
|
11443 |
if (dom.hasClass(pn, c)) |
|
11444 |
dom.removeClass(n, c); |
|
11445 |
}); |
|
11446 |
} |
|
11447 |
} |
|
11448 |
||
11449 |
return false; |
|
11450 |
}); |
|
11451 |
||
11452 |
n.removeAttribute('_mce_new'); |
|
11453 |
}); |
|
11454 |
||
11455 |
removeEmpty(); |
|
778 | 11456 |
ed.selection.moveToBookmark(bm); |
11457 |
||
11458 |
return !!bm; |
|
11459 |
}; |
|
11460 |
||
11461 |
// Create inline elements |
|
11462 |
ed.focus(); |
|
11463 |
ed.getDoc().execCommand('FontName', false, 'mceinline'); |
|
11464 |
replaceFonts(); |
|
11465 |
||
11466 |
if (kh = t._applyInlineStyle.keyhandler) { |
|
11467 |
ed.onKeyUp.remove(kh); |
|
11468 |
ed.onKeyPress.remove(kh); |
|
11469 |
ed.onKeyDown.remove(kh); |
|
11470 |
ed.onSetContent.remove(t._applyInlineStyle.chandler); |
|
11471 |
} |
|
11472 |
||
11473 |
if (ed.selection.isCollapsed()) { |
|
1193 | 11474 |
// IE will format the current word so this code can't be executed on that browser |
11475 |
if (!isIE) { |
|
11476 |
each(dom.getParents(ed.selection.getNode(), 'span'), function(n) { |
|
11477 |
each(at.style, function(v, k) { |
|
11478 |
var kv; |
|
11479 |
||
11480 |
if (kv = dom.getStyle(n, k)) { |
|
11481 |
if (kv == v) { |
|
11482 |
dom.setStyle(n, k, ''); |
|
11483 |
found = 2; |
|
11484 |
return false; |
|
11485 |
} |
|
11486 |
||
11487 |
found = 1; |
|
11488 |
return false; |
|
11489 |
} |
|
11490 |
}); |
|
11491 |
||
11492 |
if (found) |
|
11493 |
return false; |
|
11494 |
}); |
|
11495 |
||
11496 |
if (found == 2) { |
|
11497 |
bm = ed.selection.getBookmark(); |
|
11498 |
||
11499 |
removeEmpty(); |
|
11500 |
||
11501 |
ed.selection.moveToBookmark(bm); |
|
11502 |
||
11503 |
// Node change needs to be detached since the onselect event |
|
11504 |
// for the select box will run the onclick handler after onselect call. Todo: Add a nicer fix! |
|
11505 |
window.setTimeout(function() { |
|
11506 |
ed.nodeChanged(); |
|
11507 |
}, 1); |
|
11508 |
||
11509 |
return; |
|
11510 |
} |
|
11511 |
} |
|
11512 |
||
778 | 11513 |
// Start collecting styles |
11514 |
t._pendingStyles = tinymce.extend(t._pendingStyles || {}, at.style); |
|
11515 |
||
11516 |
t._applyInlineStyle.chandler = ed.onSetContent.add(function() { |
|
11517 |
delete t._pendingStyles; |
|
11518 |
}); |
|
11519 |
||
11520 |
t._applyInlineStyle.keyhandler = kh = function(e) { |
|
11521 |
// Use pending styles |
|
11522 |
if (t._pendingStyles) { |
|
11523 |
at.style = t._pendingStyles; |
|
11524 |
delete t._pendingStyles; |
|
11525 |
} |
|
11526 |
||
11527 |
if (replaceFonts()) { |
|
11528 |
ed.onKeyDown.remove(t._applyInlineStyle.keyhandler); |
|
11529 |
ed.onKeyPress.remove(t._applyInlineStyle.keyhandler); |
|
11530 |
} |
|
11531 |
||
11532 |
if (e.type == 'keyup') |
|
11533 |
ed.onKeyUp.remove(t._applyInlineStyle.keyhandler); |
|
11534 |
}; |
|
11535 |
||
11536 |
ed.onKeyDown.add(kh); |
|
11537 |
ed.onKeyPress.add(kh); |
|
11538 |
ed.onKeyUp.add(kh); |
|
11539 |
} else |
|
11540 |
t._pendingStyles = 0; |
|
1 | 11541 |
} |
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:
117
diff
changeset
|
11542 |
}); |
1193 | 11543 |
})(tinymce);(function(tinymce) { |
11544 |
tinymce.create('tinymce.UndoManager', { |
|
11545 |
index : 0, |
|
11546 |
data : null, |
|
11547 |
typing : 0, |
|
11548 |
||
11549 |
UndoManager : function(ed) { |
|
11550 |
var t = this, Dispatcher = tinymce.util.Dispatcher; |
|
11551 |
||
11552 |
t.editor = ed; |
|
11553 |
t.data = []; |
|
11554 |
t.onAdd = new Dispatcher(this); |
|
11555 |
t.onUndo = new Dispatcher(this); |
|
11556 |
t.onRedo = new Dispatcher(this); |
|
11557 |
}, |
|
11558 |
||
11559 |
add : function(l) { |
|
11560 |
var t = this, i, ed = t.editor, b, s = ed.settings, la; |
|
11561 |
||
11562 |
l = l || {}; |
|
11563 |
l.content = l.content || ed.getContent({format : 'raw', no_events : 1}); |
|
11564 |
||
11565 |
// Add undo level if needed |
|
11566 |
l.content = l.content.replace(/^\s*|\s*$/g, ''); |
|
11567 |
la = t.data[t.index > 0 && (t.index == 0 || t.index == t.data.length) ? t.index - 1 : t.index]; |
|
11568 |
if (!l.initial && la && l.content == la.content) |
|
11569 |
return null; |
|
11570 |
||
11571 |
// Time to compress |
|
11572 |
if (s.custom_undo_redo_levels) { |
|
11573 |
if (t.data.length > s.custom_undo_redo_levels) { |
|
11574 |
for (i = 0; i < t.data.length - 1; i++) |
|
11575 |
t.data[i] = t.data[i + 1]; |
|
11576 |
||
11577 |
t.data.length--; |
|
11578 |
t.index = t.data.length; |
|
11579 |
} |
|
11580 |
} |
|
11581 |
||
11582 |
if (s.custom_undo_redo_restore_selection && !l.initial) |
|
11583 |
l.bookmark = b = l.bookmark || ed.selection.getBookmark(); |
|
11584 |
||
11585 |
if (t.index < t.data.length) |
|
11586 |
t.index++; |
|
11587 |
||
11588 |
// Only initial marked undo levels should be allowed as first item |
|
11589 |
// This to workaround a bug with Firefox and the blur event |
|
11590 |
if (t.data.length === 0 && !l.initial) |
|
11591 |
return null; |
|
11592 |
||
11593 |
// Add level |
|
11594 |
t.data.length = t.index + 1; |
|
11595 |
t.data[t.index++] = l; |
|
11596 |
||
11597 |
if (l.initial) |
|
11598 |
t.index = 0; |
|
11599 |
||
11600 |
// Set initial bookmark use first real undo level |
|
11601 |
if (t.data.length == 2 && t.data[0].initial) |
|
11602 |
t.data[0].bookmark = b; |
|
11603 |
||
11604 |
t.onAdd.dispatch(t, l); |
|
11605 |
ed.isNotDirty = 0; |
|
11606 |
||
11607 |
//console.dir(t.data); |
|
11608 |
||
11609 |
return l; |
|
11610 |
}, |
|
11611 |
||
11612 |
undo : function() { |
|
11613 |
var t = this, ed = t.editor, l = l, i; |
|
11614 |
||
11615 |
if (t.typing) { |
|
11616 |
t.add(); |
|
11617 |
t.typing = 0; |
|
11618 |
} |
|
11619 |
||
11620 |
if (t.index > 0) { |
|
11621 |
// If undo on last index then take snapshot |
|
11622 |
if (t.index == t.data.length && t.index > 1) { |
|
11623 |
i = t.index; |
|
11624 |
t.typing = 0; |
|
11625 |
||
11626 |
if (!t.add()) |
|
11627 |
t.index = i; |
|
11628 |
||
11629 |
--t.index; |
|
11630 |
} |
|
11631 |
||
11632 |
l = t.data[--t.index]; |
|
11633 |
ed.setContent(l.content, {format : 'raw'}); |
|
11634 |
ed.selection.moveToBookmark(l.bookmark); |
|
11635 |
||
11636 |
t.onUndo.dispatch(t, l); |
|
11637 |
} |
|
11638 |
||
11639 |
return l; |
|
11640 |
}, |
|
11641 |
||
11642 |
redo : function() { |
|
11643 |
var t = this, ed = t.editor, l = null; |
|
11644 |
||
11645 |
if (t.index < t.data.length - 1) { |
|
11646 |
l = t.data[++t.index]; |
|
11647 |
ed.setContent(l.content, {format : 'raw'}); |
|
11648 |
ed.selection.moveToBookmark(l.bookmark); |
|
11649 |
||
11650 |
t.onRedo.dispatch(t, l); |
|
11651 |
} |
|
11652 |
||
11653 |
return l; |
|
11654 |
}, |
|
11655 |
||
11656 |
clear : function() { |
|
11657 |
var t = this; |
|
11658 |
||
11659 |
t.data = []; |
|
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:
117
diff
changeset
|
11660 |
t.index = 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:
117
diff
changeset
|
11661 |
t.typing = 0; |
1193 | 11662 |
t.add({initial : true}); |
11663 |
}, |
|
11664 |
||
11665 |
hasUndo : function() { |
|
11666 |
return this.index != 0 || this.typing; |
|
11667 |
}, |
|
11668 |
||
11669 |
hasRedo : function() { |
|
11670 |
return this.index < this.data.length - 1; |
|
11671 |
} |
|
1 | 11672 |
}); |
1193 | 11673 |
})(tinymce); |
11674 |
(function(tinymce) { |
|
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:
117
diff
changeset
|
11675 |
// Shorten names |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11676 |
var Event, isIE, isGecko, isOpera, each, extend; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11677 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11678 |
Event = tinymce.dom.Event; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11679 |
isIE = tinymce.isIE; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11680 |
isGecko = tinymce.isGecko; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11681 |
isOpera = tinymce.isOpera; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11682 |
each = tinymce.each; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11683 |
extend = tinymce.extend; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11684 |
|
1193 | 11685 |
// Checks if the selection/caret is at the end of the specified block element |
11686 |
function isAtEnd(rng, par) { |
|
11687 |
var rng2 = par.ownerDocument.createRange(); |
|
11688 |
||
11689 |
rng2.setStart(rng.endContainer, rng.endOffset); |
|
11690 |
rng2.setEndAfter(par); |
|
11691 |
||
11692 |
// Get number of characters to the right of the cursor if it's zero then we are at the end and need to merge the next block element |
|
11693 |
return rng2.cloneContents().textContent.length == 0; |
|
11694 |
}; |
|
11695 |
||
11696 |
function isEmpty(n) { |
|
11697 |
n = n.innerHTML; |
|
11698 |
||
11699 |
n = n.replace(/<(img|hr|table|input|select|textarea)[ \>]/gi, '-'); // Keep these convert them to - chars |
|
11700 |
n = n.replace(/<[^>]+>/g, ''); // Remove all tags |
|
11701 |
||
11702 |
return n.replace(/[ \t\r\n]+/g, '') == ''; |
|
11703 |
}; |
|
11704 |
||
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:
117
diff
changeset
|
11705 |
tinymce.create('tinymce.ForceBlocks', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11706 |
ForceBlocks : function(ed) { |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
11707 |
var t = this, s = ed.settings, elm; |
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:
117
diff
changeset
|
11708 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11709 |
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:
117
diff
changeset
|
11710 |
t.dom = ed.dom; |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11711 |
elm = (s.forced_root_block || 'p').toLowerCase(); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11712 |
s.element = elm.toUpperCase(); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11713 |
|
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:
117
diff
changeset
|
11714 |
ed.onPreInit.add(t.setup, t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11715 |
|
543 | 11716 |
t.reOpera = new RegExp('(\\u00a0| | )<\/' + elm + '>', 'gi'); |
11717 |
t.rePadd = new RegExp('<p( )([^>]+)><\\\/p>|<p( )([^>]+)\\\/>|<p( )([^>]+)>\\s+<\\\/p>|<p><\\\/p>|<p\\\/>|<p>\\s+<\\\/p>'.replace(/p/g, elm), 'gi'); |
|
11718 |
t.reNbsp2BR1 = new RegExp('<p( )([^>]+)>[\\s\\u00a0]+<\\\/p>|<p>[\\s\\u00a0]+<\\\/p>'.replace(/p/g, elm), 'gi'); |
|
1193 | 11719 |
t.reNbsp2BR2 = new RegExp('<%p()([^>]+)>( | )<\\\/%p>|<%p>( | )<\\\/%p>'.replace(/%p/g, elm), 'gi'); |
543 | 11720 |
t.reBR2Nbsp = new RegExp('<p( )([^>]+)>\\s*<br \\\/>\\s*<\\\/p>|<p>\\s*<br \\\/>\\s*<\\\/p>'.replace(/p/g, elm), 'gi'); |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11721 |
|
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
|
11722 |
function padd(ed, o) { |
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
|
11723 |
if (isOpera) |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11724 |
o.content = o.content.replace(t.reOpera, '</' + elm + '>'); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11725 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11726 |
o.content = o.content.replace(t.rePadd, '<' + elm + '$1$2$3$4$5$6>\u00a0</' + elm + '>'); |
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
|
11727 |
|
543 | 11728 |
if (!isIE && !isOpera && o.set) { |
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
|
11729 |
// Use instead of BR in padded paragraphs |
543 | 11730 |
o.content = o.content.replace(t.reNbsp2BR1, '<' + elm + '$1$2><br /></' + elm + '>'); |
11731 |
o.content = o.content.replace(t.reNbsp2BR2, '<' + elm + '$1$2><br /></' + elm + '>'); |
|
1193 | 11732 |
} else |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11733 |
o.content = o.content.replace(t.reBR2Nbsp, '<' + elm + '$1$2>\u00a0</' + elm + '>'); |
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
|
11734 |
}; |
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
|
11735 |
|
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
|
11736 |
ed.onBeforeSetContent.add(padd); |
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
|
11737 |
ed.onPostProcess.add(padd); |
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:
117
diff
changeset
|
11738 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11739 |
if (s.forced_root_block) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11740 |
ed.onInit.add(t.forceRoots, t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11741 |
ed.onSetContent.add(t.forceRoots, t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11742 |
ed.onBeforeGetContent.add(t.forceRoots, t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11743 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11744 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11745 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11746 |
setup : function() { |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
11747 |
var t = this, ed = t.editor, s = ed.settings; |
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:
117
diff
changeset
|
11748 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11749 |
// Force root blocks when typing and when getting output |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11750 |
if (s.forced_root_block) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11751 |
ed.onKeyUp.add(t.forceRoots, t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11752 |
ed.onPreProcess.add(t.forceRoots, t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11753 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11754 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11755 |
if (s.force_br_newlines) { |
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
|
11756 |
// Force IE to produce BRs on enter |
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
|
11757 |
if (isIE) { |
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
|
11758 |
ed.onKeyPress.add(function(ed, e) { |
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
|
11759 |
var n, s = ed.selection; |
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
|
11760 |
|
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11761 |
if (e.keyCode == 13 && s.getNode().nodeName != 'LI') { |
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
|
11762 |
s.setContent('<br id="__" /> ', {format : 'raw'}); |
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
|
11763 |
n = ed.dom.get('__'); |
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
|
11764 |
n.removeAttribute('id'); |
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
|
11765 |
s.select(n); |
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
|
11766 |
s.collapse(); |
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
|
11767 |
return Event.cancel(e); |
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
|
11768 |
} |
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
|
11769 |
}); |
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
|
11770 |
} |
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:
117
diff
changeset
|
11771 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11772 |
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:
117
diff
changeset
|
11773 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11774 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11775 |
if (!isIE && s.force_p_newlines) { |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11776 |
/* ed.onPreProcess.add(function(ed, o) { |
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:
117
diff
changeset
|
11777 |
each(ed.dom.select('br', o.node), 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:
117
diff
changeset
|
11778 |
var p = n.parentNode; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11779 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11780 |
// Replace <p><br /></p> with <p> </p> |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11781 |
if (p && p.nodeName == 'p' && (p.childNodes.length == 1 || p.lastChild == n)) { |
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:
117
diff
changeset
|
11782 |
p.replaceChild(ed.getDoc().createTextNode('\u00a0'), n); |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11783 |
} |
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:
117
diff
changeset
|
11784 |
}); |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11785 |
});*/ |
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:
117
diff
changeset
|
11786 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11787 |
ed.onKeyPress.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:
117
diff
changeset
|
11788 |
if (e.keyCode == 13 && !e.shiftKey) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11789 |
if (!t.insertPara(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:
117
diff
changeset
|
11790 |
Event.cancel(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:
117
diff
changeset
|
11791 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11792 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11793 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11794 |
if (isGecko) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11795 |
ed.onKeyDown.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:
117
diff
changeset
|
11796 |
if ((e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11797 |
t.backspaceDelete(e, e.keyCode == 8); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11798 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11799 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11800 |
} |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11801 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11802 |
function ren(rn, na) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11803 |
var ne = ed.dom.create(na); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11804 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11805 |
each(rn.attributes, function(a) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11806 |
if (a.specified && a.nodeValue) |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11807 |
ne.setAttribute(a.nodeName.toLowerCase(), a.nodeValue); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11808 |
}); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11809 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11810 |
each(rn.childNodes, function(n) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11811 |
ne.appendChild(n.cloneNode(true)); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11812 |
}); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11813 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11814 |
rn.parentNode.replaceChild(ne, rn); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11815 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11816 |
return ne; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11817 |
}; |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11818 |
|
1193 | 11819 |
// Padd empty inline elements within block elements |
11820 |
// For example: <p><strong><em></em></strong></p> becomes <p><strong><em> </em></strong></p> |
|
11821 |
ed.onPreProcess.add(function(ed, o) { |
|
11822 |
each(ed.dom.select('p,h1,h2,h3,h4,h5,h6,div', o.node), function(p) { |
|
11823 |
if (isEmpty(p)) { |
|
11824 |
each(ed.dom.select('span,em,strong,b,i', o.node), function(n) { |
|
11825 |
if (!n.hasChildNodes()) { |
|
11826 |
n.appendChild(ed.getDoc().createTextNode('\u00a0')); |
|
11827 |
return false; // Break the loop one padding is enough |
|
11828 |
} |
|
11829 |
}); |
|
11830 |
} |
|
11831 |
}); |
|
11832 |
}); |
|
11833 |
||
11834 |
// IE specific fixes |
|
11835 |
if (isIE) { |
|
11836 |
// Replaces IE:s auto generated paragraphs with the specified element name |
|
11837 |
if (s.element != 'P') { |
|
11838 |
ed.onKeyPress.add(function(ed, e) { |
|
11839 |
t.lastElm = ed.selection.getNode().nodeName; |
|
11840 |
}); |
|
11841 |
||
11842 |
ed.onKeyUp.add(function(ed, e) { |
|
11843 |
var bl, sel = ed.selection, n = sel.getNode(), b = ed.getBody(); |
|
11844 |
||
11845 |
if (b.childNodes.length === 1 && n.nodeName == 'P') { |
|
11846 |
n = ren(n, s.element); |
|
11847 |
sel.select(n); |
|
11848 |
sel.collapse(); |
|
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11849 |
ed.nodeChanged(); |
1193 | 11850 |
} else if (e.keyCode == 13 && !e.shiftKey && t.lastElm != 'P') { |
11851 |
bl = ed.dom.getParent(n, 'p'); |
|
11852 |
||
11853 |
if (bl) { |
|
11854 |
ren(bl, s.element); |
|
11855 |
ed.nodeChanged(); |
|
11856 |
} |
|
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11857 |
} |
1193 | 11858 |
}); |
11859 |
} |
|
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
11860 |
} |
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:
117
diff
changeset
|
11861 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11862 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11863 |
find : function(n, t, 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:
117
diff
changeset
|
11864 |
var ed = this.editor, w = ed.getDoc().createTreeWalker(n, 4, null, false), c = -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:
117
diff
changeset
|
11865 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11866 |
while (n = w.nextNode()) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11867 |
c++; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11868 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11869 |
// Index by node |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11870 |
if (t == 0 && n == 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:
117
diff
changeset
|
11871 |
return c; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11872 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11873 |
// Node by index |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11874 |
if (t == 1 && c == 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:
117
diff
changeset
|
11875 |
return 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:
117
diff
changeset
|
11876 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11877 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11878 |
return -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:
117
diff
changeset
|
11879 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11880 |
|
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
|
11881 |
forceRoots : function(ed, e) { |
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:
117
diff
changeset
|
11882 |
var t = this, ed = t.editor, b = ed.getBody(), d = ed.getDoc(), se = ed.selection, s = se.getSel(), r = se.getRng(), si = -2, ei, so, eo, tr, c = -0xFFFFFF; |
778 | 11883 |
var nx, bl, bp, sp, le, nl = b.childNodes, i, n, eid; |
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:
117
diff
changeset
|
11884 |
|
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
|
11885 |
// Fix for bug #1863847 |
778 | 11886 |
//if (e && e.keyCode == 13) |
11887 |
// return true; |
|
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
|
11888 |
|
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:
117
diff
changeset
|
11889 |
// Wrap non blocks into blocks |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11890 |
for (i = nl.length - 1; i >= 0; i--) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11891 |
nx = nl[i]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11892 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11893 |
// Is text or non block element |
1193 | 11894 |
if (nx.nodeType === 3 || (!t.dom.isBlock(nx) && nx.nodeType !== 8 && !/^(script|mce:script|style|mce:style)$/i.test(nx.nodeName))) { |
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:
117
diff
changeset
|
11895 |
if (!bl) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11896 |
// Create new block but ignore whitespace |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11897 |
if (nx.nodeType != 3 || /[^\s]/g.test(nx.nodeValue)) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11898 |
// Store selection |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11899 |
if (si == -2 && 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:
117
diff
changeset
|
11900 |
if (!isIE) { |
778 | 11901 |
// If selection is element then mark it |
11902 |
if (r.startContainer.nodeType == 1 && (n = r.startContainer.childNodes[r.startOffset]) && n.nodeType == 1) { |
|
11903 |
// Save the id of the selected element |
|
11904 |
eid = n.getAttribute("id"); |
|
11905 |
n.setAttribute("id", "__mce"); |
|
11906 |
} else { |
|
11907 |
// If element is inside body, might not be the case in contentEdiable mode |
|
11908 |
if (ed.dom.getParent(r.startContainer, function(e) {return e === b;})) { |
|
11909 |
so = r.startOffset; |
|
11910 |
eo = r.endOffset; |
|
11911 |
si = t.find(b, 0, r.startContainer); |
|
11912 |
ei = t.find(b, 0, r.endContainer); |
|
11913 |
} |
|
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11914 |
} |
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:
117
diff
changeset
|
11915 |
} 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:
117
diff
changeset
|
11916 |
tr = d.body.createTextRange(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11917 |
tr.moveToElementText(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:
117
diff
changeset
|
11918 |
tr.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:
117
diff
changeset
|
11919 |
bp = tr.move('character', c) * -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:
117
diff
changeset
|
11920 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11921 |
tr = r.duplicate(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11922 |
tr.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:
117
diff
changeset
|
11923 |
sp = tr.move('character', c) * -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:
117
diff
changeset
|
11924 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11925 |
tr = r.duplicate(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11926 |
tr.collapse(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:
117
diff
changeset
|
11927 |
le = (tr.move('character', c) * -1) - sp; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11928 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11929 |
si = sp - bp; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11930 |
ei = le; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11931 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11932 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11933 |
|
1193 | 11934 |
// Uses replaceChild instead of cloneNode since it removes selected attribute from option elements on IE |
11935 |
// See: http://support.microsoft.com/kb/829907 |
|
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
11936 |
bl = ed.dom.create(ed.settings.forced_root_block); |
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
|
11937 |
nx.parentNode.replaceChild(bl, nx); |
1193 | 11938 |
bl.appendChild(nx); |
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:
117
diff
changeset
|
11939 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11940 |
} 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:
117
diff
changeset
|
11941 |
if (bl.hasChildNodes()) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11942 |
bl.insertBefore(nx, bl.firstChild); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11943 |
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:
117
diff
changeset
|
11944 |
bl.appendChild(nx); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11945 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11946 |
} 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:
117
diff
changeset
|
11947 |
bl = null; // Time to create new block |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11948 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11949 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11950 |
// Restore selection |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11951 |
if (si != -2) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11952 |
if (!isIE) { |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
11953 |
bl = b.getElementsByTagName(ed.settings.element)[0]; |
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:
117
diff
changeset
|
11954 |
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:
117
diff
changeset
|
11955 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11956 |
// Select last location or generated block |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11957 |
if (si != -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:
117
diff
changeset
|
11958 |
r.setStart(t.find(b, 1, si), so); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11959 |
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:
117
diff
changeset
|
11960 |
r.setStart(bl, 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:
117
diff
changeset
|
11961 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11962 |
// Select last location or generated block |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11963 |
if (ei != -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:
117
diff
changeset
|
11964 |
r.setEnd(t.find(b, 1, ei), eo); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11965 |
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:
117
diff
changeset
|
11966 |
r.setEnd(bl, 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:
117
diff
changeset
|
11967 |
|
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
|
11968 |
if (s) { |
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
|
11969 |
s.removeAllRanges(); |
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
|
11970 |
s.addRange(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
|
11971 |
} |
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:
117
diff
changeset
|
11972 |
} 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:
117
diff
changeset
|
11973 |
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:
117
diff
changeset
|
11974 |
r = s.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:
117
diff
changeset
|
11975 |
r.moveToElementText(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:
117
diff
changeset
|
11976 |
r.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:
117
diff
changeset
|
11977 |
r.moveStart('character', si); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11978 |
r.moveEnd('character', ei); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11979 |
r.select(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11980 |
} 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:
117
diff
changeset
|
11981 |
// Ignore |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11982 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11983 |
} |
778 | 11984 |
} else if (!isIE && (n = ed.dom.get('__mce'))) { |
11985 |
// Restore the id of the selected element |
|
11986 |
if (eid) |
|
11987 |
n.setAttribute('id', eid); |
|
11988 |
else |
|
11989 |
n.removeAttribute('id'); |
|
11990 |
||
11991 |
// Move caret before selected element |
|
11992 |
r = d.createRange(); |
|
11993 |
r.setStartBefore(n); |
|
11994 |
r.setEndBefore(n); |
|
11995 |
se.setRng(r); |
|
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:
117
diff
changeset
|
11996 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11997 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11998 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
11999 |
getParentBlock : 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:
117
diff
changeset
|
12000 |
var d = 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:
117
diff
changeset
|
12001 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12002 |
return d.getParent(n, d.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:
117
diff
changeset
|
12003 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12004 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12005 |
insertPara : function(e) { |
543 | 12006 |
var t = this, ed = t.editor, dom = ed.dom, d = ed.getDoc(), se = ed.settings, s = ed.selection.getSel(), r = s.getRangeAt(0), b = d.body; |
778 | 12007 |
var rb, ra, dir, sn, so, en, eo, sb, eb, bn, bef, aft, sc, ec, n, vp = dom.getViewPort(ed.getWin()), y, ch, car; |
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:
117
diff
changeset
|
12008 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12009 |
// If root blocks are forced then use Operas default behavior since it's really good |
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
|
12010 |
// Removed due to bug: #1853816 |
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
|
12011 |
// if (se.forced_root_block && isOpera) |
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
|
12012 |
// return true; |
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:
117
diff
changeset
|
12013 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12014 |
// 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:
117
diff
changeset
|
12015 |
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:
117
diff
changeset
|
12016 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12017 |
// If is before the first block element and in body, then move it into first block element |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12018 |
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:
117
diff
changeset
|
12019 |
rb.collapse(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:
117
diff
changeset
|
12020 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12021 |
// 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:
117
diff
changeset
|
12022 |
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:
117
diff
changeset
|
12023 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12024 |
// If is before the first block element and in body, then move it into first block element |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12025 |
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:
117
diff
changeset
|
12026 |
ra.collapse(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:
117
diff
changeset
|
12027 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12028 |
// Setup start/end points |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12029 |
dir = 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:
117
diff
changeset
|
12030 |
sn = dir ? s.anchorNode : s.focusNode; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12031 |
so = dir ? 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:
117
diff
changeset
|
12032 |
en = dir ? s.focusNode : 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:
117
diff
changeset
|
12033 |
eo = dir ? 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:
117
diff
changeset
|
12034 |
|
543 | 12035 |
// If selection is in empty table cell |
12036 |
if (sn === en && /^(TD|TH)$/.test(sn.nodeName)) { |
|
1193 | 12037 |
if (sn.firstChild.nodeName == 'BR') |
12038 |
dom.remove(sn.firstChild); // Remove BR |
|
543 | 12039 |
|
12040 |
// Create two new block elements |
|
1193 | 12041 |
if (sn.childNodes.length == 0) { |
12042 |
ed.dom.add(sn, se.element, null, '<br />'); |
|
12043 |
aft = ed.dom.add(sn, se.element, null, '<br />'); |
|
12044 |
} else { |
|
12045 |
n = sn.innerHTML; |
|
12046 |
sn.innerHTML = ''; |
|
12047 |
ed.dom.add(sn, se.element, null, n); |
|
12048 |
aft = ed.dom.add(sn, se.element, null, '<br />'); |
|
12049 |
} |
|
543 | 12050 |
|
12051 |
// Move caret into the last one |
|
12052 |
r = d.createRange(); |
|
12053 |
r.selectNodeContents(aft); |
|
12054 |
r.collapse(1); |
|
12055 |
ed.selection.setRng(r); |
|
12056 |
||
12057 |
return false; |
|
12058 |
} |
|
12059 |
||
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:
117
diff
changeset
|
12060 |
// If the caret is in an invalid location in FF we need to move it into the first block |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12061 |
if (sn == b && en == b && b.firstChild && ed.dom.isBlock(b.firstChild)) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12062 |
sn = en = sn.firstChild; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12063 |
so = eo = 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:
117
diff
changeset
|
12064 |
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:
117
diff
changeset
|
12065 |
rb.setStart(sn, 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:
117
diff
changeset
|
12066 |
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:
117
diff
changeset
|
12067 |
ra.setStart(en, 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:
117
diff
changeset
|
12068 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12069 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12070 |
// Never use body as start or end node |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
12071 |
sn = sn.nodeName == "HTML" ? d.body : sn; // Fix for Opera bug: https://bugs.opera.com/show_bug.cgi?id=273224&comments=yes |
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:
117
diff
changeset
|
12072 |
sn = sn.nodeName == "BODY" ? sn.firstChild : sn; |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
12073 |
en = en.nodeName == "HTML" ? d.body : en; // Fix for Opera bug: https://bugs.opera.com/show_bug.cgi?id=273224&comments=yes |
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:
117
diff
changeset
|
12074 |
en = en.nodeName == "BODY" ? en.firstChild : en; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12075 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12076 |
// Get start and end blocks |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12077 |
sb = t.getParentBlock(sn); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12078 |
eb = t.getParentBlock(en); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12079 |
bn = sb ? sb.nodeName : se.element; // Get block name to create |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12080 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12081 |
// Return inside list use default browser behavior |
1193 | 12082 |
if (t.dom.getParent(sb, 'ol,ul,pre')) |
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:
117
diff
changeset
|
12083 |
return 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:
117
diff
changeset
|
12084 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12085 |
// If caption or absolute layers then always generate new blocks within |
1193 | 12086 |
if (sb && (sb.nodeName == 'CAPTION' || /absolute|relative|fixed/gi.test(dom.getStyle(sb, 'position', 1)))) { |
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:
117
diff
changeset
|
12087 |
bn = se.element; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12088 |
sb = 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:
117
diff
changeset
|
12089 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12090 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12091 |
// If caption or absolute layers then always generate new blocks within |
1193 | 12092 |
if (eb && (eb.nodeName == 'CAPTION' || /absolute|relative|fixed/gi.test(dom.getStyle(sb, 'position', 1)))) { |
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:
117
diff
changeset
|
12093 |
bn = se.element; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12094 |
eb = 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:
117
diff
changeset
|
12095 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12096 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12097 |
// Use P instead |
1193 | 12098 |
if (/(TD|TABLE|TH|CAPTION)/.test(bn) || (sb && bn == "DIV" && /left|right/gi.test(dom.getStyle(sb, 'float', 1)))) { |
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:
117
diff
changeset
|
12099 |
bn = se.element; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12100 |
sb = eb = 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:
117
diff
changeset
|
12101 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12102 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12103 |
// Setup new before and after blocks |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12104 |
bef = (sb && sb.nodeName == bn) ? sb.cloneNode(0) : ed.dom.create(bn); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12105 |
aft = (eb && eb.nodeName == bn) ? eb.cloneNode(0) : ed.dom.create(bn); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12106 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12107 |
// Remove id from after clone |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12108 |
aft.removeAttribute('id'); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12109 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12110 |
// Is header and cursor is at the end, then force paragraph under |
1193 | 12111 |
if (/^(H[1-6])$/.test(bn) && isAtEnd(r, sb)) |
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:
117
diff
changeset
|
12112 |
aft = ed.dom.create(se.element); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12113 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12114 |
// Find start chop node |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12115 |
n = sc = sn; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12116 |
do { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12117 |
if (n == b || n.nodeType == 9 || t.dom.isBlock(n) || /(TD|TABLE|TH|CAPTION)/.test(n.nodeName)) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12118 |
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:
117
diff
changeset
|
12119 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12120 |
sc = 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:
117
diff
changeset
|
12121 |
} while ((n = n.previousSibling ? n.previousSibling : n.parentNode)); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12122 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12123 |
// Find end chop node |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12124 |
n = ec = en; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12125 |
do { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12126 |
if (n == b || n.nodeType == 9 || t.dom.isBlock(n) || /(TD|TABLE|TH|CAPTION)/.test(n.nodeName)) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12127 |
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:
117
diff
changeset
|
12128 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12129 |
ec = 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:
117
diff
changeset
|
12130 |
} while ((n = n.nextSibling ? n.nextSibling : n.parentNode)); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12131 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12132 |
// Place first chop part into before block element |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12133 |
if (sc.nodeName == bn) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12134 |
rb.setStart(sc, 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:
117
diff
changeset
|
12135 |
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:
117
diff
changeset
|
12136 |
rb.setStartBefore(sc); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12137 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12138 |
rb.setEnd(sn, so); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12139 |
bef.appendChild(rb.cloneContents() || d.createTextNode('')); // Empty text node needed for 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:
117
diff
changeset
|
12140 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12141 |
// Place secnd chop part within new block element |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12142 |
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:
117
diff
changeset
|
12143 |
ra.setEndAfter(ec); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12144 |
} 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:
117
diff
changeset
|
12145 |
//console.debug(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:
117
diff
changeset
|
12146 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12147 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12148 |
ra.setStart(en, eo); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12149 |
aft.appendChild(ra.cloneContents() || d.createTextNode('')); // Empty text node needed for 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:
117
diff
changeset
|
12150 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12151 |
// Create range around everything |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12152 |
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:
117
diff
changeset
|
12153 |
if (!sc.previousSibling && sc.parentNode.nodeName == bn) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12154 |
r.setStartBefore(sc.parentNode); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12155 |
} 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:
117
diff
changeset
|
12156 |
if (rb.startContainer.nodeName == bn && rb.startOffset == 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:
117
diff
changeset
|
12157 |
r.setStartBefore(rb.startContainer); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12158 |
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:
117
diff
changeset
|
12159 |
r.setStart(rb.startContainer, rb.startOffset); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12160 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12161 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12162 |
if (!ec.nextSibling && ec.parentNode.nodeName == bn) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12163 |
r.setEndAfter(ec.parentNode); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12164 |
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:
117
diff
changeset
|
12165 |
r.setEnd(ra.endContainer, ra.endOffset); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12166 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12167 |
// Delete and replace it with new 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:
117
diff
changeset
|
12168 |
r.deleteContents(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12169 |
|
543 | 12170 |
if (isOpera) |
12171 |
ed.getWin().scrollTo(0, vp.y); |
|
12172 |
||
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:
117
diff
changeset
|
12173 |
// Never wrap blocks in blocks |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12174 |
if (bef.firstChild && bef.firstChild.nodeName == bn) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12175 |
bef.innerHTML = bef.firstChild.innerHTML; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12176 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12177 |
if (aft.firstChild && aft.firstChild.nodeName == bn) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12178 |
aft.innerHTML = aft.firstChild.innerHTML; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12179 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12180 |
// Padd empty blocks |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12181 |
if (isEmpty(bef)) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12182 |
bef.innerHTML = '<br />'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12183 |
|
778 | 12184 |
function appendStyles(e, en) { |
12185 |
var nl = [], nn, n, i; |
|
12186 |
||
12187 |
e.innerHTML = ''; |
|
12188 |
||
12189 |
// Make clones of style elements |
|
12190 |
if (se.keep_styles) { |
|
12191 |
n = en; |
|
12192 |
do { |
|
12193 |
// We only want style specific elements |
|
12194 |
if (/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(n.nodeName)) { |
|
12195 |
nn = n.cloneNode(false); |
|
12196 |
dom.setAttrib(nn, 'id', ''); // Remove ID since it needs to be unique |
|
12197 |
nl.push(nn); |
|
12198 |
} |
|
12199 |
} while (n = n.parentNode); |
|
12200 |
} |
|
12201 |
||
12202 |
// Append style elements to aft |
|
12203 |
if (nl.length > 0) { |
|
12204 |
for (i = nl.length - 1, nn = e; i >= 0; i--) |
|
12205 |
nn = nn.appendChild(nl[i]); |
|
12206 |
||
12207 |
// Padd most inner style element |
|
12208 |
nl[0].innerHTML = isOpera ? ' ' : '<br />'; // Extra space for Opera so that the caret can move there |
|
12209 |
return nl[0]; // Move caret to most inner element |
|
12210 |
} else |
|
12211 |
e.innerHTML = isOpera ? ' ' : '<br />'; // Extra space for Opera so that the caret can move there |
|
12212 |
}; |
|
12213 |
||
12214 |
// Fill empty afterblook with current style |
|
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:
117
diff
changeset
|
12215 |
if (isEmpty(aft)) |
778 | 12216 |
car = appendStyles(aft, en); |
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:
117
diff
changeset
|
12217 |
|
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
12218 |
// Opera needs this one backwards for older versions |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
12219 |
if (isOpera && parseFloat(opera.version()) < 9.5) { |
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:
117
diff
changeset
|
12220 |
r.insertNode(bef); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12221 |
r.insertNode(aft); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12222 |
} 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:
117
diff
changeset
|
12223 |
r.insertNode(aft); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12224 |
r.insertNode(bef); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12225 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12226 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12227 |
// Normalize |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12228 |
aft.normalize(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12229 |
bef.normalize(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12230 |
|
543 | 12231 |
function first(n) { |
12232 |
return d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false).nextNode() || n; |
|
12233 |
}; |
|
12234 |
||
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:
117
diff
changeset
|
12235 |
// Move cursor and scroll into view |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12236 |
r = d.createRange(); |
778 | 12237 |
r.selectNodeContents(isGecko ? first(car || aft) : car || aft); |
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:
117
diff
changeset
|
12238 |
r.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:
117
diff
changeset
|
12239 |
s.removeAllRanges(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12240 |
s.addRange(r); |
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
|
12241 |
|
543 | 12242 |
// scrollIntoView seems to scroll the parent window in most browsers now including FF 3.0b4 so it's time to stop using it and do it our selfs |
12243 |
y = ed.dom.getPos(aft).y; |
|
12244 |
ch = aft.clientHeight; |
|
12245 |
||
12246 |
// Is element within viewport |
|
12247 |
if (y < vp.y || y + ch > vp.y + vp.h) { |
|
778 | 12248 |
ed.getWin().scrollTo(0, y < vp.y ? y : y - vp.h + 25); // Needs to be hardcoded to roughly one line of text if a huge text block is broken into two blocks |
543 | 12249 |
//console.debug('SCROLL!', 'vp.y: ' + vp.y, 'y' + y, 'vp.h' + vp.h, 'clientHeight' + aft.clientHeight, 'yyy: ' + (y < vp.y ? y : y - vp.h + aft.clientHeight)); |
12250 |
} |
|
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:
117
diff
changeset
|
12251 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12252 |
return 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:
117
diff
changeset
|
12253 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12254 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12255 |
backspaceDelete : function(e, bs) { |
1193 | 12256 |
var t = this, ed = t.editor, b = ed.getBody(), dom = ed.dom, n, se = ed.selection, r = se.getRng(), sc = r.startContainer, n, w, tn; |
12257 |
||
12258 |
/* |
|
12259 |
var par, rng, nextBlock; |
|
12260 |
||
12261 |
// Delete key will not merge paragraphs on Gecko so we need to do this manually |
|
12262 |
// Hitting the delete key at the following caret position doesn't merge the elements <p>A|</p><p>B</p> |
|
12263 |
// This logic will merge them into this: <p>A|B</p> |
|
12264 |
if (e.keyCode == 46) { |
|
12265 |
if (r.collapsed) { |
|
12266 |
par = dom.getParent(sc, 'p,h1,h2,h3,h4,h5,h6,div'); |
|
12267 |
||
12268 |
if (par) { |
|
12269 |
rng = dom.createRng(); |
|
12270 |
||
12271 |
rng.setStart(sc, r.startOffset); |
|
12272 |
rng.setEndAfter(par); |
|
12273 |
||
12274 |
// Get number of characters to the right of the cursor if it's zero then we are at the end and need to merge the next block element |
|
12275 |
if (dom.getOuterHTML(rng.cloneContents()).replace(/<[^>]+>/g, '').length == 0) { |
|
12276 |
nextBlock = dom.getNext(par, 'p,h1,h2,h3,h4,h5,h6,div'); |
|
12277 |
||
12278 |
// Copy all children from next sibling block and remove it |
|
12279 |
if (nextBlock) { |
|
12280 |
each(nextBlock.childNodes, function(node) { |
|
12281 |
par.appendChild(node.cloneNode(true)); |
|
12282 |
}); |
|
12283 |
||
12284 |
dom.remove(nextBlock); |
|
12285 |
} |
|
12286 |
||
12287 |
// Block the default even since the Gecko team might eventually fix this |
|
12288 |
// We will remove this logic once they do we can't feature detect this one |
|
12289 |
e.preventDefault(); |
|
12290 |
return; |
|
12291 |
} |
|
12292 |
} |
|
12293 |
} |
|
12294 |
} |
|
12295 |
*/ |
|
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:
117
diff
changeset
|
12296 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12297 |
// The caret sometimes gets stuck in Gecko if you delete empty paragraphs |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12298 |
// This workaround removes the element by hand and moves the caret to the previous element |
543 | 12299 |
if (sc && ed.dom.isBlock(sc) && !/^(TD|TH)$/.test(sc.nodeName) && bs) { |
12300 |
if (sc.childNodes.length == 0 || (sc.childNodes.length == 1 && sc.firstChild.nodeName == 'BR')) { |
|
12301 |
// Find previous block element |
|
12302 |
n = sc; |
|
12303 |
while ((n = n.previousSibling) && !ed.dom.isBlock(n)) ; |
|
12304 |
||
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
12305 |
if (n) { |
543 | 12306 |
if (sc != b.firstChild) { |
12307 |
// Find last text node |
|
12308 |
w = ed.dom.doc.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false); |
|
12309 |
while (tn = w.nextNode()) |
|
12310 |
n = tn; |
|
12311 |
||
12312 |
// Place caret at the end of last text node |
|
12313 |
r = ed.getDoc().createRange(); |
|
12314 |
r.setStart(n, n.nodeValue ? n.nodeValue.length : 0); |
|
12315 |
r.setEnd(n, n.nodeValue ? n.nodeValue.length : 0); |
|
12316 |
se.setRng(r); |
|
12317 |
||
12318 |
// Remove the target container |
|
12319 |
ed.dom.remove(sc); |
|
12320 |
} |
|
12321 |
||
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:
117
diff
changeset
|
12322 |
return Event.cancel(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:
117
diff
changeset
|
12323 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12324 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12325 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12326 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12327 |
// Gecko generates BR elements here and there, we don't like those so lets remove them |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12328 |
function handler(e) { |
778 | 12329 |
var pr; |
12330 |
||
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:
117
diff
changeset
|
12331 |
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:
117
diff
changeset
|
12332 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12333 |
// A new BR was created in a block element, remove it |
543 | 12334 |
if (e && e.parentNode && e.nodeName == 'BR' && (n = t.getParentBlock(e))) { |
778 | 12335 |
pr = e.previousSibling; |
12336 |
||
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:
117
diff
changeset
|
12337 |
Event.remove(b, 'DOMNodeInserted', handler); |
543 | 12338 |
|
778 | 12339 |
// Is there whitespace at the end of the node before then we might need the pesky BR |
12340 |
// to place the caret at a correct location see bug: #2013943 |
|
12341 |
if (pr && pr.nodeType == 3 && /\s+$/.test(pr.nodeValue)) |
|
12342 |
return; |
|
12343 |
||
543 | 12344 |
// Only remove BR elements that got inserted in the middle of the text |
12345 |
if (e.previousSibling || e.nextSibling) |
|
12346 |
ed.dom.remove(e); |
|
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:
117
diff
changeset
|
12347 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12348 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12349 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12350 |
// Listen for new nodes |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12351 |
Event._add(b, 'DOMNodeInserted', handler); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12352 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12353 |
// Remove listener |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12354 |
window.setTimeout(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:
117
diff
changeset
|
12355 |
Event._remove(b, 'DOMNodeInserted', handler); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12356 |
}, 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:
117
diff
changeset
|
12357 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12358 |
}); |
1193 | 12359 |
})(tinymce); |
12360 |
(function(tinymce) { |
|
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:
117
diff
changeset
|
12361 |
// Shorten names |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12362 |
var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, extend = tinymce.extend; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12363 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12364 |
tinymce.create('tinymce.ControlManager', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12365 |
ControlManager : function(ed, 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:
117
diff
changeset
|
12366 |
var t = this, i; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12367 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12368 |
s = 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:
117
diff
changeset
|
12369 |
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:
117
diff
changeset
|
12370 |
t.controls = {}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12371 |
t.onAdd = new tinymce.util.Dispatcher(t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12372 |
t.onPostRender = new tinymce.util.Dispatcher(t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12373 |
t.prefix = s.prefix || ed.id + '_'; |
543 | 12374 |
t._cls = {}; |
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:
117
diff
changeset
|
12375 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12376 |
t.onPostRender.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:
117
diff
changeset
|
12377 |
each(t.controls, function(c) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12378 |
c.postRender(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12379 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12380 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12381 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12382 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12383 |
get : function(id) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12384 |
return this.controls[this.prefix + id] || this.controls[id]; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12385 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12386 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12387 |
setActive : function(id, 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:
117
diff
changeset
|
12388 |
var c = 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:
117
diff
changeset
|
12389 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12390 |
if (c = this.get(id)) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12391 |
c.setActive(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:
117
diff
changeset
|
12392 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12393 |
return c; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12394 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12395 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12396 |
setDisabled : function(id, 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:
117
diff
changeset
|
12397 |
var c = 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:
117
diff
changeset
|
12398 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12399 |
if (c = this.get(id)) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12400 |
c.setDisabled(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:
117
diff
changeset
|
12401 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12402 |
return c; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12403 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12404 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12405 |
add : function(c) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12406 |
var t = 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:
117
diff
changeset
|
12407 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12408 |
if (c) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12409 |
t.controls[c.id] = c; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12410 |
t.onAdd.dispatch(c, t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12411 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12412 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12413 |
return c; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12414 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12415 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12416 |
createControl : 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:
117
diff
changeset
|
12417 |
var c, 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:
117
diff
changeset
|
12418 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12419 |
each(ed.plugins, function(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:
117
diff
changeset
|
12420 |
if (p.createControl) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12421 |
c = p.createControl(n, t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12422 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12423 |
if (c) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12424 |
return 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:
117
diff
changeset
|
12425 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12426 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12427 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12428 |
switch (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:
117
diff
changeset
|
12429 |
case "|": |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12430 |
case "separator": |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12431 |
return t.createSeparator(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12432 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12433 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12434 |
if (!c && ed.buttons && (c = ed.buttons[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:
117
diff
changeset
|
12435 |
return t.createButton(n, c); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12436 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12437 |
return t.add(c); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12438 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12439 |
|
543 | 12440 |
createDropMenu : function(id, s, cc) { |
12441 |
var t = this, ed = t.editor, c, bm, v, cls; |
|
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:
117
diff
changeset
|
12442 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12443 |
s = extend({ |
543 | 12444 |
'class' : 'mceDropDown', |
12445 |
constrain : ed.settings.constrain_menus |
|
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:
117
diff
changeset
|
12446 |
}, 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:
117
diff
changeset
|
12447 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12448 |
s['class'] = s['class'] + ' ' + ed.getParam('skin') + 'Skin'; |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
12449 |
if (v = ed.getParam('skin_variant')) |
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
12450 |
s['class'] += ' ' + ed.getParam('skin') + 'Skin' + v.substring(0, 1).toUpperCase() + v.substring(1); |
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:
117
diff
changeset
|
12451 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12452 |
id = t.prefix + id; |
543 | 12453 |
cls = cc || t._cls.dropmenu || tinymce.ui.DropMenu; |
12454 |
c = t.controls[id] = new cls(id, s); |
|
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:
117
diff
changeset
|
12455 |
c.onAddItem.add(function(c, 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:
117
diff
changeset
|
12456 |
var s = o.settings; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12457 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12458 |
s.title = ed.getLang(s.title, s.title); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12459 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12460 |
if (!s.onclick) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12461 |
s.onclick = function(v) { |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
12462 |
ed.execCommand(s.cmd, s.ui || false, s.value); |
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:
117
diff
changeset
|
12463 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12464 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12465 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12466 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12467 |
ed.onRemove.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:
117
diff
changeset
|
12468 |
c.destroy(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12469 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12470 |
|
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
12471 |
// Fix for bug #1897785, #1898007 |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
12472 |
if (tinymce.isIE) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
12473 |
c.onShowMenu.add(function() { |
1193 | 12474 |
// IE 8 needs focus in order to store away a range with the current collapsed caret location |
12475 |
ed.focus(); |
|
12476 |
||
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
12477 |
bm = ed.selection.getBookmark(1); |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
12478 |
}); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
12479 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
12480 |
c.onHideMenu.add(function() { |
1193 | 12481 |
if (bm) { |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
12482 |
ed.selection.moveToBookmark(bm); |
1193 | 12483 |
bm = 0; |
12484 |
} |
|
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
12485 |
}); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
12486 |
} |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
12487 |
|
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:
117
diff
changeset
|
12488 |
return t.add(c); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12489 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12490 |
|
543 | 12491 |
createListBox : function(id, s, cc) { |
12492 |
var t = this, ed = t.editor, cmd, c, cls; |
|
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:
117
diff
changeset
|
12493 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12494 |
if (t.get(id)) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12495 |
return 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:
117
diff
changeset
|
12496 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12497 |
s.title = ed.translate(s.title); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12498 |
s.scope = s.scope || 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:
117
diff
changeset
|
12499 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12500 |
if (!s.onselect) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12501 |
s.onselect = 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:
117
diff
changeset
|
12502 |
ed.execCommand(s.cmd, s.ui || false, v || s.value); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12503 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12504 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12505 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12506 |
s = extend({ |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12507 |
title : s.title, |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
12508 |
'class' : 'mce_' + id, |
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:
117
diff
changeset
|
12509 |
scope : s.scope, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12510 |
control_manager : t |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12511 |
}, 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:
117
diff
changeset
|
12512 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12513 |
id = t.prefix + id; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12514 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12515 |
if (ed.settings.use_native_selects) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12516 |
c = new tinymce.ui.NativeListBox(id, s); |
543 | 12517 |
else { |
12518 |
cls = cc || t._cls.listbox || tinymce.ui.ListBox; |
|
12519 |
c = new cls(id, s); |
|
12520 |
} |
|
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:
117
diff
changeset
|
12521 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12522 |
t.controls[id] = c; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12523 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12524 |
// Fix focus problem in 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:
117
diff
changeset
|
12525 |
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:
117
diff
changeset
|
12526 |
c.onPostRender.add(function(c, 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:
117
diff
changeset
|
12527 |
// Store bookmark on mousedown |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12528 |
Event.add(n, 'mousedown', function() { |
1193 | 12529 |
ed.bookmark = ed.selection.getBookmark(1); |
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:
117
diff
changeset
|
12530 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12531 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12532 |
// Restore on focus, since it might be lost |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12533 |
Event.add(n, 'focus', 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:
117
diff
changeset
|
12534 |
ed.selection.moveToBookmark(ed.bookmark); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12535 |
ed.bookmark = 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:
117
diff
changeset
|
12536 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12537 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12538 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12539 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12540 |
if (c.hideMenu) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12541 |
ed.onMouseDown.add(c.hideMenu, c); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12542 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12543 |
return t.add(c); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12544 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12545 |
|
543 | 12546 |
createButton : function(id, s, cc) { |
12547 |
var t = this, ed = t.editor, o, c, cls; |
|
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:
117
diff
changeset
|
12548 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12549 |
if (t.get(id)) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12550 |
return 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:
117
diff
changeset
|
12551 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12552 |
s.title = ed.translate(s.title); |
543 | 12553 |
s.label = ed.translate(s.label); |
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:
117
diff
changeset
|
12554 |
s.scope = s.scope || 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:
117
diff
changeset
|
12555 |
|
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
|
12556 |
if (!s.onclick && !s.menu_button) { |
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:
117
diff
changeset
|
12557 |
s.onclick = 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:
117
diff
changeset
|
12558 |
ed.execCommand(s.cmd, s.ui || false, s.value); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12559 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12560 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12561 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12562 |
s = extend({ |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12563 |
title : s.title, |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
12564 |
'class' : 'mce_' + id, |
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:
117
diff
changeset
|
12565 |
unavailable_prefix : ed.getLang('unavailable', ''), |
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
|
12566 |
scope : s.scope, |
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
|
12567 |
control_manager : t |
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:
117
diff
changeset
|
12568 |
}, 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:
117
diff
changeset
|
12569 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12570 |
id = t.prefix + id; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12571 |
|
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
|
12572 |
if (s.menu_button) { |
543 | 12573 |
cls = cc || t._cls.menubutton || tinymce.ui.MenuButton; |
12574 |
c = new cls(id, s); |
|
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
|
12575 |
ed.onMouseDown.add(c.hideMenu, c); |
543 | 12576 |
} else { |
12577 |
cls = t._cls.button || tinymce.ui.Button; |
|
12578 |
c = new cls(id, s); |
|
12579 |
} |
|
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
|
12580 |
|
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
|
12581 |
return t.add(c); |
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
|
12582 |
}, |
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
|
12583 |
|
778 | 12584 |
createMenuButton : function(id, s, cc) { |
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
|
12585 |
s = s || {}; |
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
|
12586 |
s.menu_button = 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
|
12587 |
|
778 | 12588 |
return this.createButton(id, s, cc); |
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:
117
diff
changeset
|
12589 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12590 |
|
543 | 12591 |
createSplitButton : function(id, s, cc) { |
12592 |
var t = this, ed = t.editor, cmd, c, cls; |
|
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:
117
diff
changeset
|
12593 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12594 |
if (t.get(id)) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12595 |
return 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:
117
diff
changeset
|
12596 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12597 |
s.title = ed.translate(s.title); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12598 |
s.scope = s.scope || 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:
117
diff
changeset
|
12599 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12600 |
if (!s.onclick) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12601 |
s.onclick = 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:
117
diff
changeset
|
12602 |
ed.execCommand(s.cmd, s.ui || false, v || s.value); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12603 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12604 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12605 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12606 |
if (!s.onselect) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12607 |
s.onselect = 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:
117
diff
changeset
|
12608 |
ed.execCommand(s.cmd, s.ui || false, v || s.value); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12609 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12610 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12611 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12612 |
s = extend({ |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12613 |
title : s.title, |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
12614 |
'class' : 'mce_' + id, |
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:
117
diff
changeset
|
12615 |
scope : s.scope, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12616 |
control_manager : t |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12617 |
}, 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:
117
diff
changeset
|
12618 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12619 |
id = t.prefix + id; |
543 | 12620 |
cls = cc || t._cls.splitbutton || tinymce.ui.SplitButton; |
12621 |
c = t.add(new cls(id, s)); |
|
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:
117
diff
changeset
|
12622 |
ed.onMouseDown.add(c.hideMenu, c); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12623 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12624 |
return c; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12625 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12626 |
|
543 | 12627 |
createColorSplitButton : function(id, s, cc) { |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
12628 |
var t = this, ed = t.editor, cmd, c, cls, 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:
117
diff
changeset
|
12629 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12630 |
if (t.get(id)) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12631 |
return 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:
117
diff
changeset
|
12632 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12633 |
s.title = ed.translate(s.title); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12634 |
s.scope = s.scope || 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:
117
diff
changeset
|
12635 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12636 |
if (!s.onclick) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12637 |
s.onclick = function(v) { |
1193 | 12638 |
if (tinymce.isIE) |
12639 |
bm = ed.selection.getBookmark(1); |
|
12640 |
||
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:
117
diff
changeset
|
12641 |
ed.execCommand(s.cmd, s.ui || false, v || s.value); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12642 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12643 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12644 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12645 |
if (!s.onselect) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12646 |
s.onselect = 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:
117
diff
changeset
|
12647 |
ed.execCommand(s.cmd, s.ui || false, v || s.value); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12648 |
}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12649 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12650 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12651 |
s = extend({ |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12652 |
title : s.title, |
476
f26a69c40431
Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
459
diff
changeset
|
12653 |
'class' : 'mce_' + id, |
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:
117
diff
changeset
|
12654 |
'menu_class' : ed.getParam('skin') + 'Skin', |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12655 |
scope : s.scope, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12656 |
more_colors_title : ed.getLang('more_colors') |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12657 |
}, 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:
117
diff
changeset
|
12658 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12659 |
id = t.prefix + id; |
543 | 12660 |
cls = cc || t._cls.colorsplitbutton || tinymce.ui.ColorSplitButton; |
12661 |
c = new cls(id, s); |
|
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:
117
diff
changeset
|
12662 |
ed.onMouseDown.add(c.hideMenu, c); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12663 |
|
543 | 12664 |
// Remove the menu element when the editor is removed |
12665 |
ed.onRemove.add(function() { |
|
12666 |
c.destroy(); |
|
12667 |
}); |
|
12668 |
||
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
12669 |
// Fix for bug #1897785, #1898007 |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
12670 |
if (tinymce.isIE) { |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
12671 |
c.onShowMenu.add(function() { |
1193 | 12672 |
// IE 8 needs focus in order to store away a range with the current collapsed caret location |
12673 |
ed.focus(); |
|
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
12674 |
bm = ed.selection.getBookmark(1); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
12675 |
}); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
12676 |
|
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
12677 |
c.onHideMenu.add(function() { |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
12678 |
if (bm) { |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
12679 |
ed.selection.moveToBookmark(bm); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
12680 |
bm = 0; |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
12681 |
} |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
12682 |
}); |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
12683 |
} |
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
12684 |
|
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:
117
diff
changeset
|
12685 |
return t.add(c); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12686 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12687 |
|
543 | 12688 |
createToolbar : function(id, s, cc) { |
12689 |
var c, t = this, cls; |
|
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
|
12690 |
|
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
|
12691 |
id = t.prefix + id; |
543 | 12692 |
cls = cc || t._cls.toolbar || tinymce.ui.Toolbar; |
12693 |
c = new cls(id, s); |
|
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
|
12694 |
|
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
|
12695 |
if (t.get(id)) |
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:
117
diff
changeset
|
12696 |
return 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:
117
diff
changeset
|
12697 |
|
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
|
12698 |
return t.add(c); |
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:
117
diff
changeset
|
12699 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12700 |
|
543 | 12701 |
createSeparator : function(cc) { |
12702 |
var cls = cc || this._cls.separator || tinymce.ui.Separator; |
|
12703 |
||
12704 |
return new cls(); |
|
12705 |
}, |
|
12706 |
||
12707 |
setControlType : function(n, c) { |
|
12708 |
return this._cls[n.toLowerCase()] = c; |
|
12709 |
}, |
|
1193 | 12710 |
|
543 | 12711 |
destroy : function() { |
12712 |
each(this.controls, function(c) { |
|
12713 |
c.destroy(); |
|
12714 |
}); |
|
12715 |
||
12716 |
this.controls = null; |
|
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:
117
diff
changeset
|
12717 |
} |
1193 | 12718 |
}); |
12719 |
})(tinymce); |
|
12720 |
(function(tinymce) { |
|
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:
117
diff
changeset
|
12721 |
var Dispatcher = tinymce.util.Dispatcher, each = tinymce.each, isIE = tinymce.isIE, isOpera = tinymce.isOpera; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12722 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12723 |
tinymce.create('tinymce.WindowManager', { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12724 |
WindowManager : 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:
117
diff
changeset
|
12725 |
var t = 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:
117
diff
changeset
|
12726 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12727 |
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:
117
diff
changeset
|
12728 |
t.onOpen = new Dispatcher(t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12729 |
t.onClose = new Dispatcher(t); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12730 |
t.params = {}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12731 |
t.features = {}; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12732 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12733 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12734 |
open : function(s, p) { |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
12735 |
var t = this, f = '', x, y, mo = t.editor.settings.dialog_type == 'modal', w, sw, sh, vp = tinymce.DOM.getViewPort(), u; |
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:
117
diff
changeset
|
12736 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12737 |
// Default some options |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12738 |
s = 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:
117
diff
changeset
|
12739 |
p = 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:
117
diff
changeset
|
12740 |
sw = isOpera ? vp.w : screen.width; // Opera uses windows inside the Opera window |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12741 |
sh = isOpera ? vp.h : screen.height; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12742 |
s.name = s.name || 'mc_' + new Date().getTime(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12743 |
s.width = parseInt(s.width || 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:
117
diff
changeset
|
12744 |
s.height = parseInt(s.height || 240); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12745 |
s.resizable = 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:
117
diff
changeset
|
12746 |
s.left = s.left || parseInt(sw / 2.0) - (s.width / 2.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:
117
diff
changeset
|
12747 |
s.top = s.top || parseInt(sh / 2.0) - (s.height / 2.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:
117
diff
changeset
|
12748 |
p.inline = 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:
117
diff
changeset
|
12749 |
p.mce_width = s.width; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12750 |
p.mce_height = s.height; |
543 | 12751 |
p.mce_auto_focus = s.auto_focus; |
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:
117
diff
changeset
|
12752 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12753 |
if (mo) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12754 |
if (isIE) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12755 |
s.center = 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:
117
diff
changeset
|
12756 |
s.help = 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:
117
diff
changeset
|
12757 |
s.dialogWidth = s.width + 'px'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12758 |
s.dialogHeight = s.height + 'px'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12759 |
s.scroll = s.scrollbars || false; |
588
20484deb89cd
Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents:
543
diff
changeset
|
12760 |
} |
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:
117
diff
changeset
|
12761 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12762 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12763 |
// Build features string |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12764 |
each(s, function(v, k) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12765 |
if (tinymce.is(v, 'boolean')) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12766 |
v = v ? 'yes' : 'no'; |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12767 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12768 |
if (!/^(name|url)$/.test(k)) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12769 |
if (isIE && mo) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12770 |
f += (f ? ';' : '') + k + ':' + 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:
117
diff
changeset
|
12771 |
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:
117
diff
changeset
|
12772 |
f += (f ? ',' : '') + k + '=' + 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:
117
diff
changeset
|
12773 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12774 |
}); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12775 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12776 |
t.features = 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:
117
diff
changeset
|
12777 |
t.params = 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:
117
diff
changeset
|
12778 |
t.onOpen.dispatch(t, s, 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:
117
diff
changeset
|
12779 |
|
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
12780 |
u = s.url || s.file; |
543 | 12781 |
u = tinymce._addVer(u); |
12782 |
||
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:
117
diff
changeset
|
12783 |
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:
117
diff
changeset
|
12784 |
if (isIE && mo) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12785 |
w = 1; |
543 | 12786 |
window.showModalDialog(u, window, f); |
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:
117
diff
changeset
|
12787 |
} else |
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
12788 |
w = window.open(u, s.name, f); |
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:
117
diff
changeset
|
12789 |
} 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:
117
diff
changeset
|
12790 |
// Ignore |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12791 |
} |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12792 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12793 |
if (!w) |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12794 |
alert(t.editor.getLang('popup_blocked')); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12795 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12796 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12797 |
close : function(w) { |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12798 |
w.close(); |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12799 |
this.onClose.dispatch(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:
117
diff
changeset
|
12800 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12801 |
|
459
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
12802 |
createInstance : function(cl, a, b, c, d, e) { |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
12803 |
var f = tinymce.resolve(cl); |
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
12804 |
|
31c23016ab62
Upgraded tinyMCE to 3.0.1 in hopes of fixing IE race conditions. Fixed a couple minor syntax errors in Javascript objects declared in various places.
Dan
parents:
395
diff
changeset
|
12805 |
return new f(a, b, c, d, e); |
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:
117
diff
changeset
|
12806 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12807 |
|
778 | 12808 |
confirm : function(t, cb, s, w) { |
12809 |
w = w || window; |
|
12810 |
||
12811 |
cb.call(s || this, w.confirm(this._decode(this.editor.getLang(t, t)))); |
|
12812 |
}, |
|
12813 |
||
12814 |
alert : function(tx, cb, s, w) { |
|
543 | 12815 |
var t = this; |
778 | 12816 |
|
12817 |
w = w || window; |
|
12818 |
w.alert(t._decode(t.editor.getLang(tx, tx))); |
|
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:
117
diff
changeset
|
12819 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12820 |
if (cb) |
543 | 12821 |
cb.call(s || t); |
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:
117
diff
changeset
|
12822 |
}, |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12823 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12824 |
// Internal functions |
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12825 |
|
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
117
diff
changeset
|
12826 |
_decode : function(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:
117
diff
changeset
|
12827 |
return tinymce.DOM.decode(s).replace(/\\n/g, '\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:
117
diff
changeset
|
12828 |
} |
1193 | 12829 |
}); |
12830 |
}(tinymce));(function(tinymce) { |
|
12831 |
tinymce.CommandManager = function() { |
|
12832 |
var execCommands = {}, queryStateCommands = {}, queryValueCommands = {}; |
|
12833 |
||
12834 |
function add(collection, cmd, func, scope) { |
|
12835 |
if (typeof(cmd) == 'string') |
|
12836 |
cmd = [cmd]; |
|
12837 |
||
12838 |
tinymce.each(cmd, function(cmd) { |
|
12839 |
collection[cmd.toLowerCase()] = {func : func, scope : scope}; |
|
12840 |
}); |
|
12841 |
}; |
|
12842 |
||
12843 |
tinymce.extend(this, { |
|
12844 |
add : function(cmd, func, scope) { |
|
12845 |
add(execCommands, cmd, func, scope); |
|
12846 |
}, |
|
12847 |
||
12848 |
addQueryStateHandler : function(cmd, func, scope) { |
|
12849 |
add(queryStateCommands, cmd, func, scope); |
|
12850 |
}, |
|
12851 |
||
12852 |
addQueryValueHandler : function(cmd, func, scope) { |
|
12853 |
add(queryValueCommands, cmd, func, scope); |
|
12854 |
}, |
|
12855 |
||
12856 |
execCommand : function(scope, cmd, ui, value, args) { |
|
12857 |
if (cmd = execCommands[cmd.toLowerCase()]) { |
|
12858 |
if (cmd.func.call(scope || cmd.scope, ui, value, args) !== false) |
|
12859 |
return true; |
|
12860 |
} |
|
12861 |
}, |
|
12862 |
||
12863 |
queryCommandValue : function() { |
|
12864 |
if (cmd = queryValueCommands[cmd.toLowerCase()]) |
|
12865 |
return cmd.func.call(scope || cmd.scope, ui, value, args); |
|
12866 |
}, |
|
12867 |
||
12868 |
queryCommandState : function() { |
|
12869 |
if (cmd = queryStateCommands[cmd.toLowerCase()]) |
|
12870 |
return cmd.func.call(scope || cmd.scope, ui, value, args); |
|
12871 |
} |
|
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:
117
diff
changeset
|
12872 |
}); |
1193 | 12873 |
}; |
12874 |
||
12875 |
tinymce.GlobalCommands = new tinymce.CommandManager(); |
|
12876 |
})(tinymce);(function(tinymce) { |
|
12877 |
function processRange(dom, start, end, callback) { |
|
12878 |
var ancestor, n, startPoint, endPoint, sib; |
|
12879 |
||
12880 |
function findEndPoint(n, c) { |
|
12881 |
do { |
|
12882 |
if (n.parentNode == c) |
|
12883 |
return n; |
|
12884 |
||
12885 |
n = n.parentNode; |
|
12886 |
} while(n); |
|
12887 |
}; |
|
12888 |
||
12889 |
function process(n) { |
|
12890 |
callback(n); |
|
12891 |
tinymce.walk(n, callback, 'childNodes'); |
|
12892 |
}; |
|
12893 |
||
12894 |
// Find common ancestor and end points |
|
12895 |
ancestor = dom.findCommonAncestor(start, end); |
|
12896 |
startPoint = findEndPoint(start, ancestor) || start; |
|
12897 |
endPoint = findEndPoint(end, ancestor) || end; |
|
12898 |
||
12899 |
// Process left leaf |
|
12900 |
for (n = start; n && n != startPoint; n = n.parentNode) { |
|
12901 |
for (sib = n.nextSibling; sib; sib = sib.nextSibling) |
|
12902 |
process(sib); |
|
12903 |
} |
|
12904 |
||
12905 |
// Process middle from start to end point |
|
12906 |
if (startPoint != endPoint) { |
|
12907 |
for (n = startPoint.nextSibling; n && n != endPoint; n = n.nextSibling) |
|
12908 |
process(n); |
|
12909 |
} else |
|
12910 |
process(startPoint); |
|
12911 |
||
12912 |
// Process right leaf |
|
12913 |
for (n = end; n && n != endPoint; n = n.parentNode) { |
|
12914 |
for (sib = n.previousSibling; sib; sib = sib.previousSibling) |
|
12915 |
process(sib); |
|
12916 |
} |
|
12917 |
}; |
|
12918 |
||
12919 |
tinymce.GlobalCommands.add('RemoveFormat', function() { |
|
12920 |
var ed = this, dom = ed.dom, s = ed.selection, r = s.getRng(1), nodes = [], bm, start, end, sc, so, ec, eo, n; |
|
12921 |
||
12922 |
function findFormatRoot(n) { |
|
12923 |
var sp; |
|
12924 |
||
12925 |
dom.getParent(n, function(n) { |
|
12926 |
if (dom.is(n, ed.getParam('removeformat_selector'))) |
|
12927 |
sp = n; |
|
12928 |
||
12929 |
return dom.isBlock(n); |
|
12930 |
}, ed.getBody()); |
|
12931 |
||
12932 |
return sp; |
|
12933 |
}; |
|
12934 |
||
12935 |
function collect(n) { |
|
12936 |
if (dom.is(n, ed.getParam('removeformat_selector'))) |
|
12937 |
nodes.push(n); |
|
12938 |
}; |
|
12939 |
||
12940 |
function walk(n) { |
|
12941 |
collect(n); |
|
12942 |
tinymce.walk(n, collect, 'childNodes'); |
|
12943 |
}; |
|
12944 |
||
12945 |
bm = s.getBookmark(); |
|
12946 |
sc = r.startContainer; |
|
12947 |
ec = r.endContainer; |
|
12948 |
so = r.startOffset; |
|
12949 |
eo = r.endOffset; |
|
12950 |
sc = sc.nodeType == 1 ? sc.childNodes[Math.min(so, sc.childNodes.length - 1)] : sc; |
|
12951 |
ec = ec.nodeType == 1 ? ec.childNodes[Math.min(so == eo ? eo : eo - 1, ec.childNodes.length - 1)] : ec; |
|
12952 |
||
12953 |
// Same container |
|
12954 |
if (sc == ec) { // TEXT_NODE |
|
12955 |
start = findFormatRoot(sc); |
|
12956 |
||
12957 |
// Handle single text node |
|
12958 |
if (sc.nodeType == 3) { |
|
12959 |
if (start && start.nodeType == 1) { // ELEMENT |
|
12960 |
n = sc.splitText(so); |
|
12961 |
n.splitText(eo - so); |
|
12962 |
dom.split(start, n); |
|
12963 |
||
12964 |
s.moveToBookmark(bm); |
|
12965 |
} |
|
12966 |
||
12967 |
return; |
|
12968 |
} |
|
12969 |
||
12970 |
// Handle single element |
|
12971 |
walk(dom.split(start, sc) || sc); |
|
12972 |
} else { |
|
12973 |
// Find start/end format root |
|
12974 |
start = findFormatRoot(sc); |
|
12975 |
end = findFormatRoot(ec); |
|
12976 |
||
12977 |
// Split start text node |
|
12978 |
if (start) { |
|
12979 |
if (sc.nodeType == 3) { // TEXT |
|
12980 |
// Since IE doesn't support white space nodes in the DOM we need to |
|
12981 |
// add this invisible character so that the splitText function can split the contents |
|
12982 |
if (so == sc.nodeValue.length) |
|
12983 |
sc.nodeValue += '\uFEFF'; // Yet another pesky IE fix |
|
12984 |
||
12985 |
sc = sc.splitText(so); |
|
12986 |
} |
|
12987 |
} |
|
12988 |
||
12989 |
// Split end text node |
|
12990 |
if (end) { |
|
12991 |
if (ec.nodeType == 3) // TEXT |
|
12992 |
ec.splitText(eo); |
|
12993 |
} |
|
12994 |
||
12995 |
// If the start and end format root is the same then we need to wrap |
|
12996 |
// the end node in a span since the split calls might change the reference |
|
12997 |
// Example: <p><b><em>x[yz<span>---</span>12]3</em></b></p> |
|
12998 |
if (start && start == end) |
|
12999 |
dom.replace(dom.create('span', {id : '__end'}, ec.cloneNode(true)), ec); |
|
13000 |
||
13001 |
// Split all start containers down to the format root |
|
13002 |
if (start) |
|
13003 |
start = dom.split(start, sc); |
|
13004 |
else |
|
13005 |
start = sc; |
|
13006 |
||
13007 |
// If there is a span wrapper use that one instead |
|
13008 |
if (n = dom.get('__end')) { |
|
13009 |
ec = n; |
|
13010 |
end = findFormatRoot(ec); |
|
13011 |
} |
|
13012 |
||
13013 |
// Split all end containers down to the format root |
|
13014 |
if (end) |
|
13015 |
end = dom.split(end, ec); |
|
13016 |
else |
|
13017 |
end = ec; |
|
13018 |
||
13019 |
// Collect nodes in between |
|
13020 |
processRange(dom, start, end, collect); |
|
13021 |
||
13022 |
// Remove invisible character for IE workaround if we find it |
|
13023 |
if (sc.nodeValue == '\uFEFF') |
|
13024 |
sc.nodeValue = ''; |
|
13025 |
||
13026 |
// Process start/end container elements |
|
13027 |
walk(ec); |
|
13028 |
walk(sc); |
|
13029 |
} |
|
13030 |
||
13031 |
// Remove all collected nodes |
|
13032 |
tinymce.each(nodes, function(n) { |
|
13033 |
dom.remove(n, 1); |
|
13034 |
}); |
|
13035 |
||
13036 |
// Remove leftover wrapper |
|
13037 |
dom.remove('__end', 1); |
|
13038 |
||
13039 |
s.moveToBookmark(bm); |
|
13040 |
}); |
|
13041 |
})(tinymce); |
|
13042 |
(function(tinymce) { |
|
13043 |
tinymce.GlobalCommands.add('mceBlockQuote', function() { |
|
13044 |
var ed = this, s = ed.selection, dom = ed.dom, sb, eb, n, bm, bq, r, bq2, i, nl; |
|
13045 |
||
13046 |
function getBQ(e) { |
|
13047 |
return dom.getParent(e, function(n) {return n.nodeName === 'BLOCKQUOTE';}); |
|
13048 |
}; |
|
13049 |
||
13050 |
// Get start/end block |
|
13051 |
sb = dom.getParent(s.getStart(), dom.isBlock); |
|
13052 |
eb = dom.getParent(s.getEnd(), dom.isBlock); |
|
13053 |
||
13054 |
// Remove blockquote(s) |
|
13055 |
if (bq = getBQ(sb)) { |
|
13056 |
if (sb != eb || sb.childNodes.length > 1 || (sb.childNodes.length == 1 && sb.firstChild.nodeName != 'BR')) |
|
13057 |
bm = s.getBookmark(); |
|
13058 |
||
13059 |
// Move all elements after the end block into new bq |
|
13060 |
if (getBQ(eb)) { |
|
13061 |
bq2 = bq.cloneNode(false); |
|
13062 |
||
13063 |
while (n = eb.nextSibling) |
|
13064 |
bq2.appendChild(n.parentNode.removeChild(n)); |
|
13065 |
} |
|
13066 |
||
13067 |
// Add new bq after |
|
13068 |
if (bq2) |
|
13069 |
dom.insertAfter(bq2, bq); |
|
13070 |
||
13071 |
// Move all selected blocks after the current bq |
|
13072 |
nl = s.getSelectedBlocks(sb, eb); |
|
13073 |
for (i = nl.length - 1; i >= 0; i--) { |
|
13074 |
dom.insertAfter(nl[i], bq); |
|
13075 |
} |
|
13076 |
||
13077 |
// Empty bq, then remove it |
|
13078 |
if (/^\s*$/.test(bq.innerHTML)) |
|
13079 |
dom.remove(bq, 1); // Keep children so boomark restoration works correctly |
|
13080 |
||
13081 |
// Empty bq, then remote it |
|
13082 |
if (bq2 && /^\s*$/.test(bq2.innerHTML)) |
|
13083 |
dom.remove(bq2, 1); // Keep children so boomark restoration works correctly |
|
13084 |
||
13085 |
if (!bm) { |
|
13086 |
// Move caret inside empty block element |
|
13087 |
if (!tinymce.isIE) { |
|
13088 |
r = ed.getDoc().createRange(); |
|
13089 |
r.setStart(sb, 0); |
|
13090 |
r.setEnd(sb, 0); |
|
13091 |
s.setRng(r); |
|
13092 |
} else { |
|
13093 |
s.select(sb); |
|
13094 |
s.collapse(0); |
|
13095 |
||
13096 |
// IE misses the empty block some times element so we must move back the caret |
|
13097 |
if (dom.getParent(s.getStart(), dom.isBlock) != sb) { |
|
13098 |
r = s.getRng(); |
|
13099 |
r.move('character', -1); |
|
13100 |
r.select(); |
|
13101 |
} |
|
13102 |
} |
|
13103 |
} else |
|
13104 |
ed.selection.moveToBookmark(bm); |
|
13105 |
||
13106 |
return; |
|
13107 |
} |
|
13108 |
||
13109 |
// Since IE can start with a totally empty document we need to add the first bq and paragraph |
|
13110 |
if (tinymce.isIE && !sb && !eb) { |
|
13111 |
ed.getDoc().execCommand('Indent'); |
|
13112 |
n = getBQ(s.getNode()); |
|
13113 |
n.style.margin = n.dir = ''; // IE adds margin and dir to bq |
|
13114 |
return; |
|
13115 |
} |
|
13116 |
||
13117 |
if (!sb || !eb) |
|
13118 |
return; |
|
13119 |
||
13120 |
// If empty paragraph node then do not use bookmark |
|
13121 |
if (sb != eb || sb.childNodes.length > 1 || (sb.childNodes.length == 1 && sb.firstChild.nodeName != 'BR')) |
|
13122 |
bm = s.getBookmark(); |
|
13123 |
||
13124 |
// Move selected block elements into a bq |
|
13125 |
tinymce.each(s.getSelectedBlocks(getBQ(s.getStart()), getBQ(s.getEnd())), function(e) { |
|
13126 |
// Found existing BQ add to this one |
|
13127 |
if (e.nodeName == 'BLOCKQUOTE' && !bq) { |
|
13128 |
bq = e; |
|
13129 |
return; |
|
13130 |
} |
|
13131 |
||
13132 |
// No BQ found, create one |
|
13133 |
if (!bq) { |
|
13134 |
bq = dom.create('blockquote'); |
|
13135 |
e.parentNode.insertBefore(bq, e); |
|
13136 |
} |
|
13137 |
||
13138 |
// Add children from existing BQ |
|
13139 |
if (e.nodeName == 'BLOCKQUOTE' && bq) { |
|
13140 |
n = e.firstChild; |
|
13141 |
||
13142 |
while (n) { |
|
13143 |
bq.appendChild(n.cloneNode(true)); |
|
13144 |
n = n.nextSibling; |
|
13145 |
} |
|
13146 |
||
13147 |
dom.remove(e); |
|
13148 |
return; |
|
13149 |
} |
|
13150 |
||
13151 |
// Add non BQ element to BQ |
|
13152 |
bq.appendChild(dom.remove(e)); |
|
13153 |
}); |
|
13154 |
||
13155 |
if (!bm) { |
|
13156 |
// Move caret inside empty block element |
|
13157 |
if (!tinymce.isIE) { |
|
13158 |
r = ed.getDoc().createRange(); |
|
13159 |
r.setStart(sb, 0); |
|
13160 |
r.setEnd(sb, 0); |
|
13161 |
s.setRng(r); |
|
13162 |
} else { |
|
13163 |
s.select(sb); |
|
13164 |
s.collapse(1); |
|
13165 |
} |
|
13166 |
} else |
|
13167 |
s.moveToBookmark(bm); |
|
13168 |
}); |
|
13169 |
})(tinymce); |
|
13170 |
(function(tinymce) { |
|
13171 |
tinymce.each(['Cut', 'Copy', 'Paste'], function(cmd) { |
|
13172 |
tinymce.GlobalCommands.add(cmd, function() { |
|
13173 |
var ed = this, doc = ed.getDoc(); |
|
13174 |
||
13175 |
try { |
|
13176 |
doc.execCommand(cmd, false, null); |
|
13177 |
||
13178 |
// On WebKit the command will just be ignored if it's not enabled |
|
13179 |
if (!doc.queryCommandEnabled(cmd)) |
|
13180 |
throw 'Error'; |
|
13181 |
} catch (ex) { |
|
13182 |
if (tinymce.isGecko) { |
|
13183 |
ed.windowManager.confirm(ed.getLang('clipboard_msg'), function(s) { |
|
13184 |
if (s) |
|
13185 |
open('http://www.mozilla.org/editor/midasdemo/securityprefs.html', '_blank'); |
|
13186 |
}); |
|
13187 |
} else |
|
13188 |
ed.windowManager.alert(ed.getLang('clipboard_no_support')); |
|
13189 |
} |
|
13190 |
}); |
|
13191 |
}); |
|
13192 |
})(tinymce); |
|
13193 |
(function(tinymce) { |
|
13194 |
tinymce.GlobalCommands.add('InsertHorizontalRule', function() { |
|
13195 |
if (tinymce.isOpera) |
|
13196 |
return this.getDoc().execCommand('InsertHorizontalRule', false, ''); |
|
13197 |
||
13198 |
this.selection.setContent('<hr />'); |
|
13199 |
}); |
|
13200 |
})(tinymce); |
|
13201 |
(function() { |
|
13202 |
var cmds = tinymce.GlobalCommands; |
|
13203 |
||
13204 |
cmds.add(['mceEndUndoLevel', 'mceAddUndoLevel'], function() { |
|
13205 |
this.undoManager.add(); |
|
13206 |
}); |
|
13207 |
||
13208 |
cmds.add('Undo', function() { |
|
13209 |
var ed = this; |
|
13210 |
||
13211 |
if (ed.settings.custom_undo_redo) { |
|
13212 |
ed.undoManager.undo(); |
|
13213 |
ed.nodeChanged(); |
|
13214 |
return true; |
|
13215 |
} |
|
13216 |
||
13217 |
return false; // Run browser command |
|
13218 |
}); |
|
13219 |
||
13220 |
cmds.add('Redo', function() { |
|
13221 |
var ed = this; |
|
13222 |
||
13223 |
if (ed.settings.custom_undo_redo) { |
|
13224 |
ed.undoManager.redo(); |
|
13225 |
ed.nodeChanged(); |
|
13226 |
return true; |
|
13227 |
} |
|
13228 |
||
13229 |
return false; // Run browser command |
|
13230 |
}); |
|
13231 |
})(); |