Changeset 4506
- Timestamp:
- 11/21/2006 12:55:06 AM (19 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 28 edited
-
wp-admin/upload-js.php (modified) (2 diffs)
-
wp-includes/js/autosave.js.php (modified) (1 diff)
-
wp-includes/js/tinymce/license.txt (modified) (12 diffs)
-
wp-includes/js/tinymce/plugins/autosave/editor_plugin.js (modified) (3 diffs)
-
wp-includes/js/tinymce/plugins/directionality/editor_plugin.js (modified) (3 diffs)
-
wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js (modified) (4 diffs)
-
wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js (modified) (1 diff)
-
wp-includes/js/tinymce/plugins/paste/editor_plugin.js (modified) (1 diff)
-
wp-includes/js/tinymce/plugins/paste/jscripts/pastetext.js (modified) (1 diff)
-
wp-includes/js/tinymce/plugins/paste/jscripts/pasteword.js (modified) (1 diff)
-
wp-includes/js/tinymce/themes/advanced/charmap.htm (modified) (1 diff)
-
wp-includes/js/tinymce/themes/advanced/color_picker.htm (modified) (1 diff)
-
wp-includes/js/tinymce/themes/advanced/css/editor_content.css (modified) (1 diff)
-
wp-includes/js/tinymce/themes/advanced/css/editor_popup.css (modified) (1 diff)
-
wp-includes/js/tinymce/themes/advanced/css/editor_ui.css (modified) (1 diff)
-
wp-includes/js/tinymce/themes/advanced/editor_template.js (modified) (19 diffs)
-
wp-includes/js/tinymce/themes/advanced/editor_template_src.js (deleted)
-
wp-includes/js/tinymce/themes/advanced/images/backcolor.gif (modified) (previous)
-
wp-includes/js/tinymce/themes/advanced/images/buttons.gif (modified) (previous)
-
wp-includes/js/tinymce/themes/advanced/images/forecolor.gif (modified) (previous)
-
wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js (modified) (3 diffs)
-
wp-includes/js/tinymce/themes/advanced/langs/en.js (modified) (2 diffs)
-
wp-includes/js/tinymce/tiny_mce.js (modified) (223 diffs)
-
wp-includes/js/tinymce/tiny_mce_popup.js (modified) (1 diff)
-
wp-includes/js/tinymce/utils/form_utils.js (modified) (4 diffs)
-
wp-includes/js/tinymce/utils/mclayer.js (modified) (1 diff)
-
wp-includes/js/tinymce/utils/mctabs.js (modified) (1 diff)
-
wp-includes/js/tinymce/utils/validate.js (modified) (2 diffs)
-
wp-includes/script-loader.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/upload-js.php
r4466 r4506 98 98 h += "<table>"; 99 99 if ( this.currentImage.thumb ) { 100 h += "<tr><th style='padding-bottom:.5em'> Show:</th><td style='padding-bottom:.5em'>";101 h += "<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' checked='checked' /> Thumbnail</label><br />";102 h += "<label for='display-full'><input type='radio' name='display' id='display-full' value='full' /> Full size</label>";100 h += "<tr><th style='padding-bottom:.5em'><?php echo addslashes(__('Show:')); ?></th><td style='padding-bottom:.5em'>"; 101 h += "<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' checked='checked' /> <?php echo addslashes(__('Thumbnail')); ?></label><br />"; 102 h += "<label for='display-full'><input type='radio' name='display' id='display-full' value='full' /> <?php echo addslashes(__('Full size')); ?></label>"; 103 103 h += "</td></tr>"; 104 104 } 105 105 106 h += "<tr><th> Link to:</th><td>";107 h += "<label for='link-file'><input type='radio' name='link' id='link-file' value='file' checked='checked'/> File</label><br />";108 h += "<label for='link-page'><input type='radio' name='link' id='link-page' value='page' /> Page</label><br />";109 h += "<label for='link-none'><input type='radio' name='link' id='link-none' value='none' /> None</label>";106 h += "<tr><th><?php echo addslashes(__('Link to:')); ?></th><td>"; 107 h += "<label for='link-file'><input type='radio' name='link' id='link-file' value='file' checked='checked'/> <?php echo addslashes(__('File')); ?></label><br />"; 108 h += "<label for='link-page'><input type='radio' name='link' id='link-page' value='page' /> <?php echo addslashes(__('Page')); ?></label><br />"; 109 h += "<label for='link-none'><input type='radio' name='link' id='link-none' value='none' /> <?php echo addslashes(__('None')); ?></label>"; 110 110 h += "</td></tr>"; 111 111 112 112 h += "<tr><td colspan='2'><p class='submit'>"; 113 h += "<input type='button' class='button' name='send' onclick='theFileList.sendToEditor(" + id + ")' value=' Send to editor»' />";113 h += "<input type='button' class='button' name='send' onclick='theFileList.sendToEditor(" + id + ")' value='<?php echo addslashes(__('Send to editor')); ?> »' />"; 114 114 h += "</p></td></tr></table>"; 115 115 h += "</form>"; … … 244 244 245 245 deleteFile: function(id) { 246 if ( confirm(" Are you sure you want to delete the file '" + this.currentImage.title + "'?\nClick ok to delete or cancel to go back.")) {246 if ( confirm("<?php printf(addslashes(__("Are you sure you want to delete the file %s?\nClick ok to delete or cancel to go back.")), '" + this.currentImage.title + "'); ?>") { 247 247 $('action-value').value = 'delete'; 248 248 $('upload-file').submit(); -
trunk/wp-includes/js/autosave.js.php
r4441 r4506 4 4 var autosaveLast = ''; 5 5 var autosavePeriodical; 6 6 7 function autosave_start_timer() { 7 8 var form = $('post'); 8 9 autosaveLast = form.post_title.value+form.content.value; 9 autosavePeriodical = new PeriodicalExecuter(autosave, <?php echo apply_filters('autosave_interval', '60'); ?>); 10 autosavePeriodical = new PeriodicalExecuter(autosave, <?php echo apply_filters('autosave_interval', '16'); ?>); 11 //Disable autosave after the form has been submitted 12 // if(form.addEventListener) { 13 // form.addEventListener("submit", function () { autosavePeriodical.currentlyExecuting = true; }, false); 14 // } 15 if(form.attachEvent) { 16 form.attachEvent("onsubmit", function () { autosavePeriodical.currentlyExecuting = true; }); 17 } 10 18 } 11 19 addLoadEvent(autosave_start_timer) -
trunk/wp-includes/js/tinymce/license.txt
r3163 r4506 1 GNU L IBRARYGENERAL PUBLIC LICENSE2 Version 2 , June 19913 4 Copyright (C) 1991 Free Software Foundation, Inc.5 5 9 Temple Place, Suite 330, Boston, MA 02111-1307USA1 GNU LESSER GENERAL PUBLIC LICENSE 2 Version 2.1, February 1999 3 4 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 5 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 6 Everyone is permitted to copy and distribute verbatim copies 7 7 of this license document, but changing it is not allowed. 8 8 9 [This is the first released version of the library GPL. It is 10 numbered 2 because it goes with version 2 of the ordinary GPL.] 9 [This is the first released version of the Lesser GPL. It also counts 10 as the successor of the GNU Library Public License, version 2, hence 11 the version number 2.1.] 11 12 12 13 Preamble … … 17 18 free software--to make sure the software is free for all its users. 18 19 19 This license, the Library General Public License, applies to some 20 specially designated Free Software Foundation software, and to any 21 other libraries whose authors decide to use it. You can use it for 22 your libraries, too. 23 24 When we speak of free software, we are referring to freedom, not 25 price. Our General Public Licenses are designed to make sure that you 26 have the freedom to distribute copies of free software (and charge for 27 this service if you wish), that you receive source code or can get it 28 if you want it, that you can change the software or use pieces of it 29 in new free programs; and that you know you can do these things. 20 This license, the Lesser General Public License, applies to some 21 specially designated software packages--typically libraries--of the 22 Free Software Foundation and other authors who decide to use it. You 23 can use it too, but we suggest you first think carefully about whether 24 this license or the ordinary General Public License is the better 25 strategy to use in any particular case, based on the explanations below. 26 27 When we speak of free software, we are referring to freedom of use, 28 not price. Our General Public Licenses are designed to make sure that 29 you have the freedom to distribute copies of free software (and charge 30 for this service if you wish); that you receive source code or can get 31 it if you want it; that you can change the software and use pieces of 32 it in new free programs; and that you are informed that you can do 33 these things. 30 34 31 35 To protect your rights, we need to make restrictions that forbid 32 anyone to deny you these rights or to ask you to surrender the rights. 33 These restrictions translate to certain responsibilities for you if 34 you distribute copies of the library,or if you modify it.36 distributors to deny you these rights or to ask you to surrender these 37 rights. These restrictions translate to certain responsibilities for 38 you if you distribute copies of the library or if you modify it. 35 39 36 40 For example, if you distribute copies of the library, whether gratis 37 41 or for a fee, you must give the recipients all the rights that we gave 38 42 you. You must make sure that they, too, receive or can get the source 39 code. If you link a programwith the library, you must provide40 complete object files to the recipients so that they can relink them41 with the library ,after making changes to the library and recompiling43 code. If you link other code with the library, you must provide 44 complete object files to the recipients, so that they can relink them 45 with the library after making changes to the library and recompiling 42 46 it. And you must show them these terms so they know their rights. 43 47 44 Our method of protecting your rights has two steps: (1) copyright45 the library, and (2) offer you this licensewhich gives you legal48 We protect your rights with a two-step method: (1) we copyright the 49 library, and (2) we offer you this license, which gives you legal 46 50 permission to copy, distribute and/or modify the library. 47 51 48 Also, for each distributor's protection, we want to make certain 49 that everyone understands that there is no warranty for this free 50 library. If the library is modified by someone else and passed on, we 51 want its recipients to know that what they have is not the original 52 version, so that any problems introduced by others will not reflect on 53 the original authors' reputations. 54 . 55 Finally, any free program is threatened constantly by software 56 patents. We wish to avoid the danger that companies distributing free 57 software will individually obtain patent licenses, thus in effect 58 transforming the program into proprietary software. To prevent this, 59 we have made it clear that any patent must be licensed for everyone's 60 free use or not licensed at all. 61 62 Most GNU software, including some libraries, is covered by the ordinary 63 GNU General Public License, which was designed for utility programs. This 64 license, the GNU Library General Public License, applies to certain 65 designated libraries. This license is quite different from the ordinary 66 one; be sure to read it in full, and don't assume that anything in it is 67 the same as in the ordinary license. 68 69 The reason we have a separate public license for some libraries is that 70 they blur the distinction we usually make between modifying or adding to a 71 program and simply using it. Linking a program with a library, without 72 changing the library, is in some sense simply using the library, and is 73 analogous to running a utility program or application program. However, in 74 a textual and legal sense, the linked executable is a combined work, a 75 derivative of the original library, and the ordinary General Public License 76 treats it as such. 77 78 Because of this blurred distinction, using the ordinary General 79 Public License for libraries did not effectively promote software 80 sharing, because most developers did not use the libraries. We 81 concluded that weaker conditions might promote sharing better. 82 83 However, unrestricted linking of non-free programs would deprive the 84 users of those programs of all benefit from the free status of the 85 libraries themselves. This Library General Public License is intended to 86 permit developers of non-free programs to use free libraries, while 87 preserving your freedom as a user of such programs to change the free 88 libraries that are incorporated in them. (We have not seen how to achieve 89 this as regards changes in header files, but we have achieved it as regards 90 changes in the actual functions of the Library.) The hope is that this 91 will lead to faster development of free libraries. 52 To protect each distributor, we want to make it very clear that 53 there is no warranty for the free library. Also, if the library is 54 modified by someone else and passed on, the recipients should know 55 that what they have is not the original version, so that the original 56 author's reputation will not be affected by problems that might be 57 introduced by others. 58 59 Finally, software patents pose a constant threat to the existence of 60 any free program. We wish to make sure that a company cannot 61 effectively restrict the users of a free program by obtaining a 62 restrictive license from a patent holder. Therefore, we insist that 63 any patent license obtained for a version of the library must be 64 consistent with the full freedom of use specified in this license. 65 66 Most GNU software, including some libraries, is covered by the 67 ordinary GNU General Public License. This license, the GNU Lesser 68 General Public License, applies to certain designated libraries, and 69 is quite different from the ordinary General Public License. We use 70 this license for certain libraries in order to permit linking those 71 libraries into non-free programs. 72 73 When a program is linked with a library, whether statically or using 74 a shared library, the combination of the two is legally speaking a 75 combined work, a derivative of the original library. The ordinary 76 General Public License therefore permits such linking only if the 77 entire combination fits its criteria of freedom. The Lesser General 78 Public License permits more lax criteria for linking other code with 79 the library. 80 81 We call this license the "Lesser" General Public License because it 82 does Less to protect the user's freedom than the ordinary General 83 Public License. It also provides other free software developers Less 84 of an advantage over competing non-free programs. These disadvantages 85 are the reason we use the ordinary General Public License for many 86 libraries. However, the Lesser license provides advantages in certain 87 special circumstances. 88 89 For example, on rare occasions, there may be a special need to 90 encourage the widest possible use of a certain library, so that it becomes 91 a de-facto standard. To achieve this, non-free programs must be 92 allowed to use the library. A more frequent case is that a free 93 library does the same job as widely used non-free libraries. In this 94 case, there is little to gain by limiting the free library to free 95 software only, so we use the Lesser General Public License. 96 97 In other cases, permission to use a particular library in non-free 98 programs enables a greater number of people to use a large body of 99 free software. For example, permission to use the GNU C Library in 100 non-free programs enables many more people to use the whole GNU 101 operating system, as well as its variant, the GNU/Linux operating 102 system. 103 104 Although the Lesser General Public License is Less protective of the 105 users' freedom, it does ensure that the user of a program that is 106 linked with the Library has the freedom and the wherewithal to run 107 that program using a modified version of the Library. 92 108 93 109 The precise terms and conditions for copying, distribution and 94 110 modification follow. Pay close attention to the difference between a 95 111 "work based on the library" and a "work that uses the library". The 96 former contains code derived from the library, while the latter only 97 works together with the library. 98 99 Note that it is possible for a library to be covered by the ordinary 100 General Public License rather than by this special one. 101 . 102 GNU LIBRARY GENERAL PUBLIC LICENSE 112 former contains code derived from the library, whereas the latter must 113 be combined with the library in order to run. 114 115 GNU LESSER GENERAL PUBLIC LICENSE 103 116 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 104 117 105 0. This License Agreement applies to any software library which106 contains a notice placed by the copyright holder or other authorized 107 party saying it may be distributed under the terms of this Library 108 General Public License (also called "this License"). Each licensee is 109 addressed as "you".118 0. This License Agreement applies to any software library or other 119 program which contains a notice placed by the copyright holder or 120 other authorized party saying it may be distributed under the terms of 121 this Lesser General Public License (also called "this License"). 122 Each licensee is addressed as "you". 110 123 111 124 A "library" means a collection of software functions and/or data … … 146 159 and you may at your option offer warranty protection in exchange for a 147 160 fee. 148 . 161 149 162 2. You may modify your copy or copies of the Library or any portion 150 163 of it, thus forming a work based on the Library, and copy and … … 204 217 that version instead if you wish.) Do not make any other change in 205 218 these notices. 206 . 219 207 220 Once this change is made in a given copy, it is irreversible for 208 221 that copy, so the ordinary GNU General Public License applies to all … … 255 268 Any executables containing that work also fall under Section 6, 256 269 whether or not they are linked directly with the Library itself. 257 . 258 6. As an exception to the Sections above, you may also com pile or270 271 6. As an exception to the Sections above, you may also combine or 259 272 link a "work that uses the Library" with the Library to produce a 260 273 work containing portions of the Library, and distribute that work … … 283 296 to use the modified definitions.) 284 297 285 b) Accompany the work with a written offer, valid for at 298 b) Use a suitable shared library mechanism for linking with the 299 Library. A suitable mechanism is one that (1) uses at run time a 300 copy of the library already present on the user's computer system, 301 rather than copying library functions into the executable, and (2) 302 will operate properly with a modified version of the library, if 303 the user installs one, as long as the modified version is 304 interface-compatible with the version that the work was made with. 305 306 c) Accompany the work with a written offer, valid for at 286 307 least three years, to give the same user the materials 287 308 specified in Subsection 6a, above, for a charge no more 288 309 than the cost of performing this distribution. 289 310 290 c) If distribution of the work is made by offering access to copy311 d) If distribution of the work is made by offering access to copy 291 312 from a designated place, offer equivalent access to copy the above 292 313 specified materials from the same place. 293 314 294 d) Verify that the user has already received a copy of these315 e) Verify that the user has already received a copy of these 295 316 materials or that you have already sent this user a copy. 296 317 … … 298 319 Library" must include any data and utility programs needed for 299 320 reproducing the executable from it. However, as a special exception, 300 the source code distributed need not include anything that is normally301 distributed (in either source or binary form) with the major321 the materials to be distributed need not include anything that is 322 normally distributed (in either source or binary form) with the major 302 323 components (compiler, kernel, and so on) of the operating system on 303 324 which the executable runs, unless that component itself accompanies … … 309 330 use both them and the Library together in an executable that you 310 331 distribute. 311 . 332 312 333 7. You may place library facilities that are a work based on the 313 334 Library side-by-side in a single library together with other library … … 348 369 subject to these terms and conditions. You may not impose any further 349 370 restrictions on the recipients' exercise of the rights granted herein. 350 You are not responsible for enforcing compliance by third parties to371 You are not responsible for enforcing compliance by third parties with 351 372 this License. 352 . 373 353 374 11. If, as a consequence of a court judgment or allegation of patent 354 375 infringement or for any other reason (not limited to patent issues), … … 391 412 392 413 13. The Free Software Foundation may publish revised and/or new 393 versions of the L ibraryGeneral Public License from time to time.414 versions of the Lesser General Public License from time to time. 394 415 Such new versions will be similar in spirit to the present version, 395 416 but may differ in detail to address new problems or concerns. … … 402 423 license version number, you may choose any version ever published by 403 424 the Free Software Foundation. 404 . 425 405 426 14. If you wish to incorporate parts of the Library into other free 406 427 programs whose distribution conditions are incompatible with these, … … 436 457 437 458 END OF TERMS AND CONDITIONS 459 460 How to Apply These Terms to Your New Libraries 461 462 If you develop a new library, and you want it to be of the greatest 463 possible use to the public, we recommend making it free software that 464 everyone can redistribute and change. You can do so by permitting 465 redistribution under these terms (or, alternatively, under the terms of the 466 ordinary General Public License). 467 468 To apply these terms, attach the following notices to the library. It is 469 safest to attach them to the start of each source file to most effectively 470 convey the exclusion of warranty; and each file should have at least the 471 "copyright" line and a pointer to where the full notice is found. 472 473 <one line to give the library's name and a brief idea of what it does.> 474 Copyright (C) <year> <name of author> 475 476 This library is free software; you can redistribute it and/or 477 modify it under the terms of the GNU Lesser General Public 478 License as published by the Free Software Foundation; either 479 version 2.1 of the License, or (at your option) any later version. 480 481 This library is distributed in the hope that it will be useful, 482 but WITHOUT ANY WARRANTY; without even the implied warranty of 483 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 484 Lesser General Public License for more details. 485 486 You should have received a copy of the GNU Lesser General Public 487 License along with this library; if not, write to the Free Software 488 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 489 490 Also add information on how to contact you by electronic and paper mail. 491 492 You should also get your employer (if you work as a programmer) or your 493 school, if any, to sign a "copyright disclaimer" for the library, if 494 necessary. Here is a sample; alter the names: 495 496 Yoyodyne, Inc., hereby disclaims all copyright interest in the 497 library `Frob' (a library for tweaking knobs) written by James Random Hacker. 498 499 <signature of Ty Coon>, 1 April 1990 500 Ty Coon, President of Vice 501 502 That's all there is to it! 503 504 -
trunk/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js
r3664 r4506 1 1 /** 2 * $RCSfile: editor_plugin_src.js,v $ 3 * $Revision: 1.11 $ 4 * $Date: 2006/03/22 12:21:21 $ 2 * $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $ 5 3 * 6 4 * @author Moxiecode … … 9 7 10 8 /* Import plugin specific language pack */ 11 tinyMCE.importPluginLanguagePack('autosave' , 'en,tr,sv,cs,he,nb,hu,de,da,ru,ru_KOI8-R,ru_UTF-8,nn,fi,cy,es,is,pl,pt_br');9 tinyMCE.importPluginLanguagePack('autosave'); 12 10 13 11 var TinyMCE_AutoSavePlugin = { … … 15 13 return { 16 14 longname : 'Auto save', 17 author : 'Moxiecode Systems ',15 author : 'Moxiecode Systems AB', 18 16 authorurl : 'http://tinymce.moxiecode.com', 19 17 infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html', -
trunk/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js
r4080 r4506 1 1 /** 2 * $RCSfile: editor_plugin_src.js,v $ 3 * $Revision: 1.16 $ 4 * $Date: 2006/02/10 21:34:28 $ 2 * $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $ 5 3 * 6 4 * @author Moxiecode … … 9 7 10 8 /* Import plugin specific language pack */ 11 tinyMCE.importPluginLanguagePack('directionality' , 'en,tr,sv,fr_ca,zh_cn,cs,da,he,nb,de,hu,ru,ru_KOI8-R,ru_UTF-8,nn,es,cy,is,pl,nl,fr,pt_br');9 tinyMCE.importPluginLanguagePack('directionality'); 12 10 13 11 var TinyMCE_DirectionalityPlugin = { … … 15 13 return { 16 14 longname : 'Directionality', 17 author : 'Moxiecode Systems ',15 author : 'Moxiecode Systems AB', 18 16 authorurl : 'http://tinymce.moxiecode.com', 19 17 infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_directionality.html', -
trunk/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js
r3703 r4506 1 1 /** 2 * $RCSfile: editor_plugin_src.js,v $ 3 * $Revision: 1.8 $ 4 * $Date: 2006/02/06 20:02:38 $ 2 * $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $ 5 3 * 6 4 * Moxiecode DHTML Windows script. … … 16 14 return { 17 15 longname : 'Inline Popups', 18 author : 'Moxiecode Systems ',16 author : 'Moxiecode Systems AB', 19 17 authorurl : 'http://tinymce.moxiecode.com', 20 18 infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_inlinepopups.html', … … 437 435 TinyMCE_Windows.prototype.createFloatingIFrame = function(id_prefix, left, top, width, height, html) { 438 436 var iframe = document.createElement("iframe"); 439 var div = document.createElement("div") ;437 var div = document.createElement("div"), doc; 440 438 441 439 width = parseInt(width); … … 489 487 // Give Safari some time to setup 490 488 window.setTimeout(function() { 491 doc = window.frames[id_prefix + '_iframe'].document;489 var doc = window.frames[id_prefix + '_iframe'].document; 492 490 doc.open(); 493 491 doc.write(html); -
trunk/wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js
r3664 r4506 1 1 /** 2 * $RCSfile: mcwindows.js,v $ 3 * $Revision: 1.2 $ 4 * $Date: 2005/10/18 13:59:43 $ 2 * $Id: mcwindows.js 18 2006-06-29 14:11:23Z spocke $ 5 3 * 6 4 * Moxiecode DHTML Windows script. -
trunk/wp-includes/js/tinymce/plugins/paste/editor_plugin.js
r4080 r4506 1 tinyMCE.importPluginLanguagePack('paste','en,tr,sv,cs,zh_cn,fr_ca,da,he,nb,de,hu,ru,ru_KOI8-R,ru_UTF-8,nn,fi,es,cy,is,pl,nl,fr,pt_br');var TinyMCE_PastePlugin={getInfo:function(){return{longname:'Paste text/word',author:'Moxiecode Systems',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_paste.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};},initInstance:function(inst){if(tinyMCE.isMSIE&&tinyMCE.getParam("paste_auto_cleanup_on_paste",false))tinyMCE.addEvent(inst.getBody(),"paste",TinyMCE_PastePlugin._handlePasteEvent);},getControlHTML:function(cn){switch(cn){case"pastetext":return tinyMCE.getButtonHTML(cn,'lang_paste_text_desc','{$pluginurl}/images/pastetext.gif','mcePasteText',true);case"pasteword":return tinyMCE.getButtonHTML(cn,'lang_paste_word_desc','{$pluginurl}/images/pasteword.gif','mcePasteWord',true);case"selectall":return tinyMCE.getButtonHTML(cn,'lang_selectall_desc','{$pluginurl}/images/selectall.gif','mceSelectAll',true);}return'';},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mcePasteText":if(user_interface){if((tinyMCE.isMSIE&&!tinyMCE.isOpera)&&!tinyMCE.getParam('paste_use_dialog',false))TinyMCE_PastePlugin._insertText(clipboardData.getData("Text"),true);else{var template=new Array();template['file']='../../plugins/paste/pastetext.htm';template['width']=450;template['height']=400;var plain_text="";tinyMCE.openWindow(template,{editor_id:editor_id,plain_text:plain_text,resizable:"yes",scrollbars:"no",inline:"yes",mceDo:'insert'});}}else TinyMCE_PastePlugin._insertText(value['html'],value['linebreaks']);return true;case"mcePasteWord":if(user_interface){if((tinyMCE.isMSIE&&!tinyMCE.isOpera)&&!tinyMCE.getParam('paste_use_dialog',false)){var html=TinyMCE_PastePlugin._clipboardHTML();if(html&&html.length>0)TinyMCE_PastePlugin._insertWordContent(html);}else{var template=new Array();template['file']='../../plugins/paste/pasteword.htm';template['width']=450;template['height']=400;var plain_text="";tinyMCE.openWindow(template,{editor_id:editor_id,plain_text:plain_text,resizable:"yes",scrollbars:"no",inline:"yes",mceDo:'insert'});}}else TinyMCE_PastePlugin._insertWordContent(value);return true;case"mceSelectAll":tinyMCE.execInstanceCommand(editor_id,'selectall');return true;}return false;},_handlePasteEvent:function(e){switch(e.type){case"paste":var html=TinyMCE_PastePlugin._clipboardHTML();var r,inst=tinyMCE.selectedInstance;if(inst&&(r=inst.getRng())&&r.text.length>0)tinyMCE.execCommand('delete');if(html&&html.length>0)tinyMCE.execCommand('mcePasteWord',false,html);tinyMCE.cancelEvent(e);return false;}return true;},_insertText:function(content,bLinebreaks){if(content&&content.length>0){if(bLinebreaks){if(tinyMCE.getParam("paste_create_paragraphs",true)){var rl=tinyMCE.getParam("paste_replace_list",'\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i<rl.length;i+=2)content=content.replace(new RegExp(rl[i],'gi'),rl[i+1]);content=tinyMCE.regexpReplace(content,"\r\n\r\n","</p><p>","gi");content=tinyMCE.regexpReplace(content,"\r\r","</p><p>","gi");content=tinyMCE.regexpReplace(content,"\n\n","</p><p>","gi");if((pos=content.indexOf('</p><p>'))!=-1){tinyMCE.execCommand("Delete");var node=tinyMCE.selectedInstance.getFocusElement();var breakElms=new Array();do{if(node.nodeType==1){if(node.nodeName=="TD"||node.nodeName=="BODY")break;breakElms[breakElms.length]=node;}}while(node=node.parentNode);var before="",after="</p>";before+=content.substring(0,pos);for(var i=0;i<breakElms.length;i++){before+="</"+breakElms[i].nodeName+">";after+="<"+breakElms[(breakElms.length-1)-i].nodeName+">";}before+="<p>";content=before+content.substring(pos+7)+after;}}if(tinyMCE.getParam("paste_create_linebreaks",true)){content=tinyMCE.regexpReplace(content,"\r\n","<br />","gi");content=tinyMCE.regexpReplace(content,"\r","<br />","gi");content=tinyMCE.regexpReplace(content,"\n","<br />","gi");}}tinyMCE.execCommand("mceInsertRawHTML",false,content);}},_insertWordContent:function(content){if(content&&content.length>0){var bull=String.fromCharCode(8226);var middot=String.fromCharCode(183);var cb;if((cb=tinyMCE.getParam("paste_insert_word_content_callback",""))!="")content=eval(cb+"('before', content)");var rl=tinyMCE.getParam("paste_replace_list",'\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i<rl.length;i+=2)content=content.replace(new RegExp(rl[i],'gi'),rl[i+1]);if(tinyMCE.getParam("paste_convert_headers_to_strong",false)){content=content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>','gi'),'<p><b>$1</b></p>');}content=content.replace(new RegExp('tab-stops: list [0-9]+.0pt">','gi'),'">'+"--list--");content=content.replace(new RegExp(bull+"(.*?)<BR>","gi"),"<p>"+middot+"$1</p>");content=content.replace(new RegExp('<SPAN style="mso-list: Ignore">','gi'),"<span>"+bull);content=content.replace(/<o:p><\/o:p>/gi,"");content=content.replace(new RegExp('<br style="page-break-before: always;.*>','gi'),'-- page break --');content=content.replace(new RegExp('<(!--)([^>]*)(--)>','g'),"");if(tinyMCE.getParam("paste_remove_spans",true))content=content.replace(/<\/?span[^>]*>/gi,"");if(tinyMCE.getParam("paste_remove_styles",true))content=content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)','gi'),"<$1$3");content=content.replace(/<\/?font[^>]*>/gi,"");switch(tinyMCE.getParam("paste_strip_class_attributes","all")){case"all":content=content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi,"<$1$3");break;case"mso":content=content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)','gi'),"<$1$3");break;}content=content.replace(new RegExp('href="?'+TinyMCE_PastePlugin._reEscape(""+document.location)+'','gi'),'href="'+tinyMCE.settings['document_base_url']);content=content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi,"<$1$3");content=content.replace(/<\\?\?xml[^>]*>/gi,"");content=content.replace(/<\/?\w+:[^>]*>/gi,"");content=content.replace(/-- page break --\s*<p> <\/p>/gi,"");content=content.replace(/-- page break --/gi,"");if(!tinyMCE.settings['force_p_newlines']){content=content.replace('','','gi');content=content.replace('</p>','<br /><br />','gi');}if(!tinyMCE.isMSIE&&!tinyMCE.settings['force_p_newlines']){content=content.replace(/<\/?p[^>]*>/gi,"");}content=content.replace(/<\/?div[^>]*>/gi,"");if(tinyMCE.getParam("paste_convert_middot_lists",true)){var div=document.createElement("div");div.innerHTML=content;var className=tinyMCE.getParam("paste_unindented_list_class","unIndentedList");while(TinyMCE_PastePlugin._convertMiddots(div,"--list--"));while(TinyMCE_PastePlugin._convertMiddots(div,middot,className));while(TinyMCE_PastePlugin._convertMiddots(div,bull));content=div.innerHTML;}if(tinyMCE.getParam("paste_convert_headers_to_strong",false)){content=content.replace(/<h[1-6]> <\/h[1-6]>/gi,'<p> </p>');content=content.replace(/<h[1-6]>/gi,'<p><b>');content=content.replace(/<\/h[1-6]>/gi,'</b></p>');content=content.replace(/<b> <\/b>/gi,'<b> </b>');content=content.replace(/^( )*/gi,'');}content=content.replace(/--list--/gi,"");if((cb=tinyMCE.getParam("paste_insert_word_content_callback",""))!="")content=eval(cb+"('after', content)");tinyMCE.execCommand("mceInsertContent",false,content);window.setTimeout('tinyMCE.execCommand("mceCleanup");',1);}},_reEscape:function(s){var l="?.\\*[](){}+^$:";var o="";for(var i=0;i<s.length;i++){var c=s.charAt(i);if(l.indexOf(c)!=-1)o+='\\'+c;else o+=c;}return o;},_convertMiddots:function(div,search,class_name){var mdot=String.fromCharCode(183);var bull=String.fromCharCode(8226);var nodes=div.getElementsByTagName("p");var prevul;for(var i=0;i<nodes.length;i++){var p=nodes[i];if(p.innerHTML.indexOf(search)==0){var ul=document.createElement("ul");if(class_name)ul.className=class_name;var li=document.createElement("li");li.innerHTML=p.innerHTML.replace(new RegExp(''+mdot+'|'+bull+'|--list--| ',"gi"),'');ul.appendChild(li);var np=p.nextSibling;while(np){if(np.nodeType==3&&new RegExp('^\\s$','m').test(np.nodeValue)){np=np.nextSibling;continue;}if(search==mdot){if(np.nodeType==1&&new RegExp('^o(\\s+| )').test(np.innerHTML)){if(!prevul){prevul=ul;ul=document.createElement("ul");prevul.appendChild(ul);}np.innerHTML=np.innerHTML.replace(/^o/,'');}else{if(prevul){ul=prevul;prevul=null;}if(np.nodeType!=1||np.innerHTML.indexOf(search)!=0)break;}}else{if(np.nodeType!=1||np.innerHTML.indexOf(search)!=0)break;}var cp=np.nextSibling;var li=document.createElement("li");li.innerHTML=np.innerHTML.replace(new RegExp(''+mdot+'|'+bull+'|--list--| ',"gi"),'');np.parentNode.removeChild(np);ul.appendChild(li);np=cp;}p.parentNode.replaceChild(ul,p);return true;}}return false;},_clipboardHTML:function(){var div=document.getElementById('_TinyMCE_clipboardHTML');if(!div){var div=document.createElement('DIV');div.id='_TinyMCE_clipboardHTML';with(div.style){visibility='hidden';overflow='hidden';position='absolute';width=1;height=1;}document.body.appendChild(div);}div.innerHTML='';var rng=document.body.createTextRange();rng.moveToElementText(div);rng.execCommand('Paste');var html=div.innerHTML;div.innerHTML='';return html;}};tinyMCE.addPlugin("paste",TinyMCE_PastePlugin); 1 /** 2 * $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $ 3 * 4 * @author Moxiecode 5 * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved. 6 */ 7 8 /* Import plugin specific language pack */ 9 tinyMCE.importPluginLanguagePack('paste'); 10 11 var TinyMCE_PastePlugin = { 12 getInfo : function() { 13 return { 14 longname : 'Paste text/word', 15 author : 'Moxiecode Systems AB', 16 authorurl : 'http://tinymce.moxiecode.com', 17 infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_paste.html', 18 version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion 19 }; 20 }, 21 22 initInstance : function(inst) { 23 if (tinyMCE.isMSIE && tinyMCE.getParam("paste_auto_cleanup_on_paste", false)) 24 tinyMCE.addEvent(inst.getBody(), "paste", TinyMCE_PastePlugin._handlePasteEvent); 25 }, 26 27 getControlHTML : function(cn) { 28 switch (cn) { 29 case "pastetext": 30 return tinyMCE.getButtonHTML(cn, 'lang_paste_text_desc', '{$pluginurl}/images/pastetext.gif', 'mcePasteText', true); 31 32 case "pasteword": 33 return tinyMCE.getButtonHTML(cn, 'lang_paste_word_desc', '{$pluginurl}/images/pasteword.gif', 'mcePasteWord', true); 34 35 case "selectall": 36 return tinyMCE.getButtonHTML(cn, 'lang_selectall_desc', '{$pluginurl}/images/selectall.gif', 'mceSelectAll', true); 37 } 38 39 return ''; 40 }, 41 42 execCommand : function(editor_id, element, command, user_interface, value) { 43 switch (command) { 44 case "mcePasteText": 45 if (user_interface) { 46 if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && !tinyMCE.getParam('paste_use_dialog', false)) 47 TinyMCE_PastePlugin._insertText(clipboardData.getData("Text"), true); 48 else { 49 var template = new Array(); 50 template['file'] = '../../plugins/paste/pastetext.htm'; // Relative to theme 51 template['width'] = 450; 52 template['height'] = 400; 53 var plain_text = ""; 54 tinyMCE.openWindow(template, {editor_id : editor_id, plain_text: plain_text, resizable : "yes", scrollbars : "no", inline : "yes", mceDo : 'insert'}); 55 } 56 } else 57 TinyMCE_PastePlugin._insertText(value['html'], value['linebreaks']); 58 59 return true; 60 61 case "mcePasteWord": 62 if (user_interface) { 63 if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && !tinyMCE.getParam('paste_use_dialog', false)) { 64 TinyMCE_PastePlugin._insertWordContent(TinyMCE_PastePlugin._clipboardHTML()); 65 } else { 66 var template = new Array(); 67 template['file'] = '../../plugins/paste/pasteword.htm'; // Relative to theme 68 template['width'] = 450; 69 template['height'] = 400; 70 var plain_text = ""; 71 tinyMCE.openWindow(template, {editor_id : editor_id, plain_text: plain_text, resizable : "yes", scrollbars : "no", inline : "yes", mceDo : 'insert'}); 72 } 73 } else 74 TinyMCE_PastePlugin._insertWordContent(value); 75 76 return true; 77 78 case "mceSelectAll": 79 tinyMCE.execInstanceCommand(editor_id, 'selectall'); 80 return true; 81 82 } 83 84 // Pass to next handler in chain 85 return false; 86 }, 87 88 // Private plugin internal methods 89 90 _handlePasteEvent : function(e) { 91 switch (e.type) { 92 case "paste": 93 var html = TinyMCE_PastePlugin._clipboardHTML(); 94 var r, inst = tinyMCE.selectedInstance; 95 96 // Removes italic, strong etc, the if was needed due to bug #1437114 97 if (inst && (r = inst.getRng()) && r.text.length > 0) 98 tinyMCE.execCommand('delete'); 99 100 if (html && html.length > 0) 101 tinyMCE.execCommand('mcePasteWord', false, html); 102 103 tinyMCE.cancelEvent(e); 104 return false; 105 } 106 107 return true; 108 }, 109 110 _insertText : function(content, bLinebreaks) { 111 if (content && content.length > 0) { 112 if (bLinebreaks) { 113 // Special paragraph treatment 114 if (tinyMCE.getParam("paste_create_paragraphs", true)) { 115 var rl = tinyMCE.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(','); 116 for (var i=0; i<rl.length; i+=2) 117 content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]); 118 119 content = tinyMCE.regexpReplace(content, "\r\n\r\n", "</p><p>", "gi"); 120 content = tinyMCE.regexpReplace(content, "\r\r", "</p><p>", "gi"); 121 content = tinyMCE.regexpReplace(content, "\n\n", "</p><p>", "gi"); 122 123 // Has paragraphs 124 if ((pos = content.indexOf('</p><p>')) != -1) { 125 tinyMCE.execCommand("Delete"); 126 127 var node = tinyMCE.selectedInstance.getFocusElement(); 128 129 // Get list of elements to break 130 var breakElms = new Array(); 131 132 do { 133 if (node.nodeType == 1) { 134 // Don't break tables and break at body 135 if (node.nodeName == "TD" || node.nodeName == "BODY") 136 break; 137 138 breakElms[breakElms.length] = node; 139 } 140 } while(node = node.parentNode); 141 142 var before = "", after = "</p>"; 143 before += content.substring(0, pos); 144 145 for (var i=0; i<breakElms.length; i++) { 146 before += "</" + breakElms[i].nodeName + ">"; 147 after += "<" + breakElms[(breakElms.length-1)-i].nodeName + ">"; 148 } 149 150 before += "<p>"; 151 content = before + content.substring(pos+7) + after; 152 } 153 } 154 155 if (tinyMCE.getParam("paste_create_linebreaks", true)) { 156 content = tinyMCE.regexpReplace(content, "\r\n", "<br />", "gi"); 157 content = tinyMCE.regexpReplace(content, "\r", "<br />", "gi"); 158 content = tinyMCE.regexpReplace(content, "\n", "<br />", "gi"); 159 } 160 } 161 162 tinyMCE.execCommand("mceInsertRawHTML", false, content); 163 } 164 }, 165 166 _insertWordContent : function(content) { 167 if (content && content.length > 0) { 168 // Cleanup Word content 169 var bull = String.fromCharCode(8226); 170 var middot = String.fromCharCode(183); 171 var cb; 172 173 if ((cb = tinyMCE.getParam("paste_insert_word_content_callback", "")) != "") 174 content = eval(cb + "('before', content)"); 175 176 var rl = tinyMCE.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(','); 177 for (var i=0; i<rl.length; i+=2) 178 content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]); 179 180 if (tinyMCE.getParam("paste_convert_headers_to_strong", false)) { 181 content = content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>', 'gi'), '<p><b>$1</b></p>'); 182 } 183 184 content = content.replace(new RegExp('tab-stops: list [0-9]+.0pt">', 'gi'), '">' + "--list--"); 185 content = content.replace(new RegExp(bull + "(.*?)<BR>", "gi"), "<p>" + middot + "$1</p>"); 186 content = content.replace(new RegExp('<SPAN style="mso-list: Ignore">', 'gi'), "<span>" + bull); // Covert to bull list 187 content = content.replace(/<o:p><\/o:p>/gi, ""); 188 content = content.replace(new RegExp('<br style="page-break-before: always;.*>', 'gi'), '-- page break --'); // Replace pagebreaks 189 content = content.replace(new RegExp('<(!--)([^>]*)(--)>', 'g'), ""); // Word comments 190 191 if (tinyMCE.getParam("paste_remove_spans", true)) 192 content = content.replace(/<\/?span[^>]*>/gi, ""); 193 194 if (tinyMCE.getParam("paste_remove_styles", true)) 195 content = content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)', 'gi'), "<$1$3"); 196 197 content = content.replace(/<\/?font[^>]*>/gi, ""); 198 199 // Strips class attributes. 200 switch (tinyMCE.getParam("paste_strip_class_attributes", "all")) { 201 case "all": 202 content = content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3"); 203 break; 204 205 case "mso": 206 content = content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)', 'gi'), "<$1$3"); 207 break; 208 } 209 210 content = content.replace(new RegExp('href="?' + TinyMCE_PastePlugin._reEscape("" + document.location) + '', 'gi'), 'href="' + tinyMCE.settings['document_base_url']); 211 content = content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3"); 212 content = content.replace(/<\\?\?xml[^>]*>/gi, ""); 213 content = content.replace(/<\/?\w+:[^>]*>/gi, ""); 214 content = content.replace(/-- page break --\s*<p> <\/p>/gi, ""); // Remove pagebreaks 215 content = content.replace(/-- page break --/gi, ""); // Remove pagebreaks 216 217 // content = content.replace(/\/? */gi, ""); 218 // content = content.replace(/<p> <\/p>/gi, ''); 219 220 if (!tinyMCE.settings['force_p_newlines']) { 221 content = content.replace('', '' ,'gi'); 222 content = content.replace('</p>', '<br /><br />' ,'gi'); 223 } 224 225 if (!tinyMCE.isMSIE && !tinyMCE.settings['force_p_newlines']) { 226 content = content.replace(/<\/?p[^>]*>/gi, ""); 227 } 228 229 content = content.replace(/<\/?div[^>]*>/gi, ""); 230 231 // Convert all middlot lists to UL lists 232 if (tinyMCE.getParam("paste_convert_middot_lists", true)) { 233 var div = document.createElement("div"); 234 div.innerHTML = content; 235 236 // Convert all middot paragraphs to li elements 237 var className = tinyMCE.getParam("paste_unindented_list_class", "unIndentedList"); 238 239 while (TinyMCE_PastePlugin._convertMiddots(div, "--list--")) ; // bull 240 while (TinyMCE_PastePlugin._convertMiddots(div, middot, className)) ; // Middot 241 while (TinyMCE_PastePlugin._convertMiddots(div, bull)) ; // bull 242 243 content = div.innerHTML; 244 } 245 246 // Replace all headers with strong and fix some other issues 247 if (tinyMCE.getParam("paste_convert_headers_to_strong", false)) { 248 content = content.replace(/<h[1-6]> <\/h[1-6]>/gi, '<p> </p>'); 249 content = content.replace(/<h[1-6]>/gi, '<p><b>'); 250 content = content.replace(/<\/h[1-6]>/gi, '</b></p>'); 251 content = content.replace(/<b> <\/b>/gi, '<b> </b>'); 252 content = content.replace(/^( )*/gi, ''); 253 } 254 255 content = content.replace(/--list--/gi, ""); // Remove --list-- 256 257 if ((cb = tinyMCE.getParam("paste_insert_word_content_callback", "")) != "") 258 content = eval(cb + "('after', content)"); 259 260 // Insert cleaned content 261 tinyMCE.execCommand("mceInsertContent", false, content); 262 263 if (tinyMCE.getParam('paste_force_cleanup_wordpaste', true)) 264 window.setTimeout('tinyMCE.execCommand("mceCleanup");', 1); // Do normal cleanup detached from this thread 265 } 266 }, 267 268 _reEscape : function(s) { 269 var l = "?.\\*[](){}+^$:"; 270 var o = ""; 271 272 for (var i=0; i<s.length; i++) { 273 var c = s.charAt(i); 274 275 if (l.indexOf(c) != -1) 276 o += '\\' + c; 277 else 278 o += c; 279 } 280 281 return o; 282 }, 283 284 _convertMiddots : function(div, search, class_name) { 285 var mdot = String.fromCharCode(183); 286 var bull = String.fromCharCode(8226); 287 288 var nodes = div.getElementsByTagName("p"); 289 var prevul; 290 for (var i=0; i<nodes.length; i++) { 291 var p = nodes[i]; 292 293 // Is middot 294 if (p.innerHTML.indexOf(search) == 0) { 295 var ul = document.createElement("ul"); 296 297 if (class_name) 298 ul.className = class_name; 299 300 // Add the first one 301 var li = document.createElement("li"); 302 li.innerHTML = p.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--| ', "gi"), ''); 303 ul.appendChild(li); 304 305 // Add the rest 306 var np = p.nextSibling; 307 while (np) { 308 // If the node is whitespace, then 309 // ignore it and continue on. 310 if (np.nodeType == 3 && new RegExp('^\\s$', 'm').test(np.nodeValue)) { 311 np = np.nextSibling; 312 continue; 313 } 314 315 if (search == mdot) { 316 if (np.nodeType == 1 && new RegExp('^o(\\s+| )').test(np.innerHTML)) { 317 // Second level of nesting 318 if (!prevul) { 319 prevul = ul; 320 ul = document.createElement("ul"); 321 prevul.appendChild(ul); 322 } 323 np.innerHTML = np.innerHTML.replace(/^o/, ''); 324 } else { 325 // Pop the stack if we're going back up to the first level 326 if (prevul) { 327 ul = prevul; 328 prevul = null; 329 } 330 // Not element or middot paragraph 331 if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0) 332 break; 333 } 334 } else { 335 // Not element or middot paragraph 336 if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0) 337 break; 338 } 339 340 var cp = np.nextSibling; 341 var li = document.createElement("li"); 342 li.innerHTML = np.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--| ', "gi"), ''); 343 np.parentNode.removeChild(np); 344 ul.appendChild(li); 345 np = cp; 346 } 347 348 p.parentNode.replaceChild(ul, p); 349 350 return true; 351 } 352 } 353 354 return false; 355 }, 356 357 _clipboardHTML : function() { 358 var div = document.getElementById('_TinyMCE_clipboardHTML'); 359 360 if (!div) { 361 var div = document.createElement('DIV'); 362 div.id = '_TinyMCE_clipboardHTML'; 363 364 with (div.style) { 365 visibility = 'hidden'; 366 overflow = 'hidden'; 367 position = 'absolute'; 368 width = 1; 369 height = 1; 370 } 371 372 document.body.appendChild(div); 373 } 374 375 div.innerHTML = ''; 376 var rng = document.body.createTextRange(); 377 rng.moveToElementText(div); 378 rng.execCommand('Paste'); 379 var html = div.innerHTML; 380 div.innerHTML = ''; 381 return html; 382 } 383 }; 384 385 tinyMCE.addPlugin("paste", TinyMCE_PastePlugin); -
trunk/wp-includes/js/tinymce/plugins/paste/jscripts/pastetext.js
r3664 r4506 15 15 function onLoadInit() { 16 16 tinyMCEPopup.resizeToInnerSize(); 17 18 // Remove Gecko spellchecking 19 if (tinyMCE.isGecko) 20 document.body.spellcheck = tinyMCE.getParam("gecko_spellcheck"); 17 21 18 22 resizeInputs(); -
trunk/wp-includes/js/tinymce/plugins/paste/jscripts/pasteword.js
r3664 r4506 26 26 function initIframe(doc) { 27 27 var dir = tinyMCE.selectedInstance.settings['directionality']; 28 28 29 doc.body.dir = dir; 30 31 // Remove Gecko spellchecking 32 if (tinyMCE.isGecko) 33 doc.body.spellcheck = tinyMCE.getParam("gecko_spellcheck"); 34 29 35 resizeInputs(); 30 36 } -
trunk/wp-includes/js/tinymce/themes/advanced/charmap.htm
r3664 r4506 7 7 <base target="_self" /> 8 8 </head> 9 <body onload="tinyMCEPopup.executeOnLoad('init();'); document.body.style.display='';document.getElementById('insert').focus();" style="display: none">9 <body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none"> 10 10 <table align="center" border="0" cellspacing="0" cellpadding="2"> 11 11 <tr> -
trunk/wp-includes/js/tinymce/themes/advanced/color_picker.htm
r3664 r4506 6 6 <base target="_self" /> 7 7 </head> 8 <body onload="tinyMCEPopup.executeOnLoad('init();'); document.body.style.display='';document.getElementById('insert').focus();" style="margin: 3px; display: none">8 <body onload="tinyMCEPopup.executeOnLoad('init();');" style="margin: 3px; display: none"> 9 9 <div align="center"> 10 10 <script language="javascript" type="text/javascript">renderColorMap();</script> -
trunk/wp-includes/js/tinymce/themes/advanced/css/editor_content.css
r3664 r4506 13 13 .mceVisualAid { 14 14 border: 1px dashed #BBBBBB !important; 15 } 16 17 div.mceVisualAid { 18 background-image:url('../images/spacer.gif'); 19 visibility: visible !important; 15 20 } 16 21 -
trunk/wp-includes/js/tinymce/themes/advanced/css/editor_popup.css
r3664 r4506 312 312 height: 190px; 313 313 } 314 315 label.msg { display: none; } 316 label.invalid { color: #EE0000; display: inline; } 317 input.invalid { border: 1px solid #EE0000; } 314 318 315 319 /* Disables the advanced tab in the table plugin. */ -
trunk/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css
r3664 r4506 1 1 /* This file contains the CSS data for the editor UI of TinyMCE instances */ 2 2 3 .mceToolbarTop a, .mceToolbarTop a:visited, .mceToolbarTop a:hover, .mceToolbarBottom a, .mceToolbarBottom a:visited, .mceToolbarBottom a:hover { 4 border: 0; margin: 0; padding: 0; background: transparent; 5 } 6 7 .mceSeparatorLine { 8 border: 0; 9 padding: 0; 10 margin-left: 4px; 11 margin-right: 2px; 12 } 13 14 .mceSelectList { 15 font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; 16 font-size: 7pt !important; 17 font-weight: normal; 18 margin-top: 3px; 19 padding: 0; 20 display: inline; 21 vertical-align: top; 22 background-color: #F0F0EE; 23 } 24 25 .mceLabel, .mceLabelDisabled { 26 font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; 27 font-size: 9pt; 28 } 29 30 .mceLabel { 31 color: #000000; 32 } 33 34 .mceLabelDisabled { 35 cursor: text; 36 color: #999999; 37 } 38 39 .mceEditor { 40 background: #F0F0EE; 41 border: 1px solid #cccccc; 42 padding: 0; 43 margin: 0; 44 } 45 46 .mceEditorArea { 47 font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; 48 background: #FFFFFF; 49 padding: 0; 50 margin: 0; 51 } 52 53 .mceToolbarTop, .mceToolbarBottom { 54 background: #F0F0EE; 55 line-height: 1px; 56 font-size: 1px; 57 } 58 59 .mceToolbarTop { 60 border-bottom: 1px solid #cccccc; 61 padding-bottom: 1px; 62 } 63 64 .mceToolbarBottom { 65 border-top: 1px solid #cccccc; 66 } 67 68 .mceStatusbarTop, .mceStatusbarBottom, .mceStatusbar { 69 height: 20px; 70 } 71 72 .mceStatusbarTop .mceStatusbarPathText, .mceStatusbarBottom .mceStatusbarPathText, .mceStatusbar .mceStatusbarPathText { 73 font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; 74 font-size: 9pt; 75 padding: 2px; 76 line-height: 16px; 77 overflow: visible; 78 } 79 80 .mceStatusbarTop { 81 border-bottom: 1px solid #cccccc; 82 } 83 84 .mceStatusbarBottom { 85 border-top: 1px solid #cccccc; 86 } 87 88 .mceStatusbar { 89 border-bottom: 1px solid #cccccc; 90 } 91 92 .mcePathItem, .mcePathItem:link, .mcePathItem:visited, .mcePathItem:hover { 93 text-decoration: none; 94 font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; 95 font-size: 9pt; 96 color: #000000; 97 } 98 99 .mcePathItem:hover { 100 text-decoration: underline; 101 } 102 103 .mceStatusbarPathText { 104 float: left; 105 } 106 107 .mceStatusbarResize { 108 float: right; 109 background-image: url('../images/statusbar_resize.gif'); 110 background-repeat: no-repeat; 111 width: 11px; 112 height: 20px; 113 cursor: se-resize; 114 } 115 116 .mceResizeBox { 117 width: 10px; 118 height: 10px; 119 display: none; 120 border: 1px dotted gray; 121 margin: 0; 122 padding: 0; 123 } 3 .mceToolbarTop a, .mceToolbarTop a:visited, .mceToolbarTop a:hover, .mceToolbarBottom a, .mceToolbarBottom a:visited, .mceToolbarBottom a:hover {border: 0; margin: 0; padding: 0; background: transparent;} 4 .mceSeparatorLine {border: 0; padding: 0; margin-left: 4px; margin-right: 2px;} 5 .mceSelectList {font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 7pt !important; font-weight: normal; margin-top: 3px; padding: 0; display: inline; vertical-align: top; background-color: #F0F0EE;} 6 .mceLabel, .mceLabelDisabled {font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 9pt;} 7 .mceLabel {color: #000000;} 8 .mceLabelDisabled {cursor: text; color: #999999;} 9 .mceEditor {background: #F0F0EE; border: 1px solid #cccccc; padding: 0; margin: 0;} 10 .mceEditorArea { font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; background: #FFFFFF; padding: 0; margin: 0; } 11 .mceToolbarTop, .mceToolbarBottom {background: #F0F0EE; line-height: 1px; font-size: 1px;} 12 .mceToolbarTop {border-bottom: 1px solid #cccccc; padding-bottom: 1px;} 13 .mceToolbarBottom {border-top: 1px solid #cccccc;} 14 .mceToolbarContainer {position: relative; left: 0; top: 0; display: block;} 15 .mceStatusbarTop, .mceStatusbarBottom, .mceStatusbar {height: 20px;} 16 .mceStatusbarTop .mceStatusbarPathText, .mceStatusbarBottom .mceStatusbarPathText, .mceStatusbar .mceStatusbarPathText {font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 9pt; padding: 2px; line-height: 16px; overflow: visible;} 17 .mceStatusbarTop {border-bottom: 1px solid #cccccc;} 18 .mceStatusbarBottom {border-top: 1px solid #cccccc;} 19 .mceStatusbar {border-bottom: 1px solid #cccccc;} 20 .mcePathItem, .mcePathItem:link, .mcePathItem:visited, .mcePathItem:hover {text-decoration: none; font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 9pt; color: #000000;} 21 .mcePathItem:hover {text-decoration: underline;} 22 .mceStatusbarPathText {float: left;} 23 .mceStatusbarResize {float: right; background-image: url('../images/statusbar_resize.gif'); background-repeat: no-repeat; width: 11px; height: 20px; cursor: se-resize;} 24 .mceResizeBox {width: 10px; height: 10px; display: none; border: 1px dotted gray; margin: 0; padding: 0;} 25 .mceEditorIframe {border: 0;} 124 26 125 27 /* Button CSS rules */ 126 28 127 a.mceButtonDisabled img, a.mceButtonNormal img, a.mceButtonSelected img { 128 width: 20px; 129 height: 20px; 130 cursor: default; 131 margin-top: 1px; 132 margin-left: 1px; 133 } 134 135 a.mceButtonDisabled img { 136 border: 0 !important; 137 } 138 139 a.mceButtonNormal img, a.mceButtonSelected img { 140 border: 1px solid #F0F0EE !important; 141 } 142 143 a.mceButtonSelected img { 144 border: 1px solid #6779AA !important; 145 background-color: #D4D5D8; 146 } 147 148 a.mceButtonNormal img:hover, a.mceButtonSelected img:hover { 149 border: 1px solid #0A246A !important; 150 cursor: default; 151 background-color: #B6BDD2; 152 } 153 154 a.mceButtonDisabled img { 155 -moz-opacity:0.3; 156 opacity: 0.3; 157 border: 1px solid #F0F0EE !important; 158 cursor: default; 159 } 160 161 a.mceTiledButton img { 162 background-image: url('../images/buttons.gif'); 163 background-repeat: no-repeat; 164 } 165 166 /* MSIE specific rules */ 167 168 * html a.mceButtonNormal img, * html a.mceButtonSelected img, * html a.mceButtonDisabled img { 169 border: 0 !important; 170 margin-top: 2px; 171 margin-bottom: 1px; 172 } 173 174 * html a.mceButtonDisabled img { 175 filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30); 176 border: 0 !important; 177 } 178 179 * html a.mceButtonDisabled { 180 border: 1px solid #F0F0EE !important; 181 } 182 183 * html a.mceButtonNormal, * html a.mceButtonSelected { 184 border: 1px solid #F0F0EE !important; 185 cursor: default; 186 } 187 188 * html a.mceButtonSelected { 189 border: 1px solid #6779AA !important; 190 background-color: #D4D5D8; 191 } 192 193 * html a.mceButtonNormal:hover, * html a.mceButtonSelected:hover { 194 border: 1px solid #0A246A !important; 195 cursor: default; 196 background-color: #B6BDD2; 197 } 198 199 * html .mceSelectList { 200 margin-top: 2px; 201 } 29 a.mceButtonDisabled img, a.mceButtonNormal img, a.mceButtonSelected img {width: 20px; height: 20px; cursor: default; margin-top: 1px; margin-left: 1px;} 30 a.mceButtonDisabled img {border: 0 !important;} 31 a.mceButtonNormal img, a.mceButtonSelected img {border: 1px solid #F0F0EE !important;} 32 a.mceButtonSelected img {border: 1px solid #6779AA !important; background-color: #D4D5D8;} 33 a.mceButtonNormal img:hover, a.mceButtonSelected img:hover {border: 1px solid #0A246A !important; cursor: default; background-color: #B6BDD2;} 34 a.mceButtonDisabled img {-moz-opacity:0.3; opacity: 0.3; border: 1px solid #F0F0EE !important; cursor: default;} 35 a.mceTiledButton img {background-image: url('../images/buttons.gif'); background-repeat: no-repeat;} 202 36 203 37 /* Menu button CSS rules */ 204 38 205 span.mceMenuButton img, span.mceMenuButtonSelected img { 206 border: 1px solid #F0F0EE; 207 margin-left: 1px; 208 } 209 210 span.mceMenuButtonSelected img { 211 border: 1px solid #6779AA; 212 background-color: #B6BDD2; 213 } 214 215 span.mceMenuButtonSelected img.mceMenuButton { 216 border: 1px solid #F0F0EE; 217 background-color: transparent; 218 } 219 220 span.mceMenuButton img.mceMenuButton, span.mceMenuButtonSelected img.mceMenuButton { 221 border-left: 0; 222 margin-left: 0; 223 } 224 225 span.mceMenuButton:hover img, span.mceMenuButtonSelected:hover img { 226 border: 1px solid #0A246A; 227 background-color: #B6BDD2; 228 } 229 230 span.mceMenuButton:hover img.mceMenuButton, span.mceMenuButtonSelected:hover img.mceMenuButton { 231 border-left: 0; 232 } 233 234 span.mceMenuButtonFocus img { 235 border: 1px solid gray; 236 border-right: 0; 237 margin-left: 1px; 238 background-color: #F5F4F2; 239 } 240 241 span.mceMenuButtonFocus img.mceMenuButton { 242 border: 1px solid gray; 243 border-left: 1px solid #F5F4F2; 244 margin-left: 0; 245 } 246 247 /* Menu button MSIE specific rules */ 248 249 * html span.mceMenuButton, * html span.mceMenuButtonFocus { 250 position: relative; 251 left: 0; 252 top: 0; 253 } 254 255 * html span.mceMenuButton img, * html span.mceMenuButtonSelected img, * html span.mceMenuButtonFocus img { 256 position: relative; 257 top: 1px; 258 } 259 260 * html span.mceMenuHover img { 261 border: 1px solid #0A246A; 262 background-color: #B6BDD2; 263 } 264 265 * html span.mceMenuButtonSelected.mceMenuHover img.mceMenuButton { 266 border: 1px solid #0A246A; 267 background-color: #B6BDD2; 268 border-left: 0; 269 } 39 span.mceMenuButton img, span.mceMenuButtonSelected img {border: 1px solid #F0F0EE; margin-left: 1px;} 40 span.mceMenuButtonSelected img {border: 1px solid #6779AA; background-color: #B6BDD2;} 41 span.mceMenuButtonSelected img.mceMenuButton {border: 1px solid #F0F0EE; background-color: transparent;} 42 span.mceMenuButton img.mceMenuButton, span.mceMenuButtonSelected img.mceMenuButton {border-left: 0; margin-left: 0;} 43 span.mceMenuButton:hover img, span.mceMenuButtonSelected:hover img {border: 1px solid #0A246A; background-color: #B6BDD2;} 44 span.mceMenuButton:hover img.mceMenuButton, span.mceMenuButtonSelected:hover img.mceMenuButton {border-left: 0;} 45 span.mceMenuButtonFocus img {border: 1px solid gray; border-right: 0; margin-left: 1px; background-color: #F5F4F2;} 46 span.mceMenuButtonFocus img.mceMenuButton {border: 1px solid gray; border-left: 1px solid #F5F4F2; margin-left: 0;} 47 span.mceMenuHover img {border: 1px solid #0A246A; background-color: #B6BDD2;} 48 span.mceMenuButtonSelected.mceMenuHover img.mceMenuButton {border: 1px solid #0A246A; background-color: #B6BDD2; border-left: 0;} 270 49 271 50 /* Menu */ 272 51 273 .mceMenu { 274 position: absolute; 275 left: 0; 276 top: 0; 277 display: none; 278 z-index: 100; 279 background-color: white; 280 border: 1px solid gray; 281 font-weight: normal; 282 } 52 .mceMenu {position: absolute; left: 0; top: 0; display: none; z-index: 100; background-color: white; border: 1px solid gray; font-weight: normal;} 53 .mceMenu a, .mceMenuTitle, .mceMenuDisabled {display: block; width: 100%; text-decoration: none; background-color: white; font-family: Tahoma, Verdana, Arial, Helvetica; font-size: 11px; line-height: 20px; color: black;} 54 .mceMenu a:hover {background-color: #B6BDD2; color: black; text-decoration: none !important;} 55 .mceMenu span {padding-left: 10px; padding-right: 10px; display: block; line-height: 20px;} 56 .mceMenuSeparator {border-bottom: 1px solid gray; background-color: gray; height: 1px;} 57 .mceMenuTitle span {padding-left: 5px;} 58 .mceMenuTitle {background-color: #DDDDDD; font-weight: bold;} 59 .mceMenuDisabled {color: gray;} 60 span.mceMenuSelectedItem {background-image: url('../images/menu_check.gif'); background-repeat: no-repeat; background-position: 5px 8px; padding-left: 20px;} 61 span.mceMenuCheckItem {padding-left: 20px;} 62 span.mceMenuLine {display: block; position: absolute; left: 0; top: -1px; background-color: #F5F4F2; width: 30px; height: 1px; overflow: hidden; padding-left: 0; padding-right: 0;} 63 .mceColors table, .mceColors td {margin: 0; padding: 2px;} 64 a.mceMoreColors {width: 130px; margin: 0; padding: 0; margin-left: 3px; margin-bottom: 3px; text-align: center; border: 1px solid white;} 65 .mceColorPreview {position: absolute; left: 0; top: 0; margin-left: 3px; margin-top: 15px; width: 16px; height: 4px; background-color: red;} 66 a.mceMoreColors:hover {border: 1px solid #0A246A;} 67 .mceColors td a {width: 9px; height: 9px; overflow: hidden; border: 1px solid #808080;} 283 68 284 .mceMenu a, .mceMenuTitle, .mceMenuDisabled { 285 display: block; 286 width: 100%; 287 text-decoration: none; 288 background-color: white; 289 font-family: Tahoma, Verdana, Arial, Helvetica; 290 font-size: 11px; 291 line-height: 20px; 292 color: black; 293 } 69 /* MSIE 6 specific rules */ 294 70 295 .mceMenu a:hover { 296 background-color: #B6BDD2; 297 color: black; 298 } 71 * html a.mceButtonNormal img, * html a.mceButtonSelected img, * html a.mceButtonDisabled img {border: 0 !important; margin-top: 2px; margin-bottom: 1px;} 72 * html a.mceButtonDisabled img {filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30); border: 0 !important;} 73 * html a.mceButtonDisabled {border: 1px solid #F0F0EE !important;} 74 * html a.mceButtonNormal, * html a.mceButtonSelected {border: 1px solid #F0F0EE !important; cursor: default;} 75 * html a.mceButtonSelected {border: 1px solid #6779AA !important; background-color: #D4D5D8;} 76 * html a.mceButtonNormal:hover, * html a.mceButtonSelected:hover {border: 1px solid #0A246A !important; background-color: #B6BDD2; cursor: default;} 77 * html .mceSelectList {margin-top: 2px;} 78 * html span.mceMenuButton, * html span.mceMenuButtonFocus {position: relative; left: 0; top: 0;} 79 * html span.mceMenuButton img, * html span.mceMenuButtonSelected img, * html span.mceMenuButtonFocus img {position: relative; top: 1px;} 80 * html a.mceMoreColors {width: 132px;} 81 * html .mceColors td a {width: 10px; height: 10px;} 82 * html .mceColorPreview {margin-left: 2px; margin-top: 14px;} 299 83 300 .mceMenu span { 301 padding-left: 10px; 302 padding-right: 10px; 303 display: block; 304 line-height: 20px; 305 } 84 /* MSIE 7 specific rules */ 306 85 307 .mceMenuSeparator { 308 border-bottom: 1px solid gray; 309 background-color: gray; 310 height: 1px; 311 } 312 313 .mceMenuTitle span { 314 padding-left: 5px; 315 } 316 317 .mceMenuTitle { 318 background-color: #DDDDDD; 319 font-weight: bold; 320 } 321 322 .mceMenuDisabled { 323 color: gray; 324 } 325 326 span.mceMenuSelectedItem { 327 background-image: url('../images/menu_check.gif'); 328 background-repeat: no-repeat; 329 background-position: 5px 8px; 330 padding-left: 20px; 331 } 332 333 span.mceMenuCheckItem { 334 padding-left: 20px; 335 } 336 337 span.mceMenuLine { 338 display: block; 339 position: absolute; 340 left: 0; 341 top: -1px; 342 background-color: #F5F4F2; 343 width: 30px; 344 height: 1px; 345 overflow: hidden; 346 padding-left: 0; 347 padding-right: 0; 348 } 86 *:first-child+html a.mceButtonNormal img, *:first-child+html a.mceButtonSelected img, *:first-child+html a.mceButtonDisabled img {border: 0 !important; margin-top: 2px; margin-bottom: 1px;} 87 *:first-child+html a.mceButtonDisabled img {filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30); border: 0 !important;} 88 *:first-child+html a.mceButtonDisabled {border: 1px solid #F0F0EE !important;} 89 *:first-child+html a.mceButtonNormal, *:first-child+html a.mceButtonSelected {border: 1px solid #F0F0EE !important; cursor: default;} 90 *:first-child+html a.mceButtonSelected {border: 1px solid #6779AA !important; background-color: #D4D5D8;} 91 *:first-child+html a.mceButtonNormal:hover, *:first-child+html a.mceButtonSelected:hover {border: 1px solid #0A246A !important; background-color: #B6BDD2; cursor: default;} 92 *:first-child+html .mceSelectList {margin-top: 2px;} 93 *:first-child+html span.mceMenuButton, *:first-child+html span.mceMenuButtonFocus {position: relative; left: 0; top: 0;} 94 *:first-child+html span.mceMenuButton img, *:first-child+html span.mceMenuButtonSelected img, *:first-child+html span.mceMenuButtonFocus img {position: relative; top: 1px;} 95 *:first-child+html a.mceMoreColors {width: 132px;} 96 *:first-child+html .mceColors td a {width: 10px; height: 10px;} 97 *:first-child+html .mceColorPreview {margin: 0; padding-left: 4px; margin-top: 14px; width: 14px;} -
trunk/wp-includes/js/tinymce/themes/advanced/editor_template.js
r4080 r4506 1 1 /** 2 * $RCSfile: editor_template_src.js,v $ 3 * $Revision: 1.96 $ 4 * $Date: 2006/04/18 13:32:52 $ 2 * $Id: editor_template_src.js 129 2006-10-23 09:45:17Z spocke $ 5 3 * 6 4 * @author Moxiecode … … 13 11 var TinyMCE_AdvancedTheme = { 14 12 // Private theme fields 13 _defColors : "000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF", 15 14 _autoImportCSSClasses : true, 16 15 _resizer : {}, … … 44 43 ['sub', 'sub.gif', 'lang_theme_sub_desc', 'subscript'], 45 44 ['sup', 'sup.gif', 'lang_theme_sup_desc', 'superscript'], 46 ['forecolor', 'forecolor.gif', 'lang_theme_forecolor_desc', ' mceForeColor', true],47 ['backcolor', 'backcolor.gif', 'lang_theme_backcolor_desc', ' mceBackColor', true],45 ['forecolor', 'forecolor.gif', 'lang_theme_forecolor_desc', 'forecolor', true], 46 ['backcolor', 'backcolor.gif', 'lang_theme_backcolor_desc', 'HiliteColor', true], 48 47 ['charmap', 'charmap.gif', 'lang_theme_charmap_desc', 'mceCharMap'], 49 48 ['visualaid', 'visualaid.gif', 'lang_theme_visualaid_desc', 'mceToggleVisualAid'], … … 52 51 ], 53 52 54 _buttonMap : 'anchor,backcolor,bold,bullist,charmap,cleanup,code,copy,cut,forecolor,help,hr,image,indent,italic,justifycenter,justifyfull,justifyleft,justifyright,link,newdocument,numlist,outdent,paste,redo,removeformat,strikethrough,sub,sup,underline,undo,unlink,visualaid,advhr,ltr,rtl,emotions,flash,fullpage,fullscreen,iespell,insertdate,inserttime,pastetext,pasteword,selectall,preview,print,save,replace,search,table,cell_props,delete_col,delete_row,col_after,col_before,row_after,row_before,merge_cells,row_props,split_cells ',53 _buttonMap : 'anchor,backcolor,bold,bullist,charmap,cleanup,code,copy,cut,forecolor,help,hr,image,indent,italic,justifycenter,justifyfull,justifyleft,justifyright,link,newdocument,numlist,outdent,paste,redo,removeformat,strikethrough,sub,sup,underline,undo,unlink,visualaid,advhr,ltr,rtl,emotions,flash,fullpage,fullscreen,iespell,insertdate,inserttime,pastetext,pasteword,selectall,preview,print,save,replace,search,table,cell_props,delete_col,delete_row,col_after,col_before,row_after,row_before,merge_cells,row_props,split_cells,delete_table', 55 54 56 55 /** … … 58 57 */ 59 58 getControlHTML : function(button_name) { 60 var i, x ;59 var i, x, but; 61 60 62 61 // Lookup button in button list 63 62 for (i=0; i<TinyMCE_AdvancedTheme._buttons.length; i++) { 64 var but = TinyMCE_AdvancedTheme._buttons[i]; 63 but = TinyMCE_AdvancedTheme._buttons[i]; 64 65 if (but[0] == button_name && (button_name == "forecolor" || button_name == "backcolor")) 66 return tinyMCE.getMenuButtonHTML(but[0], but[2], '{$themeurl}/images/' + but[1], but[3] + "Menu", but[3], (but.length > 4 ? but[4] : false), (but.length > 5 ? but[5] : null)); 65 67 66 68 if (but[0] == button_name) … … 154 156 execCommand : function(editor_id, element, command, user_interface, value) { 155 157 switch (command) { 158 case 'mceHelp': 159 tinyMCE.openWindow({ 160 file : 'about.htm', 161 width : 480, 162 height : 380 163 }, { 164 tinymce_version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion, 165 tinymce_releasedate : tinyMCE.releaseDate, 166 inline : "yes" 167 }); 168 return true; 169 156 170 case "mceLink": 157 171 var inst = tinyMCE.getInstanceById(editor_id); … … 318 332 return true; 319 333 320 case "mceForeColor": 321 var template = new Array(); 322 var elm = tinyMCE.selectedInstance.getFocusElement(); 323 var inputColor = tinyMCE.getAttrib(elm, "color"); 324 325 if (inputColor == '') 326 inputColor = elm.style.color; 327 328 if (!inputColor) 329 inputColor = "#000000"; 330 331 template['file'] = 'color_picker.htm'; 332 template['width'] = 220; 333 template['height'] = 190; 334 335 tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", command : "forecolor", input_color : inputColor}); 334 case "forecolor": 335 var fcp = new TinyMCE_Layer(editor_id + '_fcPreview', false), p, img, elm; 336 337 TinyMCE_AdvancedTheme._hideMenus(editor_id); 338 339 if (!fcp.exists()) { 340 fcp.create('div', 'mceColorPreview', document.getElementById(editor_id + '_toolbar')); 341 elm = fcp.getElement(); 342 elm._editor_id = editor_id; 343 elm._command = "forecolor"; 344 elm._switchId = editor_id + "_forecolor"; 345 tinyMCE.addEvent(elm, 'click', TinyMCE_AdvancedTheme._handleMenuEvent); 346 tinyMCE.addEvent(elm, 'mouseover', TinyMCE_AdvancedTheme._handleMenuEvent); 347 tinyMCE.addEvent(elm, 'mouseout', TinyMCE_AdvancedTheme._handleMenuEvent); 348 } 349 350 img = tinyMCE.selectNodes(document.getElementById(editor_id + "_forecolor"), function(n) {return n.nodeName == "IMG";})[0]; 351 p = tinyMCE.getAbsPosition(img, document.getElementById(editor_id + '_toolbar')); 352 353 fcp.moveTo(p.absLeft, p.absTop); 354 fcp.getElement().style.backgroundColor = value != null ? value : tinyMCE.getInstanceById(editor_id).foreColor; 355 fcp.show(); 356 357 return false; 358 359 case "forecolorMenu": 360 TinyMCE_AdvancedTheme._hideMenus(editor_id); 361 362 // Create color layer 363 var ml = new TinyMCE_Layer(editor_id + '_fcMenu'); 364 365 if (!ml.exists()) 366 ml.create('div', 'mceMenu', document.body, TinyMCE_AdvancedTheme._getColorHTML(editor_id, 'theme_advanced_text_colors', 'forecolor')); 367 368 tinyMCE.switchClass(editor_id + '_forecolor', 'mceMenuButtonFocus'); 369 ml.moveRelativeTo(document.getElementById(editor_id + "_forecolor"), 'bl'); 370 371 ml.moveBy(tinyMCE.isMSIE && !tinyMCE.isOpera ? -1 : 1, -1); 372 373 if (tinyMCE.isOpera) 374 ml.moveBy(0, -2); 375 376 ml.show(); 336 377 return true; 337 378 338 case "mceBackColor": 339 var template = new Array(); 340 var elm = tinyMCE.selectedInstance.getFocusElement(); 341 var inputColor = elm.style.backgroundColor; 342 343 if (!inputColor) 344 inputColor = "#000000"; 345 346 template['file'] = 'color_picker.htm'; 347 template['width'] = 220; 348 template['height'] = 190; 349 350 template['width'] += tinyMCE.getLang('lang_theme_advanced_backcolor_delta_width', 0); 351 template['height'] += tinyMCE.getLang('lang_theme_advanced_backcolor_delta_height', 0); 352 353 tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", command : "HiliteColor", input_color : inputColor}); 354 //mceBackColor 379 case "HiliteColor": 380 var bcp = new TinyMCE_Layer(editor_id + '_bcPreview', false), p, img; 381 382 TinyMCE_AdvancedTheme._hideMenus(editor_id); 383 384 if (!bcp.exists()) { 385 bcp.create('div', 'mceColorPreview', document.getElementById(editor_id + '_toolbar')); 386 elm = bcp.getElement(); 387 elm._editor_id = editor_id; 388 elm._command = "HiliteColor"; 389 elm._switchId = editor_id + "_backcolor"; 390 tinyMCE.addEvent(elm, 'click', TinyMCE_AdvancedTheme._handleMenuEvent); 391 tinyMCE.addEvent(elm, 'mouseover', TinyMCE_AdvancedTheme._handleMenuEvent); 392 tinyMCE.addEvent(elm, 'mouseout', TinyMCE_AdvancedTheme._handleMenuEvent); 393 } 394 395 img = tinyMCE.selectNodes(document.getElementById(editor_id + "_backcolor"), function(n) {return n.nodeName == "IMG";})[0]; 396 p = tinyMCE.getAbsPosition(img, document.getElementById(editor_id + '_toolbar')); 397 398 bcp.moveTo(p.absLeft, p.absTop); 399 bcp.getElement().style.backgroundColor = value != null ? value : tinyMCE.getInstanceById(editor_id).backColor; 400 bcp.show(); 401 402 return false; 403 404 case "HiliteColorMenu": 405 TinyMCE_AdvancedTheme._hideMenus(editor_id); 406 407 // Create color layer 408 var ml = new TinyMCE_Layer(editor_id + '_bcMenu'); 409 410 if (!ml.exists()) 411 ml.create('div', 'mceMenu', document.body, TinyMCE_AdvancedTheme._getColorHTML(editor_id, 'theme_advanced_background_colors', 'HiliteColor')); 412 413 tinyMCE.switchClass(editor_id + '_backcolor', 'mceMenuButtonFocus'); 414 ml.moveRelativeTo(document.getElementById(editor_id + "_backcolor"), 'bl'); 415 416 ml.moveBy(tinyMCE.isMSIE && !tinyMCE.isOpera ? -1 : 1, -1); 417 418 if (tinyMCE.isOpera) 419 ml.moveBy(0, -2); 420 421 ml.show(); 355 422 return true; 356 423 … … 434 501 getEditorTemplate : function(settings, editorId) { 435 502 function removeFromArray(in_array, remove_array) { 436 var outArray = new Array() ;503 var outArray = new Array(), skip; 437 504 438 505 for (var i=0; i<in_array.length; i++) { … … 531 598 532 599 // Setup template html 533 template['html'] = '<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width }px;height:{$height}px"><tbody>';600 template['html'] = '<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width_style};height:{$height_style}"><tbody>'; 534 601 535 602 if (toolbarLocation == "top") { 536 template['html'] += '<tr><td class="mceToolbarTop" align="' + toolbarAlign + '" height="1" nowrap="nowrap"> ' + toolbarHTML + '</td></tr>';603 template['html'] += '<tr><td class="mceToolbarTop" align="' + toolbarAlign + '" height="1" nowrap="nowrap"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>'; 537 604 } 538 605 … … 545 612 546 613 if (toolbarLocation == "bottom") { 547 template['html'] += '<tr><td class="mceToolbarBottom" align="' + toolbarAlign + '" height="1"> ' + toolbarHTML + '</td></tr>';614 template['html'] += '<tr><td class="mceToolbarBottom" align="' + toolbarAlign + '" height="1"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>'; 548 615 } 549 616 … … 616 683 var curCSS = tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_class", defaultContainerCSS); 617 684 618 for (var j=0; j<curContainer.length; j++) { 685 curContainer = removeFromArray(curContainer, tinyMCE.getParam("theme_advanced_disable", "", true, ',')); 686 687 for (var j=0; j<curContainer.length; j++) 619 688 curContainerHTML += tinyMCE.getControlHTML(curContainer[j]); 620 }621 689 622 690 if (curContainer.length > 0) { … … 665 733 }, 666 734 735 _handleMenuEvent : function(e) { 736 var te = tinyMCE.isMSIE ? window.event.srcElement : e.target; 737 tinyMCE._menuButtonEvent(e.type == "mouseover" ? "over" : "out", document.getElementById(te._switchId)); 738 739 if (e.type == "click") 740 tinyMCE.execInstanceCommand(te._editor_id, te._command); 741 }, 742 743 _hideMenus : function(id) { 744 var fcml = new TinyMCE_Layer(id + '_fcMenu'), bcml = new TinyMCE_Layer(id + '_bcMenu'); 745 746 if (fcml.exists() && fcml.isVisible()) { 747 tinyMCE.switchClass(id + '_forecolor', 'mceMenuButton'); 748 fcml.hide(); 749 } 750 751 if (bcml.exists() && bcml.isVisible()) { 752 tinyMCE.switchClass(id + '_backcolor', 'mceMenuButton'); 753 bcml.hide(); 754 } 755 }, 756 667 757 /** 668 758 * Node change handler. 669 759 */ 670 760 handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection, setup_content) { 761 var alignNode, breakOut, classNode; 762 671 763 function selectByValue(select_elm, value, first_index) { 672 764 first_index = typeof(first_index) == "undefined" ? false : true; … … 703 795 var inst = tinyMCE.getInstanceById(editor_id); 704 796 var doc = inst.getDoc(); 797 TinyMCE_AdvancedTheme._hideMenus(editor_id); 705 798 706 799 if (pathElm) { … … 728 821 var nodeData = ""; 729 822 823 if (nodeName.indexOf("html:") == 0) 824 nodeName = nodeName.substring(5); 825 730 826 if (nodeName == "b") { 731 827 nodeName = "strong"; … … 782 878 } 783 879 784 if ( getAttrib(path[i], 'href') != "") {880 if (path[i].nodeName == 'A' && getAttrib(path[i], 'href') != "") { 785 881 var href = tinyMCE.getAttrib(path[i], "mce_href"); 786 882 … … 791 887 } 792 888 793 if (nodeName == "img" && tinyMCE.getAttrib(path[i], "class").indexOf('mceItemFlash') != -1) { 794 nodeName = "flash"; 795 nodeData = "src: " + path[i].getAttribute('title'); 889 className = tinyMCE.getAttrib(path[i], "class"); 890 if ((nodeName == "img" || nodeName == "span") && className.indexOf('mceItem') != -1) { 891 nodeName = className.replace(/mceItem([a-z]+)/gi, '$1').toLowerCase(); 892 nodeData = path[i].getAttribute('title'); 796 893 } 797 894 … … 1028 1125 1029 1126 case "IMG": 1030 if (getAttrib(node, 'name').indexOf('mce_') != 0 ) {1127 if (getAttrib(node, 'name').indexOf('mce_') != 0 && tinyMCE.getAttrib(node, 'class').indexOf('mceItem') == -1) { 1031 1128 tinyMCE.switchClass(editor_id + '_image', 'mceButtonSelected'); 1032 1129 } … … 1149 1246 } 1150 1247 } 1248 1249 // Remove pesky table controls 1250 inst.useCSS = false; 1151 1251 }, 1152 1252 … … 1256 1356 }, 1257 1357 1358 _getColorHTML : function(id, n, cm) { 1359 var i, h, cl; 1360 1361 h = '<span class="mceMenuLine"></span>'; 1362 cl = tinyMCE.getParam(n, TinyMCE_AdvancedTheme._defColors).split(','); 1363 1364 h += '<table class="mceColors"><tr>'; 1365 for (i=0; i<cl.length; i++) { 1366 c = 'tinyMCE.execInstanceCommand(\'' + id + '\', \'' + cm + '\', false, \'#' + cl[i] + '\');'; 1367 h += '<td><a href="javascript:' + c + '" style="background-color: #' + cl[i] + '" onclick="' + c + ';return false;"></a></td>'; 1368 1369 if ((i+1) % 8 == 0) 1370 h += '</tr><tr>'; 1371 } 1372 1373 h += '</tr></table>'; 1374 /* 1375 h += '<a href="" class="mceMoreColors">More colors</a>'; 1376 */ 1377 1378 return h; 1379 }, 1380 1258 1381 _insertImage : function(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout) { 1259 1382 tinyMCE.execCommand('mceBeginUndoLevel'); -
trunk/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js
r3664 r4506 4 4 } 5 5 6 // Fixes some charcode issues7 function fixContent(html) {8 /* html = html.replace(new RegExp('<(p|hr|table|tr|td|ol|ul|object|embed|li|blockquote)', 'gi'),'\n<$1');9 html = html.replace(new RegExp('<\/(p|ol|ul|li|table|tr|td|blockquote|object)>', 'gi'),'</$1>\n');10 html = tinyMCE.regexpReplace(html, '<br />','<br />\n','gi');11 html = tinyMCE.regexpReplace(html, '\n\n','\n','gi');*/12 return html;13 }14 15 6 function onLoadInit() { 16 7 tinyMCEPopup.resizeToInnerSize(); 17 8 18 document.forms[0].htmlSource.value = fixContent(tinyMCE.getContent(tinyMCE.getWindowArg('editor_id'))); 9 // Remove Gecko spellchecking 10 if (tinyMCE.isGecko) 11 document.body.spellcheck = tinyMCE.getParam("gecko_spellcheck"); 12 13 document.getElementById('htmlSource').value = tinyMCE.getContent(tinyMCE.getWindowArg('editor_id')); 14 19 15 resizeInputs(); 16 17 if (tinyMCE.getParam("theme_advanced_source_editor_wrap", true)) { 18 setWrap('soft'); 19 document.getElementById('wraped').checked = true; 20 } 20 21 } 21 22 22 23 function setWrap(val) { 23 var s = document. forms[0].htmlSource;24 var s = document.getElementById('htmlSource'); 24 25 25 26 s.wrap = val; … … 44 45 45 46 function resizeInputs() { 47 var el = document.getElementById('htmlSource'); 48 46 49 if (!tinyMCE.isMSIE) { 47 50 wHeight = self.innerHeight-80; … … 52 55 } 53 56 54 document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px';55 document.forms[0].htmlSource.style.width = Math.abs(wWidth) + 'px';57 el.style.height = Math.abs(wHeight) + 'px'; 58 el.style.width = Math.abs(wWidth) + 'px'; 56 59 } 57 60 58 function renderWordWrap() {59 if (tinyMCE.isMSIE || tinyMCE.isGecko)60 document.write('<input type="checkbox" name="wraped" id="wraped" onclick="toggleWordWrap(this);" class="wordWrapCode" /><label for="wraped">{$lang_theme_code_wordwrap}</label>');61 } -
trunk/wp-includes/js/tinymce/themes/advanced/langs/en.js
r3664 r4506 39 39 theme_h5 : 'Heading 5', 40 40 theme_h6 : 'Heading 6', 41 theme_blockquote : 'Blockquote', 42 theme_code : 'Code', 43 theme_samp : 'Code sample', 44 theme_dt : 'Definition term ', 45 theme_dd : 'Definition description', 41 46 theme_colorpicker_title : 'Select a color', 42 47 theme_colorpicker_apply : 'Apply', … … 73 78 not_set : '-- Not set --', 74 79 close : 'Close', 75 toolbar_focus : 'Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X' 80 toolbar_focus : 'Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X', 81 invalid_data : 'Error: Invalid values entered, these are marked in red.' 76 82 }); -
trunk/wp-includes/js/tinymce/tiny_mce.js
r4080 r4506 3 3 4 4 function TinyMCE_Engine() { 5 var ua; 6 5 7 this.majorVersion = "2"; 6 this.minorVersion = "0. 6.1";7 this.releaseDate = "2006- 05-04";8 this.minorVersion = "0.8"; 9 this.releaseDate = "2006-10-23"; 8 10 9 11 this.instances = new Array(); … … 16 18 this.currentConfig = 0; 17 19 this.eventHandlers = new Array(); 20 this.log = new Array(); 21 this.undoLevels = []; 22 this.undoIndex = 0; 23 this.typingUndoIndex = -1; 18 24 19 25 // Browser check 20 varua = navigator.userAgent;26 ua = navigator.userAgent; 21 27 this.isMSIE = (navigator.appName == "Microsoft Internet Explorer"); 22 28 this.isMSIE5 = this.isMSIE && (ua.indexOf('MSIE 5') != -1); 23 29 this.isMSIE5_0 = this.isMSIE && (ua.indexOf('MSIE 5.0') != -1); 30 this.isMSIE7 = this.isMSIE && (ua.indexOf('MSIE 7') != -1); 24 31 this.isGecko = ua.indexOf('Gecko') != -1; 25 32 this.isSafari = ua.indexOf('Safari') != -1; … … 43 50 } 44 51 52 this.isIE = this.isMSIE; 53 this.isRealIE = this.isMSIE && !this.isOpera; 54 45 55 // TinyMCE editor id instance counter 46 56 this.idCounter = 0; … … 49 59 TinyMCE_Engine.prototype = { 50 60 init : function(settings) { 51 var theme; 61 var theme, nl, baseHREF = "", i; 62 63 // IE 5.0x is no longer supported since 5.5, 6.0 and 7.0 now exists. We can't support old browsers forever, sorry. 64 if (this.isMSIE5_0) 65 return; 52 66 53 67 this.settings = settings; … … 61 75 var elements = document.getElementsByTagName('script'); 62 76 77 // If base element found, add that infront of baseURL 78 nl = document.getElementsByTagName('base'); 79 for (i=0; i<nl.length; i++) { 80 if (nl[i].href) 81 baseHREF = nl[i].href; 82 } 83 63 84 for (var i=0; i<elements.length; i++) { 64 85 if (elements[i].src && (elements[i].src.indexOf("tiny_mce.js") != -1 || elements[i].src.indexOf("tiny_mce_dev.js") != -1 || elements[i].src.indexOf("tiny_mce_src.js") != -1 || elements[i].src.indexOf("tiny_mce_gzip") != -1)) { … … 72 93 tinyMCE.srcMode = settings.exec_mode == "src" ? '_src' : ''; 73 94 74 tinyMCE.baseURL = src; 95 // Force it absolute if page has a base href 96 if (baseHREF != "" && src.indexOf('://') == -1) 97 tinyMCE.baseURL = baseHREF + src; 98 else 99 tinyMCE.baseURL = src; 100 75 101 break; 76 102 } … … 101 127 this._def("editor_selector", ""); 102 128 this._def("editor_deselector", "mceNoEditor"); 103 this._def("valid_elements", "+a[id|style|rel|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],-strike[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|style],-ul[class|style],-li[class|style],br,img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align],-sub[style|class],-sup[style|class],-blockquote[dir|style],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],tfoot[id|class], -td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[style|class|align],-pre[class|align|style],address[class|align|style],-h1[id|style|dir|class|align],-h2[id|style|dir|class|align],-h3[id|style|dir|class|align],-h4[id|style|dir|class|align],-h5[id|style|dir|class|align],-h6[id|style|dir|class|align],hr[class|style],-font[face|size|style|id|class|dir|color],dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang]");129 this._def("valid_elements", "+a[id|style|rel|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],-strike[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|style],-ul[class|style],-li[class|style],br,img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align],-sub[style|class],-sup[style|class],-blockquote[dir|style],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],tfoot[id|class],#td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[style|class|align],-pre[class|align|style],address[class|align|style],-h1[id|style|dir|class|align],-h2[id|style|dir|class|align],-h3[id|style|dir|class|align],-h4[id|style|dir|class|align],-h5[id|style|dir|class|align],-h6[id|style|dir|class|align],hr[class|style],-font[face|size|style|id|class|dir|color],dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang],cite[title|id|class|style|dir|lang],abbr[title|id|class|style|dir|lang],acronym[title|id|class|style|dir|lang],del[title|id|class|style|dir|lang|datetime|cite],ins[title|id|class|style|dir|lang|datetime|cite]"); 104 130 this._def("extended_valid_elements", ""); 105 131 this._def("invalid_elements", ""); … … 123 149 this._def("custom_undo_redo_keyboard_shortcuts", true); 124 150 this._def("custom_undo_redo_restore_selection", true); 151 this._def("custom_undo_redo_global", false); 125 152 this._def("verify_html", true); 126 153 this._def("apply_source_formatting", false); … … 165 192 this._def("hidden_tab_class", ''); 166 193 this._def("display_tab_class", ''); 194 this._def("gecko_spellcheck", false); 167 195 168 196 // Force strict loading mode to false on non Gecko browsers … … 187 215 188 216 // If not super absolute make it so 189 varbaseHREF = tinyMCE.settings['document_base_url'];217 baseHREF = tinyMCE.settings['document_base_url']; 190 218 var h = document.location.href; 191 219 var p = h.indexOf('://'); … … 208 236 209 237 theme = this.settings['theme']; 210 this.blockRegExp = new RegExp("^(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|blockquote|center|dl|dt|dd|dir|fieldset|form|noscript|noframes|menu|isindex|samp)$", "i"); 238 this.inlineStrict = 'A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment'; 239 this.inlineTransitional = 'A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment'; 240 this.blockElms = 'H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP'; 241 this.blockRegExp = new RegExp("^(" + this.blockElms + ")$", "i"); 211 242 this.posKeyCodes = new Array(13,45,36,35,33,34,37,38,39,40); 212 243 this.uniqueURL = 'javascript:TINYMCE_UNIQUEURL();'; // Make unique URL non real URL … … 217 248 this.settings['theme_href'] = tinyMCE.baseURL + "/themes/" + theme; 218 249 219 if (!tinyMCE.is MSIE)250 if (!tinyMCE.isIE || tinyMCE.isOpera) 220 251 this.settings['force_br_newlines'] = false; 221 252 … … 239 270 else 240 271 this.settings['editor_css'] = cssPath; 241 } else 242 this.settings['editor_css'] = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_ui.css"; 272 } else { 273 if (this.settings.editor_css != '') 274 this.settings['editor_css'] = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_ui.css"; 275 } 243 276 244 277 if (tinyMCE.settings['debug']) { … … 256 289 // Only do this once 257 290 if (this.configs.length == 0) { 258 // Is Safari enabled259 if (this.isSafari && this.getParam('safari_warning', false))260 alert("Safari support is very limited and should be considered experimental.\nSo there is no need to even submit bugreports on this early version.\nYou can disable this message by setting: safari_warning option to false");261 262 291 if (typeof(TinyMCECompressed) == "undefined") { 263 292 tinyMCE.addEvent(window, "DOMContentLoaded", TinyMCE_Engine.prototype.onLoad); 264 293 265 if (tinyMCE.is MSIE && !tinyMCE.isOpera) {294 if (tinyMCE.isRealIE) { 266 295 if (document.body) 267 296 tinyMCE.addEvent(document.body, "readystatechange", TinyMCE_Engine.prototype.onLoad); … … 289 318 290 319 // Setup entities 291 settings['cleanup_entities'] = new Array(); 292 var entities = tinyMCE.getParam('entities', '', true, ','); 293 for (var i=0; i<entities.length; i+=2) 294 settings['cleanup_entities']['c' + entities[i]] = entities[i+1]; 320 if (tinyMCE.getParam('entity_encoding') == 'named') { 321 settings['cleanup_entities'] = new Array(); 322 var entities = tinyMCE.getParam('entities', '', true, ','); 323 for (var i=0; i<entities.length; i+=2) 324 settings['cleanup_entities']['c' + entities[i]] = entities[i+1]; 325 } 295 326 296 327 // Save away this config … … 300 331 // Start loading first one in chain 301 332 this.loadNextScript(); 333 334 // Force flicker free CSS backgrounds in IE 335 if (this.isIE && !this.isOpera) { 336 try { 337 document.execCommand('BackgroundImageCache', false, true); 338 } catch (e) { 339 } 340 } 302 341 }, 303 342 304 343 _addUnloadEvents : function() { 305 if (tinyMCE.is MSIE) {344 if (tinyMCE.isIE) { 306 345 if (tinyMCE.settings['add_unload_trigger']) { 307 346 tinyMCE.addEvent(window, "unload", TinyMCE_Engine.prototype.unloadHandler); … … 317 356 var v = tinyMCE.getParam(key, def_val); 318 357 319 v = t ? v.replace(/\s+/g, "") : v;358 v = t ? v.replace(/\s+/g, "") : v; 320 359 321 360 this.settings[key] = v; … … 410 449 411 450 for (x = 0,csslen = ar.length; x<csslen; x++) { 412 ignore_css = false;413 414 451 if (ar[x] != null && ar[x] != 'null' && ar[x].length > 0) { 415 452 /* Make sure it doesn't exist. */ … … 467 504 468 505 confirmAdd : function(e, settings) { 469 var elm = tinyMCE.is MSIE ? event.srcElement : e.target;506 var elm = tinyMCE.isIE ? event.srcElement : e.target; 470 507 var elementId = elm.name ? elm.name : elm.id; 471 508 … … 493 530 tinyMCE._setHTML(doc, inst.formElement.value); 494 531 495 if (!tinyMCE.is MSIE)532 if (!tinyMCE.isIE) 496 533 doc.body.innerHTML = tinyMCE._cleanupHTML(inst, doc, this.settings, doc.body, inst.visualAid); 497 534 } … … 509 546 }, 510 547 548 removeInstance : function(ti) { 549 var t = [], n, i; 550 551 // Remove from instances 552 for (n in tinyMCE.instances) { 553 i = tinyMCE.instances[n]; 554 555 if (tinyMCE.isInstance(i) && ti != i) 556 t[n] = i; 557 } 558 559 tinyMCE.instances = t; 560 561 // Remove from global undo/redo 562 n = []; 563 t = tinyMCE.undoLevels; 564 565 for (i=0; i<t.length; i++) { 566 if (t[i] != ti) 567 n.push(t[i]); 568 } 569 570 tinyMCE.undoLevels = n; 571 tinyMCE.undoIndex = n.length; 572 573 return ti; 574 }, 575 511 576 removeMCEControl : function(editor_id) { 512 var inst = tinyMCE.getInstanceById(editor_id) ;577 var inst = tinyMCE.getInstanceById(editor_id), h, re, ot, tn; 513 578 514 579 if (inst) { … … 516 581 517 582 editor_id = inst.editorId; 518 var html = tinyMCE.getContent(editor_id); 519 520 // Remove editor instance from instances array 521 var tmpInstances = new Array(); 522 for (var instanceName in tinyMCE.instances) { 523 var instance = tinyMCE.instances[instanceName]; 524 if (!tinyMCE.isInstance(instance)) 525 continue; 526 527 if (instanceName != editor_id) 528 tmpInstances[instanceName] = instance; 529 } 530 tinyMCE.instances = tmpInstances; 583 h = tinyMCE.getContent(editor_id); 584 585 this.removeInstance(inst); 531 586 532 587 tinyMCE.selectedElement = null; … … 534 589 535 590 // Remove element 536 var replaceElement = document.getElementById(editor_id + "_parent"); 537 var oldTargetElement = inst.oldTargetElement; 538 var targetName = oldTargetElement.nodeName.toLowerCase(); 539 540 if (targetName == "textarea" || targetName == "input") { 541 // Just show the old text area 542 replaceElement.parentNode.removeChild(replaceElement); 543 oldTargetElement.style.display = "inline"; 544 oldTargetElement.value = html; 591 re = document.getElementById(editor_id + "_parent"); 592 ot = inst.oldTargetElement; 593 tn = ot.nodeName.toLowerCase(); 594 595 if (tn == "textarea" || tn == "input") { 596 re.parentNode.removeChild(re); 597 ot.style.display = "inline"; 598 ot.value = h; 545 599 } else { 546 oldTargetElement.innerHTML = html; 547 oldTargetElement.style.display = 'block'; 548 549 replaceElement.parentNode.insertBefore(oldTargetElement, replaceElement); 550 replaceElement.parentNode.removeChild(replaceElement); 600 ot.innerHTML = h; 601 ot.style.display = 'block'; 602 re.parentNode.insertBefore(ot, re); 603 re.parentNode.removeChild(re); 551 604 } 552 605 } … … 594 647 595 648 execInstanceCommand : function(editor_id, command, user_interface, value, focus) { 596 var inst = tinyMCE.getInstanceById(editor_id); 649 var inst = tinyMCE.getInstanceById(editor_id), r; 650 597 651 if (inst) { 652 r = inst.selection.getRng(); 653 598 654 if (typeof(focus) == "undefined") 599 655 focus = true; 600 656 601 if (focus) 657 // IE bug lost focus on images in absolute divs Bug #1534575 658 if (focus && (!r || !r.item)) 602 659 inst.contentWindow.focus(); 603 660 … … 606 663 607 664 this.selectedElement = inst.getFocusElement(); 608 this.selectedInstance = inst;665 inst.select(); 609 666 tinyMCE.execCommand(command, user_interface, value); 610 667 611 668 // Cancel event so it doesn't call onbeforeonunlaod 612 if (tinyMCE.is MSIE && window.event != null)669 if (tinyMCE.isIE && window.event != null) 613 670 tinyMCE.cancelEvent(window.event); 614 671 } … … 616 673 617 674 execCommand : function(command, user_interface, value) { 675 var inst = tinyMCE.selectedInstance; 676 618 677 // Default input 619 678 user_interface = user_interface ? user_interface : false; 620 679 value = value ? value : null; 621 680 622 if ( tinyMCE.selectedInstance)623 tinyMCE.selectedInstance.switchSettings();681 if (inst) 682 inst.switchSettings(); 624 683 625 684 switch (command) { 626 case 'mceHelp': 627 tinyMCE.openWindow({ 628 file : 'about.htm', 629 width : 480, 630 height : 380 631 }, { 632 tinymce_version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion, 633 tinymce_releasedate : tinyMCE.releaseDate, 634 inline : "yes" 635 }); 636 return; 685 case "Undo": 686 if (this.getParam('custom_undo_redo_global')) { 687 if (this.undoIndex > 0) { 688 tinyMCE.nextUndoRedoAction = 'Undo'; 689 inst = this.undoLevels[--this.undoIndex]; 690 inst.select(); 691 692 if (!tinyMCE.nextUndoRedoInstanceId) 693 inst.execCommand('Undo'); 694 } 695 } else 696 inst.execCommand('Undo'); 697 return true; 698 699 case "Redo": 700 if (this.getParam('custom_undo_redo_global')) { 701 if (this.undoIndex <= this.undoLevels.length - 1) { 702 tinyMCE.nextUndoRedoAction = 'Redo'; 703 inst = this.undoLevels[this.undoIndex++]; 704 inst.select(); 705 706 if (!tinyMCE.nextUndoRedoInstanceId) 707 inst.execCommand('Redo'); 708 } 709 } else 710 inst.execCommand('Redo'); 711 712 return true; 637 713 638 714 case 'mceFocus': 639 715 var inst = tinyMCE.getInstanceById(value); 640 716 if (inst) 641 inst. contentWindow.focus();717 inst.getWin().focus(); 642 718 return; 643 719 … … 658 734 case "mceResetDesignMode": 659 735 // Resets the designmode state of the editors in Gecko 660 if (!tinyMCE.is MSIE) {736 if (!tinyMCE.isIE) { 661 737 for (var n in tinyMCE.instances) { 662 738 if (!tinyMCE.isInstance(tinyMCE.instances[n])) … … 674 750 } 675 751 676 if ( this.selectedInstance) {677 this.selectedInstance.execCommand(command, user_interface, value);752 if (inst) { 753 inst.execCommand(command, user_interface, value); 678 754 } else if (tinyMCE.settings['focus_alert']) 679 755 alert(tinyMCELang['lang_focus_alert']); … … 697 773 if (aw.indexOf('%') == -1) { 698 774 aw = parseInt(aw); 699 aw = aw < 0? 300 : aw;775 aw = (isNaN(aw) || aw < 0) ? 300 : aw; 700 776 aw = aw + "px"; 701 777 } … … 703 779 if (ah.indexOf('%') == -1) { 704 780 ah = parseInt(ah); 705 ah = ah < 0? 240 : ah;781 ah = (isNaN(ah) || ah < 0) ? 240 : ah; 706 782 ah = ah + "px"; 707 783 } 708 784 709 785 iframe.setAttribute("id", id); 786 iframe.setAttribute("name", id); 710 787 iframe.setAttribute("class", "mceEditorIframe"); 711 788 iframe.setAttribute("border", "0"); … … 724 801 725 802 // Must have a src element in MSIE HTTPs breaks aswell as absoute URLs 726 if (tinyMCE.is MSIE && !tinyMCE.isOpera)803 if (tinyMCE.isRealIE) 727 804 iframe.setAttribute("src", this.settings['default_document']); 728 805 … … 735 812 736 813 // MSIE 5.0 issue 737 if (tinyMCE.is MSIE && !tinyMCE.isOpera)814 if (tinyMCE.isRealIE) 738 815 replace_element.outerHTML = iframe.outerHTML; 739 816 else 740 817 replace_element.parentNode.replaceChild(iframe, replace_element); 741 818 742 if (tinyMCE.is MSIE && !tinyMCE.isOpera)819 if (tinyMCE.isRealIE) 743 820 return win.frames[id]; 744 821 else … … 747 824 748 825 setupContent : function(editor_id) { 749 var inst = tinyMCE.instances[editor_id] ;826 var inst = tinyMCE.instances[editor_id], i; 750 827 var doc = inst.getDoc(); 751 828 var head = doc.getElementsByTagName('head').item(0); … … 763 840 764 841 // Not loaded correctly hit it again, Mozilla bug #997860 765 if (!tinyMCE.is MSIE && tinyMCE.getParam("setupcontent_reload", false) && doc.title != "blank_page") {842 if (!tinyMCE.isIE && tinyMCE.getParam("setupcontent_reload", false) && doc.title != "blank_page") { 766 843 // This part will remove the designMode status 767 844 // Failes first time in Firefox 1.5b2 on Mac … … 787 864 } 788 865 866 // BlockFormat shortcuts keys 867 for (i=1; i<=6; i++) 868 inst.addShortcut('ctrl', '' + i, '', 'FormatBlock', false, '<h' + i + '>'); 869 870 inst.addShortcut('ctrl', '7', '', 'FormatBlock', false, '<p>'); 871 inst.addShortcut('ctrl', '8', '', 'FormatBlock', false, '<div>'); 872 inst.addShortcut('ctrl', '9', '', 'FormatBlock', false, '<address>'); 873 789 874 // Add default shortcuts for gecko 790 875 if (tinyMCE.isGecko) { … … 796 881 // Setup span styles 797 882 if (tinyMCE.getParam("convert_fonts_to_spans")) 798 inst.get Doc().body.setAttribute('id', 'mceSpanFonts');883 inst.getBody().setAttribute('id', 'mceSpanFonts'); 799 884 800 885 if (tinyMCE.settings['nowrap']) … … 805 890 806 891 // Add on document element in Mozilla 807 if (!tinyMCE.is MSIE)892 if (!tinyMCE.isIE) 808 893 doc.documentElement.editorId = editor_id; 809 894 … … 824 909 content = tinyMCE._customCleanup(inst, "insert_to_editor", content); 825 910 826 if (tinyMCE.is MSIE) {911 if (tinyMCE.isIE) { 827 912 // Ugly!!! 828 913 window.setInterval('try{tinyMCE.getCSSClasses(tinyMCE.instances["' + editor_id + '"].getDoc(), "' + editor_id + '");}catch(e){}', 500); … … 838 923 839 924 // Fix for bug #958637 840 if (!tinyMCE.is MSIE) {925 if (!tinyMCE.isIE) { 841 926 var contentElement = inst.getDoc().createElement("body"); 842 927 var doc = inst.getDoc(); … … 850 935 if (tinyMCE.settings['cleanup_on_startup']) 851 936 tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, doc, this.settings, contentElement)); 852 else { 853 // Convert all strong/em to b/i 854 content = tinyMCE.regexpReplace(content, "<strong", "<b", "gi"); 855 content = tinyMCE.regexpReplace(content, "<em(/?)>", "<i$1>", "gi"); 856 content = tinyMCE.regexpReplace(content, "<em ", "<i ", "gi"); 857 content = tinyMCE.regexpReplace(content, "</strong>", "</b>", "gi"); 858 content = tinyMCE.regexpReplace(content, "</em>", "</i>", "gi"); 937 else 859 938 tinyMCE.setInnerHTML(inst.getBody(), content); 860 }861 939 862 940 tinyMCE.convertAllRelativeURLs(inst.getBody()); … … 882 960 883 961 // Re-add design mode on mozilla 884 if (!tinyMCE.is MSIE)962 if (!tinyMCE.isIE) 885 963 tinyMCE.addEventHandlers(inst); 886 964 887 965 // Add blur handler 888 if (tinyMCE.is MSIE) {966 if (tinyMCE.isIE) { 889 967 tinyMCE.addEvent(inst.getBody(), "blur", TinyMCE_Engine.prototype._eventPatch); 890 968 tinyMCE.addEvent(inst.getBody(), "beforedeactivate", TinyMCE_Engine.prototype._eventPatch); // Bug #1439953 … … 899 977 900 978 // Trigger node change, this call locks buttons for tables and so forth 901 tinyMCE.selectedInstance = inst;979 inst.select(); 902 980 tinyMCE.selectedElement = inst.contentWindow.document.body; 903 981 … … 918 996 // Remove mce_src from textnodes and comments 919 997 tinyMCE.selectNodes(inst.getBody(), function(n) { 920 if (n.nodeType == 3 || n.nodeType == 8) { 921 n.nodeValue = n.nodeValue.replace(new RegExp('\\smce_src=\"[^\"]*\"', 'gi'), ""); 922 n.nodeValue = n.nodeValue.replace(new RegExp('\\smce_href=\"[^\"]*\"', 'gi'), ""); 923 } 998 if (n.nodeType == 3 || n.nodeType == 8) 999 n.nodeValue = n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"', 'gi'), ""); 924 1000 925 1001 return false; … … 927 1003 } 928 1004 1005 // Remove Gecko spellchecking 1006 if (tinyMCE.isGecko) 1007 inst.getBody().spellcheck = tinyMCE.getParam("gecko_spellcheck"); 1008 929 1009 // Cleanup any mess left from storyAwayURLs 930 1010 tinyMCE._removeInternal(inst.getBody()); 931 1011 932 tinyMCE.selectedInstance = inst;1012 inst.select(); 933 1013 tinyMCE.triggerNodeChange(false, true); 934 1014 }, … … 951 1031 // Remove mce_src from textnodes and comments 952 1032 tinyMCE.selectNodes(n, function(n) { 953 if (n.nodeType == 3 || n.nodeType == 8) { 954 n.nodeValue = n.nodeValue.replace(new RegExp('\\smce_src=\"[^\"]*\"', 'gi'), ""); 955 n.nodeValue = n.nodeValue.replace(new RegExp('\\smce_href=\"[^\"]*\"', 'gi'), ""); 956 } 1033 if (n.nodeType == 3 || n.nodeType == 8) 1034 n.nodeValue = n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"', 'gi'), ""); 957 1035 958 1036 return false; 959 1037 }); 960 }961 },962 963 removeTinyMCEFormElements : function(form_obj) {964 // Check if form is valid965 if (typeof(form_obj) == "undefined" || form_obj == null)966 return;967 968 // If not a form, find the form969 if (form_obj.nodeName != "FORM") {970 if (form_obj.form)971 form_obj = form_obj.form;972 else973 form_obj = tinyMCE.getParentElement(form_obj, "form");974 }975 976 // Still nothing977 if (form_obj == null)978 return;979 980 // Disable all UI form elements that TinyMCE created981 for (var i=0; i<form_obj.elements.length; i++) {982 var elementId = form_obj.elements[i].name ? form_obj.elements[i].name : form_obj.elements[i].id;983 984 if (elementId.indexOf('mce_editor_') == 0)985 form_obj.elements[i].disabled = true;986 1038 } 987 1039 }, … … 1017 1069 // Fixes odd MSIE bug where drag/droping elements in a iframe with height 100% breaks 1018 1070 // This logic forces the width/height to be in pixels while the user is drag/dropping 1019 if (tinyMCE.is MSIE && !tinyMCE.isOpera) {1071 if (tinyMCE.isRealIE) { 1020 1072 var ife = tinyMCE.selectedInstance.iframeElement; 1021 1073 … … 1035 1087 1036 1088 case "submit": 1037 tinyMCE.removeTinyMCEFormElements(tinyMCE.isMSIE ? window.event.srcElement : e.target);1038 1089 tinyMCE.triggerSave(); 1039 1090 tinyMCE.isNotDirty = true; … … 1041 1092 1042 1093 case "reset": 1043 var formObj = tinyMCE.is MSIE ? window.event.srcElement : e.target;1094 var formObj = tinyMCE.isIE ? window.event.srcElement : e.target; 1044 1095 1045 1096 for (var i=0; i<document.forms.length; i++) { … … 1055 1106 1056 1107 if (e.target.editorId) { 1057 tinyMCE. selectedInstance = tinyMCE.instances[e.target.editorId];1108 tinyMCE.instances[e.target.editorId].select(); 1058 1109 } else { 1059 1110 if (e.target.ownerDocument.editorId) 1060 tinyMCE. selectedInstance = tinyMCE.instances[e.target.ownerDocument.editorId];1111 tinyMCE.instances[e.target.ownerDocument.editorId].select(); 1061 1112 } 1062 1113 … … 1065 1116 1066 1117 // Insert P element 1067 if ( tinyMCE.isGecko&& tinyMCE.settings['force_p_newlines'] && e.keyCode == 13 && !e.shiftKey) {1118 if ((tinyMCE.isGecko || tinyMCE.isOpera || tinyMCE.isSafari) && tinyMCE.settings['force_p_newlines'] && e.keyCode == 13 && !e.shiftKey) { 1068 1119 // Insert P element instead of BR 1069 1120 if (TinyMCE_ForceParagraphs._insertPara(tinyMCE.selectedInstance, e)) { 1070 1121 // Cancel event 1071 1122 tinyMCE.execCommand("mceAddUndoLevel"); 1072 tinyMCE.cancelEvent(e); 1073 return false; 1123 return tinyMCE.cancelEvent(e); 1074 1124 } 1075 1125 } 1076 1126 1077 1127 // Handle backspace 1078 if ( tinyMCE.isGecko&& tinyMCE.settings['force_p_newlines'] && (e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey) {1128 if ((tinyMCE.isGecko && !tinyMCE.isSafari) && tinyMCE.settings['force_p_newlines'] && (e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey) { 1079 1129 // Insert P element instead of BR 1080 1130 if (TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance, e.type)) { 1081 1131 // Cancel event 1082 1132 tinyMCE.execCommand("mceAddUndoLevel"); 1083 tinyMCE.cancelEvent(e); 1084 return false; 1133 return tinyMCE.cancelEvent(e); 1085 1134 } 1086 1135 } 1087 1136 1088 1137 // Return key pressed 1089 if (tinyMCE.is MSIE && tinyMCE.settings['force_br_newlines'] && e.keyCode == 13) {1138 if (tinyMCE.isIE && tinyMCE.settings['force_br_newlines'] && e.keyCode == 13) { 1090 1139 if (e.target.editorId) 1091 tinyMCE. selectedInstance = tinyMCE.instances[e.target.editorId];1140 tinyMCE.instances[e.target.editorId].select(); 1092 1141 1093 1142 if (tinyMCE.selectedInstance) { … … 1133 1182 1134 1183 if (e.target.editorId) 1135 tinyMCE.selectedInstance = tinyMCE.instances[e.target.editorId]; 1136 else 1137 return; 1184 tinyMCE.instances[e.target.editorId].select(); 1138 1185 1139 1186 if (tinyMCE.selectedInstance) … … 1165 1212 1166 1213 // Fix empty elements on return/enter, check where enter occured 1167 if (tinyMCE.is MSIE && e.type == "keydown" && e.keyCode == 13)1214 if (tinyMCE.isIE && e.type == "keydown" && e.keyCode == 13) 1168 1215 tinyMCE.enterKeyElement = tinyMCE.selectedInstance.getFocusElement(); 1169 1216 1170 1217 // Fix empty elements on return/enter 1171 if (tinyMCE.is MSIE && e.type == "keyup" && e.keyCode == 13) {1218 if (tinyMCE.isIE && e.type == "keyup" && e.keyCode == 13) { 1172 1219 var elm = tinyMCE.enterKeyElement; 1173 1220 if (elm) { … … 1195 1242 1196 1243 // MSIE custom key handling 1197 if (tinyMCE.is MSIE && tinyMCE.settings['custom_undo_redo']) {1244 if (tinyMCE.isIE && tinyMCE.settings['custom_undo_redo']) { 1198 1245 var keys = new Array(8,46); // Backspace,Delete 1246 1199 1247 for (var i=0; i<keys.length; i++) { 1200 1248 if (keys[i] == e.keyCode) { … … 1211 1259 // Handle Undo/Redo when typing content 1212 1260 1213 // Start typing (non position key) 1214 if (!posKey && e.type == "keyup") 1215 tinyMCE.execCommand("mceStartTyping"); 1261 if (tinyMCE.isGecko) { 1262 // Start typing (not a position key or ctrl key, but ctrl+x and ctrl+p is ok) 1263 if (!posKey && e.type == "keyup" && !e.ctrlKey || (e.ctrlKey && (e.keyCode == 86 || e.keyCode == 88))) 1264 tinyMCE.execCommand("mceStartTyping"); 1265 } else { 1266 // IE seems to be working better with this setting 1267 if (!posKey && e.type == "keyup") 1268 tinyMCE.execCommand("mceStartTyping"); 1269 } 1216 1270 1217 1271 // Store undo bookmark … … 1226 1280 tinyMCE.triggerNodeChange(false); 1227 1281 1228 if (tinyMCE.is MSIE && e.ctrlKey)1282 if (tinyMCE.isIE && e.ctrlKey) 1229 1283 window.setTimeout('tinyMCE.triggerNodeChange(false);', 1); 1230 1284 break; … … 1233 1287 case "mouseup": 1234 1288 case "click": 1289 case "dblclick": 1235 1290 case "focus": 1236 1291 tinyMCE.hideMenus(); … … 1242 1297 1243 1298 // Check instance event trigged on 1244 var targetBody = tinyMCE.getParentElement(e.target, " body");1299 var targetBody = tinyMCE.getParentElement(e.target, "html"); 1245 1300 for (var instanceName in tinyMCE.instances) { 1246 1301 if (!tinyMCE.isInstance(tinyMCE.instances[instanceName])) … … 1252 1307 inst.autoResetDesignMode(); 1253 1308 1254 if (inst.getBody() == targetBody) { 1255 tinyMCE.selectedInstance = inst; 1309 // Use HTML element since users might click outside of body element 1310 if (inst.getBody().parentNode == targetBody) { 1311 inst.select(); 1256 1312 tinyMCE.selectedElement = e.target; 1257 1313 tinyMCE.linkElement = tinyMCE.getParentElement(tinyMCE.selectedElement, "a"); … … 1262 1318 1263 1319 // Add first bookmark location 1264 if (!tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark )1320 if (!tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark && (e.type == "mouseup" || e.type == "dblclick")) 1265 1321 tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark = tinyMCE.selectedInstance.selection.getBookmark(); 1266 1267 if (tinyMCE.isSafari) {1268 tinyMCE.selectedInstance.lastSafariSelection = tinyMCE.selectedInstance.selection.getBookmark();1269 tinyMCE.selectedInstance.lastSafariSelectedElement = tinyMCE.selectedElement;1270 1271 var lnk = tinyMCE.getParentElement(tinyMCE.selectedElement, "a");1272 1273 // Patch the darned link1274 if (lnk && e.type == "mousedown") {1275 lnk.setAttribute("mce_real_href", lnk.getAttribute("href"));1276 lnk.setAttribute("href", "javascript:void(0);");1277 }1278 1279 // Patch back1280 if (lnk && e.type == "click") {1281 window.setTimeout(function() {1282 lnk.setAttribute("href", lnk.getAttribute("mce_real_href"));1283 lnk.removeAttribute("mce_real_href");1284 }, 10);1285 }1286 }1287 1322 1288 1323 // Reset selected node … … 1298 1333 // Just in case 1299 1334 if (!tinyMCE.selectedInstance && e.target.editorId) 1300 tinyMCE. selectedInstance = tinyMCE.instances[e.target.editorId];1335 tinyMCE.instances[e.target.editorId].select(); 1301 1336 1302 1337 return false; … … 1306 1341 1307 1342 getButtonHTML : function(id, lang, img, cmd, ui, val) { 1308 var h = '', m, x ;1343 var h = '', m, x, io = ''; 1309 1344 1310 1345 cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + cmd + '\''; … … 1318 1353 cmd += ');'; 1319 1354 1355 // Patch for IE7 bug with hover out not restoring correctly 1356 if (tinyMCE.isRealIE) 1357 io = 'onmouseover="tinyMCE.lastHover = this;"'; 1358 1320 1359 // Use tilemaps when enabled and found and never in MSIE since it loads the tile each time from cache if cahce is disabled 1321 if (tinyMCE.getParam('button_tile_map') && (!tinyMCE.is MSIE || tinyMCE.isOpera) && (m = this.buttonMap[id]) != null && (tinyMCE.getParam("language") == "en" || img.indexOf('$lang') == -1)) {1360 if (tinyMCE.getParam('button_tile_map') && (!tinyMCE.isIE || tinyMCE.isOpera) && (m = this.buttonMap[id]) != null && (tinyMCE.getParam("language") == "en" || img.indexOf('$lang') == -1)) { 1322 1361 // Tiled button 1323 1362 x = 0 - (m * 20) == 0 ? '0' : 0 - (m * 20); 1324 h += '<a id="{$editor_id}_' + id + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceTiledButton mceButtonNormal" target="_self">';1363 h += '<a id="{$editor_id}_' + id + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" ' + io + ' class="mceTiledButton mceButtonNormal" target="_self">'; 1325 1364 h += '<img src="{$themeurl}/images/spacer.gif" style="background-position: ' + x + 'px 0" title="{$' + lang + '}" />'; 1326 1365 h += '</a>'; 1327 1366 } else { 1328 1367 // Normal button 1329 h += '<a id="{$editor_id}_' + id + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceButtonNormal" target="_self">';1368 h += '<a id="{$editor_id}_' + id + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" ' + io + ' class="mceButtonNormal" target="_self">'; 1330 1369 h += '<img src="' + img + '" title="{$' + lang + '}" />'; 1331 1370 h += '</a>'; … … 1335 1374 }, 1336 1375 1376 getMenuButtonHTML : function(id, lang, img, mcmd, cmd, ui, val) { 1377 var h = '', m, x; 1378 1379 mcmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + mcmd + '\');'; 1380 cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + cmd + '\''; 1381 1382 if (typeof(ui) != "undefined" && ui != null) 1383 cmd += ',' + ui; 1384 1385 if (typeof(val) != "undefined" && val != null) 1386 cmd += ",'" + val + "'"; 1387 1388 cmd += ');'; 1389 1390 // Use tilemaps when enabled and found and never in MSIE since it loads the tile each time from cache if cahce is disabled 1391 if (tinyMCE.getParam('button_tile_map') && (!tinyMCE.isIE || tinyMCE.isOpera) && (m = tinyMCE.buttonMap[id]) != null && (tinyMCE.getParam("language") == "en" || img.indexOf('$lang') == -1)) { 1392 x = 0 - (m * 20) == 0 ? '0' : 0 - (m * 20); 1393 1394 if (tinyMCE.isRealIE) 1395 h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">'; 1396 else 1397 h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton">'; 1398 1399 h += '<a href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceTiledButton mceMenuButtonNormal" target="_self">'; 1400 h += '<img src="{$themeurl}/images/spacer.gif" style="width: 20px; height: 20px; background-position: ' + x + 'px 0" title="{$' + lang + '}" /></a>'; 1401 h += '<a href="javascript:' + mcmd + '" onclick="' + mcmd + 'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$' + lang + '}" class="mceMenuButton" />'; 1402 h += '</a></span>'; 1403 } else { 1404 if (tinyMCE.isRealIE) 1405 h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">'; 1406 else 1407 h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton">'; 1408 1409 h += '<a href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceMenuButtonNormal" target="_self">'; 1410 h += '<img src="' + img + '" title="{$' + lang + '}" /></a>'; 1411 h += '<a href="javascript:' + mcmd + '" onclick="' + mcmd + 'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$' + lang + '}" class="mceMenuButton" />'; 1412 h += '</a></span>'; 1413 } 1414 1415 return h; 1416 }, 1417 1418 _menuButtonEvent : function(e, o) { 1419 if (o.className == 'mceMenuButtonFocus') 1420 return; 1421 1422 if (e == 'over') 1423 o.className = o.className + ' mceMenuHover'; 1424 else 1425 o.className = o.className.replace(/\s.*$/, ''); 1426 }, 1427 1337 1428 addButtonMap : function(m) { 1338 1429 var i, a = m.replace(/\s+/, '').split(','); … … 1343 1434 1344 1435 submitPatch : function() { 1345 tinyMCE.removeTinyMCEFormElements(this);1346 1436 tinyMCE.triggerSave(); 1437 tinyMCE.isNotDirty = true; 1347 1438 this.mceOldSubmit(); 1348 tinyMCE.isNotDirty = true;1349 1439 }, 1350 1440 1351 1441 onLoad : function() { 1442 var r; 1443 1352 1444 // Wait for everything to be loaded first 1353 1445 if (tinyMCE.settings.strict_loading_mode && this.loadingIndex != -1) { … … 1356 1448 } 1357 1449 1358 if (tinyMCE.is MSIE && !tinyMCE.isOpera&& window.event.type == "readystatechange" && document.readyState != "complete")1450 if (tinyMCE.isRealIE && window.event.type == "readystatechange" && document.readyState != "complete") 1359 1451 return true; 1360 1452 … … 1363 1455 1364 1456 tinyMCE.isLoaded = true; 1457 1458 // IE produces JS error if TinyMCE is placed in a frame 1459 // It seems to have something to do with the selection not beeing 1460 // correctly initialized in IE so this hack solves the problem 1461 if (tinyMCE.isRealIE && document.body) { 1462 r = document.body.createTextRange(); 1463 r.collapse(true); 1464 r.select(); 1465 } 1365 1466 1366 1467 tinyMCE.dispatchCallback(null, 'onpageload', 'onPageLoad'); … … 1404 1505 var trigger = element ? element.getAttribute(tinyMCE.settings['textarea_trigger']) : ""; 1405 1506 1406 if ( tinyMCE.getAttrib(element, "class").indexOf(deselector) != -1)1507 if (new RegExp('\\b' + deselector + '\\b').test(tinyMCE.getAttrib(element, "class"))) 1407 1508 continue; 1408 1509 … … 1430 1531 var trigger = elm.getAttribute(tinyMCE.settings['textarea_trigger']); 1431 1532 1432 if (selector != '' && tinyMCE.getAttrib(elm, "class").indexOf(selector) == -1)1533 if (selector != '' && !new RegExp('\\b' + selector + '\\b').test(tinyMCE.getAttrib(elm, "class"))) 1433 1534 continue; 1434 1535 … … 1436 1537 trigger = selector != "" ? "true" : ""; 1437 1538 1438 if ( tinyMCE.getAttrib(elm, "class").indexOf(deselector) != -1)1539 if (new RegExp('\\b' + deselector + '\\b').test(tinyMCE.getAttrib(elm, "class"))) 1439 1540 continue; 1440 1541 … … 1476 1577 inst.selection.selectNode(inst.getBody(), true, true); 1477 1578 inst.contentWindow.focus(); 1478 }, 10 );1579 }, 100); 1479 1580 } 1480 1581 … … 1528 1629 entityDecode : function(s) { 1529 1630 var e = document.createElement("div"); 1631 1530 1632 e.innerHTML = s; 1531 return e.innerHTML; 1633 1634 return e.firstChild.nodeValue; 1532 1635 }, 1533 1636 … … 1551 1654 var editorId = inst.editorId; 1552 1655 var elm = (typeof(setup_content) != "undefined" && setup_content) ? tinyMCE.selectedElement : inst.getFocusElement(); 1553 var undoIndex = -1 ;1656 var undoIndex = -1, doc; 1554 1657 var undoLevels = -1; 1555 1658 var anySelection = false; 1556 1659 var selectedText = inst.selection.getSelectedText(); 1557 1660 1661 if (tinyMCE.settings.auto_resize) 1662 inst.resizeToContent(); 1663 1558 1664 if (setup_content && tinyMCE.isGecko && inst.isHidden()) 1559 1665 elm = inst.getBody(); 1560 1666 1561 1667 inst.switchSettings(); 1562 1563 if (tinyMCE.settings["auto_resize"]) {1564 var doc = inst.getDoc();1565 1566 inst.iframeElement.style.width = doc.body.offsetWidth + "px";1567 inst.iframeElement.style.height = doc.body.offsetHeight + "px";1568 }1569 1668 1570 1669 if (tinyMCE.selectedElement) … … 1591 1690 content = eval(customCleanup + "(type, content, inst);"); 1592 1691 1692 // Trigger theme cleanup 1693 po = tinyMCE.themes[tinyMCE.settings['theme']]; 1694 if (po && po.cleanup) 1695 content = po.cleanup(type, content, inst); 1696 1593 1697 // Trigger plugin cleanups 1594 1698 pl = inst.plugins; … … 1617 1721 }, 1618 1722 1619 importPluginLanguagePack : function(name, valid_languages) { 1620 var lang = "en", b = tinyMCE.baseURL + '/plugins/' + name; 1621 1622 valid_languages = valid_languages.split(','); 1623 for (var i=0; i<valid_languages.length; i++) { 1624 if (tinyMCE.settings['language'] == valid_languages[i]) 1625 lang = tinyMCE.settings['language']; 1626 } 1723 importPluginLanguagePack : function(name) { 1724 var b = tinyMCE.baseURL + '/plugins/' + name; 1627 1725 1628 1726 if (this.plugins[name]) 1629 1727 b = this.plugins[name].baseURL; 1630 1728 1631 tinyMCE.loadScript(b + '/langs/' + lang+ '.js');1729 tinyMCE.loadScript(b + '/langs/' + tinyMCE.settings['language'] + '.js'); 1632 1730 }, 1633 1731 1634 1732 applyTemplate : function(h, as) { 1635 var i, s, ar = h.match(new RegExp('\\{\\$[a-z0-9_]+\\}', 'gi')); 1636 1637 if (ar && ar.length > 0) { 1638 for (i=ar.length-1; i>=0; i--) { 1639 s = ar[i].substring(2, ar[i].length-1); 1640 1641 if (s.indexOf('lang_') == 0 && tinyMCELang[s]) 1642 h = tinyMCE.replaceVar(h, s, tinyMCELang[s]); 1643 else if (as && as[s]) 1644 h = tinyMCE.replaceVar(h, s, as[s]); 1645 else if (tinyMCE.settings[s]) 1646 h = tinyMCE.replaceVar(h, s, tinyMCE.settings[s]); 1647 } 1648 } 1649 1650 h = tinyMCE.replaceVar(h, "themeurl", tinyMCE.themeURL); 1651 1652 return h; 1733 return h.replace(new RegExp('\\{\\$([a-z0-9_]+)\\}', 'gi'), function(m, s) { 1734 if (s.indexOf('lang_') == 0 && tinyMCELang[s]) 1735 return tinyMCELang[s]; 1736 1737 if (as && as[s]) 1738 return as[s]; 1739 1740 if (tinyMCE.settings[s]) 1741 return tinyMCE.settings[s]; 1742 1743 if (m == 'themeurl') 1744 return tinyMCE.themeURL; 1745 1746 return m; 1747 }); 1653 1748 }, 1654 1749 … … 1673 1768 1674 1769 // Add to height in M$ due to SP2 WHY DON'T YOU GUYS IMPLEMENT innerWidth of windows!! 1675 if (tinyMCE.is MSIE)1770 if (tinyMCE.isIE) 1676 1771 height += 40; 1677 1772 else … … 1712 1807 win.focus(); 1713 1808 } else { 1714 if ((tinyMCE.is MSIE && !tinyMCE.isOpera) && resizable != 'yes' && tinyMCE.settings["dialog_type"] == "modal") {1809 if ((tinyMCE.isRealIE) && resizable != 'yes' && tinyMCE.settings["dialog_type"] == "modal") { 1715 1810 height += 10; 1716 1811 … … 1824 1919 if (anchorName != '' && state) { 1825 1920 el.title = anchorName; 1826 el.className = 'mceItemAnchor';1921 tinyMCE.addCSSClass(el, 'mceItemAnchor'); 1827 1922 } else if (anchorName != '' && !state) 1828 1923 el.className = ''; … … 1871 1966 1872 1967 fixGeckoBaseHREFBug : function(m, e, h) { 1873 var nl, i, a, n, xsrc, xhref, el;1968 var xsrc, xhref; 1874 1969 1875 1970 if (tinyMCE.isGecko) { … … 1880 1975 return h; 1881 1976 } else { 1882 el = new Array('a','img','select','area','iframe','base','input','script','embed','object','link'); 1883 1884 for (a=0; a<el.length; a++) { 1885 n = e.getElementsByTagName(el[a]); 1886 1887 for (i=0; i<n.length; i++) { 1888 xsrc = tinyMCE.getAttrib(n[i], "mce_tsrc"); 1889 xhref = tinyMCE.getAttrib(n[i], "mce_thref"); 1890 1891 if (xsrc != "") { 1892 try { 1893 n[i].src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], xsrc); 1894 } catch (e) { 1895 // Ignore, Firefox cast exception if local file wasn't found 1896 } 1897 1898 n[i].removeAttribute("mce_tsrc"); 1977 // Why bother if there is no src or href broken 1978 if (!new RegExp('(src|href)=', 'g').test(h)) 1979 return h; 1980 1981 // Restore src and href that gets messed up by Gecko 1982 tinyMCE.selectElements(e, 'A,IMG,SELECT,AREA,IFRAME,BASE,INPUT,SCRIPT,EMBED,OBJECT,LINK', function (n) { 1983 xsrc = tinyMCE.getAttrib(n, "mce_tsrc"); 1984 xhref = tinyMCE.getAttrib(n, "mce_thref"); 1985 1986 if (xsrc != "") { 1987 try { 1988 n.src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], xsrc); 1989 } catch (e) { 1990 // Ignore, Firefox cast exception if local file wasn't found 1899 1991 } 1900 1992 1901 if (xhref != "") {1902 try {1903 n[i].href = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], xhref); 1904 } catch (e) {1905 // Ignore, Firefox cast exception if local file wasn't found1906 }1907 1908 n[i].removeAttribute("mce_thref");1993 n.removeAttribute("mce_tsrc"); 1994 } 1995 1996 if (xhref != "") { 1997 try { 1998 n.href = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], xhref); 1999 } catch (e) { 2000 // Ignore, Firefox cast exception if local file wasn't found 1909 2001 } 2002 2003 n.removeAttribute("mce_thref"); 1910 2004 } 1911 } 1912 1913 el = tinyMCE.selectNodes(e, function(n) { 2005 2006 return false; 2007 }); 2008 2009 // Restore text/comment nodes 2010 tinyMCE.selectNodes(e, function(n) { 1914 2011 if (n.nodeType == 3 || n.nodeType == 8) { 1915 2012 n.nodeValue = n.nodeValue.replace(/\smce_tsrc=/gi, " src="); … … 1940 2037 1941 2038 // Content duplication bug fix 1942 if (tinyMCE.is MSIE && tinyMCE.settings['fix_content_duplication']) {2039 if (tinyMCE.isIE && tinyMCE.settings['fix_content_duplication']) { 1943 2040 // Remove P elements in P elements 1944 2041 var paras = doc.getElementsByTagName("P"); … … 2066 2163 2067 2164 // Just ignore any errors 2068 eval("try {var csses = tinyMCE.is MSIE ? doc.styleSheets(" + x + ").rules : styles[" + x + "].cssRules;} catch(e) {}");2165 eval("try {var csses = tinyMCE.isIE ? doc.styleSheets(" + x + ").rules : styles[" + x + "].cssRules;} catch(e) {}"); 2069 2166 if (!csses) 2070 2167 return new Array(); … … 2159 2256 }, 2160 2257 2161 evalFunc : function(f, idx, a ) {2258 evalFunc : function(f, idx, a, o) { 2162 2259 var s = '(', i; 2163 2260 … … 2171 2268 s += ');'; 2172 2269 2173 return eval("f" + s);2270 return o ? eval("o." + f + s) : eval("f" + s); 2174 2271 }, 2175 2272 … … 2200 2297 o = tinyMCE.plugins[l[i]]; 2201 2298 2202 if (o[n] && (v = tinyMCE.evalFunc( o[n], 3, a)) == s && m > 0)2299 if (o[n] && (v = tinyMCE.evalFunc(n, 3, a, o)) == s && m > 0) 2203 2300 return true; 2204 2301 } … … 2209 2306 o = l[on]; 2210 2307 2211 if (o[n] && (v = tinyMCE.evalFunc( o[n], 3, a)) == s && m > 0)2308 if (o[n] && (v = tinyMCE.evalFunc(n, 3, a, o)) == s && m > 0) 2212 2309 return true; 2213 2310 } … … 2217 2314 2218 2315 xmlEncode : function(s) { 2219 s = "" + s; 2220 s = s.replace(/&/g, '&'); 2221 s = s.replace(new RegExp('"', 'g'), '"'); 2222 s = s.replace(/\'/g, '''); // ' is not working in MSIE 2223 s = s.replace(/</g, '<'); 2224 s = s.replace(/>/g, '>'); 2225 2226 return s; 2316 return s ? ('' + s).replace(new RegExp('[<>&"\']', 'g'), function (c, b) { 2317 switch (c) { 2318 case '&': 2319 return '&'; 2320 2321 case '"': 2322 return '"'; 2323 2324 case '\'': 2325 return '''; // ' is not working in MSIE 2326 2327 case '<': 2328 return '<'; 2329 2330 case '>': 2331 return '>'; 2332 } 2333 2334 return c; 2335 }) : s; 2227 2336 }, 2228 2337 … … 2253 2362 tinyMCE.lastSelectedMenuBtn = null; 2254 2363 } 2255 },2256 2257 explode : function(d, s) {2258 var ar = s.split(d), oar = new Array(), i;2259 2260 for (i = 0; i<ar.length; i++) {2261 if (ar[i] != "")2262 oar[oar.length] = ar[i];2263 }2264 2265 return oar;2266 2364 } 2267 }; 2365 2366 }; 2268 2367 2269 2368 // Global instances … … 2290 2389 this.shortcuts = new Array(); 2291 2390 this.hasMouseMoved = false; 2391 this.foreColor = this.backColor = "#999999"; 2392 this.data = {}; 2292 2393 2293 2394 this.cleanup.init({ 2294 2395 valid_elements : s.valid_elements, 2295 2396 extended_valid_elements : s.extended_valid_elements, 2397 valid_child_elements : s.valid_child_elements, 2296 2398 entities : s.entities, 2297 2399 entity_encoding : s.entity_encoding, … … 2346 2448 2347 2449 TinyMCE_Control.prototype = { 2450 selection : null, 2451 2452 settings : null, 2453 2454 cleanup : null, 2455 2456 getData : function(na) { 2457 var o = this.data[na]; 2458 2459 if (!o) 2460 o = this.data[na] = {}; 2461 2462 return o; 2463 }, 2464 2348 2465 hasPlugin : function(n) { 2349 2466 var i; … … 2365 2482 2366 2483 repaint : function() { 2367 if (tinyMCE.isMSIE && !tinyMCE.isOpera) 2484 var s, b, ex; 2485 2486 if (tinyMCE.isRealIE) 2368 2487 return; 2369 2488 2370 2489 try { 2371 vars = this.selection;2372 varb = s.getBookmark(true);2490 s = this.selection; 2491 b = s.getBookmark(true); 2373 2492 this.getBody().style.display = 'none'; 2374 2493 this.getDoc().execCommand('selectall', false, null); … … 2388 2507 }, 2389 2508 2509 select : function() { 2510 var oldInst = tinyMCE.selectedInstance; 2511 2512 if (oldInst != this) { 2513 if (oldInst) 2514 oldInst.execCommand('mceEndTyping'); 2515 2516 tinyMCE.dispatchCallback(this, 'select_instance_callback', 'selectInstance', this, oldInst); 2517 tinyMCE.selectedInstance = this; 2518 } 2519 }, 2520 2390 2521 getBody : function() { 2391 return this. getDoc().body;2522 return this.contentBody ? this.contentBody : this.getDoc().body; 2392 2523 }, 2393 2524 2394 2525 getDoc : function() { 2526 // return this.contentDocument ? this.contentDocument : this.contentWindow.document; // Removed due to IE 5.5 ? 2395 2527 return this.contentWindow.document; 2396 2528 }, … … 2400 2532 }, 2401 2533 2534 getContainerWin : function() { 2535 return this.containerWindow ? this.containerWindow : window; 2536 }, 2537 2538 getViewPort : function() { 2539 return tinyMCE.getViewPort(this.getWin()); 2540 }, 2541 2542 getParentNode : function(n, f) { 2543 return tinyMCE.getParentNode(n, f, this.getBody()); 2544 }, 2545 2546 getParentElement : function(n, na, f) { 2547 return tinyMCE.getParentElement(n, na, f, this.getBody()); 2548 }, 2549 2550 getParentBlockElement : function(n) { 2551 return tinyMCE.getParentBlockElement(n, this.getBody()); 2552 }, 2553 2554 resizeToContent : function() { 2555 var d = this.getDoc(), b = d.body, de = d.documentElement; 2556 2557 this.iframeElement.style.height = (tinyMCE.isRealIE) ? b.scrollHeight : de.offsetHeight + 'px'; 2558 }, 2559 2402 2560 addShortcut : function(m, k, d, cmd, ui, va) { 2403 var n = typeof(k) == "number", ie = tinyMCE.isMSIE, c, sc, i; 2404 var scl = this.shortcuts; 2561 var n = typeof(k) == "number", ie = tinyMCE.isIE, c, sc, i, scl = this.shortcuts; 2405 2562 2406 2563 if (!tinyMCE.getParam('custom_shortcuts')) … … 2441 2598 for (i=0; i<s.length; i++) { 2442 2599 o = s[i]; 2600 2443 2601 if (o.alt == e.altKey && o.ctrl == e.ctrlKey && (o.keyCode == e.keyCode || o.charCode == e.charCode)) { 2444 2602 if (o.cmd && (e.type == "keydown" || (e.type == "keypress" && !tinyMCE.isOpera))) … … 2455 2613 autoResetDesignMode : function() { 2456 2614 // Add fix for tab/style.display none/block problems in Gecko 2457 if (!tinyMCE.is MSIE && this.isHidden() && tinyMCE.getParam('auto_reset_designmode'))2458 eval('try { this.getDoc().designMode = "On"; } catch(e) {}');2615 if (!tinyMCE.isIE && this.isHidden() && tinyMCE.getParam('auto_reset_designmode')) 2616 eval('try { this.getDoc().designMode = "On"; this.useCSS = false; } catch(e) {}'); 2459 2617 }, 2460 2618 2461 2619 isHidden : function() { 2462 if (tinyMCE.isMSIE) 2620 var s; 2621 2622 if (tinyMCE.isIE) 2463 2623 return false; 2464 2624 2465 vars = this.getSel();2625 s = this.getSel(); 2466 2626 2467 2627 // Weird, wheres that cursor selection? … … 2471 2631 isDirty : function() { 2472 2632 // Is content modified and not in a submit procedure 2473 return t his.startContent!= tinyMCE.trim(this.getBody().innerHTML) && !tinyMCE.isNotDirty;2633 return tinyMCE.trim(this.startContent) != tinyMCE.trim(this.getBody().innerHTML) && !tinyMCE.isNotDirty; 2474 2634 }, 2475 2635 … … 2487 2647 var className = tinyMCE.getAttrib(pa, "class"); 2488 2648 2489 className += " " + tinyMCE.getAttrib(ch, "class"); 2649 // Removed class adding due to bug #1478272 2650 className = tinyMCE.getAttrib(ch, "class"); 2490 2651 2491 2652 if (override) { … … 2527 2688 2528 2689 execCommand : function(command, user_interface, value) { 2529 var doc = this.getDoc(); 2530 var win = this.getWin(); 2531 var focusElm = this.getFocusElement(); 2532 2533 // Is non udno specific command 2690 var doc = this.getDoc(), win = this.getWin(), focusElm = this.getFocusElement(); 2691 2692 // Is not a undo specific command 2534 2693 if (!new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel', 'gi').test(command)) 2535 2694 this.undoBookmark = null; 2536 2695 2537 if (this.lastSafariSelection && !new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel', 'gi').test(command)) {2538 this.selection.moveToBookmark(this.lastSafariSelection);2539 tinyMCE.selectedElement = this.lastSafariSelectedElement;2540 }2541 2542 2696 // Mozilla issue 2543 if (!tinyMCE.is MSIE && !this.useCSS) {2697 if (!tinyMCE.isIE && !this.useCSS) { 2544 2698 this._setUseCSS(false); 2545 2699 this.useCSS = true; … … 2655 2809 return true; 2656 2810 2811 case "unlink": 2812 // Unlink if caret is inside link 2813 if (tinyMCE.isGecko && this.getSel().isCollapsed) { 2814 focusElm = tinyMCE.getParentElement(focusElm, 'A'); 2815 2816 if (focusElm) 2817 this.selection.selectNode(focusElm, false); 2818 } 2819 2820 this.getDoc().execCommand(command, user_interface, value); 2821 2822 tinyMCE.isGecko && this.getSel().collapseToEnd(); 2823 2824 tinyMCE.triggerNodeChange(); 2825 2826 return true; 2827 2828 case "FormatBlock": 2829 if (!this.cleanup.isValid(value)) 2830 return true; 2831 2832 this.getDoc().execCommand(command, user_interface, value); 2833 tinyMCE.triggerNodeChange(); 2834 break; 2835 2657 2836 case "InsertUnorderedList": 2658 2837 case "InsertOrderedList": 2659 var tag = (command == "InsertUnorderedList") ? "ul" : "ol"; 2660 2661 if (tinyMCE.isSafari) 2662 this.execCommand("mceInsertContent", false, "<" + tag + "><li> </li><" + tag + ">"); 2663 else 2664 this.getDoc().execCommand(command, user_interface, value); 2665 2838 this.getDoc().execCommand(command, user_interface, value); 2666 2839 tinyMCE.triggerNodeChange(); 2667 2840 break; 2668 2841 2669 2842 case "Strikethrough": 2670 if (tinyMCE.isSafari) 2671 this.execCommand("mceInsertContent", false, "<strike>" + this.selection.getSelectedHTML() + "</strike>"); 2672 else 2673 this.getDoc().execCommand(command, user_interface, value); 2674 2843 this.getDoc().execCommand(command, user_interface, value); 2675 2844 tinyMCE.triggerNodeChange(); 2676 2845 break; … … 2692 2861 value = value.replace(/[^a-z]/gi, ''); 2693 2862 2694 if (tinyMCE.is MSIE && new RegExp('blockquote|code|samp', 'gi').test(value)) {2863 if (tinyMCE.isIE && new RegExp('blockquote|code|samp', 'gi').test(value)) { 2695 2864 var b = this.selection.getBookmark(); 2696 2865 this.getDoc().execCommand("FormatBlock", false, '<p>'); … … 2709 2878 value = tinyMCE.getParentElement(this.getFocusElement()); 2710 2879 2711 if (tinyMCE.is MSIE) {2880 if (tinyMCE.isIE) { 2712 2881 value.outerHTML = value.innerHTML; 2713 2882 } else { … … 2760 2929 2761 2930 // Whole element selected check 2762 if (tinyMCE.is MSIE) {2931 if (tinyMCE.isIE) { 2763 2932 // Control range 2764 2933 if (rng.item) … … 2954 3123 2955 3124 case "forecolor": 3125 value = value == null ? this.foreColor : value; 3126 value = tinyMCE.trim(value); 3127 value = value.charAt(0) != '#' ? (isNaN('0x' + value) ? value : '#' + value) : value; 3128 3129 this.foreColor = value; 2956 3130 this.getDoc().execCommand('forecolor', false, value); 2957 3131 break; 2958 3132 2959 3133 case "HiliteColor": 3134 value = value == null ? this.backColor : value; 3135 value = tinyMCE.trim(value); 3136 value = value.charAt(0) != '#' ? (isNaN('0x' + value) ? value : '#' + value) : value; 3137 this.backColor = value; 3138 2960 3139 if (tinyMCE.isGecko) { 2961 3140 this._setUseCSS(true); … … 2995 3174 value = tinyMCE.storeAwayURLs(value); 2996 3175 value = tinyMCE._customCleanup(this, "insert_to_editor", value); 2997 tinyMCE._setHTML(doc, value); 2998 tinyMCE.setInnerHTML(doc.body, tinyMCE._cleanupHTML(this, doc, tinyMCE.settings, doc.body)); 2999 tinyMCE.convertAllRelativeURLs(doc.body); 3176 3177 if (this.getBody().nodeName == 'BODY') 3178 tinyMCE._setHTML(doc, value); 3179 else 3180 this.getBody().innerHTML = value; 3181 3182 tinyMCE.setInnerHTML(this.getBody(), tinyMCE._cleanupHTML(this, doc, this.settings, this.getBody(), false, false, false, true)); 3183 tinyMCE.convertAllRelativeURLs(this.getBody()); 3000 3184 3001 3185 // Cleanup any mess left from storyAwayURLs … … 3006 3190 tinyMCE.convertSpansToFonts(doc); 3007 3191 3008 tinyMCE.handleVisualAid( doc.body, true, this.visualAid, this);3009 tinyMCE._setEventsEnabled( doc.body, false);3192 tinyMCE.handleVisualAid(this.getBody(), true, this.visualAid, this); 3193 tinyMCE._setEventsEnabled(this.getBody(), false); 3010 3194 return true; 3011 3195 … … 3036 3220 var selectedText = ""; 3037 3221 3038 if (tinyMCE.is MSIE) {3222 if (tinyMCE.isIE) { 3039 3223 var rng = doc.selection.createRange(); 3040 3224 selectedText = rng.text; … … 3075 3259 3076 3260 // Store away scroll pos 3077 var scrollX = this.get Doc().body.scrollLeft + this.getDoc().documentElement.scrollLeft;3078 var scrollY = this.get Doc().body.scrollTop + this.getDoc().documentElement.scrollTop;3261 var scrollX = this.getBody().scrollLeft + this.getDoc().documentElement.scrollLeft; 3262 var scrollY = this.getBody().scrollTop + this.getDoc().documentElement.scrollTop; 3079 3263 3080 3264 // Find marker and replace with RAW HTML … … 3096 3280 3097 3281 var insertHTMLFailed = false; 3098 this.getWin().focus(); 3282 3283 // Removed since it produced problems in IE 3284 // this.getWin().focus(); 3099 3285 3100 3286 if (tinyMCE.isGecko || tinyMCE.isOpera) { … … 3132 3318 } 3133 3319 3134 // Ugly hack in Opera due to non working "inserthtml" 3135 if (tinyMCE.isOpera && insertHTMLFailed) { 3136 this.getDoc().execCommand("insertimage", false, tinyMCE.uniqueURL); 3137 var ar = tinyMCE.getElementsByAttributeValue(this.getBody(), "img", "src", tinyMCE.uniqueURL); 3138 ar[0].outerHTML = value; 3139 return; 3140 } 3141 3142 if (!tinyMCE.isMSIE) { 3320 if (!tinyMCE.isIE) { 3143 3321 var isHTML = value.indexOf('<') != -1; 3144 3322 var sel = this.getSel(); … … 3201 3379 tinyMCE.fixGeckoBaseHREFBug(2, this.getDoc(), value); 3202 3380 } else { 3203 var rng = doc.selection.createRange() ;3381 var rng = doc.selection.createRange(), tmpRng = null; 3204 3382 var c = value.indexOf('<!--') != -1; 3205 3383 … … 3207 3385 if (c) 3208 3386 value = tinyMCE.uniqueTag + value; 3387 3388 // tmpRng = rng.duplicate(); // Store away range (Fixes Undo bookmark bug in IE) 3209 3389 3210 3390 if (rng.item) … … 3212 3392 else 3213 3393 rng.pasteHTML(value); 3394 3395 //if (tmpRng) 3396 // tmpRng.select(); // Restore range (Fixes Undo bookmark bug in IE) 3214 3397 3215 3398 // Remove unique tag … … 3220 3403 } 3221 3404 3405 tinyMCE.execCommand("mceAddUndoLevel"); 3222 3406 tinyMCE.triggerNodeChange(); 3223 3407 break; … … 3226 3410 if (tinyMCE.settings['custom_undo_redo'] && this.undoRedo.typingUndoIndex == -1) { 3227 3411 this.undoRedo.typingUndoIndex = this.undoRedo.undoIndex; 3412 tinyMCE.typingUndoIndex = tinyMCE.undoIndex; 3228 3413 this.execCommand('mceAddUndoLevel'); 3229 //tinyMCE.debug("mceStartTyping");3230 3414 } 3231 3415 break; … … 3235 3419 this.execCommand('mceAddUndoLevel'); 3236 3420 this.undoRedo.typingUndoIndex = -1; 3237 //tinyMCE.debug("mceEndTyping");3238 3421 } 3422 3423 tinyMCE.typingUndoIndex = -1; 3239 3424 break; 3240 3425 … … 3282 3467 this.getDoc().execCommand(command, user_interface, value); 3283 3468 tinyMCE.triggerNodeChange(); 3284 if (tinyMCE.isMSIE) { 3469 3470 if (tinyMCE.isIE) { 3285 3471 var n = tinyMCE.getParentElement(this.getFocusElement(), "blockquote"); 3286 3472 do { … … 3301 3487 } 3302 3488 3303 if (tinyMCE.is MSIE) {3489 if (tinyMCE.isIE) { 3304 3490 try { 3305 3491 var rng = doc.selection.createRange(); … … 3407 3593 this.settings['area_height'] += deltaHeight; 3408 3594 3595 this.settings['width_style'] = "" + this.settings['width']; 3596 this.settings['height_style'] = "" + this.settings['height']; 3597 3409 3598 // Special % handling 3410 3599 if (("" + this.settings['width']).indexOf('%') != -1) 3411 3600 this.settings['area_width'] = "100%"; 3601 else 3602 this.settings['width_style'] += 'px'; 3412 3603 3413 3604 if (("" + this.settings['height']).indexOf('%') != -1) 3414 3605 this.settings['area_height'] = "100%"; 3606 else 3607 this.settings['height_style'] += 'px'; 3415 3608 3416 3609 if (("" + replace_element.style.width).indexOf('%') != -1) { 3417 3610 this.settings['width'] = replace_element.style.width; 3418 3611 this.settings['area_width'] = "100%"; 3612 this.settings['width_style'] = "100%"; 3419 3613 } 3420 3614 … … 3422 3616 this.settings['height'] = replace_element.style.height; 3423 3617 this.settings['area_height'] = "100%"; 3618 this.settings['height_style'] = "100%"; 3424 3619 } 3425 3620 … … 3490 3685 var tElm = targetDoc.getElementById(this.editorId); 3491 3686 3492 if (!tinyMCE.is MSIE) {3687 if (!tinyMCE.isIE) { 3493 3688 // Node case is preserved in XML strict mode 3494 3689 if (tElm && (tElm.nodeName == "SPAN" || tElm.nodeName == "span")) { … … 3544 3739 // This timeout is needed in MSIE 5.5 for some odd reason 3545 3740 // it seems that the document.frames isn't initialized yet? 3546 if (tinyMCE.is MSIE)3741 if (tinyMCE.isIE) 3547 3742 window.setTimeout("tinyMCE.addEventHandlers(tinyMCE.instances[\"" + this.editorId + "\"]);", 1); 3548 3743 … … 3574 3769 }, 3575 3770 3771 getHTML : function(r) { 3772 var h, d = this.getDoc(), b = this.getBody(); 3773 3774 if (r) 3775 return b.innerHTML; 3776 3777 h = tinyMCE._cleanupHTML(this, d, this.settings, b, false, true, false, true); 3778 3779 if (tinyMCE.getParam("convert_fonts_to_spans")) 3780 tinyMCE.convertSpansToFonts(d); 3781 3782 return h; 3783 }, 3784 3785 setHTML : function(h) { 3786 this.execCommand('mceSetContent', false, h); 3787 this.repaint(); 3788 }, 3789 3576 3790 getFocusElement : function() { 3577 3791 return this.selection.getFocusElement(); … … 3587 3801 3588 3802 triggerSave : function(skip_cleanup, skip_callback) { 3589 var e, nl = new Array(), i, s;3803 var e, nl = [], i, s; 3590 3804 3591 3805 this.switchSettings(); … … 3593 3807 3594 3808 // Force hidden tabs visible while serializing 3595 if (tinyMCE.is MSIE && !tinyMCE.isOpera) {3809 if (tinyMCE.isRealIE) { 3596 3810 e = this.iframeElement; 3597 3811 … … 3659 3873 } 3660 3874 } 3661 }; 3875 3876 }; 3662 3877 3663 3878 /* file:jscripts/tiny_mce/classes/TinyMCE_Cleanup.class.js */ … … 3680 3895 3681 3896 // Weird MSIE bug, <p><hr /></p> breaks runtime? 3682 if (tinyMCE.is MSIE)3897 if (tinyMCE.isIE) 3683 3898 s = s.replace(new RegExp('<p><hr \\/><\\/p>', 'gi'), "<hr>"); 3684 3899 3900 // Weird tags will make IE error #bug: 1538495 3901 if (tinyMCE.isIE) 3902 s = s.replace(/<!(\s*)\/>/g, ''); 3903 3685 3904 // Convert relative anchors to absolute URLs ex: #something to file.htm#something 3686 if (tinyMCE.getParam('convert_urls')) 3687 s = s.replace(new RegExp('(href=\"{0,1})(\\s*#)', 'gi'), '$1' + tinyMCE.settings['document_base_url'] + "#"); 3905 // Removed: Since local document anchors should never be forced absolute example edit.php?id=something 3906 //if (tinyMCE.getParam('convert_urls')) 3907 // s = s.replace(new RegExp('(href=\"{0,1})(\\s*#)', 'gi'), '$1' + tinyMCE.settings['document_base_url'] + "#"); 3688 3908 3689 3909 return s; … … 3827 4047 h = h.replace(/<span/gi, '<font'); 3828 4048 h = h.replace(/<\/span/gi, '</font'); 3829 doc.body.innerHTML = h;4049 tinyMCE.setInnerHTML(doc.body, h); 3830 4050 3831 4051 var s = doc.getElementsByTagName("font"); … … 3866 4086 h = h.replace(/<font/gi, '<span'); 3867 4087 h = h.replace(/<\/font/gi, '</span'); 3868 doc.body.innerHTML = h;4088 tinyMCE.setInnerHTML(doc.body, h); 3869 4089 3870 4090 var fsClasses = tinyMCE.getParam('font_size_classes'); … … 3922 4142 3923 4143 TinyMCE_Engine.prototype.getContent = function(editor_id) { 3924 var h;3925 3926 4144 if (typeof(editor_id) != "undefined") 3927 tinyMCE.selectedInstance = tinyMCE.getInstanceById(editor_id); 3928 3929 if (tinyMCE.selectedInstance) { 3930 h = tinyMCE._cleanupHTML(this.selectedInstance, this.selectedInstance.getDoc(), tinyMCE.settings, this.selectedInstance.getBody(), false, true); 3931 3932 // When editing always use fonts internaly 3933 if (tinyMCE.getParam("convert_fonts_to_spans")) 3934 tinyMCE.convertSpansToFonts(this.selectedInstance.getDoc()); 3935 3936 return h; 3937 } 4145 tinyMCE.getInstanceById(editor_id).select(); 4146 4147 if (tinyMCE.selectedInstance) 4148 return tinyMCE.selectedInstance.getHTML(); 3938 4149 3939 4150 return null; … … 3987 4198 }; 3988 4199 3989 TinyMCE_Engine.prototype._cleanupHTML = function(inst, doc, config, elm, visual, on_save, on_submit ) {3990 var h, d, t1, t2, t3, t4, t5, c, s ;4200 TinyMCE_Engine.prototype._cleanupHTML = function(inst, doc, config, elm, visual, on_save, on_submit, inn) { 4201 var h, d, t1, t2, t3, t4, t5, c, s, nb; 3991 4202 3992 4203 if (!tinyMCE.getParam('cleanup')) … … 4026 4237 4027 4238 if (s.cleanup_serializer == "xml") 4028 h = c.serializeNodeAsXML(elm );4239 h = c.serializeNodeAsXML(elm, inn); 4029 4240 else 4030 h = c.serializeNodeAsHTML(elm );4241 h = c.serializeNodeAsHTML(elm, inn); 4031 4242 4032 4243 if (d) … … 4034 4245 4035 4246 // Post processing 4247 nb = tinyMCE.getParam('entity_encoding') == 'numeric' ? ' ' : ' '; 4036 4248 h = h.replace(/<\/?(body|head|html)[^>]*>/gi, ''); 4037 4249 h = h.replace(new RegExp(' (rowspan="1"|colspan="1")', 'g'), ''); 4038 4250 h = h.replace(/<p><hr \/><\/p>/g, '<hr />'); 4039 4251 h = h.replace(/<p>( | )<\/p><hr \/><p>( | )<\/p>/g, '<hr />'); 4040 h = h.replace(/<td>\s*<br \/>\s*<\/td>/g, '<td> </td>'); 4041 h = h.replace(/<p>\s*<br \/>\s*<\/p>/g, '<p> </p>'); 4042 h = h.replace(/<p>\s*( | )\s*<br \/>\s*( | )\s*<\/p>/g, '<p> </p>'); 4043 h = h.replace(/<p>\s*( | )\s*<br \/>\s*<\/p>/g, '<p> </p>'); 4044 h = h.replace(/<p>\s*<br \/>\s* \s*<\/p>/g, '<p> </p>'); 4252 h = h.replace(/<td>\s*<br \/>\s*<\/td>/g, '<td>' + nb + '</td>'); 4253 h = h.replace(/<p>\s*<br \/>\s*<\/p>/g, '<p>' + nb + '</p>'); 4254 h = h.replace(/<br \/>$/, ''); // Remove last BR for Gecko 4255 h = h.replace(/<br \/><\/p>/g, '</p>'); // Remove last BR in P tags for Gecko 4256 h = h.replace(/<p>\s*( | )\s*<br \/>\s*( | )\s*<\/p>/g, '<p>' + nb + '</p>'); 4257 h = h.replace(/<p>\s*( | )\s*<br \/>\s*<\/p>/g, '<p>' + nb + '</p>'); 4258 h = h.replace(/<p>\s*<br \/>\s* \s*<\/p>/g, '<p>' + nb + '</p>'); 4045 4259 h = h.replace(new RegExp('<a>(.*?)<\\/a>', 'g'), '$1'); 4046 h = h.replace(/<p([^>]*)>\s*<\/p>/g, '<p$1> </p>');4260 h = h.replace(/<p([^>]*)>\s*<\/p>/g, '<p$1>' + nb + '</p>'); 4047 4261 4048 4262 // Clean body … … 4060 4274 if (tinyMCE.isGecko) { 4061 4275 h = h.replace(/<o:p _moz-userdefined="" \/>/g, ''); 4062 h = h.replace(/<td([^>]*)>\s*<br \/>\s*<\/td>/g, '<td$1> </td>');4276 h = h.replace(/<td([^>]*)>\s*<br \/>\s*<\/td>/g, '<td$1>' + nb + '</td>'); 4063 4277 } 4064 4278 … … 4098 4312 4099 4313 function TinyMCE_Cleanup() { 4100 this.is MSIE = (navigator.appName == "Microsoft Internet Explorer");4314 this.isIE = (navigator.appName == "Microsoft Internet Explorer"); 4101 4315 this.rules = tinyMCE.clearArray(new Array()); 4102 4316 … … 4119 4333 this.vElements = tinyMCE.clearArray(new Array()); 4120 4334 this.vElementsRe = ''; 4121 this.closeElementsRe = /^(IMG|BR|HR|LINK|META|BASE|INPUT| BUTTON|AREA)$/;4335 this.closeElementsRe = /^(IMG|BR|HR|LINK|META|BASE|INPUT|AREA)$/; 4122 4336 this.codeElementsRe = /^(SCRIPT|STYLE)$/; 4123 4337 this.serializationId = 0; … … 4145 4359 this.nlAfterRe = this._arrayToRe(s.newline_after_elements.split(','), 'gi', '<(', ')([^>]*)>'); 4146 4360 this.nlBeforeAfterRe = this._arrayToRe(s.newline_before_after_elements.split(','), 'gi', '<(\\/?)(', ')([^>]*)>'); 4361 this.serializedNodes = []; 4147 4362 4148 4363 if (s.invalid_elements != '') … … 4185 4400 4186 4401 this.vElementsRe = this._arrayToRe(this.vElements, ''); 4402 }, 4403 4404 isValid : function(n) { 4405 this._setupRules(); // Will initialize cleanup rules 4406 4407 // Clean the name up a bit 4408 n = n.replace(/[^a-z0-9]+/gi, '').toUpperCase(); 4409 4410 return !tinyMCE.getParam('cleanup') || this.vElementsRe.test(n); 4411 }, 4412 4413 addChildRemoveRuleStr : function(s) { 4414 var x, y, p, i, t, tn, ta, cl, r; 4415 4416 if (!s) 4417 return; 4418 4419 ta = s.split(','); 4420 for (x=0; x<ta.length; x++) { 4421 s = ta[x]; 4422 4423 // Split tag/children 4424 p = this.split(/\[|\]/, s); 4425 if (p == null || p.length < 1) 4426 t = s.toUpperCase(); 4427 else 4428 t = p[0].toUpperCase(); 4429 4430 // Handle all tag names 4431 tn = this.split('/', t); 4432 for (y=0; y<tn.length; y++) { 4433 r = "^("; 4434 4435 // Build regex 4436 cl = this.split(/\|/, p[1]); 4437 for (i=0; i<cl.length; i++) { 4438 if (cl[i] == '%istrict') 4439 r += tinyMCE.inlineStrict; 4440 else if (cl[i] == '%itrans') 4441 r += tinyMCE.inlineTransitional; 4442 else if (cl[i] == '%istrict_na') 4443 r += tinyMCE.inlineStrict.substring(2); 4444 else if (cl[i] == '%itrans_na') 4445 r += tinyMCE.inlineTransitional.substring(2); 4446 else if (cl[i] == '%btrans') 4447 r += tinyMCE.blockElms; 4448 else if (cl[i] == '%strict') 4449 r += tinyMCE.blockStrict; 4450 else 4451 r += (cl[i].charAt(0) != '#' ? cl[i].toUpperCase() : cl[i]); 4452 4453 r += (i != cl.length - 1 ? '|' : ''); 4454 } 4455 4456 r += ')$'; 4457 //tinyMCE.debug(t + "=" + r); 4458 if (this.childRules == null) 4459 this.childRules = tinyMCE.clearArray(new Array()); 4460 4461 this.childRules[tn[y]] = new RegExp(r); 4462 4463 if (p.length > 1) 4464 this.childRules[tn[y]].wrapTag = p[2]; 4465 } 4466 } 4187 4467 }, 4188 4468 … … 4234 4514 t = a[i]; 4235 4515 4516 if (t.charAt(0) == '!') { 4517 a[i] = t = t.substring(1); 4518 4519 if (!r.reqAttribsRe) 4520 r.reqAttribsRe = '\\s+(' + t; 4521 else 4522 r.reqAttribsRe += '|' + t; 4523 } 4524 4236 4525 av = new RegExp('(=|:|<)(.*?)$').exec(t); 4237 4526 t = t.replace(new RegExp('(=|:|<).*?$'), ''); … … 4253 4542 r.validAttribValues = tinyMCE.clearArray(new Array()); 4254 4543 4255 r.validAttribValues[t.toLowerCase()] = this._arrayToRe(this.split('?', av[0].substring(1)), ' ');4544 r.validAttribValues[t.toLowerCase()] = this._arrayToRe(this.split('?', av[0].substring(1)), 'i'); 4256 4545 } 4257 4546 } … … 4261 4550 a[i] = t.toLowerCase(); 4262 4551 } 4552 4553 if (r.reqAttribsRe) 4554 r.reqAttribsRe = new RegExp(r.reqAttribsRe + ')=\"', 'g'); 4263 4555 4264 4556 r.vAttribsRe += ')$'; … … 4286 4578 4287 4579 if (!this.xmlDoc) { 4288 if (this.is MSIE) {4580 if (this.isIE) { 4289 4581 try {this.xmlDoc = new ActiveXObject('MSXML2.DOMDocument');} catch (e) {} 4290 4582 … … 4306 4598 this._convertToXML(n, b); 4307 4599 4308 if (this.is MSIE)4600 if (this.isIE) 4309 4601 return this.xmlDoc.xml; 4310 4602 else … … 4357 4649 }, 4358 4650 4359 serializeNodeAsHTML : function(n ) {4360 var en, no, h = '', i, l, r, cn, va = false, f = false, at, hc;4651 serializeNodeAsHTML : function(n, inn) { 4652 var en, no, h = '', i, l, t, st, r, cn, va = false, f = false, at, hc, cr; 4361 4653 4362 4654 this._setupRules(); // Will initialize cleanup rules … … 4364 4656 if (this._isDuplicate(n)) 4365 4657 return ''; 4658 4659 // Skip non valid child elements 4660 if (n.parentNode && this.childRules != null) { 4661 cr = this.childRules[n.parentNode.nodeName]; 4662 4663 if (typeof(cr) != "undefined" && !cr.test(n.nodeName)) { 4664 st = true; 4665 t = null; 4666 } 4667 } 4366 4668 4367 4669 switch (n.nodeType) { … … 4369 4671 hc = n.hasChildNodes(); 4370 4672 4673 if (st) 4674 break; 4675 4371 4676 // MSIE sometimes produces <//tag> 4372 if ((tinyMCE.is MSIE && !tinyMCE.isOpera) && n.nodeName.indexOf('/') != -1)4677 if ((tinyMCE.isRealIE) && n.nodeName.indexOf('/') != -1) 4373 4678 break; 4374 4679 4375 if (this.vElementsRe.test(n.nodeName) && (!this.iveRe || !this.iveRe.test(n.nodeName)) ) {4680 if (this.vElementsRe.test(n.nodeName) && (!this.iveRe || !this.iveRe.test(n.nodeName)) && !inn) { 4376 4681 va = true; 4377 4682 … … 4393 4698 return ""; 4394 4699 4395 h += '<' + en;4700 t = '<' + en; 4396 4701 4397 4702 if (r.vAttribsReIsWild) { … … 4401 4706 no = at[i]; 4402 4707 if (no.specified && r.vAttribsRe.test(no.nodeName)) 4403 h+= this._serializeAttribute(n, r, no.nodeName);4708 t += this._serializeAttribute(n, r, no.nodeName); 4404 4709 } 4405 4710 } else { 4406 4711 // Serialize specific attributes 4407 4712 for (i=r.vAttribs.length-1; i>-1; i--) 4408 h+= this._serializeAttribute(n, r, r.vAttribs[i]);4713 t += this._serializeAttribute(n, r, r.vAttribs[i]); 4409 4714 } 4410 4715 … … 4415 4720 for (no in at) { 4416 4721 if (at[no]) 4417 h+= this._serializeAttribute(n, r, at[no]);4722 t += this._serializeAttribute(n, r, at[no]); 4418 4723 } 4419 4724 } 4420 4725 4726 // Check for required attribs 4727 if (r.reqAttribsRe && !t.match(r.reqAttribsRe)) 4728 t = null; 4729 4421 4730 // Close these 4422 if (this.closeElementsRe.test(n.nodeName)) 4423 return h + ' />'; 4424 4425 h += '>'; 4426 4427 if (this.isMSIE && this.codeElementsRe.test(n.nodeName)) 4731 if (t != null && this.closeElementsRe.test(n.nodeName)) 4732 return t + ' />'; 4733 4734 if (t != null) 4735 h += t + '>'; 4736 4737 if (this.isIE && this.codeElementsRe.test(n.nodeName)) 4428 4738 h += n.innerHTML; 4429 4739 } … … 4431 4741 4432 4742 case 3: // Text 4743 if (st) 4744 break; 4745 4433 4746 if (n.parentNode && this.codeElementsRe.test(n.parentNode.nodeName)) 4434 return this.is MSIE ? '' : n.nodeValue;4747 return this.isIE ? '' : n.nodeValue; 4435 4748 4436 4749 return this.xmlEncode(n.nodeValue); 4437 4750 4438 4751 case 8: // Comment 4752 if (st) 4753 break; 4754 4439 4755 return "<!--" + this._trimComment(n.nodeValue) + "-->"; 4440 4756 } … … 4452 4768 4453 4769 // End element 4454 if ( va)4770 if (t != null && va) 4455 4771 h += '</' + en + '>'; 4456 4772 … … 4489 4805 av = "uid_" + (this.idCount++); 4490 4806 4491 if (av.length != 0) 4492 return " " + an + "=" + '"' + this.xmlEncode(av) + '"'; 4807 if (av.length != 0) { 4808 if (an.indexOf('on') != 0) 4809 av = this.xmlEncode(av); 4810 4811 return " " + an + "=" + '"' + av + '"'; 4812 } 4493 4813 4494 4814 return ""; … … 4497 4817 formatHTML : function(h) { 4498 4818 var s = this.settings, p = '', i = 0, li = 0, o = '', l; 4819 4820 // Replace BR in pre elements to \n 4821 h = h.replace(/<pre([^>]*)>(.*?)<\/pre>/gi, function (a, b, c) { 4822 c = c.replace(/<br\s*\/>/gi, '\n'); 4823 return '<pre' + b + '>' + c + '</pre>'; 4824 }); 4499 4825 4500 4826 h = h.replace(/\r/g, ''); // Windows sux, isn't carriage return a thing of the past :) … … 4528 4854 4529 4855 xmlEncode : function(s) { 4530 var i, l, e, o = '', c;4856 var cl = this; 4531 4857 4532 4858 this._setupEntities(); // Will intialize lookup table … … 4537 4863 4538 4864 case "named": 4539 for (i=0, l=s.length; i<l; i++) { 4540 c = s.charCodeAt(i); 4541 e = this.entities[c]; 4542 4543 if (e && e != '') 4544 o += '&' + e + ';'; 4545 else 4546 o += String.fromCharCode(c); 4547 } 4548 4549 return o; 4865 return s.replace(new RegExp('[\u007F-\uFFFF<>&"\']', 'g'), function (c, b) { 4866 b = cl.entities[c.charCodeAt(0)]; 4867 4868 return b ? '&' + b + ';' : c; 4869 }); 4550 4870 4551 4871 case "numeric": 4552 for (i=0, l=s.length; i<l; i++) { 4553 c = s.charCodeAt(i); 4554 4555 if (c > 127 || c == 60 || c == 62 || c == 38 || c == 39 || c == 34) 4556 o += '&#' + c + ";"; 4557 else 4558 o += String.fromCharCode(c); 4559 } 4560 4561 return o; 4872 return s.replace(new RegExp('[\u007F-\uFFFF<>&"\']', 'g'), function (c, b) { 4873 return b ? '&#' + c.charCodeAt(0) + ';' : c; 4874 }); 4562 4875 } 4563 4876 … … 4597 4910 v = e.className; 4598 4911 4599 if (this.is MSIE && n == "http-equiv")4912 if (this.isIE && n == "http-equiv") 4600 4913 v = e.httpEquiv; 4601 4914 4602 if (this.is MSIE && e.nodeName == "FORM" && n == "enctype" && v == "application/x-www-form-urlencoded")4915 if (this.isIE && e.nodeName == "FORM" && n == "enctype" && v == "application/x-www-form-urlencoded") 4603 4916 v = ""; 4604 4917 4605 if (this.is MSIE && e.nodeName == "INPUT" && n == "size" && v == "20")4918 if (this.isIE && e.nodeName == "INPUT" && n == "size" && v == "20") 4606 4919 v = ""; 4607 4920 4608 if (this.is MSIE && e.nodeName == "INPUT" && n == "maxlength" && v == "2147483647")4921 if (this.isIE && e.nodeName == "INPUT" && n == "maxlength" && v == "2147483647") 4609 4922 v = ""; 4610 4923 … … 4680 4993 this.addRuleStr(s.valid_elements); 4681 4994 this.addRuleStr(s.extended_valid_elements); 4995 this.addChildRemoveRuleStr(s.valid_child_elements); 4682 4996 4683 4997 this.rulesDone = true; … … 4691 5005 return false; 4692 5006 4693 if (tinyMCE.is MSIE && !tinyMCE.isOpera&& n.nodeType == 1) {5007 if (tinyMCE.isRealIE && n.nodeType == 1) { 4694 5008 // Mark elements 4695 5009 if (n.mce_serialized == this.serializationId) … … 4709 5023 return false; 4710 5024 } 5025 5026 }; 5027 5028 /* file:jscripts/tiny_mce/classes/TinyMCE_DOMUtils.class.js */ 5029 5030 TinyMCE_Engine.prototype.createTagHTML = function(tn, a, h) { 5031 var o = '', f = tinyMCE.xmlEncode; 5032 5033 o = '<' + tn; 5034 5035 if (a) { 5036 for (n in a) { 5037 if (typeof(a[n]) != 'function' && a[n] != null) 5038 o += ' ' + f(n) + '="' + f('' + a[n]) + '"'; 5039 } 5040 } 5041 5042 o += !h ? ' />' : '>' + h + '</' + tn + '>'; 5043 5044 return o; 4711 5045 }; 4712 5046 4713 /* file:jscripts/tiny_mce/classes/TinyMCE_DOMUtils.class.js */ 5047 TinyMCE_Engine.prototype.createTag = function(d, tn, a, h) { 5048 var o = d.createElement(tn); 5049 5050 if (a) { 5051 for (n in a) { 5052 if (typeof(a[n]) != 'function' && a[n] != null) 5053 tinyMCE.setAttrib(o, n, a[n]); 5054 } 5055 } 5056 5057 if (h) 5058 o.innerHTML = h; 5059 5060 return o; 5061 }; 4714 5062 4715 5063 TinyMCE_Engine.prototype.getElementByAttributeValue = function(n, e, a, v) { … … 4732 5080 }; 4733 5081 4734 TinyMCE_Engine.prototype.getParentBlockElement = function(n) { 4735 while (n) { 4736 if (this.isBlockElement(n)) 4737 return n; 4738 4739 n = n.parentNode; 4740 } 5082 TinyMCE_Engine.prototype.getParentBlockElement = function(n, r) { 5083 return this.getParentNode(n, function(n) { 5084 return tinyMCE.isBlockElement(n); 5085 }, r); 4741 5086 4742 5087 return null; … … 4753 5098 var i, nl, n; 4754 5099 4755 if (tinyMCE.isMSIE && !tinyMCE.isOpera) { 5100 // Convert all strong/em to b/i in Gecko 5101 if (tinyMCE.isGecko) { 5102 h = h.replace(/<strong/gi, '<b'); 5103 h = h.replace(/<em(\/?)/gi, '<i'); 5104 h = h.replace(/<em /gi, '<i'); 5105 h = h.replace(/<\/strong>/gi, '</b>'); 5106 h = h.replace(/<\/em>/gi, '</i>'); 5107 } 5108 5109 if (tinyMCE.isRealIE) { 4756 5110 // Since MSIE handles invalid HTML better that valid XHTML we 4757 5111 // need to make some things invalid. <hr /> gets converted to <hr>. … … 4783 5137 4784 5138 TinyMCE_Engine.prototype.getOuterHTML = function(e) { 4785 if (tinyMCE.is MSIE)5139 if (tinyMCE.isIE) 4786 5140 return e.outerHTML; 4787 5141 4788 5142 var d = e.ownerDocument.createElement("body"); 4789 d.appendChild(e );5143 d.appendChild(e.cloneNode(true)); 4790 5144 return d.innerHTML; 4791 5145 }; 4792 5146 4793 TinyMCE_Engine.prototype.setOuterHTML = function(e, h) { 4794 if (tinyMCE.isMSIE) { 5147 TinyMCE_Engine.prototype.setOuterHTML = function(e, h, d) { 5148 var d = typeof(d) == "undefined" ? e.ownerDocument : d, i, nl, t; 5149 5150 if (tinyMCE.isIE && e.nodeType == 1) 4795 5151 e.outerHTML = h; 4796 return; 5152 else { 5153 t = d.createElement("body"); 5154 t.innerHTML = h; 5155 5156 for (i=0, nl=t.childNodes; i<nl.length; i++) 5157 e.parentNode.insertBefore(nl[i].cloneNode(true), e); 5158 5159 e.parentNode.removeChild(e); 4797 5160 } 4798 4799 var d = e.ownerDocument.createElement("body");4800 d.innerHTML = h;4801 e.parentNode.replaceChild(d.firstChild, e);4802 5161 }; 4803 5162 … … 4826 5185 4827 5186 TinyMCE_Engine.prototype.getNodeTree = function(n, na, t, nn) { 4828 var i; 4829 4830 if (typeof(t) == "undefined" || n.nodeType == t && (typeof(nn) == "undefined" || n.nodeName == nn)) 4831 na[na.length] = n; 4832 4833 if (n.hasChildNodes()) { 4834 for (i=0; i<n.childNodes.length; i++) 4835 tinyMCE.getNodeTree(n.childNodes[i], na, t, nn); 5187 return this.selectNodes(n, function(n) { 5188 return (!t || n.nodeType == t) && (!nn || n.nodeName == nn); 5189 }, na ? na : new Array()); 5190 }; 5191 5192 TinyMCE_Engine.prototype.getParentElement = function(n, na, f, r) { 5193 var re = na ? new RegExp('^(' + na.toUpperCase().replace(/,/g, '|') + ')$') : 0, v; 5194 5195 // Compatiblity with old scripts where f param was a attribute string 5196 if (f && typeof(f) == 'string') 5197 return this.getParentElement(n, na, function(no) {return tinyMCE.getAttrib(no, f) != '';}); 5198 5199 return this.getParentNode(n, function(n) { 5200 return ((n.nodeType == 1 && !re) || (re && re.test(n.nodeName))) && (!f || f(n)); 5201 }, r); 5202 }; 5203 5204 TinyMCE_Engine.prototype.getParentNode = function(n, f, r) { 5205 while (n) { 5206 if (n == r) 5207 return null; 5208 5209 if (f(n)) 5210 return n; 5211 5212 n = n.parentNode; 4836 5213 } 4837 4838 return na;4839 };4840 4841 TinyMCE_Engine.prototype.getParentElement = function(node, names, attrib_name, attrib_value) {4842 if (typeof(names) == "undefined") {4843 if (node.nodeType == 1)4844 return node;4845 4846 // Find parent node that is a element4847 while ((node = node.parentNode) != null && node.nodeType != 1) ;4848 4849 return node;4850 }4851 4852 if (node == null)4853 return null;4854 4855 var namesAr = names.toUpperCase().split(',');4856 4857 do {4858 for (var i=0; i<namesAr.length; i++) {4859 if (node.nodeName == namesAr[i] || names == "*") {4860 if (typeof(attrib_name) == "undefined")4861 return node;4862 else if (node.getAttribute(attrib_name)) {4863 if (typeof(attrib_value) == "undefined") {4864 if (node.getAttribute(attrib_name) != "")4865 return node;4866 } else if (node.getAttribute(attrib_name) == attrib_value)4867 return node;4868 }4869 }4870 }4871 } while ((node = node.parentNode) != null);4872 5214 4873 5215 return null; 4874 5216 }; 4875 5217 4876 TinyMCE_Engine.prototype.getParentNode = function(n, f) { 4877 while (n) { 4878 if (f(n)) 4879 return n; 4880 4881 n = n.parentNode; 4882 } 4883 4884 return null; 4885 }; 4886 4887 TinyMCE_Engine.prototype.getAttrib = function(elm, name, default_value) { 4888 if (typeof(default_value) == "undefined") 4889 default_value = ""; 5218 TinyMCE_Engine.prototype.getAttrib = function(elm, name, dv) { 5219 var v; 5220 5221 if (typeof(dv) == "undefined") 5222 dv = ""; 4890 5223 4891 5224 // Not a element 4892 5225 if (!elm || elm.nodeType != 1) 4893 return d efault_value;4894 4895 v ar v= elm.getAttribute(name);5226 return dv; 5227 5228 v = elm.getAttribute(name); 4896 5229 4897 5230 // Try className for class attrib … … 4907 5240 v = elm.href; 4908 5241 4909 if (name == "http-equiv" && tinyMCE.is MSIE)5242 if (name == "http-equiv" && tinyMCE.isIE) 4910 5243 v = elm.httpEquiv; 4911 5244 … … 4913 5246 v = elm.style.cssText; 4914 5247 4915 return (v && v != "") ? v : d efault_value;5248 return (v && v != "") ? v : dv; 4916 5249 }; 4917 5250 4918 TinyMCE_Engine.prototype.setAttrib = function(element, name, value, fix_value) { 4919 if (typeof(value) == "number" && value != null) 4920 value = "" + value; 4921 4922 if (fix_value) { 4923 if (value == null) 4924 value = ""; 4925 4926 var re = new RegExp('[^0-9%]', 'g'); 4927 value = value.replace(re, ''); 5251 TinyMCE_Engine.prototype.setAttrib = function(el, name, va, fix) { 5252 if (typeof(va) == "number" && va != null) 5253 va = "" + va; 5254 5255 if (fix) { 5256 if (va == null) 5257 va = ""; 5258 5259 va = va.replace(/[^0-9%]/g, ''); 4928 5260 } 4929 5261 4930 5262 if (name == "style") 4931 el ement.style.cssText = value;5263 el.style.cssText = va; 4932 5264 4933 5265 if (name == "class") 4934 el ement.className = value;4935 4936 if (va lue != null && value != "" && value!= -1)4937 el ement.setAttribute(name, value);5266 el.className = va; 5267 5268 if (va != null && va != "" && va != -1) 5269 el.setAttribute(name, va); 4938 5270 else 4939 el ement.removeAttribute(name);5271 el.removeAttribute(name); 4940 5272 }; 4941 5273 4942 TinyMCE_Engine.prototype.setStyleAttrib = function(e lm, name, value) {4943 e val('elm.style.' + name + '=value;');4944 4945 // Style attrib deleted 4946 if (tinyMCE.is MSIE && value == null || value== '') {4947 v ar str = tinyMCE.serializeStyle(tinyMCE.parseStyle(elm.style.cssText));4948 e lm.style.cssText = str;4949 e lm.setAttribute("style", str);5274 TinyMCE_Engine.prototype.setStyleAttrib = function(e, n, v) { 5275 e.style[n] = v; 5276 5277 // Style attrib deleted in IE 5278 if (tinyMCE.isIE && v == null || v == '') { 5279 v = tinyMCE.serializeStyle(tinyMCE.parseStyle(e.style.cssText)); 5280 e.style.cssText = v; 5281 e.setAttribute("style", v); 4950 5282 } 4951 5283 }; … … 4968 5300 }; 4969 5301 4970 TinyMCE_Engine.prototype.getAbsPosition = function(n ) {4971 var p = {absLeft : 0, absTop : 0};4972 4973 while (n ) {4974 p.absLeft+= n.offsetLeft;4975 p.absTop+= n.offsetTop;5302 TinyMCE_Engine.prototype.getAbsPosition = function(n, cn) { 5303 var l = 0, t = 0; 5304 5305 while (n && n != cn) { 5306 l += n.offsetLeft; 5307 t += n.offsetTop; 4976 5308 n = n.offsetParent; 4977 5309 } 4978 5310 4979 return p;5311 return {absLeft : l, absTop : t}; 4980 5312 }; 4981 5313 … … 5006 5338 }; 5007 5339 5340 TinyMCE_Engine.prototype.selectElements = function(n, na, f) { 5341 var i, a = [], nl, x; 5342 5343 for (x=0, na = na.split(','); x<na.length; x++) 5344 for (i=0, nl = n.getElementsByTagName(na[x]); i<nl.length; i++) 5345 (!f || f(nl[i])) && a.push(nl[i]); 5346 5347 return a; 5348 }; 5349 5008 5350 TinyMCE_Engine.prototype.selectNodes = function(n, f, a) { 5009 5351 var i; … … 5025 5367 TinyMCE_Engine.prototype.addCSSClass = function(e, c, b) { 5026 5368 var o = this.removeCSSClass(e, c); 5027 5028 5369 return e.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c; 5029 5370 }; 5030 5371 5031 5372 TinyMCE_Engine.prototype.removeCSSClass = function(e, c) { 5032 var a = this.explode(' ', e.className), i; 5033 5034 for (i=0; i<a.length; i++) { 5035 if (a[i] == c) 5036 a[i] = ''; 5037 } 5038 5039 return e.className = a.join(' '); 5373 c = e.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' '); 5374 return e.className = c != ' ' ? c : ''; 5375 }; 5376 5377 TinyMCE_Engine.prototype.hasCSSClass = function(n, c) { 5378 return new RegExp('\\b' + c + '\\b', 'g').test(n.className); 5040 5379 }; 5041 5380 … … 5060 5399 e.parentNode.replaceChild(ne, e); 5061 5400 } 5401 }; 5402 5403 TinyMCE_Engine.prototype.getViewPort = function(w) { 5404 var d = w.document, m = d.compatMode == 'CSS1Compat', b = d.body, de = d.documentElement; 5405 5406 return { 5407 left : w.pageXOffset || (m ? de.scrollLeft : b.scrollLeft), 5408 top : w.pageYOffset || (m ? de.scrollTop : b.scrollTop), 5409 width : w.innerWidth || (m ? de.clientWidth : b.clientWidth), 5410 height : w.innerHeight || (m ? de.clientHeight : b.clientHeight) 5411 }; 5062 5412 }; 5063 5413 … … 5229 5579 5230 5580 TinyMCE_Engine.prototype.convertRelativeToAbsoluteURL = function(base_url, relative_url) { 5231 var baseURL = this.parseURL(base_url) ;5581 var baseURL = this.parseURL(base_url), baseURLParts, relURLParts; 5232 5582 var relURL = this.parseURL(relative_url); 5233 5583 5234 if (relative_url == "" || relative_url. charAt(0) == '/' || relative_url.indexOf('://') != -1 || relative_url.indexOf('mailto:') != -1 || relative_url.indexOf('javascript:') != -1)5584 if (relative_url == "" || relative_url.indexOf('://') != -1 || /^(mailto:|javascript:|#|\/)/.test(relative_url)) 5235 5585 return relative_url; 5236 5586 … … 5307 5657 5308 5658 // Fix relative/Mozilla 5309 if (!tinyMCE.is MSIE && !on_save && url.indexOf("://") == -1 && url.charAt(0) != '/')5659 if (!tinyMCE.isIE && !on_save && url.indexOf("://") == -1 && url.charAt(0) != '/') 5310 5660 return tinyMCE.settings['base_href'] + url; 5311 5661 … … 5354 5704 5355 5705 TinyMCE_Engine.prototype.convertAllRelativeURLs = function(body) { 5706 var i, elms, src, href, mhref, msrc; 5707 5356 5708 // Convert all image URL:s to absolute URL 5357 varelms = body.getElementsByTagName("img");5358 for ( vari=0; i<elms.length; i++) {5359 varsrc = tinyMCE.getAttrib(elms[i], 'src');5360 5361 varmsrc = tinyMCE.getAttrib(elms[i], 'mce_src');5709 elms = body.getElementsByTagName("img"); 5710 for (i=0; i<elms.length; i++) { 5711 src = tinyMCE.getAttrib(elms[i], 'src'); 5712 5713 msrc = tinyMCE.getAttrib(elms[i], 'mce_src'); 5362 5714 if (msrc != "") 5363 5715 src = msrc; … … 5370 5722 5371 5723 // Convert all link URL:s to absolute URL 5372 varelms = body.getElementsByTagName("a");5373 for ( vari=0; i<elms.length; i++) {5374 varhref = tinyMCE.getAttrib(elms[i], 'href');5375 5376 varmhref = tinyMCE.getAttrib(elms[i], 'mce_href');5724 elms = body.getElementsByTagName("a"); 5725 for (i=0; i<elms.length; i++) { 5726 href = tinyMCE.getAttrib(elms[i], 'href'); 5727 5728 mhref = tinyMCE.getAttrib(elms[i], 'mce_href'); 5377 5729 if (mhref != "") 5378 5730 href = mhref; … … 5388 5740 5389 5741 TinyMCE_Engine.prototype.clearArray = function(a) { 5390 for (var k in a) 5391 a[k] = null; 5742 var n; 5743 5744 for (n in a) 5745 a[n] = null; 5392 5746 5393 5747 return a; 5394 5748 }; 5395 5749 5750 TinyMCE_Engine.prototype.explode = function(d, s) { 5751 var ar = s.split(d), oar = new Array(), i; 5752 5753 for (i = 0; i<ar.length; i++) { 5754 if (ar[i] != "") 5755 oar[oar.length] = ar[i]; 5756 } 5757 5758 return oar; 5759 }; 5760 5396 5761 /* file:jscripts/tiny_mce/classes/TinyMCE_Event.class.js */ 5397 5762 5398 5763 TinyMCE_Engine.prototype._setEventsEnabled = function(node, state) { 5399 var events = new Array('onfocus','onblur','onclick','ondblclick', 5764 var evs, x, y, elms, i, event; 5765 var events = ['onfocus','onblur','onclick','ondblclick', 5400 5766 'onmousedown','onmouseup','onmouseover','onmousemove', 5401 'onmouseout','onkeypress','onkeydown','onkeydown','onkeyup' );5402 5403 varevs = tinyMCE.settings['event_elements'].split(',');5404 for ( vary=0; y<evs.length; y++){5405 varelms = node.getElementsByTagName(evs[y]);5406 for ( vari=0; i<elms.length; i++) {5407 varevent = "";5408 5409 for ( varx=0; x<events.length; x++) {5767 'onmouseout','onkeypress','onkeydown','onkeydown','onkeyup']; 5768 5769 evs = tinyMCE.settings['event_elements'].split(','); 5770 for (y=0; y<evs.length; y++){ 5771 elms = node.getElementsByTagName(evs[y]); 5772 for (i=0; i<elms.length; i++) { 5773 event = ""; 5774 5775 for (x=0; x<events.length; x++) { 5410 5776 if ((event = tinyMCE.getAttrib(elms[i], events[x])) != '') { 5411 5777 event = tinyMCE.cleanupEventStr("" + event); … … 5454 5820 continue; 5455 5821 5456 tinyMCE.selectedInstance = inst;5822 inst.select(); 5457 5823 win = inst.getWin(); 5458 5824 … … 5472 5838 }; 5473 5839 5840 TinyMCE_Engine.prototype.findEvent = function(e) { 5841 var n, inst; 5842 5843 if (e) 5844 return e; 5845 5846 for (n in tinyMCE.instances) { 5847 inst = tinyMCE.instances[n]; 5848 5849 if (tinyMCE.isInstance(inst) && inst.getWin().event) 5850 return inst.getWin().event; 5851 } 5852 5853 return null; 5854 }; 5855 5474 5856 TinyMCE_Engine.prototype.unloadHandler = function() { 5475 5857 tinyMCE.triggerSave(true, true); … … 5477 5859 5478 5860 TinyMCE_Engine.prototype.addEventHandlers = function(inst) { 5479 var doc = inst.getDoc(); 5861 this.setEventHandlers(inst, 1); 5862 }; 5863 5864 TinyMCE_Engine.prototype.setEventHandlers = function(inst, s) { 5865 var doc = inst.getDoc(), ie, ot, i, f = s ? tinyMCE.addEvent : tinyMCE.removeEvent; 5866 5867 ie = ['keypress', 'keyup', 'keydown', 'click', 'mouseup', 'mousedown', 'controlselect', 'dblclick']; 5868 ot = ['keypress', 'keyup', 'keydown', 'click', 'mouseup', 'mousedown', 'focus', 'blur', 'dragdrop']; 5480 5869 5481 5870 inst.switchSettings(); 5482 5871 5483 if (tinyMCE.isMSIE) { 5484 tinyMCE.addEvent(doc, "keypress", TinyMCE_Engine.prototype._eventPatch); 5485 tinyMCE.addEvent(doc, "keyup", TinyMCE_Engine.prototype._eventPatch); 5486 tinyMCE.addEvent(doc, "keydown", TinyMCE_Engine.prototype._eventPatch); 5487 tinyMCE.addEvent(doc, "mouseup", TinyMCE_Engine.prototype._eventPatch); 5488 tinyMCE.addEvent(doc, "mousedown", TinyMCE_Engine.prototype._eventPatch); 5489 tinyMCE.addEvent(doc, "click", TinyMCE_Engine.prototype._eventPatch); 5872 if (tinyMCE.isIE) { 5873 for (i=0; i<ie.length; i++) 5874 f(doc, ie[i], TinyMCE_Engine.prototype._eventPatch); 5490 5875 } else { 5491 tinyMCE.addEvent(doc, "keypress", tinyMCE.handleEvent); 5492 tinyMCE.addEvent(doc, "keydown", tinyMCE.handleEvent); 5493 tinyMCE.addEvent(doc, "keyup", tinyMCE.handleEvent); 5494 tinyMCE.addEvent(doc, "click", tinyMCE.handleEvent); 5495 tinyMCE.addEvent(doc, "mouseup", tinyMCE.handleEvent); 5496 tinyMCE.addEvent(doc, "mousedown", tinyMCE.handleEvent); 5497 tinyMCE.addEvent(doc, "focus", tinyMCE.handleEvent); 5498 tinyMCE.addEvent(doc, "blur", tinyMCE.handleEvent); 5876 for (i=0; i<ot.length; i++) 5877 f(doc, ot[i], tinyMCE.handleEvent); 5499 5878 5500 5879 eval('try { doc.designMode = "On"; } catch(e) {}'); // Force designmode … … 5503 5882 5504 5883 TinyMCE_Engine.prototype.onMouseMove = function() { 5505 var inst; 5884 var inst, lh; 5885 5886 // Fix for IE7 bug where it's not restoring hover on anchors correctly 5887 if (tinyMCE.lastHover) { 5888 lh = tinyMCE.lastHover; 5889 5890 // Call out on menus and refresh class on normal buttons 5891 if (lh.className.indexOf('mceMenu') != -1) 5892 tinyMCE._menuButtonEvent('out', lh); 5893 else 5894 lh.className = lh.className; 5895 5896 tinyMCE.lastHover = null; 5897 } 5506 5898 5507 5899 if (!tinyMCE.hasMouseMoved) { … … 5520 5912 5521 5913 TinyMCE_Engine.prototype.cancelEvent = function(e) { 5522 if (tinyMCE.isMSIE) { 5914 if (!e) 5915 return false; 5916 5917 if (tinyMCE.isIE) { 5523 5918 e.returnValue = false; 5524 5919 e.cancelBubble = true; 5525 } else 5920 } else { 5526 5921 e.preventDefault(); 5922 e.stopPropagation && e.stopPropagation(); 5923 } 5924 5925 return false; 5527 5926 }; 5528 5927 5529 5928 TinyMCE_Engine.prototype.addEvent = function(o, n, h) { 5929 // Add cleanup for all non unload events 5930 if (n != 'unload') { 5931 function clean() { 5932 var ex; 5933 5934 try { 5935 tinyMCE.removeEvent(o, n, h); 5936 tinyMCE.removeEvent(window, 'unload', clean); 5937 o = n = h = null; 5938 } catch (ex) { 5939 // IE may produce access denied exception on unload 5940 } 5941 } 5942 5943 // Add memory cleaner 5944 tinyMCE.addEvent(window, 'unload', clean); 5945 } 5946 5530 5947 if (o.attachEvent) 5531 5948 o.attachEvent("on" + n, h); 5532 5949 else 5533 5950 o.addEventListener(n, h, false); 5951 }; 5952 5953 TinyMCE_Engine.prototype.removeEvent = function(o, n, h) { 5954 if (o.detachEvent) 5955 o.detachEvent("on" + n, h); 5956 else 5957 o.removeEventListener(n, h, false); 5534 5958 }; 5535 5959 … … 5548 5972 TinyMCE_Engine.prototype.accessibleEventHandler = function(e) { 5549 5973 var win = this._win; 5550 e = tinyMCE.is MSIE ? win.event : e;5551 var elm = tinyMCE.is MSIE ? e.srcElement : e.target;5974 e = tinyMCE.isIE ? win.event : e; 5975 var elm = tinyMCE.isIE ? e.srcElement : e.target; 5552 5976 5553 5977 // Unpiggyback onchange on blur … … 5583 6007 var ife; 5584 6008 5585 if (tinyMCE.is MSIE && !tinyMCE.isOpera) {6009 if (tinyMCE.isRealIE) { 5586 6010 ife = tinyMCE.selectedInstance.iframeElement; 5587 6011 … … 5609 6033 var e, r = this.getRng(), h; 5610 6034 5611 if (tinyMCE.isSafari) { 5612 // Not realy perfect!! 5613 return r.toString(); 5614 } 6035 if (!r) 6036 return null; 5615 6037 5616 6038 e = document.createElement("body"); 5617 6039 5618 if ( tinyMCE.isGecko)6040 if (r.cloneContents) 5619 6041 e.appendChild(r.cloneContents()); 5620 else 6042 else if (typeof(r.item) != 'undefined' || typeof(r.htmlText) != 'undefined') 5621 6043 e.innerHTML = r.item ? r.item(0).outerHTML : r.htmlText; 6044 else 6045 e.innerHTML = r.toString(); // Failed, use text for now 5622 6046 5623 6047 h = tinyMCE._cleanupHTML(inst, inst.contentDocument, inst.settings, e, e, false, true, false); … … 5634 6058 var d, r, s, t; 5635 6059 5636 if (tinyMCE.is MSIE) {6060 if (tinyMCE.isIE) { 5637 6061 d = inst.getDoc(); 5638 6062 … … 5655 6079 5656 6080 getBookmark : function(simple) { 6081 var inst = this.instance; 5657 6082 var rng = this.getRng(); 5658 var doc = this.instance.getDoc(); 5659 var sp, le, s, e, nl, i, si, ei; 5660 var trng, sx, sy, xx = -999999999; 5661 5662 // Skip Opera for now 5663 if (tinyMCE.isOpera) 5664 return null; 5665 5666 sx = doc.body.scrollLeft + doc.documentElement.scrollLeft; 5667 sy = doc.body.scrollTop + doc.documentElement.scrollTop; 5668 5669 if (tinyMCE.isSafari || tinyMCE.isGecko) 6083 var doc = inst.getDoc(), b = inst.getBody(); 6084 var sp, le, s, e, nl, i, si, ei, w; 6085 var trng, sx, sy, xx = -999999999, vp = inst.getViewPort(); 6086 6087 sx = vp.left; 6088 sy = vp.top; 6089 6090 if (tinyMCE.isSafari || tinyMCE.isOpera || simple) 5670 6091 return {rng : rng, scrollX : sx, scrollY : sy}; 5671 6092 5672 if (tinyMCE.isMSIE) { 5673 if (simple) 5674 return {rng : rng}; 5675 6093 if (tinyMCE.isIE) { 5676 6094 if (rng.item) { 5677 6095 e = rng.item(0); 5678 6096 5679 nl = doc.getElementsByTagName(e.nodeName);6097 nl = b.getElementsByTagName(e.nodeName); 5680 6098 for (i=0; i<nl.length; i++) { 5681 6099 if (e == nl[i]) { … … 5692 6110 }; 5693 6111 } else { 6112 trng = doc.body.createTextRange(); 6113 trng.moveToElementText(inst.getBody()); 6114 trng.collapse(true); 6115 bp = Math.abs(trng.move('character', xx)); 6116 5694 6117 trng = rng.duplicate(); 5695 6118 trng.collapse(true); … … 5701 6124 5702 6125 return { 5703 start : sp ,6126 start : sp - bp, 5704 6127 length : le, 5705 6128 scrollX : sx, … … 5710 6133 5711 6134 if (tinyMCE.isGecko) { 5712 s = tinyMCE.getParentElement(rng.startContainer); 5713 for (si=0; si<s.childNodes.length && s.childNodes[si] != rng.startContainer; si++) ; 5714 5715 nl = doc.getElementsByTagName(s.nodeName); 5716 for (i=0; i<nl.length; i++) { 5717 if (s == nl[i]) { 6135 s = this.getSel(); 6136 e = this.getFocusElement(); 6137 6138 if (!s) 6139 return null; 6140 6141 if (e && e.nodeName == 'IMG') { 6142 /*nl = b.getElementsByTagName('IMG'); 6143 for (i=0; i<nl.length; i++) { 6144 if (e == nl[i]) { 5718 6145 sp = i; 5719 6146 break; 5720 6147 } 5721 } 5722 5723 e = tinyMCE.getParentElement(rng.endContainer); 5724 for (ei=0; ei<e.childNodes.length && e.childNodes[ei] != rng.endContainer; ei++) ; 5725 5726 nl = doc.getElementsByTagName(e.nodeName); 5727 for (i=0; i<nl.length; i++) { 5728 if (e == nl[i]) { 5729 le = i; 5730 break; 5731 } 5732 } 5733 5734 //tinyMCE.debug(s.nodeName, sp, rng.startOffset, '-' , e.nodeName, le, rng.endOffset); 5735 //tinyMCE.debug(sx, sy); 5736 5737 return { 5738 startTag : s.nodeName, 5739 start : sp, 5740 startIndex : si, 5741 endTag : e.nodeName, 5742 end : le, 5743 endIndex : ei, 5744 startOffset : rng.startOffset, 5745 endOffset : rng.endOffset, 5746 scrollX : sx, 5747 scrollY : sy 5748 }; 6148 }*/ 6149 6150 return { 6151 start : -1, 6152 end : -1, 6153 index : sp, 6154 scrollX : sx, 6155 scrollY : sy 6156 }; 6157 } 6158 6159 // Caret or selection 6160 if (s.anchorNode == s.focusNode && s.anchorOffset == s.focusOffset) { 6161 e = this._getPosText(b, s.anchorNode, s.focusNode); 6162 6163 if (!e) 6164 return {scrollX : sx, scrollY : sy}; 6165 6166 return { 6167 start : e.start + s.anchorOffset, 6168 end : e.end + s.focusOffset, 6169 scrollX : sx, 6170 scrollY : sy 6171 }; 6172 } else { 6173 e = this._getPosText(b, rng.startContainer, rng.endContainer); 6174 6175 if (!e) 6176 return {scrollX : sx, scrollY : sy}; 6177 6178 return { 6179 start : e.start + rng.startOffset, 6180 end : e.end + rng.endOffset, 6181 scrollX : sx, 6182 scrollY : sy 6183 }; 6184 } 5749 6185 } 5750 6186 … … 5753 6189 5754 6190 moveToBookmark : function(bookmark) { 5755 var rng, nl, i;5756 6191 var inst = this.instance; 6192 var rng, nl, i, ex, b = inst.getBody(), sd; 5757 6193 var doc = inst.getDoc(); 5758 6194 var win = inst.getWin(); … … 5763 6199 5764 6200 if (tinyMCE.isSafari) { 5765 sel.setBaseAndExtent(bookmark. startContainer, bookmark.startOffset, bookmark.endContainer, bookmark.endOffset);6201 sel.setBaseAndExtent(bookmark.rng.startContainer, bookmark.rng.startOffset, bookmark.rng.endContainer, bookmark.rng.endOffset); 5766 6202 return true; 5767 6203 } 5768 6204 5769 if (tinyMCE.is MSIE) {6205 if (tinyMCE.isRealIE) { 5770 6206 if (bookmark.rng) { 5771 bookmark.rng.select(); 6207 try { 6208 bookmark.rng.select(); 6209 } catch (ex) { 6210 // Ignore 6211 } 6212 5772 6213 return true; 5773 6214 } … … 5776 6217 5777 6218 if (bookmark.tag) { 5778 rng = inst.getBody().createControlRange();5779 5780 nl = doc.getElementsByTagName(bookmark.tag);6219 rng = b.createControlRange(); 6220 6221 nl = b.getElementsByTagName(bookmark.tag); 5781 6222 5782 6223 if (nl.length > bookmark.index) { … … 5788 6229 } 5789 6230 } else { 5790 rng = inst.getSel().createRange(); 5791 rng.moveToElementText(inst.getBody()); 5792 rng.collapse(true); 5793 rng.moveStart('character', bookmark.start); 5794 rng.moveEnd('character', bookmark.length); 6231 // Try/catch needed since this operation breaks when TinyMCE is placed in hidden divs/tabs 6232 try { 6233 // Incorrect bookmark 6234 if (bookmark.start < 0) 6235 return true; 6236 6237 rng = inst.getSel().createRange(); 6238 rng.moveToElementText(inst.getBody()); 6239 rng.collapse(true); 6240 rng.moveStart('character', bookmark.start); 6241 rng.moveEnd('character', bookmark.length); 6242 } catch (ex) { 6243 return true; 6244 } 5795 6245 } 5796 6246 … … 5801 6251 } 5802 6252 5803 if (tinyMCE.isGecko && bookmark.rng) { 5804 sel.removeAllRanges(); 5805 sel.addRange(bookmark.rng); 6253 if (tinyMCE.isGecko || tinyMCE.isOpera) { 6254 if (bookmark.rng) { 6255 sel.removeAllRanges(); 6256 sel.addRange(bookmark.rng); 6257 } 6258 6259 if (bookmark.start != -1 && bookmark.end != -1) { 6260 try { 6261 sd = this._getTextPos(b, bookmark.start, bookmark.end); 6262 rng = doc.createRange(); 6263 rng.setStart(sd.startNode, sd.startOffset); 6264 rng.setEnd(sd.endNode, sd.endOffset); 6265 sel.removeAllRanges(); 6266 sel.addRange(rng); 6267 win.focus(); 6268 } catch (ex) { 6269 // Ignore 6270 } 6271 } 6272 6273 /* 6274 if (typeof(bookmark.index) != 'undefined') { 6275 tinyMCE.selectElements(b, 'IMG', function (n) { 6276 if (bookmark.index-- == 0) { 6277 // Select image in Gecko here 6278 } 6279 6280 return false; 6281 }); 6282 } 6283 */ 6284 5806 6285 win.scrollTo(bookmark.scrollX, bookmark.scrollY); 5807 6286 return true; 5808 6287 } 5809 6288 5810 if (tinyMCE.isGecko) {5811 // try {5812 rng = doc.createRange();5813 5814 nl = doc.getElementsByTagName(bookmark.startTag);5815 if (nl.length > bookmark.start)5816 rng.setStart(nl[bookmark.start].childNodes[bookmark.startIndex], bookmark.startOffset);5817 5818 nl = doc.getElementsByTagName(bookmark.endTag);5819 if (nl.length > bookmark.end)5820 rng.setEnd(nl[bookmark.end].childNodes[bookmark.endIndex], bookmark.endOffset);5821 5822 sel.removeAllRanges();5823 sel.addRange(rng);5824 /* } catch {5825 // Ignore5826 }*/5827 5828 win.scrollTo(bookmark.scrollX, bookmark.scrollY);5829 return true;5830 }5831 5832 6289 return false; 6290 }, 6291 6292 _getPosText : function(r, sn, en) { 6293 var w = document.createTreeWalker(r, NodeFilter.SHOW_TEXT, null, false), n, p = 0, d = {}; 6294 6295 while ((n = w.nextNode()) != null) { 6296 if (n == sn) 6297 d.start = p; 6298 6299 if (n == en) { 6300 d.end = p; 6301 return d; 6302 } 6303 6304 p += n.nodeValue ? n.nodeValue.length : 0; 6305 } 6306 6307 return null; 6308 }, 6309 6310 _getTextPos : function(r, sp, ep) { 6311 var w = document.createTreeWalker(r, NodeFilter.SHOW_TEXT, null, false), n, p = 0, d = {}; 6312 6313 while ((n = w.nextNode()) != null) { 6314 p += n.nodeValue ? n.nodeValue.length : 0; 6315 6316 if (p >= sp && !d.startNode) { 6317 d.startNode = n; 6318 d.startOffset = sp - (p - n.nodeValue.length); 6319 } 6320 6321 if (p >= ep) { 6322 d.endNode = n; 6323 d.endOffset = ep - (p - n.nodeValue.length); 6324 6325 return d; 6326 } 6327 } 6328 6329 return null; 5833 6330 }, 5834 6331 … … 5848 6345 to_start = true; 5849 6346 5850 if (tinyMCE.isMSIE) { 5851 rng = inst.getBody().createTextRange(); 6347 if (inst.settings.auto_resize) 6348 inst.resizeToContent(); 6349 6350 if (tinyMCE.isRealIE) { 6351 rng = inst.getDoc().body.createTextRange(); 5852 6352 5853 6353 try { … … 5916 6416 5917 6417 scrollToNode : function(node) { 5918 var inst = this.instance; 5919 var pos, doc, scrollX, scrollY, height; 5920 5921 // Scroll to node position 5922 pos = tinyMCE.getAbsPosition(node); 5923 doc = inst.getDoc(); 5924 scrollX = doc.body.scrollLeft + doc.documentElement.scrollLeft; 5925 scrollY = doc.body.scrollTop + doc.documentElement.scrollTop; 5926 height = tinyMCE.isMSIE ? document.getElementById(inst.editorId).style.pixelHeight : inst.targetElement.clientHeight; 6418 var inst = this.instance, w = inst.getWin(), vp = inst.getViewPort(), pos = tinyMCE.getAbsPosition(node), cvp, p, cwin; 5927 6419 5928 6420 // Only scroll if out of visible area 5929 if (!tinyMCE.settings['auto_resize'] && !(pos.absTop > scrollY && pos.absTop < (scrollY - 25 + height))) 5930 inst.contentWindow.scrollTo(pos.absLeft, pos.absTop - height + 25); 6421 if (pos.absLeft < vp.left || pos.absLeft > vp.left + vp.width || pos.absTop < vp.top || pos.absTop > vp.top + (vp.height-25)) 6422 w.scrollTo(pos.absLeft, pos.absTop - vp.height + 25); 6423 6424 // Scroll container window 6425 if (inst.settings.auto_resize) { 6426 cwin = inst.getContainerWin(); 6427 cvp = tinyMCE.getViewPort(cwin); 6428 p = this.getAbsPosition(node); 6429 6430 if (p.absLeft < cvp.left || p.absLeft > cvp.left + cvp.width || p.absTop < cvp.top || p.absTop > cvp.top + cvp.height) 6431 cwin.scrollTo(p.absLeft, p.absTop - cvp.height + 25); 6432 } 6433 }, 6434 6435 getAbsPosition : function(n) { 6436 var pos = tinyMCE.getAbsPosition(n), ipos = tinyMCE.getAbsPosition(this.instance.iframeElement); 6437 6438 return { 6439 absLeft : ipos.absLeft + pos.absLeft, 6440 absTop : ipos.absTop + pos.absTop 6441 }; 5931 6442 }, 5932 6443 … … 5934 6445 var inst = this.instance; 5935 6446 5936 if (tinyMCE.is MSIE && !tinyMCE.isOpera)6447 if (tinyMCE.isRealIE) 5937 6448 return inst.getDoc().selection; 5938 6449 … … 5941 6452 5942 6453 getRng : function() { 5943 var inst = this.instance; 5944 var sel = this.getSel(); 5945 5946 if (sel == null) 6454 var s = this.getSel(); 6455 6456 if (s == null) 5947 6457 return null; 5948 6458 5949 if (tinyMCE.is MSIE && !tinyMCE.isOpera)5950 return s el.createRange();5951 5952 if (tinyMCE.isSafari && !s el.getRangeAt)6459 if (tinyMCE.isRealIE) 6460 return s.createRange(); 6461 6462 if (tinyMCE.isSafari && !s.getRangeAt) 5953 6463 return '' + window.getSelection(); 5954 6464 5955 return s el.getRangeAt(0);6465 return s.getRangeAt(0); 5956 6466 }, 5957 6467 5958 6468 getFocusElement : function() { 5959 var inst = this.instance ;5960 5961 if (tinyMCE.is MSIE && !tinyMCE.isOpera) {5962 vardoc = inst.getDoc();5963 varrng = doc.selection.createRange();6469 var inst = this.instance, doc, rng, sel, elm; 6470 6471 if (tinyMCE.isRealIE) { 6472 doc = inst.getDoc(); 6473 rng = doc.selection.createRange(); 5964 6474 5965 6475 // if (rng.collapse) 5966 6476 // rng.collapse(true); 5967 6477 5968 varelm = rng.item ? rng.item(0) : rng.parentElement();6478 elm = rng.item ? rng.item(0) : rng.parentElement(); 5969 6479 } else { 5970 if ( inst.isHidden())6480 if (!tinyMCE.isSafari && inst.isHidden()) 5971 6481 return inst.getBody(); 5972 6482 5973 varsel = this.getSel();5974 varrng = this.getRng();6483 sel = this.getSel(); 6484 rng = this.getRng(); 5975 6485 5976 6486 if (!sel || !rng) 5977 6487 return null; 5978 6488 5979 varelm = rng.commonAncestorContainer;5980 // varelm = (sel && sel.anchorNode) ? sel.anchorNode : null;6489 elm = rng.commonAncestorContainer; 6490 //elm = (sel && sel.anchorNode) ? sel.anchorNode : null; 5981 6491 5982 6492 // Handle selection a image or other control like element such as anchors … … 6000 6510 return elm; 6001 6511 } 6002 }; 6512 6513 }; 6003 6514 6004 6515 /* file:jscripts/tiny_mce/classes/TinyMCE_UndoRedo.class.js */ … … 6014 6525 TinyMCE_UndoRedo.prototype = { 6015 6526 add : function(l) { 6016 var b ;6527 var b, customUndoLevels, newHTML, inst = this.instance, i, ul, ur; 6017 6528 6018 6529 if (l) { … … 6021 6532 } 6022 6533 6023 var inst = this.instance;6024 6025 6534 if (this.typingUndoIndex != -1) { 6026 6535 this.undoIndex = this.typingUndoIndex; 6027 // tinyMCE.debug("Override: " + this.undoIndex); 6028 } 6029 6030 var newHTML = tinyMCE.trim(inst.getBody().innerHTML); 6536 6537 if (tinyMCE.typingUndoIndex != -1) 6538 tinyMCE.undoIndex = tinyMCE.typingUndoIndex; 6539 } 6540 6541 newHTML = tinyMCE.trim(inst.getBody().innerHTML); 6031 6542 if (this.undoLevels[this.undoIndex] && newHTML != this.undoLevels[this.undoIndex].content) { 6032 //tinyMCE.debug(newHTML, this.undoLevels[this.undoIndex] );6543 //tinyMCE.debug(newHTML, this.undoLevels[this.undoIndex].content); 6033 6544 6034 6545 tinyMCE.dispatchCallback(inst, 'onchange_callback', 'onChange', inst); 6035 6546 6036 6547 // Time to compress 6037 varcustomUndoLevels = tinyMCE.settings['custom_undo_redo_levels'];6548 customUndoLevels = tinyMCE.settings['custom_undo_redo_levels']; 6038 6549 if (customUndoLevels != -1 && this.undoLevels.length > customUndoLevels) { 6039 for (var i=0; i<this.undoLevels.length-1; i++) { 6040 //tinyMCE.debug(this.undoLevels[i] + "=" + this.undoLevels[i+1]); 6550 for (i=0; i<this.undoLevels.length-1; i++) 6041 6551 this.undoLevels[i] = this.undoLevels[i+1]; 6042 }6043 6552 6044 6553 this.undoLevels.length--; 6045 6554 this.undoIndex--; 6555 6556 // Todo: Implement global undo/redo logic here 6046 6557 } 6047 6558 6048 6559 b = inst.undoBookmark; 6560 6049 6561 if (!b) 6050 6562 b = inst.selection.getBookmark(); … … 6056 6568 }; 6057 6569 6570 // Remove all above from global undo/redo 6571 ul = tinyMCE.undoLevels; 6572 for (i=tinyMCE.undoIndex + 1; i<ul.length; i++) { 6573 ur = ul[i].undoRedo; 6574 6575 if (ur.undoIndex == ur.undoLevels.length -1) 6576 ur.undoIndex--; 6577 6578 ur.undoLevels.length--; 6579 } 6580 6581 // Add global undo level 6582 tinyMCE.undoLevels[tinyMCE.undoIndex++] = inst; 6583 tinyMCE.undoLevels.length = tinyMCE.undoIndex; 6584 6058 6585 this.undoLevels.length = this.undoIndex + 1; 6059 6586 6060 //tinyMCE.debug("level added" + this.undoIndex);6061 6587 return true; 6062 6063 // tinyMCE.debug(this.undoIndex + "," + (this.undoLevels.length-1));6064 6588 } 6065 6589 … … 6073 6597 if (this.undoIndex > 0) { 6074 6598 this.undoIndex--; 6599 6075 6600 tinyMCE.setInnerHTML(inst.getBody(), this.undoLevels[this.undoIndex].content); 6076 6601 inst.repaint(); 6602 6077 6603 if (inst.settings.custom_undo_redo_restore_selection) 6078 6604 inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark); 6079 6605 } 6080 6081 // tinyMCE.debug("Undo - undo levels:" + this.undoLevels.length + ", undo index: " + this.undoIndex);6082 6606 }, 6083 6607 … … 6089 6613 if (this.undoIndex < (this.undoLevels.length-1)) { 6090 6614 this.undoIndex++; 6615 6091 6616 tinyMCE.setInnerHTML(inst.getBody(), this.undoLevels[this.undoIndex].content); 6092 6617 inst.repaint(); 6093 // if (this.undoIndex > 0) 6094 // inst.selection.moveToBookmark(this.undoLevels[this.undoIndex-1].bookmark); 6618 6095 6619 if (inst.settings.custom_undo_redo_restore_selection) 6096 6620 inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark); 6097 // tinyMCE.debug("Redo - undo levels:" + this.undoLevels.length + ", undo index: " + this.undoIndex);6098 6621 } 6099 6622 6100 6623 tinyMCE.triggerNodeChange(); 6101 6624 } 6102 }; 6625 6626 }; 6103 6627 6104 6628 /* file:jscripts/tiny_mce/classes/TinyMCE_ForceParagraphs.class.js */ … … 6106 6630 var TinyMCE_ForceParagraphs = { 6107 6631 _insertPara : function(inst, e) { 6632 var doc = inst.getDoc(), sel = inst.getSel(), body = inst.getBody(), win = inst.contentWindow, rng = sel.getRangeAt(0); 6633 var rootElm = doc.documentElement, blockName = "P", startNode, endNode, startBlock, endBlock; 6634 var rngBefore, rngAfter, direct, startNode, startOffset, endNode, endOffset, b = tinyMCE.isOpera ? inst.selection.getBookmark() : null; 6635 var paraBefore, paraAfter, startChop, endChop, contents; 6636 6108 6637 function isEmpty(para) { 6109 6638 function isEmptyHTML(html) { … … 6134 6663 } 6135 6664 6136 var doc = inst.getDoc();6137 var sel = inst.getSel();6138 var win = inst.contentWindow;6139 var rng = sel.getRangeAt(0);6140 var body = doc.body;6141 var rootElm = doc.documentElement;6142 var blockName = "P";6143 6144 6665 // tinyMCE.debug(body.innerHTML); 6145 6666 … … 6147 6668 6148 6669 // Setup before range 6149 varrngBefore = doc.createRange();6670 rngBefore = doc.createRange(); 6150 6671 rngBefore.setStart(sel.anchorNode, sel.anchorOffset); 6151 6672 rngBefore.collapse(true); 6152 6673 6153 6674 // Setup after range 6154 varrngAfter = doc.createRange();6675 rngAfter = doc.createRange(); 6155 6676 rngAfter.setStart(sel.focusNode, sel.focusOffset); 6156 6677 rngAfter.collapse(true); 6157 6678 6158 6679 // Setup start/end points 6159 vardirect = rngBefore.compareBoundaryPoints(rngBefore.START_TO_END, rngAfter) < 0;6160 varstartNode = direct ? sel.anchorNode : sel.focusNode;6161 varstartOffset = direct ? sel.anchorOffset : sel.focusOffset;6162 varendNode = direct ? sel.focusNode : sel.anchorNode;6163 varendOffset = direct ? sel.focusOffset : sel.anchorOffset;6680 direct = rngBefore.compareBoundaryPoints(rngBefore.START_TO_END, rngAfter) < 0; 6681 startNode = direct ? sel.anchorNode : sel.focusNode; 6682 startOffset = direct ? sel.anchorOffset : sel.focusOffset; 6683 endNode = direct ? sel.focusNode : sel.anchorNode; 6684 endOffset = direct ? sel.focusOffset : sel.anchorOffset; 6164 6685 6165 6686 startNode = startNode.nodeName == "BODY" ? startNode.firstChild : startNode; 6166 6687 endNode = endNode.nodeName == "BODY" ? endNode.firstChild : endNode; 6167 6688 6168 // tinyMCE.debug(startNode, endNode);6169 6170 6689 // Get block elements 6171 var startBlock = tinyMCE.getParentBlockElement(startNode);6172 var endBlock = tinyMCE.getParentBlockElement(endNode);6690 startBlock = inst.getParentBlockElement(startNode); 6691 endBlock = inst.getParentBlockElement(endNode); 6173 6692 6174 6693 // If absolute force paragraph generation within … … 6189 6708 6190 6709 // Within a list use normal behaviour 6191 if (tinyMCE.getParentElement(startBlock, "OL,UL" ) != null)6710 if (tinyMCE.getParentElement(startBlock, "OL,UL", null, body) != null) 6192 6711 return false; 6193 6712 … … 6197 6716 6198 6717 // Setup new paragraphs 6199 varparaBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName);6200 varparaAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName);6718 paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName); 6719 paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName); 6201 6720 6202 6721 // Is header, then force paragraph under … … 6205 6724 6206 6725 // Setup chop nodes 6207 varstartChop = startNode;6208 varendChop = endNode;6726 startChop = startNode; 6727 endChop = endNode; 6209 6728 6210 6729 // Get startChop node … … 6237 6756 // Delete selection 6238 6757 rng.deleteContents(); 6239 sel.removeAllRanges(); 6758 6759 if (!tinyMCE.isSafari) 6760 sel.removeAllRanges(); 6240 6761 6241 6762 if (startChop != rootElm && endChop != rootElm) { … … 6261 6782 rngBefore.setEndAfter(endChop); 6262 6783 6263 varcontents = rng.cloneContents();6784 contents = rng.cloneContents(); 6264 6785 if (contents.firstChild && (contents.firstChild.nodeName == blockName || contents.firstChild.nodeName == "BODY")) 6265 6786 paraAfter.innerHTML = contents.firstChild.innerHTML; … … 6281 6802 6282 6803 // Insert new paragraphs 6283 paraAfter.normalize(); 6284 rngBefore.insertNode(paraAfter); 6285 paraBefore.normalize(); 6286 rngBefore.insertNode(paraBefore); 6287 6288 // tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML); 6804 if (tinyMCE.isOpera) { 6805 paraBefore.normalize(); 6806 rngBefore.insertNode(paraBefore); 6807 paraAfter.normalize(); 6808 rngBefore.insertNode(paraAfter); 6809 } else { 6810 paraAfter.normalize(); 6811 rngBefore.insertNode(paraAfter); 6812 paraBefore.normalize(); 6813 rngBefore.insertNode(paraBefore); 6814 } 6815 6816 //tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML); 6289 6817 } else { 6290 6818 body.innerHTML = "<" + blockName + "> </" + blockName + "><" + blockName + "> </" + blockName + ">"; … … 6292 6820 } 6293 6821 6822 inst.selection.moveToBookmark(b); 6294 6823 inst.selection.selectNode(paraAfter, true, true); 6295 6824 … … 6309 6838 rngAfter.setEndAfter(endChop); 6310 6839 rngAfter.setStart(endNode, endOffset); 6311 varcontents = rngAfter.cloneContents();6840 contents = rngAfter.cloneContents(); 6312 6841 6313 6842 if (contents.firstChild && contents.firstChild.nodeName == blockName) { … … 6332 6861 6333 6862 // Create a range around everything 6334 varrng = doc.createRange();6863 rng = doc.createRange(); 6335 6864 6336 6865 if (!startChop.previousSibling && startChop.parentNode.nodeName.toUpperCase() == blockName) { … … 6350 6879 // Delete all contents and insert new paragraphs 6351 6880 rng.deleteContents(); 6352 rng.insertNode(paraAfter); 6353 rng.insertNode(paraBefore); 6881 6882 if (tinyMCE.isOpera) { 6883 rng.insertNode(paraBefore); 6884 rng.insertNode(paraAfter); 6885 } else { 6886 rng.insertNode(paraAfter); 6887 rng.insertNode(paraBefore); 6888 } 6889 6354 6890 //tinyMCE.debug("2", paraBefore.innerHTML, paraAfter.innerHTML); 6355 6891 … … 6358 6894 paraBefore.normalize(); 6359 6895 6896 inst.selection.moveToBookmark(b); 6360 6897 inst.selection.selectNode(paraAfter, true, true); 6361 6898 … … 6366 6903 var r = inst.getRng(), sn = r.startContainer, nv, s = false; 6367 6904 6368 if (sn && sn.nextSibling && sn.nextSibling.nodeName == "BR") { 6905 // Added body check for bug #1527787 6906 if (sn && sn.nextSibling && sn.nextSibling.nodeName == "BR" && sn.parentNode.nodeName != "BODY") { 6369 6907 nv = sn.nodeValue; 6370 6908 6371 // Handle if a backspace is pressed after a space character #bug 1466054 6372 if (nv != null && nv.length >= r.startOffset && nv.charAt(r.startOffset - 1) == ' ')6373 s = true; 6909 // Handle if a backspace is pressed after a space character #bug 1466054 removed since fix for #1527787 6910 /*if (nv != null && nv.length >= r.startOffset && nv.charAt(r.startOffset - 1) == ' ') 6911 s = true;*/ 6374 6912 6375 6913 // Only remove BRs if we are at the end of line #bug 1464152 … … 6378 6916 } 6379 6917 6918 if (inst.settings.auto_resize) 6919 inst.resizeToContent(); 6920 6380 6921 return s; 6381 6922 } 6382 }; 6923 6924 }; 6383 6925 6384 6926 /* file:jscripts/tiny_mce/classes/TinyMCE_Layer.class.js */ … … 6516 7058 if (!this.blockerElement && this.blockMode) { 6517 7059 d = this.doc; 6518 b = d.createElement("iframe"); 6519 6520 b.style.cssText = 'display: none; position: absolute; left: 0; top: 0'; 6521 b.src = 'javascript:false;'; 6522 b.frameBorder = '0'; 6523 b.scrolling = 'no'; 6524 6525 d.body.appendChild(b); 7060 b = d.getElementById(this.id + "_blocker"); 7061 7062 if (!b) { 7063 b = d.createElement("iframe"); 7064 7065 b.setAttribute('id', this.id + "_blocker"); 7066 b.style.cssText = 'display: none; position: absolute; left: 0; top: 0'; 7067 b.src = 'javascript:false;'; 7068 b.frameBorder = '0'; 7069 b.scrolling = 'no'; 7070 7071 d.body.appendChild(b); 7072 } 7073 6526 7074 this.blockerElement = b; 6527 7075 } … … 6542 7090 }, 6543 7091 6544 create : function(n, c, p ) {7092 create : function(n, c, p, h) { 6545 7093 var d = this.doc, e = d.createElement(n); 6546 7094 … … 6553 7101 p = d.body; 6554 7102 7103 if (h) 7104 e.innerHTML = h; 7105 6555 7106 p.appendChild(e); 6556 7107 6557 7108 return this.element = e; 7109 }, 7110 7111 exists : function() { 7112 return this.doc.getElementById(this.id) != null; 6558 7113 }, 6559 7114 … … 6564 7119 return parseInt(s); 6565 7120 } 6566 }; 7121 7122 }; 6567 7123 6568 7124 /* file:jscripts/tiny_mce/classes/TinyMCE_Menu.class.js */ … … 6583 7139 }; 6584 7140 6585 // Extends the TinyMCE_Layer class6586 7141 TinyMCE_Menu.prototype = tinyMCE.extend(TinyMCE_Layer.prototype, { 6587 7142 init : function(s) { … … 6654 7209 6655 7210 default: 6656 h += '<tr><td><a href=" javascript:void(0);" onmousedown="' + tinyMCE.xmlEncode(m[i].js) + ';return false;"><span' + c +'>' + t + '</span></a>';7211 h += '<tr><td><a href="#" onclick="return tinyMCE.cancelEvent(event);" onmousedown="return tinyMCE.cancelEvent(event);" onmouseup="' + tinyMCE.xmlEncode(m[i].js) + ';return tinyMCE.cancelEvent(event);"><span' + c +'>' + t + '</span></a>'; 6657 7212 } 6658 7213 … … 6691 7246 tinyMCE.lastMenu = this; 6692 7247 } 6693 }); 7248 7249 }); 7250 7251 /* file:jscripts/tiny_mce/classes/TinyMCE_Compatibility.class.js */ 7252 7253 if (!Function.prototype.call) { 7254 Function.prototype.call = function() { 7255 var a = arguments, s = a[0], i, as = '', r, o; 7256 7257 for (i=1; i<a.length; i++) 7258 as += (i > 1 ? ',' : '') + 'a[' + i + ']'; 7259 7260 o = s._fu; 7261 s._fu = this; 7262 r = eval('s._fu(' + as + ')'); 7263 s._fu = o; 7264 7265 return r; 7266 }; 7267 }; 6694 7268 6695 7269 /* file:jscripts/tiny_mce/classes/TinyMCE_Debug.class.js */ 6696 7270 6697 7271 TinyMCE_Engine.prototype.debug = function() { 6698 var m = "", e, a, i; 6699 6700 e = document.getElementById("tinymce_debug"); 6701 if (!e) { 6702 var d = document.createElement("div"); 6703 d.setAttribute("className", "debugger"); 6704 d.className = "debugger"; 6705 d.innerHTML = 'Debug output:<textarea id="tinymce_debug" style="width: 100%; height: 300px" wrap="nowrap" mce_editable="false"></textarea>'; 6706 6707 document.body.appendChild(d); 6708 e = document.getElementById("tinymce_debug"); 6709 } 6710 6711 a = this.debug.arguments; 6712 for (i=0; i<a.length; i++) { 7272 var m = "", a, i, l = tinyMCE.log.length; 7273 7274 for (i=0, a = this.debug.arguments; i<a.length; i++) { 6713 7275 m += a[i]; 7276 6714 7277 if (i<a.length-1) 6715 7278 m += ', '; 6716 7279 } 6717 7280 6718 e.value += m + "\n"; 7281 if (l < 1000) 7282 tinyMCE.log[l] = "[debug] " + m; 6719 7283 }; 7284 -
trunk/wp-includes/js/tinymce/tiny_mce_popup.js
r4080 r4506 1 2 3 1 // Some global instances, this will be filled later 4 2 var tinyMCE = null, tinyMCELang = null; 5 3 6 7 4 function TinyMCE_Popup() { 8 5 }; 9 6 10 11 TinyMCE_Popup.prototype.init = function() { 12 var win = window.opener ? window.opener : window.dialogArguments; 13 var inst; 14 15 if (!win) { 16 // Try parent 17 win = parent.parent; 7 TinyMCE_Popup.prototype = { 8 findWin : function(w) { 9 var c; 10 11 // Check parents 12 c = w; 13 while (c && (c = c.parent) != null) { 14 if (typeof(c.tinyMCE) != "undefined") 15 return c; 16 } 17 18 // Check openers 19 c = w; 20 while (c && (c = c.opener) != null) { 21 if (typeof(c.tinyMCE) != "undefined") 22 return c; 23 } 18 24 19 25 // Try top 20 if (typeof(win.tinyMCE) == "undefined") 21 win = top; 22 } 23 24 window.opener = win; 25 this.windowOpener = win; 26 this.onLoadEval = ""; 27 28 // Setup parent references 29 tinyMCE = win.tinyMCE; 30 tinyMCELang = win.tinyMCELang; 31 32 if (!tinyMCE) { 33 alert("tinyMCE object reference not found from popup."); 34 return; 35 } 36 37 inst = tinyMCE.selectedInstance; 38 this.isWindow = tinyMCE.getWindowArg('mce_inside_iframe', false) == false; 39 this.storeSelection = (tinyMCE.isMSIE && !tinyMCE.isOpera) && !this.isWindow && tinyMCE.getWindowArg('mce_store_selection', true); 40 41 if (this.isWindow) 42 window.focus(); 43 44 // Store selection 45 if (this.storeSelection) 46 inst.selectionBookmark = inst.selection.getBookmark(true); 47 48 // Setup dir 49 if (tinyMCELang['lang_dir']) 50 document.dir = tinyMCELang['lang_dir']; 51 52 // Setup title 53 var re = new RegExp('{|\\\$|}', 'g'); 54 var title = document.title.replace(re, ""); 55 if (typeof tinyMCELang[title] != "undefined") { 56 var divElm = document.createElement("div"); 57 divElm.innerHTML = tinyMCELang[title]; 58 document.title = divElm.innerHTML; 59 60 if (tinyMCE.setWindowTitle != null) 61 tinyMCE.setWindowTitle(window, divElm.innerHTML); 62 } 63 64 // Output Popup CSS class 65 document.write('<link href="' + tinyMCE.getParam("popups_css") + '" rel="stylesheet" type="text/css">'); 66 67 tinyMCE.addEvent(window, "load", this.onLoad); 68 }; 69 70 71 TinyMCE_Popup.prototype.onLoad = function() { 72 var dir, i, elms, body = document.body; 73 74 body.onkeydown = function (e) { 75 e = e ? e : window.event; 76 if ( e.keyCode == 27 && !e.shiftKey && !e.controlKey && !e.altKey ) { 77 tinyMCE.closeWindow(window); 78 } 79 } 80 81 if (tinyMCE.getWindowArg('mce_replacevariables', true)) 82 body.innerHTML = tinyMCE.applyTemplate(body.innerHTML, tinyMCE.windowArgs); 83 84 dir = tinyMCE.selectedInstance.settings['directionality']; 85 if (dir == "rtl" && document.forms && document.forms.length > 0) { 86 elms = document.forms[0].elements; 87 for (i=0; i<elms.length; i++) { 88 if ((elms[i].type == "text" || elms[i].type == "textarea") && elms[i].getAttribute("dir") != "ltr") 89 elms[i].dir = dir; 90 } 91 } 92 93 if (body.style.display == 'none') 94 body.style.display = 'block'; 95 96 // Execute real onload (Opera fix) 97 if (tinyMCEPopup.onLoadEval != "") 98 eval(tinyMCEPopup.onLoadEval); 99 }; 100 101 102 TinyMCE_Popup.prototype.executeOnLoad = function(str) { 103 if (tinyMCE.isOpera) 104 this.onLoadEval = str; 105 else 106 eval(str); 107 }; 108 109 110 TinyMCE_Popup.prototype.resizeToInnerSize = function() { 111 // Netscape 7.1 workaround 112 if (this.isWindow && tinyMCE.isNS71) { 113 window.resizeBy(0, 10); 114 return; 115 } 116 117 if (this.isWindow) { 118 var doc = document; 119 var body = doc.body; 120 var oldMargin, wrapper, iframe, nodes, dx, dy; 26 if (typeof(top.tinyMCE) != "undefined") 27 return top; 28 29 return null; 30 }, 31 32 init : function() { 33 var win = window.opener ? window.opener : window.dialogArguments, c; 34 var inst; 35 36 if (!win) 37 win = this.findWin(window); 38 39 if (!win) { 40 alert("tinyMCE object reference not found from popup."); 41 return; 42 } 43 44 window.opener = win; 45 this.windowOpener = win; 46 this.onLoadEval = ""; 47 48 // Setup parent references 49 tinyMCE = win.tinyMCE; 50 tinyMCELang = win.tinyMCELang; 51 52 inst = tinyMCE.selectedInstance; 53 this.isWindow = tinyMCE.getWindowArg('mce_inside_iframe', false) == false; 54 this.storeSelection = (tinyMCE.isRealIE) && !this.isWindow && tinyMCE.getWindowArg('mce_store_selection', true); 55 56 if (this.isWindow) 57 window.focus(); 58 59 // Store selection 60 if (this.storeSelection) 61 inst.selectionBookmark = inst.selection.getBookmark(true); 62 63 // Setup dir 64 if (tinyMCELang['lang_dir']) 65 document.dir = tinyMCELang['lang_dir']; 66 67 // Setup title 68 var re = new RegExp('{|\\\$|}', 'g'); 69 var title = document.title.replace(re, ""); 70 if (typeof tinyMCELang[title] != "undefined") { 71 var divElm = document.createElement("div"); 72 divElm.innerHTML = tinyMCELang[title]; 73 document.title = divElm.innerHTML; 74 75 if (tinyMCE.setWindowTitle != null) 76 tinyMCE.setWindowTitle(window, divElm.innerHTML); 77 } 78 79 // Output Popup CSS class 80 document.write('<link href="' + tinyMCE.getParam("popups_css") + '" rel="stylesheet" type="text/css">'); 81 82 if (tinyMCE.getParam("popups_css_add")) { 83 c = tinyMCE.getParam("popups_css_add"); 84 85 // Is relative 86 if (c.indexOf('://') == -1 && c.charAt(0) != '/') 87 c = tinyMCE.documentBasePath + "/" + c; 88 89 document.write('<link href="' + c + '" rel="stylesheet" type="text/css">'); 90 } 91 92 tinyMCE.addEvent(window, "load", this.onLoad); 93 }, 94 95 onLoad : function() { 96 var dir, i, elms, body = document.body; 97 98 if (tinyMCE.getWindowArg('mce_replacevariables', true)) 99 body.innerHTML = tinyMCE.applyTemplate(body.innerHTML, tinyMCE.windowArgs); 100 101 dir = tinyMCE.selectedInstance.settings['directionality']; 102 if (dir == "rtl" && document.forms && document.forms.length > 0) { 103 elms = document.forms[0].elements; 104 for (i=0; i<elms.length; i++) { 105 if ((elms[i].type == "text" || elms[i].type == "textarea") && elms[i].getAttribute("dir") != "ltr") 106 elms[i].dir = dir; 107 } 108 } 121 109 122 110 if (body.style.display == 'none') 123 111 body.style.display = 'block'; 124 112 125 // Remove margin 126 oldMargin = body.style.margin; 127 body.style.margin = '0'; 128 129 // Create wrapper 130 wrapper = doc.createElement("div"); 131 wrapper.id = 'mcBodyWrapper'; 132 wrapper.style.display = 'none'; 133 wrapper.style.margin = '0'; 134 135 // Wrap body elements 136 nodes = doc.body.childNodes; 137 for (var i=nodes.length-1; i>=0; i--) { 138 if (wrapper.hasChildNodes()) 139 wrapper.insertBefore(nodes[i].cloneNode(true), wrapper.firstChild); 140 else 141 wrapper.appendChild(nodes[i].cloneNode(true)); 142 143 nodes[i].parentNode.removeChild(nodes[i]); 144 } 145 146 // Add wrapper 147 doc.body.appendChild(wrapper); 148 149 // Create iframe 150 iframe = document.createElement("iframe"); 151 iframe.id = "mcWinIframe"; 152 iframe.src = document.location.href.toLowerCase().indexOf('https') == -1 ? "about:blank" : tinyMCE.settings['default_document']; 153 iframe.width = "100%"; 154 iframe.height = "100%"; 155 iframe.style.margin = '0'; 156 157 // Add iframe 158 doc.body.appendChild(iframe); 159 160 // Measure iframe 161 iframe = document.getElementById('mcWinIframe'); 162 dx = tinyMCE.getWindowArg('mce_width') - iframe.clientWidth; 163 dy = tinyMCE.getWindowArg('mce_height') - iframe.clientHeight; 164 165 // Resize window 166 // tinyMCE.debug(tinyMCE.getWindowArg('mce_width') + "," + tinyMCE.getWindowArg('mce_height') + " - " + dx + "," + dy); 167 window.resizeBy(dx, dy); 168 169 // Hide iframe and show wrapper 170 body.style.margin = oldMargin; 171 iframe.style.display = 'none'; 172 wrapper.style.display = 'block'; 113 // Execute real onload (Opera fix) 114 if (tinyMCEPopup.onLoadEval != "") 115 eval(tinyMCEPopup.onLoadEval); 116 }, 117 118 executeOnLoad : function(str) { 119 if (tinyMCE.isOpera) 120 this.onLoadEval = str; 121 else 122 eval(str); 123 }, 124 125 resizeToInnerSize : function() { 126 // Netscape 7.1 workaround 127 if (this.isWindow && tinyMCE.isNS71) { 128 window.resizeBy(0, 10); 129 return; 130 } 131 132 if (this.isWindow) { 133 var doc = document; 134 var body = doc.body; 135 var oldMargin, wrapper, iframe, nodes, dx, dy; 136 137 if (body.style.display == 'none') 138 body.style.display = 'block'; 139 140 // Remove margin 141 oldMargin = body.style.margin; 142 body.style.margin = '0'; 143 144 // Create wrapper 145 wrapper = doc.createElement("div"); 146 wrapper.id = 'mcBodyWrapper'; 147 wrapper.style.display = 'none'; 148 wrapper.style.margin = '0'; 149 150 // Wrap body elements 151 nodes = doc.body.childNodes; 152 for (var i=nodes.length-1; i>=0; i--) { 153 if (wrapper.hasChildNodes()) 154 wrapper.insertBefore(nodes[i].cloneNode(true), wrapper.firstChild); 155 else 156 wrapper.appendChild(nodes[i].cloneNode(true)); 157 158 nodes[i].parentNode.removeChild(nodes[i]); 159 } 160 161 // Add wrapper 162 doc.body.appendChild(wrapper); 163 164 // Create iframe 165 iframe = document.createElement("iframe"); 166 iframe.id = "mcWinIframe"; 167 iframe.src = document.location.href.toLowerCase().indexOf('https') == -1 ? "about:blank" : tinyMCE.settings['default_document']; 168 iframe.width = "100%"; 169 iframe.height = "100%"; 170 iframe.style.margin = '0'; 171 172 // Add iframe 173 doc.body.appendChild(iframe); 174 175 // Measure iframe 176 iframe = document.getElementById('mcWinIframe'); 177 dx = tinyMCE.getWindowArg('mce_width') - iframe.clientWidth; 178 dy = tinyMCE.getWindowArg('mce_height') - iframe.clientHeight; 179 180 // Resize window 181 // tinyMCE.debug(tinyMCE.getWindowArg('mce_width') + "," + tinyMCE.getWindowArg('mce_height') + " - " + dx + "," + dy); 182 window.resizeBy(dx, dy); 183 184 // Hide iframe and show wrapper 185 body.style.margin = oldMargin; 186 iframe.style.display = 'none'; 187 wrapper.style.display = 'block'; 188 } 189 }, 190 191 resizeToContent : function() { 192 var isMSIE = (navigator.appName == "Microsoft Internet Explorer"); 193 var isOpera = (navigator.userAgent.indexOf("Opera") != -1); 194 195 if (isOpera) 196 return; 197 198 if (isMSIE) { 199 try { window.resizeTo(10, 10); } catch (e) {} 200 201 var elm = document.body; 202 var width = elm.offsetWidth; 203 var height = elm.offsetHeight; 204 var dx = (elm.scrollWidth - width) + 4; 205 var dy = elm.scrollHeight - height; 206 207 try { window.resizeBy(dx, dy); } catch (e) {} 208 } else { 209 window.scrollBy(1000, 1000); 210 if (window.scrollX > 0 || window.scrollY > 0) { 211 window.resizeBy(window.innerWidth * 2, window.innerHeight * 2); 212 window.sizeToContent(); 213 window.scrollTo(0, 0); 214 var x = parseInt(screen.width / 2.0) - (window.outerWidth / 2.0); 215 var y = parseInt(screen.height / 2.0) - (window.outerHeight / 2.0); 216 window.moveTo(x, y); 217 } 218 } 219 }, 220 221 getWindowArg : function(name, default_value) { 222 return tinyMCE.getWindowArg(name, default_value); 223 }, 224 225 restoreSelection : function() { 226 if (this.storeSelection) { 227 var inst = tinyMCE.selectedInstance; 228 229 inst.getWin().focus(); 230 231 if (inst.selectionBookmark) 232 inst.selection.moveToBookmark(inst.selectionBookmark); 233 } 234 }, 235 236 execCommand : function(command, user_interface, value) { 237 var inst = tinyMCE.selectedInstance; 238 239 this.restoreSelection(); 240 inst.execCommand(command, user_interface, value); 241 242 // Store selection 243 if (this.storeSelection) 244 inst.selectionBookmark = inst.selection.getBookmark(true); 245 }, 246 247 close : function() { 248 tinyMCE.closeWindow(window); 249 }, 250 251 pickColor : function(e, element_id) { 252 tinyMCE.selectedInstance.execCommand('mceColorPicker', true, { 253 element_id : element_id, 254 document : document, 255 window : window, 256 store_selection : false 257 }); 258 }, 259 260 openBrowser : function(element_id, type, option) { 261 var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback")); 262 var url = document.getElementById(element_id).value; 263 264 tinyMCE.setWindowArg("window", window); 265 tinyMCE.setWindowArg("document", document); 266 267 // Call to external callback 268 if (eval('typeof(tinyMCEPopup.windowOpener.' + cb + ')') == "undefined") 269 alert("Callback function: " + cb + " could not be found."); 270 else 271 eval("tinyMCEPopup.windowOpener." + cb + "(element_id, url, type, window);"); 272 }, 273 274 importClass : function(c) { 275 window[c] = function() {}; 276 277 for (var n in window.opener[c].prototype) 278 window[c].prototype[n] = window.opener[c].prototype[n]; 279 280 window[c].constructor = window.opener[c].constructor; 173 281 } 174 }; 175 176 177 TinyMCE_Popup.prototype.resizeToContent = function() { 178 var isMSIE = (navigator.appName == "Microsoft Internet Explorer"); 179 var isOpera = (navigator.userAgent.indexOf("Opera") != -1); 180 181 if (isOpera) 182 return; 183 184 if (isMSIE) { 185 try { window.resizeTo(10, 10); } catch (e) {} 186 187 var elm = document.body; 188 var width = elm.offsetWidth; 189 var height = elm.offsetHeight; 190 var dx = (elm.scrollWidth - width) + 4; 191 var dy = elm.scrollHeight - height; 192 193 try { window.resizeBy(dx, dy); } catch (e) {} 194 } else { 195 window.scrollBy(1000, 1000); 196 if (window.scrollX > 0 || window.scrollY > 0) { 197 window.resizeBy(window.innerWidth * 2, window.innerHeight * 2); 198 window.sizeToContent(); 199 window.scrollTo(0, 0); 200 var x = parseInt(screen.width / 2.0) - (window.outerWidth / 2.0); 201 var y = parseInt(screen.height / 2.0) - (window.outerHeight / 2.0); 202 window.moveTo(x, y); 203 } 204 } 205 }; 206 207 208 TinyMCE_Popup.prototype.getWindowArg = function(name, default_value) { 209 return tinyMCE.getWindowArg(name, default_value); 210 }; 211 212 213 TinyMCE_Popup.prototype.restoreSelection = function() { 214 if (this.storeSelection) { 215 var inst = tinyMCE.selectedInstance; 216 217 inst.getWin().focus(); 218 219 if (inst.selectionBookmark) 220 inst.selection.moveToBookmark(inst.selectionBookmark); 221 } 222 }; 223 224 225 TinyMCE_Popup.prototype.execCommand = function(command, user_interface, value) { 226 var inst = tinyMCE.selectedInstance; 227 228 this.restoreSelection(); 229 inst.execCommand(command, user_interface, value); 230 231 // Store selection 232 if (this.storeSelection) 233 inst.selectionBookmark = inst.selection.getBookmark(true); 234 }; 235 236 237 TinyMCE_Popup.prototype.close = function() { 238 tinyMCE.closeWindow(window); 239 }; 240 241 242 TinyMCE_Popup.prototype.pickColor = function(e, element_id) { 243 tinyMCE.selectedInstance.execCommand('mceColorPicker', true, { 244 element_id : element_id, 245 document : document, 246 window : window, 247 store_selection : false 248 }); 249 }; 250 251 252 TinyMCE_Popup.prototype.openBrowser = function(element_id, type, option) { 253 var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback")); 254 var url = document.getElementById(element_id).value; 255 256 tinyMCE.setWindowArg("window", window); 257 tinyMCE.setWindowArg("document", document); 258 259 // Call to external callback 260 if (eval('typeof(tinyMCEPopup.windowOpener.' + cb + ')') == "undefined") 261 alert("Callback function: " + cb + " could not be found."); 262 else 263 eval("tinyMCEPopup.windowOpener." + cb + "(element_id, url, type, window);"); 264 }; 265 266 TinyMCE_Popup.prototype.importClass = function(c) { 267 window[c] = function() {}; 268 269 for (var n in window.opener[c].prototype) 270 window[c].prototype[n] = window.opener[c].prototype[n]; 271 272 window[c].constructor = window.opener[c].constructor; 273 }; 282 283 }; 274 284 275 285 // Setup global instance -
trunk/wp-includes/js/tinymce/utils/form_utils.js
r3664 r4506 1 1 /** 2 * $RCSfile: form_utils.js,v $ 3 * $Revision: 1.10 $ 4 * $Date: 2006/03/22 12:21:24 $ 2 * $Id: form_utils.js 43 2006-08-08 16:10:07Z spocke $ 5 3 * 6 4 * Various form utilitiy functions. … … 10 8 */ 11 9 10 var themeBaseURL = tinyMCE.baseURL + '/themes/' + tinyMCE.getParam("theme"); 11 12 12 function getColorPickerHTML(id, target_form_element) { 13 var h tml= "";14 15 h tml+= '<a id="' + id + '_link" href="javascript:void(0);" onkeydown="pickColor(event,\'' + target_form_element +'\');" onmousedown="pickColor(event,\'' + target_form_element +'\');return false;">';16 h tml += '<img id="' + id + '" src="../../themes/' + tinyMCE.getParam("theme")+ '/images/color.gif"';17 h tml+= ' onmouseover="this.className=\'mceButtonOver\'"';18 h tml+= ' onmouseout="this.className=\'mceButtonNormal\'"';19 h tml+= ' onmousedown="this.className=\'mceButtonDown\'"';20 h tml+= ' width="20" height="16" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';21 h tml+= ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';22 23 return h tml;13 var h = ""; 14 15 h += '<a id="' + id + '_link" href="javascript:void(0);" onkeydown="pickColor(event,\'' + target_form_element +'\');" onmousedown="pickColor(event,\'' + target_form_element +'\');return false;">'; 16 h += '<img id="' + id + '" src="' + themeBaseURL + '/images/color.gif"'; 17 h += ' onmouseover="this.className=\'mceButtonOver\'"'; 18 h += ' onmouseout="this.className=\'mceButtonNormal\'"'; 19 h += ' onmousedown="this.className=\'mceButtonDown\'"'; 20 h += ' width="20" height="16" border="0" title="' + tinyMCE.getLang('lang_browse') + '"'; 21 h += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>'; 22 23 return h; 24 24 } 25 25 … … 58 58 59 59 html += '<a id="' + id + '_link" href="javascript:openBrower(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;">'; 60 html += '<img id="' + id + '" src=" ../../themes/' + tinyMCE.getParam("theme")+ '/images/browse.gif"';60 html += '<img id="' + id + '" src="' + themeBaseURL + '/images/browse.gif"'; 61 61 html += ' onmouseover="this.className=\'mceButtonOver\';"'; 62 62 html += ' onmouseout="this.className=\'mceButtonNormal\';"'; … … 93 93 94 94 if (!found && add_custom && value != '') { 95 var option = new Option( 'Value: ' +value, value);95 var option = new Option(value, value); 96 96 option.selected = true; 97 97 sel.options[sel.options.length] = option; 98 sel.selectedIndex = sel.options.length - 1; 98 99 } 99 100 -
trunk/wp-includes/js/tinymce/utils/mclayer.js
r3664 r4506 1 1 /** 2 * $RCSfile: mclayer.js,v $ 3 * $Revision: 1.2 $ 4 * $Date: 2006/02/06 20:11:09 $ 2 * $Id: mclayer.js 18 2006-06-29 14:11:23Z spocke $ 5 3 * 6 4 * Moxiecode floating layer script. -
trunk/wp-includes/js/tinymce/utils/mctabs.js
r3664 r4506 1 1 /** 2 * $RCSfile: mctabs.js,v $ 3 * $Revision: 1.2 $ 4 * $Date: 2006/02/06 20:11:09 $ 2 * $Id: mctabs.js 18 2006-06-29 14:11:23Z spocke $ 5 3 * 6 4 * Moxiecode DHTML Tabs script. -
trunk/wp-includes/js/tinymce/utils/validate.js
r3664 r4506 1 1 /** 2 * $RCSfile: validate.js,v $ 3 * $Revision: 1.3 $ 4 * $Date: 2006/02/06 20:11:09 $ 2 * $Id: validate.js 65 2006-08-24 15:54:55Z spocke $ 5 3 * 6 4 * Various form validation methods. … … 10 8 */ 11 9 12 function testRegExp(form_name, element_name, re) { 13 return new RegExp(re).test(document.forms[form_name].elements[element_name].value); 14 } 15 16 function validateString(form_name, element_name) { 17 return (document.forms[form_name].elements[element_name].value.length > 0); 18 } 19 20 function validateSelection(form_name, element_name) { 21 return (document.forms[form_name].elements[element_name].selectedIndex > 0); 22 } 23 24 function validateCheckBox(form_name, element_name) { 25 return document.forms[form_name].elements[element_name].checked; 26 } 27 28 function validateCleanString(form_name, element_name) { 29 return testRegExp(form_name, element_name, '^[A-Za-z0-9_]+$'); 30 } 31 32 function validateEmail(form_name, element_name) { 33 return testRegExp(form_name, element_name, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$'); 34 } 35 36 function validateAbsUrl(form_name, element_name) { 37 return testRegExp(form_name, element_name, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+$'); 38 } 39 40 function validateNumber(form_name, element_name, allow_blank) { 41 return (!allow_blank && value == '') ? false : testRegExp(form_name, element_name, '^-?[0-9]*\\.?[0-9]*$'); 42 } 43 44 function validateSize(form_name, element_name,) { 45 return testRegExp(form_name, element_name, '^[0-9]+(px|%)?$'); 46 } 47 48 function validateID(form_name, element_name,) { 49 return testRegExp(form_name, element_name, '^[A-Za-z_]([A-Za-z0-9_])*$'); 50 } 10 /** 11 // String validation: 12 13 if (!Validator.isEmail('myemail')) 14 alert('Invalid email.'); 15 16 // Form validation: 17 18 var f = document.forms['myform']; 19 20 if (!Validator.isEmail(f.myemail)) 21 alert('Invalid email.'); 22 */ 23 24 var Validator = { 25 isEmail : function(s) { 26 return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$'); 27 }, 28 29 isAbsUrl : function(s) { 30 return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$'); 31 }, 32 33 isSize : function(s) { 34 return this.test(s, '^[0-9]+(px|%)?$'); 35 }, 36 37 isId : function(s) { 38 return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$'); 39 }, 40 41 isEmpty : function(s) { 42 var nl, i; 43 44 if (s.nodeName == 'SELECT' && s.selectedIndex < 1) 45 return true; 46 47 if (s.type == 'checkbox' && !s.checked) 48 return true; 49 50 if (s.type == 'radio') { 51 for (i=0, nl = s.form.elements; i<nl.length; i++) { 52 if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked) 53 return false; 54 } 55 56 return true; 57 } 58 59 return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s); 60 }, 61 62 isNumber : function(s, d) { 63 return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$')); 64 }, 65 66 test : function(s, p) { 67 s = s.nodeType == 1 ? s.value : s; 68 69 return s == '' || new RegExp(p).test(s); 70 } 71 }; 72 73 var AutoValidator = { 74 settings : { 75 id_cls : 'id', 76 int_cls : 'int', 77 url_cls : 'url', 78 number_cls : 'number', 79 email_cls : 'email', 80 size_cls : 'size', 81 required_cls : 'required', 82 invalid_cls : 'invalid', 83 min_cls : 'min', 84 max_cls : 'max' 85 }, 86 87 init : function(s) { 88 var n; 89 90 for (n in s) 91 this.settings[n] = s[n]; 92 }, 93 94 validate : function(f) { 95 var i, nl, s = this.settings, c = 0; 96 97 nl = this.tags(f, 'label'); 98 for (i=0; i<nl.length; i++) 99 this.removeClass(nl[i], s.invalid_cls); 100 101 c += this.validateElms(f, 'input'); 102 c += this.validateElms(f, 'select'); 103 c += this.validateElms(f, 'textarea'); 104 105 return c == 3; 106 }, 107 108 invalidate : function(n) { 109 this.mark(n.form, n); 110 }, 111 112 reset : function(e) { 113 var t = new Array('label', 'input', 'select', 'textarea'); 114 var i, j, nl, s = this.settings; 115 116 if (e == null) 117 return; 118 119 for (i=0; i<t.length; i++) { 120 nl = this.tags(e.form ? e.form : e, t[i]); 121 for (j=0; j<nl.length; j++) 122 this.removeClass(nl[j], s.invalid_cls); 123 } 124 }, 125 126 validateElms : function(f, e) { 127 var nl, i, n, s = this.settings, st = true, va = Validator, v; 128 129 nl = this.tags(f, e); 130 for (i=0; i<nl.length; i++) { 131 n = nl[i]; 132 133 this.removeClass(n, s.invalid_cls); 134 135 if (this.hasClass(n, s.required_cls) && va.isEmpty(n)) 136 st = this.mark(f, n); 137 138 if (this.hasClass(n, s.number_cls) && !va.isNumber(n)) 139 st = this.mark(f, n); 140 141 if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true)) 142 st = this.mark(f, n); 143 144 if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n)) 145 st = this.mark(f, n); 146 147 if (this.hasClass(n, s.email_cls) && !va.isEmail(n)) 148 st = this.mark(f, n); 149 150 if (this.hasClass(n, s.size_cls) && !va.isSize(n)) 151 st = this.mark(f, n); 152 153 if (this.hasClass(n, s.id_cls) && !va.isId(n)) 154 st = this.mark(f, n); 155 156 if (this.hasClass(n, s.min_cls, true)) { 157 v = this.getNum(n, s.min_cls); 158 159 if (isNaN(v) || parseInt(n.value) < parseInt(v)) 160 st = this.mark(f, n); 161 } 162 163 if (this.hasClass(n, s.max_cls, true)) { 164 v = this.getNum(n, s.max_cls); 165 166 if (isNaN(v) || parseInt(n.value) > parseInt(v)) 167 st = this.mark(f, n); 168 } 169 } 170 171 return st; 172 }, 173 174 hasClass : function(n, c, d) { 175 return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className); 176 }, 177 178 getNum : function(n, c) { 179 c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0]; 180 c = c.replace(/[^0-9]/g, ''); 181 182 return c; 183 }, 184 185 addClass : function(n, c, b) { 186 var o = this.removeClass(n, c); 187 n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c; 188 }, 189 190 removeClass : function(n, c) { 191 c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' '); 192 return n.className = c != ' ' ? c : ''; 193 }, 194 195 tags : function(f, s) { 196 return f.getElementsByTagName(s); 197 }, 198 199 mark : function(f, n) { 200 var s = this.settings; 201 202 this.addClass(n, s.invalid_cls); 203 this.markLabels(f, n, s.invalid_cls); 204 205 return false; 206 }, 207 208 markLabels : function(f, n, ic) { 209 var nl, i; 210 211 nl = this.tags(f, "label"); 212 for (i=0; i<nl.length; i++) { 213 if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id) 214 this.addClass(nl[i], ic); 215 } 216 217 return null; 218 } 219 }; -
trunk/wp-includes/script-loader.php
r4495 r4506 16 16 $this->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '3517' ); 17 17 $this->add( 'colorpicker', '/wp-includes/js/colorpicker.js', false, '3517' ); 18 $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '09212006' ); 19 $this->add( 'wp_tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('tiny_mce'), '09212006' ); 18 $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '20061113' ); 19 $mce_config = apply_filters('tiny_mce_config_url', '/wp-includes/js/tinymce/tiny_mce_config.php'); 20 $this->add( 'wp_tiny_mce', $mce_config, array('tiny_mce'), '20061113' ); 20 21 $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.0'); 21 22 $this->add( 'autosave', '/wp-includes/js/autosave.js.php', array('prototype', 'sack'), '4206');
Note: See TracChangeset
for help on using the changeset viewer.