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 |
|
tinymc
e.create('
tinymce.pl
ugins.Page
BreakPlugi
n', {
|
|
|
10 |
|
in
it : funct
ion(ed, ur
l) {
|
|
|
11 |
|
var pb =
'<img src
="' + url
+ '/img/tr
ans.gif" c
lass="mceP
ageBreak m
ceItemNoRe
size" />',
cls = 'mc
ePageBreak
', sep = e
d.getParam
('pagebrea
k_separato
r', '<!--
pagebreak
-->'), pbR
E;
|
|
|
12 |
|
|
|
|
13 |
|
pbRE = n
ew RegExp(
sep.replac
e(/[\?\.\*
\[\]\(\)\{
\}\+\^\$\:
]/g, funct
ion(a) {re
turn '\\'
+ a;}), 'g
');
|
|
|
14 |
|
|
|
|
15 |
|
// Regis
ter comman
ds
|
|
|
16 |
|
ed.addCo
mmand('mce
PageBreak'
, function
() {
|
|
|
17 |
|
ed.e
xecCommand
('mceInser
tContent',
0, pb);
|
|
|
18 |
|
});
|
|
|
19 |
|
|
|
|
20 |
|
// Regis
ter button
s
|
|
|
21 |
|
ed.addBu
tton('page
break', {t
itle : 'pa
gebreak.de
sc', cmd :
cls});
|
|
|
22 |
|
|
|
|
23 |
|
ed.onIni
t.add(func
tion() {
|
|
|
24 |
|
ed.d
om.loadCSS
(url + "/c
ss/content
.css");
|
|
|
25 |
|
|
|
|
26 |
|
if (
ed.theme.o
nResolveNa
me) {
|
|
|
27 |
|
ed.theme.o
nResolveNa
me.add(fun
ction(th,
o) {
|
|
|
28 |
|
if (o.
node.nodeN
ame == 'IM
G' && ed.d
om.hasClas
s(o.node,
cls))
|
|
|
29 |
|
o.
name = 'pa
gebreak';
|
|
|
30 |
|
});
|
|
|
31 |
|
}
|
|
|
32 |
|
});
|
|
|
33 |
|
|
|
|
34 |
|
ed.onCli
ck.add(fun
ction(ed,
e) {
|
|
|
35 |
|
e =
e.target;
|
|
|
36 |
|
|
|
|
37 |
|
if (
e.nodeName
=== 'IMG'
&& ed.dom
.hasClass(
e, cls))
|
|
|
38 |
|
ed.selecti
on.select(
e);
|
|
|
39 |
|
});
|
|
|
40 |
|
|
|
|
41 |
|
ed.onNod
eChange.ad
d(function
(ed, cm, n
) {
|
|
|
42 |
|
cm.s
etActive('
pagebreak'
, n.nodeNa
me === 'IM
G' && ed.d
om.hasClas
s(n, cls))
;
|
|
|
43 |
|
});
|
|
|
44 |
|
|
|
|
45 |
|
ed.onBef
oreSetCont
ent.add(fu
nction(ed,
o) {
|
|
|
46 |
|
o.co
ntent = o.
content.re
place(pbRE
, pb);
|
|
|
47 |
|
});
|
|
|
48 |
|
|
|
|
49 |
|
ed.onPos
tProcess.a
dd(functio
n(ed, o) {
|
|
|
50 |
|
if (
o.get)
|
|
|
51 |
|
o.content
= o.conten
t.replace(
/<img[^>]+
>/g, funct
ion(im) {
|
|
|
52 |
|
if (im
.indexOf('
class="mce
PageBreak'
) !== -1)
|
|
|
53 |
|
im
= sep;
|
|
|
54 |
|
|
|
|
55 |
|
return
im;
|
|
|
56 |
|
});
|
|
|
57 |
|
});
|
|
|
58 |
|
},
|
|
|
59 |
|
|
|
|
60 |
|
ge
tInfo : fu
nction() {
|
|
|
61 |
|
return {
|
|
|
62 |
|
long
name : 'Pa
geBreak',
|
|
|
63 |
|
auth
or : 'Moxi
ecode Syst
ems AB',
|
|
|
64 |
|
auth
orurl : 'h
ttp://tiny
mce.moxiec
ode.com',
|
|
|
65 |
|
info
url : 'htt
p://wiki.m
oxiecode.c
om/index.p
hp/TinyMCE
:Plugins/p
agebreak',
|
|
|
66 |
|
vers
ion : tiny
mce.majorV
ersion + "
." + tinym
ce.minorVe
rsion
|
|
|
67 |
|
};
|
|
|
68 |
|
}
|
|
|
69 |
|
});
|
|
|
70 |
|
|
|
|
71 |
|
// Reg
ister plug
in
|
|
|
72 |
|
tinymc
e.PluginMa
nager.add(
'pagebreak
', tinymce
.plugins.P
ageBreakPl
ugin);
|
|
|
73 |
|
})();
|