4
* Copyright 2009, Moxiecode Systems AB
5
* Released under LGPL License.
7
* License: http://tinymce.moxiecode.com/license
8
* Contributing: http://tinymce.moxiecode.com/contributing
12
tinymce.create('tinymce.plugins.StylePlugin', {
13
init : function(ed, url) {
15
ed.addCommand('mceStyleProps', function() {
17
var applyStyleToBlocks = false;
18
var blocks = ed.selection.getSelectedBlocks();
21
if (blocks.length === 1) {
22
styles.push(ed.selection.getNode().style.cssText);
25
tinymce.each(blocks, function(block) {
26
styles.push(ed.dom.getAttrib(block, 'style'));
28
applyStyleToBlocks = true;
31
ed.windowManager.open({
32
file : url + '/props.htm',
33
width : 480 + parseInt(ed.getLang('style.delta_width', 0)),
34
height : 340 + parseInt(ed.getLang('style.delta_height', 0)),
37
applyStyleToBlocks : applyStyleToBlocks,
43
ed.addCommand('mceSetElementStyle', function(ui, v) {
44
if (e = ed.selection.getNode()) {
45
ed.dom.setAttrib(e, 'style', v);
46
ed.execCommand('mceRepaint');
50
ed.onNodeChange.add(function(ed, cm, n) {
51
cm.setDisabled('styleprops', n.nodeName === 'BODY');
55
ed.addButton('styleprops', {title : 'style.desc', cmd : 'mceStyleProps'});
58
getInfo : function() {
61
author : 'Moxiecode Systems AB',
62
authorurl : 'http://tinymce.moxiecode.com',
63
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style',
64
version : tinymce.majorVersion + "." + tinymce.minorVersion
70
tinymce.PluginManager.add('style', tinymce.plugins.StylePlugin);