No regular expressions were active.
1 |
|
/**
|
|
1 |
|
/**
|
2 |
|
*
$Id:
editor_plu
gin_src.js
201
200
7
-0
2
-
1
2
15
:5
6
:
56
Z
spocke
$
|
|
2 |
|
*
$Id:
editor_plu
gin_src.js
677
200
8
-0
3
-
07
1
3
:5
2
:
41
Z
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 |
|
tinyMCE.im
portPlugin
LanguagePa
ck('advima
ge');
|
|
9 |
|
tinymc
e.create('
tinymce.pl
ugins.Adva
ncedImageP
lugin', {
|
|
|
10 |
|
in
it : funct
ion(ed, ur
l) {
|
|
|
11 |
|
// Regis
ter comman
ds
|
|
|
12 |
|
ed.addCo
mmand('mce
AdvImage',
function(
) {
|
|
|
13 |
|
// I
nternal im
age object
like a fl
ash placeh
older
|
|
|
14 |
|
if (
ed.dom.get
Attrib(ed.
selection.
getNode(),
'class').
indexOf('m
ceItem') !
= -1)
|
|
|
15 |
|
return;
|
|
|
16 |
|
|
|
|
17 |
|
ed.w
indowManag
er.open({
|
|
|
18 |
|
file : url
+ '/image
.htm',
|
|
|
19 |
|
width : 48
0 + parseI
nt(ed.getL
ang('advim
age.delta_
width', 0)
),
|
|
|
20 |
|
height : 3
85 + parse
Int(ed.get
Lang('advi
mage.delta
_height',
0)),
|
|
|
21 |
|
inline : 1
|
|
|
22 |
|
}, {
|
|
|
23 |
|
plugin_url
: url
|
|
|
24 |
|
});
|
|
|
25 |
|
});
|
|
|
26 |
|
|
|
|
27 |
|
// Regis
ter button
s
|
|
|
28 |
|
ed.addBu
tton('imag
e', {
|
|
|
29 |
|
titl
e : 'advim
age.image_
desc',
|
|
|
30 |
|
cmd
: 'mceAdvI
mage'
|
|
|
31 |
|
});
|
|
|
32 |
|
},
|
10 |
|
|
|
33 |
|
|
11 |
|
var TinyMC
E_Advanced
ImagePlugi
n = {
|
|
|
12 |
|
getInf
o : functi
on() {
|
|
34 |
|
ge
tInfo : fu
nction() {
|
13 |
|
re
turn {
|
|
35 |
|
return {
|
14 |
|
longname
: 'Advanc
ed image',
|
|
36 |
|
long
name : 'Ad
vanced ima
ge',
|
15 |
|
author :
'Moxiecod
e Systems
AB',
|
|
37 |
|
auth
or : 'Moxi
ecode Syst
ems AB',
|
16 |
|
authorur
l : 'http:
//tinymce.
moxiecode.
com',
|
|
38 |
|
auth
orurl : 'h
ttp://tiny
mce.moxiec
ode.com',
|
17 |
|
infourl
: 'http://
wiki.moxie
code.com/i
ndex.php/T
inyMCE:Plu
gins/advim
age',
|
|
39 |
|
info
url : 'htt
p://wiki.m
oxiecode.c
om/index.p
hp/TinyMCE
:Plugins/a
dvimage',
|
18 |
|
version
:
tiny
MCE
.majorVers
ion
+
"."
+
tiny
MCE
.minorVers
ion
|
|
40 |
|
version
:
tiny
mce
.majorVers
ion
+
"."
+
tiny
mce
.minorVers
ion
|
19 |
|
};
|
|
41 |
|
};
|
20 |
|
},
|
|
|
21 |
|
|
|
|
22 |
|
getCon
trolHTML :
function(
cn) {
|
|
|
23 |
|
sw
itch (cn)
{
|
|
|
24 |
|
case "im
age":
|
|
|
25 |
|
retu
rn tinyMCE
.getButton
HTML(cn, '
lang_image
_desc', '{
$themeurl}
/images/im
age.gif',
'mceAdvIma
ge');
|
|
|
26 |
|
}
|
|
|
27 |
|
|
|
|
28 |
|
re
turn "";
|
|
|
29 |
|
},
|
|
|
30 |
|
|
|
|
31 |
|
execCo
mmand : fu
nction(edi
tor_id, el
ement, com
mand, user
_interface
, value) {
|
|
|
32 |
|
sw
itch (comm
and) {
|
|
|
33 |
|
case "mc
eAdvImage"
:
|
|
|
34 |
|
var
template =
new Array
();
|
|
|
35 |
|
|
|
|
36 |
|
temp
late['file
'] = '..
/../plugin
s/advimage
/image.htm
';
|
|
|
37 |
|
temp
late['widt
h'] = 480
;
|
|
|
38 |
|
temp
late['heig
ht'] = 380
;
|
|
|
39 |
|
|
|
|
40 |
|
// L
anguage sp
ecific wid
th and hei
ght addons
|
|
|
41 |
|
temp
late['widt
h'] += ti
nyMCE.getL
ang('lang_
advimage_d
elta_width
', 0);
|
|
|
42 |
|
temp
late['heig
ht'] += ti
nyMCE.getL
ang('lang_
advimage_d
elta_heigh
t', 0);
|
|
|
43 |
|
|
|
|
44 |
|
var
inst = tin
yMCE.getIn
stanceById
(editor_id
);
|
|
|
45 |
|
var
elm = inst
.getFocusE
lement();
|
|
|
46 |
|
|
|
|
47 |
|
if (
elm != nul
l && tinyM
CE.getAttr
ib(elm, 'c
lass').ind
exOf('mceI
tem') != -
1)
|
|
|
48 |
|
return tru
e;
|
|
|
49 |
|
|
|
|
50 |
|
tiny
MCE.openWi
ndow(templ
ate, {edit
or_id : ed
itor_id, i
nline : "y
es"});
|
|
|
51 |
|
|
|
|
52 |
|
retu
rn true;
|
|
|
53 |
|
}
|
|
|
54 |
|
|
|
|
55 |
|
re
turn false
;
|
|
|
56 |
|
},
|
|
|
57 |
|
|
|
|
58 |
|
cleanu
p : functi
on(type, c
ontent) {
|
|
|
59 |
|
sw
itch (type
) {
|
|
|
60 |
|
case "in
sert_to_ed
itor_dom":
|
|
|
61 |
|
var
imgs = con
tent.getEl
ementsByTa
gName("img
"), src, i
;
|
|
|
62 |
|
for
(i=0; i<im
gs.length;
i++) {
|
|
|
63 |
|
var onmous
eover = ti
nyMCE.clea
nupEventSt
r(tinyMCE.
getAttrib(
imgs[i], '
onmouseove
r'));
|
|
|
64 |
|
var onmous
eout = tin
yMCE.clean
upEventStr
(tinyMCE.g
etAttrib(i
mgs[i], 'o
nmouseout'
));
|
|
|
65 |
|
|
|
|
66 |
|
if ((src =
this._get
ImageSrc(o
nmouseover
)) != "")
{
|
|
|
67 |
|
if (ti
nyMCE.getP
aram('conv
ert_urls')
)
|
|
|
68 |
|
sr
c = tinyMC
E.convertR
elativeToA
bsoluteURL
(tinyMCE.s
ettings['b
ase_href']
, src);
|
|
|
69 |
|
|
|
|
70 |
|
imgs[i
].setAttri
bute('onmo
useover',
"this.src=
'" + src +
"';");
|
|
|
71 |
|
}
|
|
|
72 |
|
|
|
|
73 |
|
if ((src =
this._get
ImageSrc(o
nmouseout)
) != "") {
|
|
|
74 |
|
if (ti
nyMCE.getP
aram('conv
ert_urls')
)
|
|
|
75 |
|
sr
c = tinyMC
E.convertR
elativeToA
bsoluteURL
(tinyMCE.s
ettings['b
ase_href']
, src);
|
|
|
76 |
|
|
|
|
77 |
|
imgs[i
].setAttri
bute('onmo
useout', "
this.src='
" + src +
"';");
|
|
|
78 |
|
}
|
|
42 |
|
}
|
79 |
|
}
|
|
43 |
|
}
);
|
80 |
|
brea
k;
|
|
|
81 |
|
|
|
|
82 |
|
case "ge
t_from_edi
tor_dom":
|
|
|
83 |
|
var
imgs = con
tent.getEl
ementsByTa
gName("img
");
|
|
|
84 |
|
for
(var i=0;
i<imgs.len
gth; i++)
{
|
|
|
85 |
|
var onmous
eover = ti
nyMCE.clea
nupEventSt
r(tinyMCE.
getAttrib(
imgs[i], '
onmouseove
r'));
|
|
|
86 |
|
var onmous
eout = tin
yMCE.clean
upEventStr
(tinyMCE.g
etAttrib(i
mgs[i], 'o
nmouseout'
));
|
|
|
87 |
|
|
|
|
88 |
|
if ((src =
this._get
ImageSrc(o
nmouseover
)) != "")
{
|
|
|
89 |
|
if (ti
nyMCE.getP
aram('conv
ert_urls')
)
|
|
|
90 |
|
sr
c = eval(t
inyMCE.set
tings['url
converter_
callback']
+ "(src,
null, true
);");
|
|
|
91 |
|
|
|
|
92 |
|
imgs[i
].setAttri
bute('onmo
useover',
"this.src=
'" + src +
"';");
|
|
|
93 |
|
}
|
|
|
94 |
|
|
|
|
95 |
|
if ((src =
this._get
ImageSrc(o
nmouseout)
) != "") {
|
|
|
96 |
|
if (ti
nyMCE.getP
aram('conv
ert_urls')
)
|
|
|
97 |
|
sr
c = eval(t
inyMCE.set
tings['url
converter_
callback']
+ "(src,
null, true
);");
|
|
|
98 |
|
|
|
|
99 |
|
imgs[i
].setAttri
bute('onmo
useout', "
this.src='
" + src +
"';");
|
|
|
100 |
|
}
|
|
|
101 |
|
}
|
|
|
102 |
|
brea
k;
|
|
|
103 |
|
}
|
|
|
104 |
|
|
|
|
105 |
|
re
turn conte
nt;
|
|
|
106 |
|
},
|
|
|
107 |
|
|
|
|
108 |
|
handle
NodeChange
: functio
n(editor_i
d, node, u
ndo_index,
undo_leve
ls, visual
_aid, any_
selection)
{
|
|
|
109 |
|
if
(node ==
null)
|
|
|
110 |
|
return;
|
|
|
111 |
|
|
|
|
112 |
|
do
{
|
|
|
113 |
|
if (node
.nodeName
== "IMG" &
& tinyMCE.
getAttrib(
node, 'cla
ss').index
Of('mceIte
m') == -1)
{
|
|
|
114 |
|
tiny
MCE.switch
Class(edit
or_id + '_
advimage',
'mceButto
nSelected'
);
|
|
|
115 |
|
retu
rn true;
|
|
|
116 |
|
}
|
|
|
117 |
|
}
while ((no
de = node.
parentNode
));
|
|
|
118 |
|
|
|
|
119 |
|
ti
nyMCE.swit
chClass(ed
itor_id +
'_advimage
', 'mceBut
tonNormal'
);
|
|
|
120 |
|
|
|
|
121 |
|
re
turn true;
|
|
|
122 |
|
},
|
|
|
123 |
|
|
|
|
124 |
|
/**
|
|
|
125 |
|
* Ret
urns the i
mage src f
rom a scri
pted mouse
over imag
e str.
|
|
|
126 |
|
*
|
|
|
127 |
|
* @pa
ram {strin
g} s Strin
g to get r
eal src fr
om.
|
|
|
128 |
|
* @re
turn Image
src from
a scripted
mouse ove
r image st
r.
|
|
|
129 |
|
* @ty
pe string
|
|
|
130 |
|
*/
|
|
|
131 |
|
_getIm
ageSrc : f
unction(s)
{
|
|
|
132 |
|
va
r sr, p =
-1;
|
|
|
133 |
|
|
|
|
134 |
|
if
(!s)
|
|
|
135 |
|
return "
";
|
|
|
136 |
|
|
|
|
137 |
|
if
((p = s.i
ndexOf('th
is.src='))
!= -1) {
|
|
|
138 |
|
sr = s.s
ubstring(p
+ 10);
|
|
|
139 |
|
sr = sr.
substring(
0, sr.inde
xOf('\''))
;
|
|
|
140 |
|
|
|
|
141 |
|
return s
r;
|
|
|
142 |
|
}
|
|
|
143 |
|
|
|
|
144 |
|
re
turn "";
|
|
|
145 |
|
}
|
|
|
146 |
|
};
|
|
|
147 |
|
|
|
44 |
|
|
148 |
|
tiny
MCE
.
add
Plugin
(
"
advimage
"
,
T
iny
MCE_
AdvancedIm
agePlugin)
;
|
|
45 |
|
// Reg
ister plug
in
|
|
|
46 |
|
tiny
mce
.
Plugin
Manager.ad
d
(
'
advimage
'
,
t
iny
mce.plugin
s.
AdvancedIm
agePlugin)
;
|
|
|
47 |
|
})();
|