|
|
1 |
|
(function(
){var DOM=
tinymce.DO
M,Event=ti
nymce.dom.
Event,each
=tinymce.e
ach,is=tin
ymce.is;ti
nymce.crea
te('tinymc
e.plugins.
Compat2x',
{getInfo:f
unction(){
return{lon
gname:'Com
pat2x',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/c
ompat2x',v
ersion:tin
yMCE.major
Version+".
"+tinyMCE.
minorVersi
on};}});(f
unction(){
tinymce.ex
tend(tinyM
CE,{addToL
ang:functi
on(p,l){ea
ch(l,funct
ion(v,k){t
inyMCE.i18
n[(tinyMCE
.settings.
language||
'en')+'.'+
(p?p+'_':'
')+k]=v;})
;},getInst
anceById:f
unction(n)
{return th
is.get(n);
}});})();(
function()
{var Edito
rManager=t
inymce.Edi
torManager
;tinyMCE.i
nstances={
};tinyMCE.
plugins={}
;tinymce.P
luginManag
er.onAdd.a
dd(functio
n(pm,n,p){
tinyMCE.pl
ugins[n]=p
;});tinyMC
E.majorVer
sion=tinym
ce.majorVe
rsion;tiny
MCE.minorV
ersion=tin
ymce.minor
Version;ti
nyMCE.rele
aseDate=ti
nymce.rele
aseDate;ti
nyMCE.base
URL=tinymc
e.baseURL;
tinyMCE.is
IE=tinyMCE
.isMSIE=ti
nymce.isIE
||tinymce.
isOpera;ti
nyMCE.isMS
IE5=tinymc
e.isIE;tin
yMCE.isMSI
E5_0=tinym
ce.isIE;ti
nyMCE.isMS
IE7=tinymc
e.isIE;tin
yMCE.isGec
ko=tinymce
.isGecko;t
inyMCE.isS
afari=tiny
mce.isWebK
it;tinyMCE
.isOpera=t
inymce.isO
pera;tinyM
CE.isMac=f
alse;tinyM
CE.isNS7=f
alse;tinyM
CE.isNS71=
false;tiny
MCE.compat
=true;Tiny
MCE_Engine
=tinyMCE;t
inymce.ext
end(tinyMC
E,{getPara
m:function
(n,dv){ret
urn this.a
ctiveEdito
r.getParam
(n,dv);},a
ddEvent:fu
nction(e,n
a,f,sc){ti
nymce.dom.
Event.add(
e,na,f,sc|
|this);},g
etControlH
TML:functi
on(n){retu
rn EditorM
anager.act
iveEditor.
controlMan
ager.creat
eControl(n
);},loadCS
S:function
(u){tinymc
e.DOM.load
CSS(u);},i
mportCSS:f
unction(do
c,u){if(do
c==documen
t)this.loa
dCSS(u);el
se new tin
ymce.dom.D
OMUtils(do
c).loadCSS
(u);},log:
function()
{console.d
ebug.apply
(console,a
rguments);
},getLang:
function(n
,dv){var v
=EditorMan
ager.activ
eEditor.ge
tLang(n.re
place(/^la
ng_/g,''),
dv);if(/^[
0-9\-.]+$/
g.test(v))
return par
seInt(v);r
eturn v;},
isInstance
:function(
o){return
o!=null&&t
ypeof(o)==
"object"&&
o.execComm
and;},trig
gerNodeCha
nge:functi
on(){Edito
rManager.a
ctiveEdito
r.nodeChan
ged();},re
gexpReplac
e:function
(in_str,re
g_exp,repl
ace_str,op
ts){var re
;if(in_str
==null)ret
urn in_str
;if(typeof
(opts)=="u
ndefined")
opts='g';r
e=new RegE
xp(reg_exp
,opts);ret
urn in_str
.replace(r
e,replace_
str);},tri
m:function
(s){return
tinymce.t
rim(s);},x
mlEncode:f
unction(s)
{return ti
nymce.DOM.
encode(s);
},explode:
function(s
,d){var o=
[];tinymce
.each(s.sp
lit(d),fun
ction(v){i
f(v!='')o.
push(v);})
;return o;
},switchCl
ass:functi
on(id,cls)
{var b;if(
/^mceButto
n/.test(cl
s)){b=Edit
orManager.
activeEdit
or.control
Manager.ge
t(id);if(!
b)return;s
witch(cls)
{case"mceB
uttonNorma
l":b.setDi
sabled(fal
se);b.setA
ctive(fals
e);return;
case"mceBu
ttonDisabl
ed":b.setD
isabled(tr
ue);return
;case"mceB
uttonSelec
ted":b.set
Active(tru
e);b.setDi
sabled(fal
se);return
;}}},addCS
SClass:fun
ction(e,n,
b){return
tinymce.DO
M.addClass
(e,n,b);},
hasCSSClas
s:function
(e,n){retu
rn tinymce
.DOM.hasCl
ass(e,n);}
,removeCSS
Class:func
tion(e,n){
return tin
ymce.DOM.r
emoveClass
(e,n);},ge
tCSSClasse
s:function
(){var cl=
EditorMana
ger.active
Editor.dom
.getClasse
s(),o=[];e
ach(cl,fun
ction(c){o
.push(c['c
lass']);})
;return o;
},setWindo
wArg:funct
ion(n,v){E
ditorManag
er.activeE
ditor.wind
owManager.
params[n]=
v;},getWin
dowArg:fun
ction(n,dv
){var wm=E
ditorManag
er.activeE
ditor.wind
owManager,
v;v=wm.get
Param(n);i
f(v==='')r
eturn'';re
turn v||wm
.getFeatur
e(n)||dv;}
,getParent
Node:funct
ion(n,f){r
eturn this
._getDOM()
.getParent
(n,f);},se
lectElemen
ts:functio
n(n,na,f){
var i,a=[]
,nl,x;for(
x=0,na=na.
split(',')
;x<na.leng
th;x++)for
(i=0,nl=n.
getElement
sByTagName
(na[x]);i<
nl.length;
i++)(!f||f
(nl[i]))&&
a.push(nl[
i]);return
a;},getNo
deTree:fun
ction(n,na
,t,nn){ret
urn this.s
electNodes
(n,functio
n(n){retur
n(!t||n.no
deType==t)
&&(!nn||n.
nodeName==
nn);},na?n
a:[]);},ge
tAttrib:fu
nction(e,n
,dv){retur
n this._ge
tDOM().get
Attrib(e,n
,dv);},set
Attrib:fun
ction(e,n,
v){return
this._getD
OM().setAt
trib(e,n,v
);},getEle
mentsByAtt
ributeValu
e:function
(n,e,a,v){
var i,nl=n
.getElemen
tsByTagNam
e(e),o=[];
for(i=0;i<
nl.length;
i++){if(ti
nyMCE.getA
ttrib(nl[i
],a).index
Of(v)!=-1)
o[o.length
]=nl[i];}r
eturn o;},
selectNode
s:function
(n,f,a){va
r i;if(!a)
a=[];if(f(
n))a[a.len
gth]=n;if(
n.hasChild
Nodes()){f
or(i=0;i<n
.childNode
s.length;i
++)tinyMCE
.selectNod
es(n.child
Nodes[i],f
,a);}retur
n a;},getC
ontent:fun
ction(){re
turn Edito
rManager.a
ctiveEdito
r.getConte
nt();},get
ParentElem
ent:functi
on(n,na,f)
{if(na)na=
new RegExp
('^('+na.t
oUpperCase
().replace
(/,/g,'|')
+')$','g')
;return th
is._getDOM
().getPare
nt(n,funct
ion(n){ret
urn n.node
Type==1&&(
!na||na.te
st(n.nodeN
ame))&&(!f
||f(n));},
this.activ
eEditor.ge
tBody());}
,importPlu
ginLanguag
ePack:func
tion(n){ti
nymce.Plug
inManager.
requireLan
gPack(n);}
,getButton
HTML:funct
ion(cn,lan
g,img,c,u,
v){var ed=
EditorMana
ger.active
Editor;img
=img.repla
ce(/\{\$pl
uginurl\}/
g,tinyMCE.
pluginURL)
;img=img.r
eplace(/\{
\$themeurl
\}/g,tinyM
CE.themeUR
L);lang=la
ng.replace
(/^lang_/g
,'');retur
n ed.contr
olManager.
createButt
on(cn,{tit
le:lang,co
mmand:c,ui
:u,value:v
,scope:thi
s,'class':
'compat',i
mage:img})
;},addSele
ctAccessib
ility:func
tion(e,s,w
){if(!s._i
sAccessibl
e){s.onkey
down=tinyM
CE.accessi
bleEventHa
ndler;s.on
blur=tinyM
CE.accessi
bleEventHa
ndler;s._i
sAccessibl
e=true;s._
win=w;}ret
urn false;
},accessib
leEventHan
dler:funct
ion(e){var
elm,win=t
his._win;e
=tinymce.i
sIE?win.ev
ent:e;elm=
tinymce.is
IE?e.srcEl
ement:e.ta
rget;if(e.
type=="blu
r"){if(elm
.oldonchan
ge){elm.on
change=elm
.oldonchan
ge;elm.old
onchange=n
ull;}retur
n true;}if
(elm.nodeN
ame=="SELE
CT"&&!elm.
oldonchang
e){elm.old
onchange=e
lm.onchang
e;elm.onch
ange=null;
}if(e.keyC
ode==13||e
.keyCode==
32){elm.on
change=elm
.oldonchan
ge;elm.onc
hange();el
m.oldoncha
nge=null;t
inyMCE.can
celEvent(e
);return f
alse;}retu
rn true;},
cancelEven
t:function
(e){return
tinymce.d
om.Event.c
ancel(e);}
,handleVis
ualAid:fun
ction(e){E
ditorManag
er.activeE
ditor.addV
isual(e);}
,getAbsPos
ition:func
tion(n,r){
return tin
ymce.DOM.g
etPos(n,r)
;},cleanup
EventStr:f
unction(s)
{s=""+s;s=
s.replace(
'function
anonymous(
)\n{\n',''
);s=s.repl
ace('\n}',
'');s=s.re
place(/^re
turn true;
/gi,'');re
turn s;},g
etVisualAi
dClass:fun
ction(s){r
eturn s;},
parseStyle
:function(
s){return
this._getD
OM().parse
Style(s);}
,serialize
Style:func
tion(s){re
turn this.
_getDOM().
serializeS
tyle(s);},
openWindow
:function(
tpl,args){
var ed=Edi
torManager
.activeEdi
tor,o={},n
;for(n in
tpl)o[n]=t
pl[n];tpl=
o;args=arg
s||{};tpl.
url=new ti
nymce.util
.URI(tinym
ce.ThemeMa
nager.them
eURLs[ed.s
ettings.th
eme]).toAb
solute(tpl
.file);tpl
.inline=tp
l.inline||
args.inlin
e;ed.windo
wManager.o
pen(tpl,ar
gs);},clos
eWindow:fu
nction(win
){EditorMa
nager.acti
veEditor.w
indowManag
er.close(w
in);},getO
uterHTML:f
unction(e)
{return ti
nymce.DOM.
getOuterHT
ML(e);},se
tOuterHTML
:function(
e,h,d){ret
urn tinymc
e.DOM.setO
uterHTML(e
,h,d);},ha
sPlugin:fu
nction(n){
return tin
ymce.Plugi
nManager.g
et(n)!=nul
l;},_setEv
entsEnable
d:function
(){},addPl
ugin:funct
ion(pn,f){
var t=this
;function
PluginWrap
per(ed){ti
nyMCE.sele
ctedInstan
ce=ed;ed.o
nInit.add(
function()
{t.setting
s=ed.setti
ngs;t.sett
ings['base
_href']=ti
nyMCE.docu
mentBasePa
th;tinyMCE
.settings=
t.settings
;tinyMCE.d
ocumentBas
ePath=ed.d
ocumentBas
ePath;if(f
.initInsta
nce)f.init
Instance(e
d);ed.cont
entDocumen
t=ed.getDo
c();ed.con
tentWindow
=ed.getWin
();ed.undo
Redo=ed.un
doManager;
ed.startCo
ntent=ed.g
etContent(
{format:'r
aw'});tiny
MCE.instan
ces[ed.id]
=ed;tinyMC
E.loadedFi
les=[];});
ed.onActiv
ate.add(fu
nction(){t
inyMCE.set
tings=ed.s
ettings;ti
nyMCE.sele
ctedInstan
ce=ed;});i
f(f.handle
NodeChange
){ed.onNod
eChange.ad
d(function
(ed,cm,n){
f.handleNo
deChange(e
d.id,n,0,0
,false,!ed
.selection
.isCollaps
ed());});}
if(f.onCha
nge){ed.on
Change.add
(function(
ed,n){retu
rn f.onCha
nge(ed);})
;}if(f.cle
anup){ed.o
nGetConten
t.add(func
tion(){});
}this.getI
nfo=functi
on(){retur
n f.getInf
o();};this
.createCon
trol=funct
ion(n){tin
yMCE.plugi
nURL=tinym
ce.baseURL
+'/plugins
/'+pn;tiny
MCE.themeU
RL=tinymce
.baseURL+'
/themes/'+
tinyMCE.ac
tiveEditor
.settings.
theme;if(f
.getContro
lHTML)retu
rn f.getCo
ntrolHTML(
n);return
null;};thi
s.execComm
and=functi
on(cmd,ui,
val){if(f.
execComman
d)return f
.execComma
nd(ed.id,e
d.getBody(
),cmd,ui,v
al);return
false;};}
;tinymce.P
luginManag
er.add(pn,
PluginWrap
per);},_ge
tDOM:funct
ion(){retu
rn tinyMCE
.activeEdi
tor?tinyMC
E.activeEd
itor.dom:t
inymce.DOM
;},convert
RelativeTo
AbsoluteUR
L:function
(b,u){retu
rn new tin
ymce.util.
URI(b).toA
bsolute(u)
;},convert
AbsoluteUR
LToRelativ
eURL:funct
ion(b,u){r
eturn new
tinymce.ut
il.URI(b).
toRelative
(u);}});ti
nymce.exte
nd(tinymce
.Editor.pr
ototype,{g
etFocusEle
ment:funct
ion(){retu
rn this.se
lection.ge
tNode();},
getData:fu
nction(n){
if(!this.d
ata)this.d
ata=[];if(
!this.data
[n])this.d
ata[n]=[];
return thi
s.data[n];
},hasPlugi
n:function
(n){return
this.plug
ins[n]!=nu
ll;},getCo
ntainerWin
:function(
){return w
indow;},ge
tHTML:func
tion(raw){
return thi
s.getConte
nt({format
:raw?'raw'
:'html'});
},setHTML:
function(h
){this.set
Content(h)
;},getSel:
function()
{return th
is.selecti
on.getSel(
);},getRng
:function(
){return t
his.select
ion.getRng
();},isHid
den:functi
on(){var s
;if(!tinym
ce.isGecko
)return fa
lse;s=this
.getSel();
return(!s|
|!s.rangeC
ount||s.ra
ngeCount==
0);},trans
late:funct
ion(s){var
c=this.se
ttings.lan
guage,o;o=
tinymce.Ed
itorManage
r.i18n[c+'
.'+s]||s.r
eplace(/{\
#([^}]+)\}
/g,functio
n(a,b){ret
urn tinymc
e.EditorMa
nager.i18n
[c+'.'+b]|
|'{#'+b+'}
';});o=o.r
eplace(/{\
$lang_([^}
]+)\}/g,fu
nction(a,b
){return t
inymce.Edi
torManager
.i18n[c+'.
'+b]||'{$l
ang_'+b+'}
';});retur
n o;},repa
int:functi
on(){this.
execComman
d('mceRepa
int');}});
tinymce.ex
tend(tinym
ce.dom.Sel
ection.pro
totype,{ge
tSelectedT
ext:functi
on(){retur
n this.get
Content({f
ormat:'tex
t'});},get
SelectedHT
ML:functio
n(){return
this.getC
ontent({fo
rmat:'html
'});},getF
ocusElemen
t:function
(){return
this.getNo
de();},sel
ectNode:fu
nction(nod
e,collapse
,select_te
xt_node,to
_start){va
r t=this;t
.select(no
de,select_
text_node|
|0);if(!is
(collapse)
)collapse=
true;if(co
llapse){if
(!is(to_st
art))to_st
art=true;t
.collapse(
to_start);
}}});}).ca
ll(this);t
inymce.Plu
ginManager
.add('comp
at2x',tiny
mce.plugin
s.Compat2x
);})();
|