No regular expressions were active.
1 |
|
/**
|
|
1 |
|
/**
|
2 |
|
*
$Id:
editor_plu
gin_src.js
4
2
200
6
-0
8
-
08
1
4:3
2
:
24
Z
spocke
$
|
|
2 |
|
*
$Id:
editor_plu
gin_src.js
2
01
200
7
-0
2
-
1
2
15
:
56:56
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('nonbre
aking');
|
|
9 |
|
tinymc
e.create('
tinymce.pl
ugins.Nonb
reaking',
{
|
|
|
10 |
|
in
it : funct
ion(ed, ur
l) {
|
|
|
11 |
|
var t =
this;
|
|
|
12 |
|
|
|
|
13 |
|
t.editor
= ed;
|
|
|
14 |
|
|
|
|
15 |
|
// Regis
ter comman
ds
|
|
|
16 |
|
ed.addCo
mmand('mce
NonBreakin
g', functi
on() {
|
|
|
17 |
|
ed.e
xecCommand
('mceInser
tContent',
false, (e
d.plugins.
visualchar
s && ed.pl
ugins.visu
alchars.st
ate) ? '<s
pan class=
"mceItemHi
dden mceVi
sualNbsp">
·</
span>' : '
');
|
|
|
18 |
|
});
|
|
|
19 |
|
|
|
|
20 |
|
// Regis
ter button
s
|
|
|
21 |
|
ed.addBu
tton('nonb
reaking',
{title : '
nonbreakin
g.nonbreak
ing_desc',
cmd : 'mc
eNonBreaki
ng'});
|
|
|
22 |
|
|
|
|
23 |
|
if (ed.g
etParam('n
onbreaking
_force_tab
')) {
|
|
|
24 |
|
ed.o
nKeyDown.a
dd(functio
n(ed, e) {
|
|
|
25 |
|
if (tinymc
e.isIE &&
e.keyCode
== 9) {
|
|
|
26 |
|
ed.exe
cCommand('
mceNonBrea
king');
|
|
|
27 |
|
ed.exe
cCommand('
mceNonBrea
king');
|
|
|
28 |
|
ed.exe
cCommand('
mceNonBrea
king');
|
|
|
29 |
|
tinymc
e.dom.Even
t.cancel(e
);
|
|
|
30 |
|
}
|
|
|
31 |
|
});
|
|
|
32 |
|
}
|
|
|
33 |
|
},
|
10 |
|
|
|
34 |
|
|
11 |
|
var TinyMC
E_NonBreak
ingPlugin
= {
|
|
|
12 |
|
getInf
o : functi
on() {
|
|
35 |
|
ge
tInfo : fu
nction() {
|
13 |
|
re
turn {
|
|
36 |
|
return {
|
14 |
|
longname
: 'Nonbre
aking spac
e',
|
|
37 |
|
long
name : 'No
nbreaking
space',
|
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/nonbr
eaking',
|
|
40 |
|
info
url : 'htt
p://wiki.m
oxiecode.c
om/index.p
hp/TinyMCE
:Plugins/n
onbreaking
',
|
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 "no
nbreaking"
:
|
|
|
25 |
|
retu
rn tinyMCE
.getButton
HTML(cn, '
lang_nonbr
eaking_des
c', '{$plu
ginurl}/im
ages/nonbr
eaking.gif
', 'mceNon
Breaking',
false);
|
|
|
26 |
|
}
|
|
|
27 |
|
|
|
|
28 |
|
re
turn "";
|
|
|
29 |
|
},
|
|
|
30 |
|
|
|
|
31 |
|
|
|
|
32 |
|
execCo
mmand : fu
nction(edi
tor_id, el
ement, com
mand, user
_interface
, value) {
|
|
|
33 |
|
va
r inst = t
inyMCE.get
InstanceBy
Id(editor_
id), h;
|
|
|
34 |
|
|
|
|
35 |
|
sw
itch (comm
and) {
|
|
|
36 |
|
case "mc
eNonBreaki
ng":
|
|
|
37 |
|
h =
(inst.visu
alChars &&
inst.visu
alChars.st
ate) ? '<s
pan class=
"mceItemHi
ddenVisual
Char">&mid
dot;</span
>' : '&nbs
p;';
|
|
|
38 |
|
tiny
MCE.execIn
stanceComm
and(editor
_id, 'mceI
nsertConte
nt', false
, h);
|
|
|
39 |
|
retu
rn true;
|
|
|
40 |
|
}
|
|
|
41 |
|
|
|
|
42 |
|
re
turn false
;
|
|
|
43 |
|
},
|
|
|
44 |
|
|
|
|
45 |
|
handle
Event : fu
nction(e)
{
|
|
|
46 |
|
va
r inst, h;
|
|
|
47 |
|
|
|
|
48 |
|
if
(!tinyMCE
.isOpera &
& e.type =
= 'keydown
' && e.key
Code == 9
&& tinyMCE
.getParam(
'nonbreaki
ng_force_t
ab', false
)) {
|
|
|
49 |
|
inst = t
inyMCE.sel
ectedInsta
nce;
|
|
|
50 |
|
|
|
|
51 |
|
h = (ins
t.visualCh
ars && ins
t.visualCh
ars.state)
? '<span
class="mce
ItemHidden
VisualChar
">·
·&m
iddot;</sp
an>' : '&n
bsp;
';
|
|
|
52 |
|
tinyMCE.
execInstan
ceCommand(
inst.edito
rId, 'mceI
nsertConte
nt', false
, h);
|
|
|
53 |
|
|
|
|
54 |
|
tinyMCE.
cancelEven
t(e);
|
|
|
55 |
|
return f
alse;
|
|
|
56 |
|
}
|
|
43 |
|
}
|
57 |
|
|
|
44 |
|
|
58 |
|
re
turn true;
|
|
45 |
|
//
Private m
ethods
|
59 |
|
}
|
|
46 |
|
}
)
;
|
60 |
|
}
;
|
|
|
61 |
|
|
|
47 |
|
|
62 |
|
tiny
MCE
.
add
Plugin
(
"
nonbreakin
g
"
,
T
iny
MCE_
Non
B
reaking
Plugin
);
|
|
48 |
|
// Reg
ister plug
in
|
|
|
49 |
|
tiny
mce
.
Plugin
Manager.ad
d
(
'
nonbreakin
g
'
,
t
iny
mce.plugin
s.
Non
b
reaking
);
|
|
|
50 |
|
})();
|