comparison media/js/tiny_mce/themes/advanced/editor_template_src.js @ 217:237710206167

Update TinyMCE to 3.3.6
author Brian Neal <bgneal@gmail.com>
date Tue, 01 Jun 2010 04:49:29 +0000
parents 149c3567fec1
children 6ed2932901fa
comparison
equal deleted inserted replaced
216:fe900598f81c 217:237710206167
201 each(ed.dom.getClasses(), function(o, idx) { 201 each(ed.dom.getClasses(), function(o, idx) {
202 var name = 'style_' + idx; 202 var name = 'style_' + idx;
203 203
204 ed.formatter.register(name, { 204 ed.formatter.register(name, {
205 inline : 'span', 205 inline : 'span',
206 classes : o['class'], 206 attributes : {'class' : o['class']},
207 selector : '*' 207 selector : '*'
208 }); 208 });
209 209
210 ctrl.add(o['class'], name); 210 ctrl.add(o['class'], name);
211 }); 211 });
217 217
218 // Setup style select box 218 // Setup style select box
219 ctrl = ctrlMan.createListBox('styleselect', { 219 ctrl = ctrlMan.createListBox('styleselect', {
220 title : 'advanced.style_select', 220 title : 'advanced.style_select',
221 onselect : function(name) { 221 onselect : function(name) {
222 ed.execCommand('mceToggleFormat', false, name); 222 var matches, formatNames = [];
223
224 each(ctrl.items, function(item) {
225 formatNames.push(item.value);
226 });
227
228 ed.focus();
229
230 // Toggle off the current format
231 matches = ed.formatter.matchAll(formatNames);
232 if (matches[0] == name)
233 ed.formatter.remove(name);
234 else
235 ed.formatter.apply(name);
223 236
224 return false; // No auto select 237 return false; // No auto select
225 } 238 }
226 }); 239 });
227 240
249 if (val) { 262 if (val) {
250 name = 'style_' + (counter++); 263 name = 'style_' + (counter++);
251 264
252 ed.formatter.register(name, { 265 ed.formatter.register(name, {
253 inline : 'span', 266 inline : 'span',
254 classes : val 267 classes : val,
268 selector : '*'
255 }); 269 });
256 270
257 ctrl.add(t.editor.translate(key), name); 271 ctrl.add(t.editor.translate(key), name);
258 } 272 }
259 }); 273 });
298 312
299 _createFontSizeSelect : function() { 313 _createFontSizeSelect : function() {
300 var t = this, ed = t.editor, c, i = 0, cl = []; 314 var t = this, ed = t.editor, c, i = 0, cl = [];
301 315
302 c = ed.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', onselect : function(v) { 316 c = ed.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', onselect : function(v) {
303 if (v.fontSize) 317 if (v['class']) {
318 ed.focus();
319 ed.formatter.toggle('fontsize_class', {value : v['class']});
320 } else
304 ed.execCommand('FontSize', false, v.fontSize); 321 ed.execCommand('FontSize', false, v.fontSize);
305 else {
306 each(t.settings.theme_advanced_font_sizes, function(v, k) {
307 if (v['class'])
308 cl.push(v['class']);
309 });
310
311 ed.editorCommands._applyInlineStyle('span', {'class' : v['class']}, {check_classes : cl});
312 }
313 322
314 return false; // No auto select 323 return false; // No auto select
315 }}); 324 }});
316 325
317 if (c) { 326 if (c) {