Skip to content
Snippets Groups Projects
overview-summary-TinyMCE_Control.class.js.html 85.5 KiB
Newer Older
  • Learn to ignore specific revisions
  • 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000
    <!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
    <html>
    <head>
    <title>
     Overview
    </title>
    <link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
    <script>
    function asd() {
    	
    		parent.document.title="TinyMCE_Control.class.js Overview";
    	
    }
    </script>
    </head>
    <body bgcolor="white" onload="asd();">
    
    <!-- ========== START OF NAVBAR ========== -->
    <a name="navbar_top"><!-- --></a>
    <table border="0" width="100%" cellpadding="1" cellspacing="0">
    <tr>
    <td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
    <a name="navbar_top_firstrow"><!-- --></a>
    <table border="0" cellpadding="0" cellspacing="3">
      <tr align="center" valign="top">
      
      
      <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
      <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
      
    
      <td bgcolor="#FFFFFF" class="NavBarCell1"> 	<font class="NavBarFont1">Class</font>&nbsp;</td>
      <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
      <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
      <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
      </tr>
    </table>
    </td>
    <td bgcolor="#EEEEFF" align="right" valign="top">
    <em>
    <b></b></em>
    </td>
    </tr>
    
    <tr>
    <td bgcolor="white" class="NavBarCell2"><font size="-2">
    &nbsp;PREV&nbsp;
    &nbsp;NEXT</font></td>
    <td bgcolor="white" class="NavBarCell2"><font size="-2">
      <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
    &nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
    &nbsp;&nbsp;
    <script>
      <!--
      if(window==top) {
        document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
      }
      //-->
    </script>
    <noscript>
    <a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
    </noscript>
    </font></td>
    </tr>
    </table>
    <!-- =========== END OF NAVBAR =========== -->
    
    <hr>
    <center>
    	
    	   <h2>TinyMCE_Control.class.js</h2>
    	
    </center>
    
    	
    
    
    <h4>Summary</h4>
    <p>
    	
    		No overview generated for 'TinyMCE_Control.class.js'<BR/><BR/>
    	
    </p>
    
    <hr>
    
    
        <table border="1" cellpadding="3" cellspacing="0" width="100%">
        <tr bgcolor="#CCCCFF" class="TableHeadingColor">
        <td colspan=2><font size="+2">
        
            <b>Class Summary</b>
        
        </font></td>
        </tr>
        
        <tr bgcolor="white" class="TableRowColor">
        <td width="15%"><b><a href="TinyMCE_Control.html">TinyMCE_Control</a></b></td>
        <td>&nbsp;</td>
        </tr>
        
        </table>
        <hr/> 
    
    
    <!-- ========== METHOD SUMMARY =========== -->
    
    <!-- ========== END METHOD SUMMARY =========== -->
    
    
            <pre class="sourceview"><span class="comment">/**
     * $RCSfile: overview-summary-TinyMCE_Control.class.js.html,v $
     * $Revision: 1.42 $
     * $Date: 2006/04/14 20:00:28 $
     *
     * <span class="attrib">@author</span> Moxiecode
     * <span class="attrib">@copyright</span> Copyright  2004-2006, Moxiecode Systems AB, All rights reserved.
     */</span>
    
    <span class="comment">/**
     * This is the TinyMCE editor control instance class. A instance of this class will is made for each
     * converted text area.
     *
     * <span class="attrib">@constructor</span>
     * <span class="attrib">@param</span> {Array} settings Name/Value array of instance specific configuration settings.
     */</span>
    <span class="reserved">function</span> TinyMCE_Control(settings) {
    	var t, i, to, fu, p, x, fn, fu, pn, s = settings;
    
    	<span class="reserved">this</span>.undoRedoLevel = true;
    	<span class="reserved">this</span>.isTinyMCE_Control = true;
    
    	<span class="comment">// Default settings</span>
    	<span class="reserved">this</span>.settings = s;
    	<span class="reserved">this</span>.settings[<span class="literal">'theme'</span>] = tinyMCE.getParam(<span class="literal">"theme"</span>, <span class="literal">"default"</span>);
    	<span class="reserved">this</span>.settings[<span class="literal">'width'</span>] = tinyMCE.getParam(<span class="literal">"width"</span>, -1);
    	<span class="reserved">this</span>.settings[<span class="literal">'height'</span>] = tinyMCE.getParam(<span class="literal">"height"</span>, -1);
    	<span class="reserved">this</span>.selection = new TinyMCE_Selection(<span class="reserved">this</span>);
    	<span class="reserved">this</span>.undoRedo = new TinyMCE_UndoRedo(<span class="reserved">this</span>);
    	<span class="reserved">this</span>.cleanup = new TinyMCE_Cleanup();
    	<span class="reserved">this</span>.shortcuts = new Array();
    	<span class="reserved">this</span>.hasMouseMoved = false;
    
    	<span class="reserved">this</span>.cleanup.init({
    		valid_elements : s.valid_elements,
    		extended_valid_elements : s.extended_valid_elements,
    		entities : s.entities,
    		entity_encoding : s.entity_encoding,
    		debug : s.cleanup_debug,
    		url_converter : <span class="literal">'TinyMCE_Cleanup.prototype._urlConverter'</span>,
    		indent : s.apply_source_formatting,
    		invalid_elements : s.invalid_elements,
    		verify_html : s.verify_html,
    		fix_content_duplication : s.fix_content_duplication
    	});
    
    	<span class="comment">// Wrap old theme</span>
    	t = <span class="reserved">this</span>.settings[<span class="literal">'theme'</span>];
    	<span class="reserved">if</span> (!tinyMCE.hasTheme(t)) {
    		fn = tinyMCE.callbacks;
    		to = {};
    
    		<span class="reserved">for</span> (i=0; i&lt;fn.length; i++) {
    			<span class="reserved">if</span> ((fu = window[<span class="literal">'TinyMCE_'</span> + t + <span class="literal">"_"</span> + fn[i]]))
    				to[fn[i]] = fu;
    		}
    
    		tinyMCE.addTheme(t, to);
    	}
    
    	<span class="comment">// Wrap old plugins</span>
    	<span class="reserved">this</span>.plugins = new Array();
    	p = tinyMCE.getParam(<span class="literal">'plugins'</span>, <span class="literal">''</span>, true, <span class="literal">','</span>);
    	<span class="reserved">if</span> (p.length &gt; 0) {
    		<span class="reserved">for</span> (i=0; i&lt;p.length; i++) {
    			pn = p[i];
    
    			<span class="reserved">if</span> (pn.charAt(0) == <span class="literal">'-'</span>)
    				pn = pn.substring(1);
    
    			<span class="reserved">if</span> (!tinyMCE.hasPlugin(pn)) {
    				fn = tinyMCE.callbacks;
    				to = {};
    
    				<span class="reserved">for</span> (x=0; x&lt;fn.length; x++) {
    					<span class="reserved">if</span> ((fu = window[<span class="literal">'TinyMCE_'</span> + pn + <span class="literal">"_"</span> + fn[x]]))
    						to[fn[x]] = fu;
    				}
    
    				tinyMCE.addPlugin(pn, to);
    			}
    
    			<span class="reserved">this</span>.plugins[<span class="reserved">this</span>.plugins.length] = pn; 
    		}
    	}
    };
    
    TinyMCE_Control.<span class="reserved">prototype</span> = {
    	<span class="comment">/**
    	 * Returns true/false if the instance has the current plugin available.
    	 *
    	 * <span class="attrib">@param</span> {string} n Plugin name to check for.
    	 * <span class="attrib">@return</span> true/false if the instance has the current plugin available.
    	 * <span class="attrib">@type</span> boolean
    	 */</span>
    	hasPlugin : <span class="reserved">function</span>(n) {
    		var i;
    
    		<span class="reserved">for</span> (i=0; i&lt;<span class="reserved">this</span>.plugins.length; i++) {
    			<span class="reserved">if</span> (<span class="reserved">this</span>.plugins[i] == n)
    				<span class="reserved">return</span> true;
    		}
    
    		<span class="reserved">return</span> false;
    	},
    
    	<span class="comment">/**
    	 * Adds a plugin to the editor instance. This will also add it globaly.
    	 *
    	 * <span class="attrib">@param</span> {string} n Plugin name to check for.
    	 * <span class="attrib">@param</span> {TinyMCE_Plugin} n TinyMCE plugin instance.
    	 */</span>
    	addPlugin : <span class="reserved">function</span>(n, p) {
    		<span class="reserved">if</span> (!<span class="reserved">this</span>.hasPlugin(n)) {
    			tinyMCE.addPlugin(n, p);
    			<span class="reserved">this</span>.plugins[<span class="reserved">this</span>.plugins.length] = n;
    		}
    	},
    
    	<span class="comment">/**
    	 * Repaints the editarea in Gecko browsers. This method removes ghost resize handlers
    	 * and other trailing graphics.
    	 */</span>
    	repaint : <span class="reserved">function</span>() {
    		<span class="reserved">if</span> (tinyMCE.isMSIE &amp;&amp; !tinyMCE.isOpera)
    			<span class="reserved">return</span>;
    
    		try {
    			var s = <span class="reserved">this</span>.selection;
    			var b = s.getBookmark(true);
    			<span class="reserved">this</span>.getBody().style.display = <span class="literal">'none'</span>;
    			<span class="reserved">this</span>.getDoc().execCommand(<span class="literal">'selectall'</span>, false, null);
    			<span class="reserved">this</span>.getSel().collapseToStart();
    			<span class="reserved">this</span>.getBody().style.display = <span class="literal">'block'</span>;
    			s.moveToBookmark(b);
    		} catch (ex) {
    			<span class="comment">// Ignore</span>
    		}
    	},
    
    	<span class="comment">/**
    	 * Switches the global TinyMCE settings to the current instance settings. This method is
    	 * used to handle multiple configurations.
    	 */</span>
    	switchSettings : <span class="reserved">function</span>() {
    		<span class="reserved">if</span> (tinyMCE.configs.length &gt; 1 &amp;&amp; tinyMCE.currentConfig != <span class="reserved">this</span>.settings[<span class="literal">'index'</span>]) {
    			tinyMCE.settings = <span class="reserved">this</span>.settings;
    			tinyMCE.currentConfig = <span class="reserved">this</span>.settings[<span class="literal">'index'</span>];
    		}
    	},
    
    	<span class="comment">/**
    	 * Returns the body element of a editor instance.
    	 *
    	 * <span class="attrib">@return</span> Body element of a editor instance.
    	 * <span class="attrib">@type</span> HTMLElement
    	 */</span>
    	getBody : <span class="reserved">function</span>() {
    		<span class="reserved">return</span> <span class="reserved">this</span>.getDoc().body;
    	},
    
    	<span class="comment">/**
    	 * Returns the DOM document of a editor instance.
    	 *
    	 * <span class="attrib">@return</span> DOM document of a editor instance.
    	 * <span class="attrib">@type</span> DOMDocument
    	 */</span>
    	getDoc : <span class="reserved">function</span>() {
    		<span class="reserved">return</span> <span class="reserved">this</span>.contentWindow.document;
    	},
    
    	<span class="comment">/**
    	 * Returns the window of a editor instance.
    	 *
    	 * <span class="attrib">@return</span> Window of a editor instance.
    	 * <span class="attrib">@type</span> Window
    	 */</span>
    	getWin : <span class="reserved">function</span>() {
    		<span class="reserved">return</span> <span class="reserved">this</span>.contentWindow;
    	},
    
    	<span class="comment">/**
    	 * Adds a keyboard shortcut to a specific command. These shortcuts can for example be added
    	 * at the initInstance callback of a plugin. The shortcut description can be a language variable name
    	 * or a string describing the function. If you don't specify a command, the shortcut will simply be a blocker
    	 * shortcut. This enables you to remove built in shortcuts or remove theme specific shortcuts from a plugin.&lt;br /&gt;
    	 * Example shortcut inst.addShortcut('ctrl,alt', 'k', 'mceSomeCommand', false, 'somevalue');
    	 * Example blocker inst.addShortcut('ctrl,alt', 'k');
    	 *
    	 * <span class="attrib">@param</span> {string} m List of shortcut modifiers keys, for example "ctrl,alt".
    	 * <span class="attrib">@param</span> {Object} k Shortcut key char for example "s" or a keycode value "13".
    	 * <span class="attrib">@param</span> {string} d Optional Shortcut description, this will be presented in the about dialog.
    	 * <span class="attrib">@param</span> {string} cmd Optional Command name to execute, for example mceLink or Bold.
    	 * <span class="attrib">@param</span> {boolean} ui Optional True/false state if a UI (dialog) should be presented or not.
    	 * <span class="attrib">@param</span> {Object} va Optional command value, this can be anything.
    	 * <span class="attrib">@return</span> true/false if the shortcut was added or not
    	 * <span class="attrib">@type</span> boolean
    	 */</span>
    	addShortcut : <span class="reserved">function</span>(m, k, d, cmd, ui, va) {
    		var n = typeof(k) == <span class="literal">"number"</span>, ie = tinyMCE.isMSIE, c, sc, i;
    		var scl = <span class="reserved">this</span>.shortcuts;
    
    		<span class="reserved">if</span> (!tinyMCE.getParam(<span class="literal">'custom_shortcuts'</span>))
    			<span class="reserved">return</span> false;
    
    		m = m.toLowerCase();
    		k = ie &amp;&amp; !n ? k.toUpperCase() : k;
    		c = n ? null : k.charCodeAt(0);
    		d = d &amp;&amp; d.indexOf(<span class="literal">'lang_'</span>) == 0 ? tinyMCE.getLang(d) : d;
    
    		sc = {
    			alt : m.indexOf(<span class="literal">'alt'</span>) != -1,
    			ctrl : m.indexOf(<span class="literal">'ctrl'</span>) != -1,
    			shift : m.indexOf(<span class="literal">'shift'</span>) != -1,
    			charCode : c,
    			keyCode : n ? k : (ie ? c : null),
    			desc : d,
    			cmd : cmd,
    			ui : ui,
    			val : va
    		};
    
    		<span class="reserved">for</span> (i=0; i&lt;scl.length; i++) {
    			<span class="reserved">if</span> (sc.alt == scl[i].alt &amp;&amp; sc.ctrl == scl[i].ctrl &amp;&amp; sc.shift == scl[i].shift
    				&amp;&amp; sc.charCode == scl[i].charCode &amp;&amp; sc.keyCode == scl[i].keyCode) {
    				<span class="reserved">return</span> false;
    			}
    		}
    
    		scl[scl.length] = sc;
    
    		<span class="reserved">return</span> true;
    	},
    
    	<span class="comment">/**
    	 * Executes shortcuts based on the event information.
    	 *
    	 * <span class="attrib">@param</span> {DOMEvent} e Keyboard event to handle.
    	 * <span class="attrib">@return</span> true/false if the shortcut was found and executed or not.
    	 * <span class="attrib">@type</span> boolean
    	 */</span>
    	handleShortcut : <span class="reserved">function</span>(e) {
    		var i, s = <span class="reserved">this</span>.shortcuts, o;
    
    		<span class="reserved">for</span> (i=0; i&lt;s.length; i++) {
    			o = s[i];
    			<span class="reserved">if</span> (o.alt == e.altKey &amp;&amp; o.ctrl == e.ctrlKey &amp;&amp; (o.keyCode == e.keyCode || o.charCode == e.charCode)) {
    				<span class="reserved">if</span> (o.cmd &amp;&amp; (e.type == <span class="literal">"keydown"</span> || (e.type == <span class="literal">"keypress"</span> &amp;&amp; !tinyMCE.isOpera)))
    					tinyMCE.execCommand(o.cmd, o.ui, o.val);
    
    				tinyMCE.cancelEvent(e);
    				<span class="reserved">return</span> true;
    			}
    		}
    
    		<span class="reserved">return</span> false;
    	},
    
    	<span class="comment">/**
    	 * Auto resets the design mode of the document if it gets lost.
    	 * This is a Gecko specific function since it's a workaround for a bug where Gecko browsers
    	 * loose the designMode state if the editor is hidden and shown in a tab or div.
    	 */</span>
    	autoResetDesignMode : <span class="reserved">function</span>() {
    		<span class="comment">// Add fix for tab/style.display none/block problems in Gecko</span>
    		<span class="reserved">if</span> (!tinyMCE.isMSIE &amp;&amp; <span class="reserved">this</span>.isHidden() &amp;&amp; tinyMCE.getParam(<span class="literal">'auto_reset_designmode'</span>))
    			eval(<span class="literal">'try { this.getDoc().designMode = "On"; } catch(e) {}'</span>);
    	},
    
    	<span class="comment">/**
    	 * Returns if the instance is hidden or not. This is a Gecko specific function
    	 * other browsers will always return false. This function is used to workaround the lost
    	 * designMode bug in Gecko browsers.
    	 *
    	 * <span class="attrib">@return</span> Returns if the instance is hidden or not.
    	 * <span class="attrib">@type</span> boolean
    	 */</span>
    	isHidden : <span class="reserved">function</span>() {
    		<span class="reserved">if</span> (tinyMCE.isMSIE)
    			<span class="reserved">return</span> false;
    
    		var s = <span class="reserved">this</span>.getSel();
    
    		<span class="comment">// Weird, wheres that cursor selection?</span>
    		<span class="reserved">return</span> (!s || !s.rangeCount || s.rangeCount == 0);
    	},
    
    	<span class="comment">/**
    	 * Returns true/false if the editor instance is dirty or not. In other words if it has been modified
    	 * or not.
    	 *
    	 * <span class="attrib">@return</span> Editor instance dirty state.
    	 * <span class="attrib">@type</span> boolean
    	 */</span>
    	isDirty : <span class="reserved">function</span>() {
    		<span class="comment">// Is content modified and not in a submit procedure</span>
    		<span class="reserved">return</span> <span class="reserved">this</span>.startContent != tinyMCE.trim(<span class="reserved">this</span>.getBody().innerHTML) &amp;&amp; !tinyMCE.isNotDirty;
    	},
    
    	<span class="comment">/**
    	 * ..
    	 *
    	 * <span class="attrib">@private</span>
    	 */</span>
    	_mergeElements : <span class="reserved">function</span>(scmd, pa, ch, override) {
    		<span class="reserved">if</span> (scmd == <span class="literal">"removeformat"</span>) {
    			pa.className = <span class="literal">""</span>;
    			pa.style.cssText = <span class="literal">""</span>;
    			ch.className = <span class="literal">""</span>;
    			ch.style.cssText = <span class="literal">""</span>;
    			<span class="reserved">return</span>;
    		}
    
    		var st = tinyMCE.parseStyle(tinyMCE.getAttrib(pa, <span class="literal">"style"</span>));
    		var stc = tinyMCE.parseStyle(tinyMCE.getAttrib(ch, <span class="literal">"style"</span>));
    		var className = tinyMCE.getAttrib(pa, <span class="literal">"class"</span>);
    
    		className += <span class="literal">" "</span> + tinyMCE.getAttrib(ch, <span class="literal">"class"</span>);
    
    		<span class="reserved">if</span> (override) {
    			<span class="reserved">for</span> (var n in st) {
    				<span class="reserved">if</span> (typeof(st[n]) == <span class="literal">'function'</span>)
    					continue;
    
    				stc[n] = st[n];
    			}
    		} <span class="reserved">else</span> {
    			<span class="reserved">for</span> (var n in stc) {
    				<span class="reserved">if</span> (typeof(stc[n]) == <span class="literal">'function'</span>)
    					continue;
    
    				st[n] = stc[n];
    			}
    		}
    
    		tinyMCE.setAttrib(pa, <span class="literal">"style"</span>, tinyMCE.serializeStyle(st));
    		tinyMCE.setAttrib(pa, <span class="literal">"class"</span>, tinyMCE.trim(className));
    		ch.className = <span class="literal">""</span>;
    		ch.style.cssText = <span class="literal">""</span>;
    		ch.removeAttribute(<span class="literal">"class"</span>);
    		ch.removeAttribute(<span class="literal">"style"</span>);
    	},
    
    	<span class="comment">/**
    	 * Sets the useCSS mode in Gecko browsers. This will also remove the build in
    	 * inline table editing controls since they are buggy when it comes to col/rowspans.
    	 *
    	 * <span class="attrib">@param</span> {boolean} b UseCSS state true/false.
    	 * <span class="attrib">@private</span>
    	 */</span>
    	_setUseCSS : <span class="reserved">function</span>(b) {
    		var d = <span class="reserved">this</span>.getDoc();
    
    		try {d.execCommand(<span class="literal">"useCSS"</span>, false, !b);} catch (ex) {}
    		try {d.execCommand(<span class="literal">"styleWithCSS"</span>, false, b);} catch (ex) {}
    
    		<span class="reserved">if</span> (!tinyMCE.getParam(<span class="literal">"table_inline_editing"</span>))
    			try {d.execCommand(<span class="literal">'enableInlineTableEditing'</span>, false, <span class="literal">"false"</span>);} catch (ex) {}
    
    		<span class="reserved">if</span> (!tinyMCE.getParam(<span class="literal">"object_resizing"</span>))
    			try {d.execCommand(<span class="literal">'enableObjectResizing'</span>, false, <span class="literal">"false"</span>);} catch (ex) {}
    	},
    
    	<span class="comment">/**
    	 * Executes a command on the current instance. These commands can be TinyMCE internal commands prefixed with "mce" or
    	 * they can be build in browser commands such as "Bold". A compleate list of browser commands is available on MSDN or Mozilla.org.
    	 * This function will dispatch the execCommand function on each plugin, theme or the execcommand_callback option if none of these
    	 * return true it will handle the command as a internal browser command.
    	 *
    	 * <span class="attrib">@param</span> {string} command Command name to execute, for example mceLink or Bold.
    	 * <span class="attrib">@param</span> {boolean} user_interface True/false state if a UI (dialog) should be presented or not.
    	 * <span class="attrib">@param</span> {mixed} value Optional command value, this can be anything.
    	 */</span>
    	execCommand : <span class="reserved">function</span>(command, user_interface, value) {
    		var doc = <span class="reserved">this</span>.getDoc();
    		var win = <span class="reserved">this</span>.getWin();
    		var focusElm = <span class="reserved">this</span>.getFocusElement();
    
    		<span class="comment">// Is non udno specific command</span>
    		<span class="reserved">if</span> (!new RegExp(<span class="literal">'mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel'</span>, <span class="literal">'gi'</span>).test(command))
    			<span class="reserved">this</span>.undoBookmark = null;
    
    		<span class="reserved">if</span> (<span class="reserved">this</span>.lastSafariSelection &amp;&amp; !new RegExp(<span class="literal">'mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel'</span>, <span class="literal">'gi'</span>).test(command)) {
    			<span class="reserved">this</span>.selection.moveToBookmark(<span class="reserved">this</span>.lastSafariSelection);
    			tinyMCE.selectedElement = <span class="reserved">this</span>.lastSafariSelectedElement;
    		}
    
    		<span class="comment">// Mozilla issue</span>
    		<span class="reserved">if</span> (!tinyMCE.isMSIE &amp;&amp; !<span class="reserved">this</span>.useCSS) {
    			<span class="reserved">this</span>._setUseCSS(false);
    			<span class="reserved">this</span>.useCSS = true;
    		}
    
    		<span class="comment">//debug("command: " + command + ", user_interface: " + user_interface + ", value: " + value);</span>
    		<span class="reserved">this</span>.contentDocument = doc; <span class="comment">// &lt;-- Strange, unless this is applied Mozilla 1.3 breaks</span>
    
    		<span class="reserved">if</span> (tinyMCE.execCommandCallback(<span class="reserved">this</span>, <span class="literal">'execcommand_callback'</span>, <span class="literal">'execCommand'</span>, <span class="reserved">this</span>.editorId, <span class="reserved">this</span>.getBody(), command, user_interface, value))
    			<span class="reserved">return</span>;
    
    		<span class="comment">// Fix align on images</span>
    		<span class="reserved">if</span> (focusElm &amp;&amp; focusElm.nodeName == <span class="literal">"IMG"</span>) {
    			var align = focusElm.getAttribute(<span class="literal">'align'</span>);
    			var img = command == <span class="literal">"JustifyCenter"</span> ? focusElm.cloneNode(false) : focusElm;
    
    			switch (command) {
    				case <span class="literal">"JustifyLeft"</span>:
    					<span class="reserved">if</span> (align == <span class="literal">'left'</span>)
    						img.removeAttribute(<span class="literal">'align'</span>);
    					<span class="reserved">else</span>
    						img.setAttribute(<span class="literal">'align'</span>, <span class="literal">'left'</span>);
    
    					<span class="comment">// Remove the div</span>
    					var div = focusElm.parentNode;
    					<span class="reserved">if</span> (div &amp;&amp; div.nodeName == <span class="literal">"DIV"</span> &amp;&amp; div.childNodes.length == 1 &amp;&amp; div.parentNode)
    						div.parentNode.replaceChild(img, div);
    
    					<span class="reserved">this</span>.selection.selectNode(img);
    					<span class="reserved">this</span>.repaint();
    					tinyMCE.triggerNodeChange();
    					<span class="reserved">return</span>;
    
    				case <span class="literal">"JustifyCenter"</span>:
    					img.removeAttribute(<span class="literal">'align'</span>);
    
    					<span class="comment">// Is centered</span>
    					var div = tinyMCE.getParentElement(focusElm, <span class="literal">"div"</span>);
    					<span class="reserved">if</span> (div &amp;&amp; div.style.textAlign == <span class="literal">"center"</span>) {
    						<span class="comment">// Remove div</span>
    						<span class="reserved">if</span> (div.nodeName == <span class="literal">"DIV"</span> &amp;&amp; div.childNodes.length == 1 &amp;&amp; div.parentNode)
    							div.parentNode.replaceChild(img, div);
    					} <span class="reserved">else</span> {
    						<span class="comment">// Add div</span>
    						var div = <span class="reserved">this</span>.getDoc().createElement(<span class="literal">"div"</span>);
    						div.style.textAlign = <span class="literal">'center'</span>;
    						div.appendChild(img);
    						focusElm.parentNode.replaceChild(div, focusElm);
    					}
    
    					<span class="reserved">this</span>.selection.selectNode(img);
    					<span class="reserved">this</span>.repaint();
    					tinyMCE.triggerNodeChange();
    					<span class="reserved">return</span>;
    
    				case <span class="literal">"JustifyRight"</span>:
    					<span class="reserved">if</span> (align == <span class="literal">'right'</span>)
    						img.removeAttribute(<span class="literal">'align'</span>);
    					<span class="reserved">else</span>
    						img.setAttribute(<span class="literal">'align'</span>, <span class="literal">'right'</span>);
    
    					<span class="comment">// Remove the div</span>
    					var div = focusElm.parentNode;
    					<span class="reserved">if</span> (div &amp;&amp; div.nodeName == <span class="literal">"DIV"</span> &amp;&amp; div.childNodes.length == 1 &amp;&amp; div.parentNode)
    						div.parentNode.replaceChild(img, div);
    
    					<span class="reserved">this</span>.selection.selectNode(img);
    					<span class="reserved">this</span>.repaint();
    					tinyMCE.triggerNodeChange();
    					<span class="reserved">return</span>;
    			}
    		}
    
    		<span class="reserved">if</span> (tinyMCE.settings[<span class="literal">'force_br_newlines'</span>]) {
    			var alignValue = <span class="literal">""</span>;
    
    			<span class="reserved">if</span> (doc.selection.type != <span class="literal">"Control"</span>) {
    				switch (command) {
    						case <span class="literal">"JustifyLeft"</span>:
    							alignValue = <span class="literal">"left"</span>;
    							break;
    
    						case <span class="literal">"JustifyCenter"</span>:
    							alignValue = <span class="literal">"center"</span>;
    							break;
    
    						case <span class="literal">"JustifyFull"</span>:
    							alignValue = <span class="literal">"justify"</span>;
    							break;
    
    						case <span class="literal">"JustifyRight"</span>:
    							alignValue = <span class="literal">"right"</span>;
    							break;
    				}
    
    				<span class="reserved">if</span> (alignValue != <span class="literal">""</span>) {
    					var rng = doc.selection.createRange();
    
    					<span class="reserved">if</span> ((divElm = tinyMCE.getParentElement(rng.parentElement(), <span class="literal">"div"</span>)) != null)
    						divElm.setAttribute(<span class="literal">"align"</span>, alignValue);
    					<span class="reserved">else</span> <span class="reserved">if</span> (rng.pasteHTML &amp;&amp; rng.htmlText.length &gt; 0)
    						rng.pasteHTML(<span class="literal">'&lt;div align="'</span> + alignValue + <span class="literal">'"&gt;'</span> + rng.htmlText + <span class="literal">"&lt;/div&gt;"</span>);
    
    					tinyMCE.triggerNodeChange();
    					<span class="reserved">return</span>;
    				}
    			}
    		}
    
    		switch (command) {
    			case <span class="literal">"mceRepaint"</span>:
    				<span class="reserved">this</span>.repaint();
    				<span class="reserved">return</span> true;
    
    			case <span class="literal">"InsertUnorderedList"</span>:
    			case <span class="literal">"InsertOrderedList"</span>:
    				var tag = (command == <span class="literal">"InsertUnorderedList"</span>) ? <span class="literal">"ul"</span> : <span class="literal">"ol"</span>;
    
    				<span class="reserved">if</span> (tinyMCE.isSafari)
    					<span class="reserved">this</span>.execCommand(<span class="literal">"mceInsertContent"</span>, false, <span class="literal">"&lt;"</span> + tag + <span class="literal">"&gt;&lt;li&gt;&amp;nbsp;&lt;/li&gt;&lt;"</span> + tag + <span class="literal">"&gt;"</span>);
    				<span class="reserved">else</span>
    					<span class="reserved">this</span>.getDoc().execCommand(command, user_interface, value);
    
    				tinyMCE.triggerNodeChange();
    				break;
    
    			case <span class="literal">"Strikethrough"</span>:
    				<span class="reserved">if</span> (tinyMCE.isSafari)
    					<span class="reserved">this</span>.execCommand(<span class="literal">"mceInsertContent"</span>, false, <span class="literal">"&lt;strike&gt;"</span> + <span class="reserved">this</span>.selection.getSelectedHTML() + <span class="literal">"&lt;/strike&gt;"</span>);
    				<span class="reserved">else</span>
    					<span class="reserved">this</span>.getDoc().execCommand(command, user_interface, value);
    
    				tinyMCE.triggerNodeChange();
    				break;
    
    			case <span class="literal">"mceSelectNode"</span>:
    				<span class="reserved">this</span>.selection.selectNode(value);
    				tinyMCE.triggerNodeChange();
    				tinyMCE.selectedNode = value;
    				break;
    
    			case <span class="literal">"FormatBlock"</span>:
    				<span class="reserved">if</span> (value == null || value == <span class="literal">""</span>) {
    					var elm = tinyMCE.getParentElement(<span class="reserved">this</span>.getFocusElement(), <span class="literal">"p,div,h1,h2,h3,h4,h5,h6,pre,address,blockquote,dt,dl,dd,samp"</span>);
    
    					<span class="reserved">if</span> (elm)
    						<span class="reserved">this</span>.execCommand(<span class="literal">"mceRemoveNode"</span>, false, elm);
    				} <span class="reserved">else</span> {
    					<span class="reserved">if</span> (tinyMCE.isGecko &amp;&amp; new RegExp(<span class="literal">'&lt;(div|blockquote|code|dt|dd|dl|samp)&gt;'</span>, <span class="literal">'gi'</span>).test(value))
    						value = value.replace(/[^a-z]/gi, <span class="literal">''</span>);
    
    					<span class="reserved">if</span> (tinyMCE.isMSIE &amp;&amp; new RegExp(<span class="literal">'blockquote|code|samp'</span>, <span class="literal">'gi'</span>).test(value)) {
    						var b = <span class="reserved">this</span>.selection.getBookmark();
    						<span class="reserved">this</span>.getDoc().execCommand(<span class="literal">"FormatBlock"</span>, false, <span class="literal">'&lt;p&gt;'</span>);
    						tinyMCE.renameElement(tinyMCE.getParentBlockElement(<span class="reserved">this</span>.getFocusElement()), value);
    						<span class="reserved">this</span>.selection.moveToBookmark(b);
    					} <span class="reserved">else</span>
    						<span class="reserved">this</span>.getDoc().execCommand(<span class="literal">"FormatBlock"</span>, false, value);
    				}
    
    				tinyMCE.triggerNodeChange();
    
    				break;
    
    			case <span class="literal">"mceRemoveNode"</span>:
    				<span class="reserved">if</span> (!value)
    					value = tinyMCE.getParentElement(<span class="reserved">this</span>.getFocusElement());
    
    				<span class="reserved">if</span> (tinyMCE.isMSIE) {
    					value.outerHTML = value.innerHTML;
    				} <span class="reserved">else</span> {
    					var rng = value.ownerDocument.createRange();
    					rng.setStartBefore(value);
    					rng.setEndAfter(value);
    					rng.deleteContents();
    					rng.insertNode(rng.createContextualFragment(value.innerHTML));
    				}
    
    				tinyMCE.triggerNodeChange();
    
    				break;
    
    			case <span class="literal">"mceSelectNodeDepth"</span>:
    				var parentNode = <span class="reserved">this</span>.getFocusElement();
    				<span class="reserved">for</span> (var i=0; parentNode; i++) {
    					<span class="reserved">if</span> (parentNode.nodeName.toLowerCase() == <span class="literal">"body"</span>)
    						break;
    
    					<span class="reserved">if</span> (parentNode.nodeName.toLowerCase() == <span class="literal">"#text"</span>) {
    						i--;
    						parentNode = parentNode.parentNode;
    						continue;
    					}
    
    					<span class="reserved">if</span> (i == value) {
    						<span class="reserved">this</span>.selection.selectNode(parentNode, false);
    						tinyMCE.triggerNodeChange();
    						tinyMCE.selectedNode = parentNode;
    						<span class="reserved">return</span>;
    					}
    
    					parentNode = parentNode.parentNode;
    				}
    
    				break;
    
    			case <span class="literal">"SetStyleInfo"</span>:
    				var rng = <span class="reserved">this</span>.getRng();
    				var sel = <span class="reserved">this</span>.getSel();
    				var scmd = value[<span class="literal">'command'</span>];
    				var sname = value[<span class="literal">'name'</span>];
    				var svalue = value[<span class="literal">'value'</span>] == null ? <span class="literal">''</span> : value[<span class="literal">'value'</span>];
    				<span class="comment">//var svalue = value['value'] == null ? '' : value['value'];</span>
    				var wrapper = value[<span class="literal">'wrapper'</span>] ? value[<span class="literal">'wrapper'</span>] : <span class="literal">"span"</span>;
    				var parentElm = null;
    				var invalidRe = new RegExp(<span class="literal">"^BODY|HTML$"</span>, <span class="literal">"g"</span>);
    				var invalidParentsRe = tinyMCE.settings[<span class="literal">'merge_styles_invalid_parents'</span>] != <span class="literal">''</span> ? new RegExp(tinyMCE.settings[<span class="literal">'merge_styles_invalid_parents'</span>], <span class="literal">"gi"</span>) : null;
    
    				<span class="comment">// Whole element selected check</span>
    				<span class="reserved">if</span> (tinyMCE.isMSIE) {
    					<span class="comment">// Control range</span>
    					<span class="reserved">if</span> (rng.item)
    						parentElm = rng.item(0);
    					<span class="reserved">else</span> {
    						var pelm = rng.parentElement();
    						var prng = doc.selection.createRange();
    						prng.moveToElementText(pelm);
    
    						<span class="reserved">if</span> (rng.htmlText == prng.htmlText || rng.boundingWidth == 0) {
    							<span class="reserved">if</span> (invalidParentsRe == null || !invalidParentsRe.test(pelm.nodeName))
    								parentElm = pelm;
    						}
    					}
    				} <span class="reserved">else</span> {
    					var felm = <span class="reserved">this</span>.getFocusElement();
    					<span class="reserved">if</span> (sel.isCollapsed || (new RegExp(<span class="literal">'td|tr|tbody|table'</span>, <span class="literal">'gi'</span>).test(felm.nodeName) &amp;&amp; sel.anchorNode == felm.parentNode))
    						parentElm = felm;
    				}
    
    				<span class="comment">// Whole element selected</span>
    				<span class="reserved">if</span> (parentElm &amp;&amp; !invalidRe.test(parentElm.nodeName)) {
    					<span class="reserved">if</span> (scmd == <span class="literal">"setstyle"</span>)
    						tinyMCE.setStyleAttrib(parentElm, sname, svalue);
    
    					<span class="reserved">if</span> (scmd == <span class="literal">"setattrib"</span>)
    						tinyMCE.setAttrib(parentElm, sname, svalue);
    
    					<span class="reserved">if</span> (scmd == <span class="literal">"removeformat"</span>) {
    						parentElm.style.cssText = <span class="literal">''</span>;
    						tinyMCE.setAttrib(parentElm, <span class="literal">'class'</span>, <span class="literal">''</span>);
    					}
    
    					<span class="comment">// Remove style/attribs from all children</span>
    					var ch = tinyMCE.getNodeTree(parentElm, new Array(), 1);
    					<span class="reserved">for</span> (var z=0; z&lt;ch.length; z++) {
    						<span class="reserved">if</span> (ch[z] == parentElm)
    							continue;
    
    						<span class="reserved">if</span> (scmd == <span class="literal">"setstyle"</span>)
    							tinyMCE.setStyleAttrib(ch[z], sname, <span class="literal">''</span>);
    
    						<span class="reserved">if</span> (scmd == <span class="literal">"setattrib"</span>)
    							tinyMCE.setAttrib(ch[z], sname, <span class="literal">''</span>);
    
    						<span class="reserved">if</span> (scmd == <span class="literal">"removeformat"</span>) {
    							ch[z].style.cssText = <span class="literal">''</span>;
    							tinyMCE.setAttrib(ch[z], <span class="literal">'class'</span>, <span class="literal">''</span>);
    						}
    					}
    				} <span class="reserved">else</span> {
    					<span class="reserved">this</span>._setUseCSS(false); <span class="comment">// Bug in FF when running in fullscreen</span>
    					doc.execCommand(<span class="literal">"FontName"</span>, false, <span class="literal">"#mce_temp_font#"</span>);
    					var elementArray = tinyMCE.getElementsByAttributeValue(<span class="reserved">this</span>.getBody(), <span class="literal">"font"</span>, <span class="literal">"face"</span>, <span class="literal">"#mce_temp_font#"</span>);
    
    					<span class="comment">// Change them all</span>
    					<span class="reserved">for</span> (var x=0; x&lt;elementArray.length; x++) {
    						elm = elementArray[x];
    						<span class="reserved">if</span> (elm) {
    							var spanElm = doc.createElement(wrapper);
    
    							<span class="reserved">if</span> (scmd == <span class="literal">"setstyle"</span>)
    								tinyMCE.setStyleAttrib(spanElm, sname, svalue);
    
    							<span class="reserved">if</span> (scmd == <span class="literal">"setattrib"</span>)
    								tinyMCE.setAttrib(spanElm, sname, svalue);
    
    							<span class="reserved">if</span> (scmd == <span class="literal">"removeformat"</span>) {
    								spanElm.style.cssText = <span class="literal">''</span>;
    								tinyMCE.setAttrib(spanElm, <span class="literal">'class'</span>, <span class="literal">''</span>);
    							}
    
    							<span class="reserved">if</span> (elm.hasChildNodes()) {
    								<span class="reserved">for</span> (var i=0; i&lt;elm.childNodes.length; i++)
    									spanElm.appendChild(elm.childNodes[i].cloneNode(true));
    							}
    
    							spanElm.setAttribute(<span class="literal">"mce_new"</span>, <span class="literal">"true"</span>);
    							elm.parentNode.replaceChild(spanElm, elm);
    
    							<span class="comment">// Remove style/attribs from all children</span>
    							var ch = tinyMCE.getNodeTree(spanElm, new Array(), 1);
    							<span class="reserved">for</span> (var z=0; z&lt;ch.length; z++) {
    								<span class="reserved">if</span> (ch[z] == spanElm)
    									continue;
    
    								<span class="reserved">if</span> (scmd == <span class="literal">"setstyle"</span>)
    									tinyMCE.setStyleAttrib(ch[z], sname, <span class="literal">''</span>);
    
    								<span class="reserved">if</span> (scmd == <span class="literal">"setattrib"</span>)
    									tinyMCE.setAttrib(ch[z], sname, <span class="literal">''</span>);
    
    								<span class="reserved">if</span> (scmd == <span class="literal">"removeformat"</span>) {
    									ch[z].style.cssText = <span class="literal">''</span>;
    									tinyMCE.setAttrib(ch[z], <span class="literal">'class'</span>, <span class="literal">''</span>);
    								}
    							}
    						}
    					}
    				}
    
    				<span class="comment">// Cleaup wrappers</span>
    				var nodes = doc.getElementsByTagName(wrapper);
    				<span class="reserved">for</span> (var i=nodes.length-1; i&gt;=0; i--) {
    					var elm = nodes[i];
    					var isNew = tinyMCE.getAttrib(elm, <span class="literal">"mce_new"</span>) == <span class="literal">"true"</span>;
    
    					elm.removeAttribute(<span class="literal">"mce_new"</span>);
    
    					<span class="comment">// Is only child a element</span>
    					<span class="reserved">if</span> (elm.childNodes &amp;&amp; elm.childNodes.length == 1 &amp;&amp; elm.childNodes[0].nodeType == 1) {
    						<span class="comment">//tinyMCE.debug("merge1" + isNew);</span>
    						<span class="reserved">this</span>._mergeElements(scmd, elm, elm.childNodes[0], isNew);
    						continue;
    					}
    
    					<span class="comment">// Is I the only child</span>
    					<span class="reserved">if</span> (elm.parentNode.childNodes.length == 1 &amp;&amp; !invalidRe.test(elm.nodeName) &amp;&amp; !invalidRe.test(elm.parentNode.nodeName)) {
    						<span class="comment">//tinyMCE.debug("merge2" + isNew + "," + elm.nodeName + "," + elm.parentNode.nodeName);</span>
    						<span class="reserved">if</span> (invalidParentsRe == null || !invalidParentsRe.test(elm.parentNode.nodeName))
    							<span class="reserved">this</span>._mergeElements(scmd, elm.parentNode, elm, false);
    					}
    				}
    
    				<span class="comment">// Remove empty wrappers</span>
    				var nodes = doc.getElementsByTagName(wrapper);
    				<span class="reserved">for</span> (var i=nodes.length-1; i&gt;=0; i--) {
    					var elm = nodes[i];
    					var isEmpty = true;
    
    					<span class="comment">// Check if it has any attribs</span>
    					var tmp = doc.createElement(<span class="literal">"body"</span>);
    					tmp.appendChild(elm.cloneNode(false));
    
    					<span class="comment">// Is empty span, remove it</span>
    					tmp.innerHTML = tmp.innerHTML.replace(new RegExp(<span class="literal">'style=""|class=""'</span>, <span class="literal">'gi'</span>), <span class="literal">''</span>);
    					<span class="comment">//tinyMCE.debug(tmp.innerHTML);</span>
    					<span class="reserved">if</span> (new RegExp(<span class="literal">'&lt;span&gt;'</span>, <span class="literal">'gi'</span>).test(tmp.innerHTML)) {
    						<span class="reserved">for</span> (var x=0; x&lt;elm.childNodes.length; x++) {
    							<span class="reserved">if</span> (elm.parentNode != null)
    								elm.parentNode.insertBefore(elm.childNodes[x].cloneNode(true), elm);
    						}
    
    						elm.parentNode.removeChild(elm);
    					}
    				}
    
    				<span class="comment">// Re add the visual aids</span>
    				<span class="reserved">if</span> (scmd == <span class="literal">"removeformat"</span>)
    					tinyMCE.handleVisualAid(<span class="reserved">this</span>.getBody(), true, <span class="reserved">this</span>.visualAid, <span class="reserved">this</span>);
    
    				tinyMCE.triggerNodeChange();
    
    				break;
    
    			case <span class="literal">"FontName"</span>:
    				<span class="reserved">if</span> (value == null) {
    					var s = <span class="reserved">this</span>.getSel();
    
    					<span class="comment">// Find font and select it</span>
    					<span class="reserved">if</span> (tinyMCE.isGecko &amp;&amp; s.isCollapsed) {
    						var f = tinyMCE.getParentElement(<span class="reserved">this</span>.getFocusElement(), <span class="literal">"font"</span>);
    
    						<span class="reserved">if</span> (f != null)
    							<span class="reserved">this</span>.selection.selectNode(f, false);
    					}
    
    					<span class="comment">// Remove format</span>
    					<span class="reserved">this</span>.getDoc().execCommand(<span class="literal">"RemoveFormat"</span>, false, null);
    
    					<span class="comment">// Collapse range if font was found</span>
    					<span class="reserved">if</span> (f != null &amp;&amp; tinyMCE.isGecko) {
    						var r = <span class="reserved">this</span>.getRng().cloneRange();
    						r.collapse(true);
    						s.removeAllRanges();
    						s.addRange(r);
    					}
    				} <span class="reserved">else</span>
    					<span class="reserved">this</span>.getDoc().execCommand(<span class="literal">'FontName'</span>, false, value);
    
    				<span class="reserved">if</span> (tinyMCE.isGecko)
    					window.setTimeout(<span class="literal">'tinyMCE.triggerNodeChange(false);'</span>, 1);
    
    				<span class="reserved">return</span>;
    
    			case <span class="literal">"FontSize"</span>:
    				<span class="reserved">this</span>.getDoc().execCommand(<span class="literal">'FontSize'</span>, false, value);
    
    				<span class="reserved">if</span> (tinyMCE.isGecko)
    					window.setTimeout(<span class="literal">'tinyMCE.triggerNodeChange(false);'</span>, 1);
    
    				<span class="reserved">return</span>;
    
    			case <span class="literal">"forecolor"</span>:
    				<span class="reserved">this</span>.getDoc().execCommand(<span class="literal">'forecolor'</span>, false, value);
    				break;
    
    			case <span class="literal">"HiliteColor"</span>:
    				<span class="reserved">if</span> (tinyMCE.isGecko) {
    					<span class="reserved">this</span>._setUseCSS(true);
    					<span class="reserved">this</span>.getDoc().execCommand(<span class="literal">'hilitecolor'</span>, false, value);
    					<span class="reserved">this</span>._setUseCSS(false);
    				} <span class="reserved">else</span>
    					<span class="reserved">this</span>.getDoc().execCommand(<span class="literal">'BackColor'</span>, false, value);
    				break;
    
    			case <span class="literal">"Cut"</span>:
    			case <span class="literal">"Copy"</span>:
    			case <span class="literal">"Paste"</span>:
    				var cmdFailed = false;
    
    				<span class="comment">// Try executing command</span>
    				eval(<span class="literal">'try {this.getDoc().execCommand(command, user_interface, value);} catch (e) {cmdFailed = true;}'</span>);
    
    				<span class="reserved">if</span> (tinyMCE.isOpera &amp;&amp; cmdFailed)
    					alert(<span class="literal">'Currently not supported by your browser, use keyboard shortcuts instead.'</span>);
    
    				<span class="comment">// Alert error in gecko if command failed</span>
    				<span class="reserved">if</span> (tinyMCE.isGecko &amp;&amp; cmdFailed) {
    					<span class="comment">// Confirm more info</span>
    					<span class="reserved">if</span> (confirm(tinyMCE.entityDecode(tinyMCE.getLang(<span class="literal">'lang_clipboard_msg'</span>))))
    						window.open(<span class="literal">'http://www.mozilla.org/editor/midasdemo/securityprefs.html'</span>, <span class="literal">'mceExternal'</span>);
    
    					<span class="reserved">return</span>;
    				} <span class="reserved">else</span>
    					tinyMCE.triggerNodeChange();
    			break;
    
    			case <span class="literal">"mceSetContent"</span>:
    				<span class="reserved">if</span> (!value)
    					value = <span class="literal">""</span>;
    
    				<span class="comment">// Call custom cleanup code</span>
    				value = tinyMCE.storeAwayURLs(value);
    				value = tinyMCE._customCleanup(<span class="reserved">this</span>, <span class="literal">"insert_to_editor"</span>, value);
    				tinyMCE._setHTML(doc, value);
    				tinyMCE.setInnerHTML(doc.body, tinyMCE._cleanupHTML(<span class="reserved">this</span>, doc, tinyMCE.settings, doc.body));
    				tinyMCE.convertAllRelativeURLs(doc.body);
    
    				<span class="comment">// Cleanup any mess left from storyAwayURLs</span>
    				tinyMCE._removeInternal(<span class="reserved">this</span>.getBody());
    
    				<span class="comment">// When editing always use fonts internaly</span>
    				<span class="reserved">if</span> (tinyMCE.getParam(<span class="literal">"convert_fonts_to_spans"</span>))
    					tinyMCE.convertSpansToFonts(doc);
    
    				tinyMCE.handleVisualAid(doc.body, true, <span class="reserved">this</span>.visualAid, <span class="reserved">this</span>);
    				tinyMCE._setEventsEnabled(doc.body, false);
    				<span class="reserved">return</span> true;
    
    			case <span class="literal">"mceCleanup"</span>:
    				var b = <span class="reserved">this</span>.selection.getBookmark();
    				tinyMCE._setHTML(<span class="reserved">this</span>.contentDocument, <span class="reserved">this</span>.getBody().innerHTML);
    				tinyMCE.setInnerHTML(<span class="reserved">this</span>.getBody(), tinyMCE._cleanupHTML(<span class="reserved">this</span>, <span class="reserved">this</span>.contentDocument, <span class="reserved">this</span>.settings, <span class="reserved">this</span>.getBody(), <span class="reserved">this</span>.visualAid));
    				tinyMCE.convertAllRelativeURLs(doc.body);
    
    				<span class="comment">// When editing always use fonts internaly</span>
    				<span class="reserved">if</span> (tinyMCE.getParam(<span class="literal">"convert_fonts_to_spans"</span>))
    					tinyMCE.convertSpansToFonts(doc);
    
    				tinyMCE.handleVisualAid(<span class="reserved">this</span>.getBody(), true, <span class="reserved">this</span>.visualAid, <span class="reserved">this</span>);
    				tinyMCE._setEventsEnabled(<span class="reserved">this</span>.getBody(), false);
    				<span class="reserved">this</span>.repaint();
    				<span class="reserved">this</span>.selection.moveToBookmark(b);
    				tinyMCE.triggerNodeChange();
    			break;
    
    			case <span class="literal">"mceReplaceContent"</span>:
    				<span class="comment">// Force empty string</span>
    				<span class="reserved">if</span> (!value)
    					value = <span class="literal">''</span>;
    
    				<span class="reserved">this</span>.getWin().focus();
    
    				var selectedText = <span class="literal">""</span>;
    
    				<span class="reserved">if</span> (tinyMCE.isMSIE) {
    					var rng = doc.selection.createRange();
    					selectedText = rng.text;
    				} <span class="reserved">else</span>
    					selectedText = <span class="reserved">this</span>.getSel().toString();
    
    				<span class="reserved">if</span> (selectedText.length &gt; 0) {