A tumblelog CMS built on AJAX, PHP and MySQL.

del.js 1.5KB

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