1 |
|
tinyMCE.im
portPlugin
LanguagePa
ck('direct
ionality')
;var TinyM
CE_Directi
onalityPlu
gin={getIn
fo:functio
n(){return
{longname:
'Direction
ality',aut
hor:'Moxie
code Syste
ms AB',aut
horurl:'ht
tp://tinym
ce.moxieco
de.com',in
fourl:'htt
p://wiki.m
oxiecode.c
om/index.p
hp/TinyMCE
:Plugins/d
irectional
ity',versi
on:tinyMCE
.majorVers
ion+"."+ti
nyMCE.mino
rVersion}}
,getContro
lHTML:func
tion(cn){s
witch(cn){
case"ltr":
return tin
yMCE.getBu
ttonHTML(c
n,'lang_di
rectionali
ty_ltr_des
c','{$plug
inurl}/ima
ges/ltr.gi
f','mceDir
ectionLTR'
);case"rtl
":return t
inyMCE.get
ButtonHTML
(cn,'lang_
directiona
lity_rtl_d
esc','{$pl
uginurl}/i
mages/rtl.
gif','mceD
irectionRT
L')}return
""},execCo
mmand:func
tion(edito
r_id,eleme
nt,command
,user_inte
rface,valu
e){switch(
command){c
ase"mceDir
ectionLTR"
:var inst=
tinyMCE.ge
tInstanceB
yId(editor
_id);var e
lm=tinyMCE
.getParent
Element(in
st.getFocu
sElement()
,"p,div,td
,h1,h2,h3,
h4,h5,h6,p
re,address
");if(elm)
elm.setAtt
ribute("di
r","ltr");
tinyMCE.tr
iggerNodeC
hange(fals
e);return
true;case"
mceDirecti
onRTL":var
inst=tiny
MCE.getIns
tanceById(
editor_id)
;var elm=t
inyMCE.get
ParentElem
ent(inst.g
etFocusEle
ment(),"p,
div,td,h1,
h2,h3,h4,h
5,h6,pre,a
ddress");i
f(elm)elm.
setAttribu
te("dir","
rtl");tiny
MCE.trigge
rNodeChang
e(false);r
eturn true
}return fa
lse},handl
eNodeChang
e:function
(editor_id
,node,undo
_index,und
o_levels,v
isual_aid,
any_select
ion){funct
ion getAtt
rib(elm,na
me){return
elm.getAt
tribute(na
me)?elm.ge
tAttribute
(name):""}
if(node==n
ull)return
;var elm=t
inyMCE.get
ParentElem
ent(node,"
p,div,td,h
1,h2,h3,h4
,h5,h6,pre
,address")
;if(!elm){
tinyMCE.sw
itchClass(
editor_id+
'_ltr','mc
eButtonDis
abled');ti
nyMCE.swit
chClass(ed
itor_id+'_
rtl','mceB
uttonDisab
led');retu
rn true}ti
nyMCE.swit
chClass(ed
itor_id+'_
ltr','mceB
uttonNorma
l');tinyMC
E.switchCl
ass(editor
_id+'_rtl'
,'mceButto
nNormal');
var dir=ge
tAttrib(el
m,"dir");i
f(dir=="lt
r"||dir=="
")tinyMCE.
switchClas
s(editor_i
d+'_ltr','
mceButtonS
elected');
else tinyM
CE.switchC
lass(edito
r_id+'_rtl
','mceButt
onSelected
');return
true}};tin
yMCE.addPl
ugin("dire
ctionality
",TinyMCE_
Directiona
lityPlugin
);
|
|
1 |
|
(function(
){tinymce.
create('ti
nymce.plug
ins.Direct
ionality',
{init:func
tion(ed,ur
l){var t=t
his;t.edit
or=ed;ed.a
ddCommand(
'mceDirect
ionLTR',fu
nction(){v
ar e=ed.do
m.getParen
t(ed.selec
tion.getNo
de(),ed.do
m.isBlock)
;if(e){if(
ed.dom.get
Attrib(e,"
dir")!="lt
r")ed.dom.
setAttrib(
e,"dir","l
tr");else
ed.dom.set
Attrib(e,"
dir","");}
ed.nodeCha
nged();});
ed.addComm
and('mceDi
rectionRTL
',function
(){var e=e
d.dom.getP
arent(ed.s
election.g
etNode(),e
d.dom.isBl
ock);if(e)
{if(ed.dom
.getAttrib
(e,"dir")!
="rtl")ed.
dom.setAtt
rib(e,"dir
","rtl");e
lse ed.dom
.setAttrib
(e,"dir","
");}ed.nod
eChanged()
;});ed.add
Button('lt
r',{title:
'direction
ality.ltr_
desc',cmd:
'mceDirect
ionLTR'});
ed.addButt
on('rtl',{
title:'dir
ectionalit
y.rtl_desc
',cmd:'mce
DirectionR
TL'});ed.o
nNodeChang
e.add(t._n
odeChange,
t);},getIn
fo:functio
n(){return
{longname:
'Direction
ality',aut
hor:'Moxie
code Syste
ms AB',aut
horurl:'ht
tp://tinym
ce.moxieco
de.com',in
fourl:'htt
p://wiki.m
oxiecode.c
om/index.p
hp/TinyMCE
:Plugins/d
irectional
ity',versi
on:tinymce
.majorVers
ion+"."+ti
nymce.mino
rVersion};
},_nodeCha
nge:functi
on(ed,cm,n
){var dom=
ed.dom,dir
;n=dom.get
Parent(n,d
om.isBlock
);if(!n){c
m.setDisab
led('ltr',
1);cm.setD
isabled('r
tl',1);ret
urn;}dir=d
om.getAttr
ib(n,'dir'
);cm.setAc
tive('ltr'
,dir=="ltr
");cm.setD
isabled('l
tr',0);cm.
setActive(
'rtl',dir=
="rtl");cm
.setDisabl
ed('rtl',0
);}});tiny
mce.Plugin
Manager.ad
d('directi
onality',t
inymce.plu
gins.Direc
tionality)
;})();
|