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

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

#
JavaScript | 51 lines | 39 code | 8 blank | 4 comment | 1 complexity | 6b758cd879b654657e565f21bf79933a MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0, BSD-3-Clause
  1. (function() {
  2. // Load plugin specific language pack
  3. tinymce.PluginManager.requireLangPack('insertcode');
  4. tinymce.create('tinymce.plugins.InsertCode', {
  5. init : function(ed, url) {
  6. ed.addCommand('mceInsertCode', function() {
  7. ed.windowManager.open({
  8. file : url + '/dialog.htm?v=2',
  9. width : 480 + parseInt(ed.getLang('insertcode.delta_width', 0)),
  10. height : 320 + parseInt(ed.getLang('insertcode.delta_height', 0)),
  11. inline : 1
  12. }, {
  13. plugin_url : url, // Plugin absolute URL
  14. some_custom_arg : 'custom arg' // Custom argument
  15. });
  16. });
  17. // Register example button
  18. ed.addButton('insertcode', {
  19. title: 'Insert Code',
  20. cmd : 'mceInsertCode',
  21. image : url + '/img/code2.gif'
  22. });
  23. // Add a node change handler, selects the button in the UI when a image is selected
  24. ed.onNodeChange.add(function(ed, cm, n) {
  25. cm.setActive('insertcode', n.nodeName == 'IMG');
  26. });
  27. },
  28. createControl : function(n, cm) {
  29. return null;
  30. },
  31. getInfo : function() {
  32. return {
  33. longname : 'Insert Code plugin',
  34. author : 'Rtur.net',
  35. authorurl : 'http://rtur.net',
  36. infourl: 'http://rtur.net/blog/post/2009/11/26/Building-custom-plugin-for-TinyMCE.aspx',
  37. version : "1.0"
  38. };
  39. }
  40. });
  41. // Register plugin
  42. tinymce.PluginManager.add('insertcode', tinymce.plugins.InsertCode);
  43. })();