No regular expressions were active.
1 |
|
/**
|
|
1 |
|
/**
|
2 |
|
*
$Id:
editor_plu
gin_src.js
268
200
7
-0
4
-
28
1
5
:
52
:5
9
Z
spocke
$
|
|
2 |
|
*
$Id:
editor_plu
gin_src.js
539
200
8
-0
1
-
1
4
19
:
08
:5
8
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('advlin
k');
|
|
9 |
|
tinymc
e.create('
tinymce.pl
ugins.Adva
ncedLinkPl
ugin', {
|
|
|
10 |
|
in
it : funct
ion(ed, ur
l) {
|
|
|
11 |
|
this.edi
tor = ed;
|
10 |
|
|
|
12 |
|
|
11 |
|
var TinyMC
E_Advanced
LinkPlugin
= {
|
|
13 |
|
// Regis
ter comman
ds
|
12 |
|
getInf
o : functi
on() {
|
|
14 |
|
ed.addCo
mmand('mce
AdvLink',
function()
{
|
13 |
|
re
turn {
|
|
15 |
|
var
se = ed.se
lection;
|
14 |
|
longname
: 'Advanc
ed link',
|
|
|
15 |
|
author :
'Moxiecod
e Systems
AB',
|
|
|
16 |
|
authorur
l : 'http:
//tinymce.
moxiecode.
com',
|
|
|
17 |
|
infourl
: 'http://
wiki.moxie
code.com/i
ndex.php/T
inyMCE:Plu
gins/advli
nk',
|
|
|
18 |
|
version
: tinyMCE.
majorVersi
on + "." +
tinyMCE.m
inorVersio
n
|
|
|
19 |
|
};
|
|
|
20 |
|
},
|
|
|
21 |
|
|
|
|
22 |
|
initIn
stance : f
unction(in
st) {
|
|
|
23 |
|
in
st.addShor
tcut('ctrl
', 'k', 'l
ang_advlin
k_desc', '
mceAdvLink
');
|
|
|
24 |
|
},
|
|
|
25 |
|
|
|
16 |
|
|
26 |
|
getCon
trolHTML :
function(
cn) {
|
|
17 |
|
// N
o selectio
n and not
in link
|
27 |
|
sw
itch (cn)
{
|
|
18 |
|
if (
se.isColla
psed() &&
!ed.dom.ge
tParent(se
.getNode()
, 'A'))
|
28 |
|
case "li
nk":
|
|
19 |
|
return
;
|
29 |
|
retu
rn tinyMCE
.getButton
HTML(cn, '
lang_link_
desc', '{$
themeurl}/
images/lin
k.gif', 'm
ceAdvLink'
);
|
|
|
30 |
|
}
|
|
|
31 |
|
|
|
|
32 |
|
return
""
;
|
|
|
33 |
|
},
|
|
|
34 |
|
|
|
|
35 |
|
execCo
mmand : fu
nction(edi
tor_id, el
ement, com
mand, user
_interface
, value) {
|
|
|
36 |
|
sw
itch (comm
and) {
|
|
|
37 |
|
case "mc
eAdvLink":
|
|
|
38 |
|
var
inst = tin
yMCE.getIn
stanceById
(editor_id
), anySele
ction = fa
lse;
|
|
|
39 |
|
var
focusElm =
inst.getF
ocusElemen
t(), selec
tedText =
inst.selec
tion.getSe
lectedText
();
|
|
|
40 |
|
|
|
|
41 |
|
if (
tinyMCE.se
lectedElem
ent)
|
|
|
42 |
|
anySelecti
on = (tiny
MCE.select
edElement.
nodeName.t
oLowerCase
() == "img
") || (sel
ectedText
&& selecte
dText.leng
th > 0);
|
|
|
43 |
|
|
|
20 |
|
|
44 |
|
if (
anySelecti
on || (foc
usElm != n
ull && foc
usElm.node
Name == "A
")) {
|
|
21 |
|
ed.w
indowManag
er.open({
|
45 |
|
tinyMCE.op
enWindow({
|
|
22 |
|
file
:
u
r
l
+
'
/link.htm'
,
|
46 |
|
file
:
'../../pl
u
gins/adv
l
ink
/link.htm'
,
|
|
23 |
|
width
:
480
+
parseI
n
t(ed
.getLang('
advlink
.
delta_widt
h',
0)
)
,
|
47 |
|
width
:
480
+
ti
n
yMCE
.getLang('
lang_
advlink
_
delta_widt
h',
0)
,
|
|
24 |
|
height
:
400
+
parseI
n
t(ed
.getLang('
advlink
.
delta_heig
ht',
0)
),
|
48 |
|
height
:
400
+
ti
n
yMCE
.getLang('
lang_
advlink
_
delta_heig
ht',
0)
|
|
25 |
|
inline : 1
|
49 |
|
}, {
|
|
26 |
|
}, {
|
50 |
|
editor
_id : edit
or_id,
|
|
27 |
|
plugin_url
: url
|
51 |
|
inline
: "yes"
|
|
28 |
|
});
|
52 |
|
});
|
|
29 |
|
});
|
53 |
|
}
|
|
|
54 |
|
|
|
|
55 |
|
retu
rn true;
|
|
|
56 |
|
}
|
|
|
57 |
|
|
|
|
58 |
|
re
turn false
;
|
|
|
59 |
|
},
|
|
|
60 |
|
|
|
|
61 |
|
handle
NodeChange
: functio
n(editor_i
d, node, u
ndo_index,
undo_leve
ls, visual
_aid, any_
selection)
{
|
|
|
62 |
|
if
(node ==
null)
|
|
|
63 |
|
return;
|
|
|
64 |
|
|
|
30 |
|
|
65 |
|
do
{
|
|
31 |
|
// Regis
ter button
s
|
66 |
|
if (node
.nodeName
== "A" &&
tinyMCE.ge
tAttrib(no
de, 'href'
) != "") {
|
|
32 |
|
ed.addBu
tton('link
', {
|
67 |
|
tiny
MCE.switch
Class(edit
or_id + '_
advlink',
'mceButton
Selected')
;
|
|
33 |
|
titl
e : 'advli
nk.link_de
sc',
|
68 |
|
retu
rn true;
|
|
34 |
|
cmd
: 'mceAdvL
ink'
|
69 |
|
}
|
|
35 |
|
}
);
|
70 |
|
}
while ((no
de = node.
parentNode
));
|
|
|
71 |
|
|
|
36 |
|
|
72 |
|
if
(any_sele
ction) {
|
|
37 |
|
ed.addSh
ortcut('ct
rl+k', 'ad
vlink.advl
ink_desc',
'mceAdvLi
nk');
|
73 |
|
tinyMCE.
switchClas
s(editor_i
d + '_advl
ink', 'mce
ButtonNorm
al');
|
|
|
74 |
|
return t
rue;
|
|
|
75 |
|
}
|
|
|
76 |
|
|
|
38 |
|
|
77 |
|
ti
nyMCE.swit
chClass(ed
itor_id +
'_advlink'
, 'mceButt
onDisabled
');
|
|
39 |
|
ed.onNod
eChange.ad
d(function
(ed, cm, n
, co) {
|
|
|
40 |
|
cm.s
etDisabled
('link', c
o && n.nod
eName != '
A');
|
|
|
41 |
|
cm.s
etActive('
link', n.n
odeName ==
'A' && !n
.name);
|
|
|
42 |
|
});
|
|
|
43 |
|
},
|
78 |
|
|
|
44 |
|
|
79 |
|
return
true;
|
|
45 |
|
ge
tInfo : fu
nction() {
|
80 |
|
}
|
|
46 |
|
return
{
|
|
|
47 |
|
long
name : 'Ad
vanced lin
k',
|
|
|
48 |
|
auth
or : 'Moxi
ecode Syst
ems AB',
|
|
|
49 |
|
auth
orurl : 'h
ttp://tiny
mce.moxiec
ode.com',
|
|
|
50 |
|
info
url : 'htt
p://wiki.m
oxiecode.c
om/index.p
hp/TinyMCE
:Plugins/a
dvlink',
|
|
|
51 |
|
vers
ion : tiny
mce.majorV
ersion + "
." + tinym
ce.minorVe
rsion
|
81 |
|
};
|
|
52 |
|
};
|
|
|
53 |
|
}
|
|
|
54 |
|
});
|
82 |
|
|
|
55 |
|
|
83 |
|
tiny
MCE
.
add
Plugin
(
"
advlink
"
,
T
iny
MCE_
AdvancedLi
nkPlugin);
|
|
56 |
|
// Reg
ister plug
in
|
|
|
57 |
|
tiny
mce
.
Plugin
Manager.ad
d
(
'
advlink
'
,
t
iny
mce.plugin
s.
AdvancedLi
nkPlugin);
|
|
|
58 |
|
})();
|