No regular expressions were active.
1 |
|
var action
, element;
|
|
|
2 |
|
|
|
|
3 |
|
function i
nit() {
|
|
|
4 |
|
tinyMC
EPopup.res
izeToInner
Size();
|
|
|
5 |
|
|
|
|
6 |
|
var in
st = tinyM
CE.getInst
anceById(t
inyMCE.get
WindowArg(
'editor_id
'));
|
|
|
7 |
|
var an
chor = tin
yMCE.getPa
rentElemen
t(inst.get
FocusEleme
nt(), "a",
"name");
|
|
|
8 |
|
var im
g = inst.g
etFocusEle
ment();
|
|
|
9 |
|
action
= 'insert
';
|
|
|
10 |
|
|
|
|
11 |
|
if (an
chor != nu
ll) {
|
|
|
12 |
|
el
ement = an
chor;
|
|
|
13 |
|
ac
tion = "up
date";
|
|
|
14 |
|
}
|
|
|
15 |
|
|
|
|
16 |
|
if (ti
nyMCE.getA
ttrib(img,
"class")
== "mceIte
mAnchor")
{
|
|
|
17 |
|
el
ement = im
g;
|
|
|
18 |
|
ac
tion = "up
date";
|
|
|
19 |
|
}
|
|
|
20 |
|
|
|
|
21 |
|
if (ac
tion == "u
pdate")
|
|
|
22 |
|
do
cument.for
ms[0].anch
orName.val
ue = eleme
nt.nodeNam
e == "IMG"
? element
.getAttrib
ute("title
") : eleme
nt.getAttr
ibute("nam
e");
|
|
|
23 |
|
|
|
|
24 |
|
docume
nt.forms[0
].insert.v
alue = tin
yMCE.getLa
ng('lang_'
+ action,
'Insert',
true);
|
|
|
25 |
|
}
|
|
|
26 |
|
|
|
|
27 |
|
function i
nsertAncho
r() {
|
|
|
28 |
|
var in
st = tinyM
CE.getInst
anceById(t
inyMCE.get
WindowArg(
'editor_id
'));
|
|
|
29 |
|
var na
me = docum
ent.forms[
0].anchorN
ame.value,
e;
|
|
|
30 |
|
|
|
|
31 |
|
tinyMC
EPopup.exe
cCommand("
mceBeginUn
doLevel");
|
|
|
32 |
|
|
|
|
33 |
|
if (ac
tion == "u
pdate") {
|
|
|
34 |
|
if
(element.
nodeName =
= "IMG")
|
|
|
35 |
|
element.
setAttribu
te("title"
, name);
|
|
|
36 |
|
el
se
|
|
|
37 |
|
element.
setAttribu
te("name",
name);
|
|
|
38 |
|
} else
{
|
|
|
39 |
|
va
r rng = in
st.getRng(
);
|
|
|
40 |
|
|
|
|
41 |
|
if
(rng.coll
apse)
|
|
|
42 |
|
rng.coll
apse(false
);
|
|
|
43 |
|
|
|
|
44 |
|
na
me = name.
replace(/&
/g, '&
');
|
|
|
45 |
|
na
me = name.
replace(/\
"/g, '&quo
t;');
|
|
|
46 |
|
na
me = name.
replace(/<
/g, '<'
);
|
|
|
47 |
|
na
me = name.
replace(/>
/g, '>'
);
|
|
|
48 |
|
|
|
|
49 |
|
//
Fix for b
ug #144733
5
|
|
|
50 |
|
if
(tinyMCE.
isGecko)
|
|
|
51 |
|
html = '
<a id="mce
NewAnchor"
name="' +
name + '"
></a>';
|
|
|
52 |
|
el
se
|
|
|
53 |
|
html = '
<a name="'
+ name +
'"></a>';
|
|
|
54 |
|
|
|
|
55 |
|
ti
nyMCEPopup
.execComma
nd("mceIns
ertContent
", false,
html);
|
|
|
56 |
|
|
|
|
57 |
|
//
Fix for b
ug #144733
5 force cu
rsor after
the ancho
r element
|
|
|
58 |
|
if
(tinyMCE.
isGecko) {
|
|
|
59 |
|
e = inst
.getDoc().
getElement
ById('mceN
ewAnchor')
;
|
|
|
60 |
|
|
|
|
61 |
|
if (e) {
|
|
|
62 |
|
inst
.selection
.selectNod
e(e, true,
false, fa
lse);
|
|
|
63 |
|
e.re
moveAttrib
ute('id');
|
|
|
64 |
|
}
|
|
|
65 |
|
}
|
|
|
66 |
|
|
|
|
67 |
|
ti
nyMCE.hand
leVisualAi
d(inst.get
Body(), tr
ue, inst.v
isualAid,
inst);
|
|
|
68 |
|
}
|
|
|
69 |
|
|
|
|
70 |
|
tinyMC
EPopup.exe
cCommand("
mceEndUndo
Level");
|
|
|
71 |
|
|
|
|
72 |
|
tinyMC
E.triggerN
odeChange(
);
|
|
|
73 |
|
tinyMC
EPopup.clo
se();
|
|
|
74 |
|
}
|
|
|