/pigeoncms/Plugins/tiny_mce/plugins/style/editor_plugin_src.js

http://pigeoncms.googlecode.com/ · JavaScript · 55 lines · 37 code · 6 blank · 12 comment · 1 complexity · f3fe95aa447b856e589a48b78c0556f8 MD5 · raw file

  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.StylePlugin', {
  12. init : function(ed, url) {
  13. // Register commands
  14. ed.addCommand('mceStyleProps', function() {
  15. ed.windowManager.open({
  16. file : url + '/props.htm',
  17. width : 480 + parseInt(ed.getLang('style.delta_width', 0)),
  18. height : 320 + parseInt(ed.getLang('style.delta_height', 0)),
  19. inline : 1
  20. }, {
  21. plugin_url : url,
  22. style_text : ed.selection.getNode().style.cssText
  23. });
  24. });
  25. ed.addCommand('mceSetElementStyle', function(ui, v) {
  26. if (e = ed.selection.getNode()) {
  27. ed.dom.setAttrib(e, 'style', v);
  28. ed.execCommand('mceRepaint');
  29. }
  30. });
  31. ed.onNodeChange.add(function(ed, cm, n) {
  32. cm.setDisabled('styleprops', n.nodeName === 'BODY');
  33. });
  34. // Register buttons
  35. ed.addButton('styleprops', {title : 'style.desc', cmd : 'mceStyleProps'});
  36. },
  37. getInfo : function() {
  38. return {
  39. longname : 'Style',
  40. author : 'Moxiecode Systems AB',
  41. authorurl : 'http://tinymce.moxiecode.com',
  42. infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style',
  43. version : tinymce.majorVersion + "." + tinymce.minorVersion
  44. };
  45. }
  46. });
  47. // Register plugin
  48. tinymce.PluginManager.add('style', tinymce.plugins.StylePlugin);
  49. })();