source: trunk/library/tiny_mce/themes/advanced/js/anchor.js @ 4829

Revision 4829, 1023 bytes checked in by airton, 13 years ago (diff)

Ticket #2146 - Implementacao da funcionalidade de multiplas assinaturas - Adicao da biblioteca TinyMCE

  • Property svn:executable set to *
Line 
1tinyMCEPopup.requireLangPack();
2
3var AnchorDialog = {
4        init : function(ed) {
5                var action, elm, f = document.forms[0];
6
7                this.editor = ed;
8                elm = ed.dom.getParent(ed.selection.getNode(), 'A');
9                v = ed.dom.getAttrib(elm, 'name');
10
11                if (v) {
12                        this.action = 'update';
13                        f.anchorName.value = v;
14                }
15
16                f.insert.value = ed.getLang(elm ? 'update' : 'insert');
17        },
18
19        update : function() {
20                var ed = this.editor, elm, name = document.forms[0].anchorName.value;
21
22                if (!name || !/^[a-z][a-z0-9\-\_:\.]*$/i.test(name)) {
23                        tinyMCEPopup.alert('advanced_dlg.anchor_invalid');
24                        return;
25                }
26
27                tinyMCEPopup.restoreSelection();
28
29                if (this.action != 'update')
30                        ed.selection.collapse(1);
31
32                elm = ed.dom.getParent(ed.selection.getNode(), 'A');
33                if (elm)
34                        elm.name = name;
35                else
36                        ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : name, 'class' : 'mceItemAnchor'}, ''));
37
38                tinyMCEPopup.close();
39        }
40};
41
42tinyMCEPopup.onInit.add(AnchorDialog.init, AnchorDialog);
Note: See TracBrowser for help on using the repository browser.