1 |
|
tinyMCE.im
portPlugin
LanguagePa
ck('xhtmlx
tras');var
TinyMCE_X
HTMLXtrasP
lugin={get
Info:funct
ion(){retu
rn{longnam
e:'XHTML X
tras Plugi
n',author:
'Moxiecode
Systems A
B',authoru
rl:'http:/
/tinymce.m
oxiecode.c
om',infour
l:'http://
wiki.moxie
code.com/i
ndex.php/T
inyMCE:Plu
gins/xhtml
xtras',ver
sion:tinyM
CE.majorVe
rsion+"."+
tinyMCE.mi
norVersion
}},initIns
tance:func
tion(inst)
{tinyMCE.i
mportCSS(i
nst.getDoc
(),tinyMCE
.baseURL+"
/plugins/x
htmlxtras/
css/xhtmlx
tras.css")
},getContr
olHTML:fun
ction(cn){
switch(cn)
{case"cite
":return t
inyMCE.get
ButtonHTML
(cn,'lang_
xhtmlxtras
_cite_desc
','{$plugi
nurl}/imag
es/cite.gi
f','mceCit
e',true);c
ase"acrony
m":return
tinyMCE.ge
tButtonHTM
L(cn,'lang
_xhtmlxtra
s_acronym_
desc','{$p
luginurl}/
images/acr
onym.gif',
'mceAcrony
m',true);c
ase"abbr":
return tin
yMCE.getBu
ttonHTML(c
n,'lang_xh
tmlxtras_a
bbr_desc',
'{$pluginu
rl}/images
/abbr.gif'
,'mceAbbr'
,true);cas
e"del":ret
urn tinyMC
E.getButto
nHTML(cn,'
lang_xhtml
xtras_del_
desc','{$p
luginurl}/
images/del
.gif','mce
Del',true)
;case"ins"
:return ti
nyMCE.getB
uttonHTML(
cn,'lang_x
htmlxtras_
ins_desc',
'{$pluginu
rl}/images
/ins.gif',
'mceIns',t
rue);case"
attribs":r
eturn tiny
MCE.getBut
tonHTML(cn
,'lang_xht
mlxtras_at
tribs_desc
','{$plugi
nurl}/imag
es/attribs
.gif','mce
Attributes
',true)}re
turn""},ex
ecCommand:
function(e
ditor_id,e
lement,com
mand,user_
interface,
value){var
template,
inst,elm;s
witch(comm
and){case"
mceCite":i
f(!this._a
nySel(edit
or_id))ret
urn true;t
emplate=ne
w Array();
template['
file']='..
/../plugin
s/xhtmlxtr
as/cite.ht
m';templat
e['width']
=350;templ
ate['heigh
t']=250;ti
nyMCE.open
Window(tem
plate,{edi
tor_id:edi
tor_id});r
eturn true
;case"mceA
cronym":if
(!this._an
ySel(edito
r_id))retu
rn true;te
mplate=new
Array();t
emplate['f
ile']='../
../plugins
/xhtmlxtra
s/acronym.
htm';templ
ate['width
']=350;tem
plate['hei
ght']=250;
tinyMCE.op
enWindow(t
emplate,{e
ditor_id:e
ditor_id})
;return tr
ue;case"mc
eAbbr":if(
!this._any
Sel(editor
_id))retur
n true;tem
plate=new
Array();te
mplate['fi
le']='../.
./plugins/
xhtmlxtras
/abbr.htm'
;template[
'width']=3
50;templat
e['height'
]=250;tiny
MCE.openWi
ndow(templ
ate,{edito
r_id:edito
r_id});ret
urn true;c
ase"mceIns
":if(!this
._anySel(e
ditor_id))
return tru
e;template
=new Array
();templat
e['file']=
'../../plu
gins/xhtml
xtras/ins.
htm';templ
ate['width
']=350;tem
plate['hei
ght']=310;
tinyMCE.op
enWindow(t
emplate,{e
ditor_id:e
ditor_id})
;return tr
ue;case"mc
eDel":if(!
this._anyS
el(editor_
id))return
true;temp
late=new A
rray();tem
plate['fil
e']='../..
/plugins/x
htmlxtras/
del.htm';t
emplate['w
idth']=350
;template[
'height']=
310;tinyMC
E.openWind
ow(templat
e,{editor_
id:editor_
id});retur
n true;cas
e"mceAttri
butes":ins
t=tinyMCE.
getInstanc
eById(edit
or_id);elm
=inst.getF
ocusElemen
t();if(elm
&&elm.node
Name!=='BO
DY'&&elm.c
lassName.i
ndexOf('mc
eItem')==-
1){tinyMCE
.openWindo
w({file:'.
./../plugi
ns/xhtmlxt
ras/attrib
utes.htm',
width:380,
height:370
},{editor_
id:editor_
id})}retur
n true}ret
urn false}
,cleanup:f
unction(ty
pe,content
,inst){if(
type=='ins
ert_to_edi
tor'&&tiny
MCE.isIE&&
!tinyMCE.i
sOpera){co
ntent=cont
ent.replac
e(/<abbr([
^>]+)>/gi,
'<html:ABB
R $1>');co
ntent=cont
ent.replac
e(/<\/abbr
>/gi,'</ht
ml:ABBR>')
}return co
ntent},han
dleNodeCha
nge:functi
on(editor_
id,node,un
do_index,u
ndo_levels
,visual_ai
d,any_sele
ction){var
elm=tinyM
CE.getPare
ntElement(
node);if(n
ode==null)
return;tin
yMCE.switc
hClass(edi
tor_id+'_a
ttribs','m
ceButtonDi
sabled');i
f(!any_sel
ection){ti
nyMCE.swit
chClass(ed
itor_id+'_
cite','mce
ButtonDisa
bled');tin
yMCE.switc
hClass(edi
tor_id+'_a
cronym','m
ceButtonDi
sabled');t
inyMCE.swi
tchClass(e
ditor_id+'
_abbr','mc
eButtonDis
abled');ti
nyMCE.swit
chClass(ed
itor_id+'_
del','mceB
uttonDisab
led');tiny
MCE.switch
Class(edit
or_id+'_in
s','mceBut
tonDisable
d')}else{t
inyMCE.swi
tchClass(e
ditor_id+'
_cite','mc
eButtonNor
mal');tiny
MCE.switch
Class(edit
or_id+'_ac
ronym','mc
eButtonNor
mal');tiny
MCE.switch
Class(edit
or_id+'_ab
br','mceBu
ttonNormal
');tinyMCE
.switchCla
ss(editor_
id+'_del',
'mceButton
Normal');t
inyMCE.swi
tchClass(e
ditor_id+'
_ins','mce
ButtonNorm
al')}if(el
m&&elm.nod
eName!='BO
DY'&&elm.c
lassName.i
ndexOf('mc
eItem')==-
1)tinyMCE.
switchClas
s(editor_i
d+'_attrib
s','mceBut
tonNormal'
);switch(n
ode.nodeNa
me){case"C
ITE":tinyM
CE.switchC
lass(edito
r_id+'_cit
e','mceBut
tonSelecte
d');return
true;case
"ACRONYM":
tinyMCE.sw
itchClass(
editor_id+
'_acronym'
,'mceButto
nSelected'
);return t
rue;case"a
bbr":case"
HTML:ABBR"
:case"ABBR
":tinyMCE.
switchClas
s(editor_i
d+'_abbr',
'mceButton
Selected')
;return tr
ue;case"DE
L":tinyMCE
.switchCla
ss(editor_
id+'_del',
'mceButton
Selected')
;return tr
ue;case"IN
S":tinyMCE
.switchCla
ss(editor_
id+'_ins',
'mceButton
Selected')
;return tr
ue}return
true},_any
Sel:functi
on(editor_
id){var in
st=tinyMCE
.getInstan
ceById(edi
tor_id),t=
inst.selec
tion.getSe
lectedText
(),pe;pe=t
inyMCE.get
ParentElem
ent(inst.g
etFocusEle
ment(),'CI
TE,ACRONYM
,ABBR,HTML
:ABBR,DEL,
INS');retu
rn pe||ins
t.getFocus
Element().
nodeName==
"IMG"||(t&
&t.length>
0)}};tinyM
CE.addPlug
in("xhtmlx
tras",Tiny
MCE_XHTMLX
trasPlugin
);
|
|
1 |
|
(function(
){tinymce.
create('ti
nymce.plug
ins.XHTMLX
trasPlugin
',{init:fu
nction(ed,
url){ed.ad
dCommand('
mceCite',f
unction(){
ed.windowM
anager.ope
n({file:ur
l+'/cite.h
tm',width:
350+parseI
nt(ed.getL
ang('xhtml
xtras.cite
_delta_wid
th',0)),he
ight:250+p
arseInt(ed
.getLang('
xhtmlxtras
.cite_delt
a_height',
0)),inline
:1},{plugi
n_url:url}
);});ed.ad
dCommand('
mceAcronym
',function
(){ed.wind
owManager.
open({file
:url+'/acr
onym.htm',
width:350+
parseInt(e
d.getLang(
'xhtmlxtra
s.acronym_
delta_widt
h',0)),hei
ght:250+pa
rseInt(ed.
getLang('x
htmlxtras.
acronym_de
lta_width'
,0)),inlin
e:1},{plug
in_url:url
});});ed.a
ddCommand(
'mceAbbr',
function()
{ed.window
Manager.op
en({file:u
rl+'/abbr.
htm',width
:350+parse
Int(ed.get
Lang('xhtm
lxtras.abb
r_delta_wi
dth',0)),h
eight:250+
parseInt(e
d.getLang(
'xhtmlxtra
s.abbr_del
ta_width',
0)),inline
:1},{plugi
n_url:url}
);});ed.ad
dCommand('
mceDel',fu
nction(){e
d.windowMa
nager.open
({file:url
+'/del.htm
',width:34
0+parseInt
(ed.getLan
g('xhtmlxt
ras.del_de
lta_width'
,0)),heigh
t:310+pars
eInt(ed.ge
tLang('xht
mlxtras.de
l_delta_wi
dth',0)),i
nline:1},{
plugin_url
:url});});
ed.addComm
and('mceIn
s',functio
n(){ed.win
dowManager
.open({fil
e:url+'/in
s.htm',wid
th:340+par
seInt(ed.g
etLang('xh
tmlxtras.i
ns_delta_w
idth',0)),
height:310
+parseInt(
ed.getLang
('xhtmlxtr
as.ins_del
ta_width',
0)),inline
:1},{plugi
n_url:url}
);});ed.ad
dCommand('
mceAttribu
tes',funct
ion(){ed.w
indowManag
er.open({f
ile:url+'/
attributes
.htm',widt
h:380,heig
ht:370,inl
ine:1},{pl
ugin_url:u
rl});});ed
.addButton
('cite',{t
itle:'xhtm
lxtras.cit
e_desc',cm
d:'mceCite
'});ed.add
Button('ac
ronym',{ti
tle:'xhtml
xtras.acro
nym_desc',
cmd:'mceAc
ronym'});e
d.addButto
n('abbr',{
title:'xht
mlxtras.ab
br_desc',c
md:'mceAbb
r'});ed.ad
dButton('d
el',{title
:'xhtmlxtr
as.del_des
c',cmd:'mc
eDel'});ed
.addButton
('ins',{ti
tle:'xhtml
xtras.ins_
desc',cmd:
'mceIns'})
;ed.addBut
ton('attri
bs',{title
:'xhtmlxtr
as.attribs
_desc',cmd
:'mceAttri
butes'});i
f(tinymce.
isIE){func
tion fix(e
d,o){if(o.
set){o.con
tent=o.con
tent.repla
ce(/<abbr(
[^>]+)>/gi
,'<html:ab
br $1>');o
.content=o
.content.r
eplace(/<\
/abbr>/gi,
'</html:ab
br>');}};e
d.onBefore
SetContent
.add(fix);
ed.onPostP
rocess.add
(fix);}ed.
onNodeChan
ge.add(fun
ction(ed,c
m,n,co){n=
ed.dom.get
Parent(n,'
CITE,ACRON
YM,ABBR,DE
L,INS');cm
.setDisabl
ed('cite',
co);cm.set
Disabled('
acronym',c
o);cm.setD
isabled('a
bbr',co);c
m.setDisab
led('del',
co);cm.set
Disabled('
ins',co);c
m.setDisab
led('attri
bs',n&&n.n
odeName=='
BODY');if(
n){cm.setD
isabled(n.
nodeName.t
oLowerCase
(),0);cm.s
etActive(n
.nodeName.
toLowerCas
e(),1);}el
se{cm.setA
ctive('cit
e',0);cm.s
etActive('
acronym',0
);cm.setAc
tive('abbr
',0);cm.se
tActive('d
el',0);cm.
setActive(
'ins',0);}
});},getIn
fo:functio
n(){return
{longname:
'XHTML Xtr
as Plugin'
,author:'M
oxiecode S
ystems AB'
,authorurl
:'http://t
inymce.mox
iecode.com
',infourl:
'http://wi
ki.moxieco
de.com/ind
ex.php/Tin
yMCE:Plugi
ns/xhtmlxt
ras',versi
on:tinymce
.majorVers
ion+"."+ti
nymce.mino
rVersion};
}});tinymc
e.PluginMa
nager.add(
'xhtmlxtra
s',tinymce
.plugins.X
HTMLXtrasP
lugin);})(
);
|