thomascube
2011-02-06 07b95dc49b31d131b1fecdabf2059a447935c196
program/js/tiny_mce/themes/advanced/editor_template_src.js
@@ -1,17 +1,22 @@
/**
 * $Id: editor_template_src.js 766 2008-04-03 20:37:06Z spocke $
 * editor_template_src.js
 *
 * @author Moxiecode
 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
 * Copyright 2009, Moxiecode Systems AB
 * Released under LGPL License.
 *
 * License: http://tinymce.moxiecode.com/license
 * Contributing: http://tinymce.moxiecode.com/contributing
 */
(function() {
(function(tinymce) {
   var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID, explode = tinymce.explode;
   // Tell it to load theme specific language pack(s)
   tinymce.ThemeManager.requireLangPack('advanced');
   tinymce.create('tinymce.themes.AdvancedTheme', {
      sizes : [8, 10, 12, 14, 18, 24, 36],
      // Control name lookup, format: title, command
      controls : {
         bold : ['bold_desc', 'Bold'],
@@ -55,7 +60,7 @@
      stateControls : ['bold', 'italic', 'underline', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'sub', 'sup', 'blockquote'],
      init : function(ed, url) {
         var t = this, s, v;
         var t = this, s, v, o;
   
         t.editor = ed;
         t.url = url;
@@ -71,12 +76,42 @@
            theme_advanced_blockformats : "p,address,pre,h1,h2,h3,h4,h5,h6",
            theme_advanced_toolbar_align : "center",
            theme_advanced_fonts : "Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",
            theme_advanced_font_sizes : "1,2,3,4,5,6,7",
            theme_advanced_more_colors : 1,
            theme_advanced_row_height : 23,
            theme_advanced_resize_horizontal : 1,
            theme_advanced_resizing_use_cookie : 1
            theme_advanced_resizing_use_cookie : 1,
            theme_advanced_font_sizes : "1,2,3,4,5,6,7",
            readonly : ed.settings.readonly
         }, ed.settings);
         // Setup default font_size_style_values
         if (!s.font_size_style_values)
            s.font_size_style_values = "8pt,10pt,12pt,14pt,18pt,24pt,36pt";
         if (tinymce.is(s.theme_advanced_font_sizes, 'string')) {
            s.font_size_style_values = tinymce.explode(s.font_size_style_values);
            s.font_size_classes = tinymce.explode(s.font_size_classes || '');
            // Parse string value
            o = {};
            ed.settings.theme_advanced_font_sizes = s.theme_advanced_font_sizes;
            each(ed.getParam('theme_advanced_font_sizes', '', 'hash'), function(v, k) {
               var cl;
               if (k == v && v >= 1 && v <= 7) {
                  k = v + ' (' + t.sizes[v - 1] + 'pt)';
                  cl = s.font_size_classes[v - 1];
                  v = s.font_size_style_values[v - 1] || (t.sizes[v - 1] + 'pt');
               }
               if (/^\s*\./.test(v))
                  cl = v.replace(/\./g, '');
               o[k] = cl ? {'class' : cl} : {fontSize : v};
            });
            s.theme_advanced_font_sizes = o;
         }
         if ((v = s.theme_advanced_path_location) && v != 'none')
            s.theme_advanced_statusbar_location = s.theme_advanced_path_location;
@@ -86,7 +121,8 @@
         // Init editor
         ed.onInit.add(function() {
            ed.onNodeChange.add(t._nodeChanged, t);
            if (!ed.settings.readonly)
               ed.onNodeChange.add(t._nodeChanged, t);
            if (ed.settings.content_css !== false)
               ed.dom.loadCSS(ed.baseURI.toAbsolute("themes/advanced/skins/" + ed.settings.skin + "/content.css"));
@@ -111,10 +147,10 @@
            }
         });
         DOM.loadCSS(ed.baseURI.toAbsolute(s.editor_css || "themes/advanced/skins/" + ed.settings.skin + "/ui.css"));
         DOM.loadCSS(s.editor_css ? ed.documentBaseURI.toAbsolute(s.editor_css) : url + "/skins/" + ed.settings.skin + "/ui.css");
         if (s.skin_variant)
            DOM.loadCSS(ed.baseURI.toAbsolute(s.editor_css || "themes/advanced/skins/" + ed.settings.skin + "/ui_" + s.skin_variant + ".css"));
            DOM.loadCSS(url + "/skins/" + ed.settings.skin + "/ui_" + s.skin_variant + ".css");
      },
      createControl : function(n, cf) {
@@ -158,48 +194,123 @@
         return false;
      },
      _importClasses : function() {
         var ed = this.editor, c = ed.controlManager.get('styleselect');
      _importClasses : function(e) {
         var ed = this.editor, ctrl = ed.controlManager.get('styleselect');
         if (c.getLength() == 0) {
            each(ed.dom.getClasses(), function(o) {
               c.add(o['class'], o['class']);
         if (ctrl.getLength() == 0) {
            each(ed.dom.getClasses(), function(o, idx) {
               var name = 'style_' + idx;
               ed.formatter.register(name, {
                  inline : 'span',
                  attributes : {'class' : o['class']},
                  selector : '*'
               });
               ctrl.add(o['class'], name);
            });
         }
      },
      _createStyleSelect : function(n) {
         var t = this, ed = t.editor, cf = ed.controlManager, c = cf.createListBox('styleselect', {
         var t = this, ed = t.editor, ctrlMan = ed.controlManager, ctrl;
         // Setup style select box
         ctrl = ctrlMan.createListBox('styleselect', {
            title : 'advanced.style_select',
            onselect : function(v) {
               if (c.selectedValue === v) {
                  ed.execCommand('mceSetStyleInfo', 0, {command : 'removeformat'});
                  c.select();
                  return false;
               } else
                  ed.execCommand('mceSetCSSClass', 0, v);
            onselect : function(name) {
               var matches, formatNames = [];
               each(ctrl.items, function(item) {
                  formatNames.push(item.value);
               });
               ed.focus();
               ed.undoManager.add();
               // Toggle off the current format
               matches = ed.formatter.matchAll(formatNames);
               if (matches[0] == name)
                  ed.formatter.remove(name);
               else
                  ed.formatter.apply(name);
               ed.undoManager.add();
               ed.nodeChanged();
               return false; // No auto select
            }
         });
         if (c) {
            each(ed.getParam('theme_advanced_styles', '', 'hash'), function(v, k) {
               if (v)
                  c.add(t.editor.translate(k), v);
            });
         // Handle specified format
         ed.onInit.add(function() {
            var counter = 0, formats = ed.getParam('style_formats');
            c.onPostRender.add(function(ed, n) {
               Event.add(n, 'focus', t._importClasses, t);
               Event.add(n, 'mousedown', t._importClasses, t);
            if (formats) {
               each(formats, function(fmt) {
                  var name, keys = 0;
                  each(fmt, function() {keys++;});
                  if (keys > 1) {
                     name = fmt.name = fmt.name || 'style_' + (counter++);
                     ed.formatter.register(name, fmt);
                     ctrl.add(fmt.title, name);
                  } else
                     ctrl.add(fmt.title);
               });
            } else {
               each(ed.getParam('theme_advanced_styles', '', 'hash'), function(val, key) {
                  var name;
                  if (val) {
                     name = 'style_' + (counter++);
                     ed.formatter.register(name, {
                        inline : 'span',
                        classes : val,
                        selector : '*'
                     });
                     ctrl.add(t.editor.translate(key), name);
                  }
               });
            }
         });
         // Auto import classes if the ctrl box is empty
         if (ctrl.getLength() == 0) {
            ctrl.onPostRender.add(function(ed, n) {
               if (!ctrl.NativeListBox) {
                  Event.add(n.id + '_text', 'focus', t._importClasses, t);
                  Event.add(n.id + '_text', 'mousedown', t._importClasses, t);
                  Event.add(n.id + '_open', 'focus', t._importClasses, t);
                  Event.add(n.id + '_open', 'mousedown', t._importClasses, t);
               } else
                  Event.add(n.id, 'focus', t._importClasses, t);
            });
         }
         return c;
         return ctrl;
      },
      _createFontSelect : function() {
         var c, t = this, ed = t.editor;
         c = ed.controlManager.createListBox('fontselect', {title : 'advanced.fontdefault', cmd : 'FontName'});
         c = ed.controlManager.createListBox('fontselect', {
            title : 'advanced.fontdefault',
            onselect : function(v) {
               ed.execCommand('FontName', false, v);
               // Fake selection, execCommand will fire a nodeChange and update the selection
               c.select(function(sv) {
                  return v == sv;
               });
               return false; // No auto select
            }
         });
         if (c) {
            each(ed.getParam('theme_advanced_fonts', t.settings.theme_advanced_fonts, 'hash'), function(v, k) {
               c.add(ed.translate(k), v, {style : v.indexOf('dings') == -1 ? 'font-family:' + v : ''});
@@ -210,20 +321,34 @@
      },
      _createFontSizeSelect : function() {
         var c, t = this, lo = [
            "1 (8 pt)",
            "2 (10 pt)",
            "3 (12 pt)",
            "4 (14 pt)",
            "5 (18 pt)",
            "6 (24 pt)",
            "7 (36 pt)"
         ], fz = [8, 10, 12, 14, 18, 24, 36];
         var t = this, ed = t.editor, c, i = 0, cl = [];
         c = t.editor.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', cmd : 'FontSize'});
         c = ed.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', onselect : function(v) {
            if (v['class']) {
               ed.focus();
               ed.undoManager.add();
               ed.formatter.toggle('fontsize_class', {value : v['class']});
               ed.undoManager.add();
               ed.nodeChanged();
            } else
               ed.execCommand('FontSize', false, v.fontSize);
            // Fake selection, execCommand will fire a nodeChange and update the selection
            c.select(function(sv) {
               return v == sv;
            });
            return false; // No auto select
         }});
         if (c) {
            each(explode(t.settings.theme_advanced_font_sizes), function(v) {
               c.add(lo[parseInt(v) - 1], v, {'style' : 'font-size:' + fz[v - 1] + 'pt', 'class' : 'mceFontSize' + v});
            each(t.settings.theme_advanced_font_sizes, function(v, k) {
               var fz = v.fontSize;
               if (fz >= 1 && fz <= 7)
                  fz = t.sizes[parseInt(fz) - 1] + 'pt';
               c.add(k, v, {'style' : 'font-size:' + fz, 'class' : 'mceFontSize' + (i++) + (' ' + (v['class'] || ''))});
            });
         }
@@ -276,6 +401,9 @@
         if (v = s.theme_advanced_text_colors)
            o.colors = v;
         if (s.theme_advanced_default_foreground_color)
            o.default_color = s.theme_advanced_default_foreground_color;
         o.title = 'advanced.forecolor_desc';
         o.cmd = 'ForeColor';
         o.scope = this;
@@ -301,6 +429,9 @@
         if (v = s.theme_advanced_background_colors)
            o.colors = v;
         if (s.theme_advanced_default_background_color)
            o.default_color = s.theme_advanced_default_background_color;
         o.title = 'advanced.backcolor_desc';
         o.cmd = 'HiliteColor';
@@ -385,7 +516,7 @@
         }
*/
         if (!ed.getParam('accessibility_focus') || ed.getParam('tab_focus'))
         if (!ed.getParam('accessibility_focus'))
            Event.add(DOM.add(p, 'a', {href : '#'}, '<!-- IE -->'), 'focus', function() {tinyMCE.get(ed.id).focus();});
         if (s.theme_advanced_toolbar_location == 'external')
@@ -418,7 +549,7 @@
      },
      resizeTo : function(w, h) {
         var ed = this.editor, s = ed.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr'), dh;
         var ed = this.editor, s = this.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr');
         // Boundery fix box
         w = Math.max(s.theme_advanced_resizing_min_width || 100, w);
@@ -426,12 +557,18 @@
         w = Math.min(s.theme_advanced_resizing_max_width || 0xFFFF, w);
         h = Math.min(s.theme_advanced_resizing_max_height || 0xFFFF, h);
         // Calc difference between iframe and container
         dh = e.clientHeight - ifr.clientHeight;
         // Resize iframe and container
         DOM.setStyle(ifr, 'height', h - dh);
         DOM.setStyles(e, {width : w, height : h});
         DOM.setStyle(e, 'height', '');
         DOM.setStyle(ifr, 'height', h);
         if (s.theme_advanced_resize_horizontal) {
            DOM.setStyle(e, 'width', '');
            DOM.setStyle(ifr, 'width', w);
            // Make sure that the size is never smaller than the over all ui
            if (w < e.clientWidth)
               DOM.setStyle(ifr, 'width', e.clientWidth);
         }
      },
      destroy : function() {
@@ -446,6 +583,12 @@
      _simpleLayout : function(s, tb, o, p) {
         var t = this, ed = t.editor, lo = s.theme_advanced_toolbar_location, sl = s.theme_advanced_statusbar_location, n, ic, etb, c;
         if (s.readonly) {
            n = DOM.add(tb, 'tr');
            n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
            return ic;
         }
         // Create toolbar container at top
         if (lo == 'top')
@@ -519,7 +662,7 @@
         each(explode(s.theme_advanced_containers || ''), function(c, i) {
            var v = s['theme_advanced_container_' + c] || '';
            switch (c.toLowerCase()) {
            switch (v.toLowerCase()) {
               case 'mceeditor':
                  n = DOM.add(tb, 'tr');
                  n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
@@ -530,7 +673,7 @@
                  break;
               default:
                  a = s['theme_advanced_container_' + c + '_align'].toLowerCase();
                  a = (s['theme_advanced_container_' + c + '_align'] || da).toLowerCase();
                  a = 'mce' + t._ufirst(a);
                  n = DOM.add(DOM.add(tb, 'tr'), 'td', {
@@ -594,7 +737,7 @@
         n = DOM.add(DOM.add(c, 'tr'), 'td', {'class' : 'mceToolbar ' + a});
         if (!ed.getParam('accessibility_focus') || ed.getParam('tab_focus'))
         if (!ed.getParam('accessibility_focus'))
            h.push(DOM.createHTML('a', {href : '#', onfocus : 'tinyMCE.get(\'' + ed.id + '\').focus();'}, '<!-- IE -->'));
         h.push(DOM.createHTML('a', {href : '#', accesskey : 'q', title : ed.getLang("advanced.toolbar_focus")}, '<!-- IE -->'));
@@ -626,10 +769,10 @@
         n = DOM.add(tb, 'tr');
         n = td = DOM.add(n, 'td', {'class' : 'mceStatusbar'});
         n = DOM.add(n, 'div', {id : ed.id + '_path_row'}, s.theme_advanced_path ? ed.translate('advanced.path') + ': ' : '&nbsp;');
         n = DOM.add(n, 'div', {id : ed.id + '_path_row'}, s.theme_advanced_path ? ed.translate('advanced.path') + ': ' : '&#160;');
         DOM.add(n, 'a', {href : '#', accesskey : 'x'});
         if (s.theme_advanced_resizing && !tinymce.isOldWebKit) {
         if (s.theme_advanced_resizing) {
            DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'mceResize'});
            if (s.theme_advanced_resizing_use_cookie) {
@@ -639,99 +782,53 @@
                  if (!o)
                     return;
                  if (s.theme_advanced_resize_horizontal)
                     c.style.width = Math.max(10, o.cw) + 'px';
                  c.style.height = Math.max(10, o.ch) + 'px';
                  DOM.get(ed.id + '_ifr').style.height = Math.max(10, parseInt(o.ch) + t.deltaHeight) + 'px';
                  t.resizeTo(o.cw, o.ch);
               });
            }
            ed.onPostRender.add(function() {
               Event.add(ed.id + '_resize', 'mousedown', function(e) {
                  var c, p, w, h, n, pa;
                  var mouseMoveHandler1, mouseMoveHandler2,
                     mouseUpHandler1, mouseUpHandler2,
                     startX, startY, startWidth, startHeight, width, height, ifrElm;
                  // Measure container
                  c = DOM.get(ed.id + '_tbl');
                  w = c.clientWidth;
                  h = c.clientHeight;
                  function resizeOnMove(e) {
                     width = startWidth + (e.screenX - startX);
                     height = startHeight + (e.screenY - startY);
                  miw = s.theme_advanced_resizing_min_width || 100;
                  mih = s.theme_advanced_resizing_min_height || 100;
                  maw = s.theme_advanced_resizing_max_width || 0xFFFF;
                  mah = s.theme_advanced_resizing_max_height || 0xFFFF;
                  // Setup placeholder
                  p = DOM.add(DOM.get(ed.id + '_parent'), 'div', {'class' : 'mcePlaceHolder'});
                  DOM.setStyles(p, {width : w, height : h});
                  // Replace with placeholder
                  DOM.hide(c);
                  DOM.show(p);
                  // Create internal resize obj
                  r = {
                     x : e.screenX,
                     y : e.screenY,
                     w : w,
                     h : h,
                     dx : null,
                     dy : null
                     t.resizeTo(width, height);
                  };
                  // Start listening
                  mf = Event.add(DOM.doc, 'mousemove', function(e) {
                     var w, h;
                     // Calc delta values
                     r.dx = e.screenX - r.x;
                     r.dy = e.screenY - r.y;
                     // Boundery fix box
                     w = Math.max(miw, r.w + r.dx);
                     h = Math.max(mih, r.h + r.dy);
                     w = Math.min(maw, w);
                     h = Math.min(mah, h);
                     // Resize placeholder
                     if (s.theme_advanced_resize_horizontal)
                        p.style.width = w + 'px';
                     p.style.height = h + 'px';
                     return Event.cancel(e);
                  });
                  me = Event.add(DOM.doc, 'mouseup', function(e) {
                     var ifr;
                  function endResize(e) {
                     // Stop listening
                     Event.remove(DOM.doc, 'mousemove', mf);
                     Event.remove(DOM.doc, 'mouseup', me);
                     Event.remove(DOM.doc, 'mousemove', mouseMoveHandler1);
                     Event.remove(ed.getDoc(), 'mousemove', mouseMoveHandler2);
                     Event.remove(DOM.doc, 'mouseup', mouseUpHandler1);
                     Event.remove(ed.getDoc(), 'mouseup', mouseUpHandler2);
                     c.style.display = '';
                     DOM.remove(p);
                     if (r.dx === null)
                        return;
                     ifr = DOM.get(ed.id + '_ifr');
                     if (s.theme_advanced_resize_horizontal)
                        c.style.width = Math.max(10, r.w + r.dx) + 'px';
                     c.style.height = Math.max(10, r.h + r.dy) + 'px';
                     ifr.style.height = Math.max(10, ifr.clientHeight + r.dy) + 'px';
                     // Store away the size
                     if (s.theme_advanced_resizing_use_cookie) {
                        Cookie.setHash("TinyMCE_" + ed.id + "_size", {
                           cw : r.w + r.dx,
                           ch : r.h + r.dy
                           cw : width,
                           ch : height
                        });
                     }
                  });
                  };
                  return Event.cancel(e);
                  e.preventDefault();
                  // Get the current rect size
                  startX = e.screenX;
                  startY = e.screenY;
                  ifrElm = DOM.get(t.editor.id + '_ifr');
                  startWidth = width = ifrElm.clientWidth;
                  startHeight = height = ifrElm.clientHeight;
                  // Register envent handlers
                  mouseMoveHandler1 = Event.add(DOM.doc, 'mousemove', resizeOnMove);
                  mouseMoveHandler2 = Event.add(ed.getDoc(), 'mousemove', resizeOnMove);
                  mouseUpHandler1 = Event.add(DOM.doc, 'mouseup', endResize);
                  mouseUpHandler2 = Event.add(ed.getDoc(), 'mouseup', endResize);
               });
            });
         }
@@ -740,19 +837,34 @@
         n = tb = null;
      },
      _nodeChanged : function(ed, cm, n, co) {
         var t = this, p, de = 0, v, c, s = t.settings;
      _nodeChanged : function(ed, cm, n, co, ob) {
         var t = this, p, de = 0, v, c, s = t.settings, cl, fz, fn, formatNames, matches;
         tinymce.each(t.stateControls, function(c) {
            cm.setActive(c, ed.queryCommandState(t.controls[c][1]));
         });
         function getParent(name) {
            var i, parents = ob.parents, func = name;
            if (typeof(name) == 'string') {
               func = function(node) {
                  return node.nodeName == name;
               };
            }
            for (i = 0; i < parents.length; i++) {
               if (func(parents[i]))
                  return parents[i];
            }
         };
         cm.setActive('visualaid', ed.hasVisual);
         cm.setDisabled('undo', !ed.undoManager.hasUndo() && !ed.typing);
         cm.setDisabled('redo', !ed.undoManager.hasRedo());
         cm.setDisabled('outdent', !ed.queryCommandState('Outdent'));
         p = DOM.getParent(n, 'A');
         p = getParent('A');
         if (c = cm.get('link')) {
            if (!p || !p.name) {
               c.setDisabled(!p && co);
@@ -767,53 +879,86 @@
         if (c = cm.get('anchor')) {
            c.setActive(!!p && p.name);
            if (tinymce.isWebKit) {
               p = DOM.getParent(n, 'IMG');
               c.setActive(!!p && DOM.getAttrib(p, 'mce_name') == 'a');
            }
         }
         p = DOM.getParent(n, 'IMG');
         p = getParent('IMG');
         if (c = cm.get('image'))
            c.setActive(!!p && n.className.indexOf('mceItem') == -1);
         if (c = cm.get('styleselect')) {
            if (n.className) {
               t._importClasses();
               c.select(n.className);
            } else
               c.select();
            t._importClasses();
            formatNames = [];
            each(c.items, function(item) {
               formatNames.push(item.value);
            });
            matches = ed.formatter.matchAll(formatNames);
            c.select(matches[0]);
         }
         if (c = cm.get('formatselect')) {
            p = DOM.getParent(n, DOM.isBlock);
            p = getParent(DOM.isBlock);
            if (p)
               c.select(p.nodeName.toLowerCase());
         }
         if (c = cm.get('fontselect'))
            c.select(ed.queryCommandValue('FontName'));
         // Find out current fontSize, fontFamily and fontClass
         getParent(function(n) {
            if (n.nodeName === 'SPAN') {
               if (!cl && n.className)
                  cl = n.className;
         if (c = cm.get('fontsizeselect'))
            c.select(ed.queryCommandValue('FontSize'));
               if (!fz && n.style.fontSize)
                  fz = n.style.fontSize;
               if (!fn && n.style.fontFamily)
                  fn = n.style.fontFamily.replace(/[\"\']+/g, '').replace(/^([^,]+).*/, '$1').toLowerCase();
            }
            return false;
         });
         if (c = cm.get('fontselect')) {
            c.select(function(v) {
               return v.replace(/^([^,]+).*/, '$1').toLowerCase() == fn;
            });
         }
         // Select font size
         if (c = cm.get('fontsizeselect')) {
            // Use computed style
            if (s.theme_advanced_runtime_fontsize && !fz && !cl)
               fz = ed.dom.getStyle(n, 'fontSize', true);
            c.select(function(v) {
               if (v.fontSize && v.fontSize === fz)
                  return true;
               if (v['class'] && v['class'] === cl)
                  return true;
            });
         }
         if (s.theme_advanced_path && s.theme_advanced_statusbar_location) {
            p = DOM.get(ed.id + '_path') || DOM.add(ed.id + '_path_row', 'span', {id : ed.id + '_path'});
            DOM.setHTML(p, '');
            ed.dom.getParent(n, function(n) {
            getParent(function(n) {
               var na = n.nodeName.toLowerCase(), u, pi, ti = '';
               /*if (n.getAttribute('_mce_bogus'))
                  return;
*/
               // Ignore non element and hidden elements
               if (n.nodeType != 1 || (DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved')))
               if (n.nodeType != 1 || n.nodeName === 'BR' || (DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved')))
                  return;
               // Fake name
               if (v = DOM.getAttrib(n, 'mce_name'))
                  na = v;
               // Handle prefix
               if (tinymce.isIE && n.scopeName !== 'HTML')
                  na = n.scopeName + ':' + na;
@@ -849,9 +994,6 @@
                     break;
                  case 'font':
                     if (s.convert_fonts_to_spans)
                        na = 'span';
                     if (v = DOM.getAttrib(n, 'face'))
                        ti += 'font: ' + v + ' ';
@@ -874,9 +1016,9 @@
                  ti += 'id: ' + v + ' ';
               if (v = n.className) {
                  v = v.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g, '');
                  v = v.replace(/\b\s*(webkit|mce|Apple-)\w+\s*\b/g, '')
                  if (v && v.indexOf('mceItem') == -1) {
                  if (v) {
                     ti += 'class: ' + v + ' ';
                     if (DOM.isBlock(n) || na == 'img' || na == 'span')
@@ -1023,7 +1165,9 @@
         var t = this;
         this._mceColorPicker(0, {
            color: t.fgColor,
            func : function(co) {
               t.fgColor = co;
               t.editor.execCommand('ForeColor', false, co);
            }
         });
@@ -1033,7 +1177,9 @@
         var t = this;
         this._mceColorPicker(0, {
            color: t.bgColor,
            func : function(co) {
               t.bgColor = co;
               t.editor.execCommand('HiliteColor', false, co);
            }
         });
@@ -1045,4 +1191,4 @@
   });
   tinymce.ThemeManager.add('advanced', tinymce.themes.AdvancedTheme);
}());
}(tinymce));