annotate WebContent/jscripts/tiny_mce/plugins/layer/editor_plugin_src.js @ 5:0be9d53a6967

editor for annotations
author dwinter
date Tue, 13 Dec 2011 17:43:46 +0100
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1 /**
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
2 * editor_plugin_src.js
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
3 *
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
4 * Copyright 2009, Moxiecode Systems AB
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
5 * Released under LGPL License.
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
6 *
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
7 * License: http://tinymce.moxiecode.com/license
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
8 * Contributing: http://tinymce.moxiecode.com/contributing
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
9 */
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
10
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
11 (function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
12 function findParentLayer(node) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
13 do {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
14 if (node.className && node.className.indexOf('mceItemLayer') != -1) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
15 return node;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
16 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
17 } while (node = node.parentNode);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
18 };
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
19
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
20 tinymce.create('tinymce.plugins.Layer', {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
21 init : function(ed, url) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
22 var t = this;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
23
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
24 t.editor = ed;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
25
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
26 // Register commands
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
27 ed.addCommand('mceInsertLayer', t._insertLayer, t);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
28
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
29 ed.addCommand('mceMoveForward', function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
30 t._move(1);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
31 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
32
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
33 ed.addCommand('mceMoveBackward', function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
34 t._move(-1);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
35 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
36
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
37 ed.addCommand('mceMakeAbsolute', function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
38 t._toggleAbsolute();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
39 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
40
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
41 // Register buttons
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
42 ed.addButton('moveforward', {title : 'layer.forward_desc', cmd : 'mceMoveForward'});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
43 ed.addButton('movebackward', {title : 'layer.backward_desc', cmd : 'mceMoveBackward'});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
44 ed.addButton('absolute', {title : 'layer.absolute_desc', cmd : 'mceMakeAbsolute'});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
45 ed.addButton('insertlayer', {title : 'layer.insertlayer_desc', cmd : 'mceInsertLayer'});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
46
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
47 ed.onInit.add(function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
48 var dom = ed.dom;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
49
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
50 if (tinymce.isIE)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
51 ed.getDoc().execCommand('2D-Position', false, true);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
52 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
53
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
54 // Remove serialized styles when selecting a layer since it might be changed by a drag operation
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
55 ed.onMouseUp.add(function(ed, e) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
56 var layer = findParentLayer(e.target);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
57
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
58 if (layer) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
59 ed.dom.setAttrib(layer, 'data-mce-style', '');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
60 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
61 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
62
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
63 // Fixes edit focus issues with layers on Gecko
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
64 // This will enable designMode while inside a layer and disable it when outside
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
65 ed.onMouseDown.add(function(ed, e) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
66 var node = e.target, doc = ed.getDoc(), parent;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
67
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
68 if (tinymce.isGecko) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
69 if (findParentLayer(node)) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
70 if (doc.designMode !== 'on') {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
71 doc.designMode = 'on';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
72
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
73 // Repaint caret
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
74 node = doc.body;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
75 parent = node.parentNode;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
76 parent.removeChild(node);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
77 parent.appendChild(node);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
78 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
79 } else if (doc.designMode == 'on') {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
80 doc.designMode = 'off';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
81 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
82 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
83 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
84
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
85 ed.onNodeChange.add(t._nodeChange, t);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
86 ed.onVisualAid.add(t._visualAid, t);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
87 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
88
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
89 getInfo : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
90 return {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
91 longname : 'Layer',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
92 author : 'Moxiecode Systems AB',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
93 authorurl : 'http://tinymce.moxiecode.com',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
94 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/layer',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
95 version : tinymce.majorVersion + "." + tinymce.minorVersion
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
96 };
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
97 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
98
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
99 // Private methods
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
100
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
101 _nodeChange : function(ed, cm, n) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
102 var le, p;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
103
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
104 le = this._getParentLayer(n);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
105 p = ed.dom.getParent(n, 'DIV,P,IMG');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
106
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
107 if (!p) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
108 cm.setDisabled('absolute', 1);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
109 cm.setDisabled('moveforward', 1);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
110 cm.setDisabled('movebackward', 1);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
111 } else {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
112 cm.setDisabled('absolute', 0);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
113 cm.setDisabled('moveforward', !le);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
114 cm.setDisabled('movebackward', !le);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
115 cm.setActive('absolute', le && le.style.position.toLowerCase() == "absolute");
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
116 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
117 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
118
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
119 // Private methods
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
120
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
121 _visualAid : function(ed, e, s) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
122 var dom = ed.dom;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
123
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
124 tinymce.each(dom.select('div,p', e), function(e) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
125 if (/^(absolute|relative|fixed)$/i.test(e.style.position)) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
126 if (s)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
127 dom.addClass(e, 'mceItemVisualAid');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
128 else
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
129 dom.removeClass(e, 'mceItemVisualAid');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
130
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
131 dom.addClass(e, 'mceItemLayer');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
132 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
133 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
134 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
135
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
136 _move : function(d) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
137 var ed = this.editor, i, z = [], le = this._getParentLayer(ed.selection.getNode()), ci = -1, fi = -1, nl;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
138
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
139 nl = [];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
140 tinymce.walk(ed.getBody(), function(n) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
141 if (n.nodeType == 1 && /^(absolute|relative|static)$/i.test(n.style.position))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
142 nl.push(n);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
143 }, 'childNodes');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
144
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
145 // Find z-indexes
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
146 for (i=0; i<nl.length; i++) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
147 z[i] = nl[i].style.zIndex ? parseInt(nl[i].style.zIndex) : 0;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
148
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
149 if (ci < 0 && nl[i] == le)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
150 ci = i;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
151 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
152
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
153 if (d < 0) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
154 // Move back
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
155
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
156 // Try find a lower one
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
157 for (i=0; i<z.length; i++) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
158 if (z[i] < z[ci]) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
159 fi = i;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
160 break;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
161 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
162 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
163
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
164 if (fi > -1) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
165 nl[ci].style.zIndex = z[fi];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
166 nl[fi].style.zIndex = z[ci];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
167 } else {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
168 if (z[ci] > 0)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
169 nl[ci].style.zIndex = z[ci] - 1;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
170 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
171 } else {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
172 // Move forward
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
173
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
174 // Try find a higher one
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
175 for (i=0; i<z.length; i++) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
176 if (z[i] > z[ci]) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
177 fi = i;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
178 break;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
179 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
180 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
181
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
182 if (fi > -1) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
183 nl[ci].style.zIndex = z[fi];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
184 nl[fi].style.zIndex = z[ci];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
185 } else
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
186 nl[ci].style.zIndex = z[ci] + 1;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
187 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
188
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
189 ed.execCommand('mceRepaint');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
190 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
191
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
192 _getParentLayer : function(n) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
193 return this.editor.dom.getParent(n, function(n) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
194 return n.nodeType == 1 && /^(absolute|relative|static)$/i.test(n.style.position);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
195 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
196 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
197
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
198 _insertLayer : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
199 var ed = this.editor, dom = ed.dom, p = dom.getPos(dom.getParent(ed.selection.getNode(), '*')), body = ed.getBody();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
200
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
201 ed.dom.add(body, 'div', {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
202 style : {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
203 position : 'absolute',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
204 left : p.x,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
205 top : (p.y > 20 ? p.y : 20),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
206 width : 100,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
207 height : 100
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
208 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
209 'class' : 'mceItemVisualAid mceItemLayer'
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
210 }, ed.selection.getContent() || ed.getLang('layer.content'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
211
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
212 // Workaround for IE where it messes up the JS engine if you insert a layer on IE 6,7
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
213 if (tinymce.isIE)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
214 dom.setHTML(body, body.innerHTML);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
215 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
216
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
217 _toggleAbsolute : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
218 var ed = this.editor, le = this._getParentLayer(ed.selection.getNode());
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
219
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
220 if (!le)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
221 le = ed.dom.getParent(ed.selection.getNode(), 'DIV,P,IMG');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
222
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
223 if (le) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
224 if (le.style.position.toLowerCase() == "absolute") {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
225 ed.dom.setStyles(le, {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
226 position : '',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
227 left : '',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
228 top : '',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
229 width : '',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
230 height : ''
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
231 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
232
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
233 ed.dom.removeClass(le, 'mceItemVisualAid');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
234 ed.dom.removeClass(le, 'mceItemLayer');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
235 } else {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
236 if (le.style.left == "")
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
237 le.style.left = 20 + 'px';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
238
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
239 if (le.style.top == "")
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
240 le.style.top = 20 + 'px';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
241
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
242 if (le.style.width == "")
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
243 le.style.width = le.width ? (le.width + 'px') : '100px';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
244
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
245 if (le.style.height == "")
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
246 le.style.height = le.height ? (le.height + 'px') : '100px';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
247
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
248 le.style.position = "absolute";
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
249
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
250 ed.dom.setAttrib(le, 'data-mce-style', '');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
251 ed.addVisual(ed.getBody());
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
252 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
253
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
254 ed.execCommand('mceRepaint');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
255 ed.nodeChanged();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
256 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
257 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
258 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
259
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
260 // Register plugin
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
261 tinymce.PluginManager.add('layer', tinymce.plugins.Layer);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
262 })();