No regular expressions were active.
|
|
1 |
|
/**
|
|
|
2 |
|
* $Id: ed
itor_plugi
n_src.js 2
01 2007-02
-12 15:56:
56Z spocke
$
|
|
|
3 |
|
*
|
|
|
4 |
|
* @author
Moxiecode
|
|
|
5 |
|
* @copyri
ght Copyri
ght © 2004
-2008, Mox
iecode Sys
tems AB, A
ll rights
reserved.
|
|
|
6 |
|
*/
|
|
|
7 |
|
|
|
|
8 |
|
(function(
) {
|
|
|
9 |
|
// Loa
d plugin s
pecific la
nguage pac
k
|
|
|
10 |
|
tinymc
e.PluginMa
nager.requ
ireLangPac
k('example
');
|
|
|
11 |
|
|
|
|
12 |
|
tinymc
e.create('
tinymce.pl
ugins.Exam
plePlugin'
, {
|
|
|
13 |
|
/*
*
|
|
|
14 |
|
*
Initializ
es the plu
gin, this
will be ex
ecuted aft
er the plu
gin has be
en created
.
|
|
|
15 |
|
*
This call
is done b
efore the
editor ins
tance has
finished i
t's initia
lization s
o use the
onInit eve
nt
|
|
|
16 |
|
*
of the ed
itor insta
nce to int
ercept tha
t event.
|
|
|
17 |
|
*
|
|
|
18 |
|
*
@param {t
inymce.Edi
tor} ed Ed
itor insta
nce that t
he plugin
is initial
ized in.
|
|
|
19 |
|
*
@param {s
tring} url
Absolute
URL to whe
re the plu
gin is loc
ated.
|
|
|
20 |
|
*
/
|
|
|
21 |
|
in
it : funct
ion(ed, ur
l) {
|
|
|
22 |
|
// Regis
ter the co
mmand so t
hat it can
be invoke
d by using
tinyMCE.a
ctiveEdito
r.execComm
and('mceEx
ample');
|
|
|
23 |
|
ed.addCo
mmand('mce
Example',
function()
{
|
|
|
24 |
|
ed.w
indowManag
er.open({
|
|
|
25 |
|
file : url
+ '/dialo
g.htm',
|
|
|
26 |
|
width : 32
0 + parseI
nt(ed.getL
ang('examp
le.delta_w
idth', 0))
,
|
|
|
27 |
|
height : 1
20 + parse
Int(ed.get
Lang('exam
ple.delta_
height', 0
)),
|
|
|
28 |
|
inline : 1
|
|
|
29 |
|
}, {
|
|
|
30 |
|
plugin_url
: url, //
Plugin ab
solute URL
|
|
|
31 |
|
some_custo
m_arg : 'c
ustom arg'
// Custom
argument
|
|
|
32 |
|
});
|
|
|
33 |
|
});
|
|
|
34 |
|
|
|
|
35 |
|
// Regis
ter exampl
e button
|
|
|
36 |
|
ed.addBu
tton('exam
ple', {
|
|
|
37 |
|
titl
e : 'examp
le.desc',
|
|
|
38 |
|
cmd
: 'mceExam
ple',
|
|
|
39 |
|
imag
e : url +
'/img/exam
ple.gif'
|
|
|
40 |
|
});
|
|
|
41 |
|
|
|
|
42 |
|
// Add a
node chan
ge handler
, selects
the button
in the UI
when a im
age is sel
ected
|
|
|
43 |
|
ed.onNod
eChange.ad
d(function
(ed, cm, n
) {
|
|
|
44 |
|
cm.s
etActive('
example',
n.nodeName
== 'IMG')
;
|
|
|
45 |
|
});
|
|
|
46 |
|
},
|
|
|
47 |
|
|
|
|
48 |
|
/*
*
|
|
|
49 |
|
*
Creates c
ontrol ins
tances bas
ed in the
incomming
name. This
method is
normally
not
|
|
|
50 |
|
*
needed si
nce the ad
dButton me
thod of th
e tinymce.
Editor cla
ss is a mo
re easy wa
y of addin
g buttons
|
|
|
51 |
|
*
but you s
ometimes n
eed to cre
ate more c
omplex con
trols like
listboxes
, split bu
ttons etc
then this
|
|
|
52 |
|
*
method ca
n be used
to create
those.
|
|
|
53 |
|
*
|
|
|
54 |
|
*
@param {S
tring} n N
ame of the
control t
o create.
|
|
|
55 |
|
*
@param {t
inymce.Con
trolManage
r} cm Cont
rol manage
r to use i
norder to
create new
control.
|
|
|
56 |
|
*
@return {
tinymce.ui
.Control}
New contro
l instance
or null i
f no contr
ol was cre
ated.
|
|
|
57 |
|
*
/
|
|
|
58 |
|
cr
eateContro
l : functi
on(n, cm)
{
|
|
|
59 |
|
return n
ull;
|
|
|
60 |
|
},
|
|
|
61 |
|
|
|
|
62 |
|
/*
*
|
|
|
63 |
|
*
Returns i
nformation
about the
plugin as
a name/va
lue array.
|
|
|
64 |
|
*
The curre
nt keys ar
e longname
, author,
authorurl,
infourl a
nd version
.
|
|
|
65 |
|
*
|
|
|
66 |
|
*
@return {
Object} Na
me/value a
rray conta
ining info
rmation ab
out the pl
ugin.
|
|
|
67 |
|
*
/
|
|
|
68 |
|
ge
tInfo : fu
nction() {
|
|
|
69 |
|
return {
|
|
|
70 |
|
long
name : 'Ex
ample plug
in',
|
|
|
71 |
|
auth
or : 'Some
author',
|
|
|
72 |
|
auth
orurl : 'h
ttp://tiny
mce.moxiec
ode.com',
|
|
|
73 |
|
info
url : 'htt
p://wiki.m
oxiecode.c
om/index.p
hp/TinyMCE
:Plugins/e
xample',
|
|
|
74 |
|
vers
ion : "1.0
"
|
|
|
75 |
|
};
|
|
|
76 |
|
}
|
|
|
77 |
|
});
|
|
|
78 |
|
|
|
|
79 |
|
// Reg
ister plug
in
|
|
|
80 |
|
tinymc
e.PluginMa
nager.add(
'example',
tinymce.p
lugins.Exa
mplePlugin
);
|
|
|
81 |
|
})();
|