/static/scripts/tiny_mce/plugins/xhtmlxtras/js/del.js

http://n23.googlecode.com/ · JavaScript · 50 lines · 38 code · 6 blank · 6 comment · 8 complexity · 25044b3ff5373f8859d8dcd8c4fc0245 MD5 · raw file

  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-2008, Moxiecode Systems AB, All rights reserved.
  6. */
  7. function init() {
  8. SXE.initElementDialog('del');
  9. if (SXE.currentAction == "update") {
  10. setFormValue('datetime', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'datetime'));
  11. setFormValue('cite', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'cite'));
  12. SXE.showRemoveButton();
  13. }
  14. }
  15. function setElementAttribs(elm) {
  16. setAllCommonAttribs(elm);
  17. setAttrib(elm, 'datetime');
  18. setAttrib(elm, 'cite');
  19. }
  20. function insertDel() {
  21. var elm = tinyMCEPopup.editor.dom.getParent(SXE.focusElement, 'DEL');
  22. tinyMCEPopup.execCommand('mceBeginUndoLevel');
  23. if (elm == null) {
  24. var s = SXE.inst.selection.getContent();
  25. if(s.length > 0) {
  26. tinyMCEPopup.execCommand('mceInsertContent', false, '<del id="#sxe_temp_del#">' + s + '</del>');
  27. var elementArray = tinymce.grep(SXE.inst.dom.select('del'), function(n) {return n.id == '#sxe_temp_del#';});
  28. for (var i=0; i<elementArray.length; i++) {
  29. var elm = elementArray[i];
  30. setElementAttribs(elm);
  31. }
  32. }
  33. } else {
  34. setElementAttribs(elm);
  35. }
  36. tinyMCEPopup.editor.nodeChanged();
  37. tinyMCEPopup.execCommand('mceEndUndoLevel');
  38. tinyMCEPopup.close();
  39. }
  40. function removeDel() {
  41. SXE.removeElement('del');
  42. tinyMCEPopup.close();
  43. }
  44. tinyMCEPopup.onInit.add(init);