PageRenderTime 41ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/static/scripts/tiny_mce/plugins/style/editor_plugin_src.js

http://n23.googlecode.com/
JavaScript | 52 lines | 37 code | 6 blank | 9 comment | 1 complexity | d95bd8888758328f31a8670186e65aa1 MD5 | raw file
Possible License(s): Apache-2.0, LGPL-2.1
  1. /**
  2. * $Id: editor_plugin_src.js 787 2008-04-10 11:40:57Z spocke $
  3. *
  4. * @author Moxiecode
  5. * @copyright Copyright Š 2004-2008, Moxiecode Systems AB, All rights reserved.
  6. */
  7. (function() {
  8. tinymce.create('tinymce.plugins.StylePlugin', {
  9. init : function(ed, url) {
  10. // Register commands
  11. ed.addCommand('mceStyleProps', function() {
  12. ed.windowManager.open({
  13. file : url + '/props.htm',
  14. width : 480 + parseInt(ed.getLang('style.delta_width', 0)),
  15. height : 320 + parseInt(ed.getLang('style.delta_height', 0)),
  16. inline : 1
  17. }, {
  18. plugin_url : url,
  19. style_text : ed.selection.getNode().style.cssText
  20. });
  21. });
  22. ed.addCommand('mceSetElementStyle', function(ui, v) {
  23. if (e = ed.selection.getNode()) {
  24. ed.dom.setAttrib(e, 'style', v);
  25. ed.execCommand('mceRepaint');
  26. }
  27. });
  28. ed.onNodeChange.add(function(ed, cm, n) {
  29. cm.setDisabled('styleprops', n.nodeName === 'BODY');
  30. });
  31. // Register buttons
  32. ed.addButton('styleprops', {title : 'style.desc', cmd : 'mceStyleProps'});
  33. },
  34. getInfo : function() {
  35. return {
  36. longname : 'Style',
  37. author : 'Moxiecode Systems AB',
  38. authorurl : 'http://tinymce.moxiecode.com',
  39. infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style',
  40. version : tinymce.majorVersion + "." + tinymce.minorVersion
  41. };
  42. }
  43. });
  44. // Register plugin
  45. tinymce.PluginManager.add('style', tinymce.plugins.StylePlugin);
  46. })();