includes/clientside/tinymce/plugins/xhtmlxtras/js/del.js
changeset 335 67bd3121a12e
child 395 fa4c5ecb7c9a
equal deleted inserted replaced
334:c72b545f1304 335:67bd3121a12e
       
     1  /**
       
     2  * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $
       
     3  *
       
     4  * @author Moxiecode - based on work by Andrew Tetlaw
       
     5  * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
       
     6  */
       
     7 
       
     8 function init() {
       
     9 	SXE.initElementDialog('del');
       
    10 	if (SXE.currentAction == "update") {
       
    11 		setFormValue('datetime', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'datetime'));
       
    12 		setFormValue('cite', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'cite'));
       
    13 		SXE.showRemoveButton();
       
    14 	}
       
    15 }
       
    16 
       
    17 function setElementAttribs(elm) {
       
    18 	setAllCommonAttribs(elm);
       
    19 	setAttrib(elm, 'datetime');
       
    20 	setAttrib(elm, 'cite');
       
    21 }
       
    22 
       
    23 function insertDel() {
       
    24 	var elm = tinyMCEPopup.editor.dom.getParent(SXE.focusElement, 'DEL');
       
    25 
       
    26 	tinyMCEPopup.execCommand('mceBeginUndoLevel');
       
    27 	if (elm == null) {
       
    28 		var s = SXE.inst.selection.getContent();
       
    29 		if(s.length > 0) {
       
    30 			tinyMCEPopup.execCommand('mceInsertContent', false, '<del id="#sxe_temp_del#">' + s + '</del>');
       
    31 			var elementArray = tinymce.grep(SXE.inst.dom.select('del'), function(n) {return n.id == '#sxe_temp_del#';});
       
    32 			for (var i=0; i<elementArray.length; i++) {
       
    33 				var elm = elementArray[i];
       
    34 				setElementAttribs(elm);
       
    35 			}
       
    36 		}
       
    37 	} else {
       
    38 		setElementAttribs(elm);
       
    39 	}
       
    40 	tinyMCEPopup.editor.nodeChanged();
       
    41 	tinyMCEPopup.execCommand('mceEndUndoLevel');
       
    42 	tinyMCEPopup.close();
       
    43 }
       
    44 
       
    45 function removeDel() {
       
    46 	SXE.removeElement('del');
       
    47 	tinyMCEPopup.close();
       
    48 }
       
    49 
       
    50 tinyMCEPopup.onInit.add(init);