home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Plugins / tinymce-advanced / mce / xhtmlxtras / jscripts / del.js < prev    next >
Encoding:
JavaScript  |  2008-02-20  |  1.5 KB  |  54 lines

  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. }