No regular expressions were active.
1 |
|
/**
|
|
1 |
|
/**
|
2 |
|
*
$Id:
editor_plu
gin_src.js
20
1
200
7
-0
2-
1
2
1
5:5
6:
56
Z
spocke
$
|
|
2 |
|
*
$Id:
editor_plu
gin_src.js
5
20
200
8
-0
1
-07
1
6:
30:32
Z
spocke
$
|
3 |
|
*
|
|
3 |
|
*
|
4 |
|
* @author
Moxiecode
|
|
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('style'
);
|
|
9 |
|
tinymc
e.create('
tinymce.pl
ugins.Styl
ePlugin',
{
|
|
|
10 |
|
in
it : funct
ion(ed, ur
l) {
|
|
|
11 |
|
// Regis
ter comman
ds
|
|
|
12 |
|
ed.addCo
mmand('mce
StyleProps
', functio
n() {
|
|
|
13 |
|
ed.w
indowManag
er.open({
|
|
|
14 |
|
file : url
+ '/props
.htm',
|
|
|
15 |
|
width : 48
0 + parseI
nt(ed.getL
ang('style
.delta_wid
th', 0)),
|
|
|
16 |
|
height : 3
20 + parse
Int(ed.get
Lang('styl
e.delta_he
ight', 0))
,
|
|
|
17 |
|
inline : 1
|
|
|
18 |
|
}, {
|
|
|
19 |
|
plugin_url
: url,
|
|
|
20 |
|
style_text
: ed.sele
ction.getN
ode().styl
e.cssText
|
|
|
21 |
|
});
|
|
|
22 |
|
});
|
|
|
23 |
|
|
|
|
24 |
|
ed.addCo
mmand('mce
SetElement
Style', fu
nction(ui,
v) {
|
|
|
25 |
|
if (
e = ed.sel
ection.get
Node()) {
|
|
|
26 |
|
ed.dom.set
Attrib(e,
'style', v
);
|
|
|
27 |
|
ed.execCom
mand('mceR
epaint');
|
|
|
28 |
|
}
|
|
|
29 |
|
});
|
|
|
30 |
|
|
|
|
31 |
|
// Regis
ter button
s
|
|
|
32 |
|
ed.addBu
tton('styl
eprops', {
title : 's
tyle.desc'
, cmd : 'm
ceStylePro
ps'});
|
|
|
33 |
|
},
|
10 |
|
|
|
34 |
|
|
11 |
|
var TinyMC
E_StylePlu
gin = {
|
|
|
12 |
|
getInf
o : functi
on() {
|
|
35 |
|
ge
tInfo : fu
nction() {
|
13 |
|
re
turn {
|
|
36 |
|
return {
|
14 |
|
longname
: 'Style'
,
|
|
37 |
|
long
name : 'St
yle',
|
15 |
|
author :
'Moxiecod
e Systems
AB',
|
|
38 |
|
auth
or : 'Moxi
ecode Syst
ems AB',
|
16 |
|
authorur
l : 'http:
//tinymce.
moxiecode.
com',
|
|
39 |
|
auth
orurl : 'h
ttp://tiny
mce.moxiec
ode.com',
|
17 |
|
infourl
: 'http://
wiki.moxie
code.com/i
ndex.php/T
inyMCE:Plu
gins/style
',
|
|
40 |
|
info
url : 'htt
p://wiki.m
oxiecode.c
om/index.p
hp/TinyMCE
:Plugins/s
tyle',
|
18 |
|
version
:
tiny
MCE
.majorVers
ion
+
"."
+
tiny
MCE
.minorVers
ion
|
|
41 |
|
version
:
tiny
mce
.majorVers
ion
+
"."
+
tiny
mce
.minorVers
ion
|
19 |
|
};
|
|
42 |
|
};
|
20 |
|
},
|
|
|
21 |
|
|
|
|
22 |
|
getCon
trolHTML :
function(
cn) {
|
|
|
23 |
|
sw
itch (cn)
{
|
|
|
24 |
|
case "st
yleprops":
|
|
|
25 |
|
retu
rn tinyMCE
.getButton
HTML(cn, '
lang_style
_styleinfo
_desc', '{
$pluginurl
}/images/s
tyleprops.
gif', 'mce
StyleProps
', true);
|
|
|
26 |
|
}
|
|
|
27 |
|
|
|
|
28 |
|
re
turn "";
|
|
|
29 |
|
},
|
|
|
30 |
|
|
|
|
31 |
|
execCo
mmand : fu
nction(edi
tor_id, el
ement, com
mand, user
_interface
, value) {
|
|
|
32 |
|
va
r e, inst;
|
|
|
33 |
|
|
|
|
34 |
|
//
Handle co
mmands
|
|
|
35 |
|
sw
itch (comm
and) {
|
|
|
36 |
|
case "mc
eStyleProp
s":
|
|
|
37 |
|
Tiny
MCE_StyleP
lugin._sty
leProps();
|
|
|
38 |
|
retu
rn true;
|
|
|
39 |
|
|
|
|
40 |
|
case "mc
eSetElemen
tStyle":
|
|
|
41 |
|
inst
= tinyMCE
.getInstan
ceById(edi
tor_id);
|
|
|
42 |
|
e =
inst.selec
tion.getFo
cusElement
();
|
|
|
43 |
|
|
|
|
44 |
|
if (
e) {
|
|
|
45 |
|
e.style.cs
sText = va
lue;
|
|
|
46 |
|
inst.repai
nt();
|
|
|
47 |
|
}
|
|
|
48 |
|
|
|
|
49 |
|
retu
rn true;
|
|
|
50 |
|
}
|
|
43 |
|
}
|
51 |
|
|
|
|
52 |
|
//
Pass to n
ext handle
r in chain
|
|
|
53 |
|
re
turn false
;
|
|
|
54 |
|
},
|
|
|
55 |
|
|
|
|
56 |
|
handle
NodeChange
: functio
n(editor_i
d, node, u
ndo_index,
undo_leve
ls, visual
_aid, any_
selection)
{
|
|
|
57 |
|
if
(node.nod
eName == '
BODY')
|
|
|
58 |
|
tinyMCE.
switchClas
s(editor_i
d + '_styl
eprops', '
mceButtonD
isabled');
|
|
|
59 |
|
el
se
|
|
|
60 |
|
tinyMCE.
switchClas
s(editor_i
d + '_styl
eprops', '
mceButtonN
ormal');
|
|
|
61 |
|
},
|
|
|
62 |
|
|
|
|
63 |
|
// Pri
vate plugi
n specific
methods
|
|
|
64 |
|
|
|
|
65 |
|
_style
Props : fu
nction() {
|
|
|
66 |
|
va
r e = tiny
MCE.select
edInstance
.selection
.getFocusE
lement();
|
|
|
67 |
|
|
|
|
68 |
|
if
(!e || e.
nodeName =
= 'BODY')
|
|
|
69 |
|
return;
|
|
|
70 |
|
|
|
|
71 |
|
ti
nyMCE.open
Window({
|
|
|
72 |
|
file : '
../../plug
ins/style/
props.htm'
,
|
|
|
73 |
|
width :
480 + tiny
MCE.getLan
g('lang_st
yle_props_
delta_widt
h', 0),
|
|
|
74 |
|
height :
320 + tin
yMCE.getLa
ng('lang_s
tyle_props
_delta_hei
ght', 0)
|
|
|
75 |
|
},
{
|
|
|
76 |
|
editor_i
d : tinyMC
E.selected
Instance.e
ditorId,
|
|
|
77 |
|
inline :
"yes",
|
|
|
78 |
|
style_te
xt : e.sty
le.cssText
|
|
|
79 |
|
})
;
|
|
44 |
|
});
|
80 |
|
}
|
|
|
81 |
|
};
|
|
|
82 |
|
|
|
45 |
|
|
83 |
|
tiny
MCE
.
add
Plugin
(
"
style
"
,
T
iny
MCE_
StylePlugi
n);
|
|
46 |
|
// Reg
ister plug
in
|
|
|
47 |
|
tiny
mce
.
Plugin
Manager.ad
d
(
'
style
'
,
t
iny
mce.plugin
s.
StylePlugi
n);
|
|
|
48 |
|
})();
|