PageRenderTime 45ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
JavaScript | 132 lines | 105 code | 13 blank | 14 comment | 4 complexity | b8b8236893ef2347a46cb131fc1a8c69 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0, BSD-3-Clause
  1. /**
  2. * editor_plugin_src.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() {
  11. tinymce.create('tinymce.plugins.XHTMLXtrasPlugin', {
  12. init : function(ed, url) {
  13. // Register commands
  14. ed.addCommand('mceCite', function() {
  15. ed.windowManager.open({
  16. file : url + '/cite.htm',
  17. width : 350 + parseInt(ed.getLang('xhtmlxtras.cite_delta_width', 0)),
  18. height : 250 + parseInt(ed.getLang('xhtmlxtras.cite_delta_height', 0)),
  19. inline : 1
  20. }, {
  21. plugin_url : url
  22. });
  23. });
  24. ed.addCommand('mceAcronym', function() {
  25. ed.windowManager.open({
  26. file : url + '/acronym.htm',
  27. width : 350 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_width', 0)),
  28. height : 250 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_height', 0)),
  29. inline : 1
  30. }, {
  31. plugin_url : url
  32. });
  33. });
  34. ed.addCommand('mceAbbr', function() {
  35. ed.windowManager.open({
  36. file : url + '/abbr.htm',
  37. width : 350 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_width', 0)),
  38. height : 250 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_height', 0)),
  39. inline : 1
  40. }, {
  41. plugin_url : url
  42. });
  43. });
  44. ed.addCommand('mceDel', function() {
  45. ed.windowManager.open({
  46. file : url + '/del.htm',
  47. width : 340 + parseInt(ed.getLang('xhtmlxtras.del_delta_width', 0)),
  48. height : 310 + parseInt(ed.getLang('xhtmlxtras.del_delta_height', 0)),
  49. inline : 1
  50. }, {
  51. plugin_url : url
  52. });
  53. });
  54. ed.addCommand('mceIns', function() {
  55. ed.windowManager.open({
  56. file : url + '/ins.htm',
  57. width : 340 + parseInt(ed.getLang('xhtmlxtras.ins_delta_width', 0)),
  58. height : 310 + parseInt(ed.getLang('xhtmlxtras.ins_delta_height', 0)),
  59. inline : 1
  60. }, {
  61. plugin_url : url
  62. });
  63. });
  64. ed.addCommand('mceAttributes', function() {
  65. ed.windowManager.open({
  66. file : url + '/attributes.htm',
  67. width : 380 + parseInt(ed.getLang('xhtmlxtras.attr_delta_width', 0)),
  68. height : 370 + parseInt(ed.getLang('xhtmlxtras.attr_delta_height', 0)),
  69. inline : 1
  70. }, {
  71. plugin_url : url
  72. });
  73. });
  74. // Register buttons
  75. ed.addButton('cite', {title : 'xhtmlxtras.cite_desc', cmd : 'mceCite'});
  76. ed.addButton('acronym', {title : 'xhtmlxtras.acronym_desc', cmd : 'mceAcronym'});
  77. ed.addButton('abbr', {title : 'xhtmlxtras.abbr_desc', cmd : 'mceAbbr'});
  78. ed.addButton('del', {title : 'xhtmlxtras.del_desc', cmd : 'mceDel'});
  79. ed.addButton('ins', {title : 'xhtmlxtras.ins_desc', cmd : 'mceIns'});
  80. ed.addButton('attribs', {title : 'xhtmlxtras.attribs_desc', cmd : 'mceAttributes'});
  81. ed.onNodeChange.add(function(ed, cm, n, co) {
  82. n = ed.dom.getParent(n, 'CITE,ACRONYM,ABBR,DEL,INS');
  83. cm.setDisabled('cite', co);
  84. cm.setDisabled('acronym', co);
  85. cm.setDisabled('abbr', co);
  86. cm.setDisabled('del', co);
  87. cm.setDisabled('ins', co);
  88. cm.setDisabled('attribs', n && n.nodeName == 'BODY');
  89. cm.setActive('cite', 0);
  90. cm.setActive('acronym', 0);
  91. cm.setActive('abbr', 0);
  92. cm.setActive('del', 0);
  93. cm.setActive('ins', 0);
  94. // Activate all
  95. if (n) {
  96. do {
  97. cm.setDisabled(n.nodeName.toLowerCase(), 0);
  98. cm.setActive(n.nodeName.toLowerCase(), 1);
  99. } while (n = n.parentNode);
  100. }
  101. });
  102. ed.onPreInit.add(function() {
  103. // Fixed IE issue where it can't handle these elements correctly
  104. ed.dom.create('abbr');
  105. });
  106. },
  107. getInfo : function() {
  108. return {
  109. longname : 'XHTML Xtras Plugin',
  110. author : 'Moxiecode Systems AB',
  111. authorurl : 'http://tinymce.moxiecode.com',
  112. infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras',
  113. version : tinymce.majorVersion + "." + tinymce.minorVersion
  114. };
  115. }
  116. });
  117. // Register plugin
  118. tinymce.PluginManager.add('xhtmlxtras', tinymce.plugins.XHTMLXtrasPlugin);
  119. })();