includes/clientside/tinymce/themes/advanced/js/image.js
changeset 459 31c23016ab62
parent 395 fa4c5ecb7c9a
child 543 dffcbfbc4e59
--- a/includes/clientside/tinymce/themes/advanced/js/image.js	Fri Feb 22 12:51:53 2008 -0500
+++ b/includes/clientside/tinymce/themes/advanced/js/image.js	Sun Feb 24 12:50:52 2008 -0500
@@ -55,8 +55,11 @@
 		var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, args = {}, el;
 
 		if (f.src.value === '') {
-			ed.dom.remove(ed.selection.getNode());
-			ed.execCommand('mceRepaint');
+			if (ed.selection.getNode().nodeName == 'IMG') {
+				ed.dom.remove(ed.selection.getNode());
+				ed.execCommand('mceRepaint');
+			}
+
 			tinyMCEPopup.close();
 			return;
 		}
@@ -83,9 +86,10 @@
 		if (el && el.nodeName == 'IMG') {
 			ed.dom.setAttribs(el, args);
 		} else {
-			ed.execCommand('mceInsertContent', false, '<img id="__mce_tmp" src="javascript:;" />');
+			ed.execCommand('mceInsertContent', false, '<img id="__mce_tmp" src="javascript:;" />', {skip_undo : 1});
 			ed.dom.setAttribs('__mce_tmp', args);
 			ed.dom.setAttrib('__mce_tmp', 'id', '');
+			ed.undoManager.add();
 		}
 
 		tinyMCEPopup.close();