Mercurial > public > sg101
comparison media/js/tiny_mce/themes/advanced/editor_template_src.js @ 183:149c3567fec1
Updated to TinyMCE version 3.3.2. This is for #57.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 28 Mar 2010 21:47:48 +0000 |
parents | a5b4c5ce0658 |
children | 237710206167 |
comparison
equal
deleted
inserted
replaced
182:5c889b587416 | 183:149c3567fec1 |
---|---|
1 /** | 1 /** |
2 * $Id: editor_template_src.js 1045 2009-03-04 20:03:18Z spocke $ | 2 * editor_template_src.js |
3 * | 3 * |
4 * @author Moxiecode | 4 * Copyright 2009, Moxiecode Systems AB |
5 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. | 5 * Released under LGPL License. |
6 * | |
7 * License: http://tinymce.moxiecode.com/license | |
8 * Contributing: http://tinymce.moxiecode.com/contributing | |
6 */ | 9 */ |
7 | 10 |
8 (function(tinymce) { | 11 (function(tinymce) { |
9 var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID, explode = tinymce.explode; | 12 var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID, explode = tinymce.explode; |
10 | 13 |
95 each(ed.getParam('theme_advanced_font_sizes', '', 'hash'), function(v, k) { | 98 each(ed.getParam('theme_advanced_font_sizes', '', 'hash'), function(v, k) { |
96 var cl; | 99 var cl; |
97 | 100 |
98 if (k == v && v >= 1 && v <= 7) { | 101 if (k == v && v >= 1 && v <= 7) { |
99 k = v + ' (' + t.sizes[v - 1] + 'pt)'; | 102 k = v + ' (' + t.sizes[v - 1] + 'pt)'; |
100 | 103 cl = s.font_size_classes[v - 1]; |
101 if (ed.settings.convert_fonts_to_spans) { | 104 v = s.font_size_style_values[v - 1] || (t.sizes[v - 1] + 'pt'); |
102 cl = s.font_size_classes[v - 1]; | |
103 v = s.font_size_style_values[v - 1] || (t.sizes[v - 1] + 'pt'); | |
104 } | |
105 } | 105 } |
106 | 106 |
107 if (/^\s*\./.test(v)) | 107 if (/^\s*\./.test(v)) |
108 cl = v.replace(/\./g, ''); | 108 cl = v.replace(/\./g, ''); |
109 | 109 |
119 if (s.theme_advanced_statusbar_location == 'none') | 119 if (s.theme_advanced_statusbar_location == 'none') |
120 s.theme_advanced_statusbar_location = 0; | 120 s.theme_advanced_statusbar_location = 0; |
121 | 121 |
122 // Init editor | 122 // Init editor |
123 ed.onInit.add(function() { | 123 ed.onInit.add(function() { |
124 ed.onNodeChange.add(t._nodeChanged, t); | 124 if (!ed.settings.readonly) |
125 ed.onNodeChange.add(t._nodeChanged, t); | |
125 | 126 |
126 if (ed.settings.content_css !== false) | 127 if (ed.settings.content_css !== false) |
127 ed.dom.loadCSS(ed.baseURI.toAbsolute("themes/advanced/skins/" + ed.settings.skin + "/content.css")); | 128 ed.dom.loadCSS(ed.baseURI.toAbsolute("themes/advanced/skins/" + ed.settings.skin + "/content.css")); |
128 }); | 129 }); |
129 | 130 |
192 | 193 |
193 return false; | 194 return false; |
194 }, | 195 }, |
195 | 196 |
196 _importClasses : function(e) { | 197 _importClasses : function(e) { |
197 var ed = this.editor, c = ed.controlManager.get('styleselect'); | 198 var ed = this.editor, ctrl = ed.controlManager.get('styleselect'); |
198 | 199 |
199 if (c.getLength() == 0) { | 200 if (ctrl.getLength() == 0) { |
200 each(ed.dom.getClasses(), function(o) { | 201 each(ed.dom.getClasses(), function(o, idx) { |
201 c.add(o['class'], o['class']); | 202 var name = 'style_' + idx; |
203 | |
204 ed.formatter.register(name, { | |
205 inline : 'span', | |
206 classes : o['class'], | |
207 selector : '*' | |
208 }); | |
209 | |
210 ctrl.add(o['class'], name); | |
202 }); | 211 }); |
203 } | 212 } |
204 }, | 213 }, |
205 | 214 |
206 _createStyleSelect : function(n) { | 215 _createStyleSelect : function(n) { |
207 var t = this, ed = t.editor, cf = ed.controlManager, c = cf.createListBox('styleselect', { | 216 var t = this, ed = t.editor, ctrlMan = ed.controlManager, ctrl; |
217 | |
218 // Setup style select box | |
219 ctrl = ctrlMan.createListBox('styleselect', { | |
208 title : 'advanced.style_select', | 220 title : 'advanced.style_select', |
209 onselect : function(v) { | 221 onselect : function(name) { |
210 if (c.selectedValue === v) { | 222 ed.execCommand('mceToggleFormat', false, name); |
211 ed.execCommand('mceSetStyleInfo', 0, {command : 'removeformat'}); | 223 |
212 c.select(); | 224 return false; // No auto select |
213 return false; | 225 } |
214 } else | 226 }); |
215 ed.execCommand('mceSetCSSClass', 0, v); | 227 |
216 } | 228 // Handle specified format |
217 }); | 229 ed.onInit.add(function() { |
218 | 230 var counter = 0, formats = ed.getParam('style_formats'); |
219 if (c) { | 231 |
220 each(ed.getParam('theme_advanced_styles', '', 'hash'), function(v, k) { | 232 if (formats) { |
221 if (v) | 233 each(formats, function(fmt) { |
222 c.add(t.editor.translate(k), v); | 234 var name, keys = 0; |
223 }); | 235 |
224 | 236 each(fmt, function() {keys++;}); |
225 c.onPostRender.add(function(ed, n) { | 237 |
226 if (!c.NativeListBox) { | 238 if (keys > 1) { |
239 name = fmt.name = fmt.name || 'style_' + (counter++); | |
240 ed.formatter.register(name, fmt); | |
241 ctrl.add(fmt.title, name); | |
242 } else | |
243 ctrl.add(fmt.title); | |
244 }); | |
245 } else { | |
246 each(ed.getParam('theme_advanced_styles', '', 'hash'), function(val, key) { | |
247 var name; | |
248 | |
249 if (val) { | |
250 name = 'style_' + (counter++); | |
251 | |
252 ed.formatter.register(name, { | |
253 inline : 'span', | |
254 classes : val | |
255 }); | |
256 | |
257 ctrl.add(t.editor.translate(key), name); | |
258 } | |
259 }); | |
260 } | |
261 }); | |
262 | |
263 // Auto import classes if the ctrl box is empty | |
264 if (ctrl.getLength() == 0) { | |
265 ctrl.onPostRender.add(function(ed, n) { | |
266 if (!ctrl.NativeListBox) { | |
227 Event.add(n.id + '_text', 'focus', t._importClasses, t); | 267 Event.add(n.id + '_text', 'focus', t._importClasses, t); |
228 Event.add(n.id + '_text', 'mousedown', t._importClasses, t); | 268 Event.add(n.id + '_text', 'mousedown', t._importClasses, t); |
229 Event.add(n.id + '_open', 'focus', t._importClasses, t); | 269 Event.add(n.id + '_open', 'focus', t._importClasses, t); |
230 Event.add(n.id + '_open', 'mousedown', t._importClasses, t); | 270 Event.add(n.id + '_open', 'mousedown', t._importClasses, t); |
231 } else | 271 } else |
232 Event.add(n.id, 'focus', t._importClasses, t); | 272 Event.add(n.id, 'focus', t._importClasses, t); |
233 }); | 273 }); |
234 } | 274 } |
235 | 275 |
236 return c; | 276 return ctrl; |
237 }, | 277 }, |
238 | 278 |
239 _createFontSelect : function() { | 279 _createFontSelect : function() { |
240 var c, t = this, ed = t.editor; | 280 var c, t = this, ed = t.editor; |
241 | 281 |
242 c = ed.controlManager.createListBox('fontselect', {title : 'advanced.fontdefault', cmd : 'FontName'}); | 282 c = ed.controlManager.createListBox('fontselect', { |
283 title : 'advanced.fontdefault', | |
284 onselect : function(v) { | |
285 ed.execCommand('FontName', false, v); | |
286 return false; // No auto select | |
287 } | |
288 }); | |
289 | |
243 if (c) { | 290 if (c) { |
244 each(ed.getParam('theme_advanced_fonts', t.settings.theme_advanced_fonts, 'hash'), function(v, k) { | 291 each(ed.getParam('theme_advanced_fonts', t.settings.theme_advanced_fonts, 'hash'), function(v, k) { |
245 c.add(ed.translate(k), v, {style : v.indexOf('dings') == -1 ? 'font-family:' + v : ''}); | 292 c.add(ed.translate(k), v, {style : v.indexOf('dings') == -1 ? 'font-family:' + v : ''}); |
246 }); | 293 }); |
247 } | 294 } |
261 cl.push(v['class']); | 308 cl.push(v['class']); |
262 }); | 309 }); |
263 | 310 |
264 ed.editorCommands._applyInlineStyle('span', {'class' : v['class']}, {check_classes : cl}); | 311 ed.editorCommands._applyInlineStyle('span', {'class' : v['class']}, {check_classes : cl}); |
265 } | 312 } |
313 | |
314 return false; // No auto select | |
266 }}); | 315 }}); |
267 | 316 |
268 if (c) { | 317 if (c) { |
269 each(t.settings.theme_advanced_font_sizes, function(v, k) { | 318 each(t.settings.theme_advanced_font_sizes, function(v, k) { |
270 var fz = v.fontSize; | 319 var fz = v.fontSize; |
471 | 520 |
472 this.resizeTo(e.clientWidth + dw, e.clientHeight + dh); | 521 this.resizeTo(e.clientWidth + dw, e.clientHeight + dh); |
473 }, | 522 }, |
474 | 523 |
475 resizeTo : function(w, h) { | 524 resizeTo : function(w, h) { |
476 var ed = this.editor, s = ed.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr'), dh; | 525 var ed = this.editor, s = this.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr'); |
477 | 526 |
478 // Boundery fix box | 527 // Boundery fix box |
479 w = Math.max(s.theme_advanced_resizing_min_width || 100, w); | 528 w = Math.max(s.theme_advanced_resizing_min_width || 100, w); |
480 h = Math.max(s.theme_advanced_resizing_min_height || 100, h); | 529 h = Math.max(s.theme_advanced_resizing_min_height || 100, h); |
481 w = Math.min(s.theme_advanced_resizing_max_width || 0xFFFF, w); | 530 w = Math.min(s.theme_advanced_resizing_max_width || 0xFFFF, w); |
482 h = Math.min(s.theme_advanced_resizing_max_height || 0xFFFF, h); | 531 h = Math.min(s.theme_advanced_resizing_max_height || 0xFFFF, h); |
483 | 532 |
484 // Calc difference between iframe and container | |
485 dh = e.clientHeight - ifr.clientHeight; | |
486 | |
487 // Resize iframe and container | 533 // Resize iframe and container |
488 DOM.setStyle(ifr, 'height', h - dh); | 534 DOM.setStyle(e, 'height', ''); |
489 DOM.setStyles(e, {width : w, height : h}); | 535 DOM.setStyle(ifr, 'height', h); |
536 | |
537 if (s.theme_advanced_resize_horizontal) { | |
538 DOM.setStyle(e, 'width', ''); | |
539 DOM.setStyle(ifr, 'width', w); | |
540 | |
541 // Make sure that the size is never smaller than the over all ui | |
542 if (w < e.clientWidth) | |
543 DOM.setStyle(ifr, 'width', e.clientWidth); | |
544 } | |
490 }, | 545 }, |
491 | 546 |
492 destroy : function() { | 547 destroy : function() { |
493 var id = this.editor.id; | 548 var id = this.editor.id; |
494 | 549 |
698 var o = Cookie.getHash("TinyMCE_" + ed.id + "_size"), c = DOM.get(ed.id + '_tbl'); | 753 var o = Cookie.getHash("TinyMCE_" + ed.id + "_size"), c = DOM.get(ed.id + '_tbl'); |
699 | 754 |
700 if (!o) | 755 if (!o) |
701 return; | 756 return; |
702 | 757 |
703 if (s.theme_advanced_resize_horizontal) | 758 t.resizeTo(o.cw, o.ch); |
704 c.style.width = Math.max(10, o.cw) + 'px'; | |
705 | |
706 c.style.height = Math.max(10, o.ch) + 'px'; | |
707 DOM.get(ed.id + '_ifr').style.height = Math.max(10, parseInt(o.ch) + t.deltaHeight) + 'px'; | |
708 }); | 759 }); |
709 } | 760 } |
710 | 761 |
711 ed.onPostRender.add(function() { | 762 ed.onPostRender.add(function() { |
712 Event.add(ed.id + '_resize', 'mousedown', function(e) { | 763 Event.add(ed.id + '_resize', 'mousedown', function(e) { |
713 var c, p, w, h, n, pa; | 764 var mouseMoveHandler1, mouseMoveHandler2, |
714 | 765 mouseUpHandler1, mouseUpHandler2, |
715 // Measure container | 766 startX, startY, startWidth, startHeight, width, height, ifrElm; |
716 c = DOM.get(ed.id + '_tbl'); | 767 |
717 w = c.clientWidth; | 768 function resizeOnMove(e) { |
718 h = c.clientHeight; | 769 width = startWidth + (e.screenX - startX); |
719 | 770 height = startHeight + (e.screenY - startY); |
720 miw = s.theme_advanced_resizing_min_width || 100; | 771 |
721 mih = s.theme_advanced_resizing_min_height || 100; | 772 t.resizeTo(width, height); |
722 maw = s.theme_advanced_resizing_max_width || 0xFFFF; | |
723 mah = s.theme_advanced_resizing_max_height || 0xFFFF; | |
724 | |
725 // Setup placeholder | |
726 p = DOM.add(DOM.get(ed.id + '_parent'), 'div', {'class' : 'mcePlaceHolder'}); | |
727 DOM.setStyles(p, {width : w, height : h}); | |
728 | |
729 // Replace with placeholder | |
730 DOM.hide(c); | |
731 DOM.show(p); | |
732 | |
733 // Create internal resize obj | |
734 r = { | |
735 x : e.screenX, | |
736 y : e.screenY, | |
737 w : w, | |
738 h : h, | |
739 dx : null, | |
740 dy : null | |
741 }; | 773 }; |
742 | 774 |
743 // Start listening | 775 function endResize(e) { |
744 mf = Event.add(DOM.doc, 'mousemove', function(e) { | |
745 var w, h; | |
746 | |
747 // Calc delta values | |
748 r.dx = e.screenX - r.x; | |
749 r.dy = e.screenY - r.y; | |
750 | |
751 // Boundery fix box | |
752 w = Math.max(miw, r.w + r.dx); | |
753 h = Math.max(mih, r.h + r.dy); | |
754 w = Math.min(maw, w); | |
755 h = Math.min(mah, h); | |
756 | |
757 // Resize placeholder | |
758 if (s.theme_advanced_resize_horizontal) | |
759 p.style.width = w + 'px'; | |
760 | |
761 p.style.height = h + 'px'; | |
762 | |
763 return Event.cancel(e); | |
764 }); | |
765 | |
766 me = Event.add(DOM.doc, 'mouseup', function(e) { | |
767 var ifr; | |
768 | |
769 // Stop listening | 776 // Stop listening |
770 Event.remove(DOM.doc, 'mousemove', mf); | 777 Event.remove(DOM.doc, 'mousemove', mouseMoveHandler1); |
771 Event.remove(DOM.doc, 'mouseup', me); | 778 Event.remove(ed.getDoc(), 'mousemove', mouseMoveHandler2); |
772 | 779 Event.remove(DOM.doc, 'mouseup', mouseUpHandler1); |
773 c.style.display = ''; | 780 Event.remove(ed.getDoc(), 'mouseup', mouseUpHandler2); |
774 DOM.remove(p); | 781 |
775 | 782 // Store away the size |
776 if (r.dx === null) | |
777 return; | |
778 | |
779 ifr = DOM.get(ed.id + '_ifr'); | |
780 | |
781 if (s.theme_advanced_resize_horizontal) | |
782 c.style.width = Math.max(10, r.w + r.dx) + 'px'; | |
783 | |
784 c.style.height = Math.max(10, r.h + r.dy) + 'px'; | |
785 ifr.style.height = Math.max(10, ifr.clientHeight + r.dy) + 'px'; | |
786 | |
787 if (s.theme_advanced_resizing_use_cookie) { | 783 if (s.theme_advanced_resizing_use_cookie) { |
788 Cookie.setHash("TinyMCE_" + ed.id + "_size", { | 784 Cookie.setHash("TinyMCE_" + ed.id + "_size", { |
789 cw : r.w + r.dx, | 785 cw : width, |
790 ch : r.h + r.dy | 786 ch : height |
791 }); | 787 }); |
792 } | 788 } |
793 }); | 789 }; |
794 | 790 |
795 return Event.cancel(e); | 791 e.preventDefault(); |
792 | |
793 // Get the current rect size | |
794 startX = e.screenX; | |
795 startY = e.screenY; | |
796 ifrElm = DOM.get(t.editor.id + '_ifr'); | |
797 startWidth = width = ifrElm.clientWidth; | |
798 startHeight = height = ifrElm.clientHeight; | |
799 | |
800 // Register envent handlers | |
801 mouseMoveHandler1 = Event.add(DOM.doc, 'mousemove', resizeOnMove); | |
802 mouseMoveHandler2 = Event.add(ed.getDoc(), 'mousemove', resizeOnMove); | |
803 mouseUpHandler1 = Event.add(DOM.doc, 'mouseup', endResize); | |
804 mouseUpHandler2 = Event.add(ed.getDoc(), 'mouseup', endResize); | |
796 }); | 805 }); |
797 }); | 806 }); |
798 } | 807 } |
799 | 808 |
800 o.deltaHeight -= 21; | 809 o.deltaHeight -= 21; |
801 n = tb = null; | 810 n = tb = null; |
802 }, | 811 }, |
803 | 812 |
804 _nodeChanged : function(ed, cm, n, co) { | 813 _nodeChanged : function(ed, cm, n, co, ob) { |
805 var t = this, p, de = 0, v, c, s = t.settings, cl, fz, fn; | 814 var t = this, p, de = 0, v, c, s = t.settings, cl, fz, fn, formatNames, matches; |
806 | |
807 if (s.readonly) | |
808 return; | |
809 | 815 |
810 tinymce.each(t.stateControls, function(c) { | 816 tinymce.each(t.stateControls, function(c) { |
811 cm.setActive(c, ed.queryCommandState(t.controls[c][1])); | 817 cm.setActive(c, ed.queryCommandState(t.controls[c][1])); |
812 }); | 818 }); |
819 | |
820 function getParent(name) { | |
821 var i, parents = ob.parents, func = name; | |
822 | |
823 if (typeof(name) == 'string') { | |
824 func = function(node) { | |
825 return node.nodeName == name; | |
826 }; | |
827 } | |
828 | |
829 for (i = 0; i < parents.length; i++) { | |
830 if (func(parents[i])) | |
831 return parents[i]; | |
832 } | |
833 }; | |
813 | 834 |
814 cm.setActive('visualaid', ed.hasVisual); | 835 cm.setActive('visualaid', ed.hasVisual); |
815 cm.setDisabled('undo', !ed.undoManager.hasUndo() && !ed.typing); | 836 cm.setDisabled('undo', !ed.undoManager.hasUndo() && !ed.typing); |
816 cm.setDisabled('redo', !ed.undoManager.hasRedo()); | 837 cm.setDisabled('redo', !ed.undoManager.hasRedo()); |
817 cm.setDisabled('outdent', !ed.queryCommandState('Outdent')); | 838 cm.setDisabled('outdent', !ed.queryCommandState('Outdent')); |
818 | 839 |
819 p = DOM.getParent(n, 'A'); | 840 p = getParent('A'); |
820 if (c = cm.get('link')) { | 841 if (c = cm.get('link')) { |
821 if (!p || !p.name) { | 842 if (!p || !p.name) { |
822 c.setDisabled(!p && co); | 843 c.setDisabled(!p && co); |
823 c.setActive(!!p); | 844 c.setActive(!!p); |
824 } | 845 } |
829 c.setActive(!!p && !p.name); | 850 c.setActive(!!p && !p.name); |
830 } | 851 } |
831 | 852 |
832 if (c = cm.get('anchor')) { | 853 if (c = cm.get('anchor')) { |
833 c.setActive(!!p && p.name); | 854 c.setActive(!!p && p.name); |
834 | 855 } |
835 if (tinymce.isWebKit) { | 856 |
836 p = DOM.getParent(n, 'IMG'); | 857 p = getParent('IMG'); |
837 c.setActive(!!p && DOM.getAttrib(p, 'mce_name') == 'a'); | |
838 } | |
839 } | |
840 | |
841 p = DOM.getParent(n, 'IMG'); | |
842 if (c = cm.get('image')) | 858 if (c = cm.get('image')) |
843 c.setActive(!!p && n.className.indexOf('mceItem') == -1); | 859 c.setActive(!!p && n.className.indexOf('mceItem') == -1); |
844 | 860 |
845 if (c = cm.get('styleselect')) { | 861 if (c = cm.get('styleselect')) { |
846 if (n.className) { | 862 t._importClasses(); |
847 t._importClasses(); | 863 |
848 c.select(n.className); | 864 formatNames = []; |
849 } else | 865 each(c.items, function(item) { |
850 c.select(); | 866 formatNames.push(item.value); |
867 }); | |
868 | |
869 matches = ed.formatter.matchAll(formatNames); | |
870 c.select(matches[0]); | |
851 } | 871 } |
852 | 872 |
853 if (c = cm.get('formatselect')) { | 873 if (c = cm.get('formatselect')) { |
854 p = DOM.getParent(n, DOM.isBlock); | 874 p = getParent(DOM.isBlock); |
855 | 875 |
856 if (p) | 876 if (p) |
857 c.select(p.nodeName.toLowerCase()); | 877 c.select(p.nodeName.toLowerCase()); |
858 } | 878 } |
859 | 879 |
860 if (ed.settings.convert_fonts_to_spans) { | 880 // Find out current fontSize, fontFamily and fontClass |
861 ed.dom.getParent(n, function(n) { | 881 getParent(function(n) { |
862 if (n.nodeName === 'SPAN') { | 882 if (n.nodeName === 'SPAN') { |
863 if (!cl && n.className) | 883 if (!cl && n.className) |
864 cl = n.className; | 884 cl = n.className; |
865 | 885 |
866 if (!fz && n.style.fontSize) | 886 if (!fz && n.style.fontSize) |
867 fz = n.style.fontSize; | 887 fz = n.style.fontSize; |
868 | 888 |
869 if (!fn && n.style.fontFamily) | 889 if (!fn && n.style.fontFamily) |
870 fn = n.style.fontFamily.replace(/[\"\']+/g, '').replace(/^([^,]+).*/, '$1').toLowerCase(); | 890 fn = n.style.fontFamily.replace(/[\"\']+/g, '').replace(/^([^,]+).*/, '$1').toLowerCase(); |
871 } | 891 } |
872 | 892 |
873 return false; | 893 return false; |
874 }); | 894 }); |
875 | 895 |
876 if (c = cm.get('fontselect')) { | 896 if (c = cm.get('fontselect')) { |
877 c.select(function(v) { | 897 c.select(function(v) { |
878 return v.replace(/^([^,]+).*/, '$1').toLowerCase() == fn; | 898 return v.replace(/^([^,]+).*/, '$1').toLowerCase() == fn; |
879 }); | 899 }); |
880 } | 900 } |
881 | 901 |
882 if (c = cm.get('fontsizeselect')) { | 902 // Select font size |
883 c.select(function(v) { | 903 if (c = cm.get('fontsizeselect')) { |
884 if (v.fontSize && v.fontSize === fz) | 904 // Use computed style |
885 return true; | 905 if (s.theme_advanced_runtime_fontsize && !fz && !cl) |
886 | 906 fz = ed.dom.getStyle(n, 'fontSize', true); |
887 if (v['class'] && v['class'] === cl) | 907 |
888 return true; | 908 c.select(function(v) { |
889 }); | 909 if (v.fontSize && v.fontSize === fz) |
890 } | 910 return true; |
891 } else { | 911 |
892 if (c = cm.get('fontselect')) | 912 if (v['class'] && v['class'] === cl) |
893 c.select(ed.queryCommandValue('FontName')); | 913 return true; |
894 | 914 }); |
895 if (c = cm.get('fontsizeselect')) { | |
896 v = ed.queryCommandValue('FontSize'); | |
897 c.select(function(iv) { | |
898 return iv.fontSize == v; | |
899 }); | |
900 } | |
901 } | 915 } |
902 | 916 |
903 if (s.theme_advanced_path && s.theme_advanced_statusbar_location) { | 917 if (s.theme_advanced_path && s.theme_advanced_statusbar_location) { |
904 p = DOM.get(ed.id + '_path') || DOM.add(ed.id + '_path_row', 'span', {id : ed.id + '_path'}); | 918 p = DOM.get(ed.id + '_path') || DOM.add(ed.id + '_path_row', 'span', {id : ed.id + '_path'}); |
905 DOM.setHTML(p, ''); | 919 DOM.setHTML(p, ''); |
906 | 920 |
907 ed.dom.getParent(n, function(n) { | 921 getParent(function(n) { |
908 var na = n.nodeName.toLowerCase(), u, pi, ti = ''; | 922 var na = n.nodeName.toLowerCase(), u, pi, ti = ''; |
909 | 923 |
924 /*if (n.getAttribute('_mce_bogus')) | |
925 return; | |
926 */ | |
910 // Ignore non element and hidden elements | 927 // Ignore non element and hidden elements |
911 if (n.nodeType != 1 || n.nodeName === 'BR' || (DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved'))) | 928 if (n.nodeType != 1 || n.nodeName === 'BR' || (DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved'))) |
912 return; | 929 return; |
913 | 930 |
914 // Fake name | 931 // Fake name |
948 ti += 'href: ' + v + ' '; | 965 ti += 'href: ' + v + ' '; |
949 | 966 |
950 break; | 967 break; |
951 | 968 |
952 case 'font': | 969 case 'font': |
953 if (s.convert_fonts_to_spans) | |
954 na = 'span'; | |
955 | |
956 if (v = DOM.getAttrib(n, 'face')) | 970 if (v = DOM.getAttrib(n, 'face')) |
957 ti += 'font: ' + v + ' '; | 971 ti += 'font: ' + v + ' '; |
958 | 972 |
959 if (v = DOM.getAttrib(n, 'size')) | 973 if (v = DOM.getAttrib(n, 'size')) |
960 ti += 'size: ' + v + ' '; | 974 ti += 'size: ' + v + ' '; |
973 | 987 |
974 if (v = DOM.getAttrib(n, 'id')) | 988 if (v = DOM.getAttrib(n, 'id')) |
975 ti += 'id: ' + v + ' '; | 989 ti += 'id: ' + v + ' '; |
976 | 990 |
977 if (v = n.className) { | 991 if (v = n.className) { |
978 v = v.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g, ''); | 992 v = v.replace(/\b\s*(webkit|mce|Apple-)\w+\s*\b/g, '') |
979 | 993 |
980 if (v && v.indexOf('mceItem') == -1) { | 994 if (v) { |
981 ti += 'class: ' + v + ' '; | 995 ti += 'class: ' + v + ' '; |
982 | 996 |
983 if (DOM.isBlock(n) || na == 'img' || na == 'span') | 997 if (DOM.isBlock(n) || na == 'img' || na == 'span') |
984 na += '.' + v; | 998 na += '.' + v; |
985 } | 999 } |