home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Plugins / tinymce-advanced / mce / xhtmlxtras / jscripts / ins.js < prev   
Encoding:
JavaScript  |  2008-02-20  |  1.5 KB  |  53 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('ins');
  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 insertIns() {
  30.     var elm = tinyMCE.getParentElement(SXE.focusElement, 'ins');
  31.     tinyMCEPopup.execCommand('mceBeginUndoLevel');
  32.     if (elm == null) {
  33.         var s = SXE.inst.selection.getSelectedHTML();
  34.         if(s.length > 0) {
  35.             tinyMCEPopup.execCommand('mceInsertContent', false, '<ins id="#sxe_temp_ins#">' + s + '</ins>');
  36.             var elementArray = tinyMCE.getElementsByAttributeValue(SXE.inst.getBody(), 'ins', 'id', '#sxe_temp_ins#');
  37.             for (var i=0; i<elementArray.length; i++) {
  38.                 var elm = elementArray[i];
  39.                 setElementAttribs(elm);
  40.             }
  41.         }
  42.     } else {
  43.         setElementAttribs(elm);
  44.     }
  45.     tinyMCE.triggerNodeChange();
  46.     tinyMCEPopup.execCommand('mceEndUndoLevel');
  47.     tinyMCEPopup.close();
  48. }
  49.  
  50. function removeIns() {
  51.     SXE.removeElement('ins');
  52.     tinyMCEPopup.close();
  53. }