includes/clientside/tinymce/themes/advanced/js/anchor.js
changeset 543 dffcbfbc4e59
parent 395 fa4c5ecb7c9a
equal deleted inserted replaced
542:5841df0ab575 543:dffcbfbc4e59
     6 
     6 
     7 		this.editor = ed;
     7 		this.editor = ed;
     8 		elm = ed.dom.getParent(ed.selection.getNode(), 'A,IMG');
     8 		elm = ed.dom.getParent(ed.selection.getNode(), 'A,IMG');
     9 		v = ed.dom.getAttrib(elm, 'name');
     9 		v = ed.dom.getAttrib(elm, 'name');
    10 
    10 
    11 		if (v)
    11 		if (v) {
       
    12 			this.action = 'update';
    12 			f.anchorName.value = v;
    13 			f.anchorName.value = v;
       
    14 		}
    13 
    15 
    14 		f.insert.value = ed.getLang(elm ? 'update' : 'insert');
    16 		f.insert.value = ed.getLang(elm ? 'update' : 'insert');
    15 	},
    17 	},
    16 
    18 
    17 	update : function() {
    19 	update : function() {
    18 		var ed = this.editor;
    20 		var ed = this.editor;
    19 		
    21 		
    20 		tinyMCEPopup.restoreSelection();
    22 		tinyMCEPopup.restoreSelection();
    21 		ed.selection.collapse(1);
    23 
       
    24 		if (this.action != 'update')
       
    25 			ed.selection.collapse(1);
    22 
    26 
    23 		// Webkit acts weird if empty inline element is inserted so we need to use a image instead
    27 		// Webkit acts weird if empty inline element is inserted so we need to use a image instead
    24 		if (tinymce.isWebKit)
    28 		if (tinymce.isWebKit)
    25 			ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('img', {mce_name : 'a', name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}));
    29 			ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('img', {mce_name : 'a', name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}));
    26 		else
    30 		else