No regular expressions were active.
1 |
|
/**
|
|
|
2 |
|
* $Id: ed
itor_plugi
n_src.js 4
2 2006-08-
08 14:32:2
4Z spocke
$
|
|
|
3 |
|
*
|
|
|
4 |
|
* @author
Moxiecode
|
|
|
5 |
|
* @copyri
ght Copyri
ght © 2004
-2007, Mox
iecode Sys
tems AB, A
ll rights
reserved.
|
|
|
6 |
|
*/
|
|
|
7 |
|
|
|
|
8 |
|
tinyMCE.im
portPlugin
LanguagePa
ck('devkit
');
|
|
|
9 |
|
|
|
|
10 |
|
var TinyMC
E_DevKitPl
ugin = {
|
|
|
11 |
|
_logFi
lter : '\\
[(importCS
S|execComm
and|execIn
stanceComm
and|debug)
\\]',
|
|
|
12 |
|
_logPa
dding : ''
,
|
|
|
13 |
|
_start
Time : nul
l,
|
|
|
14 |
|
_bench
Mark : fal
se,
|
|
|
15 |
|
_winLo
aded : fal
se,
|
|
|
16 |
|
_isDeb
ugEvents :
false,
|
|
|
17 |
|
|
|
|
18 |
|
getInf
o : functi
on() {
|
|
|
19 |
|
re
turn {
|
|
|
20 |
|
longname
: 'Develo
pment Kit'
,
|
|
|
21 |
|
author :
'Moxiecod
e Systems
AB',
|
|
|
22 |
|
authorur
l : 'http:
//tinymce.
moxiecode.
com',
|
|
|
23 |
|
infourl
: 'http://
wiki.moxie
code.com/i
ndex.php/T
inyMCE:Plu
gins/devki
t',
|
|
|
24 |
|
version
: tinyMCE.
majorVersi
on + "." +
tinyMCE.m
inorVersio
n
|
|
|
25 |
|
};
|
|
|
26 |
|
},
|
|
|
27 |
|
|
|
|
28 |
|
initIn
stance : f
unction(in
st) {
|
|
|
29 |
|
th
is._setup(
);
|
|
|
30 |
|
},
|
|
|
31 |
|
|
|
|
32 |
|
_setup
: functio
n() {
|
|
|
33 |
|
if
(this._lo
aded)
|
|
|
34 |
|
return;
|
|
|
35 |
|
|
|
|
36 |
|
th
is._loaded
= true;
|
|
|
37 |
|
|
|
|
38 |
|
//
Register
a document
reference
for more
easy acces
s in the F
F DOM insp
ector
|
|
|
39 |
|
do
cument.___
TinyMCE =
tinyMCE;
|
|
|
40 |
|
|
|
|
41 |
|
//
Setup dev
kit by set
tings
|
|
|
42 |
|
th
is._logFil
ter = tiny
MCE.getPar
am('devkit
_log_filte
r', this._
logFilter)
;
|
|
|
43 |
|
th
is._benchM
ark = tiny
MCE.getPar
am('devkit
_bench_mar
k', false)
;
|
|
|
44 |
|
|
|
|
45 |
|
va
r ifr = do
cument.cre
ateElement
('iframe')
;
|
|
|
46 |
|
|
|
|
47 |
|
if
r.setAttri
bute("id",
"devkit")
;
|
|
|
48 |
|
if
r.setAttri
bute("fram
eBorder",
"0");
|
|
|
49 |
|
if
r.setAttri
bute("src"
, tinyMCE.
baseURL +
'/plugins/
devkit/dev
kit.htm');
|
|
|
50 |
|
|
|
|
51 |
|
do
cument.bod
y.appendCh
ild(ifr);
|
|
|
52 |
|
|
|
|
53 |
|
//
Workaroun
d for stra
nge IE rel
oad bug
|
|
|
54 |
|
//
if (tinyMC
E.isRealIE
)
|
|
|
55 |
|
//
document
.getElemen
tById('dev
kit').oute
rHTML = do
cument.get
ElementByI
d('devkit'
).outerHTM
L;
|
|
|
56 |
|
|
|
|
57 |
|
ti
nyMCE.impo
rtCSS(docu
ment, tiny
MCE.baseUR
L + '/plug
ins/devkit
/css/devki
t_ui.css')
;
|
|
|
58 |
|
},
|
|
|
59 |
|
|
|
|
60 |
|
_start
: functio
n() {
|
|
|
61 |
|
th
is._logPad
ding += '\
u00a0';
|
|
|
62 |
|
|
|
|
63 |
|
re
turn new D
ate().getT
ime();
|
|
|
64 |
|
},
|
|
|
65 |
|
|
|
|
66 |
|
_end :
function(
st) {
|
|
|
67 |
|
if
(this._lo
gPadding.l
ength > 0)
|
|
|
68 |
|
this._lo
gPadding =
this._log
Padding.su
bstring(0,
this._log
Padding.le
ngth - 1);
|
|
|
69 |
|
|
|
|
70 |
|
if
(this._be
nchMark)
|
|
|
71 |
|
this._lo
g("benchma
rk", "Exec
ution time
: " + (new
Date().ge
tTime() -
st));
|
|
|
72 |
|
},
|
|
|
73 |
|
|
|
|
74 |
|
_log :
function(
t) {
|
|
|
75 |
|
va
r m, a, i,
e = docum
ent.getEle
mentById('
devkit'),
now = new
Date().get
Time();
|
|
|
76 |
|
|
|
|
77 |
|
if
(!this._s
tartTime)
|
|
|
78 |
|
this._st
artTime =
now;
|
|
|
79 |
|
|
|
|
80 |
|
m
= (this._l
ogPadding.
length > 1
? this._l
ogPadding
: '') + '[
' + (now -
this._sta
rtTime) +
'] [' + t
+ '] ';
|
|
|
81 |
|
|
|
|
82 |
|
a
= this._lo
g.argument
s;
|
|
|
83 |
|
fo
r (i=1; i<
a.length;
i++) {
|
|
|
84 |
|
if (type
of(a[i]) =
= 'undefin
ed')
|
|
|
85 |
|
cont
inue;
|
|
|
86 |
|
|
|
|
87 |
|
if (i >
1)
|
|
|
88 |
|
m +=
', ';
|
|
|
89 |
|
|
|
|
90 |
|
m += a[i
];
|
|
|
91 |
|
}
|
|
|
92 |
|
|
|
|
93 |
|
if
(!new Reg
Exp(this._
logFilter,
'gi').tes
t(m)) {
|
|
|
94 |
|
if (this
._logPaddi
ng.length
> 0)
|
|
|
95 |
|
this
._logPaddi
ng = this.
_logPaddin
g.substrin
g(0, this.
_logPaddin
g.length -
1);
|
|
|
96 |
|
|
|
|
97 |
|
return;
|
|
|
98 |
|
}
|
|
|
99 |
|
|
|
|
100 |
|
if
(!this._w
inLoaded)
|
|
|
101 |
|
tinyMCE.
log[tinyMC
E.log.leng
th] = m;
|
|
|
102 |
|
el
se
|
|
|
103 |
|
e.conten
tWindow.de
bug(m);
|
|
|
104 |
|
},
|
|
|
105 |
|
|
|
|
106 |
|
_debug
Events : f
unction(s)
{
|
|
|
107 |
|
va
r i, ld, i
nst, n, ev
= ['Check
boxStateCh
ange','DOM
AttrModifi
ed','DOMMe
nuItemActi
ve',
|
|
|
108 |
|
'DOM
MenuItemIn
active','D
OMMouseScr
oll','DOMN
odeInserte
d','DOMNod
eRemoved',
|
|
|
109 |
|
'Rad
ioStateCha
nge','blur
','broadca
st','chang
e','click'
,'close','
command',
|
|
|
110 |
|
'com
mandupdate
','context
menu','dbl
click','dr
agdrop','d
ragenter',
'dragexit'
,
|
|
|
111 |
|
'dra
ggesture',
'dragover'
,'focus','
input','ke
ydown','ke
ypress','k
eyup','loa
d',
|
|
|
112 |
|
'mou
sedown','m
ouseout','
mouseover'
,'mouseup'
,'overflow
','overflo
wchanged',
'popuphidd
en',
|
|
|
113 |
|
'pop
uphiding',
'popupshow
ing','popu
pshown','s
elect','sy
ncfrompref
erence','s
ynctoprefe
rence',
|
|
|
114 |
|
'und
erflow','u
nload','ab
ort','acti
vate','aft
erprint','
afterupdat
e','before
activate',
|
|
|
115 |
|
'bef
orecopy','
beforecut'
,'beforede
activate',
'beforeedi
tfocus','b
eforepaste
','beforep
rint',
|
|
|
116 |
|
'bef
oreunload'
,'beforeup
date','bou
nce','cell
change','c
ontrolsele
ct','copy'
,'cut',
|
|
|
117 |
|
'dat
aavailable
','dataset
changed','
datasetcom
plete','de
activate',
'dragend',
'dragleave
',
|
|
|
118 |
|
'dra
gstart','d
rop','erro
r','erroru
pdate','fi
lterchange
','finish'
,'focusin'
,'focusout
',
|
|
|
119 |
|
'hel
p','layout
complete',
'losecaptu
re','mouse
enter','mo
useleave',
'mousewhee
l',
|
|
|
120 |
|
'mov
e','moveen
d','movest
art','past
e','proper
tychange',
'readystat
echange','
reset','re
size',
|
|
|
121 |
|
'res
izeend','r
esizestart
','rowente
r','rowexi
t','rowsde
lete','row
sinserted'
,'scroll',
|
|
|
122 |
|
'sel
ectionchan
ge','selec
tstart','s
tart','sto
p','submit
'];
|
|
|
123 |
|
//
mousemove
|
|
|
124 |
|
|
|
|
125 |
|
if
(TinyMCE_
DevKitPlug
in._isDebu
gEvents ==
s)
|
|
|
126 |
|
return;
|
|
|
127 |
|
|
|
|
128 |
|
Ti
nyMCE_DevK
itPlugin._
isDebugEve
nts = s;
|
|
|
129 |
|
|
|
|
130 |
|
fo
r (n in ti
nyMCE.inst
ances) {
|
|
|
131 |
|
inst = t
inyMCE.ins
tances[n];
|
|
|
132 |
|
|
|
|
133 |
|
if (!tin
yMCE.isIns
tance(inst
) || inst.
getDoc() =
= ld)
|
|
|
134 |
|
cont
inue;
|
|
|
135 |
|
|
|
|
136 |
|
ld = ins
t.getDoc()
;
|
|
|
137 |
|
|
|
|
138 |
|
for (i=0
; i<ev.len
gth; i++)
{
|
|
|
139 |
|
if (
s)
|
|
|
140 |
|
tinyMCE.ad
dEvent(ld,
ev[i], Ti
nyMCE_DevK
itPlugin._
debugEvent
);
|
|
|
141 |
|
else
|
|
|
142 |
|
tinyMCE.re
moveEvent(
ld, ev[i],
TinyMCE_D
evKitPlugi
n._debugEv
ent);
|
|
|
143 |
|
}
|
|
|
144 |
|
}
|
|
|
145 |
|
},
|
|
|
146 |
|
|
|
|
147 |
|
_debug
Event : fu
nction(e)
{
|
|
|
148 |
|
va
r t;
|
|
|
149 |
|
|
|
|
150 |
|
e
= e ? e :
tinyMCE.se
lectedInst
ance.getWi
n().event;
|
|
|
151 |
|
t
= e.srcEle
ment ? e.s
rcElement
: e.target
;
|
|
|
152 |
|
|
|
|
153 |
|
ti
nyMCE.debu
g(e.type,
t ? t.node
Name : '')
;
|
|
|
154 |
|
},
|
|
|
155 |
|
|
|
|
156 |
|
_seria
lize : fun
ction(o) {
|
|
|
157 |
|
va
r i, v, s
= TinyMCE_
DevKitPlug
in._serial
ize;
|
|
|
158 |
|
|
|
|
159 |
|
if
(o == nul
l)
|
|
|
160 |
|
return '
null';
|
|
|
161 |
|
|
|
|
162 |
|
sw
itch (type
of o) {
|
|
|
163 |
|
case 'st
ring':
|
|
|
164 |
|
v =
'\bb\tt\nn
\ff\rr\""\
'\'\\\\';
|
|
|
165 |
|
|
|
|
166 |
|
retu
rn '"' + o
.replace(n
ew RegExp(
'([\u0080-
\uFFFF\\x0
0-\\x1f\\"
])', 'g'),
function(
a, b) {
|
|
|
167 |
|
i = v.inde
xOf(b);
|
|
|
168 |
|
|
|
|
169 |
|
if (i+1)
|
|
|
170 |
|
return
'\\' + v.
charAt(i +
1);
|
|
|
171 |
|
|
|
|
172 |
|
a = b.char
CodeAt().t
oString(16
);
|
|
|
173 |
|
|
|
|
174 |
|
return '\\
u' + '0000
'.substrin
g(a.length
) + a;
|
|
|
175 |
|
}) +
'"';
|
|
|
176 |
|
|
|
|
177 |
|
case 'ob
ject':
|
|
|
178 |
|
if (
o instance
of Array)
{
|
|
|
179 |
|
for (i=0,
v = '['; i
<o.length;
i++)
|
|
|
180 |
|
v += (
i > 0 ? ',
' : '') +
s(o[i]);
|
|
|
181 |
|
|
|
|
182 |
|
return v +
']';
|
|
|
183 |
|
}
|
|
|
184 |
|
|
|
|
185 |
|
v =
'{';
|
|
|
186 |
|
|
|
|
187 |
|
for
(i in o)
|
|
|
188 |
|
v += typeo
f o[i] !=
'function'
? (v.leng
th > 1 ? '
,"' : '"')
+ i + '":
' + s(o[i]
) : '';
|
|
|
189 |
|
|
|
|
190 |
|
retu
rn v + '}'
;
|
|
|
191 |
|
}
|
|
|
192 |
|
|
|
|
193 |
|
re
turn '' +
o;
|
|
|
194 |
|
}
|
|
|
195 |
|
};
|
|
|
196 |
|
|
|
|
197 |
|
// Patch a
nd piggy b
ack functi
ons
|
|
|
198 |
|
tinyMCE.__
debug = ti
nyMCE.debu
g;
|
|
|
199 |
|
tinyMCE.de
bug = func
tion() {
|
|
|
200 |
|
var a,
i, m = ''
, now = ne
w Date().g
etTime(),
start = Ti
nyMCE_DevK
itPlugin._
startTime;
|
|
|
201 |
|
|
|
|
202 |
|
if (!s
tart)
|
|
|
203 |
|
Ti
nyMCE_DevK
itPlugin._
startTime
= start =
now;
|
|
|
204 |
|
|
|
|
205 |
|
a = th
is.debug.a
rguments;
|
|
|
206 |
|
for (i
=0; i<a.le
ngth; i++)
{
|
|
|
207 |
|
if
(typeof(a
[i]) == 'u
ndefined')
|
|
|
208 |
|
continue
;
|
|
|
209 |
|
|
|
|
210 |
|
if
(i > 0)
|
|
|
211 |
|
m += ',
';
|
|
|
212 |
|
|
|
|
213 |
|
m
+= a[i];
|
|
|
214 |
|
}
|
|
|
215 |
|
|
|
|
216 |
|
TinyMC
E_DevKitPl
ugin._log(
'debug', m
);
|
|
|
217 |
|
};
|
|
|
218 |
|
|
|
|
219 |
|
tinyMCE.du
mp = funct
ion(o) {
|
|
|
220 |
|
tinyMC
E.debug(Ti
nyMCE_DevK
itPlugin._
serialize(
o));
|
|
|
221 |
|
};
|
|
|
222 |
|
|
|
|
223 |
|
tinyMCE.sl
eep = func
tion(t) {
|
|
|
224 |
|
var s
= new Date
().getTime
(), b;
|
|
|
225 |
|
|
|
|
226 |
|
while
(new Date(
).getTime(
) - s < t)
b=1;
|
|
|
227 |
|
};
|
|
|
228 |
|
|
|
|
229 |
|
tinyMCE.__
execComman
d = tinyMC
E.execComm
and;
|
|
|
230 |
|
tinyMCE.ex
ecCommand
= function
(command,
user_inter
face, valu
e) {
|
|
|
231 |
|
var r,
st, dk =
TinyMCE_De
vKitPlugin
;
|
|
|
232 |
|
|
|
|
233 |
|
st = d
k._start()
;
|
|
|
234 |
|
dk._lo
g('execCom
mand', com
mand, user
_interface
, value);
|
|
|
235 |
|
r = ti
nyMCE.__ex
ecCommand(
command, u
ser_interf
ace, value
);
|
|
|
236 |
|
dk._en
d(st);
|
|
|
237 |
|
|
|
|
238 |
|
return
r;
|
|
|
239 |
|
};
|
|
|
240 |
|
|
|
|
241 |
|
tinyMCE.__
execInstan
ceCommand
= tinyMCE.
execInstan
ceCommand;
|
|
|
242 |
|
tinyMCE.ex
ecInstance
Command =
function(e
ditor_id,
command, u
ser_interf
ace, value
, focus) {
|
|
|
243 |
|
var r,
st, dk =
TinyMCE_De
vKitPlugin
;
|
|
|
244 |
|
|
|
|
245 |
|
st = d
k._start()
;
|
|
|
246 |
|
dk._lo
g('execIns
tanceComma
nd', edito
r_id, comm
and, user_
interface,
value);
|
|
|
247 |
|
r = ti
nyMCE.__ex
ecInstance
Command(ed
itor_id, c
ommand, us
er_interfa
ce, value)
;
|
|
|
248 |
|
dk._en
d(st);
|
|
|
249 |
|
|
|
|
250 |
|
return
r;
|
|
|
251 |
|
};
|
|
|
252 |
|
|
|
|
253 |
|
TinyMCE_En
gine.proto
type.__han
dleEvent =
TinyMCE_E
ngine.prot
otype.hand
leEvent;
|
|
|
254 |
|
TinyMCE_En
gine.proto
type.handl
eEvent = f
unction(e)
{
|
|
|
255 |
|
var r,
st, dk =
TinyMCE_De
vKitPlugin
;
|
|
|
256 |
|
|
|
|
257 |
|
st = d
k._start()
;
|
|
|
258 |
|
dk._lo
g('handleE
vent', e.t
ype);
|
|
|
259 |
|
r = ti
nyMCE.__ha
ndleEvent(
e);
|
|
|
260 |
|
dk._en
d(st);
|
|
|
261 |
|
|
|
|
262 |
|
return
r;
|
|
|
263 |
|
};
|
|
|
264 |
|
|
|
|
265 |
|
tinyMCE.__
importCSS
= tinyMCE.
importCSS;
|
|
|
266 |
|
tinyMCE.im
portCSS =
function(d
oc, css) {
|
|
|
267 |
|
var r,
st, dk =
TinyMCE_De
vKitPlugin
;
|
|
|
268 |
|
|
|
|
269 |
|
st = d
k._start()
;
|
|
|
270 |
|
dk._lo
g('importC
SS', doc,
css);
|
|
|
271 |
|
r = ti
nyMCE.__im
portCSS(do
c, css);
|
|
|
272 |
|
dk._en
d(st);
|
|
|
273 |
|
|
|
|
274 |
|
return
r;
|
|
|
275 |
|
};
|
|
|
276 |
|
|
|
|
277 |
|
tinyMCE.__
triggerNod
eChange =
tinyMCE.tr
iggerNodeC
hange;
|
|
|
278 |
|
tinyMCE.tr
iggerNodeC
hange = fu
nction(foc
us, setup_
content) {
|
|
|
279 |
|
var r,
st, dk =
TinyMCE_De
vKitPlugin
;
|
|
|
280 |
|
|
|
|
281 |
|
st = d
k._start()
;
|
|
|
282 |
|
dk._lo
g('trigger
NodeChange
', focus,
setup_cont
ent);
|
|
|
283 |
|
r = ti
nyMCE.__tr
iggerNodeC
hange(focu
s, setup_c
ontent);
|
|
|
284 |
|
dk._en
d(st);
|
|
|
285 |
|
|
|
|
286 |
|
return
r;
|
|
|
287 |
|
};
|
|
|
288 |
|
|
|
|
289 |
|
tinyMCE.__
dispatchCa
llback = t
inyMCE.dis
patchCallb
ack;
|
|
|
290 |
|
tinyMCE.di
spatchCall
back = fun
ction(i, p
, n) {
|
|
|
291 |
|
var r,
st, dk =
TinyMCE_De
vKitPlugin
;
|
|
|
292 |
|
|
|
|
293 |
|
st = d
k._start()
;
|
|
|
294 |
|
dk._lo
g('dispatc
hCallback'
, i, p, n)
;
|
|
|
295 |
|
r = ti
nyMCE.__di
spatchCall
back(i, p,
n);
|
|
|
296 |
|
dk._en
d(st);
|
|
|
297 |
|
|
|
|
298 |
|
return
r;
|
|
|
299 |
|
};
|
|
|
300 |
|
|
|
|
301 |
|
tinyMCE.__
executeCal
lback = ti
nyMCE.exec
uteCallbac
k;
|
|
|
302 |
|
tinyMCE.ex
ecuteCallb
ack = func
tion(i, p,
n) {
|
|
|
303 |
|
var r,
st, dk =
TinyMCE_De
vKitPlugin
;
|
|
|
304 |
|
|
|
|
305 |
|
st = d
k._start()
;
|
|
|
306 |
|
dk._lo
g('execute
Callback',
i, p, n);
|
|
|
307 |
|
r = ti
nyMCE.__ex
ecuteCallb
ack(i, p,
n);
|
|
|
308 |
|
dk._en
d(st);
|
|
|
309 |
|
|
|
|
310 |
|
return
r;
|
|
|
311 |
|
};
|
|
|
312 |
|
|
|
|
313 |
|
tinyMCE.__
execComman
dCallback
= tinyMCE.
execComman
dCallback;
|
|
|
314 |
|
tinyMCE.ex
ecCommandC
allback =
function(i
, p, n) {
|
|
|
315 |
|
var r,
st, dk =
TinyMCE_De
vKitPlugin
;
|
|
|
316 |
|
|
|
|
317 |
|
st = d
k._start()
;
|
|
|
318 |
|
dk._lo
g('execCom
mandCallba
ck', i, p,
n);
|
|
|
319 |
|
r = ti
nyMCE.__ex
ecCommandC
allback(i,
p, n);
|
|
|
320 |
|
dk._en
d(st);
|
|
|
321 |
|
|
|
|
322 |
|
return
r;
|
|
|
323 |
|
};
|
|
|
324 |
|
|
|
|
325 |
|
tinyMCE.ad
dPlugin("d
evkit", Ti
nyMCE_DevK
itPlugin);
|
|
|