1 |
|
tinyMCE.im
portPlugin
LanguagePa
ck('fullsc
reen');var
TinyMCE_F
ullScreenP
lugin={get
Info:funct
ion(){retu
rn{longnam
e:'Fullscr
een',autho
r:'Moxieco
de Systems
AB',autho
rurl:'http
://tinymce
.moxiecode
.com',info
url:'http:
//wiki.mox
iecode.com
/index.php
/TinyMCE:P
lugins/ful
lscreen',v
ersion:tin
yMCE.major
Version+".
"+tinyMCE.
minorVersi
on}},initI
nstance:fu
nction(ins
t){if(!tin
yMCE.setti
ngs['fulls
creen_skip
_plugin_cs
s'])tinyMC
E.importCS
S(inst.get
ContainerW
in().docum
ent,tinyMC
E.baseURL+
"/plugins/
fullscreen
/css/page.
css")},get
ControlHTM
L:function
(cn){switc
h(cn){case
"fullscree
n":return
tinyMCE.ge
tButtonHTM
L(cn,'lang
_fullscree
n_desc','{
$pluginurl
}/images/f
ullscreen.
gif','mceF
ullScreen'
)}return""
},execComm
and:functi
on(editor_
id,element
,command,u
ser_interf
ace,value)
{var inst;
switch(com
mand){case
"mceFullSc
reen":inst
=tinyMCE.g
etInstance
ById(edito
r_id);if(t
inyMCE.get
Param('ful
lscreen_ne
w_window')
)this._tog
gleFullscr
eenWin(ins
t);else th
is._toggle
Fullscreen
(inst);ret
urn true}r
eturn fals
e},_toggle
Fullscreen
Win:functi
on(inst){i
f(tinyMCE.
getParam('
fullscreen
_is_enable
d')){windo
w.opener.t
inyMCE.exe
cInstanceC
ommand(tin
yMCE.getPa
ram('fulls
creen_edit
or_id'),'m
ceSetConte
nt',false,
tinyMCE.ge
tContent(i
nst.editor
Id));top.c
lose()}els
e{tinyMCE.
setWindowA
rg('editor
_id',inst.
editorId);
var win=wi
ndow.open(
tinyMCE.ba
seURL+"/pl
ugins/full
screen/ful
lscreen.ht
m","mceFul
lScreenPop
up","fulls
creen=yes,
menubar=no
,toolbar=n
o,scrollba
rs=no,resi
zable=yes,
left=0,top
=0,width="
+screen.av
ailWidth+"
,height="+
screen.ava
ilHeight);
try{win.re
sizeTo(scr
een.availW
idth,scree
n.availHei
ght)}catch
(e){}}},_t
oggleFulls
creen:func
tion(inst)
{var ds=in
st.getData
('fullscre
en'),edito
rContainer
,tableElm,
iframe,vp,
cw,cd,re,w
,h,si,blo,
delta=0,ce
ll,row,fcm
l,bcml;cw=
inst.getCo
ntainerWin
();cd=cw.d
ocument;ed
itorContai
ner=cd.get
ElementByI
d(inst.edi
torId+'_pa
rent');tab
leElm=edit
orContaine
r.firstChi
ld;iframe=
inst.ifram
eElement;r
e=cd.getEl
ementById(
inst.edito
rId+'_resi
ze');blo=d
ocument.ge
tElementBy
Id('mce_fu
llscreen_b
locker');f
cm=new Tin
yMCE_Layer
(inst.edit
orId+'_fcM
enu');fcml
=new TinyM
CE_Layer(i
nst.editor
Id+'_fcMen
u');bcml=n
ew TinyMCE
_Layer(ins
t.editorId
+'_bcMenu'
);if(fcml.
exists()&&
fcml.isVis
ible()){ti
nyMCE.swit
chClass(in
st.editorI
d+'_foreco
lor','mceM
enuButton'
);fcml.hid
e()}if(bcm
l.exists()
&&bcml.isV
isible()){
tinyMCE.sw
itchClass(
inst.edito
rId+'_back
color','mc
eMenuButto
n');bcml.h
ide()}if(!
ds.enabled
){if(inst.
toolbarEle
ment){delt
a+=inst.to
olbarEleme
nt.offsetH
eight;cell
=tableElm.
tBodies[0]
.insertRow
(0).insert
Cell(-1);c
ell.classN
ame='mceTo
olbarTop';
cell.nowra
p=true;ds.
oldToolbar
Parent=ins
t.toolbarE
lement.par
entNode;ds
.toolbarHo
lder=docum
ent.create
TextNode('
...');cell
.appendChi
ld(ds.oldT
oolbarPare
nt.replace
Child(ds.t
oolbarHold
er,inst.to
olbarEleme
nt))}ds.pa
rents=[];v
p=tinyMCE.
getViewPor
t(cw);ds.s
crollX=vp.
left;ds.sc
rollY=vp.t
op;if(!tin
yMCE.isOpe
ra)tinyMCE
.addCSSCla
ss(cd.body
,'mceFulls
creen');ti
nyMCE.getP
arentNode(
tableElm.p
arentNode,
function(n
){if(n.nod
eName=='BO
DY')return
true;if(n
.nodeType=
=1)tinyMCE
.addCSSCla
ss(n,'mceF
ullscreenP
os');retur
n false});
if(re)re.s
tyle.displ
ay='none';
vp=tinyMCE
.getViewPo
rt(cw);ds.
oldWidth=i
frame.styl
e.width?if
rame.style
.width:ifr
ame.offset
Width;ds.o
ldHeight=i
frame.styl
e.height?i
frame.styl
e.height:i
frame.offs
etHeight;d
s.oldTWidt
h=tableElm
.style.wid
th?tableEl
m.style.wi
dth:tableE
lm.offsetW
idth;ds.ol
dTHeight=t
ableElm.st
yle.height
?tableElm.
style.heig
ht:tableEl
m.offsetHe
ight;if(ds
.oldWidth&
&ds.oldWid
th.indexOf
)ds.oldTWi
dth=ds.old
Width.inde
xOf('%')!=
-1?ds.oldW
idth:ds.ol
dTWidth;if
(!blo&&tin
yMCE.isRea
lIE){blo=t
inyMCE.cre
ateTag(doc
ument,'ifr
ame',{id:'
mce_fullsc
reen_block
er',src:'a
bout:blank
',frameBor
der:0,widt
h:vp.width
,height:vp
.height,st
yle:'displ
ay: block;
position:
absolute;
left: 0;
top: 0; z-
index: 999
; margin:
0; padding
: 0;'});do
cument.bod
y.appendCh
ild(blo)}t
ableElm.st
yle.positi
on='absolu
te';tableE
lm.style.z
Index=1000
;tableElm.
style.left
=tableElm.
style.top=
'0';tableE
lm.style.w
idth=vp.wi
dth+'px';t
ableElm.st
yle.height
=vp.height
+'px';if(t
inyMCE.isR
ealIE){ifr
ame.style.
width=vp.w
idth+'px';
iframe.sty
le.height=
vp.height+
'px';w=ifr
ame.parent
Node.clien
tWidth-(ta
bleElm.off
setWidth-v
p.width);h
=iframe.pa
rentNode.c
lientHeigh
t-(tableEl
m.offsetHe
ight-vp.he
ight)}else
{w=iframe.
parentNode
.clientWid
th;h=ifram
e.parentNo
de.clientH
eight}ifra
me.style.w
idth=w+"px
";iframe.s
tyle.heigh
t=(h+delta
)+"px";tin
yMCE.switc
hClass(ins
t.editorId
+'_fullscr
een','mceB
uttonSelec
ted');ds.e
nabled=tru
e;inst.use
CSS=false}
else{if(in
st.toolbar
Element){r
ow=inst.to
olbarEleme
nt.parentN
ode.parent
Node;row.p
arentNode.
removeChil
d(row);ds.
oldToolbar
Parent.rep
laceChild(
inst.toolb
arElement,
ds.toolbar
Holder);ds
.oldToolba
rParent=nu
ll;ds.tool
barHolder=
null}if(bl
o)blo.pare
ntNode.rem
oveChild(b
lo);si=0;t
inyMCE.get
ParentNode
(tableElm.
parentNode
,function(
n){if(n.no
deName=='B
ODY')retur
n true;if(
n.nodeType
==1)tinyMC
E.removeCS
SClass(n,'
mceFullscr
eenPos')})
;if(re&&ti
nyMCE.getP
aram("them
e_advanced
_resizing"
,false))re
.style.dis
play='bloc
k';tableEl
m.style.po
sition='st
atic';tabl
eElm.style
.zIndex=''
;tableElm.
style.widt
h='';table
Elm.style.
height='';
tableElm.s
tyle.width
=ds.oldTWi
dth?ds.old
TWidth:'';
tableElm.s
tyle.heigh
t=ds.oldTH
eight?ds.o
ldTHeight:
'';iframe.
style.widt
h=ds.oldWi
dth?ds.old
Width:'';i
frame.styl
e.height=d
s.oldHeigh
t?ds.oldHe
ight:'';ti
nyMCE.swit
chClass(in
st.editorI
d+'_fullsc
reen','mce
ButtonNorm
al');ds.en
abled=fals
e;tinyMCE.
removeCSSC
lass(cd.bo
dy,'mceFul
lscreen');
cw.scrollT
o(ds.scrol
lX,ds.scro
llY);inst.
useCSS=fal
se}},handl
eNodeChang
e:function
(editor_id
,node,undo
_index,und
o_levels,v
isual_aid,
any_select
ion){if(ti
nyMCE.getP
aram('full
screen_is_
enabled'))
tinyMCE.sw
itchClass(
editor_id+
'_fullscre
en','mceBu
ttonSelect
ed');retur
n true}};t
inyMCE.add
Plugin("fu
llscreen",
TinyMCE_Fu
llScreenPl
ugin);
|
|
1 |
|
(function(
){var DOM=
tinymce.DO
M;tinymce.
create('ti
nymce.plug
ins.FullSc
reenPlugin
',{init:fu
nction(ed,
url){var t
=this,s={}
,vp;t.edit
or=ed;ed.a
ddCommand(
'mceFullSc
reen',func
tion(){var
win,de=do
cument.doc
umentEleme
nt;if(ed.g
etParam('f
ullscreen_
is_enabled
')){if(ed.
getParam('
fullscreen
_new_windo
w'))closeF
ullscreen(
);else{win
dow.setTim
eout(funct
ion(){tiny
mce.dom.Ev
ent.remove
(window,'r
esize',t.r
esizeFunc)
;tinyMCE.g
et(ed.getP
aram('full
screen_edi
tor_id')).
setContent
(ed.getCon
tent({form
at:'raw'})
,{format:'
raw'});tin
yMCE.remov
e(ed);DOM.
remove('mc
e_fullscre
en_contain
er');de.st
yle.overfl
ow=ed.getP
aram('full
screen_htm
l_overflow
');DOM.set
Style(docu
ment.body,
'overflow'
,ed.getPar
am('fullsc
reen_overf
low'));win
dow.scroll
To(ed.getP
aram('full
screen_scr
ollx'),ed.
getParam('
fullscreen
_scrolly')
);tinyMCE.
settings=t
inyMCE.old
Settings;}
,10);}retu
rn;}if(ed.
getParam('
fullscreen
_new_windo
w')){win=w
indow.open
(url+"/ful
lscreen.ht
m","mceFul
lScreenPop
up","fulls
creen=yes,
menubar=no
,toolbar=n
o,scrollba
rs=no,resi
zable=yes,
left=0,top
=0,width="
+screen.av
ailWidth+"
,height="+
screen.ava
ilHeight);
try{win.re
sizeTo(scr
een.availW
idth,scree
n.availHei
ght);}catc
h(e){}}els
e{tinyMCE.
oldSetting
s=tinyMCE.
settings;s
.fullscree
n_overflow
=DOM.getSt
yle(docume
nt.body,'o
verflow',1
)||'auto';
s.fullscre
en_html_ov
erflow=DOM
.getStyle(
de,'overfl
ow',1);vp=
DOM.getVie
wPort();s.
fullscreen
_scrollx=v
p.x;s.full
screen_scr
olly=vp.y;
if(tinymce
.isOpera&&
s.fullscre
en_overflo
w=='visibl
e')s.fulls
creen_over
flow='auto
';if(tinym
ce.isIE&&s
.fullscree
n_overflow
=='scroll'
)s.fullscr
een_overfl
ow='auto';
if(s.fulls
creen_over
flow=='0px
')s.fullsc
reen_overf
low='';DOM
.setStyle(
document.b
ody,'overf
low','hidd
en');de.st
yle.overfl
ow='hidden
';vp=DOM.g
etViewPort
();window.
scrollTo(0
,0);if(tin
ymce.isIE)
vp.h-=1;n=
DOM.add(do
cument.bod
y,'div',{i
d:'mce_ful
lscreen_co
ntainer',s
tyle:'posi
tion:absol
ute;top:0;
left:0;wid
th:'+vp.w+
'px;height
:'+vp.h+'p
x;z-index:
150;'});DO
M.add(n,'d
iv',{id:'m
ce_fullscr
een'});tin
ymce.each(
ed.setting
s,function
(v,n){s[n]
=v;});s.id
='mce_full
screen';s.
width=n.cl
ientWidth;
s.height=n
.clientHei
ght-15;s.f
ullscreen_
is_enabled
=true;s.fu
llscreen_e
ditor_id=e
d.id;s.the
me_advance
d_resizing
=false;s.s
ave_onsave
callback=f
unction(){
ed.setCont
ent(tinyMC
E.get(s.id
).getConte
nt({format
:'raw'}),{
format:'ra
w'});ed.ex
ecCommand(
'mceSave')
;};tinymce
.each(ed.g
etParam('f
ullscreen_
settings')
,function(
v,k){s[k]=
v;});if(s.
theme_adva
nced_toolb
ar_locatio
n==='exter
nal')s.the
me_advance
d_toolbar_
location='
top';t.ful
lscreenEdi
tor=new ti
nymce.Edit
or('mce_fu
llscreen',
s);t.fulls
creenEdito
r.onInit.a
dd(functio
n(){t.full
screenEdit
or.setCont
ent(ed.get
Content())
;});t.full
screenEdit
or.render(
);tinyMCE.
add(t.full
screenEdit
or);t.full
screenElem
ent=new ti
nymce.dom.
Element('m
ce_fullscr
een_contai
ner');t.fu
llscreenEl
ement.upda
te();t.res
izeFunc=ti
nymce.dom.
Event.add(
window,'re
size',func
tion(){var
vp=tinymc
e.DOM.getV
iewPort();
t.fullscre
enEditor.t
heme.resiz
eTo(vp.w,v
p.h);});}}
);ed.addBu
tton('full
screen',{t
itle:'full
screen.des
c',cmd:'mc
eFullScree
n'});ed.on
NodeChange
.add(funct
ion(ed,cm)
{cm.setAct
ive('fulls
creen',ed.
getParam('
fullscreen
_is_enable
d'));});},
getInfo:fu
nction(){r
eturn{long
name:'Full
screen',au
thor:'Moxi
ecode Syst
ems AB',au
thorurl:'h
ttp://tiny
mce.moxiec
ode.com',i
nfourl:'ht
tp://wiki.
moxiecode.
com/index.
php/TinyMC
E:Plugins/
fullscreen
',version:
tinymce.ma
jorVersion
+"."+tinym
ce.minorVe
rsion};}})
;tinymce.P
luginManag
er.add('fu
llscreen',
tinymce.pl
ugins.Full
ScreenPlug
in);})();
|