1 tinyMCEPopup
.requireLangPack();
5 var action
, elm
, f
= document
.forms
[0];
8 elm
= ed
.dom
.getParent(ed
.selection
.getNode(), 'A');
9 v
= ed
.dom
.getAttrib(elm
, 'name');
12 this.action
= 'update';
13 f
.anchorName
.value
= v
;
16 f
.insert
.value
= ed
.getLang(elm
? 'update' : 'insert');
20 var ed
= this.editor
, elm
, name
= document
.forms
[0].anchorName
.value
;
22 if (!name
|| !/^[a-z][a-z0-9\-\_:\.]*$/i.test(name
)) {
23 tinyMCEPopup
.alert('advanced_dlg.anchor_invalid');
27 tinyMCEPopup
.restoreSelection();
29 if (this.action
!= 'update')
30 ed
.selection
.collapse(1);
32 elm
= ed
.dom
.getParent(ed
.selection
.getNode(), 'A');
34 elm
.setAttribute('name', name
);
37 // create with zero-sized nbsp so that in Webkit where anchor is on last line by itself caret cannot be placed after it
38 ed
.execCommand('mceInsertContent', 0, ed
.dom
.createHTML('a', {name
: name
, 'class' : 'mceItemAnchor'}, '\uFEFF'));
44 tinyMCEPopup
.onInit
.add(AnchorDialog
.init
, AnchorDialog
);