No regular expressions were active.
1 |
|
/**
|
|
1 |
|
/**
|
2 |
|
*
$Id:
editor_plu
gin_src.js
20
1
200
7
-0
2-
1
2
1
5:5
6:
56
Z
spocke
$
|
|
2 |
|
*
$Id:
editor_plu
gin_src.js
5
20
200
8
-0
1
-07
1
6:
30:32
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('advhr'
);
|
|
9 |
|
tinymc
e.create('
tinymce.pl
ugins.Adva
ncedHRPlug
in', {
|
|
|
10 |
|
in
it : funct
ion(ed, ur
l) {
|
|
|
11 |
|
// Regis
ter comman
ds
|
|
|
12 |
|
ed.addCo
mmand('mce
AdvancedHr
', functio
n() {
|
|
|
13 |
|
ed.w
indowManag
er.open({
|
|
|
14 |
|
file : url
+ '/rule.
htm',
|
|
|
15 |
|
width : 25
0 + parseI
nt(ed.getL
ang('advhr
.delta_wid
th', 0)),
|
|
|
16 |
|
height : 1
60 + parse
Int(ed.get
Lang('advh
r.delta_he
ight', 0))
,
|
|
|
17 |
|
inline : 1
|
|
|
18 |
|
}, {
|
|
|
19 |
|
plugin_url
: url
|
|
|
20 |
|
});
|
|
|
21 |
|
});
|
|
|
22 |
|
|
|
|
23 |
|
// Regis
ter button
s
|
|
|
24 |
|
ed.addBu
tton('advh
r', {
|
|
|
25 |
|
titl
e : 'advhr
.advhr_des
c',
|
|
|
26 |
|
cmd
: 'mceAdva
ncedHr'
|
|
|
27 |
|
});
|
|
|
28 |
|
|
|
|
29 |
|
ed.onNod
eChange.ad
d(function
(ed, cm, n
) {
|
|
|
30 |
|
cm.s
etActive('
advhr', n.
nodeName =
= 'HR');
|
|
|
31 |
|
});
|
|
|
32 |
|
|
|
|
33 |
|
ed.onCli
ck.add(fun
ction(ed,
e) {
|
|
|
34 |
|
e =
e.target;
|
|
|
35 |
|
|
|
|
36 |
|
if (
e.nodeName
=== 'HR')
|
|
|
37 |
|
ed.selecti
on.select(
e);
|
|
|
38 |
|
});
|
|
|
39 |
|
},
|
10 |
|
|
|
40 |
|
|
11 |
|
var TinyMC
E_Advanced
HRPlugin =
{
|
|
|
12 |
|
getInf
o : functi
on() {
|
|
41 |
|
ge
tInfo : fu
nction() {
|
13 |
|
re
turn {
|
|
42 |
|
return {
|
14 |
|
longname
: 'Advanc
ed HR',
|
|
43 |
|
long
name : 'Ad
vanced HR'
,
|
15 |
|
author :
'Moxiecod
e Systems
AB',
|
|
44 |
|
auth
or : 'Moxi
ecode Syst
ems AB',
|
16 |
|
authorur
l : 'http:
//tinymce.
moxiecode.
com',
|
|
45 |
|
auth
orurl : 'h
ttp://tiny
mce.moxiec
ode.com',
|
17 |
|
infourl
: 'http://
wiki.moxie
code.com/i
ndex.php/T
inyMCE:Plu
gins/advhr
',
|
|
46 |
|
info
url : 'htt
p://wiki.m
oxiecode.c
om/index.p
hp/TinyMCE
:Plugins/a
dvhr',
|
18 |
|
version
:
tiny
MCE
.majorVers
ion
+
"."
+
tiny
MCE
.minorVers
ion
|
|
47 |
|
version
:
tiny
mce
.majorVers
ion
+
"."
+
tiny
mce
.minorVers
ion
|
19 |
|
}
|
|
|
20 |
|
},
|
|
|
21 |
|
|
|
|
22 |
|
getCon
trolHTML :
function(
cn) {
|
|
|
23 |
|
sw
itch (cn)
{
|
|
|
24 |
|
case "ad
vhr":
|
|
|
25 |
|
retu
rn tinyMCE
.getButton
HTML(cn, '
lang_inser
t_advhr_de
sc', '{$pl
uginurl}/i
mages/advh
r.gif', 'm
ceAdvanced
Hr');
|
|
|
26 |
|
}
|
|
|
27 |
|
|
|
|
28 |
|
re
turn "";
|
|
|
29 |
|
},
|
|
|
30 |
|
|
|
|
31 |
|
/**
|
|
|
32 |
|
* Exe
cutes the
mceAdvance
Hr command
.
|
|
|
33 |
|
*/
|
|
|
34 |
|
execCo
mmand : fu
nction(edi
tor_id, el
ement, com
mand, user
_interface
, value) {
|
|
|
35 |
|
//
Handle co
mmands
|
|
|
36 |
|
sw
itch (comm
and) {
|
|
|
37 |
|
case "mc
eAdvancedH
r":
|
|
|
38 |
|
var
template =
new Array
();
|
|
|
39 |
|
|
|
|
40 |
|
temp
late['file
'] = '..
/../plugin
s/advhr/ru
le.htm'; /
/ Relative
to theme
|
|
|
41 |
|
temp
late['widt
h'] = 250
;
|
|
|
42 |
|
temp
late['heig
ht'] = 160
;
|
|
|
43 |
|
|
|
|
44 |
|
temp
late['widt
h'] += ti
nyMCE.getL
ang('lang_
advhr_delt
a_width',
0);
|
|
|
45 |
|
temp
late['heig
ht'] += ti
nyMCE.getL
ang('lang_
advhr_delt
a_height',
0);
|
|
|
46 |
|
|
|
|
47 |
|
var
size = "",
width = "
", noshade
= "";
|
|
|
48 |
|
if (
tinyMCE.se
lectedElem
ent != nul
l && tinyM
CE.selecte
dElement.n
odeName.to
LowerCase(
) == "hr")
{
|
|
|
49 |
|
tinyMCE.hr
Element =
tinyMCE.se
lectedElem
ent;
|
|
|
50 |
|
|
|
|
51 |
|
if (tinyMC
E.hrElemen
t) {
|
|
|
52 |
|
size
= tinyMC
E.hrElemen
t.getAttri
bute('size
') ? tinyM
CE.hrEleme
nt.getAttr
ibute('siz
e') : "";
|
|
|
53 |
|
width
= tinyMC
E.hrElemen
t.getAttri
bute('widt
h') ? tiny
MCE.hrElem
ent.getAtt
ribute('wi
dth') : ""
;
|
|
|
54 |
|
noshad
e = tinyMC
E.hrElemen
t.getAttri
bute('nosh
ade') ? ti
nyMCE.hrEl
ement.getA
ttribute('
noshade')
: "";
|
|
|
55 |
|
}
|
|
|
56 |
|
|
|
|
57 |
|
tinyMCE.op
enWindow(t
emplate, {
editor_id
: editor_i
d, size :
size, widt
h : width,
noshade :
noshade,
mceDo : 'u
pdate'});
|
|
|
58 |
|
} el
se {
|
|
|
59 |
|
if (tinyMC
E.isMSIE)
{
|
|
|
60 |
|
tinyMC
E.execInst
anceComman
d(editor_i
d, 'mceIns
ertContent
', false,'
<hr />');
|
|
|
61 |
|
} else {
|
|
|
62 |
|
tinyMC
E.openWind
ow(templat
e, {editor
_id : edit
or_id, inl
ine : "yes
", size :
size, widt
h : width,
noshade :
noshade,
mceDo : 'i
nsert'});
|
|
|
63 |
|
}
|
|
|
64 |
|
}
|
|
|
65 |
|
|
|
|
66 |
|
retu
rn true;
|
|
|
67 |
|
}
|
|
|
68 |
|
|
|
|
69 |
|
//
Pass to n
ext handle
r in chain
|
|
|
70 |
|
re
turn false
;
|
|
|
71 |
|
},
|
|
|
72 |
|
|
|
|
73 |
|
handle
NodeChange
: functio
n(editor_i
d, node, u
ndo_index,
undo_leve
ls, visual
_aid, any_
selection)
{
|
|
|
74 |
|
if
(node ==
null)
|
|
|
75 |
|
return;
|
|
|
76 |
|
|
|
|
77 |
|
do
{
|
|
|
78 |
|
if (node
.nodeName
== "HR") {
|
|
|
79 |
|
tiny
MCE.switch
Class(edit
or_id + '_
advhr', 'm
ceButtonSe
lected');
|
|
|
80 |
|
retu
rn true;
|
|
|
81 |
|
}
|
|
|
82 |
|
}
while ((no
de = node.
parentNode
));
|
|
|
83 |
|
|
|
|
84 |
|
ti
nyMCE.swit
chClass(ed
itor_id +
'_advhr',
'mceButton
Normal');
|
|
|
85 |
|
|
|
|
86 |
|
re
turn true;
|
|
|
87 |
|
}
|
|
|
88 |
|
};
|
|
48 |
|
};
|
|
|
49 |
|
}
|
|
|
50 |
|
});
|
89 |
|
|
|
51 |
|
|
90 |
|
tiny
MCE
.
add
Plugin
(
"
advhr
"
,
T
iny
MCE_
AdvancedHR
Plugin);
|
|
52 |
|
// Reg
ister plug
in
|
|
|
53 |
|
tiny
mce
.
Plugin
Manager.ad
d
(
'
advhr
'
,
t
iny
mce.plugin
s.
AdvancedHR
Plugin);
|
|
|
54 |
|
})();
|