No regular expressions were active.
|
|
1 |
|
/**
|
|
|
2 |
|
* $Id: ed
itor_plugi
n_src.js 2
64 2007-04
-26 20:53:
09Z spocke
$
|
|
|
3 |
|
*
|
|
|
4 |
|
* @author
Moxiecode
|
|
|
5 |
|
* @copyri
ght Copyri
ght © 2004
-2008, Mox
iecode Sys
tems AB, A
ll rights
reserved.
|
|
|
6 |
|
*/
|
|
|
7 |
|
|
|
|
8 |
|
(function(
) {
|
|
|
9 |
|
var DO
M = tinymc
e.DOM, Eve
nt = tinym
ce.dom.Eve
nt, each =
tinymce.e
ach, is =
tinymce.is
;
|
|
|
10 |
|
|
|
|
11 |
|
tinymc
e.create('
tinymce.pl
ugins.Comp
at2x', {
|
|
|
12 |
|
ge
tInfo : fu
nction() {
|
|
|
13 |
|
return {
|
|
|
14 |
|
long
name : 'Co
mpat2x',
|
|
|
15 |
|
auth
or : 'Moxi
ecode Syst
ems AB',
|
|
|
16 |
|
auth
orurl : 'h
ttp://tiny
mce.moxiec
ode.com',
|
|
|
17 |
|
info
url : 'htt
p://wiki.m
oxiecode.c
om/index.p
hp/TinyMCE
:Plugins/c
ompat2x',
|
|
|
18 |
|
vers
ion : tiny
MCE.majorV
ersion + "
." + tinyM
CE.minorVe
rsion
|
|
|
19 |
|
};
|
|
|
20 |
|
}
|
|
|
21 |
|
});
|
|
|
22 |
|
|
|
|
23 |
|
(funct
ion() {
|
|
|
24 |
|
//
Extend ti
nyMCE/Edit
orManager
|
|
|
25 |
|
ti
nymce.exte
nd(tinyMCE
, {
|
|
|
26 |
|
addToLan
g : functi
on(p, l) {
|
|
|
27 |
|
each
(l, functi
on(v, k) {
|
|
|
28 |
|
tinyMCE.i1
8n[(tinyMC
E.settings
.language
|| 'en') +
'.' + (p
? p + '_'
: '') + k]
= v;
|
|
|
29 |
|
});
|
|
|
30 |
|
},
|
|
|
31 |
|
|
|
|
32 |
|
getInsta
nceById :
function(n
) {
|
|
|
33 |
|
retu
rn this.ge
t(n);
|
|
|
34 |
|
}
|
|
|
35 |
|
})
;
|
|
|
36 |
|
})();
|
|
|
37 |
|
|
|
|
38 |
|
(funct
ion() {
|
|
|
39 |
|
va
r EditorMa
nager = ti
nymce.Edit
orManager;
|
|
|
40 |
|
|
|
|
41 |
|
ti
nyMCE.inst
ances = {}
;
|
|
|
42 |
|
ti
nyMCE.plug
ins = {};
|
|
|
43 |
|
ti
nymce.Plug
inManager.
onAdd.add(
function(p
m, n, p) {
|
|
|
44 |
|
tinyMCE.
plugins[n]
= p;
|
|
|
45 |
|
})
;
|
|
|
46 |
|
|
|
|
47 |
|
ti
nyMCE.majo
rVersion =
tinymce.m
ajorVersio
n;
|
|
|
48 |
|
ti
nyMCE.mino
rVersion =
tinymce.m
inorVersio
n;
|
|
|
49 |
|
ti
nyMCE.rele
aseDate =
tinymce.re
leaseDate;
|
|
|
50 |
|
ti
nyMCE.base
URL = tiny
mce.baseUR
L;
|
|
|
51 |
|
ti
nyMCE.isIE
= tinyMCE
.isMSIE =
tinymce.is
IE || tiny
mce.isOper
a;
|
|
|
52 |
|
ti
nyMCE.isMS
IE5 = tiny
mce.isIE;
|
|
|
53 |
|
ti
nyMCE.isMS
IE5_0 = ti
nymce.isIE
;
|
|
|
54 |
|
ti
nyMCE.isMS
IE7 = tiny
mce.isIE;
|
|
|
55 |
|
ti
nyMCE.isGe
cko = tiny
mce.isGeck
o;
|
|
|
56 |
|
ti
nyMCE.isSa
fari = tin
ymce.isWeb
Kit;
|
|
|
57 |
|
ti
nyMCE.isOp
era = tiny
mce.isOper
a;
|
|
|
58 |
|
ti
nyMCE.isMa
c = false;
|
|
|
59 |
|
ti
nyMCE.isNS
7 = false;
|
|
|
60 |
|
ti
nyMCE.isNS
71 = false
;
|
|
|
61 |
|
ti
nyMCE.comp
at = true;
|
|
|
62 |
|
|
|
|
63 |
|
//
Extend ti
nyMCE clas
s
|
|
|
64 |
|
Ti
nyMCE_Engi
ne = tinyM
CE;
|
|
|
65 |
|
ti
nymce.exte
nd(tinyMCE
, {
|
|
|
66 |
|
getParam
: functio
n(n, dv) {
|
|
|
67 |
|
retu
rn this.ac
tiveEditor
.getParam(
n, dv);
|
|
|
68 |
|
},
|
|
|
69 |
|
|
|
|
70 |
|
addEvent
: functio
n(e, na, f
, sc) {
|
|
|
71 |
|
tiny
mce.dom.Ev
ent.add(e,
na, f, sc
|| this);
|
|
|
72 |
|
},
|
|
|
73 |
|
|
|
|
74 |
|
getContr
olHTML : f
unction(n)
{
|
|
|
75 |
|
retu
rn EditorM
anager.act
iveEditor.
controlMan
ager.creat
eControl(n
);
|
|
|
76 |
|
},
|
|
|
77 |
|
|
|
|
78 |
|
loadCSS
: function
(u) {
|
|
|
79 |
|
tiny
mce.DOM.lo
adCSS(u);
|
|
|
80 |
|
},
|
|
|
81 |
|
|
|
|
82 |
|
importCS
S : functi
on(doc, u)
{
|
|
|
83 |
|
if (
doc == doc
ument)
|
|
|
84 |
|
this.loadC
SS(u);
|
|
|
85 |
|
else
|
|
|
86 |
|
new tinymc
e.dom.DOMU
tils(doc).
loadCSS(u)
;
|
|
|
87 |
|
},
|
|
|
88 |
|
|
|
|
89 |
|
log : fu
nction() {
|
|
|
90 |
|
cons
ole.debug.
apply(cons
ole, argum
ents);
|
|
|
91 |
|
},
|
|
|
92 |
|
|
|
|
93 |
|
getLang
: function
(n, dv) {
|
|
|
94 |
|
var
v = Editor
Manager.ac
tiveEditor
.getLang(n
.replace(/
^lang_/g,
''), dv);
|
|
|
95 |
|
|
|
|
96 |
|
// I
s number
|
|
|
97 |
|
if (
/^[0-9\-.]
+$/g.test(
v))
|
|
|
98 |
|
return par
seInt(v);
|
|
|
99 |
|
|
|
|
100 |
|
retu
rn v;
|
|
|
101 |
|
},
|
|
|
102 |
|
|
|
|
103 |
|
isInstan
ce : funct
ion(o) {
|
|
|
104 |
|
retu
rn o != nu
ll && type
of(o) == "
object" &&
o.execCom
mand;
|
|
|
105 |
|
},
|
|
|
106 |
|
|
|
|
107 |
|
triggerN
odeChange
: function
() {
|
|
|
108 |
|
Edit
orManager.
activeEdit
or.nodeCha
nged();
|
|
|
109 |
|
},
|
|
|
110 |
|
|
|
|
111 |
|
regexpRe
place : fu
nction(in_
str, reg_e
xp, replac
e_str, opt
s) {
|
|
|
112 |
|
var
re;
|
|
|
113 |
|
|
|
|
114 |
|
if (
in_str ==
null)
|
|
|
115 |
|
return in_
str;
|
|
|
116 |
|
|
|
|
117 |
|
if (
typeof(opt
s) == "und
efined")
|
|
|
118 |
|
opts = 'g'
;
|
|
|
119 |
|
|
|
|
120 |
|
re =
new RegEx
p(reg_exp,
opts);
|
|
|
121 |
|
|
|
|
122 |
|
retu
rn in_str.
replace(re
, replace_
str);
|
|
|
123 |
|
},
|
|
|
124 |
|
|
|
|
125 |
|
trim : f
unction(s)
{
|
|
|
126 |
|
retu
rn tinymce
.trim(s);
|
|
|
127 |
|
},
|
|
|
128 |
|
|
|
|
129 |
|
xmlEncod
e : functi
on(s) {
|
|
|
130 |
|
retu
rn tinymce
.DOM.encod
e(s);
|
|
|
131 |
|
},
|
|
|
132 |
|
|
|
|
133 |
|
explode
: function
(s, d) {
|
|
|
134 |
|
var
o = [];
|
|
|
135 |
|
|
|
|
136 |
|
tiny
mce.each(s
.split(d),
function(
v) {
|
|
|
137 |
|
if (v != '
')
|
|
|
138 |
|
o.push
(v);
|
|
|
139 |
|
});
|
|
|
140 |
|
|
|
|
141 |
|
retu
rn o;
|
|
|
142 |
|
},
|
|
|
143 |
|
|
|
|
144 |
|
switchCl
ass : func
tion(id, c
ls) {
|
|
|
145 |
|
var
b;
|
|
|
146 |
|
|
|
|
147 |
|
if (
/^mceButto
n/.test(cl
s)) {
|
|
|
148 |
|
b = Editor
Manager.ac
tiveEditor
.controlMa
nager.get(
id);
|
|
|
149 |
|
|
|
|
150 |
|
if (!b)
|
|
|
151 |
|
return
;
|
|
|
152 |
|
|
|
|
153 |
|
switch (cl
s) {
|
|
|
154 |
|
case "
mceButtonN
ormal":
|
|
|
155 |
|
b.
setDisable
d(false);
|
|
|
156 |
|
b.
setActive(
false);
|
|
|
157 |
|
re
turn;
|
|
|
158 |
|
|
|
|
159 |
|
case "
mceButtonD
isabled":
|
|
|
160 |
|
b.
setDisable
d(true);
|
|
|
161 |
|
re
turn;
|
|
|
162 |
|
|
|
|
163 |
|
case "
mceButtonS
elected":
|
|
|
164 |
|
b.
setActive(
true);
|
|
|
165 |
|
b.
setDisable
d(false);
|
|
|
166 |
|
re
turn;
|
|
|
167 |
|
}
|
|
|
168 |
|
}
|
|
|
169 |
|
},
|
|
|
170 |
|
|
|
|
171 |
|
addCSSCl
ass : func
tion(e, n,
b) {
|
|
|
172 |
|
retu
rn tinymce
.DOM.addCl
ass(e, n,
b);
|
|
|
173 |
|
},
|
|
|
174 |
|
|
|
|
175 |
|
hasCSSCl
ass : func
tion(e, n)
{
|
|
|
176 |
|
retu
rn tinymce
.DOM.hasCl
ass(e, n);
|
|
|
177 |
|
},
|
|
|
178 |
|
|
|
|
179 |
|
removeCS
SClass : f
unction(e,
n) {
|
|
|
180 |
|
retu
rn tinymce
.DOM.remov
eClass(e,
n);
|
|
|
181 |
|
},
|
|
|
182 |
|
|
|
|
183 |
|
getCSSCl
asses : fu
nction() {
|
|
|
184 |
|
var
cl = Edito
rManager.a
ctiveEdito
r.dom.getC
lasses(),
o = [];
|
|
|
185 |
|
|
|
|
186 |
|
each
(cl, funct
ion(c) {
|
|
|
187 |
|
o.push(c['
class']);
|
|
|
188 |
|
});
|
|
|
189 |
|
|
|
|
190 |
|
retu
rn o;
|
|
|
191 |
|
},
|
|
|
192 |
|
|
|
|
193 |
|
setWindo
wArg : fun
ction(n, v
) {
|
|
|
194 |
|
Edit
orManager.
activeEdit
or.windowM
anager.par
ams[n] = v
;
|
|
|
195 |
|
},
|
|
|
196 |
|
|
|
|
197 |
|
getWindo
wArg : fun
ction(n, d
v) {
|
|
|
198 |
|
var
wm = Edito
rManager.a
ctiveEdito
r.windowMa
nager, v;
|
|
|
199 |
|
|
|
|
200 |
|
v =
wm.getPara
m(n);
|
|
|
201 |
|
if (
v === '')
|
|
|
202 |
|
return '';
|
|
|
203 |
|
|
|
|
204 |
|
retu
rn v || wm
.getFeatur
e(n) || dv
;
|
|
|
205 |
|
},
|
|
|
206 |
|
|
|
|
207 |
|
getParen
tNode : fu
nction(n,
f) {
|
|
|
208 |
|
retu
rn this._g
etDOM().ge
tParent(n,
f);
|
|
|
209 |
|
},
|
|
|
210 |
|
|
|
|
211 |
|
selectEl
ements : f
unction(n,
na, f) {
|
|
|
212 |
|
var
i, a = [],
nl, x;
|
|
|
213 |
|
|
|
|
214 |
|
for
(x=0, na =
na.split(
','); x<na
.length; x
++)
|
|
|
215 |
|
for (i=0,
nl = n.get
ElementsBy
TagName(na
[x]); i<nl
.length; i
++)
|
|
|
216 |
|
(!f ||
f(nl[i]))
&& a.push
(nl[i]);
|
|
|
217 |
|
|
|
|
218 |
|
retu
rn a;
|
|
|
219 |
|
},
|
|
|
220 |
|
|
|
|
221 |
|
getNodeT
ree : func
tion(n, na
, t, nn) {
|
|
|
222 |
|
retu
rn this.se
lectNodes(
n, functio
n(n) {
|
|
|
223 |
|
return (!t
|| n.node
Type == t)
&& (!nn |
| n.nodeNa
me == nn);
|
|
|
224 |
|
}, n
a ? na : [
]);
|
|
|
225 |
|
},
|
|
|
226 |
|
|
|
|
227 |
|
getAttri
b : functi
on(e, n, d
v) {
|
|
|
228 |
|
retu
rn this._g
etDOM().ge
tAttrib(e,
n, dv);
|
|
|
229 |
|
},
|
|
|
230 |
|
|
|
|
231 |
|
setAttri
b : functi
on(e, n, v
) {
|
|
|
232 |
|
retu
rn this._g
etDOM().se
tAttrib(e,
n, v);
|
|
|
233 |
|
},
|
|
|
234 |
|
|
|
|
235 |
|
getEleme
ntsByAttri
buteValue
: function
(n, e, a,
v) {
|
|
|
236 |
|
var
i, nl = n.
getElement
sByTagName
(e), o = [
];
|
|
|
237 |
|
|
|
|
238 |
|
for
(i=0; i<nl
.length; i
++) {
|
|
|
239 |
|
if (tinyMC
E.getAttri
b(nl[i], a
).indexOf(
v) != -1)
|
|
|
240 |
|
o[o.le
ngth] = nl
[i];
|
|
|
241 |
|
}
|
|
|
242 |
|
|
|
|
243 |
|
retu
rn o;
|
|
|
244 |
|
},
|
|
|
245 |
|
|
|
|
246 |
|
selectNo
des : func
tion(n, f,
a) {
|
|
|
247 |
|
var
i;
|
|
|
248 |
|
|
|
|
249 |
|
if (
!a)
|
|
|
250 |
|
a = [];
|
|
|
251 |
|
|
|
|
252 |
|
if (
f(n))
|
|
|
253 |
|
a[a.length
] = n;
|
|
|
254 |
|
|
|
|
255 |
|
if (
n.hasChild
Nodes()) {
|
|
|
256 |
|
for (i=0;
i<n.childN
odes.lengt
h; i++)
|
|
|
257 |
|
tinyMC
E.selectNo
des(n.chil
dNodes[i],
f, a);
|
|
|
258 |
|
}
|
|
|
259 |
|
|
|
|
260 |
|
retu
rn a;
|
|
|
261 |
|
},
|
|
|
262 |
|
|
|
|
263 |
|
getConte
nt : funct
ion() {
|
|
|
264 |
|
retu
rn EditorM
anager.act
iveEditor.
getContent
();
|
|
|
265 |
|
},
|
|
|
266 |
|
|
|
|
267 |
|
getParen
tElement :
function(
n, na, f)
{
|
|
|
268 |
|
if (
na)
|
|
|
269 |
|
na = new R
egExp('^('
+ na.toUp
perCase().
replace(/,
/g, '|') +
')$', 'g'
);
|
|
|
270 |
|
|
|
|
271 |
|
retu
rn this._g
etDOM().ge
tParent(n,
function(
n) {
|
|
|
272 |
|
return n.n
odeType ==
1 && (!na
|| na.tes
t(n.nodeNa
me)) && (!
f || f(n))
;
|
|
|
273 |
|
}, t
his.active
Editor.get
Body());
|
|
|
274 |
|
},
|
|
|
275 |
|
|
|
|
276 |
|
importPl
uginLangua
gePack : f
unction(n)
{
|
|
|
277 |
|
tiny
mce.Plugin
Manager.re
quireLangP
ack(n);
|
|
|
278 |
|
},
|
|
|
279 |
|
|
|
|
280 |
|
getButto
nHTML : fu
nction(cn,
lang, img
, c, u, v)
{
|
|
|
281 |
|
var
ed = Edito
rManager.a
ctiveEdito
r;
|
|
|
282 |
|
|
|
|
283 |
|
img
= img.repl
ace(/\{\$p
luginurl\}
/g, tinyMC
E.pluginUR
L);
|
|
|
284 |
|
img
= img.repl
ace(/\{\$t
hemeurl\}/
g, tinyMCE
.themeURL)
;
|
|
|
285 |
|
lang
= lang.re
place(/^la
ng_/g, '')
;
|
|
|
286 |
|
|
|
|
287 |
|
retu
rn ed.cont
rolManager
.createBut
ton(cn, {
|
|
|
288 |
|
title : la
ng,
|
|
|
289 |
|
command :
c,
|
|
|
290 |
|
ui : u,
|
|
|
291 |
|
value : v,
|
|
|
292 |
|
scope : th
is,
|
|
|
293 |
|
'class' :
'compat',
|
|
|
294 |
|
image : im
g
|
|
|
295 |
|
});
|
|
|
296 |
|
},
|
|
|
297 |
|
|
|
|
298 |
|
addSelec
tAccessibi
lity : fun
ction(e, s
, w) {
|
|
|
299 |
|
// A
dd event h
andlers
|
|
|
300 |
|
if (
!s._isAcce
ssible) {
|
|
|
301 |
|
s.onkeydow
n = tinyMC
E.accessib
leEventHan
dler;
|
|
|
302 |
|
s.onblur =
tinyMCE.a
ccessibleE
ventHandle
r;
|
|
|
303 |
|
s._isAcces
sible = tr
ue;
|
|
|
304 |
|
s._win = w
;
|
|
|
305 |
|
}
|
|
|
306 |
|
|
|
|
307 |
|
retu
rn false;
|
|
|
308 |
|
},
|
|
|
309 |
|
|
|
|
310 |
|
accessib
leEventHan
dler : fun
ction(e) {
|
|
|
311 |
|
var
elm, win =
this._win
;
|
|
|
312 |
|
|
|
|
313 |
|
e =
tinymce.is
IE ? win.e
vent : e;
|
|
|
314 |
|
elm
= tinymce.
isIE ? e.s
rcElement
: e.target
;
|
|
|
315 |
|
|
|
|
316 |
|
// U
npiggyback
onchange
on blur
|
|
|
317 |
|
if (
e.type ==
"blur") {
|
|
|
318 |
|
if (elm.ol
donchange)
{
|
|
|
319 |
|
elm.on
change = e
lm.oldonch
ange;
|
|
|
320 |
|
elm.ol
donchange
= null;
|
|
|
321 |
|
}
|
|
|
322 |
|
|
|
|
323 |
|
return tru
e;
|
|
|
324 |
|
}
|
|
|
325 |
|
|
|
|
326 |
|
// P
iggyback o
nchange
|
|
|
327 |
|
if (
elm.nodeNa
me == "SEL
ECT" && !e
lm.oldonch
ange) {
|
|
|
328 |
|
elm.oldonc
hange = el
m.onchange
;
|
|
|
329 |
|
elm.onchan
ge = null;
|
|
|
330 |
|
}
|
|
|
331 |
|
|
|
|
332 |
|
// E
xecute onc
hange and
remove pig
gyback
|
|
|
333 |
|
if (
e.keyCode
== 13 || e
.keyCode =
= 32) {
|
|
|
334 |
|
elm.onchan
ge = elm.o
ldonchange
;
|
|
|
335 |
|
elm.onchan
ge();
|
|
|
336 |
|
elm.oldonc
hange = nu
ll;
|
|
|
337 |
|
|
|
|
338 |
|
tinyMCE.ca
ncelEvent(
e);
|
|
|
339 |
|
return fal
se;
|
|
|
340 |
|
}
|
|
|
341 |
|
|
|
|
342 |
|
retu
rn true;
|
|
|
343 |
|
},
|
|
|
344 |
|
|
|
|
345 |
|
cancelEv
ent : func
tion(e) {
|
|
|
346 |
|
retu
rn tinymce
.dom.Event
.cancel(e)
;
|
|
|
347 |
|
},
|
|
|
348 |
|
|
|
|
349 |
|
handleVi
sualAid :
function(e
) {
|
|
|
350 |
|
Edit
orManager.
activeEdit
or.addVisu
al(e);
|
|
|
351 |
|
},
|
|
|
352 |
|
|
|
|
353 |
|
getAbsPo
sition : f
unction(n,
r) {
|
|
|
354 |
|
retu
rn tinymce
.DOM.getPo
s(n, r);
|
|
|
355 |
|
},
|
|
|
356 |
|
|
|
|
357 |
|
cleanupE
ventStr :
function(s
) {
|
|
|
358 |
|
s =
"" + s;
|
|
|
359 |
|
s =
s.replace(
'function
anonymous(
)\n{\n', '
');
|
|
|
360 |
|
s =
s.replace(
'\n}', '')
;
|
|
|
361 |
|
s =
s.replace(
/^return t
rue;/gi, '
'); // Rem
ove event
blocker
|
|
|
362 |
|
|
|
|
363 |
|
retu
rn s;
|
|
|
364 |
|
},
|
|
|
365 |
|
|
|
|
366 |
|
getVisua
lAidClass
: function
(s) {
|
|
|
367 |
|
// T
ODO: Imple
ment
|
|
|
368 |
|
retu
rn s;
|
|
|
369 |
|
},
|
|
|
370 |
|
|
|
|
371 |
|
parseSty
le : funct
ion(s) {
|
|
|
372 |
|
retu
rn this._g
etDOM().pa
rseStyle(s
);
|
|
|
373 |
|
},
|
|
|
374 |
|
|
|
|
375 |
|
serializ
eStyle : f
unction(s)
{
|
|
|
376 |
|
retu
rn this._g
etDOM().se
rializeSty
le(s);
|
|
|
377 |
|
},
|
|
|
378 |
|
|
|
|
379 |
|
openWind
ow : funct
ion(tpl, a
rgs) {
|
|
|
380 |
|
var
ed = Edito
rManager.a
ctiveEdito
r, o = {},
n;
|
|
|
381 |
|
|
|
|
382 |
|
// C
onvert nam
e/value ar
ray to obj
ect
|
|
|
383 |
|
for
(n in tpl)
|
|
|
384 |
|
o[n] = tpl
[n];
|
|
|
385 |
|
|
|
|
386 |
|
tpl
= o;
|
|
|
387 |
|
|
|
|
388 |
|
args
= args ||
{};
|
|
|
389 |
|
tpl.
url = new
tinymce.ut
il.URI(tin
ymce.Theme
Manager.th
emeURLs[ed
.settings.
theme]).to
Absolute(t
pl.file);
|
|
|
390 |
|
tpl.
inline = t
pl.inline
|| args.in
line;
|
|
|
391 |
|
|
|
|
392 |
|
ed.w
indowManag
er.open(tp
l, args);
|
|
|
393 |
|
},
|
|
|
394 |
|
|
|
|
395 |
|
closeWin
dow : func
tion(win)
{
|
|
|
396 |
|
Edit
orManager.
activeEdit
or.windowM
anager.clo
se(win);
|
|
|
397 |
|
},
|
|
|
398 |
|
|
|
|
399 |
|
getOuter
HTML : fun
ction(e) {
|
|
|
400 |
|
retu
rn tinymce
.DOM.getOu
terHTML(e)
;
|
|
|
401 |
|
},
|
|
|
402 |
|
|
|
|
403 |
|
setOuter
HTML : fun
ction(e, h
, d) {
|
|
|
404 |
|
retu
rn tinymce
.DOM.setOu
terHTML(e,
h, d);
|
|
|
405 |
|
},
|
|
|
406 |
|
|
|
|
407 |
|
hasPlugi
n : functi
on(n) {
|
|
|
408 |
|
retu
rn tinymce
.PluginMan
ager.get(n
) != null;
|
|
|
409 |
|
},
|
|
|
410 |
|
|
|
|
411 |
|
_setEven
tsEnabled
: function
() {
|
|
|
412 |
|
// I
gnore it!!
|
|
|
413 |
|
},
|
|
|
414 |
|
|
|
|
415 |
|
addPlugi
n : functi
on(pn, f)
{
|
|
|
416 |
|
var
t = this;
|
|
|
417 |
|
|
|
|
418 |
|
func
tion Plugi
nWrapper(e
d) {
|
|
|
419 |
|
tinyMCE.se
lectedInst
ance = ed;
|
|
|
420 |
|
|
|
|
421 |
|
ed.onInit.
add(functi
on() {
|
|
|
422 |
|
t.sett
ings = ed.
settings;
|
|
|
423 |
|
t.sett
ings['base
_href'] =
tinyMCE.do
cumentBase
Path;
|
|
|
424 |
|
tinyMC
E.settings
= t.setti
ngs;
|
|
|
425 |
|
tinyMC
E.document
BasePath =
ed.docume
ntBasePath
;
|
|
|
426 |
|
//ed.f
ormElement
= DOM.get
(ed.id);
|
|
|
427 |
|
|
|
|
428 |
|
if (f.
initInstan
ce)
|
|
|
429 |
|
f.
initInstan
ce(ed);
|
|
|
430 |
|
|
|
|
431 |
|
ed.con
tentDocume
nt = ed.ge
tDoc();
|
|
|
432 |
|
ed.con
tentWindow
= ed.getW
in();
|
|
|
433 |
|
ed.und
oRedo = ed
.undoManag
er;
|
|
|
434 |
|
ed.sta
rtContent
= ed.getCo
ntent({for
mat : 'raw
'});
|
|
|
435 |
|
|
|
|
436 |
|
tinyMC
E.instance
s[ed.id] =
ed;
|
|
|
437 |
|
tinyMC
E.loadedFi
les = [];
|
|
|
438 |
|
});
|
|
|
439 |
|
|
|
|
440 |
|
ed.onActiv
ate.add(fu
nction() {
|
|
|
441 |
|
tinyMC
E.settings
= ed.sett
ings;
|
|
|
442 |
|
tinyMC
E.selected
Instance =
ed;
|
|
|
443 |
|
});
|
|
|
444 |
|
|
|
|
445 |
|
/*
if (f.remo
veInstance
) {
|
|
|
446 |
|
ed.onD
estroy.add
(function(
) {
|
|
|
447 |
|
re
turn f.rem
oveInstanc
e(ed.id);
|
|
|
448 |
|
});
|
|
|
449 |
|
}*/
|
|
|
450 |
|
|
|
|
451 |
|
if (f.hand
leNodeChan
ge) {
|
|
|
452 |
|
ed.onN
odeChange.
add(functi
on(ed, cm,
n) {
|
|
|
453 |
|
f.
handleNode
Change(ed.
id, n, 0,
0, false,
!ed.select
ion.isColl
apsed());
|
|
|
454 |
|
});
|
|
|
455 |
|
}
|
|
|
456 |
|
|
|
|
457 |
|
if (f.onCh
ange) {
|
|
|
458 |
|
ed.onC
hange.add(
function(e
d, n) {
|
|
|
459 |
|
re
turn f.onC
hange(ed);
|
|
|
460 |
|
});
|
|
|
461 |
|
}
|
|
|
462 |
|
|
|
|
463 |
|
if (f.clea
nup) {
|
|
|
464 |
|
ed.onG
etContent.
add(functi
on() {
|
|
|
465 |
|
//
f.cleanup(
type, cont
ent, inst)
;
|
|
|
466 |
|
});
|
|
|
467 |
|
}
|
|
|
468 |
|
|
|
|
469 |
|
this.getIn
fo = funct
ion() {
|
|
|
470 |
|
return
f.getInfo
();
|
|
|
471 |
|
};
|
|
|
472 |
|
|
|
|
473 |
|
this.creat
eControl =
function(
n) {
|
|
|
474 |
|
tinyMC
E.pluginUR
L = tinymc
e.baseURL
+ '/plugin
s/' + pn;
|
|
|
475 |
|
tinyMC
E.themeURL
= tinymce
.baseURL +
'/themes/
' + tinyMC
E.activeEd
itor.setti
ngs.theme;
|
|
|
476 |
|
|
|
|
477 |
|
if (f.
getControl
HTML)
|
|
|
478 |
|
re
turn f.get
ControlHTM
L(n);
|
|
|
479 |
|
|
|
|
480 |
|
return
null;
|
|
|
481 |
|
};
|
|
|
482 |
|
|
|
|
483 |
|
this.execC
ommand = f
unction(cm
d, ui, val
) {
|
|
|
484 |
|
if (f.
execComman
d)
|
|
|
485 |
|
re
turn f.exe
cCommand(e
d.id, ed.g
etBody(),
cmd, ui, v
al);
|
|
|
486 |
|
|
|
|
487 |
|
return
false;
|
|
|
488 |
|
};
|
|
|
489 |
|
};
|
|
|
490 |
|
|
|
|
491 |
|
tiny
mce.Plugin
Manager.ad
d(pn, Plug
inWrapper)
;
|
|
|
492 |
|
},
|
|
|
493 |
|
|
|
|
494 |
|
_getDOM
: function
() {
|
|
|
495 |
|
retu
rn tinyMCE
.activeEdi
tor ? tiny
MCE.active
Editor.dom
: tinymce
.DOM;
|
|
|
496 |
|
},
|
|
|
497 |
|
|
|
|
498 |
|
convertR
elativeToA
bsoluteURL
: functio
n(b, u) {
|
|
|
499 |
|
retu
rn new tin
ymce.util.
URI(b).toA
bsolute(u)
;
|
|
|
500 |
|
},
|
|
|
501 |
|
|
|
|
502 |
|
convertA
bsoluteURL
ToRelative
URL : func
tion(b, u)
{
|
|
|
503 |
|
retu
rn new tin
ymce.util.
URI(b).toR
elative(u)
;
|
|
|
504 |
|
}
|
|
|
505 |
|
})
;
|
|
|
506 |
|
|
|
|
507 |
|
//
Extend Ed
itor class
|
|
|
508 |
|
ti
nymce.exte
nd(tinymce
.Editor.pr
ototype, {
|
|
|
509 |
|
getFocus
Element :
function()
{
|
|
|
510 |
|
retu
rn this.se
lection.ge
tNode();
|
|
|
511 |
|
},
|
|
|
512 |
|
|
|
|
513 |
|
getData
: function
(n) {
|
|
|
514 |
|
if (
!this.data
)
|
|
|
515 |
|
this.data
= [];
|
|
|
516 |
|
|
|
|
517 |
|
if (
!this.data
[n])
|
|
|
518 |
|
this.data[
n] = [];
|
|
|
519 |
|
|
|
|
520 |
|
retu
rn this.da
ta[n];
|
|
|
521 |
|
},
|
|
|
522 |
|
|
|
|
523 |
|
hasPlugi
n : functi
on(n) {
|
|
|
524 |
|
retu
rn this.pl
ugins[n] !
= null;
|
|
|
525 |
|
},
|
|
|
526 |
|
|
|
|
527 |
|
getConta
inerWin :
function()
{
|
|
|
528 |
|
retu
rn window;
|
|
|
529 |
|
},
|
|
|
530 |
|
|
|
|
531 |
|
getHTML
: function
(raw) {
|
|
|
532 |
|
retu
rn this.ge
tContent({
format :
raw ? 'raw
' : 'html'
});
|
|
|
533 |
|
},
|
|
|
534 |
|
|
|
|
535 |
|
setHTML
: function
(h) {
|
|
|
536 |
|
this
.setConten
t(h);
|
|
|
537 |
|
},
|
|
|
538 |
|
|
|
|
539 |
|
getSel :
function(
) {
|
|
|
540 |
|
retu
rn this.se
lection.ge
tSel();
|
|
|
541 |
|
},
|
|
|
542 |
|
|
|
|
543 |
|
getRng :
function(
) {
|
|
|
544 |
|
retu
rn this.se
lection.ge
tRng();
|
|
|
545 |
|
},
|
|
|
546 |
|
|
|
|
547 |
|
isHidden
: functio
n() {
|
|
|
548 |
|
var
s;
|
|
|
549 |
|
|
|
|
550 |
|
if (
!tinymce.i
sGecko)
|
|
|
551 |
|
return fal
se;
|
|
|
552 |
|
|
|
|
553 |
|
s =
this.getSe
l();
|
|
|
554 |
|
|
|
|
555 |
|
// W
eird, wher
es that cu
rsor selec
tion?
|
|
|
556 |
|
retu
rn (!s ||
!s.rangeCo
unt || s.r
angeCount
== 0);
|
|
|
557 |
|
},
|
|
|
558 |
|
|
|
|
559 |
|
translat
e : functi
on(s) {
|
|
|
560 |
|
var
c = this.s
ettings.la
nguage, o;
|
|
|
561 |
|
|
|
|
562 |
|
o =
tinymce.Ed
itorManage
r.i18n[c +
'.' + s]
|| s.repla
ce(/{\#([^
}]+)\}/g,
function(a
, b) {
|
|
|
563 |
|
return tin
ymce.Edito
rManager.i
18n[c + '.
' + b] ||
'{#' + b +
'}';
|
|
|
564 |
|
});
|
|
|
565 |
|
|
|
|
566 |
|
o =
o.replace(
/{\$lang_(
[^}]+)\}/g
, function
(a, b) {
|
|
|
567 |
|
return tin
ymce.Edito
rManager.i
18n[c + '.
' + b] ||
'{$lang_'
+ b + '}';
|
|
|
568 |
|
});
|
|
|
569 |
|
|
|
|
570 |
|
retu
rn o;
|
|
|
571 |
|
},
|
|
|
572 |
|
|
|
|
573 |
|
repaint
: function
() {
|
|
|
574 |
|
this
.execComma
nd('mceRep
aint');
|
|
|
575 |
|
}
|
|
|
576 |
|
})
;
|
|
|
577 |
|
|
|
|
578 |
|
//
Extend se
lection
|
|
|
579 |
|
ti
nymce.exte
nd(tinymce
.dom.Selec
tion.proto
type, {
|
|
|
580 |
|
getSelec
tedText :
function()
{
|
|
|
581 |
|
retu
rn this.ge
tContent({
format : '
text'});
|
|
|
582 |
|
},
|
|
|
583 |
|
|
|
|
584 |
|
getSelec
tedHTML :
function()
{
|
|
|
585 |
|
retu
rn this.ge
tContent({
format : '
html'});
|
|
|
586 |
|
},
|
|
|
587 |
|
|
|
|
588 |
|
getFocus
Element :
function()
{
|
|
|
589 |
|
retu
rn this.ge
tNode();
|
|
|
590 |
|
},
|
|
|
591 |
|
|
|
|
592 |
|
selectNo
de : funct
ion(node,
collapse,
select_tex
t_node, to
_start) {
|
|
|
593 |
|
var
t = this;
|
|
|
594 |
|
|
|
|
595 |
|
t.se
lect(node,
select_te
xt_node ||
0);
|
|
|
596 |
|
|
|
|
597 |
|
if (
!is(collap
se))
|
|
|
598 |
|
collapse =
true;
|
|
|
599 |
|
|
|
|
600 |
|
if (
collapse)
{
|
|
|
601 |
|
if (!is(to
_start))
|
|
|
602 |
|
to_sta
rt = true;
|
|
|
603 |
|
|
|
|
604 |
|
t.collapse
(to_start)
;
|
|
|
605 |
|
}
|
|
|
606 |
|
}
|
|
|
607 |
|
})
;
|
|
|
608 |
|
}).cal
l(this);
|
|
|
609 |
|
|
|
|
610 |
|
// Reg
ister plug
in
|
|
|
611 |
|
tinymc
e.PluginMa
nager.add(
'compat2x'
, tinymce.
plugins.Co
mpat2x);
|
|
|
612 |
|
})();
|
|
|
613 |
|
|