No regular expressions were active.
1 |
|
/**
|
|
1 |
|
/**
|
2 |
|
*
$Id:
editor_plu
gin_src.js
4
2
200
6
-0
8
-
08
1
4:3
2
:
24
Z
spocke
$
|
|
2 |
|
*
$Id:
editor_plu
gin_src.js
2
01
200
7
-0
2
-
1
2
15
:
56:56
Z
spocke
$
|
3 |
|
*
|
|
3 |
|
*
|
4 |
|
*
@author
Moxiecode
-
based
on
work
by
Andrew
Tetlaw
|
|
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('xhtmlx
tras');
|
|
9 |
|
tinymc
e.create('
tinymce.pl
ugins.XHTM
LXtrasPlug
in', {
|
|
|
10 |
|
in
it : funct
ion(ed, ur
l) {
|
|
|
11 |
|
// Regis
ter comman
ds
|
|
|
12 |
|
ed.addCo
mmand('mce
Cite', fun
ction() {
|
|
|
13 |
|
ed.w
indowManag
er.open({
|
|
|
14 |
|
file : url
+ '/cite.
htm',
|
|
|
15 |
|
width : 35
0 + parseI
nt(ed.getL
ang('xhtml
xtras.cite
_delta_wid
th', 0)),
|
|
|
16 |
|
height : 2
50 + parse
Int(ed.get
Lang('xhtm
lxtras.cit
e_delta_he
ight', 0))
,
|
|
|
17 |
|
inline : 1
|
|
|
18 |
|
}, {
|
|
|
19 |
|
plugin_url
: url
|
|
|
20 |
|
});
|
|
|
21 |
|
});
|
10 |
|
|
|
22 |
|
|
11 |
|
var TinyMC
E_XHTMLXtr
asPlugin =
{
|
|
23 |
|
ed.addCo
mmand('mce
Acronym',
function()
{
|
12 |
|
getInf
o : functi
on() {
|
|
24 |
|
ed.w
indowManag
er.open({
|
13 |
|
re
turn {
|
|
25 |
|
file : url
+ '/acron
ym.htm',
|
14 |
|
longname
: 'XHTML
Xtras Plug
in',
|
|
26 |
|
width : 35
0 + parseI
nt(ed.getL
ang('xhtml
xtras.acro
nym_delta_
width', 0)
),
|
15 |
|
author :
'Moxiecod
e Systems
AB',
|
|
27 |
|
height : 2
50 + parse
Int(ed.get
Lang('xhtm
lxtras.acr
onym_delta
_width', 0
)),
|
16 |
|
authorur
l : 'http:
//tinymce.
moxiecode.
com',
|
|
28 |
|
inline : 1
|
17 |
|
infourl
: 'http://
wiki.moxie
code.com/i
ndex.php/T
inyMCE:Plu
gins/xhtml
xtras',
|
|
29 |
|
}, {
|
18 |
|
version
: tinyMCE.
majorVersi
on + "." +
tinyMCE.m
inorVersio
n
|
|
30 |
|
plugin_url
: url
|
19 |
|
};
|
|
31 |
|
});
|
20 |
|
},
|
|
32 |
|
});
|
21 |
|
|
|
|
22 |
|
initIn
stance : f
unction(in
st) {
|
|
|
23 |
|
ti
nyMCE.impo
rtCSS(inst
.getDoc(),
tinyMCE.b
aseURL + "
/plugins/x
htmlxtras/
css/xhtmlx
tras.css")
;
|
|
|
24 |
|
},
|
|
|
25 |
|
|
|
|
26 |
|
getCon
trolHTML :
function(
cn) {
|
|
|
27 |
|
sw
itch (cn)
{
|
|
|
28 |
|
case "ci
te":
|
|
|
29 |
|
retu
rn tinyMCE
.getButton
HTML(cn, '
lang_xhtml
xtras_cite
_desc', '{
$pluginurl
}/images/c
ite.gif',
'mceCite',
true);
|
|
|
30 |
|
|
|
|
31 |
|
case "ac
ronym":
|
|
|
32 |
|
retu
rn tinyMCE
.getButton
HTML(cn, '
lang_xhtml
xtras_acro
nym_desc',
'{$plugin
url}/image
s/acronym.
gif', 'mce
Acronym',
true);
|
|
|
33 |
|
|
|
|
34 |
|
case "ab
br":
|
|
|
35 |
|
retu
rn tinyMCE
.getButton
HTML(cn, '
lang_xhtml
xtras_abbr
_desc', '{
$pluginurl
}/images/a
bbr.gif',
'mceAbbr',
true);
|
|
|
36 |
|
|
|
|
37 |
|
case "de
l":
|
|
|
38 |
|
retu
rn tinyMCE
.getButton
HTML(cn, '
lang_xhtml
xtras_del_
desc', '{$
pluginurl}
/images/de
l.gif', 'm
ceDel', tr
ue);
|
|
|
39 |
|
|
|
|
40 |
|
case "in
s":
|
|
|
41 |
|
retu
rn tinyMCE
.getButton
HTML(cn, '
lang_xhtml
xtras_ins_
desc', '{$
pluginurl}
/images/in
s.gif', 'm
ceIns', tr
ue);
|
|
|
42 |
|
|
|
|
43 |
|
case "at
tribs":
|
|
|
44 |
|
retu
rn tinyMCE
.getButton
HTML(cn, '
lang_xhtml
xtras_attr
ibs_desc',
'{$plugin
url}/image
s/attribs.
gif', 'mce
Attributes
', true);
|
|
|
45 |
|
}
|
|
|
46 |
|
|
|
|
47 |
|
re
turn "";
|
|
|
48 |
|
},
|
|
|
49 |
|
|
|
|
50 |
|
execCo
mmand : fu
nction(edi
tor_id, el
ement, com
mand, user
_interface
, value) {
|
|
|
51 |
|
va
r template
, inst, el
m;
|
|
|
52 |
|
|
|
|
53 |
|
sw
itch (comm
and) {
|
|
|
54 |
|
case "mc
eCite":
|
|
|
55 |
|
if (
!this._any
Sel(editor
_id))
|
|
|
56 |
|
return tru
e;
|
|
|
57 |
|
|
|
|
58 |
|
temp
late = new
Array();
|
|
|
59 |
|
temp
late['file
'] = '../.
./plugins/
xhtmlxtras
/cite.htm'
;
|
|
|
60 |
|
temp
late['widt
h'] = 350;
|
|
|
61 |
|
temp
late['heig
ht'] = 250
;
|
|
|
62 |
|
tiny
MCE.openWi
ndow(templ
ate, {edit
or_id : ed
itor_id});
|
|
|
63 |
|
retu
rn true;
|
|
|
64 |
|
|
|
|
65 |
|
case "mc
eAcronym":
|
|
|
66 |
|
if (
!this._any
Sel(editor
_id))
|
|
|
67 |
|
return tru
e;
|
|
|
68 |
|
|
|
|
69 |
|
temp
late = new
Array();
|
|
|
70 |
|
temp
late['file
'] = '../.
./plugins/
xhtmlxtras
/acronym.h
tm';
|
|
|
71 |
|
temp
late['widt
h'] = 350;
|
|
|
72 |
|
temp
late['heig
ht'] = 250
;
|
|
|
73 |
|
tiny
MCE.openWi
ndow(templ
ate, {edit
or_id : ed
itor_id});
|
|
|
74 |
|
retu
rn true;
|
|
|
75 |
|
|
|
|
76 |
|
case "mc
eAbbr":
|
|
|
77 |
|
if (
!this._any
Sel(editor
_id))
|
|
|
78 |
|
return tru
e;
|
|
|
79 |
|
|
|
|
80 |
|
temp
late = new
Array();
|
|
|
81 |
|
temp
late['file
'] = '../.
./plugins/
xhtmlxtras
/abbr.htm'
;
|
|
|
82 |
|
temp
late['widt
h'] = 350;
|
|
|
83 |
|
temp
late['heig
ht'] = 250
;
|
|
|
84 |
|
tiny
MCE.openWi
ndow(templ
ate, {edit
or_id : ed
itor_id});
|
|
|
85 |
|
retu
rn true;
|
|
|
86 |
|
|
|
|
87 |
|
case "mc
eIns":
|
|
|
88 |
|
if (
!this._any
Sel(editor
_id))
|
|
|
89 |
|
return tru
e;
|
|
|
90 |
|
|
|
33 |
|
|
91 |
|
temp
late = new
Array();
|
|
34 |
|
ed.addCo
mmand('mce
Abbr', fun
ction() {
|
92 |
|
temp
late['file
'] = '../.
./plugins/
xhtmlxtras
/ins.htm';
|
|
35 |
|
ed.w
indowManag
er.open({
|
93 |
|
temp
late['widt
h'] = 350;
|
|
36 |
|
file : url
+ '/abbr.
htm',
|
94 |
|
temp
late['heig
ht'] = 310
;
|
|
37 |
|
width : 35
0 + parseI
nt(ed.getL
ang('xhtml
xtras.abbr
_delta_wid
th', 0)),
|
95 |
|
tiny
MCE.openWi
ndow(templ
ate, {edit
or_id : ed
itor_id});
|
|
38 |
|
height : 2
50 + parse
Int(ed.get
Lang('xhtm
lxtras.abb
r_delta_wi
dth', 0)),
|
96 |
|
retu
rn true;
|
|
39 |
|
inline : 1
|
|
|
40 |
|
}, {
|
|
|
41 |
|
plugin_url
: url
|
|
|
42 |
|
});
|
|
|
43 |
|
});
|
97 |
|
|
|
44 |
|
|
98 |
|
case "mc
eDel":
|
|
45 |
|
ed.addCo
mmand('mce
Del', func
tion() {
|
99 |
|
if (
!this._any
Sel(editor
_id))
|
|
46 |
|
ed.w
indowManag
er.open({
|
100 |
|
return tru
e;
|
|
47 |
|
file : url
+ '/del.h
tm',
|
|
|
48 |
|
width : 34
0 + parseI
nt(ed.getL
ang('xhtml
xtras.del_
delta_widt
h', 0)),
|
|
|
49 |
|
height : 3
10 + parse
Int(ed.get
Lang('xhtm
lxtras.del
_delta_wid
th', 0)),
|
|
|
50 |
|
inline : 1
|
|
|
51 |
|
}, {
|
|
|
52 |
|
plugin_url
: url
|
|
|
53 |
|
});
|
|
|
54 |
|
});
|
101 |
|
|
|
55 |
|
|
102 |
|
temp
late = new
Array();
|
|
56 |
|
ed.addCo
mmand('mce
Ins', func
tion() {
|
103 |
|
temp
late['file
'] = '../.
./plugins/
xhtmlxtras
/del.htm';
|
|
57 |
|
ed.w
indowManag
er.open({
|
104 |
|
temp
late['widt
h'] = 350;
|
|
58 |
|
file : url
+ '/ins.h
tm',
|
105 |
|
temp
late['heig
ht'] = 310
;
|
|
59 |
|
width : 34
0 + parseI
nt(ed.getL
ang('xhtml
xtras.ins_
delta_widt
h', 0)),
|
106 |
|
tiny
MCE.openWi
ndow(templ
ate, {edit
or_id : ed
itor_id});
|
|
60 |
|
height : 3
10 + parse
Int(ed.get
Lang('xhtm
lxtras.ins
_delta_wid
th', 0)),
|
107 |
|
retu
rn true;
|
|
61 |
|
inline : 1
|
|
|
62 |
|
}, {
|
|
|
63 |
|
plugin_url
: url
|
|
|
64 |
|
});
|
|
|
65 |
|
});
|
108 |
|
|
|
66 |
|
|
109 |
|
case "mc
eAttribute
s":
|
|
67 |
|
ed.addCo
mmand('mce
Attributes
', functio
n() {
|
110 |
|
inst
= tinyMCE
.getInstan
ceById(edi
tor_id);
|
|
68 |
|
ed.w
indowManag
er.open({
|
111 |
|
elm
= inst.get
FocusEleme
nt();
|
|
69 |
|
file
:
u
r
l
+
'
/attribute
s.htm',
|
112 |
|
|
|
|
113 |
|
if (
elm && elm
.nodeName
!== 'BODY'
&& elm.cl
assName.in
dexOf('mce
Item') ==
-1) {
|
|
|
114 |
|
tinyMCE.op
enWindow({
|
|
|
115 |
|
file
:
'../../pl
u
gins/xhtml
xt
r
as
/attribute
s.htm',
|
|
|
116 |
|
width
: 380,
|
|
70 |
|
width : 38
0,
|
117 |
|
height
:
370
|
|
71 |
|
height
:
370
,
|
118 |
|
}, {editor
_id : edit
or_id});
|
|
72 |
|
inline : 1
|
119 |
|
}
|
|
73 |
|
}, {
|
|
|
74 |
|
plugin_url
: url
|
|
|
75 |
|
});
|
|
|
76 |
|
}
);
|
120 |
|
|
|
77 |
|
|
121 |
|
retu
rn true;
|
|
78 |
|
// Regis
ter button
s
|
122 |
|
}
|
|
79 |
|
ed.addBu
tton('cite
', {title
: 'xhtmlxt
ras.cite_d
esc', cmd
: 'mceCite
'});
|
|
|
80 |
|
ed.addBu
tton('acro
nym', {tit
le : 'xhtm
lxtras.acr
onym_desc'
, cmd : 'm
ceAcronym'
});
|
|
|
81 |
|
ed.addBu
tton('abbr
', {title
: 'xhtmlxt
ras.abbr_d
esc', cmd
: 'mceAbbr
'});
|
|
|
82 |
|
ed.addBu
tton('del'
, {title :
'xhtmlxtr
as.del_des
c', cmd :
'mceDel'})
;
|
|
|
83 |
|
ed.addBu
tton('ins'
, {title :
'xhtmlxtr
as.ins_des
c', cmd :
'mceIns'})
;
|
|
|
84 |
|
ed.addBu
tton('attr
ibs', {tit
le : 'xhtm
lxtras.att
ribs_desc'
, cmd : 'm
ceAttribut
es'});
|
123 |
|
|
|
85 |
|
|
124 |
|
re
turn false
;
|
|
86 |
|
if (tiny
mce.isIE)
{
|
125 |
|
},
|
|
87 |
|
function
fix
(
e
d
,
o
)
{
|
126 |
|
|
|
88 |
|
if (o.set)
{
|
127 |
|
cleanup
:
function
(
typ
e
,
c
o
ntent,
inst
)
{
|
|
89 |
|
o.
content
=
o.
content.re
place(/<ab
br([^>]+)>
/gi,
'<html:
abbr
$1>');
|
128 |
|
if
(type ==
'insert_to
_editor' &
& tinyMCE.
isIE && !t
inyMCE.isO
pera) {
|
|
90 |
|
o.
content
=
o.
content.re
place(/<\/
abbr>/gi,
'</html:
abbr
>');
|
129 |
|
content
=
content.re
place(/<ab
br([^>]+)>
/gi,
'<html:
ABBR
$1>');
|
|
|
130 |
|
content
=
content.re
place(/<\/
abbr>/gi,
'</html:
ABBR
>');
|
|
|
131 |
|
}
|
|
91 |
|
}
|
|
|
92 |
|
};
|
132 |
|
|
|
93 |
|
|
133 |
|
re
turn conte
nt;
|
|
94 |
|
ed.o
nBeforeSet
Content.ad
d(fix);
|
134 |
|
},
|
|
95 |
|
ed.o
nPostProce
ss.add(fix
);
|
135 |
|
|
|
|
136 |
|
handle
NodeChange
: functio
n(editor_i
d, node, u
ndo_index,
undo_level
s, visual_
aid, any_s
election)
{
|
|
|
137 |
|
va
r elm = ti
nyMCE.getP
arentEleme
nt(node);
|
|
|
138 |
|
|
|
|
139 |
|
if
(node ==
null)
|
|
|
140 |
|
return;
|
|
|
141 |
|
|
|
|
142 |
|
ti
nyMCE.swit
chClass(ed
itor_id +
'_attribs'
, 'mceButt
onDisabled
');
|
|
|
143 |
|
|
|
|
144 |
|
if
(!any_sel
ection) {
|
|
|
145 |
|
// Disab
le the but
tons
|
|
|
146 |
|
tinyMCE.
switchClas
s(editor_i
d + '_cite
', 'mceBut
tonDisable
d');
|
|
|
147 |
|
tinyMCE.
switchClas
s(editor_i
d + '_acro
nym', 'mce
ButtonDisa
bled');
|
|
|
148 |
|
tinyMCE.
switchClas
s(editor_i
d + '_abbr
', 'mceBut
tonDisable
d');
|
|
|
149 |
|
tinyMCE.
switchClas
s(editor_i
d + '_del'
, 'mceButt
onDisabled
');
|
|
|
150 |
|
tinyMCE.
switchClas
s(editor_i
d + '_ins'
, 'mceButt
onDisabled
');
|
|
|
151 |
|
}
else {
|
|
|
152 |
|
// A sel
ection mea
ns the but
tons shoul
d be activ
e.
|
|
|
153 |
|
tinyMCE.
switchClas
s(editor_i
d + '_cite
', 'mceBut
tonNormal'
);
|
|
|
154 |
|
tinyMCE.
switchClas
s(editor_i
d + '_acro
nym', 'mce
ButtonNorm
al');
|
|
|
155 |
|
tinyMCE.
switchClas
s(editor_i
d + '_abbr
', 'mceBut
tonNormal'
);
|
|
|
156 |
|
tinyMCE.
switchClas
s(editor_i
d + '_del'
, 'mceButt
onNormal')
;
|
|
|
157 |
|
tinyMCE.
switchClas
s(editor_i
d + '_ins'
, 'mceButt
onNormal')
;
|
|
|
158 |
|
}
|
|
96 |
|
}
|
159 |
|
|
|
97 |
|
|
160 |
|
if
(elm && e
lm.nodeNam
e != 'BODY
' && elm.c
lassName.i
ndexOf('mc
eItem') ==
-1)
|
|
98 |
|
ed.onNod
eChange.ad
d(function
(ed, cm, n
, co) {
|
161 |
|
tinyMCE.
switchClas
s(editor_i
d + '_attr
ibs', 'mce
ButtonNorm
al');
|
|
99 |
|
n =
ed.dom.get
Parent(n,
'CITE,ACRO
NYM,ABBR,D
EL,INS');
|
162 |
|
|
|
|
163 |
|
sw
itch (node
.nodeName)
{
|
|
|
164 |
|
case "CI
TE":
|
|
|
165 |
|
tiny
MCE.switch
Class(edit
or_id + '_
cite', 'mc
eButtonSel
ected');
|
|
|
166 |
|
retu
rn true;
|
|
|
167 |
|
|
|
|
168 |
|
case "AC
RONYM":
|
|
|
169 |
|
tiny
MCE.switch
Class(edit
or_id + '_
acronym',
'mceButton
Selected')
;
|
|
|
170 |
|
retu
rn true;
|
|
|
171 |
|
|
|
100 |
|
|
172 |
|
case "ab
br": // IE
|
|
101 |
|
cm.s
etDisabled
('cite', c
o);
|
173 |
|
case "HT
ML:ABBR":
// FF
|
|
102 |
|
cm.s
etDisabled
('acronym'
, co);
|
174 |
|
case "AB
BR":
|
|
103 |
|
cm.s
etDisabled
('abbr', c
o);
|
175 |
|
tiny
MCE.switch
Class(edit
or_id + '_
abbr', 'mc
eButtonSel
ected');
|
|
104 |
|
cm.s
etDisabled
('del', co
);
|
176 |
|
retu
rn true;
|
|
105 |
|
cm.s
etDisabled
('ins', co
);
|
|
|
106 |
|
cm.s
etDisabled
('attribs'
, n && n.n
odeName ==
'BODY');
|
177 |
|
|
|
107 |
|
|
178 |
|
case "DE
L":
|
|
108 |
|
if (
n) {
|
179 |
|
tiny
MCE.switch
Class(edit
or_id + '_
del', 'mce
ButtonSele
cted');
|
|
109 |
|
cm.setDisa
bled(n.nod
eName.toLo
werCase(),
0);
|
180 |
|
retu
rn true;
|
|
110 |
|
cm.setActi
ve(n.nodeN
ame.toLowe
rCase(), 1
);
|
181 |
|
|
|
111 |
|
} el
se {
|
182 |
|
case "IN
S":
|
|
112 |
|
cm.setActi
ve('cite',
0);
|
183 |
|
tiny
MCE.switch
Class(edit
or_id + '_
ins', 'mce
ButtonSele
cted');
|
|
113 |
|
cm.setActi
ve('acrony
m', 0);
|
184 |
|
retu
rn true;
|
|
114 |
|
cm.setActi
ve('abbr',
0);
|
|
|
115 |
|
cm.setActi
ve('del',
0);
|
|
|
116 |
|
cm.setActi
ve('ins',
0);
|
185 |
|
}
|
|
117 |
|
}
|
186 |
|
|
|
118 |
|
});
|
187 |
|
re
turn true;
|
|
|
188 |
|
},
|
|
119 |
|
},
|
189 |
|
|
|
120 |
|
|
190 |
|
_anyS
e
l
:
function(
editor_id
)
{
|
|
121 |
|
g
e
tInfo
:
function(
)
{
|
191 |
|
va
r inst = t
inyMCE.get
InstanceBy
Id(editor_
id), t = i
nst.select
ion.getSel
ectedText(
), pe;
|
|
122 |
|
return {
|
192 |
|
|
|
123 |
|
long
name : 'XH
TML Xtras
Plugin',
|
193 |
|
pe
= tinyMCE
.getParent
Element(in
st.getFocu
sElement()
, 'CITE,AC
RONYM,ABBR
,HTML:ABBR
,DEL,INS')
;
|
|
124 |
|
auth
or : 'Moxi
ecode Syst
ems AB',
|
194 |
|
|
|
125 |
|
auth
orurl : 'h
ttp://tiny
mce.moxiec
ode.com',
|
195 |
|
re
turn pe ||
inst.getF
ocusElemen
t().nodeNa
me == "IMG
" || (t &&
t.length
> 0);
|
|
126 |
|
info
url : 'htt
p://wiki.m
oxiecode.c
om/index.p
hp/TinyMCE
:Plugins/x
htmlxtras'
,
|
196 |
|
}
|
|
127 |
|
vers
ion : tiny
mce.majorV
ersion + "
." + tinym
ce.minorVe
rsion
|
197 |
|
};
|
|
128 |
|
};
|
|
|
129 |
|
}
|
|
|
130 |
|
});
|
198 |
|
|
|
131 |
|
|
199 |
|
tiny
MCE
.
add
Plugin
(
"
xhtmlxtras
"
,
T
iny
MCE_
XHTMLXtras
Plugin);
|
|
132 |
|
// Reg
ister plug
in
|
|
|
133 |
|
tiny
mce
.
Plugin
Manager.ad
d
(
'
xhtmlxtras
'
,
t
iny
mce.plugin
s.
XHTMLXtras
Plugin);
|
|
|
134 |
|
})();
|