No regular expressions were active.
1 |
|
/**
|
|
1 |
|
/**
|
2 |
|
*
$Id:
editor_plu
gin_src.js
2
6
4
200
7
-0
4
-
26
20
:5
3:0
9Z
spocke
$
|
|
2 |
|
*
$Id:
editor_plu
gin_src.js
6
65
200
8
-0
3
-
04
13:
26
:5
9Z
spocke
$
|
3 |
|
*
|
|
3 |
|
*
|
4 |
|
* @author
Moxiecode
|
|
4 |
|
* @author
Moxiecode
|
5 |
|
*
@copyright
Copyright
©
2004-200
7
,
Moxiecode
Systems
AB,
All
rights
reserved.
|
|
5 |
|
*
@copyright
Copyright
©
2004-200
8
,
Moxiecode
Systems
AB,
All
rights
reserved.
|
6 |
|
*/
|
|
6 |
|
*/
|
7 |
|
|
|
7 |
|
|
8 |
|
/* Import
plugin spe
cific lang
uage pack
*/
|
|
8 |
|
(function(
) {
|
9 |
|
if (!tinyM
CE.setting
s['context
menu_skip_
plugin_css
']) {
|
|
9 |
|
var Ev
ent = tiny
mce.dom.Ev
ent, each
= tinymce.
each, DOM
= tinymce.
DOM;
|
10 |
|
tinyMC
E.loadCSS(
tinyMCE.ba
seURL + "/
plugins/co
ntextmenu/
css/contex
tmenu.css"
);
|
|
|
11 |
|
}
|
|
|
12 |
|
|
|
|
13 |
|
var TinyMC
E_ContextM
enuPlugin
= {
|
|
|
14 |
|
// Pri
vate field
s
|
|
|
15 |
|
_conte
xtMenu : n
ull,
|
|
|
16 |
|
|
|
|
17 |
|
getInf
o : functi
on() {
|
|
|
18 |
|
re
turn {
|
|
|
19 |
|
longname
: 'Contex
t menus',
|
|
|
20 |
|
author :
'Moxiecod
e Systems
AB',
|
|
|
21 |
|
authorur
l : 'http:
//tinymce.
moxiecode.
com',
|
|
|
22 |
|
infourl
: 'http://
wiki.moxie
code.com/i
ndex.php/T
inyMCE:Plu
gins/conte
xtmenu',
|
|
|
23 |
|
version
: tinyMCE.
majorVersi
on + "." +
tinyMCE.m
inorVersio
n
|
|
|
24 |
|
};
|
|
|
25 |
|
},
|
|
|
26 |
|
|
|
|
27 |
|
initIn
stance : f
unction(in
st) {
|
|
|
28 |
|
//
Is not wo
rking on M
SIE 5.0 or
Opera no
contextmen
u event
|
|
|
29 |
|
if
(tinyMCE.
isMSIE5_0
&& tinyMCE
.isOpera)
|
|
|
30 |
|
return;
|
|
|
31 |
|
|
|
|
32 |
|
Ti
nyMCE_Cont
extMenuPlu
gin._conte
xtMenu = n
ew TinyMCE
_ContextMe
nu({
|
|
|
33 |
|
commandh
andler : "
TinyMCE_Co
ntextMenuP
lugin._com
mandHandle
r",
|
|
|
34 |
|
spacer_i
mage : tin
yMCE.baseU
RL + "/plu
gins/conte
xtmenu/ima
ges/spacer
.gif"
|
|
|
35 |
|
})
;
|
|
|
36 |
|
|
|
|
37 |
|
//
Add hide
event hand
les
|
|
|
38 |
|
ti
nyMCE.addE
vent(inst.
getDoc(),
"click", T
inyMCE_Con
textMenuPl
ugin._hide
ContextMen
u);
|
|
|
39 |
|
ti
nyMCE.addE
vent(inst.
getDoc(),
"keypress"
, TinyMCE_
ContextMen
uPlugin._h
ideContext
Menu);
|
|
|
40 |
|
ti
nyMCE.addE
vent(inst.
getDoc(),
"keydown",
TinyMCE_C
ontextMenu
Plugin._hi
deContextM
enu);
|
|
|
41 |
|
ti
nyMCE.addE
vent(docum
ent, "clic
k", TinyMC
E_ContextM
enuPlugin.
_hideConte
xtMenu);
|
|
|
42 |
|
ti
nyMCE.addE
vent(docum
ent, "keyp
ress", Tin
yMCE_Conte
xtMenuPlug
in._hideCo
ntextMenu)
;
|
|
|
43 |
|
ti
nyMCE.addE
vent(docum
ent, "keyd
own", Tiny
MCE_Contex
tMenuPlugi
n._hideCon
textMenu);
|
|
|
44 |
|
|
|
|
45 |
|
//
Attach co
ntextmenu
event
|
|
|
46 |
|
if
(tinyMCE.
isGecko) {
|
|
|
47 |
|
tinyMCE.
addEvent(i
nst.getDoc
(), "conte
xtmenu", f
unction(e)
{TinyMCE_
ContextMen
uPlugin._s
howContext
Menu(tinyM
CE.isMSIE
? inst.con
tentWindow
.event : e
, inst);})
;
|
|
|
48 |
|
}
else
|
|
|
49 |
|
tinyMCE.
addEvent(i
nst.getDoc
(), "conte
xtmenu", T
inyMCE_Con
textMenuPl
ugin._onCo
ntextMenu)
;
|
|
|
50 |
|
},
|
|
|
51 |
|
|
|
|
52 |
|
// Pri
vate plugi
n internal
methods
|
|
|
53 |
|
|
|
|
54 |
|
_onCon
textMenu :
function(
e) {
|
|
|
55 |
|
va
r elm = ti
nyMCE.isMS
IE ? e.src
Element :
e.target;
|
|
|
56 |
|
va
r targetIn
st, body;
|
|
|
57 |
|
|
|
|
58 |
|
//
Find inst
ance
|
|
|
59 |
|
if
((body =
tinyMCE.ge
tParentEle
ment(elm,
"body")) !
= null) {
|
|
|
60 |
|
for (var
n in tiny
MCE.instan
ces) {
|
|
|
61 |
|
var
inst = tin
yMCE.insta
nces[n];
|
|
|
62 |
|
if (
!tinyMCE.i
sInstance(
inst))
|
|
|
63 |
|
continue;
|
|
|
64 |
|
|
|
|
65 |
|
if (
body == in
st.getBody
()) {
|
|
|
66 |
|
targetInst
= inst;
|
|
|
67 |
|
break;
|
|
|
68 |
|
}
|
|
|
69 |
|
}
|
|
|
70 |
|
|
|
|
71 |
|
return T
inyMCE_Con
textMenuPl
ugin._show
ContextMen
u(tinyMCE.
isMSIE ? t
argetInst.
contentWin
dow.event
: e, targe
tInst);
|
|
|
72 |
|
}
|
|
|
73 |
|
},
|
|
|
74 |
|
|
|
10 |
|
|
75 |
|
_showCo
n
t
extMenu
:
function(e
,
inst
)
{
|
|
11 |
|
tinymc
e.create('
tinymce.pl
ugins.Cont
extMenu',
{
|
76 |
|
if
(e.ctrlKe
y)
|
|
12 |
|
i
n
i
t
:
function(e
d
)
{
|
77 |
|
return t
rue;
|
|
13 |
|
var t =
this;
|
78 |
|
|
|
14 |
|
|
79 |
|
fu
nction get
Attrib(elm
, name) {
|
|
15 |
|
t.editor
= ed;
|
80 |
|
return e
lm.getAttr
ibute(name
) ? elm.ge
tAttribute
(name) : "
";
|
|
16 |
|
t.onCont
extMenu =
new tinymc
e.util.Dis
patcher(th
is);
|
81 |
|
}
|
|
|
82 |
|
|
|
|
83 |
|
va
r x, y, el
m, context
Menu;
|
|
|
84 |
|
va
r pos = ti
nyMCE.getA
bsPosition
(inst.ifra
meElement)
;
|
|
|
85 |
|
|
|
|
86 |
|
x
= tinyMCE.
isMSIE ? e
.screenX :
pos.absLe
ft + (e.pa
geX - inst
.getBody()
.scrollLef
t);
|
|
|
87 |
|
y
= tinyMCE.
isMSIE ? e
.screenY :
pos.absTo
p + (e.pag
eY - inst.
getBody().
scrollTop)
;
|
|
|
88 |
|
el
m = tinyMC
E.isMSIE ?
e.srcElem
ent : e.ta
rget;
|
|
|
89 |
|
|
|
|
90 |
|
co
ntextMenu
= this._co
ntextMenu;
|
|
|
91 |
|
co
ntextMenu.
inst = ins
t;
|
|
|
92 |
|
|
|
|
93 |
|
//
Mozilla n
eeds some
time
|
|
|
94 |
|
wi
ndow.setTi
meout(func
tion () {
|
|
|
95 |
|
var them
e = tinyMC
E.getParam
("theme");
|
|
|
96 |
|
|
|
|
97 |
|
contextM
enu.clearA
ll();
|
|
|
98 |
|
var sel
= inst.sel
ection.get
SelectedTe
xt().lengt
h != 0 ||
elm.nodeNa
me == "IMG
";
|
|
|
99 |
|
|
|
|
100 |
|
// Defau
lt items
|
|
|
101 |
|
contextM
enu.addIte
m(tinyMCE.
baseURL +
"/themes/"
+ theme +
"/images/
cut.gif",
"$lang_cut
_desc", "C
ut", "", !
sel);
|
|
|
102 |
|
contextM
enu.addIte
m(tinyMCE.
baseURL +
"/themes/"
+ theme +
"/images/
copy.gif",
"$lang_co
py_desc",
"Copy", ""
, !sel);
|
|
|
103 |
|
contextM
enu.addIte
m(tinyMCE.
baseURL +
"/themes/"
+ theme +
"/images/
paste.gif"
, "$lang_p
aste_desc"
, "Paste",
"", false
);
|
|
|
104 |
|
|
|
|
105 |
|
if (sel
|| (elm ?
(elm.nodeN
ame == 'A'
&& tinyMC
E.getAttri
b(elm, 'na
me') == ''
) || (elm.
nodeName =
= 'IMG') :
false)) {
|
|
|
106 |
|
cont
extMenu.ad
dSeparator
();
|
|
|
107 |
|
cont
extMenu.ad
dItem(tiny
MCE.baseUR
L + "/them
es/advance
d/images/l
ink.gif",
"$lang_lin
k_desc", i
nst.hasPlu
gin("advli
nk") ? "mc
eAdvLink"
: "mceLink
");
|
|
|
108 |
|
cont
extMenu.ad
dItem(tiny
MCE.baseUR
L + "/them
es/advance
d/images/u
nlink.gif"
, "$lang_u
nlink_desc
", "unlink
", "", (el
m ? (elm.n
odeName !=
'A') && (
elm.nodeNa
me != 'IMG
') : true)
);
|
|
|
109 |
|
}
|
|
|
110 |
|
|
|
|
111 |
|
// Get e
lement
|
|
|
112 |
|
elm = ti
nyMCE.getP
arentEleme
nt(elm, "i
mg,table,t
d" + (inst
.hasPlugin
("advhr")
? ',hr' :
''));
|
|
|
113 |
|
if (elm)
{
|
|
|
114 |
|
swit
ch (elm.no
deName) {
|
|
|
115 |
|
case "IMG"
:
|
|
|
116 |
|
contex
tMenu.addS
eparator()
;
|
|
|
117 |
|
|
|
17 |
|
|
118 |
|
// If
flash
|
|
18 |
|
ed.onCon
textMenu.a
dd(functio
n(ed, e) {
|
119 |
|
if (ti
nyMCE.hasP
lugin('fla
sh') && ti
nyMCE.getA
ttrib(elm,
'class').
indexOf('m
ceItemFlas
h') != -1)
|
|
19 |
|
if (
!e.ctrlKey
) {
|
120 |
|
co
ntextMenu.
addItem(ti
nyMCE.base
URL + "/pl
ugins/flas
h/images/f
lash.gif",
"$lang_fl
ash_props"
, "mceFlas
h");
|
|
20 |
|
t._getMenu
(ed).showM
enu(e.clie
ntX, e.cli
entY);
|
121 |
|
else i
f (tinyMCE
.hasPlugin
('media')
&& /mceIte
m(Flash|Sh
ockWave|Wi
ndowsMedia
|QuickTime
|RealMedia
)/.test(ti
nyMCE.getA
ttrib(elm,
'class'))
)
|
|
21 |
|
Event.canc
el(e);
|
122 |
|
co
ntextMenu.
addItem(ti
nyMCE.base
URL + "/pl
ugins/flas
h/images/f
lash.gif",
"$lang_me
dia_title"
, "mceMedi
a");
|
|
|
123 |
|
else
|
|
|
124 |
|
co
ntextMenu.
addItem(ti
nyMCE.base
URL + "/th
emes/" + t
heme + "/i
mages/imag
e.gif", "$
lang_image
_props_des
c", inst.h
asPlugin("
advimage")
? "mceAdv
Image" : "
mceImage")
;
|
|
|
125 |
|
break;
|
|
|
126 |
|
|
|
|
127 |
|
case "HR":
|
|
|
128 |
|
contex
tMenu.addS
eparator()
;
|
|
|
129 |
|
contex
tMenu.addI
tem(tinyMC
E.baseURL
+ "/plugin
s/advhr/im
ages/advhr
.gif", "$l
ang_insert
_advhr_des
c", "mceAd
vancedHr")
;
|
|
|
130 |
|
break;
|
|
|
131 |
|
|
|
|
132 |
|
case "TABL
E":
|
|
|
133 |
|
case "TD":
|
|
|
134 |
|
// Is
table plug
in loaded
|
|
|
135 |
|
if (in
st.hasPlug
in("table"
)) {
|
|
|
136 |
|
va
r colspan
= (elm.nod
eName == "
TABLE") ?
"" : getAt
trib(elm,
"colspan")
;
|
|
|
137 |
|
va
r rowspan
= (elm.nod
eName == "
TABLE") ?
"" : getAt
trib(elm,
"rowspan")
;
|
|
|
138 |
|
|
|
|
139 |
|
co
lspan = co
lspan == "
" ? "1" :
colspan;
|
|
|
140 |
|
ro
wspan = ro
wspan == "
" ? "1" :
rowspan;
|
|
|
141 |
|
|
|
|
142 |
|
co
ntextMenu.
addSeparat
or();
|
|
|
143 |
|
co
ntextMenu.
addItem(ti
nyMCE.base
URL + "/th
emes/" + t
heme + "/i
mages/cut.
gif", "$la
ng_table_c
ut_row_des
c", "mceTa
bleCutRow"
);
|
|
|
144 |
|
co
ntextMenu.
addItem(ti
nyMCE.base
URL + "/th
emes/" + t
heme + "/i
mages/copy
.gif", "$l
ang_table_
copy_row_d
esc", "mce
TableCopyR
ow");
|
|
|
145 |
|
co
ntextMenu.
addItem(ti
nyMCE.base
URL + "/th
emes/" + t
heme + "/i
mages/past
e.gif", "$
lang_table
_paste_row
_before_de
sc", "mceT
ablePasteR
owBefore",
"", inst.
tableRowCl
ipboard ==
null);
|
|
|
146 |
|
co
ntextMenu.
addItem(ti
nyMCE.base
URL + "/th
emes/" + t
heme + "/i
mages/past
e.gif", "$
lang_table
_paste_row
_after_des
c", "mceTa
blePasteRo
wAfter", "
", inst.ta
bleRowClip
board == n
ull);
|
|
|
147 |
|
|
|
|
148 |
|
/*
co
ntextMenu.
addItem(ti
nyMCE.base
URL + "/th
emes/" + t
heme + "/i
mages/just
ifyleft.gi
f", "$lang
_justifyle
ft_desc",
"JustifyLe
ft", "", f
alse);
|
|
|
149 |
|
co
ntextMenu.
addItem(ti
nyMCE.base
URL + "/th
emes/" + t
heme + "/i
mages/just
ifycenter.
gif", "$la
ng_justify
center_des
c", "Justi
fyCenter",
"", false
);
|
|
|
150 |
|
co
ntextMenu.
addItem(ti
nyMCE.base
URL + "/th
emes/" + t
heme + "/i
mages/just
ifyright.g
if", "$lan
g_justifyr
ight_desc"
, "Justify
Right", ""
, false);
|
|
|
151 |
|
co
ntextMenu.
addItem(ti
nyMCE.base
URL + "/th
emes/" + t
heme + "/i
mages/just
ifyfull.gi
f", "$lang
_justifyfu
ll_desc",
"JustifyFu
ll", "", f
alse);*/
|
|
|
152 |
|
co
ntextMenu.
addSeparat
or();
|
|
|
153 |
|
co
ntextMenu.
addItem(ti
nyMCE.base
URL + "/pl
ugins/tabl
e/images/t
able.gif",
"$lang_ta
ble_desc",
"mceInser
tTable", "
insert");
|
|
|
154 |
|
co
ntextMenu.
addItem(ti
nyMCE.base
URL + "/pl
ugins/tabl
e/images/t
able.gif",
"$lang_ta
ble_props_
desc", "mc
eInsertTab
le");
|
|
|
155 |
|
co
ntextMenu.
addItem(ti
nyMCE.base
URL + "/pl
ugins/tabl
e/images/t
able_cell_
props.gif"
, "$lang_t
able_cell_
desc", "mc
eTableCell
Props");
|
|
|
156 |
|
co
ntextMenu.
addItem(ti
nyMCE.base
URL + "/pl
ugins/tabl
e/images/t
able_delet
e.gif", "$
lang_table
_del", "mc
eTableDele
te");
|
|
|
157 |
|
co
ntextMenu.
addSeparat
or();
|
|
|
158 |
|
co
ntextMenu.
addItem(ti
nyMCE.base
URL + "/pl
ugins/tabl
e/images/t
able_row_p
rops.gif",
"$lang_ta
ble_row_de
sc", "mceT
ableRowPro
ps");
|
|
|
159 |
|
co
ntextMenu.
addItem(ti
nyMCE.base
URL + "/pl
ugins/tabl
e/images/t
able_inser
t_row_befo
re.gif", "
$lang_tabl
e_row_befo
re_desc",
"mceTableI
nsertRowBe
fore");
|
|
|
160 |
|
co
ntextMenu.
addItem(ti
nyMCE.base
URL + "/pl
ugins/tabl
e/images/t
able_inser
t_row_afte
r.gif", "$
lang_table
_row_after
_desc", "m
ceTableIns
ertRowAfte
r");
|
|
|
161 |
|
co
ntextMenu.
addItem(ti
nyMCE.base
URL + "/pl
ugins/tabl
e/images/t
able_delet
e_row.gif"
, "$lang_t
able_delet
e_row_desc
", "mceTab
leDeleteRo
w");
|
|
|
162 |
|
co
ntextMenu.
addSeparat
or();
|
|
|
163 |
|
co
ntextMenu.
addItem(ti
nyMCE.base
URL + "/pl
ugins/tabl
e/images/t
able_inser
t_col_befo
re.gif", "
$lang_tabl
e_col_befo
re_desc",
"mceTableI
nsertColBe
fore");
|
|
|
164 |
|
co
ntextMenu.
addItem(ti
nyMCE.base
URL + "/pl
ugins/tabl
e/images/t
able_inser
t_col_afte
r.gif", "$
lang_table
_col_after
_desc", "m
ceTableIns
ertColAfte
r");
|
|
|
165 |
|
co
ntextMenu.
addItem(ti
nyMCE.base
URL + "/pl
ugins/tabl
e/images/t
able_delet
e_col.gif"
, "$lang_t
able_delet
e_col_desc
", "mceTab
leDeleteCo
l");
|
|
|
166 |
|
co
ntextMenu.
addSeparat
or();
|
|
|
167 |
|
co
ntextMenu.
addItem(ti
nyMCE.base
URL + "/pl
ugins/tabl
e/images/t
able_split
_cells.gif
", "$lang_
table_spli
t_cells_de
sc", "mceT
ableSplitC
ells", "",
(colspan
== "1" &&
rowspan ==
"1"));
|
|
|
168 |
|
co
ntextMenu.
addItem(ti
nyMCE.base
URL + "/pl
ugins/tabl
e/images/t
able_merge
_cells.gif
", "$lang_
table_merg
e_cells_de
sc", "mceT
ableMergeC
ells", "",
false);
|
|
|
169 |
|
}
|
|
22 |
|
}
|
170 |
|
break
;
|
|
23 |
|
})
;
|
171 |
|
}
|
|
|
172 |
|
} else
{
|
|
|
173 |
|
// A
dd table s
pecific
|
|
|
174 |
|
if (
inst.hasPl
ugin("tabl
e")) {
|
|
|
175 |
|
contextMen
u.addSepar
ator();
|
|
|
176 |
|
contextMen
u.addItem(
tinyMCE.ba
seURL + "/
plugins/ta
ble/images
/table.gif
", "$lang_
table_desc
", "mceIns
ertTable",
"insert")
;
|
|
|
177 |
|
}
|
|
|
178 |
|
}
|
|
|
179 |
|
|
|
|
180 |
|
contextM
enu.show(x
, y);
|
|
|
181 |
|
},
10);
|
|
|
182 |
|
|
|
|
183 |
|
//
Cancel de
fault hand
eling
|
|
|
184 |
|
ti
nyMCE.canc
elEvent(e)
;
|
|
|
185 |
|
re
turn false
;
|
|
|
186 |
|
},
|
|
|
187 |
|
|
|
|
188 |
|
_hideC
ontextMenu
: functio
n() {
|
|
|
189 |
|
if
(TinyMCE_
ContextMen
uPlugin._c
ontextMenu
)
|
|
|
190 |
|
TinyMCE_
ContextMen
uPlugin._c
ontextMenu
.hide();
|
|
|
191 |
|
},
|
|
|
192 |
|
|
|
|
193 |
|
_comma
ndHandler
: function
(command,
value) {
|
|
|
194 |
|
va
r cm = Tin
yMCE_Conte
xtMenuPlug
in._contex
tMenu;
|
|
|
195 |
|
|
|
|
196 |
|
cm
.hide();
|
|
|
197 |
|
|
|
|
198 |
|
//
UI must b
e true on
these
|
|
|
199 |
|
va
r ui = fal
se;
|
|
|
200 |
|
if
(command
== "mceIns
ertTable"
|| command
== "mceTa
bleCellPro
ps" || com
mand == "m
ceTableRow
Props" ||
command ==
"mceTable
MergeCells
")
|
|
|
201 |
|
ui = tru
e;
|
|
|
202 |
|
|
|
|
203 |
|
if
(command
== "Paste"
)
|
|
|
204 |
|
value =
null;
|
|
|
205 |
|
|
|
24 |
|
|
206 |
|
if
(tinyMCE.
getParam("
dialog_typ
e") == "mo
dal" && ti
nyMCE.isMS
IE) {
|
|
25 |
|
function
hide
()
{
|
207 |
|
// Cell
properties
will gene
rate acces
s denied e
rror is th
is isn't d
one?!
|
|
26 |
|
if (
t._menu) {
|
208 |
|
window.set
Timeout(
function
()
{
|
|
27 |
|
t._menu.re
moveAll();
|
209 |
|
cm.i
nst.execCo
mmand(comm
and, ui, v
alue);
|
|
28 |
|
t._menu.de
stroy();
|
210 |
|
}, 100);
|
|
|
211 |
|
}
else
|
|
|
212 |
|
cm.inst.
execComman
d(command,
ui, value
);
|
|
|
213 |
|
}
|
|
29 |
|
}
|
214 |
|
};
|
|
30 |
|
};
|
215 |
|
|
|
31 |
|
|
216 |
|
tinyMCE.ad
dPlugin("c
ontextmenu
", TinyMCE
_ContextMe
nuPlugin);
|
|
32 |
|
ed.onMou
seDown.add
(hide);
|
217 |
|
|
|
33 |
|
ed.onKey
Down.add(h
ide);
|
218 |
|
// Context
menu clas
s
|
|
34 |
|
Event.ad
d(document
, 'click',
hide);
|
|
|
35 |
|
},
|
219 |
|
|
|
36 |
|
|
220 |
|
function T
inyMCE_Con
textMenu(s
ettings) {
|
|
37 |
|
_g
etMenu : f
unction(ed
) {
|
221 |
|
var do
c, self =
this;
|
|
38 |
|
var t =
this, m =
t._menu, s
e = ed.sel
ection, co
l = se.isC
ollapsed()
, el = se.
getNode()
|| ed.getB
ody(), am,
p1, p2;
|
222 |
|
|
|
39 |
|
|
223 |
|
// Def
ault value
function
|
|
40 |
|
if (m) {
|
224 |
|
functi
on defPara
m(key, def
_val) {
|
|
41 |
|
m.re
moveAll();
|
225 |
|
se
ttings[key
] = typeof
(settings[
key]) != "
undefined"
? setting
s[key] : d
ef_val;
|
|
42 |
|
m.de
stroy();
|
226 |
|
}
|
|
43 |
|
}
|
227 |
|
|
|
44 |
|
|
228 |
|
this.i
sMSIE = (n
avigator.a
ppName ==
"Microsoft
Internet
Explorer")
;
|
|
45 |
|
p1 = DOM
.getPos(ed
.getConten
tAreaConta
iner());
|
|
|
46 |
|
p2 = DOM
.getPos(ed
.getContai
ner());
|
229 |
|
|
|
47 |
|
|
230 |
|
// Set
up context
menu div
|
|
48 |
|
m = ed.c
ontrolMana
ger.create
DropMenu('
contextmen
u', {
|
231 |
|
this.c
ontextMenu
Div = docu
ment.creat
eElement("
div");
|
|
49 |
|
offs
et_x : p1.
x,
|
232 |
|
this.c
ontextMenu
Div.classN
ame = "con
textMenu";
|
|
50 |
|
offs
et_y : p1.
y,
|
233 |
|
this.c
ontextMenu
Div.setAtt
ribute("cl
ass", "con
textMenu")
;
|
|
51 |
|
/*
vp_o
ffset_x :
p2.x,
|
234 |
|
this.c
ontextMenu
Div.style.
display =
"none";
|
|
52 |
|
vp_o
ffset_y :
p2.y,*/
|
235 |
|
this.c
ontextMenu
Div.style.
position =
'absolute
';
|
|
53 |
|
cons
train : 1
|
236 |
|
this.c
ontextMenu
Div.style.
zindex = 1
000;
|
|
54 |
|
});
|
237 |
|
this.c
ontextMenu
Div.style.
left = '0'
;
|
|
|
238 |
|
this.c
ontextMenu
Div.style.
top = '0';
|
|
|
239 |
|
this.c
ontextMenu
Div.unsele
ctable = "
on";
|
|
|
240 |
|
|
|
|
241 |
|
docume
nt.body.ap
pendChild(
this.conte
xtMenuDiv)
;
|
|
|
242 |
|
|
|
55 |
|
|
243 |
|
// Set
up default
values
|
|
56 |
|
t._menu
= m;
|
244 |
|
defPar
am("comman
dhandler",
"");
|
|
|
245 |
|
defPar
am("spacer
_image", "
images/spa
cer.gif");
|
|
|
246 |
|
|
|
57 |
|
|
247 |
|
this.i
tems = new
Array();
|
|
58 |
|
m.add({t
itle : 'ad
vanced.cut
_desc', ic
on : 'cut'
, cmd : 'C
ut'}).setD
isabled(co
l);
|
248 |
|
this.s
ettings =
settings;
|
|
59 |
|
m.add({t
itle : 'ad
vanced.cop
y_desc', i
con : 'cop
y', cmd :
'Copy'}).s
etDisabled
(col);
|
249 |
|
this.h
tml = "";
|
|
60 |
|
m.add({t
itle : 'ad
vanced.pas
te_desc',
icon : 'pa
ste', cmd
: 'Paste'}
);
|
250 |
|
|
|
61 |
|
|
251 |
|
// IE
Popup
|
|
62 |
|
if ((el.
nodeName =
= 'A' && !
ed.dom.get
Attrib(el,
'name'))
|| !col) {
|
252 |
|
if (ti
nyMCE.isMS
IE && !tin
yMCE.isMSI
E5_0 && !t
inyMCE.isO
pera) {
|
|
63 |
|
m.ad
dSeparator
();
|
253 |
|
th
is.pop = w
indow.crea
tePopup();
|
|
64 |
|
m.ad
d({title :
'advanced
.link_desc
', icon :
'link', cm
d : ed.plu
gins.advli
nk ? 'mceA
dvLink' :
'mceLink',
ui : true
});
|
254 |
|
do
c = this.p
op.documen
t;
|
|
65 |
|
m.ad
d({title :
'advanced
.unlink_de
sc', icon
: 'unlink'
, cmd : 'U
nLink'});
|
255 |
|
do
c.open();
|
|
|
256 |
|
do
c.write('<
html><head
><link hre
f="' + tin
yMCE.baseU
RL + '/plu
gins/conte
xtmenu/css
/contextme
nu.css" re
l="stylesh
eet" type=
"text/css"
/></head>
<body unse
lectable="
yes" class
="contextM
enuIEPopup
"></body><
/html>');
|
|
|
257 |
|
do
c.close();
|
|
|
258 |
|
}
|
|
66 |
|
}
|
259 |
|
};
|
|
|
260 |
|
|
|
|
261 |
|
TinyMCE_Co
ntextMenu.
prototype
= {
|
|
|
262 |
|
clearA
ll : funct
ion() {
|
|
|
263 |
|
th
is.html =
"";
|
|
|
264 |
|
th
is.context
MenuDiv.in
nerHTML =
"";
|
|
|
265 |
|
},
|
|
|
266 |
|
|
|
|
267 |
|
addSep
arator : f
unction()
{
|
|
|
268 |
|
th
is.html +=
'<tr clas
s="context
MenuItem">
<td class=
"contextMe
nuIcon"><i
mg src="'
+ this.set
tings['spa
cer_image'
] + '" wid
th="20" he
ight="1" c
lass="cont
extMenuIma
ge" /></td
><td><img
class="con
textMenuSe
parator" w
idth="1" h
eight="1"
src="' + t
his.settin
gs['spacer
_image'] +
'" /></td
></tr>';
|
|
|
269 |
|
},
|
|
|
270 |
|
|
|
|
271 |
|
addIte
m : functi
on(icon, t
itle, comm
and, value
, disabled
) {
|
|
|
272 |
|
if
(title.ch
arAt(0) ==
'$')
|
|
|
273 |
|
title =
tinyMCE.ge
tLang(titl
e.substrin
g(1));
|
|
|
274 |
|
|
|
|
275 |
|
va
r onMouseD
own = '';
|
|
|
276 |
|
va
r html = '
';
|
|
|
277 |
|
|
|
|
278 |
|
if
(tinyMCE.
isMSIE &&
!tinyMCE.i
sMSIE5_0)
|
|
|
279 |
|
onMouseD
own = 'con
textMenu.e
xecCommand
(\'' + com
mand + '\'
, \'' + va
lue + '\')
;return fa
lse;';
|
|
|
280 |
|
el
se
|
|
|
281 |
|
onMouseD
own = this
.settings[
'commandha
ndler'] +
'(\'' + co
mmand + '\
', \'' + v
alue + '\'
);return f
alse;';
|
|
|
282 |
|
|
|
67 |
|
|
283 |
|
if
(icon ==
"")
|
|
68 |
|
m.addSep
arator();
|
284 |
|
icon = t
his.settin
gs['spacer
_image'];
|
|
69 |
|
m.add({t
itle : 'ad
vanced.ima
ge_desc',
icon : 'im
age', cmd
: ed.plugi
ns.advimag
e ? 'mceAd
vImage' :
'mceImage'
, ui : tru
e});
|
285 |
|
|
|
70 |
|
|
286 |
|
if
(!disable
d)
|
|
71 |
|
m.addSep
arator();
|
287 |
|
html +=
'<tr class
="contextM
enuItem">'
;
|
|
72 |
|
am = m.a
ddMenu({ti
tle : 'con
textmenu.a
lign'});
|
288 |
|
el
se
|
|
73 |
|
am.add({
title : 'c
ontextmenu
.left', ic
on : 'just
ifyleft',
cmd : 'Jus
tifyLeft'}
);
|
289 |
|
html +=
'<tr class
="contextM
enuItemDis
abled">';
|
|
74 |
|
am.add({
title : 'c
ontextmenu
.center',
icon : 'ju
stifycente
r', cmd :
'JustifyCe
nter'});
|
|
|
75 |
|
am.add({
title : 'c
ontextmenu
.right', i
con : 'jus
tifyright'
, cmd : 'J
ustifyRigh
t'});
|
|
|
76 |
|
am.add({
title : 'c
ontextmenu
.full', ic
on : 'just
ifyfull',
cmd : 'Jus
tifyFull'}
);
|
290 |
|
|
|
77 |
|
|
291 |
|
ht
ml += '<td
class="co
ntextMenuI
con"><img
src="' + i
con + '" w
idth="20"
height="20
" class="c
ontextMenu
Image" /><
/td>';
|
|
78 |
|
t.onCont
extMenu.di
spatch(t,
m, el, col
);
|
292 |
|
ht
ml += '<td
><div clas
s="context
MenuText">
';
|
|
|
293 |
|
ht
ml += '<a
href="java
script:voi
d(0);" onc
lick="' +
onMouseDow
n + '" onm
ousedown="
return fal
se;"> 
;';
|
|
|
294 |
|
|
|
79 |
|
|
295 |
|
//
Add text
|
|
80 |
|
return m
;
|
296 |
|
ht
ml += titl
e;
|
|
|
297 |
|
|
|
|
298 |
|
ht
ml += '
60;</a>';
|
|
|
299 |
|
ht
ml += '</d
iv></td>';
|
|
|
300 |
|
ht
ml += '</t
r>';
|
|
|
301 |
|
|
|
|
302 |
|
//
Add to ma
in
|
|
|
303 |
|
th
is.html +=
html;
|
|
|
304 |
|
},
|
|
|
305 |
|
|
|
|
306 |
|
show :
function(
x, y) {
|
|
|
307 |
|
va
r vp, widt
h, height,
yo;
|
|
|
308 |
|
|
|
|
309 |
|
if
(this.htm
l == "")
|
|
|
310 |
|
return;
|
|
|
311 |
|
|
|
|
312 |
|
va
r html = '
';
|
|
|
313 |
|
|
|
|
314 |
|
ht
ml += '<a
href="#"><
/a><table
border="0"
cellpaddi
ng="0" cel
lspacing="
0">';
|
|
|
315 |
|
ht
ml += this
.html;
|
|
|
316 |
|
ht
ml += '</t
able>';
|
|
|
317 |
|
|
|
|
318 |
|
th
is.context
MenuDiv.in
nerHTML =
html;
|
|
|
319 |
|
|
|
|
320 |
|
//
Get dimen
sions
|
|
|
321 |
|
th
is.context
MenuDiv.st
yle.displa
y = "block
";
|
|
|
322 |
|
wi
dth = this
.contextMe
nuDiv.offs
etWidth;
|
|
|
323 |
|
he
ight = thi
s.contextM
enuDiv.off
setHeight;
|
|
|
324 |
|
th
is.context
MenuDiv.st
yle.displa
y = "none"
;
|
|
|
325 |
|
|
|
|
326 |
|
if
(tinyMCE.
isMSIE &&
!tinyMCE.i
sMSIE5_0 &
& !tinyMCE
.isOpera)
{
|
|
|
327 |
|
// Setup
popup and
show
|
|
|
328 |
|
this.pop
.document.
body.inner
HTML = '<d
iv class="
contextMen
u">' + htm
l + "</div
>";
|
|
|
329 |
|
this.pop
.document.
tinyMCE =
tinyMCE;
|
|
|
330 |
|
this.pop
.document.
contextMen
u = this;
|
|
|
331 |
|
this.pop
.show(x, y
, width, h
eight);
|
|
|
332 |
|
}
else {
|
|
|
333 |
|
vp = thi
s.getViewP
ort();
|
|
|
334 |
|
yo = tin
yMCE.isMSI
E5_0 ? doc
ument.body
.scrollTop
: self.pa
geYOffset;
|
|
|
335 |
|
this.con
textMenuDi
v.style.le
ft = (x >
vp.left +
vp.width -
width ? v
p.left + v
p.width -
width : x)
+ 'px';
|
|
|
336 |
|
this.con
textMenuDi
v.style.to
p = (y > v
p.top + vp
.height -
height ? v
p.top + vp
.height -
height : y
) + 'px';
|
|
|
337 |
|
this.con
textMenuDi
v.style.di
splay = "b
lock";
|
|
|
338 |
|
}
|
|
81 |
|
}
|
339 |
|
}
,
|
|
82 |
|
}
);
|
340 |
|
|
|
|
341 |
|
getVie
wPort : fu
nction() {
|
|
|
342 |
|
re
turn {
|
|
|
343 |
|
left : s
elf.pageXO
ffset || s
elf.docume
nt.documen
tElement.s
crollLeft
|| self.do
cument.bod
y.scrollLe
ft,
|
|
|
344 |
|
top: sel
f.pageYOff
set || sel
f.document
.documentE
lement.scr
ollTop ||
self.docum
ent.body.s
crollTop,
|
|
|
345 |
|
width :
document.d
ocumentEle
ment.offse
tWidth ||
document.b
ody.offset
Width,
|
|
|
346 |
|
height :
self.inne
rHeight ||
document.
documentEl
ement.clie
ntHeight |
| document
.body.clie
ntHeight
|
|
|
347 |
|
};
|
|
|
348 |
|
},
|
|
|
349 |
|
|
|
|
350 |
|
hide :
function(
) {
|
|
|
351 |
|
if
(tinyMCE.
isMSIE &&
!tinyMCE.i
sMSIE5_0 &
& !tinyMCE
.isOpera)
|
|
|
352 |
|
this.pop
.hide();
|
|
|
353 |
|
el
se
|
|
|
354 |
|
this.con
textMenuDi
v.style.di
splay = "n
one";
|
|
|
355 |
|
},
|
|
|
356 |
|
|
|
83 |
|
|
357 |
|
execCo
mmand : fu
nction(com
mand, valu
e) {
|
|
84 |
|
// Reg
ister plug
in
|
358 |
|
ev
al(this.se
ttings['co
mmandhandl
er'] + "(c
ommand, va
lue);");
|
|
85 |
|
tinymc
e.PluginMa
nager.add(
'contextme
nu', tinym
ce.plugins
.ContextMe
nu);
|
359 |
|
}
|
|
86 |
|
}
)()
;
|
360 |
|
}
;
|
|
|