includes/clientside/tinymce/plugins/xhtmlxtras/jscripts/del.js
changeset 335 67bd3121a12e
parent 334 c72b545f1304
child 336 bfa2e9c23f03
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 preinit() {
       
     9 	// Initialize
       
    10 	tinyMCE.setWindowArg('mce_windowresize', false);
       
    11 }
       
    12 
       
    13 function init() {
       
    14 	tinyMCEPopup.resizeToInnerSize();
       
    15 	SXE.initElementDialog('del');
       
    16 	if (SXE.currentAction == "update") {
       
    17 		setFormValue('datetime', tinyMCE.getAttrib(SXE.updateElement, 'datetime'));
       
    18 		setFormValue('cite', tinyMCE.getAttrib(SXE.updateElement, 'cite'));
       
    19 		SXE.showRemoveButton();
       
    20 	}
       
    21 }
       
    22 
       
    23 function setElementAttribs(elm) {
       
    24 	setAllCommonAttribs(elm);
       
    25 	setAttrib(elm, 'datetime');
       
    26 	setAttrib(elm, 'cite');
       
    27 }
       
    28 
       
    29 function insertDel() {
       
    30 	var elm = tinyMCE.getParentElement(SXE.focusElement, 'del');
       
    31 
       
    32 	tinyMCEPopup.execCommand('mceBeginUndoLevel');
       
    33 	if (elm == null) {
       
    34 		var s = SXE.inst.selection.getSelectedHTML();
       
    35 		if(s.length > 0) {
       
    36 			tinyMCEPopup.execCommand('mceInsertContent', false, '<del id="#sxe_temp_del#">' + s + '</del>');
       
    37 			var elementArray = tinyMCE.getElementsByAttributeValue(SXE.inst.getBody(), 'del', 'id', '#sxe_temp_del#');
       
    38 			for (var i=0; i<elementArray.length; i++) {
       
    39 				var elm = elementArray[i];
       
    40 				setElementAttribs(elm);
       
    41 			}
       
    42 		}
       
    43 	} else {
       
    44 		setElementAttribs(elm);
       
    45 	}
       
    46 	tinyMCE.triggerNodeChange();
       
    47 	tinyMCEPopup.execCommand('mceEndUndoLevel');
       
    48 	tinyMCEPopup.close();
       
    49 }
       
    50 
       
    51 function removeDel() {
       
    52 	SXE.removeElement('del');
       
    53 	tinyMCEPopup.close();
       
    54 }