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