PageRenderTime 28ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
JavaScript | 61 lines | 39 code | 9 blank | 13 comment | 6 complexity | 4104cd66aea546becf5d8fca66cf7951 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.AdvancedLinkPlugin', {
  12. init : function(ed, url) {
  13. this.editor = ed;
  14. // Register commands
  15. ed.addCommand('mceAdvLink', function() {
  16. var se = ed.selection;
  17. // No selection and not in link
  18. if (se.isCollapsed() && !ed.dom.getParent(se.getNode(), 'A'))
  19. return;
  20. ed.windowManager.open({
  21. file : url + '/link.htm',
  22. width : 480 + parseInt(ed.getLang('advlink.delta_width', 0)),
  23. height : 400 + parseInt(ed.getLang('advlink.delta_height', 0)),
  24. inline : 1
  25. }, {
  26. plugin_url : url
  27. });
  28. });
  29. // Register buttons
  30. ed.addButton('link', {
  31. title : 'advlink.link_desc',
  32. cmd : 'mceAdvLink'
  33. });
  34. ed.addShortcut('ctrl+k', 'advlink.advlink_desc', 'mceAdvLink');
  35. ed.onNodeChange.add(function(ed, cm, n, co) {
  36. cm.setDisabled('link', co && n.nodeName != 'A');
  37. cm.setActive('link', n.nodeName == 'A' && !n.name);
  38. });
  39. },
  40. getInfo : function() {
  41. return {
  42. longname : 'Advanced link',
  43. author : 'Moxiecode Systems AB',
  44. authorurl : 'http://tinymce.moxiecode.com',
  45. infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink',
  46. version : tinymce.majorVersion + "." + tinymce.minorVersion
  47. };
  48. }
  49. });
  50. // Register plugin
  51. tinymce.PluginManager.add('advlink', tinymce.plugins.AdvancedLinkPlugin);
  52. })();