No regular expressions were active.
1 |
|
//
Some
global
instances
,
this
will
be
filled
later
|
|
1 |
|
//
Some
global
instances
|
2 |
|
var
tiny
MCE
=
null,
tinyMCE
Lang
=
n
u
ll
;
|
|
2 |
|
var
tiny
mce
=
null,
tinyMCE
Pop
u
p,
tinyMCE
;
|
3 |
|
|
|
3 |
|
|
4 |
|
func
ti
on
Ti
nyMCE
_
Popup
()
{
|
|
4 |
|
ti
nyMCE
Popup
=
{
|
5 |
|
};
|
|
5 |
|
in
i
t
:
function(
)
{
|
6 |
|
|
|
6 |
|
va
r t = this
, w, ti, l
i, q, i, i
t;
|
7 |
|
TinyMCE_Po
pup.protot
ype = {
|
|
|
8 |
|
f
in
dW
i
n
:
function(
w
)
{
|
|
|
9 |
|
va
r c;
|
|
|
10 |
|
|
|
7 |
|
|
11 |
|
//
Check par
ents
|
|
8 |
|
li
= ('' + d
ocument.lo
cation.sea
rch).repla
ce(/^\?/,
'').split(
'&');
|
12 |
|
c
= w;
|
|
9 |
|
q
= {};
|
13 |
|
wh
ile (c &&
(c = c.par
ent) != nu
ll) {
|
|
10 |
|
fo
r (i=0; i<
li.length;
i++) {
|
14 |
|
if (type
of(c.tinyM
CE) != "un
defined")
|
|
11 |
|
it = li[
i].split('
=');
|
15 |
|
retu
rn c;
|
|
12 |
|
q[unesca
pe(it[0])]
= unescap
e(it[1]);
|
16 |
|
}
|
|
13 |
|
}
|
17 |
|
|
|
14 |
|
|
18 |
|
//
Check ope
ners
|
|
15 |
|
if
(q.mce_rd
omain)
|
19 |
|
c
= w;
|
|
16 |
|
document
.domain =
q.mce_rdom
ain;
|
20 |
|
wh
ile (c &&
(c = c.ope
ner) != nu
ll) {
|
|
|
21 |
|
if (type
of(c.tinyM
CE) != "un
defined")
|
|
|
22 |
|
retu
rn c;
|
|
|
23 |
|
}
|
|
|
24 |
|
|
|
17 |
|
|
25 |
|
//
Try top
|
|
18 |
|
//
Find wind
ow & API
|
26 |
|
if
(typeof(t
op.tinyMCE
) != "unde
fined")
|
|
19 |
|
w
= t.getWin
();
|
27 |
|
return t
op;
|
|
20 |
|
ti
nymce = w.
tinymce;
|
|
|
21 |
|
ti
nyMCE = w.
tinyMCE;
|
|
|
22 |
|
t.
editor = t
inymce.Edi
torManager
.activeEdi
tor;
|
|
|
23 |
|
t.
params = t
.editor.wi
ndowManage
r.params;
|
28 |
|
|
|
24 |
|
|
29 |
|
re
turn null;
|
|
25 |
|
//
Setup loc
al DOM
|
30 |
|
},
|
|
26 |
|
t.
dom = t.ed
itor.windo
wManager.c
reateInsta
nce('tinym
ce.dom.DOM
Utils', do
cument);
|
|
|
27 |
|
t.
dom.loadCS
S(t.editor
.settings.
popup_css)
;
|
31 |
|
|
|
28 |
|
|
32 |
|
init
:
function(
)
{
|
|
29 |
|
//
Setup on
init liste
ners
|
33 |
|
va
r win = wi
ndow.opene
r ? window
.opener :
window.dia
logArgumen
ts, c;
|
|
30 |
|
t.
listeners
= [];
|
34 |
|
va
r inst, re
, title, d
ivElm;
|
|
31 |
|
t.
onInit = {
|
|
|
32 |
|
add
:
function(
f,
s
)
{
|
|
|
33 |
|
t.li
steners.pu
sh({func :
f, scope
: s});
|
|
|
34 |
|
}
|
|
|
35 |
|
};
|
35 |
|
|
|
36 |
|
|
36 |
|
if
(!win)
|
|
37 |
|
t.
isWindow =
!t.getWin
dowArg('mc
e_inline')
;
|
37 |
|
win
=
t
his
.
f
i
n
d
Win
(
window
);
|
|
38 |
|
t
.
i
d
=
t.get
Win
dowArg
(
'mce_
window
_id'
);
|
|
|
39 |
|
t.
editor.win
dowManager
.onOpen.di
spatch(t.e
ditor.wind
owManager,
window);
|
|
|
40 |
|
},
|
38 |
|
|
|
41 |
|
|
39 |
|
if
(!win) {
|
|
42 |
|
getWin
: functio
n() {
|
40 |
|
alert("t
inyMCE obj
ect refere
nce not fo
und from p
opup.");
|
|
43 |
|
re
turn windo
w.dialogAr
guments ||
opener ||
parent ||
top;
|
41 |
|
return;
|
|
44 |
|
}
,
|
42 |
|
}
|
|
|
43 |
|
|
|
45 |
|
|
44 |
|
wi
ndow.opene
r = win;
|
|
46 |
|
getWin
dowArg : f
unction(n,
dv) {
|
45 |
|
th
is.windowO
pener = wi
n;
|
|
47 |
|
va
r v = this
.params[n]
;
|
46 |
|
th
is.onLoadE
val = "";
|
|
|
47 |
|
|
|
48 |
|
|
48 |
|
//
Setup par
ent refere
nces
|
|
49 |
|
re
turn tinym
ce.is(v) ?
v : dv;
|
49 |
|
ti
nyMCE = wi
n.tinyMCE;
|
|
50 |
|
},
|
50 |
|
ti
nyMCELang
= win.tiny
MCELang;
|
|
|
51 |
|
|
|
51 |
|
|
52 |
|
in
st = tinyM
CE.selecte
dInstance;
|
|
52 |
|
getPar
am : funct
ion(n, dv)
{
|
53 |
|
th
is.isWindo
w = tinyMC
E.getWindo
wArg('mce_
inside_ifr
ame', fals
e) == fals
e;
|
|
53 |
|
re
turn this.
editor.get
Param(n, d
v);
|
54 |
|
th
is.storeSe
lection =
(tinyMCE.i
sRealIE) &
& !this.is
Window &&
tinyMCE.ge
tWindowArg
('mce_stor
e_selectio
n', true);
|
|
54 |
|
},
|
55 |
|
|
|
55 |
|
|
56 |
|
if
(this.isW
indow)
|
|
56 |
|
getLan
g : functi
on(n, dv)
{
|
57 |
|
window.f
ocus();
|
|
57 |
|
re
turn this.
editor.get
Lang(n, dv
);
|
|
|
58 |
|
},
|
58 |
|
|
|
59 |
|
|
59 |
|
//
Store sel
ection
|
|
60 |
|
execCo
mmand : fu
nction(cmd
, ui, val,
a) {
|
60 |
|
if
(this.sto
reSelectio
n)
|
|
61 |
|
a
= a || {};
|
61 |
|
inst.sel
ectionBook
mark = ins
t.selectio
n.getBookm
ark(true);
|
|
62 |
|
a.
skip_focus
= 1;
|
62 |
|
|
|
63 |
|
|
63 |
|
//
Setup dir
|
|
64 |
|
th
is.restore
Selection(
);
|
64 |
|
if
(tinyMCEL
ang.lang_d
ir)
|
|
65 |
|
re
turn this.
editor.exe
cCommand(c
md, ui, va
l, a);
|
65 |
|
document
.dir = tin
yMCELang.l
ang_dir;
|
|
66 |
|
},
|
66 |
|
|
|
67 |
|
|
67 |
|
//
Setup tit
le
|
|
68 |
|
resize
ToInnerSiz
e : functi
on() {
|
68 |
|
re
= new Reg
Exp('{|\\\
$|}', 'g')
;
|
|
69 |
|
va
r t = this
, n, b = d
ocument.bo
dy, vp = t
.dom.getVi
ewPort(win
dow), dw,
dh;
|
69 |
|
ti
tle = docu
ment.title
.replace(r
e, "");
|
|
|
70 |
|
if
(typeof(t
inyMCELang
[title]) !
= "undefin
ed") {
|
|
|
71 |
|
divElm =
document.
createElem
ent("div")
;
|
|
|
72 |
|
divElm.i
nnerHTML =
tinyMCELa
ng[title];
|
|
|
73 |
|
document
.title = d
ivElm.inne
rHTML;
|
|
|
74 |
|
|
|
70 |
|
|
75 |
|
if (type
of(tinyMCE
.setWindow
Title) !=
'undefined
')
|
|
71 |
|
dw
= t.getWi
ndowArg('m
ce_width')
- vp.w;
|
76 |
|
tiny
MCE.setWin
dowTitle(w
indow, div
Elm.innerH
TML);
|
|
72 |
|
dh
= t.getWi
ndowArg('m
ce_height'
) - vp.h;
|
77 |
|
}
|
|
|
78 |
|
|
|
73 |
|
|
79 |
|
//
Output Po
pup CSS cl
ass
|
|
74 |
|
if
(t.isWind
ow)
|
80 |
|
do
cument.wri
te('<link
href="' +
tinyMCE.ge
tParam("po
pups_css")
+ '" rel=
"styleshee
t" type="t
ext/css">'
);
|
|
75 |
|
window.r
esizeBy(dw
, dh);
|
|
|
76 |
|
el
se
|
|
|
77 |
|
t.editor
.windowMan
ager.resiz
eBy(dw, dh
, t.id);
|
|
|
78 |
|
},
|
81 |
|
|
|
79 |
|
|
82 |
|
if
(tinyMCE.
getParam("
popups_css
_add")) {
|
|
80 |
|
execut
eOnLoad :
function(s
) {
|
83 |
|
c = tiny
MCE.getPar
am("popups
_css_add")
;
|
|
81 |
|
th
is.onInit.
add(functi
on() {
|
|
|
82 |
|
eval(s);
|
|
|
83 |
|
})
;
|
|
|
84 |
|
},
|
84 |
|
|
|
85 |
|
|
85 |
|
// Is re
lative
|
|
86 |
|
storeS
election :
function(
) {
|
86 |
|
if (c.in
dexOf('://
') == -1 &
& c.charAt
(0) != '/'
)
|
|
87 |
|
th
is.editor.
windowMana
ger.bookma
rk = tinyM
CEPopup.ed
itor.selec
tion.getBo
okmark('si
mple');
|
87 |
|
c =
tinyMCE.do
cumentBase
Path + "/"
+ c;
|
|
88 |
|
},
|
88 |
|
|
|
89 |
|
|
89 |
|
document
.write('<l
ink href="
' + c + '"
rel="styl
esheet" ty
pe="text/c
ss">');
|
|
90 |
|
restor
eSelection
: functio
n() {
|
90 |
|
}
|
|
91 |
|
va
r t = tiny
MCEPopup;
|
91 |
|
|
|
92 |
|
|
92 |
|
ti
nyMCE.addE
vent(windo
w, "load",
this.onLo
ad);
|
|
93 |
|
if
(!t.isWin
dow && tin
ymce.isIE)
|
|
|
94 |
|
t.editor
.selection
.moveToBoo
kmark(t.ed
itor.windo
wManager.b
ookmark);
|
93 |
|
},
|
|
95 |
|
},
|
94 |
|
|
|
96 |
|
|
95 |
|
on
L
o
a
d
:
function()
{
|
|
97 |
|
require
L
a
ngPack
:
function()
{
|
96 |
|
va
r dir, i,
elms, body
= documen
t.body;
|
|
98 |
|
va
r u = this
.getWindow
Arg('plugi
n_url') ||
this.getW
indowArg('
theme_url'
);
|
97 |
|
|
|
99 |
|
|
98 |
|
if
(tinyMCE.
getWindowA
rg('mce_re
placevaria
bles', tru
e))
|
|
100 |
|
if
(u && thi
s.editor.s
ettings.la
nguage) {
|
99 |
|
body.inn
erHTML = t
inyMCE.app
lyTemplate
(body.inne
rHTML, tin
yMCE.windo
wArgs);
|
|
101 |
|
u += '/l
angs/' + t
his.editor
.settings.
language +
'_dlg.js'
;
|
100 |
|
|
|
102 |
|
|
101 |
|
di
r = tinyMC
E.selected
Instance.s
ettings.di
rectionali
ty;
|
|
103 |
|
if (!tin
ymce.Scrip
tLoader.is
Done(u)) {
|
102 |
|
if
(dir == "
rtl" && do
cument.for
ms && docu
ment.forms
.length >
0) {
|
|
104 |
|
docu
ment.write
('<script
type="text
/javascrip
t" src="'
+ u + '"><
/script>')
;
|
103 |
|
elms = d
ocument.fo
rms[0].ele
ments;
|
|
105 |
|
tiny
mce.Script
Loader.mar
kDone(u);
|
104 |
|
for (i=0
; i<elms.l
ength; i++
) {
|
|
|
105 |
|
if (
(elms[i].t
ype == "te
xt" || elm
s[i].type
== "textar
ea") && el
ms[i].getA
ttribute("
dir") != "
ltr")
|
|
|
106 |
|
elms[i].di
r = dir;
|
|
|
107 |
|
}
|
|
106 |
|
}
|
108 |
|
}
|
|
107 |
|
}
|
|
|
108 |
|
},
|
109 |
|
|
|
109 |
|
|
110 |
|
if
(body.sty
le.display
== 'none'
)
|
|
110 |
|
pickCo
lor : func
tion(e, el
ement_id)
{
|
111 |
|
body.sty
le.display
= 'block'
;
|
|
111 |
|
th
is.execCom
mand('mceC
olorPicker
', true, {
|
|
|
112 |
|
color :
document.g
etElementB
yId(elemen
t_id).valu
e,
|
|
|
113 |
|
func : f
unction(c)
{
|
|
|
114 |
|
docu
ment.getEl
ementById(
element_id
).value =
c;
|
112 |
|
|
|
115 |
|
|
113 |
|
//
Execute r
eal onload
(Opera fi
x)
|
|
116 |
|
try
{
|
114 |
|
if
(tinyMCEP
opup.onLoa
dEval !==
'')
|
|
117 |
|
document.g
etElementB
yId(elemen
t_id).onch
ange();
|
115 |
|
eval(tin
yMCEPopup.
onLoadEval
);
|
|
118 |
|
} ca
tch (ex) {
|
|
|
119 |
|
// Try fir
e event, i
gnore erro
rs
|
|
|
120 |
|
}
|
|
|
121 |
|
}
|
|
|
122 |
|
})
;
|
116 |
|
},
|
|
123 |
|
},
|
117 |
|
|
|
124 |
|
|
118 |
|
execut
eOnLoad :
function(s
tr) {
|
|
125 |
|
openBr
owser : fu
nction(ele
ment_id, t
ype, optio
n) {
|
119 |
|
if
(tinyMCE.
isOpera)
|
|
126 |
|
ti
nyMCEPopup
.restoreSe
lection();
|
120 |
|
this.onL
oadEval =
str;
|
|
127 |
|
th
is.editor.
execCallba
ck('file_b
rowser_cal
lback', el
ement_id,
document.g
etElementB
yId(elemen
t_id).valu
e, type, w
indow);
|
121 |
|
el
se
|
|
|
122 |
|
eval(str
);
|
|
|
123 |
|
},
|
|
128 |
|
},
|
124 |
|
|
|
129 |
|
|
125 |
|
resizeT
o
InnerSiz
e
:
function()
{
|
|
130 |
|
cl
o
s
e
:
function()
{
|
126 |
|
va
r i, doc,
body, oldM
argin, wra
pper, ifra
me, nodes,
dx, dy;
|
|
131 |
|
va
r t = this
;
|
127 |
|
|
|
132 |
|
|
128 |
|
//
Netscape
7.1 workar
ound
|
|
133 |
|
//
To avoid
domain rel
axing issu
e in Opera
|
129 |
|
if
(this.isW
indow && t
inyMCE.isN
S71) {
|
|
134 |
|
fu
nction clo
se() {
|
130 |
|
window.r
esizeBy(0,
10);
|
|
135 |
|
t.editor
.windowMan
ager.close
(window, t
.id);
|
131 |
|
return;
|
|
136 |
|
tinymce
= tinyMCE
= t.editor
= t.param
s = t.dom
= t.dom.do
c = null;
// Cleanup
|
132 |
|
}
|
|
137 |
|
}
;
|
133 |
|
|
|
138 |
|
|
134 |
|
if
(this.isW
indow) {
|
|
139 |
|
if
(tinymce.
isOpera)
|
135 |
|
doc = do
cument;
|
|
140 |
|
t.getWin
().setTime
out(close,
0);
|
136 |
|
body = d
oc.body;
|
|
141 |
|
el
se
|
|
|
142 |
|
close();
|
|
|
143 |
|
},
|
137 |
|
|
|
144 |
|
|
138 |
|
if (body
.style.dis
play == 'n
one')
|
|
145 |
|
// Int
ernal func
tions
|
139 |
|
body
.style.dis
play = 'bl
ock';
|
|
|
140 |
|
|
|
146 |
|
|
141 |
|
// Remov
e margin
|
|
147 |
|
_resto
reSelectio
n : functi
on() {
|
142 |
|
oldMargi
n = body.s
tyle.margi
n;
|
|
148 |
|
va
r e = wind
ow.event.s
rcElement;
|
143 |
|
body.sty
le.margin
= '0';
|
|
|
144 |
|
|
|
149 |
|
|
145 |
|
// Creat
e wrapper
|
|
150 |
|
if
(e.nodeNa
me == 'INP
UT' && (e.
type == 's
ubmit' ||
e.type ==
'button'))
|
146 |
|
wrapper
= doc.crea
teElement(
"div");
|
|
151 |
|
tinyMCEP
opup.resto
reSelectio
n();
|
147 |
|
wrapper.
id = 'mcBo
dyWrapper'
;
|
|
152 |
|
},
|
148 |
|
wrapper.
style.disp
lay = 'non
e';
|
|
|
149 |
|
wrapper.
style.marg
in = '0';
|
|
|
150 |
|
|
|
153 |
|
|
151 |
|
// Wrap
body eleme
nts
|
|
154 |
|
/* _resto
reSelectio
n : functi
on() {
|
152 |
|
nodes =
doc.body.c
hildNodes;
|
|
155 |
|
va
r e = wind
ow.event.s
rcElement;
|
153 |
|
for (i=n
odes.lengt
h-1; i>=0;
i--) {
|
|
|
154 |
|
if (
wrapper.ha
sChildNode
s())
|
|
|
155 |
|
wrapper.in
sertBefore
(nodes[i].
cloneNode(
true), wra
pper.first
Child);
|
|
|
156 |
|
else
|
|
|
157 |
|
wrapper.ap
pendChild(
nodes[i].c
loneNode(t
rue));
|
|
|
158 |
|
|
|
156 |
|
|
159 |
|
node
s[i].paren
tNode.remo
veChild(no
des[i]);
|
|
157 |
|
//
If user f
ocus a non
text inpu
t or texta
rea
|
160 |
|
}
|
|
158 |
|
if
((e.nodeN
ame != 'IN
PUT' && e.
nodeName !
= 'TEXTARE
A') || e.t
ype != 'te
xt')
|
|
|
159 |
|
tinyMCEP
opup.resto
reSelectio
n();
|
|
|
160 |
|
}
,*/
|
161 |
|
|
|
161 |
|
|
162 |
|
// Add w
rapper
|
|
162 |
|
_onDOM
Loaded : f
unction()
{
|
163 |
|
doc.body
.appendChi
ld(wrapper
);
|
|
163 |
|
va
r t = this
, ti = doc
ument.titl
e, bm, h;
|
164 |
|
|
|
164 |
|
|
165 |
|
//
C
r
e
ate
ifr
a
m
e
|
|
165 |
|
//
T
r
ansl
ate
p
a
g
e
|
166 |
|
iframe =
document.
createElem
ent("ifram
e");
|
|
166 |
|
h
= document
.body.inne
rHTML;
|
167 |
|
iframe.i
d = "mcWin
Iframe";
|
|
|
168 |
|
iframe.s
rc = docum
ent.locati
on.href.to
LowerCase(
).indexOf(
'https') =
= -1 ? "ab
out:blank"
: tinyMCE
.settings.
default_do
cument;
|
|
|
169 |
|
iframe.w
idth = "10
0%";
|
|
|
170 |
|
iframe.h
eight = "1
00%";
|
|
|
171 |
|
iframe.s
tyle.margi
n = '0';
|
|
|
172 |
|
|
|
167 |
|
|
173 |
|
// Add i
frame
|
|
168 |
|
//
Replace a
=x with a=
"x" in IE
|
174 |
|
doc.body
.appendChi
ld(iframe)
;
|
|
169 |
|
if
(tinymce.
isIE)
|
|
|
170 |
|
h = h.re
place(/ (v
alue|title
|alt)=([^"
][^\s>]+)/
gi, ' $1="
$2"')
|
175 |
|
|
|
171 |
|
|
176 |
|
// Measu
re iframe
|
|
172 |
|
do
cument.bod
y.innerHTM
L = t.edit
or.transla
te(h);
|
177 |
|
iframe =
document.
getElement
ById('mcWi
nIframe');
|
|
173 |
|
do
cument.tit
le = ti =
t.editor.t
ranslate(t
i);
|
178 |
|
dx = tin
yMCE.getWi
ndowArg('m
ce_width')
- iframe.
clientWidt
h;
|
|
174 |
|
do
cument.bod
y.style.di
splay = ''
;
|
179 |
|
dy = tin
yMCE.getWi
ndowArg('m
ce_height'
) - iframe
.clientHei
ght;
|
|
|
180 |
|
|
|
175 |
|
|
181 |
|
// Resiz
e window
|
|
176 |
|
//
Restore s
election i
n IE when
focus is p
laced on a
non texta
rea or inp
ut element
of the ty
pe text
|
182 |
|
// tinyM
CE.debug(t
inyMCE.get
WindowArg(
'mce_width
') + "," +
tinyMCE.g
etWindowAr
g('mce_hei
ght') + "
- " + dx +
"," + dy)
;
|
|
177 |
|
if
(tinymce.
isIE)
|
183 |
|
window.r
esizeBy(dx
, dy);
|
|
178 |
|
document
.attachEve
nt('onmous
eup', tiny
MCEPopup._
restoreSel
ection);
|
184 |
|
|
|
179 |
|
|
185 |
|
// Hide
iframe and
show wrap
per
|
|
180 |
|
t.
restoreSel
ection();
|
186 |
|
body.sty
le.margin
= oldMargi
n;
|
|
181 |
|
t.
resizeToIn
nerSize();
|
187 |
|
iframe.s
tyle.displ
ay = 'none
';
|
|
|
188 |
|
wrapper.
style.disp
lay = 'blo
ck';
|
|
|
189 |
|
}
|
|
|
190 |
|
},
|
|
|
191 |
|
|
|
182 |
|
|
192 |
|
resize
ToContent
: function
() {
|
|
183 |
|
//
Set inlin
e title
|
193 |
|
va
r isMSIE =
(navigato
r.appName
== "Micros
oft Intern
et Explore
r");
|
|
184 |
|
if
(!t.isWin
dow)
|
194 |
|
va
r isOpera
= (navigat
or.userAge
nt.indexOf
("Opera")
!= -1);
|
|
185 |
|
t.editor
.windowMan
ager.setTi
tle(ti, t.
id);
|
195 |
|
va
r elm, wid
th, height
, x, y, dx
, dy;
|
|
186 |
|
el
se
|
|
|
187 |
|
window.f
ocus();
|
196 |
|
|
|
188 |
|
|
197 |
|
if
(isOpera)
|
|
189 |
|
if
(!tinymce
.isIE && !
t.isWindow
) {
|
198 |
|
return
;
|
|
190 |
|
tinymce.
dom.Event.
_add(docum
ent, 'focu
s', functi
on() {
|
|
|
191 |
|
t.ed
itor.windo
wManager.f
ocus(t.id)
|
|
|
192 |
|
})
;
|
|
|
193 |
|
}
|
199 |
|
|
|
194 |
|
|
200 |
|
if
(isMSIE)
{
|
|
195 |
|
//
Patch for
accessibi
lity
|
201 |
|
try { wi
ndow.resiz
eTo(10, 10
); } catch
(e) {}
|
|
196 |
|
ti
nymce.each
(t.dom.sel
ect('selec
t'), funct
ion(e) {
|
|
|
197 |
|
e.onkeyd
own = tiny
MCEPopup._
accessHand
ler;
|
|
|
198 |
|
})
;
|
202 |
|
|
|
199 |
|
|
203 |
|
elm = do
cument.bod
y;
|
|
200 |
|
//
Call onIn
it
|
204 |
|
width =
elm.offset
Width;
|
|
201 |
|
//
Init must
be called
before fo
cus so the
selection
won't get
lost by t
he focus c
all
|
205 |
|
height =
elm.offse
tHeight;
|
|
202 |
|
ti
nymce.each
(t.listene
rs, functi
on(o) {
|
206 |
|
dx = (el
m.scrollWi
dth - widt
h) + 4;
|
|
203 |
|
o.func.c
all(o.scop
e, t.edito
r);
|
207 |
|
dy = elm
.scrollHei
ght - heig
ht;
|
|
204 |
|
})
;
|
208 |
|
|
|
205 |
|
|
209 |
|
try { wi
ndow.resiz
eBy(dx, dy
); } catch
(e) {}
|
|
206 |
|
//
Move focu
s to windo
w
|
210 |
|
}
else {
|
|
207 |
|
if
(t.getWin
dowArg('mc
e_auto_foc
us', true)
) {
|
211 |
|
window.s
crollBy(10
00, 1000);
|
|
208 |
|
window.
f
o
cus
(
);
|
212 |
|
if (wind
ow.scrollX
> 0 || wi
ndow.scrol
lY > 0) {
|
|
209 |
|
|
213 |
|
wind
ow.resizeB
y(window.i
nnerWidth
* 2, windo
w.innerHei
ght * 2);
|
|
210 |
|
// Focus
element w
ith mceFoc
us class
|
214 |
|
wind
ow.sizeToC
ontent();
|
|
211 |
|
tinymce.
each(docum
ent.forms,
function(
f) {
|
215 |
|
wind
ow.scrollT
o(0, 0);
|
|
212 |
|
tiny
mce.each(f
.elements,
function(
e) {
|
216 |
|
x =
parseInt(s
creen.widt
h / 2.0) -
(window.o
uterWidth
/ 2.0);
|
|
213 |
|
if (t.dom.
hasClass(e
, 'mceFocu
s')) {
|
217 |
|
y =
parseInt(s
creen.heig
ht / 2.0)
- (window.
outerHeigh
t / 2.0);
|
|
214 |
|
e.focu
s();
|
218 |
|
window.
moveT
o
(
x,
y
);
|
|
215 |
|
return
false; //
Break loo
p
|
219 |
|
}
|
|
216 |
|
}
|
|
|
217 |
|
});
|
|
|
218 |
|
});
|
220 |
|
}
|
|
219 |
|
}
|
221 |
|
},
|
|
|
222 |
|
|
|
220 |
|
|
223 |
|
getWin
dowArg : f
unction(na
me, defaul
t_value) {
|
|
221 |
|
do
cument.onk
eydown = t
inyMCEPopu
p._closeWi
nKeyHandle
r;
|
224 |
|
re
turn tinyM
CE.getWind
owArg(name
, default_
value);
|
|
|
225 |
|
},
|
|
222 |
|
},
|
226 |
|
|
|
223 |
|
|
227 |
|
r
es
toreSe
le
ction
:
function(
)
{
|
|
224 |
|
_acc
es
sHand
le
r
:
function(
e
)
{
|
228 |
|
va
r inst;
|
|
225 |
|
e
= e || win
dow.event;
|
229 |
|
|
|
226 |
|
|
230 |
|
if
(this.sto
reSelectio
n) {
|
|
227 |
|
if
(e.keyCod
e == 13 ||
e.keyCode
== 32) {
|
231 |
|
inst = t
inyMCE.sel
ectedInsta
nce;
|
|
228 |
|
e = e.ta
rget || e.
srcElement
;
|
232 |
|
|
|
229 |
|
|
233 |
|
inst.get
Win().focu
s();
|
|
230 |
|
if (e.on
change)
|
|
|
231 |
|
e.on
change();
|
234 |
|
|
|
232 |
|
|
235 |
|
if (inst
.selection
Bookmark)
|
|
233 |
|
return t
inymce.dom
.Event.can
cel(e);
|
236 |
|
inst
.selection
.moveToBoo
kmark(inst
.selection
Bookmark);
|
|
|
237 |
|
}
|
|
234 |
|
}
|
238 |
|
},
|
|
235 |
|
},
|
239 |
|
|
|
236 |
|
|
240 |
|
execCo
mmand : fu
nction(com
mand, user
_interface
, value) {
|
|
237 |
|
_close
WinKeyHand
ler : func
tion(e) {
|
241 |
|
va
r inst = t
inyMCE.sel
ectedInsta
nce;
|
|
238 |
|
e
= e || win
dow.event;
|
242 |
|
|
|
|
243 |
|
th
is.restore
Selection(
);
|
|
|
244 |
|
in
st.execCom
mand(comma
nd, user_i
nterface,
value);
|
|
|
245 |
|
|
|
239 |
|
|
246 |
|
//
Store sel
ection
|
|
240 |
|
if
(e.keyCod
e == 27)
|
247 |
|
if
(this.sto
reSelectio
n)
|
|
241 |
|
tinyMCEP
opup.close
();
|
248 |
|
inst.sel
ectionBook
mark = ins
t.selectio
n.getBookm
ark(true);
|
|
|
249 |
|
},
|
|
242 |
|
},
|
250 |
|
|
|
243 |
|
|
251 |
|
close
:
function()
{
|
|
244 |
|
_wait
:
function()
{
|
252 |
|
ti
nyMCE.clos
eWindow(wi
ndow);
|
|
245 |
|
va
r t = this
, ti;
|
253 |
|
},
|
|
|
254 |
|
|
|
246 |
|
|
255 |
|
pickCo
lor : func
tion(e, el
ement_id)
{
|
|
247 |
|
if
(tinymce.
isIE && do
cument.loc
ation.prot
ocol != 'h
ttps:') {
|
256 |
|
ti
nyMCE.sele
ctedInstan
ce.execCom
mand('mceC
olorPicker
', true, {
|
|
248 |
|
// Fake
DOMContent
Loaded on
IE
|
257 |
|
element_
id : eleme
nt_id,
|
|
249 |
|
document
.write('<s
cript id=_
_ie_onload
defer src
=\'javascr
ipt:""\';>
<\/script>
');
|
258 |
|
document
: documen
t,
|
|
250 |
|
document
.getElemen
tById("__i
e_onload")
.onreadyst
atechange
= function
() {
|
259 |
|
window :
window,
|
|
251 |
|
if (
this.ready
State == "
complete")
{
|
260 |
|
store_se
lection :
false
|
|
252 |
|
t._onDOMLo
aded();
|
261 |
|
})
;
|
|
253 |
|
document.g
etElementB
yId(
"_
_i
e_onloa
d
"
).
onre
a
dystat
e
change
=
null
;
//
Prevent
leak
|
262 |
|
},
|
|
254 |
|
}
|
263 |
|
|
|
255 |
|
};
|
264 |
|
openBr
owser : fu
nction(ele
ment_id, t
ype, optio
n) {
|
|
256 |
|
}
else
{
|
265 |
|
va
r cb = tin
yMCE.getPa
ram(option
, tinyMCE.
getParam("
file_brows
er_callbac
k"));
|
|
257 |
|
if (tiny
mce.isIE |
| tinymce.
isWebKit)
{
|
266 |
|
var
url
=
document.g
etElementB
yId(
element
_i
d
).
v
a
lu
e
;
|
|
258 |
|
t
i
=
se
t
Interv
a
l(
function(
)
{
|
267 |
|
|
|
259 |
|
if (/loade
d|complete
/.test(doc
ument.read
yState)) {
|
268 |
|
ti
nyMCE.setW
indowArg("
window", w
indow);
|
|
260 |
|
clearI
nterval(ti
);
|
269 |
|
ti
nyMCE.setW
indowArg("
document",
document)
;
|
|
261 |
|
t._onD
OMLoaded()
;
|
270 |
|
|
|
262 |
|
}
|
271 |
|
//
Call to e
xternal ca
llback
|
|
263 |
|
}, 1
0);
|
272 |
|
if
(eval('ty
peof(tinyM
CEPopup.wi
ndowOpener
.' + cb +
')') == "u
ndefined")
|
|
264 |
|
} else {
|
273 |
|
alert("C
allback fu
nction: "
+ cb + " c
ould not b
e found.")
;
|
|
265 |
|
wind
ow.addEven
tListener(
'DOMConten
tLoaded',
function()
{
|
274 |
|
else
|
|
266 |
|
t._onDOMLo
aded();
|
275 |
|
eval("ti
nyMCEPopup
.windowOpe
ner." + cb
+ "(eleme
nt_id, url
, type, wi
ndow);");
|
|
267 |
|
}, f
alse);
|
276 |
|
},
|
|
268 |
|
}
|
277 |
|
|
|
269 |
|
}
|
278 |
|
i
mpor
t
Cl
a
ss
:
function(
c
)
{
|
|
|
279 |
|
va
r n;
|
|
|
280 |
|
|
|
|
281 |
|
wi
ndow[c] =
function()
{};
|
|
|
282 |
|
|
|
|
283 |
|
fo
r (n in wi
ndow.opene
r[c].proto
type)
|
|
|
284 |
|
window[c
].prototyp
e[n] = win
dow.opener
[c].protot
ype[n];
|
|
|
285 |
|
|
|
|
286 |
|
wi
ndow[c].co
nstructor
= window.o
pener[c].c
onstructor
;
|
|
|
287 |
|
}
|
|
270 |
|
}
|
288 |
|
|
|
|
289 |
|
};
|
|
271 |
|
};
|
290 |
|
|
|
|
291 |
|
// Setup g
lobal inst
ance
|
|
|
292 |
|
var tinyMC
EPopup = n
ew TinyMCE
_Popup();
|
|
|
293 |
|
|
|
272 |
|
|
294 |
|
tinyMCEPop
up.init();
|
|
273 |
|
tinyMCEPop
up.init();
|
|
|
274 |
|
tinyMCEPop
up._wait()
; // Wait
for DOM Co
ntent Load
ed
|