includes/clientside/tinymce/themes/advanced/js/anchor.js
changeset 335 67bd3121a12e
child 395 fa4c5ecb7c9a
equal deleted inserted replaced
334:c72b545f1304 335:67bd3121a12e
       
     1 tinyMCEPopup.requireLangPack();
       
     2 
       
     3 var 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,IMG');
       
     9 		v = ed.dom.getAttrib(elm, 'name');
       
    10 
       
    11 		if (v)
       
    12 			f.anchorName.value = v;
       
    13 
       
    14 		f.insert.value = ed.getLang(elm ? 'update' : 'insert');
       
    15 	},
       
    16 
       
    17 	update : function() {
       
    18 		var ed = this.editor;
       
    19 
       
    20 		// Webkit acts weird if empty inline element is inserted so we need to use a image instead
       
    21 		if (tinymce.isWebKit)
       
    22 			ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('img', {mce_name : 'a', name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}));
       
    23 		else
       
    24 			ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}, ''));
       
    25 
       
    26 		tinyMCEPopup.close();
       
    27 	}
       
    28 };
       
    29 
       
    30 tinyMCEPopup.onInit.add(AnchorDialog.init, AnchorDialog);