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