/BlogEngine/BlogEngine.NET/editors/tiny_mce_3_4_3_1/plugins/xhtmlxtras/js/ins.js

# · JavaScript · 53 lines · 38 code · 6 blank · 9 comment · 7 complexity · 6148dd4151e58dcda9112933908b97b1 MD5 · raw file

  1. /**
  2. * ins.js
  3. *
  4. * Copyright 2009, Moxiecode Systems AB
  5. * Released under LGPL License.
  6. *
  7. * License: http://tinymce.moxiecode.com/license
  8. * Contributing: http://tinymce.moxiecode.com/contributing
  9. */
  10. function init() {
  11. SXE.initElementDialog('ins');
  12. if (SXE.currentAction == "update") {
  13. setFormValue('datetime', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'datetime'));
  14. setFormValue('cite', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'cite'));
  15. SXE.showRemoveButton();
  16. }
  17. }
  18. function setElementAttribs(elm) {
  19. setAllCommonAttribs(elm);
  20. setAttrib(elm, 'datetime');
  21. setAttrib(elm, 'cite');
  22. elm.removeAttribute('data-mce-new');
  23. }
  24. function insertIns() {
  25. var elm = tinyMCEPopup.editor.dom.getParent(SXE.focusElement, 'INS');
  26. if (elm == null) {
  27. var s = SXE.inst.selection.getContent();
  28. if(s.length > 0) {
  29. insertInlineElement('ins');
  30. var elementArray = SXE.inst.dom.select('ins[data-mce-new]');
  31. for (var i=0; i<elementArray.length; i++) {
  32. var elm = elementArray[i];
  33. setElementAttribs(elm);
  34. }
  35. }
  36. } else {
  37. setElementAttribs(elm);
  38. }
  39. tinyMCEPopup.editor.nodeChanged();
  40. tinyMCEPopup.execCommand('mceEndUndoLevel');
  41. tinyMCEPopup.close();
  42. }
  43. function removeIns() {
  44. SXE.removeElement('ins');
  45. tinyMCEPopup.close();
  46. }
  47. tinyMCEPopup.onInit.add(init);