summaryrefslogtreecommitdiffstats
path: root/wp-includes/js/tinymce
diff options
context:
space:
mode:
Diffstat (limited to 'wp-includes/js/tinymce')
-rw-r--r--wp-includes/js/tinymce/license.txt255
-rw-r--r--wp-includes/js/tinymce/plugins/autosave/editor_plugin.js8
-rw-r--r--wp-includes/js/tinymce/plugins/directionality/editor_plugin.js8
-rw-r--r--wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js10
-rw-r--r--wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js4
-rw-r--r--wp-includes/js/tinymce/plugins/paste/editor_plugin.js387
-rw-r--r--wp-includes/js/tinymce/plugins/paste/jscripts/pastetext.js4
-rw-r--r--wp-includes/js/tinymce/plugins/paste/jscripts/pasteword.js6
-rw-r--r--wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js2
-rw-r--r--wp-includes/js/tinymce/themes/advanced/charmap.htm2
-rw-r--r--wp-includes/js/tinymce/themes/advanced/color_picker.htm2
-rw-r--r--wp-includes/js/tinymce/themes/advanced/css/editor_content.css5
-rw-r--r--wp-includes/js/tinymce/themes/advanced/css/editor_popup.css4
-rw-r--r--wp-includes/js/tinymce/themes/advanced/css/editor_ui.css423
-rw-r--r--wp-includes/js/tinymce/themes/advanced/editor_template.js211
-rw-r--r--wp-includes/js/tinymce/themes/advanced/editor_template_src.js0
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/backcolor.gifbin174 -> 359 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/buttons.gifbin8399 -> 5662 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/images/forecolor.gifbin272 -> 342 bytes
-rw-r--r--wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js30
-rw-r--r--wp-includes/js/tinymce/themes/advanced/langs/en.js8
-rw-r--r--wp-includes/js/tinymce/tiny_mce.js2093
-rw-r--r--wp-includes/js/tinymce/tiny_mce_popup.js446
-rw-r--r--wp-includes/js/tinymce/utils/form_utils.js29
-rw-r--r--wp-includes/js/tinymce/utils/mclayer.js6
-rw-r--r--wp-includes/js/tinymce/utils/mctabs.js4
-rw-r--r--wp-includes/js/tinymce/utils/validate.js235
27 files changed, 2630 insertions, 1552 deletions
diff --git a/wp-includes/js/tinymce/license.txt b/wp-includes/js/tinymce/license.txt
index 3b0396a..60d6d4c 100644
--- a/wp-includes/js/tinymce/license.txt
+++ b/wp-includes/js/tinymce/license.txt
@@ -1,13 +1,14 @@
- GNU LIBRARY GENERAL PUBLIC LICENSE
- Version 2, June 1991
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
- Copyright (C) 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
-[This is the first released version of the library GPL. It is
- numbered 2 because it goes with version 2 of the ordinary GPL.]
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
Preamble
@@ -16,97 +17,109 @@ freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
- This license, the Library General Public License, applies to some
-specially designated Free Software Foundation software, and to any
-other libraries whose authors decide to use it. You can use it for
-your libraries, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if
-you distribute copies of the library, or if you modify it.
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
-code. If you link a program with the library, you must provide
-complete object files to the recipients so that they can relink them
-with the library, after making changes to the library and recompiling
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
- Our method of protecting your rights has two steps: (1) copyright
-the library, and (2) offer you this license which gives you legal
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
- Also, for each distributor's protection, we want to make certain
-that everyone understands that there is no warranty for this free
-library. If the library is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original
-version, so that any problems introduced by others will not reflect on
-the original authors' reputations.
-.
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that companies distributing free
-software will individually obtain patent licenses, thus in effect
-transforming the program into proprietary software. To prevent this,
-we have made it clear that any patent must be licensed for everyone's
-free use or not licensed at all.
-
- Most GNU software, including some libraries, is covered by the ordinary
-GNU General Public License, which was designed for utility programs. This
-license, the GNU Library General Public License, applies to certain
-designated libraries. This license is quite different from the ordinary
-one; be sure to read it in full, and don't assume that anything in it is
-the same as in the ordinary license.
-
- The reason we have a separate public license for some libraries is that
-they blur the distinction we usually make between modifying or adding to a
-program and simply using it. Linking a program with a library, without
-changing the library, is in some sense simply using the library, and is
-analogous to running a utility program or application program. However, in
-a textual and legal sense, the linked executable is a combined work, a
-derivative of the original library, and the ordinary General Public License
-treats it as such.
-
- Because of this blurred distinction, using the ordinary General
-Public License for libraries did not effectively promote software
-sharing, because most developers did not use the libraries. We
-concluded that weaker conditions might promote sharing better.
-
- However, unrestricted linking of non-free programs would deprive the
-users of those programs of all benefit from the free status of the
-libraries themselves. This Library General Public License is intended to
-permit developers of non-free programs to use free libraries, while
-preserving your freedom as a user of such programs to change the free
-libraries that are incorporated in them. (We have not seen how to achieve
-this as regards changes in header files, but we have achieved it as regards
-changes in the actual functions of the Library.) The hope is that this
-will lead to faster development of free libraries.
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, while the latter only
-works together with the library.
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
- Note that it is possible for a library to be covered by the ordinary
-General Public License rather than by this special one.
-.
- GNU LIBRARY GENERAL PUBLIC LICENSE
+ GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
- 0. This License Agreement applies to any software library which
-contains a notice placed by the copyright holder or other authorized
-party saying it may be distributed under the terms of this Library
-General Public License (also called "this License"). Each licensee is
-addressed as "you".
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
@@ -145,7 +158,7 @@ Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
-.
+
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
@@ -203,7 +216,7 @@ instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
-.
+
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
@@ -254,8 +267,8 @@ Library will still fall under Section 6.)
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
-.
- 6. As an exception to the Sections above, you may also compile or
+
+ 6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
@@ -282,23 +295,31 @@ of these things:
Library will not necessarily be able to recompile the application
to use the modified definitions.)
- b) Accompany the work with a written offer, valid for at
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
- c) If distribution of the work is made by offering access to copy
+ d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
- d) Verify that the user has already received a copy of these
+ e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
-the source code distributed need not include anything that is normally
-distributed (in either source or binary form) with the major
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
@@ -308,7 +329,7 @@ restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
-.
+
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
@@ -347,9 +368,9 @@ Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
+You are not responsible for enforcing compliance by third parties with
this License.
-.
+
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
@@ -390,7 +411,7 @@ excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
-versions of the Library General Public License from time to time.
+versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
@@ -401,7 +422,7 @@ conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
-.
+
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
@@ -435,3 +456,49 @@ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js b/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js
index 4b88d2e..68563f9 100644
--- a/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js
+++ b/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js
@@ -1,20 +1,18 @@
/**
- * $RCSfile: editor_plugin_src.js,v $
- * $Revision: 1.11 $
- * $Date: 2006/03/22 12:21:21 $
+ * $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
/* Import plugin specific language pack */
-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');
+tinyMCE.importPluginLanguagePack('autosave');
var TinyMCE_AutoSavePlugin = {
getInfo : function() {
return {
longname : 'Auto save',
- author : 'Moxiecode Systems',
+ author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
diff --git a/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js b/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js
index ad0fa87..c8a6295 100644
--- a/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js
+++ b/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js
@@ -1,20 +1,18 @@
/**
- * $RCSfile: editor_plugin_src.js,v $
- * $Revision: 1.16 $
- * $Date: 2006/02/10 21:34:28 $
+ * $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
/* Import plugin specific language pack */
-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');
+tinyMCE.importPluginLanguagePack('directionality');
var TinyMCE_DirectionalityPlugin = {
getInfo : function() {
return {
longname : 'Directionality',
- author : 'Moxiecode Systems',
+ author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_directionality.html',
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js b/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js
index 74d1805..c005a9e 100644
--- a/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js
+++ b/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js
@@ -1,7 +1,5 @@
/**
- * $RCSfile: editor_plugin_src.js,v $
- * $Revision: 1.8 $
- * $Date: 2006/02/06 20:02:38 $
+ * $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $
*
* Moxiecode DHTML Windows script.
*
@@ -15,7 +13,7 @@ var TinyMCE_InlinePopupsPlugin = {
getInfo : function() {
return {
longname : 'Inline Popups',
- author : 'Moxiecode Systems',
+ author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_inlinepopups.html',
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
@@ -436,7 +434,7 @@ TinyMCE_Windows.prototype.onLoad = function(name) {
TinyMCE_Windows.prototype.createFloatingIFrame = function(id_prefix, left, top, width, height, html) {
var iframe = document.createElement("iframe");
- var div = document.createElement("div");
+ var div = document.createElement("div"), doc;
width = parseInt(width);
height = parseInt(height)+1;
@@ -488,7 +486,7 @@ TinyMCE_Windows.prototype.createFloatingIFrame = function(id_prefix, left, top,
if (this.isSafari) {
// Give Safari some time to setup
window.setTimeout(function() {
- doc = window.frames[id_prefix + '_iframe'].document;
+ var doc = window.frames[id_prefix + '_iframe'].document;
doc.open();
doc.write(html);
doc.close();
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js b/wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js
index a88ffd7..325d293 100644
--- a/wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js
+++ b/wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js
@@ -1,7 +1,5 @@
/**
- * $RCSfile: mcwindows.js,v $
- * $Revision: 1.2 $
- * $Date: 2005/10/18 13:59:43 $
+ * $Id: mcwindows.js 18 2006-06-29 14:11:23Z spocke $
*
* Moxiecode DHTML Windows script.
*
diff --git a/wp-includes/js/tinymce/plugins/paste/editor_plugin.js b/wp-includes/js/tinymce/plugins/paste/editor_plugin.js
index d9bd215..de5edbe 100644
--- a/wp-includes/js/tinymce/plugins/paste/editor_plugin.js
+++ b/wp-includes/js/tinymce/plugins/paste/editor_plugin.js
@@ -1 +1,386 @@
-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>&nbsp;<\/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]>&nbsp;<\/h[1-6]>/gi,'<p>&nbsp;&nbsp;</p>');content=content.replace(/<h[1-6]>/gi,'<p><b>');content=content.replace(/<\/h[1-6]>/gi,'</b></p>');content=content.replace(/<b>&nbsp;<\/b>/gi,'<b>&nbsp;&nbsp;</b>');content=content.replace(/^(&nbsp;)*/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--|&nbsp;',"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+|&nbsp;)').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--|&nbsp;',"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);
+/**
+ * $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $
+ *
+ * @author Moxiecode
+ * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
+ */
+
+/* Import plugin specific language pack */
+tinyMCE.importPluginLanguagePack('paste');
+
+var TinyMCE_PastePlugin = {
+ getInfo : function() {
+ return {
+ longname : 'Paste text/word',
+ author : 'Moxiecode Systems AB',
+ 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'; // Relative to theme
+ 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)) {
+ TinyMCE_PastePlugin._insertWordContent(TinyMCE_PastePlugin._clipboardHTML());
+ } else {
+ var template = new Array();
+ template['file'] = '../../plugins/paste/pasteword.htm'; // Relative to theme
+ 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;
+
+ }
+
+ // Pass to next handler in chain
+ return false;
+ },
+
+ // Private plugin internal methods
+
+ _handlePasteEvent : function(e) {
+ switch (e.type) {
+ case "paste":
+ var html = TinyMCE_PastePlugin._clipboardHTML();
+ var r, inst = tinyMCE.selectedInstance;
+
+ // Removes italic, strong etc, the if was needed due to bug #1437114
+ 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) {
+ // Special paragraph treatment
+ 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");
+
+ // Has paragraphs
+ if ((pos = content.indexOf('</p><p>')) != -1) {
+ tinyMCE.execCommand("Delete");
+
+ var node = tinyMCE.selectedInstance.getFocusElement();
+
+ // Get list of elements to break
+ var breakElms = new Array();
+
+ do {
+ if (node.nodeType == 1) {
+ // Don't break tables and break at body
+ 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) {
+ // Cleanup Word content
+ 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); // Covert to bull list
+ content = content.replace(/<o:p><\/o:p>/gi, "");
+ content = content.replace(new RegExp('<br style="page-break-before: always;.*>', 'gi'), '-- page break --'); // Replace pagebreaks
+ content = content.replace(new RegExp('<(!--)([^>]*)(--)>', 'g'), ""); // Word comments
+
+ 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, "");
+
+ // Strips class attributes.
+ 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>&nbsp;<\/p>/gi, ""); // Remove pagebreaks
+ content = content.replace(/-- page break --/gi, ""); // Remove pagebreaks
+
+ // content = content.replace(/\/?&nbsp;*/gi, ""); &nbsp;
+ // content = content.replace(/<p>&nbsp;<\/p>/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, "");
+
+ // Convert all middlot lists to UL lists
+ if (tinyMCE.getParam("paste_convert_middot_lists", true)) {
+ var div = document.createElement("div");
+ div.innerHTML = content;
+
+ // Convert all middot paragraphs to li elements
+ var className = tinyMCE.getParam("paste_unindented_list_class", "unIndentedList");
+
+ while (TinyMCE_PastePlugin._convertMiddots(div, "--list--")) ; // bull
+ while (TinyMCE_PastePlugin._convertMiddots(div, middot, className)) ; // Middot
+ while (TinyMCE_PastePlugin._convertMiddots(div, bull)) ; // bull
+
+ content = div.innerHTML;
+ }
+
+ // Replace all headers with strong and fix some other issues
+ if (tinyMCE.getParam("paste_convert_headers_to_strong", false)) {
+ content = content.replace(/<h[1-6]>&nbsp;<\/h[1-6]>/gi, '<p>&nbsp;&nbsp;</p>');
+ content = content.replace(/<h[1-6]>/gi, '<p><b>');
+ content = content.replace(/<\/h[1-6]>/gi, '</b></p>');
+ content = content.replace(/<b>&nbsp;<\/b>/gi, '<b>&nbsp;&nbsp;</b>');
+ content = content.replace(/^(&nbsp;)*/gi, '');
+ }
+
+ content = content.replace(/--list--/gi, ""); // Remove --list--
+
+ if ((cb = tinyMCE.getParam("paste_insert_word_content_callback", "")) != "")
+ content = eval(cb + "('after', content)");
+
+ // Insert cleaned content
+ tinyMCE.execCommand("mceInsertContent", false, content);
+
+ if (tinyMCE.getParam('paste_force_cleanup_wordpaste', true))
+ window.setTimeout('tinyMCE.execCommand("mceCleanup");', 1); // Do normal cleanup detached from this thread
+ }
+ },
+
+ _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];
+
+ // Is middot
+ if (p.innerHTML.indexOf(search) == 0) {
+ var ul = document.createElement("ul");
+
+ if (class_name)
+ ul.className = class_name;
+
+ // Add the first one
+ var li = document.createElement("li");
+ li.innerHTML = p.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--|&nbsp;', "gi"), '');
+ ul.appendChild(li);
+
+ // Add the rest
+ var np = p.nextSibling;
+ while (np) {
+ // If the node is whitespace, then
+ // ignore it and continue on.
+ 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+|&nbsp;)').test(np.innerHTML)) {
+ // Second level of nesting
+ if (!prevul) {
+ prevul = ul;
+ ul = document.createElement("ul");
+ prevul.appendChild(ul);
+ }
+ np.innerHTML = np.innerHTML.replace(/^o/, '');
+ } else {
+ // Pop the stack if we're going back up to the first level
+ if (prevul) {
+ ul = prevul;
+ prevul = null;
+ }
+ // Not element or middot paragraph
+ if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0)
+ break;
+ }
+ } else {
+ // Not element or middot paragraph
+ 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--|&nbsp;', "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);
+
diff --git a/wp-includes/js/tinymce/plugins/paste/jscripts/pastetext.js b/wp-includes/js/tinymce/plugins/paste/jscripts/pastetext.js
index 927745b..4c07691 100644
--- a/wp-includes/js/tinymce/plugins/paste/jscripts/pastetext.js
+++ b/wp-includes/js/tinymce/plugins/paste/jscripts/pastetext.js
@@ -15,6 +15,10 @@ function saveContent() {
function onLoadInit() {
tinyMCEPopup.resizeToInnerSize();
+ // Remove Gecko spellchecking
+ if (tinyMCE.isGecko)
+ document.body.spellcheck = tinyMCE.getParam("gecko_spellcheck");
+
resizeInputs();
}
diff --git a/wp-includes/js/tinymce/plugins/paste/jscripts/pasteword.js b/wp-includes/js/tinymce/plugins/paste/jscripts/pasteword.js
index c56ea81..b243a10 100644
--- a/wp-includes/js/tinymce/plugins/paste/jscripts/pasteword.js
+++ b/wp-includes/js/tinymce/plugins/paste/jscripts/pasteword.js
@@ -25,7 +25,13 @@ var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
function initIframe(doc) {
var dir = tinyMCE.selectedInstance.settings['directionality'];
+
doc.body.dir = dir;
+
+ // Remove Gecko spellchecking
+ if (tinyMCE.isGecko)
+ doc.body.spellcheck = tinyMCE.getParam("gecko_spellcheck");
+
resizeInputs();
}
diff --git a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
index a596b83..ede6576 100644
--- a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
+++ b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
@@ -575,7 +575,7 @@ function wpautop(pee) {
pee = pee.replace(new RegExp('(</(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])>)', 'gi'), "$1\n\n");
pee = pee.replace(new RegExp("\\r\\n|\\r", 'g'), "\n");
pee = pee.replace(new RegExp("\\n\\s*\\n+", 'g'), "\n\n");
- pee = pee.replace(new RegExp('\n*([^\Z]+?)\\n{2}', 'mg'), "<p>$1</p>\n");
+ pee = pee.replace(new RegExp('([\\s\\S]+?)\\n\\n', 'mg'), "<p>$1</p>\n");
pee = pee.replace(new RegExp('<p>\\s*?</p>', 'gi'), '');
pee = pee.replace(new RegExp('<p>\\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\\s*</p>', 'gi'), "$1");
pee = pee.replace(new RegExp("<p>(<li.+?)</p>", 'gi'), "$1");
diff --git a/wp-includes/js/tinymce/themes/advanced/charmap.htm b/wp-includes/js/tinymce/themes/advanced/charmap.htm
index 9dac168..fbd472b 100644
--- a/wp-includes/js/tinymce/themes/advanced/charmap.htm
+++ b/wp-includes/js/tinymce/themes/advanced/charmap.htm
@@ -6,7 +6,7 @@
<script language="javascript" type="text/javascript" src="jscripts/charmap.js"></script>
<base target="_self" />
</head>
-<body onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';document.getElementById('insert').focus();" style="display: none">
+<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
<table align="center" border="0" cellspacing="0" cellpadding="2">
<tr>
<td colspan="2" class="title">{$lang_theme_charmap_title}</td>
diff --git a/wp-includes/js/tinymce/themes/advanced/color_picker.htm b/wp-includes/js/tinymce/themes/advanced/color_picker.htm
index 725466e..e5fdc9f 100644
--- a/wp-includes/js/tinymce/themes/advanced/color_picker.htm
+++ b/wp-includes/js/tinymce/themes/advanced/color_picker.htm
@@ -5,7 +5,7 @@
<script language="javascript" type="text/javascript" src="jscripts/color_picker.js"></script>
<base target="_self" />
</head>
-<body onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';document.getElementById('insert').focus();" style="margin: 3px; display: none">
+<body onload="tinyMCEPopup.executeOnLoad('init();');" style="margin: 3px; display: none">
<div align="center">
<script language="javascript" type="text/javascript">renderColorMap();</script>
</div>
diff --git a/wp-includes/js/tinymce/themes/advanced/css/editor_content.css b/wp-includes/js/tinymce/themes/advanced/css/editor_content.css
index 11f75df..182e791 100644
--- a/wp-includes/js/tinymce/themes/advanced/css/editor_content.css
+++ b/wp-includes/js/tinymce/themes/advanced/css/editor_content.css
@@ -14,6 +14,11 @@ body {
border: 1px dashed #BBBBBB !important;
}
+div.mceVisualAid {
+ background-image:url('../images/spacer.gif');
+ visibility: visible !important;
+}
+
.mceItemAnchor {
width: 12px;
line-height: 6px;
diff --git a/wp-includes/js/tinymce/themes/advanced/css/editor_popup.css b/wp-includes/js/tinymce/themes/advanced/css/editor_popup.css
index 3b42925..079470c 100644
--- a/wp-includes/js/tinymce/themes/advanced/css/editor_popup.css
+++ b/wp-includes/js/tinymce/themes/advanced/css/editor_popup.css
@@ -312,6 +312,10 @@ h3 {
height: 190px;
}
+label.msg { display: none; }
+label.invalid { color: #EE0000; display: inline; }
+input.invalid { border: 1px solid #EE0000; }
+
/* Disables the advanced tab in the table plugin. */
/*
#table #advanced_tab {
diff --git a/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css b/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css
index 04fccc7..e70405d 100644
--- a/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css
+++ b/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css
@@ -1,348 +1,97 @@
/* This file contains the CSS data for the editor UI of TinyMCE instances */
-.mceToolbarTop a, .mceToolbarTop a:visited, .mceToolbarTop a:hover, .mceToolbarBottom a, .mceToolbarBottom a:visited, .mceToolbarBottom a:hover {
- border: 0; margin: 0; padding: 0; background: transparent;
-}
-
-.mceSeparatorLine {
- border: 0;
- padding: 0;
- margin-left: 4px;
- margin-right: 2px;
-}
-
-.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;
-}
-
-.mceLabel, .mceLabelDisabled {
- font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
- font-size: 9pt;
-}
-
-.mceLabel {
- color: #000000;
-}
-
-.mceLabelDisabled {
- cursor: text;
- color: #999999;
-}
-
-.mceEditor {
- background: #F0F0EE;
- border: 1px solid #cccccc;
- padding: 0;
- margin: 0;
-}
-
-.mceEditorArea {
- font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
- background: #FFFFFF;
- padding: 0;
- margin: 0;
-}
-
-.mceToolbarTop, .mceToolbarBottom {
- background: #F0F0EE;
- line-height: 1px;
- font-size: 1px;
-}
-
-.mceToolbarTop {
- border-bottom: 1px solid #cccccc;
- padding-bottom: 1px;
-}
-
-.mceToolbarBottom {
- border-top: 1px solid #cccccc;
-}
-
-.mceStatusbarTop, .mceStatusbarBottom, .mceStatusbar {
- height: 20px;
-}
-
-.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;
-}
-
-.mceStatusbarTop {
- border-bottom: 1px solid #cccccc;
-}
-
-.mceStatusbarBottom {
- border-top: 1px solid #cccccc;
-}
-
-.mceStatusbar {
- border-bottom: 1px solid #cccccc;
-}
-
-.mcePathItem, .mcePathItem:link, .mcePathItem:visited, .mcePathItem:hover {
- text-decoration: none;
- font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
- font-size: 9pt;
- color: #000000;
-}
-
-.mcePathItem:hover {
- text-decoration: underline;
-}
-
-.mceStatusbarPathText {
- float: left;
-}
-
-.mceStatusbarResize {
- float: right;
- background-image: url('../images/statusbar_resize.gif');
- background-repeat: no-repeat;
- width: 11px;
- height: 20px;
- cursor: se-resize;
-}
-
-.mceResizeBox {
- width: 10px;
- height: 10px;
- display: none;
- border: 1px dotted gray;
- margin: 0;
- padding: 0;
-}
+.mceToolbarTop a, .mceToolbarTop a:visited, .mceToolbarTop a:hover, .mceToolbarBottom a, .mceToolbarBottom a:visited, .mceToolbarBottom a:hover {border: 0; margin: 0; padding: 0; background: transparent;}
+.mceSeparatorLine {border: 0; padding: 0; margin-left: 4px; margin-right: 2px;}
+.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;}
+.mceLabel, .mceLabelDisabled {font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 9pt;}
+.mceLabel {color: #000000;}
+.mceLabelDisabled {cursor: text; color: #999999;}
+.mceEditor {background: #F0F0EE; border: 1px solid #cccccc; padding: 0; margin: 0;}
+.mceEditorArea { font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; background: #FFFFFF; padding: 0; margin: 0; }
+.mceToolbarTop, .mceToolbarBottom {background: #F0F0EE; line-height: 1px; font-size: 1px;}
+.mceToolbarTop {border-bottom: 1px solid #cccccc; padding-bottom: 1px;}
+.mceToolbarBottom {border-top: 1px solid #cccccc;}
+.mceToolbarContainer {position: relative; left: 0; top: 0; display: block;}
+.mceStatusbarTop, .mceStatusbarBottom, .mceStatusbar {height: 20px;}
+.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;}
+.mceStatusbarTop {border-bottom: 1px solid #cccccc;}
+.mceStatusbarBottom {border-top: 1px solid #cccccc;}
+.mceStatusbar {border-bottom: 1px solid #cccccc;}
+.mcePathItem, .mcePathItem:link, .mcePathItem:visited, .mcePathItem:hover {text-decoration: none; font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 9pt; color: #000000;}
+.mcePathItem:hover {text-decoration: underline;}
+.mceStatusbarPathText {float: left;}
+.mceStatusbarResize {float: right; background-image: url('../images/statusbar_resize.gif'); background-repeat: no-repeat; width: 11px; height: 20px; cursor: se-resize;}
+.mceResizeBox {width: 10px; height: 10px; display: none; border: 1px dotted gray; margin: 0; padding: 0;}
+.mceEditorIframe {border: 0;}
/* Button CSS rules */
-a.mceButtonDisabled img, a.mceButtonNormal img, a.mceButtonSelected img {
- width: 20px;
- height: 20px;
- cursor: default;
- margin-top: 1px;
- margin-left: 1px;
-}
-
-a.mceButtonDisabled img {
- border: 0 !important;
-}
-
-a.mceButtonNormal img, a.mceButtonSelected img {
- border: 1px solid #F0F0EE !important;
-}
-
-a.mceButtonSelected img {
- border: 1px solid #6779AA !important;
- background-color: #D4D5D8;
-}
-
-a.mceButtonNormal img:hover, a.mceButtonSelected img:hover {
- border: 1px solid #0A246A !important;
- cursor: default;
- background-color: #B6BDD2;
-}
-
-a.mceButtonDisabled img {
- -moz-opacity:0.3;
- opacity: 0.3;
- border: 1px solid #F0F0EE !important;
- cursor: default;
-}
-
-a.mceTiledButton img {
- background-image: url('../images/buttons.gif');
- background-repeat: no-repeat;
-}
-
-/* MSIE specific rules */
-
-* html a.mceButtonNormal img, * html a.mceButtonSelected img, * html a.mceButtonDisabled img {
- border: 0 !important;
- margin-top: 2px;
- margin-bottom: 1px;
-}
-
-* html a.mceButtonDisabled img {
- filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);
- border: 0 !important;
-}
-
-* html a.mceButtonDisabled {
- border: 1px solid #F0F0EE !important;
-}
-
-* html a.mceButtonNormal, * html a.mceButtonSelected {
- border: 1px solid #F0F0EE !important;
- cursor: default;
-}
-
-* html a.mceButtonSelected {
- border: 1px solid #6779AA !important;
- background-color: #D4D5D8;
-}
-
-* html a.mceButtonNormal:hover, * html a.mceButtonSelected:hover {
- border: 1px solid #0A246A !important;
- cursor: default;
- background-color: #B6BDD2;
-}
-
-* html .mceSelectList {
- margin-top: 2px;
-}
+a.mceButtonDisabled img, a.mceButtonNormal img, a.mceButtonSelected img {width: 20px; height: 20px; cursor: default; margin-top: 1px; margin-left: 1px;}
+a.mceButtonDisabled img {border: 0 !important;}
+a.mceButtonNormal img, a.mceButtonSelected img {border: 1px solid #F0F0EE !important;}
+a.mceButtonSelected img {border: 1px solid #6779AA !important; background-color: #D4D5D8;}
+a.mceButtonNormal img:hover, a.mceButtonSelected img:hover {border: 1px solid #0A246A !important; cursor: default; background-color: #B6BDD2;}
+a.mceButtonDisabled img {-moz-opacity:0.3; opacity: 0.3; border: 1px solid #F0F0EE !important; cursor: default;}
+a.mceTiledButton img {background-image: url('../images/buttons.gif'); background-repeat: no-repeat;}
/* Menu button CSS rules */
-span.mceMenuButton img, span.mceMenuButtonSelected img {
- border: 1px solid #F0F0EE;
- margin-left: 1px;
-}
-
-span.mceMenuButtonSelected img {
- border: 1px solid #6779AA;
- background-color: #B6BDD2;
-}
-
-span.mceMenuButtonSelected img.mceMenuButton {
- border: 1px solid #F0F0EE;
- background-color: transparent;
-}
-
-span.mceMenuButton img.mceMenuButton, span.mceMenuButtonSelected img.mceMenuButton {
- border-left: 0;
- margin-left: 0;
-}
-
-span.mceMenuButton:hover img, span.mceMenuButtonSelected:hover img {
- border: 1px solid #0A246A;
- background-color: #B6BDD2;
-}
-
-span.mceMenuButton:hover img.mceMenuButton, span.mceMenuButtonSelected:hover img.mceMenuButton {
- border-left: 0;
-}
-
-span.mceMenuButtonFocus img {
- border: 1px solid gray;
- border-right: 0;
- margin-left: 1px;
- background-color: #F5F4F2;
-}
-
-span.mceMenuButtonFocus img.mceMenuButton {
- border: 1px solid gray;
- border-left: 1px solid #F5F4F2;
- margin-left: 0;
-}
-
-/* Menu button MSIE specific rules */
-
-* html span.mceMenuButton, * html span.mceMenuButtonFocus {
- position: relative;
- left: 0;
- top: 0;
-}
-
-* html span.mceMenuButton img, * html span.mceMenuButtonSelected img, * html span.mceMenuButtonFocus img {
- position: relative;
- top: 1px;
-}
-
-* html span.mceMenuHover img {
- border: 1px solid #0A246A;
- background-color: #B6BDD2;
-}
-
-* html span.mceMenuButtonSelected.mceMenuHover img.mceMenuButton {
- border: 1px solid #0A246A;
- background-color: #B6BDD2;
- border-left: 0;
-}
+span.mceMenuButton img, span.mceMenuButtonSelected img {border: 1px solid #F0F0EE; margin-left: 1px;}
+span.mceMenuButtonSelected img {border: 1px solid #6779AA; background-color: #B6BDD2;}
+span.mceMenuButtonSelected img.mceMenuButton {border: 1px solid #F0F0EE; background-color: transparent;}
+span.mceMenuButton img.mceMenuButton, span.mceMenuButtonSelected img.mceMenuButton {border-left: 0; margin-left: 0;}
+span.mceMenuButton:hover img, span.mceMenuButtonSelected:hover img {border: 1px solid #0A246A; background-color: #B6BDD2;}
+span.mceMenuButton:hover img.mceMenuButton, span.mceMenuButtonSelected:hover img.mceMenuButton {border-left: 0;}
+span.mceMenuButtonFocus img {border: 1px solid gray; border-right: 0; margin-left: 1px; background-color: #F5F4F2;}
+span.mceMenuButtonFocus img.mceMenuButton {border: 1px solid gray; border-left: 1px solid #F5F4F2; margin-left: 0;}
+span.mceMenuHover img {border: 1px solid #0A246A; background-color: #B6BDD2;}
+span.mceMenuButtonSelected.mceMenuHover img.mceMenuButton {border: 1px solid #0A246A; background-color: #B6BDD2; border-left: 0;}
/* Menu */
-.mceMenu {
- position: absolute;
- left: 0;
- top: 0;
- display: none;
- z-index: 100;
- background-color: white;
- border: 1px solid gray;
- font-weight: normal;
-}
-
-.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;
-}
-
-.mceMenu a:hover {
- background-color: #B6BDD2;
- color: black;
-}
-
-.mceMenu span {
- padding-left: 10px;
- padding-right: 10px;
- display: block;
- line-height: 20px;
-}
-
-.mceMenuSeparator {
- border-bottom: 1px solid gray;
- background-color: gray;
- height: 1px;
-}
-
-.mceMenuTitle span {
- padding-left: 5px;
-}
-
-.mceMenuTitle {
- background-color: #DDDDDD;
- font-weight: bold;
-}
-
-.mceMenuDisabled {
- color: gray;
-}
-
-span.mceMenuSelectedItem {
- background-image: url('../images/menu_check.gif');
- background-repeat: no-repeat;
- background-position: 5px 8px;
- padding-left: 20px;
-}
-
-span.mceMenuCheckItem {
- padding-left: 20px;
-}
-
-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;
-}
+.mceMenu {position: absolute; left: 0; top: 0; display: none; z-index: 100; background-color: white; border: 1px solid gray; font-weight: normal;}
+.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;}
+.mceMenu a:hover {background-color: #B6BDD2; color: black; text-decoration: none !important;}
+.mceMenu span {padding-left: 10px; padding-right: 10px; display: block; line-height: 20px;}
+.mceMenuSeparator {border-bottom: 1px solid gray; background-color: gray; height: 1px;}
+.mceMenuTitle span {padding-left: 5px;}
+.mceMenuTitle {background-color: #DDDDDD; font-weight: bold;}
+.mceMenuDisabled {color: gray;}
+span.mceMenuSelectedItem {background-image: url('../images/menu_check.gif'); background-repeat: no-repeat; background-position: 5px 8px; padding-left: 20px;}
+span.mceMenuCheckItem {padding-left: 20px;}
+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;}
+.mceColors table, .mceColors td {margin: 0; padding: 2px;}
+a.mceMoreColors {width: 130px; margin: 0; padding: 0; margin-left: 3px; margin-bottom: 3px; text-align: center; border: 1px solid white;}
+.mceColorPreview {position: absolute; left: 0; top: 0; margin-left: 3px; margin-top: 15px; width: 16px; height: 4px; background-color: red;}
+a.mceMoreColors:hover {border: 1px solid #0A246A;}
+.mceColors td a {width: 9px; height: 9px; overflow: hidden; border: 1px solid #808080;}
+
+/* MSIE 6 specific rules */
+
+* html a.mceButtonNormal img, * html a.mceButtonSelected img, * html a.mceButtonDisabled img {border: 0 !important; margin-top: 2px; margin-bottom: 1px;}
+* html a.mceButtonDisabled img {filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30); border: 0 !important;}
+* html a.mceButtonDisabled {border: 1px solid #F0F0EE !important;}
+* html a.mceButtonNormal, * html a.mceButtonSelected {border: 1px solid #F0F0EE !important; cursor: default;}
+* html a.mceButtonSelected {border: 1px solid #6779AA !important; background-color: #D4D5D8;}
+* html a.mceButtonNormal:hover, * html a.mceButtonSelected:hover {border: 1px solid #0A246A !important; background-color: #B6BDD2; cursor: default;}
+* html .mceSelectList {margin-top: 2px;}
+* html span.mceMenuButton, * html span.mceMenuButtonFocus {position: relative; left: 0; top: 0;}
+* html span.mceMenuButton img, * html span.mceMenuButtonSelected img, * html span.mceMenuButtonFocus img {position: relative; top: 1px;}
+* html a.mceMoreColors {width: 132px;}
+* html .mceColors td a {width: 10px; height: 10px;}
+* html .mceColorPreview {margin-left: 2px; margin-top: 14px;}
+
+/* MSIE 7 specific rules */
+
+*: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;}
+*:first-child+html a.mceButtonDisabled img {filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30); border: 0 !important;}
+*:first-child+html a.mceButtonDisabled {border: 1px solid #F0F0EE !important;}
+*:first-child+html a.mceButtonNormal, *:first-child+html a.mceButtonSelected {border: 1px solid #F0F0EE !important; cursor: default;}
+*:first-child+html a.mceButtonSelected {border: 1px solid #6779AA !important; background-color: #D4D5D8;}
+*:first-child+html a.mceButtonNormal:hover, *:first-child+html a.mceButtonSelected:hover {border: 1px solid #0A246A !important; background-color: #B6BDD2; cursor: default;}
+*:first-child+html .mceSelectList {margin-top: 2px;}
+*:first-child+html span.mceMenuButton, *:first-child+html span.mceMenuButtonFocus {position: relative; left: 0; top: 0;}
+*:first-child+html span.mceMenuButton img, *:first-child+html span.mceMenuButtonSelected img, *:first-child+html span.mceMenuButtonFocus img {position: relative; top: 1px;}
+*:first-child+html a.mceMoreColors {width: 132px;}
+*:first-child+html .mceColors td a {width: 10px; height: 10px;}
+*:first-child+html .mceColorPreview {margin: 0; padding-left: 4px; margin-top: 14px; width: 14px;}
diff --git a/wp-includes/js/tinymce/themes/advanced/editor_template.js b/wp-includes/js/tinymce/themes/advanced/editor_template.js
index 052914e..2285832 100644
--- a/wp-includes/js/tinymce/themes/advanced/editor_template.js
+++ b/wp-includes/js/tinymce/themes/advanced/editor_template.js
@@ -1,7 +1,5 @@
/**
- * $RCSfile: editor_template_src.js,v $
- * $Revision: 1.96 $
- * $Date: 2006/04/18 13:32:52 $
+ * $Id: editor_template_src.js 129 2006-10-23 09:45:17Z spocke $
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
@@ -12,6 +10,7 @@ tinyMCE.importThemeLanguagePack('advanced');
var TinyMCE_AdvancedTheme = {
// Private theme fields
+ _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",
_autoImportCSSClasses : true,
_resizer : {},
_buttons : [
@@ -43,25 +42,28 @@ var TinyMCE_AdvancedTheme = {
['removeformat', 'removeformat.gif', 'lang_theme_removeformat_desc', 'removeformat'],
['sub', 'sub.gif', 'lang_theme_sub_desc', 'subscript'],
['sup', 'sup.gif', 'lang_theme_sup_desc', 'superscript'],
- ['forecolor', 'forecolor.gif', 'lang_theme_forecolor_desc', 'mceForeColor', true],
- ['backcolor', 'backcolor.gif', 'lang_theme_backcolor_desc', 'mceBackColor', true],
+ ['forecolor', 'forecolor.gif', 'lang_theme_forecolor_desc', 'forecolor', true],
+ ['backcolor', 'backcolor.gif', 'lang_theme_backcolor_desc', 'HiliteColor', true],
['charmap', 'charmap.gif', 'lang_theme_charmap_desc', 'mceCharMap'],
['visualaid', 'visualaid.gif', 'lang_theme_visualaid_desc', 'mceToggleVisualAid'],
['anchor', 'anchor.gif', 'lang_theme_anchor_desc', 'mceInsertAnchor'],
['newdocument', 'newdocument.gif', 'lang_newdocument_desc', 'mceNewDocument']
],
- _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',
+ _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',
/**
* Returns HTML code for the specificed control.
*/
getControlHTML : function(button_name) {
- var i, x;
+ var i, x, but;
// Lookup button in button list
for (i=0; i<TinyMCE_AdvancedTheme._buttons.length; i++) {
- var but = TinyMCE_AdvancedTheme._buttons[i];
+ but = TinyMCE_AdvancedTheme._buttons[i];
+
+ if (but[0] == button_name && (button_name == "forecolor" || button_name == "backcolor"))
+ 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));
if (but[0] == button_name)
return tinyMCE.getButtonHTML(but[0], but[2], '{$themeurl}/images/' + but[1], but[3], (but.length > 4 ? but[4] : false), (but.length > 5 ? but[5] : null));
@@ -153,6 +155,18 @@ var TinyMCE_AdvancedTheme = {
*/
execCommand : function(editor_id, element, command, user_interface, value) {
switch (command) {
+ case 'mceHelp':
+ tinyMCE.openWindow({
+ file : 'about.htm',
+ width : 480,
+ height : 380
+ }, {
+ tinymce_version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion,
+ tinymce_releasedate : tinyMCE.releaseDate,
+ inline : "yes"
+ });
+ return true;
+
case "mceLink":
var inst = tinyMCE.getInstanceById(editor_id);
var doc = inst.getDoc();
@@ -317,41 +331,94 @@ var TinyMCE_AdvancedTheme = {
return true;
- case "mceForeColor":
- var template = new Array();
- var elm = tinyMCE.selectedInstance.getFocusElement();
- var inputColor = tinyMCE.getAttrib(elm, "color");
+ case "forecolor":
+ var fcp = new TinyMCE_Layer(editor_id + '_fcPreview', false), p, img, elm;
+
+ TinyMCE_AdvancedTheme._hideMenus(editor_id);
+
+ if (!fcp.exists()) {
+ fcp.create('div', 'mceColorPreview', document.getElementById(editor_id + '_toolbar'));
+ elm = fcp.getElement();
+ elm._editor_id = editor_id;
+ elm._command = "forecolor";
+ elm._switchId = editor_id + "_forecolor";
+ tinyMCE.addEvent(elm, 'click', TinyMCE_AdvancedTheme._handleMenuEvent);
+ tinyMCE.addEvent(elm, 'mouseover', TinyMCE_AdvancedTheme._handleMenuEvent);
+ tinyMCE.addEvent(elm, 'mouseout', TinyMCE_AdvancedTheme._handleMenuEvent);
+ }
+
+ img = tinyMCE.selectNodes(document.getElementById(editor_id + "_forecolor"), function(n) {return n.nodeName == "IMG";})[0];
+ p = tinyMCE.getAbsPosition(img, document.getElementById(editor_id + '_toolbar'));
+
+ fcp.moveTo(p.absLeft, p.absTop);
+ fcp.getElement().style.backgroundColor = value != null ? value : tinyMCE.getInstanceById(editor_id).foreColor;
+ fcp.show();
+
+ return false;
+
+ case "forecolorMenu":
+ TinyMCE_AdvancedTheme._hideMenus(editor_id);
+
+ // Create color layer
+ var ml = new TinyMCE_Layer(editor_id + '_fcMenu');
- if (inputColor == '')
- inputColor = elm.style.color;
+ if (!ml.exists())
+ ml.create('div', 'mceMenu', document.body, TinyMCE_AdvancedTheme._getColorHTML(editor_id, 'theme_advanced_text_colors', 'forecolor'));
- if (!inputColor)
- inputColor = "#000000";
+ tinyMCE.switchClass(editor_id + '_forecolor', 'mceMenuButtonFocus');
+ ml.moveRelativeTo(document.getElementById(editor_id + "_forecolor"), 'bl');
- template['file'] = 'color_picker.htm';
- template['width'] = 220;
- template['height'] = 190;
+ ml.moveBy(tinyMCE.isMSIE && !tinyMCE.isOpera ? -1 : 1, -1);
- tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", command : "forecolor", input_color : inputColor});
+ if (tinyMCE.isOpera)
+ ml.moveBy(0, -2);
+
+ ml.show();
return true;
- case "mceBackColor":
- var template = new Array();
- var elm = tinyMCE.selectedInstance.getFocusElement();
- var inputColor = elm.style.backgroundColor;
+ case "HiliteColor":
+ var bcp = new TinyMCE_Layer(editor_id + '_bcPreview', false), p, img;
+
+ TinyMCE_AdvancedTheme._hideMenus(editor_id);
+
+ if (!bcp.exists()) {
+ bcp.create('div', 'mceColorPreview', document.getElementById(editor_id + '_toolbar'));
+ elm = bcp.getElement();
+ elm._editor_id = editor_id;
+ elm._command = "HiliteColor";
+ elm._switchId = editor_id + "_backcolor";
+ tinyMCE.addEvent(elm, 'click', TinyMCE_AdvancedTheme._handleMenuEvent);
+ tinyMCE.addEvent(elm, 'mouseover', TinyMCE_AdvancedTheme._handleMenuEvent);
+ tinyMCE.addEvent(elm, 'mouseout', TinyMCE_AdvancedTheme._handleMenuEvent);
+ }
+
+ img = tinyMCE.selectNodes(document.getElementById(editor_id + "_backcolor"), function(n) {return n.nodeName == "IMG";})[0];
+ p = tinyMCE.getAbsPosition(img, document.getElementById(editor_id + '_toolbar'));
+
+ bcp.moveTo(p.absLeft, p.absTop);
+ bcp.getElement().style.backgroundColor = value != null ? value : tinyMCE.getInstanceById(editor_id).backColor;
+ bcp.show();
+
+ return false;
+
+ case "HiliteColorMenu":
+ TinyMCE_AdvancedTheme._hideMenus(editor_id);
+
+ // Create color layer
+ var ml = new TinyMCE_Layer(editor_id + '_bcMenu');
+
+ if (!ml.exists())
+ ml.create('div', 'mceMenu', document.body, TinyMCE_AdvancedTheme._getColorHTML(editor_id, 'theme_advanced_background_colors', 'HiliteColor'));
- if (!inputColor)
- inputColor = "#000000";
+ tinyMCE.switchClass(editor_id + '_backcolor', 'mceMenuButtonFocus');
+ ml.moveRelativeTo(document.getElementById(editor_id + "_backcolor"), 'bl');
- template['file'] = 'color_picker.htm';
- template['width'] = 220;
- template['height'] = 190;
+ ml.moveBy(tinyMCE.isMSIE && !tinyMCE.isOpera ? -1 : 1, -1);
- template['width'] += tinyMCE.getLang('lang_theme_advanced_backcolor_delta_width', 0);
- template['height'] += tinyMCE.getLang('lang_theme_advanced_backcolor_delta_height', 0);
+ if (tinyMCE.isOpera)
+ ml.moveBy(0, -2);
- tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", command : "HiliteColor", input_color : inputColor});
- //mceBackColor
+ ml.show();
return true;
case "mceColorPicker":
@@ -433,7 +500,7 @@ var TinyMCE_AdvancedTheme = {
*/
getEditorTemplate : function(settings, editorId) {
function removeFromArray(in_array, remove_array) {
- var outArray = new Array();
+ var outArray = new Array(), skip;
for (var i=0; i<in_array.length; i++) {
skip = false;
@@ -530,10 +597,10 @@ var TinyMCE_AdvancedTheme = {
toolbarHTML += '<a href="#" accesskey="z" onfocus="tinyMCE.getInstanceById(\'' + editorId + '\').getWin().focus();"></a>';
// Setup template html
- template['html'] = '<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width}px;height:{$height}px"><tbody>';
+ template['html'] = '<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width_style};height:{$height_style}"><tbody>';
if (toolbarLocation == "top") {
- template['html'] += '<tr><td class="mceToolbarTop" align="' + toolbarAlign + '" height="1" nowrap="nowrap">' + toolbarHTML + '</td></tr>';
+ template['html'] += '<tr><td class="mceToolbarTop" align="' + toolbarAlign + '" height="1" nowrap="nowrap"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>';
}
if (statusbarLocation == "top") {
@@ -544,7 +611,7 @@ var TinyMCE_AdvancedTheme = {
template['html'] += '<tr><td align="center"><span id="{$editor_id}"></span></td></tr>';
if (toolbarLocation == "bottom") {
- template['html'] += '<tr><td class="mceToolbarBottom" align="' + toolbarAlign + '" height="1">' + toolbarHTML + '</td></tr>';
+ template['html'] += '<tr><td class="mceToolbarBottom" align="' + toolbarAlign + '" height="1"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>';
}
// External toolbar changes
@@ -615,9 +682,10 @@ var TinyMCE_AdvancedTheme = {
var curAlign = tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_align", defaultContainerAlign);
var curCSS = tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_class", defaultContainerCSS);
- for (var j=0; j<curContainer.length; j++) {
+ curContainer = removeFromArray(curContainer, tinyMCE.getParam("theme_advanced_disable", "", true, ','));
+
+ for (var j=0; j<curContainer.length; j++)
curContainerHTML += tinyMCE.getControlHTML(curContainer[j]);
- }
if (curContainer.length > 0) {
curContainerHTML += "<br />";
@@ -664,10 +732,34 @@ var TinyMCE_AdvancedTheme = {
inst.addShortcut('ctrl', 'k', 'lang_link_desc', 'mceLink');
},
+ _handleMenuEvent : function(e) {
+ var te = tinyMCE.isMSIE ? window.event.srcElement : e.target;
+ tinyMCE._menuButtonEvent(e.type == "mouseover" ? "over" : "out", document.getElementById(te._switchId));
+
+ if (e.type == "click")
+ tinyMCE.execInstanceCommand(te._editor_id, te._command);
+ },
+
+ _hideMenus : function(id) {
+ var fcml = new TinyMCE_Layer(id + '_fcMenu'), bcml = new TinyMCE_Layer(id + '_bcMenu');
+
+ if (fcml.exists() && fcml.isVisible()) {
+ tinyMCE.switchClass(id + '_forecolor', 'mceMenuButton');
+ fcml.hide();
+ }
+
+ if (bcml.exists() && bcml.isVisible()) {
+ tinyMCE.switchClass(id + '_backcolor', 'mceMenuButton');
+ bcml.hide();
+ }
+ },
+
/**
* Node change handler.
*/
handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection, setup_content) {
+ var alignNode, breakOut, classNode;
+
function selectByValue(select_elm, value, first_index) {
first_index = typeof(first_index) == "undefined" ? false : true;
@@ -702,6 +794,7 @@ var TinyMCE_AdvancedTheme = {
var pathElm = document.getElementById(editor_id + "_path");
var inst = tinyMCE.getInstanceById(editor_id);
var doc = inst.getDoc();
+ TinyMCE_AdvancedTheme._hideMenus(editor_id);
if (pathElm) {
// Get node path
@@ -727,6 +820,9 @@ var TinyMCE_AdvancedTheme = {
var nodeName = path[i].nodeName.toLowerCase();
var nodeData = "";
+ if (nodeName.indexOf("html:") == 0)
+ nodeName = nodeName.substring(5);
+
if (nodeName == "b") {
nodeName = "strong";
}
@@ -781,7 +877,7 @@ var TinyMCE_AdvancedTheme = {
nodeData += "src: " + src + " ";
}
- if (getAttrib(path[i], 'href') != "") {
+ if (path[i].nodeName == 'A' && getAttrib(path[i], 'href') != "") {
var href = tinyMCE.getAttrib(path[i], "mce_href");
if (href == "")
@@ -790,9 +886,10 @@ var TinyMCE_AdvancedTheme = {
nodeData += "href: " + href + " ";
}
- if (nodeName == "img" && tinyMCE.getAttrib(path[i], "class").indexOf('mceItemFlash') != -1) {
- nodeName = "flash";
- nodeData = "src: " + path[i].getAttribute('title');
+ className = tinyMCE.getAttrib(path[i], "class");
+ if ((nodeName == "img" || nodeName == "span") && className.indexOf('mceItem') != -1) {
+ nodeName = className.replace(/mceItem([a-z]+)/gi, '$1').toLowerCase();
+ nodeData = path[i].getAttribute('title');
}
if (nodeName == "a" && (anchor = tinyMCE.getAttrib(path[i], "name")) != "") {
@@ -1027,7 +1124,7 @@ var TinyMCE_AdvancedTheme = {
break;
case "IMG":
- if (getAttrib(node, 'name').indexOf('mce_') != 0) {
+ if (getAttrib(node, 'name').indexOf('mce_') != 0 && tinyMCE.getAttrib(node, 'class').indexOf('mceItem') == -1) {
tinyMCE.switchClass(editor_id + '_image', 'mceButtonSelected');
}
break;
@@ -1148,6 +1245,9 @@ var TinyMCE_AdvancedTheme = {
inst.iframeElement.style.width = (iw + dx) + "px";
}
}
+
+ // Remove pesky table controls
+ inst.useCSS = false;
},
/**
@@ -1255,6 +1355,29 @@ var TinyMCE_AdvancedTheme = {
}
},
+ _getColorHTML : function(id, n, cm) {
+ var i, h, cl;
+
+ h = '<span class="mceMenuLine"></span>';
+ cl = tinyMCE.getParam(n, TinyMCE_AdvancedTheme._defColors).split(',');
+
+ h += '<table class="mceColors"><tr>';
+ for (i=0; i<cl.length; i++) {
+ c = 'tinyMCE.execInstanceCommand(\'' + id + '\', \'' + cm + '\', false, \'#' + cl[i] + '\');';
+ h += '<td><a href="javascript:' + c + '" style="background-color: #' + cl[i] + '" onclick="' + c + ';return false;"></a></td>';
+
+ if ((i+1) % 8 == 0)
+ h += '</tr><tr>';
+ }
+
+ h += '</tr></table>';
+ /*
+ h += '<a href="" class="mceMoreColors">More colors</a>';
+ */
+
+ return h;
+ },
+
_insertImage : function(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout) {
tinyMCE.execCommand('mceBeginUndoLevel');
diff --git a/wp-includes/js/tinymce/themes/advanced/editor_template_src.js b/wp-includes/js/tinymce/themes/advanced/editor_template_src.js
deleted file mode 100644
index e69de29..0000000
--- a/wp-includes/js/tinymce/themes/advanced/editor_template_src.js
+++ /dev/null
diff --git a/wp-includes/js/tinymce/themes/advanced/images/backcolor.gif b/wp-includes/js/tinymce/themes/advanced/images/backcolor.gif
index 8a532e5..d03e206 100644
--- a/wp-includes/js/tinymce/themes/advanced/images/backcolor.gif
+++ b/wp-includes/js/tinymce/themes/advanced/images/backcolor.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/buttons.gif b/wp-includes/js/tinymce/themes/advanced/images/buttons.gif
index 6196350..5ad99a7 100644
--- a/wp-includes/js/tinymce/themes/advanced/images/buttons.gif
+++ b/wp-includes/js/tinymce/themes/advanced/images/buttons.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/forecolor.gif b/wp-includes/js/tinymce/themes/advanced/images/forecolor.gif
index d5e3814..8b70361 100644
--- a/wp-includes/js/tinymce/themes/advanced/images/forecolor.gif
+++ b/wp-includes/js/tinymce/themes/advanced/images/forecolor.gif
Binary files differ
diff --git a/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js b/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js
index b7dadc6..8395340 100644
--- a/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js
+++ b/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js
@@ -3,29 +3,25 @@ function saveContent() {
tinyMCE.closeWindow(window);
}
-// Fixes some charcode issues
-function fixContent(html) {
-/* html = html.replace(new RegExp('<(p|hr|table|tr|td|ol|ul|object|embed|li|blockquote)', 'gi'),'\n<$1');
- html = html.replace(new RegExp('<\/(p|ol|ul|li|table|tr|td|blockquote|object)>', 'gi'),'</$1>\n');
- html = tinyMCE.regexpReplace(html, '<br />','<br />\n','gi');
- html = tinyMCE.regexpReplace(html, '\n\n','\n','gi');*/
- return html;
-}
-
function onLoadInit() {
tinyMCEPopup.resizeToInnerSize();
- document.forms[0].htmlSource.value = fixContent(tinyMCE.getContent(tinyMCE.getWindowArg('editor_id')));
+ // Remove Gecko spellchecking
+ if (tinyMCE.isGecko)
+ document.body.spellcheck = tinyMCE.getParam("gecko_spellcheck");
+
+ document.getElementById('htmlSource').value = tinyMCE.getContent(tinyMCE.getWindowArg('editor_id'));
+
resizeInputs();
if (tinyMCE.getParam("theme_advanced_source_editor_wrap", true)) {
setWrap('soft');
- document.forms[0].wraped.checked = true;
+ document.getElementById('wraped').checked = true;
}
}
function setWrap(val) {
- var s = document.forms[0].htmlSource;
+ var s = document.getElementById('htmlSource');
s.wrap = val;
@@ -48,6 +44,8 @@ function toggleWordWrap(elm) {
var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
function resizeInputs() {
+ var el = document.getElementById('htmlSource');
+
if (!tinyMCE.isMSIE) {
wHeight = self.innerHeight-80;
wWidth = self.innerWidth-16;
@@ -56,11 +54,7 @@ function resizeInputs() {
wWidth = document.body.clientWidth - 16;
}
- document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px';
- document.forms[0].htmlSource.style.width = Math.abs(wWidth) + 'px';
+ el.style.height = Math.abs(wHeight) + 'px';
+ el.style.width = Math.abs(wWidth) + 'px';
}
-function renderWordWrap() {
- if (tinyMCE.isMSIE || tinyMCE.isGecko)
- document.write('<input type="checkbox" name="wraped" id="wraped" onclick="toggleWordWrap(this);" class="wordWrapCode" /><label for="wraped">{$lang_theme_code_wordwrap}</label>');
-}
diff --git a/wp-includes/js/tinymce/themes/advanced/langs/en.js b/wp-includes/js/tinymce/themes/advanced/langs/en.js
index ca72676..fd915ea 100644
--- a/wp-includes/js/tinymce/themes/advanced/langs/en.js
+++ b/wp-includes/js/tinymce/themes/advanced/langs/en.js
@@ -38,6 +38,11 @@ theme_h3 : 'Heading 3',
theme_h4 : 'Heading 4',
theme_h5 : 'Heading 5',
theme_h6 : 'Heading 6',
+theme_blockquote : 'Blockquote',
+theme_code : 'Code',
+theme_samp : 'Code sample',
+theme_dt : 'Definition term ',
+theme_dd : 'Definition description',
theme_colorpicker_title : 'Select a color',
theme_colorpicker_apply : 'Apply',
theme_forecolor_desc : 'Select text color',
@@ -72,5 +77,6 @@ loaded_plugins : 'Loaded plugins',
help : 'Help',
not_set : '-- Not set --',
close : 'Close',
-toolbar_focus : 'Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X'
+toolbar_focus : 'Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X',
+invalid_data : 'Error: Invalid values entered, these are marked in red.'
});
diff --git a/wp-includes/js/tinymce/tiny_mce.js b/wp-includes/js/tinymce/tiny_mce.js
index 643aab4..ecd78a2 100644
--- a/wp-includes/js/tinymce/tiny_mce.js
+++ b/wp-includes/js/tinymce/tiny_mce.js
@@ -2,9 +2,11 @@
/* file:jscripts/tiny_mce/classes/TinyMCE_Engine.class.js */
function TinyMCE_Engine() {
+ var ua;
+
this.majorVersion = "2";
- this.minorVersion = "0.6.1";
- this.releaseDate = "2006-05-04";
+ this.minorVersion = "0.8";
+ this.releaseDate = "2006-10-23";
this.instances = new Array();
this.switchClassCache = new Array();
@@ -15,12 +17,17 @@ function TinyMCE_Engine() {
this.configs = new Array();
this.currentConfig = 0;
this.eventHandlers = new Array();
+ this.log = new Array();
+ this.undoLevels = [];
+ this.undoIndex = 0;
+ this.typingUndoIndex = -1;
// Browser check
- var ua = navigator.userAgent;
+ ua = navigator.userAgent;
this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
this.isMSIE5 = this.isMSIE && (ua.indexOf('MSIE 5') != -1);
this.isMSIE5_0 = this.isMSIE && (ua.indexOf('MSIE 5.0') != -1);
+ this.isMSIE7 = this.isMSIE && (ua.indexOf('MSIE 7') != -1);
this.isGecko = ua.indexOf('Gecko') != -1;
this.isSafari = ua.indexOf('Safari') != -1;
this.isOpera = ua.indexOf('Opera') != -1;
@@ -42,13 +49,20 @@ function TinyMCE_Engine() {
this.isSafari = false;
}
+ this.isIE = this.isMSIE;
+ this.isRealIE = this.isMSIE && !this.isOpera;
+
// TinyMCE editor id instance counter
this.idCounter = 0;
};
TinyMCE_Engine.prototype = {
init : function(settings) {
- var theme;
+ var theme, nl, baseHREF = "", i;
+
+ // 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.
+ if (this.isMSIE5_0)
+ return;
this.settings = settings;
@@ -60,6 +74,13 @@ TinyMCE_Engine.prototype = {
if (!tinyMCE.baseURL) {
var elements = document.getElementsByTagName('script');
+ // If base element found, add that infront of baseURL
+ nl = document.getElementsByTagName('base');
+ for (i=0; i<nl.length; i++) {
+ if (nl[i].href)
+ baseHREF = nl[i].href;
+ }
+
for (var i=0; i<elements.length; i++) {
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)) {
var src = elements[i].src;
@@ -71,7 +92,12 @@ TinyMCE_Engine.prototype = {
if (settings.exec_mode == "src" || settings.exec_mode == "normal")
tinyMCE.srcMode = settings.exec_mode == "src" ? '_src' : '';
- tinyMCE.baseURL = src;
+ // Force it absolute if page has a base href
+ if (baseHREF != "" && src.indexOf('://') == -1)
+ tinyMCE.baseURL = baseHREF + src;
+ else
+ tinyMCE.baseURL = src;
+
break;
}
}
@@ -100,7 +126,7 @@ TinyMCE_Engine.prototype = {
this._def("textarea_trigger", "mce_editable");
this._def("editor_selector", "");
this._def("editor_deselector", "mceNoEditor");
- 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]");
+ 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]");
this._def("extended_valid_elements", "");
this._def("invalid_elements", "");
this._def("encoding", "");
@@ -122,6 +148,7 @@ TinyMCE_Engine.prototype = {
this._def("custom_undo_redo_levels", -1);
this._def("custom_undo_redo_keyboard_shortcuts", true);
this._def("custom_undo_redo_restore_selection", true);
+ this._def("custom_undo_redo_global", false);
this._def("verify_html", true);
this._def("apply_source_formatting", false);
this._def("directionality", "ltr");
@@ -164,6 +191,7 @@ TinyMCE_Engine.prototype = {
this._def("strict_loading_mode", document.contentType == 'application/xhtml+xml');
this._def("hidden_tab_class", '');
this._def("display_tab_class", '');
+ this._def("gecko_spellcheck", false);
// Force strict loading mode to false on non Gecko browsers
if (this.isMSIE && !this.isOpera)
@@ -186,7 +214,7 @@ TinyMCE_Engine.prototype = {
return;
// If not super absolute make it so
- var baseHREF = tinyMCE.settings['document_base_url'];
+ baseHREF = tinyMCE.settings['document_base_url'];
var h = document.location.href;
var p = h.indexOf('://');
if (p > 0 && document.location.protocol != "file:") {
@@ -207,7 +235,10 @@ TinyMCE_Engine.prototype = {
this.settings['base_href'] = baseHREF.substring(0, baseHREF.lastIndexOf('/')) + "/";
theme = this.settings['theme'];
- 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");
+ 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';
+ 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';
+ 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';
+ this.blockRegExp = new RegExp("^(" + this.blockElms + ")$", "i");
this.posKeyCodes = new Array(13,45,36,35,33,34,37,38,39,40);
this.uniqueURL = 'javascript:TINYMCE_UNIQUEURL();'; // Make unique URL non real URL
this.uniqueTag = '<div id="mceTMPElement" style="display: none">TMP</div>';
@@ -216,7 +247,7 @@ TinyMCE_Engine.prototype = {
// Theme url
this.settings['theme_href'] = tinyMCE.baseURL + "/themes/" + theme;
- if (!tinyMCE.isMSIE)
+ if (!tinyMCE.isIE || tinyMCE.isOpera)
this.settings['force_br_newlines'] = false;
if (tinyMCE.getParam("popups_css", false)) {
@@ -238,8 +269,10 @@ TinyMCE_Engine.prototype = {
this.settings['editor_css'] = this.documentBasePath + "/" + cssPath;
else
this.settings['editor_css'] = cssPath;
- } else
- this.settings['editor_css'] = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_ui.css";
+ } else {
+ if (this.settings.editor_css != '')
+ this.settings['editor_css'] = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_ui.css";
+ }
if (tinyMCE.settings['debug']) {
var msg = "Debug: \n";
@@ -255,14 +288,10 @@ TinyMCE_Engine.prototype = {
// Only do this once
if (this.configs.length == 0) {
- // Is Safari enabled
- if (this.isSafari && this.getParam('safari_warning', false))
- 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");
-
if (typeof(TinyMCECompressed) == "undefined") {
tinyMCE.addEvent(window, "DOMContentLoaded", TinyMCE_Engine.prototype.onLoad);
- if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
+ if (tinyMCE.isRealIE) {
if (document.body)
tinyMCE.addEvent(document.body, "readystatechange", TinyMCE_Engine.prototype.onLoad);
else
@@ -288,10 +317,12 @@ TinyMCE_Engine.prototype = {
}
// Setup entities
- settings['cleanup_entities'] = new Array();
- var entities = tinyMCE.getParam('entities', '', true, ',');
- for (var i=0; i<entities.length; i+=2)
- settings['cleanup_entities']['c' + entities[i]] = entities[i+1];
+ if (tinyMCE.getParam('entity_encoding') == 'named') {
+ settings['cleanup_entities'] = new Array();
+ var entities = tinyMCE.getParam('entities', '', true, ',');
+ for (var i=0; i<entities.length; i+=2)
+ settings['cleanup_entities']['c' + entities[i]] = entities[i+1];
+ }
// Save away this config
settings['index'] = this.configs.length;
@@ -299,10 +330,18 @@ TinyMCE_Engine.prototype = {
// Start loading first one in chain
this.loadNextScript();
+
+ // Force flicker free CSS backgrounds in IE
+ if (this.isIE && !this.isOpera) {
+ try {
+ document.execCommand('BackgroundImageCache', false, true);
+ } catch (e) {
+ }
+ }
},
_addUnloadEvents : function() {
- if (tinyMCE.isMSIE) {
+ if (tinyMCE.isIE) {
if (tinyMCE.settings['add_unload_trigger']) {
tinyMCE.addEvent(window, "unload", TinyMCE_Engine.prototype.unloadHandler);
tinyMCE.addEvent(window.document, "beforeunload", TinyMCE_Engine.prototype.unloadHandler);
@@ -316,7 +355,7 @@ TinyMCE_Engine.prototype = {
_def : function(key, def_val, t) {
var v = tinyMCE.getParam(key, def_val);
- v = t ? v.replace(/\s+/g,"") : v;
+ v = t ? v.replace(/\s+/g, "") : v;
this.settings[key] = v;
},
@@ -409,8 +448,6 @@ TinyMCE_Engine.prototype = {
var x = 0, i = 0, nl, le;
for (x = 0,csslen = ar.length; x<csslen; x++) {
- ignore_css = false;
-
if (ar[x] != null && ar[x] != 'null' && ar[x].length > 0) {
/* Make sure it doesn't exist. */
for (i=0, lflen=this.loadedFiles.length; i<lflen; i++) {
@@ -466,7 +503,7 @@ TinyMCE_Engine.prototype = {
},
confirmAdd : function(e, settings) {
- var elm = tinyMCE.isMSIE ? event.srcElement : e.target;
+ var elm = tinyMCE.isIE ? event.srcElement : e.target;
var elementId = elm.name ? elm.name : elm.id;
tinyMCE.settings = settings;
@@ -492,7 +529,7 @@ TinyMCE_Engine.prototype = {
tinyMCE._setHTML(doc, inst.formElement.value);
- if (!tinyMCE.isMSIE)
+ if (!tinyMCE.isIE)
doc.body.innerHTML = tinyMCE._cleanupHTML(inst, doc, this.settings, doc.body, inst.visualAid);
}
}
@@ -508,46 +545,62 @@ TinyMCE_Engine.prototype = {
inst._onAdd(replace_element, form_element_name, target_document);
},
+ removeInstance : function(ti) {
+ var t = [], n, i;
+
+ // Remove from instances
+ for (n in tinyMCE.instances) {
+ i = tinyMCE.instances[n];
+
+ if (tinyMCE.isInstance(i) && ti != i)
+ t[n] = i;
+ }
+
+ tinyMCE.instances = t;
+
+ // Remove from global undo/redo
+ n = [];
+ t = tinyMCE.undoLevels;
+
+ for (i=0; i<t.length; i++) {
+ if (t[i] != ti)
+ n.push(t[i]);
+ }
+
+ tinyMCE.undoLevels = n;
+ tinyMCE.undoIndex = n.length;
+
+ return ti;
+ },
+
removeMCEControl : function(editor_id) {
- var inst = tinyMCE.getInstanceById(editor_id);
+ var inst = tinyMCE.getInstanceById(editor_id), h, re, ot, tn;
if (inst) {
inst.switchSettings();
editor_id = inst.editorId;
- var html = tinyMCE.getContent(editor_id);
+ h = tinyMCE.getContent(editor_id);
- // Remove editor instance from instances array
- var tmpInstances = new Array();
- for (var instanceName in tinyMCE.instances) {
- var instance = tinyMCE.instances[instanceName];
- if (!tinyMCE.isInstance(instance))
- continue;
-
- if (instanceName != editor_id)
- tmpInstances[instanceName] = instance;
- }
- tinyMCE.instances = tmpInstances;
+ this.removeInstance(inst);
tinyMCE.selectedElement = null;
tinyMCE.selectedInstance = null;
// Remove element
- var replaceElement = document.getElementById(editor_id + "_parent");
- var oldTargetElement = inst.oldTargetElement;
- var targetName = oldTargetElement.nodeName.toLowerCase();
-
- if (targetName == "textarea" || targetName == "input") {
- // Just show the old text area
- replaceElement.parentNode.removeChild(replaceElement);
- oldTargetElement.style.display = "inline";
- oldTargetElement.value = html;
+ re = document.getElementById(editor_id + "_parent");
+ ot = inst.oldTargetElement;
+ tn = ot.nodeName.toLowerCase();
+
+ if (tn == "textarea" || tn == "input") {
+ re.parentNode.removeChild(re);
+ ot.style.display = "inline";
+ ot.value = h;
} else {
- oldTargetElement.innerHTML = html;
- oldTargetElement.style.display = 'block';
-
- replaceElement.parentNode.insertBefore(oldTargetElement, replaceElement);
- replaceElement.parentNode.removeChild(replaceElement);
+ ot.innerHTML = h;
+ ot.style.display = 'block';
+ re.parentNode.insertBefore(ot, re);
+ re.parentNode.removeChild(re);
}
}
},
@@ -593,52 +646,75 @@ TinyMCE_Engine.prototype = {
},
execInstanceCommand : function(editor_id, command, user_interface, value, focus) {
- var inst = tinyMCE.getInstanceById(editor_id);
+ var inst = tinyMCE.getInstanceById(editor_id), r;
+
if (inst) {
+ r = inst.selection.getRng();
+
if (typeof(focus) == "undefined")
focus = true;
- if (focus)
+ // IE bug lost focus on images in absolute divs Bug #1534575
+ if (focus && (!r || !r.item))
inst.contentWindow.focus();
// Reset design mode if lost
inst.autoResetDesignMode();
this.selectedElement = inst.getFocusElement();
- this.selectedInstance = inst;
+ inst.select();
tinyMCE.execCommand(command, user_interface, value);
// Cancel event so it doesn't call onbeforeonunlaod
- if (tinyMCE.isMSIE && window.event != null)
+ if (tinyMCE.isIE && window.event != null)
tinyMCE.cancelEvent(window.event);
}
},
execCommand : function(command, user_interface, value) {
+ var inst = tinyMCE.selectedInstance;
+
// Default input
user_interface = user_interface ? user_interface : false;
value = value ? value : null;
- if (tinyMCE.selectedInstance)
- tinyMCE.selectedInstance.switchSettings();
+ if (inst)
+ inst.switchSettings();
switch (command) {
- case 'mceHelp':
- tinyMCE.openWindow({
- file : 'about.htm',
- width : 480,
- height : 380
- }, {
- tinymce_version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion,
- tinymce_releasedate : tinyMCE.releaseDate,
- inline : "yes"
- });
- return;
+ case "Undo":
+ if (this.getParam('custom_undo_redo_global')) {
+ if (this.undoIndex > 0) {
+ tinyMCE.nextUndoRedoAction = 'Undo';
+ inst = this.undoLevels[--this.undoIndex];
+ inst.select();
+
+ if (!tinyMCE.nextUndoRedoInstanceId)
+ inst.execCommand('Undo');
+ }
+ } else
+ inst.execCommand('Undo');
+ return true;
+
+ case "Redo":
+ if (this.getParam('custom_undo_redo_global')) {
+ if (this.undoIndex <= this.undoLevels.length - 1) {
+ tinyMCE.nextUndoRedoAction = 'Redo';
+ inst = this.undoLevels[this.undoIndex++];
+ inst.select();
+
+ if (!tinyMCE.nextUndoRedoInstanceId)
+ inst.execCommand('Redo');
+ }
+ } else
+ inst.execCommand('Redo');
+
+ return true;
case 'mceFocus':
var inst = tinyMCE.getInstanceById(value);
if (inst)
- inst.contentWindow.focus();
+ inst.getWin().focus();
return;
case "mceAddControl":
@@ -657,7 +733,7 @@ TinyMCE_Engine.prototype = {
case "mceResetDesignMode":
// Resets the designmode state of the editors in Gecko
- if (!tinyMCE.isMSIE) {
+ if (!tinyMCE.isIE) {
for (var n in tinyMCE.instances) {
if (!tinyMCE.isInstance(tinyMCE.instances[n]))
continue;
@@ -673,8 +749,8 @@ TinyMCE_Engine.prototype = {
return;
}
- if (this.selectedInstance) {
- this.selectedInstance.execCommand(command, user_interface, value);
+ if (inst) {
+ inst.execCommand(command, user_interface, value);
} else if (tinyMCE.settings['focus_alert'])
alert(tinyMCELang['lang_focus_alert']);
},
@@ -696,17 +772,18 @@ TinyMCE_Engine.prototype = {
if (aw.indexOf('%') == -1) {
aw = parseInt(aw);
- aw = aw < 0 ? 300 : aw;
+ aw = (isNaN(aw) || aw < 0) ? 300 : aw;
aw = aw + "px";
}
if (ah.indexOf('%') == -1) {
ah = parseInt(ah);
- ah = ah < 0 ? 240 : ah;
+ ah = (isNaN(ah) || ah < 0) ? 240 : ah;
ah = ah + "px";
}
iframe.setAttribute("id", id);
+ iframe.setAttribute("name", id);
iframe.setAttribute("class", "mceEditorIframe");
iframe.setAttribute("border", "0");
iframe.setAttribute("frameBorder", "0");
@@ -723,7 +800,7 @@ TinyMCE_Engine.prototype = {
iframe.setAttribute("scrolling", "no");
// Must have a src element in MSIE HTTPs breaks aswell as absoute URLs
- if (tinyMCE.isMSIE && !tinyMCE.isOpera)
+ if (tinyMCE.isRealIE)
iframe.setAttribute("src", this.settings['default_document']);
iframe.style.width = aw;
@@ -734,19 +811,19 @@ TinyMCE_Engine.prototype = {
iframe.style.marginBottom = '-5px';
// MSIE 5.0 issue
- if (tinyMCE.isMSIE && !tinyMCE.isOpera)
+ if (tinyMCE.isRealIE)
replace_element.outerHTML = iframe.outerHTML;
else
replace_element.parentNode.replaceChild(iframe, replace_element);
- if (tinyMCE.isMSIE && !tinyMCE.isOpera)
+ if (tinyMCE.isRealIE)
return win.frames[id];
else
return iframe;
},
setupContent : function(editor_id) {
- var inst = tinyMCE.instances[editor_id];
+ var inst = tinyMCE.instances[editor_id], i;
var doc = inst.getDoc();
var head = doc.getElementsByTagName('head').item(0);
var content = inst.startContent;
@@ -762,7 +839,7 @@ TinyMCE_Engine.prototype = {
inst.switchSettings();
// Not loaded correctly hit it again, Mozilla bug #997860
- if (!tinyMCE.isMSIE && tinyMCE.getParam("setupcontent_reload", false) && doc.title != "blank_page") {
+ if (!tinyMCE.isIE && tinyMCE.getParam("setupcontent_reload", false) && doc.title != "blank_page") {
// This part will remove the designMode status
// Failes first time in Firefox 1.5b2 on Mac
try {doc.location.href = tinyMCE.baseURL + "/blank.htm";} catch (ex) {}
@@ -786,6 +863,14 @@ TinyMCE_Engine.prototype = {
inst.addShortcut('ctrl', 'y', 'lang_redo_desc', 'Redo');
}
+ // BlockFormat shortcuts keys
+ for (i=1; i<=6; i++)
+ inst.addShortcut('ctrl', '' + i, '', 'FormatBlock', false, '<h' + i + '>');
+
+ inst.addShortcut('ctrl', '7', '', 'FormatBlock', false, '<p>');
+ inst.addShortcut('ctrl', '8', '', 'FormatBlock', false, '<div>');
+ inst.addShortcut('ctrl', '9', '', 'FormatBlock', false, '<address>');
+
// Add default shortcuts for gecko
if (tinyMCE.isGecko) {
inst.addShortcut('ctrl', 'b', 'lang_bold_desc', 'Bold');
@@ -795,7 +880,7 @@ TinyMCE_Engine.prototype = {
// Setup span styles
if (tinyMCE.getParam("convert_fonts_to_spans"))
- inst.getDoc().body.setAttribute('id', 'mceSpanFonts');
+ inst.getBody().setAttribute('id', 'mceSpanFonts');
if (tinyMCE.settings['nowrap'])
doc.body.style.whiteSpace = "nowrap";
@@ -804,7 +889,7 @@ TinyMCE_Engine.prototype = {
doc.editorId = editor_id;
// Add on document element in Mozilla
- if (!tinyMCE.isMSIE)
+ if (!tinyMCE.isIE)
doc.documentElement.editorId = editor_id;
inst.setBaseHREF(tinyMCE.settings['base_href']);
@@ -823,7 +908,7 @@ TinyMCE_Engine.prototype = {
content = tinyMCE.storeAwayURLs(content);
content = tinyMCE._customCleanup(inst, "insert_to_editor", content);
- if (tinyMCE.isMSIE) {
+ if (tinyMCE.isIE) {
// Ugly!!!
window.setInterval('try{tinyMCE.getCSSClasses(tinyMCE.instances["' + editor_id + '"].getDoc(), "' + editor_id + '");}catch(e){}', 500);
@@ -837,7 +922,7 @@ TinyMCE_Engine.prototype = {
content = tinyMCE.cleanupHTMLCode(content);
// Fix for bug #958637
- if (!tinyMCE.isMSIE) {
+ if (!tinyMCE.isIE) {
var contentElement = inst.getDoc().createElement("body");
var doc = inst.getDoc();
@@ -849,15 +934,8 @@ TinyMCE_Engine.prototype = {
if (tinyMCE.settings['cleanup_on_startup'])
tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, doc, this.settings, contentElement));
- else {
- // Convert all strong/em to b/i
- content = tinyMCE.regexpReplace(content, "<strong", "<b", "gi");
- content = tinyMCE.regexpReplace(content, "<em(/?)>", "<i$1>", "gi");
- content = tinyMCE.regexpReplace(content, "<em ", "<i ", "gi");
- content = tinyMCE.regexpReplace(content, "</strong>", "</b>", "gi");
- content = tinyMCE.regexpReplace(content, "</em>", "</i>", "gi");
+ else
tinyMCE.setInnerHTML(inst.getBody(), content);
- }
tinyMCE.convertAllRelativeURLs(inst.getBody());
} else {
@@ -881,11 +959,11 @@ TinyMCE_Engine.prototype = {
tinyMCE.dispatchCallback(inst, 'setupcontent_callback', 'setupContent', editor_id, inst.getBody(), inst.getDoc());
// Re-add design mode on mozilla
- if (!tinyMCE.isMSIE)
+ if (!tinyMCE.isIE)
tinyMCE.addEventHandlers(inst);
// Add blur handler
- if (tinyMCE.isMSIE) {
+ if (tinyMCE.isIE) {
tinyMCE.addEvent(inst.getBody(), "blur", TinyMCE_Engine.prototype._eventPatch);
tinyMCE.addEvent(inst.getBody(), "beforedeactivate", TinyMCE_Engine.prototype._eventPatch); // Bug #1439953
@@ -898,7 +976,7 @@ TinyMCE_Engine.prototype = {
}
// Trigger node change, this call locks buttons for tables and so forth
- tinyMCE.selectedInstance = inst;
+ inst.select();
tinyMCE.selectedElement = inst.contentWindow.document.body;
// Call custom DOM cleanup
@@ -917,19 +995,21 @@ TinyMCE_Engine.prototype = {
if (tinyMCE.isGecko) {
// Remove mce_src from textnodes and comments
tinyMCE.selectNodes(inst.getBody(), function(n) {
- if (n.nodeType == 3 || n.nodeType == 8) {
- n.nodeValue = n.nodeValue.replace(new RegExp('\\smce_src=\"[^\"]*\"', 'gi'), "");
- n.nodeValue = n.nodeValue.replace(new RegExp('\\smce_href=\"[^\"]*\"', 'gi'), "");
- }
+ if (n.nodeType == 3 || n.nodeType == 8)
+ n.nodeValue = n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"', 'gi'), "");
return false;
});
}
+ // Remove Gecko spellchecking
+ if (tinyMCE.isGecko)
+ inst.getBody().spellcheck = tinyMCE.getParam("gecko_spellcheck");
+
// Cleanup any mess left from storyAwayURLs
tinyMCE._removeInternal(inst.getBody());
- tinyMCE.selectedInstance = inst;
+ inst.select();
tinyMCE.triggerNodeChange(false, true);
},
@@ -950,42 +1030,14 @@ TinyMCE_Engine.prototype = {
if (tinyMCE.isGecko) {
// Remove mce_src from textnodes and comments
tinyMCE.selectNodes(n, function(n) {
- if (n.nodeType == 3 || n.nodeType == 8) {
- n.nodeValue = n.nodeValue.replace(new RegExp('\\smce_src=\"[^\"]*\"', 'gi'), "");
- n.nodeValue = n.nodeValue.replace(new RegExp('\\smce_href=\"[^\"]*\"', 'gi'), "");
- }
+ if (n.nodeType == 3 || n.nodeType == 8)
+ n.nodeValue = n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"', 'gi'), "");
return false;
});
}
},
- removeTinyMCEFormElements : function(form_obj) {
- // Check if form is valid
- if (typeof(form_obj) == "undefined" || form_obj == null)
- return;
-
- // If not a form, find the form
- if (form_obj.nodeName != "FORM") {
- if (form_obj.form)
- form_obj = form_obj.form;
- else
- form_obj = tinyMCE.getParentElement(form_obj, "form");
- }
-
- // Still nothing
- if (form_obj == null)
- return;
-
- // Disable all UI form elements that TinyMCE created
- for (var i=0; i<form_obj.elements.length; i++) {
- var elementId = form_obj.elements[i].name ? form_obj.elements[i].name : form_obj.elements[i].id;
-
- if (elementId.indexOf('mce_editor_') == 0)
- form_obj.elements[i].disabled = true;
- }
- },
-
handleEvent : function(e) {
var inst = tinyMCE.selectedInstance;
@@ -1016,7 +1068,7 @@ TinyMCE_Engine.prototype = {
// Fixes odd MSIE bug where drag/droping elements in a iframe with height 100% breaks
// This logic forces the width/height to be in pixels while the user is drag/dropping
- if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
+ if (tinyMCE.isRealIE) {
var ife = tinyMCE.selectedInstance.iframeElement;
/*if (ife.style.width.indexOf('%') != -1) {
@@ -1034,13 +1086,12 @@ TinyMCE_Engine.prototype = {
return;
case "submit":
- tinyMCE.removeTinyMCEFormElements(tinyMCE.isMSIE ? window.event.srcElement : e.target);
tinyMCE.triggerSave();
tinyMCE.isNotDirty = true;
return;
case "reset":
- var formObj = tinyMCE.isMSIE ? window.event.srcElement : e.target;
+ var formObj = tinyMCE.isIE ? window.event.srcElement : e.target;
for (var i=0; i<document.forms.length; i++) {
if (document.forms[i] == formObj)
@@ -1054,41 +1105,39 @@ TinyMCE_Engine.prototype = {
return false;
if (e.target.editorId) {
- tinyMCE.selectedInstance = tinyMCE.instances[e.target.editorId];
+ tinyMCE.instances[e.target.editorId].select();
} else {
if (e.target.ownerDocument.editorId)
- tinyMCE.selectedInstance = tinyMCE.instances[e.target.ownerDocument.editorId];
+ tinyMCE.instances[e.target.ownerDocument.editorId].select();
}
if (tinyMCE.selectedInstance)
tinyMCE.selectedInstance.switchSettings();
// Insert P element
- if (tinyMCE.isGecko && tinyMCE.settings['force_p_newlines'] && e.keyCode == 13 && !e.shiftKey) {
+ if ((tinyMCE.isGecko || tinyMCE.isOpera || tinyMCE.isSafari) && tinyMCE.settings['force_p_newlines'] && e.keyCode == 13 && !e.shiftKey) {
// Insert P element instead of BR
if (TinyMCE_ForceParagraphs._insertPara(tinyMCE.selectedInstance, e)) {
// Cancel event
tinyMCE.execCommand("mceAddUndoLevel");
- tinyMCE.cancelEvent(e);
- return false;
+ return tinyMCE.cancelEvent(e);
}
}
// Handle backspace
- if (tinyMCE.isGecko && tinyMCE.settings['force_p_newlines'] && (e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey) {
+ if ((tinyMCE.isGecko && !tinyMCE.isSafari) && tinyMCE.settings['force_p_newlines'] && (e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey) {
// Insert P element instead of BR
if (TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance, e.type)) {
// Cancel event
tinyMCE.execCommand("mceAddUndoLevel");
- tinyMCE.cancelEvent(e);
- return false;
+ return tinyMCE.cancelEvent(e);
}
}
// Return key pressed
- if (tinyMCE.isMSIE && tinyMCE.settings['force_br_newlines'] && e.keyCode == 13) {
+ if (tinyMCE.isIE && tinyMCE.settings['force_br_newlines'] && e.keyCode == 13) {
if (e.target.editorId)
- tinyMCE.selectedInstance = tinyMCE.instances[e.target.editorId];
+ tinyMCE.instances[e.target.editorId].select();
if (tinyMCE.selectedInstance) {
var sel = tinyMCE.selectedInstance.getDoc().selection;
@@ -1132,9 +1181,7 @@ TinyMCE_Engine.prototype = {
return false;
if (e.target.editorId)
- tinyMCE.selectedInstance = tinyMCE.instances[e.target.editorId];
- else
- return;
+ tinyMCE.instances[e.target.editorId].select();
if (tinyMCE.selectedInstance)
tinyMCE.selectedInstance.switchSettings();
@@ -1164,11 +1211,11 @@ TinyMCE_Engine.prototype = {
tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(), true, tinyMCE.settings['visual'], tinyMCE.selectedInstance);
// Fix empty elements on return/enter, check where enter occured
- if (tinyMCE.isMSIE && e.type == "keydown" && e.keyCode == 13)
+ if (tinyMCE.isIE && e.type == "keydown" && e.keyCode == 13)
tinyMCE.enterKeyElement = tinyMCE.selectedInstance.getFocusElement();
// Fix empty elements on return/enter
- if (tinyMCE.isMSIE && e.type == "keyup" && e.keyCode == 13) {
+ if (tinyMCE.isIE && e.type == "keyup" && e.keyCode == 13) {
var elm = tinyMCE.enterKeyElement;
if (elm) {
var re = new RegExp('^HR|IMG|BR$','g'); // Skip these
@@ -1194,8 +1241,9 @@ TinyMCE_Engine.prototype = {
}
// MSIE custom key handling
- if (tinyMCE.isMSIE && tinyMCE.settings['custom_undo_redo']) {
+ if (tinyMCE.isIE && tinyMCE.settings['custom_undo_redo']) {
var keys = new Array(8,46); // Backspace,Delete
+
for (var i=0; i<keys.length; i++) {
if (keys[i] == e.keyCode) {
if (e.type == "keyup")
@@ -1210,9 +1258,15 @@ TinyMCE_Engine.prototype = {
// Handle Undo/Redo when typing content
- // Start typing (non position key)
- if (!posKey && e.type == "keyup")
- tinyMCE.execCommand("mceStartTyping");
+ if (tinyMCE.isGecko) {
+ // Start typing (not a position key or ctrl key, but ctrl+x and ctrl+p is ok)
+ if (!posKey && e.type == "keyup" && !e.ctrlKey || (e.ctrlKey && (e.keyCode == 86 || e.keyCode == 88)))
+ tinyMCE.execCommand("mceStartTyping");
+ } else {
+ // IE seems to be working better with this setting
+ if (!posKey && e.type == "keyup")
+ tinyMCE.execCommand("mceStartTyping");
+ }
// Store undo bookmark
if (e.type == "keydown" && (posKey || e.ctrlKey) && inst)
@@ -1225,13 +1279,14 @@ TinyMCE_Engine.prototype = {
if (posKey && e.type == "keyup")
tinyMCE.triggerNodeChange(false);
- if (tinyMCE.isMSIE && e.ctrlKey)
+ if (tinyMCE.isIE && e.ctrlKey)
window.setTimeout('tinyMCE.triggerNodeChange(false);', 1);
break;
case "mousedown":
case "mouseup":
case "click":
+ case "dblclick":
case "focus":
tinyMCE.hideMenus();
@@ -1241,7 +1296,7 @@ TinyMCE_Engine.prototype = {
}
// Check instance event trigged on
- var targetBody = tinyMCE.getParentElement(e.target, "body");
+ var targetBody = tinyMCE.getParentElement(e.target, "html");
for (var instanceName in tinyMCE.instances) {
if (!tinyMCE.isInstance(tinyMCE.instances[instanceName]))
continue;
@@ -1251,8 +1306,9 @@ TinyMCE_Engine.prototype = {
// Reset design mode if lost (on everything just in case)
inst.autoResetDesignMode();
- if (inst.getBody() == targetBody) {
- tinyMCE.selectedInstance = inst;
+ // Use HTML element since users might click outside of body element
+ if (inst.getBody().parentNode == targetBody) {
+ inst.select();
tinyMCE.selectedElement = e.target;
tinyMCE.linkElement = tinyMCE.getParentElement(tinyMCE.selectedElement, "a");
tinyMCE.imgElement = tinyMCE.getParentElement(tinyMCE.selectedElement, "img");
@@ -1261,30 +1317,9 @@ TinyMCE_Engine.prototype = {
}
// Add first bookmark location
- if (!tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark)
+ if (!tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark && (e.type == "mouseup" || e.type == "dblclick"))
tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark = tinyMCE.selectedInstance.selection.getBookmark();
- if (tinyMCE.isSafari) {
- tinyMCE.selectedInstance.lastSafariSelection = tinyMCE.selectedInstance.selection.getBookmark();
- tinyMCE.selectedInstance.lastSafariSelectedElement = tinyMCE.selectedElement;
-
- var lnk = tinyMCE.getParentElement(tinyMCE.selectedElement, "a");
-
- // Patch the darned link
- if (lnk && e.type == "mousedown") {
- lnk.setAttribute("mce_real_href", lnk.getAttribute("href"));
- lnk.setAttribute("href", "javascript:void(0);");
- }
-
- // Patch back
- if (lnk && e.type == "click") {
- window.setTimeout(function() {
- lnk.setAttribute("href", lnk.getAttribute("mce_real_href"));
- lnk.removeAttribute("mce_real_href");
- }, 10);
- }
- }
-
// Reset selected node
if (e.type != "focus")
tinyMCE.selectedNode = null;
@@ -1297,7 +1332,7 @@ TinyMCE_Engine.prototype = {
// Just in case
if (!tinyMCE.selectedInstance && e.target.editorId)
- tinyMCE.selectedInstance = tinyMCE.instances[e.target.editorId];
+ tinyMCE.instances[e.target.editorId].select();
return false;
break;
@@ -1305,7 +1340,7 @@ TinyMCE_Engine.prototype = {
},
getButtonHTML : function(id, lang, img, cmd, ui, val) {
- var h = '', m, x;
+ var h = '', m, x, io = '';
cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + cmd + '\'';
@@ -1317,16 +1352,20 @@ TinyMCE_Engine.prototype = {
cmd += ');';
+ // Patch for IE7 bug with hover out not restoring correctly
+ if (tinyMCE.isRealIE)
+ io = 'onmouseover="tinyMCE.lastHover = this;"';
+
// Use tilemaps when enabled and found and never in MSIE since it loads the tile each time from cache if cahce is disabled
- if (tinyMCE.getParam('button_tile_map') && (!tinyMCE.isMSIE || tinyMCE.isOpera) && (m = this.buttonMap[id]) != null && (tinyMCE.getParam("language") == "en" || img.indexOf('$lang') == -1)) {
+ if (tinyMCE.getParam('button_tile_map') && (!tinyMCE.isIE || tinyMCE.isOpera) && (m = this.buttonMap[id]) != null && (tinyMCE.getParam("language") == "en" || img.indexOf('$lang') == -1)) {
// Tiled button
x = 0 - (m * 20) == 0 ? '0' : 0 - (m * 20);
- h += '<a id="{$editor_id}_' + id + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceTiledButton mceButtonNormal" target="_self">';
+ h += '<a id="{$editor_id}_' + id + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" ' + io + ' class="mceTiledButton mceButtonNormal" target="_self">';
h += '<img src="{$themeurl}/images/spacer.gif" style="background-position: ' + x + 'px 0" title="{$' + lang + '}" />';
h += '</a>';
} else {
// Normal button
- h += '<a id="{$editor_id}_' + id + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceButtonNormal" target="_self">';
+ h += '<a id="{$editor_id}_' + id + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" ' + io + ' class="mceButtonNormal" target="_self">';
h += '<img src="' + img + '" title="{$' + lang + '}" />';
h += '</a>';
}
@@ -1334,6 +1373,58 @@ TinyMCE_Engine.prototype = {
return h;
},
+ getMenuButtonHTML : function(id, lang, img, mcmd, cmd, ui, val) {
+ var h = '', m, x;
+
+ mcmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + mcmd + '\');';
+ cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + cmd + '\'';
+
+ if (typeof(ui) != "undefined" && ui != null)
+ cmd += ',' + ui;
+
+ if (typeof(val) != "undefined" && val != null)
+ cmd += ",'" + val + "'";
+
+ cmd += ');';
+
+ // Use tilemaps when enabled and found and never in MSIE since it loads the tile each time from cache if cahce is disabled
+ if (tinyMCE.getParam('button_tile_map') && (!tinyMCE.isIE || tinyMCE.isOpera) && (m = tinyMCE.buttonMap[id]) != null && (tinyMCE.getParam("language") == "en" || img.indexOf('$lang') == -1)) {
+ x = 0 - (m * 20) == 0 ? '0' : 0 - (m * 20);
+
+ if (tinyMCE.isRealIE)
+ h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">';
+ else
+ h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton">';
+
+ h += '<a href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceTiledButton mceMenuButtonNormal" target="_self">';
+ h += '<img src="{$themeurl}/images/spacer.gif" style="width: 20px; height: 20px; background-position: ' + x + 'px 0" title="{$' + lang + '}" /></a>';
+ h += '<a href="javascript:' + mcmd + '" onclick="' + mcmd + 'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$' + lang + '}" class="mceMenuButton" />';
+ h += '</a></span>';
+ } else {
+ if (tinyMCE.isRealIE)
+ h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">';
+ else
+ h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton">';
+
+ h += '<a href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceMenuButtonNormal" target="_self">';
+ h += '<img src="' + img + '" title="{$' + lang + '}" /></a>';
+ h += '<a href="javascript:' + mcmd + '" onclick="' + mcmd + 'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$' + lang + '}" class="mceMenuButton" />';
+ h += '</a></span>';
+ }
+
+ return h;
+ },
+
+ _menuButtonEvent : function(e, o) {
+ if (o.className == 'mceMenuButtonFocus')
+ return;
+
+ if (e == 'over')
+ o.className = o.className + ' mceMenuHover';
+ else
+ o.className = o.className.replace(/\s.*$/, '');
+ },
+
addButtonMap : function(m) {
var i, a = m.replace(/\s+/, '').split(',');
@@ -1342,20 +1433,21 @@ TinyMCE_Engine.prototype = {
},
submitPatch : function() {
- tinyMCE.removeTinyMCEFormElements(this);
tinyMCE.triggerSave();
- this.mceOldSubmit();
tinyMCE.isNotDirty = true;
+ this.mceOldSubmit();
},
onLoad : function() {
+ var r;
+
// Wait for everything to be loaded first
if (tinyMCE.settings.strict_loading_mode && this.loadingIndex != -1) {
window.setTimeout('tinyMCE.onLoad();', 1);
return;
}
- if (tinyMCE.isMSIE && !tinyMCE.isOpera && window.event.type == "readystatechange" && document.readyState != "complete")
+ if (tinyMCE.isRealIE && window.event.type == "readystatechange" && document.readyState != "complete")
return true;
if (tinyMCE.isLoaded)
@@ -1363,6 +1455,15 @@ TinyMCE_Engine.prototype = {
tinyMCE.isLoaded = true;
+ // IE produces JS error if TinyMCE is placed in a frame
+ // It seems to have something to do with the selection not beeing
+ // correctly initialized in IE so this hack solves the problem
+ if (tinyMCE.isRealIE && document.body) {
+ r = document.body.createTextRange();
+ r.collapse(true);
+ r.select();
+ }
+
tinyMCE.dispatchCallback(null, 'onpageload', 'onPageLoad');
for (var c=0; c<tinyMCE.configs.length; c++) {
@@ -1403,7 +1504,7 @@ TinyMCE_Engine.prototype = {
var element = tinyMCE._getElementById(elements[i]);
var trigger = element ? element.getAttribute(tinyMCE.settings['textarea_trigger']) : "";
- if (tinyMCE.getAttrib(element, "class").indexOf(deselector) != -1)
+ if (new RegExp('\\b' + deselector + '\\b').test(tinyMCE.getAttrib(element, "class")))
continue;
if (trigger == "false")
@@ -1429,13 +1530,13 @@ TinyMCE_Engine.prototype = {
var elm = nodeList.item(i);
var trigger = elm.getAttribute(tinyMCE.settings['textarea_trigger']);
- if (selector != '' && tinyMCE.getAttrib(elm, "class").indexOf(selector) == -1)
+ if (selector != '' && !new RegExp('\\b' + selector + '\\b').test(tinyMCE.getAttrib(elm, "class")))
continue;
if (selector != '')
trigger = selector != "" ? "true" : "";
- if (tinyMCE.getAttrib(elm, "class").indexOf(deselector) != -1)
+ if (new RegExp('\\b' + deselector + '\\b').test(tinyMCE.getAttrib(elm, "class")))
continue;
if ((mode == "specific_textareas" && trigger == "true") || (mode == "textareas" && trigger != "false"))
@@ -1475,7 +1576,7 @@ TinyMCE_Engine.prototype = {
var inst = tinyMCE.getInstanceById(tinyMCE.settings['auto_focus']);
inst.selection.selectNode(inst.getBody(), true, true);
inst.contentWindow.focus();
- }, 10);
+ }, 100);
}
tinyMCE.dispatchCallback(null, 'oninit', 'onInit');
@@ -1527,8 +1628,10 @@ TinyMCE_Engine.prototype = {
entityDecode : function(s) {
var e = document.createElement("div");
+
e.innerHTML = s;
- return e.innerHTML;
+
+ return e.firstChild.nodeValue;
},
addToLang : function(prefix, ar) {
@@ -1550,23 +1653,19 @@ TinyMCE_Engine.prototype = {
var inst = tinyMCE.selectedInstance;
var editorId = inst.editorId;
var elm = (typeof(setup_content) != "undefined" && setup_content) ? tinyMCE.selectedElement : inst.getFocusElement();
- var undoIndex = -1;
+ var undoIndex = -1, doc;
var undoLevels = -1;
var anySelection = false;
var selectedText = inst.selection.getSelectedText();
+ if (tinyMCE.settings.auto_resize)
+ inst.resizeToContent();
+
if (setup_content && tinyMCE.isGecko && inst.isHidden())
elm = inst.getBody();
inst.switchSettings();
- if (tinyMCE.settings["auto_resize"]) {
- var doc = inst.getDoc();
-
- inst.iframeElement.style.width = doc.body.offsetWidth + "px";
- inst.iframeElement.style.height = doc.body.offsetHeight + "px";
- }
-
if (tinyMCE.selectedElement)
anySelection = (tinyMCE.selectedElement.nodeName.toLowerCase() == "img") || (selectedText && selectedText.length > 0);
@@ -1590,6 +1689,11 @@ TinyMCE_Engine.prototype = {
if (customCleanup != "" && eval("typeof(" + customCleanup + ")") != "undefined")
content = eval(customCleanup + "(type, content, inst);");
+ // Trigger theme cleanup
+ po = tinyMCE.themes[tinyMCE.settings['theme']];
+ if (po && po.cleanup)
+ content = po.cleanup(type, content, inst);
+
// Trigger plugin cleanups
pl = inst.plugins;
for (i=0; i<pl.length; i++) {
@@ -1616,40 +1720,31 @@ TinyMCE_Engine.prototype = {
tinyMCE.loadScript(tinyMCE.baseURL + '/themes/' + name + '/langs/' + tinyMCE.settings['language'] + '.js');
},
- importPluginLanguagePack : function(name, valid_languages) {
- var lang = "en", b = tinyMCE.baseURL + '/plugins/' + name;
-
- valid_languages = valid_languages.split(',');
- for (var i=0; i<valid_languages.length; i++) {
- if (tinyMCE.settings['language'] == valid_languages[i])
- lang = tinyMCE.settings['language'];
- }
+ importPluginLanguagePack : function(name) {
+ var b = tinyMCE.baseURL + '/plugins/' + name;
if (this.plugins[name])
b = this.plugins[name].baseURL;
- tinyMCE.loadScript(b + '/langs/' + lang + '.js');
+ tinyMCE.loadScript(b + '/langs/' + tinyMCE.settings['language'] + '.js');
},
applyTemplate : function(h, as) {
- var i, s, ar = h.match(new RegExp('\\{\\$[a-z0-9_]+\\}', 'gi'));
-
- if (ar && ar.length > 0) {
- for (i=ar.length-1; i>=0; i--) {
- s = ar[i].substring(2, ar[i].length-1);
-
- if (s.indexOf('lang_') == 0 && tinyMCELang[s])
- h = tinyMCE.replaceVar(h, s, tinyMCELang[s]);
- else if (as && as[s])
- h = tinyMCE.replaceVar(h, s, as[s]);
- else if (tinyMCE.settings[s])
- h = tinyMCE.replaceVar(h, s, tinyMCE.settings[s]);
- }
- }
+ return h.replace(new RegExp('\\{\\$([a-z0-9_]+)\\}', 'gi'), function(m, s) {
+ if (s.indexOf('lang_') == 0 && tinyMCELang[s])
+ return tinyMCELang[s];
- h = tinyMCE.replaceVar(h, "themeurl", tinyMCE.themeURL);
+ if (as && as[s])
+ return as[s];
- return h;
+ if (tinyMCE.settings[s])
+ return tinyMCE.settings[s];
+
+ if (m == 'themeurl')
+ return tinyMCE.themeURL;
+
+ return m;
+ });
},
replaceVar : function(h, r, v) {
@@ -1672,7 +1767,7 @@ TinyMCE_Engine.prototype = {
height = 200;
// Add to height in M$ due to SP2 WHY DON'T YOU GUYS IMPLEMENT innerWidth of windows!!
- if (tinyMCE.isMSIE)
+ if (tinyMCE.isIE)
height += 40;
else
height += 20;
@@ -1711,7 +1806,7 @@ TinyMCE_Engine.prototype = {
win.resizeTo(width, height);
win.focus();
} else {
- if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && resizable != 'yes' && tinyMCE.settings["dialog_type"] == "modal") {
+ if ((tinyMCE.isRealIE) && resizable != 'yes' && tinyMCE.settings["dialog_type"] == "modal") {
height += 10;
var features = "resizable:" + resizable
@@ -1823,7 +1918,7 @@ TinyMCE_Engine.prototype = {
if (anchorName != '' && state) {
el.title = anchorName;
- el.className = 'mceItemAnchor';
+ tinyMCE.addCSSClass(el, 'mceItemAnchor');
} else if (anchorName != '' && !state)
el.className = '';
@@ -1870,7 +1965,7 @@ TinyMCE_Engine.prototype = {
*/
fixGeckoBaseHREFBug : function(m, e, h) {
- var nl, i, a, n, xsrc, xhref, el;
+ var xsrc, xhref;
if (tinyMCE.isGecko) {
if (m == 1) {
@@ -1879,38 +1974,40 @@ TinyMCE_Engine.prototype = {
return h;
} else {
- el = new Array('a','img','select','area','iframe','base','input','script','embed','object','link');
+ // Why bother if there is no src or href broken
+ if (!new RegExp('(src|href)=', 'g').test(h))
+ return h;
- for (a=0; a<el.length; a++) {
- n = e.getElementsByTagName(el[a]);
+ // Restore src and href that gets messed up by Gecko
+ tinyMCE.selectElements(e, 'A,IMG,SELECT,AREA,IFRAME,BASE,INPUT,SCRIPT,EMBED,OBJECT,LINK', function (n) {
+ xsrc = tinyMCE.getAttrib(n, "mce_tsrc");
+ xhref = tinyMCE.getAttrib(n, "mce_thref");
- for (i=0; i<n.length; i++) {
- xsrc = tinyMCE.getAttrib(n[i], "mce_tsrc");
- xhref = tinyMCE.getAttrib(n[i], "mce_thref");
-
- if (xsrc != "") {
- try {
- n[i].src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], xsrc);
- } catch (e) {
- // Ignore, Firefox cast exception if local file wasn't found
- }
-
- n[i].removeAttribute("mce_tsrc");
+ if (xsrc != "") {
+ try {
+ n.src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], xsrc);
+ } catch (e) {
+ // Ignore, Firefox cast exception if local file wasn't found
}
- if (xhref != "") {
- try {
- n[i].href = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], xhref);
- } catch (e) {
- // Ignore, Firefox cast exception if local file wasn't found
- }
+ n.removeAttribute("mce_tsrc");
+ }
- n[i].removeAttribute("mce_thref");
+ if (xhref != "") {
+ try {
+ n.href = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], xhref);
+ } catch (e) {
+ // Ignore, Firefox cast exception if local file wasn't found
}
+
+ n.removeAttribute("mce_thref");
}
- }
- el = tinyMCE.selectNodes(e, function(n) {
+ return false;
+ });
+
+ // Restore text/comment nodes
+ tinyMCE.selectNodes(e, function(n) {
if (n.nodeType == 3 || n.nodeType == 8) {
n.nodeValue = n.nodeValue.replace(/\smce_tsrc=/gi, " src=");
n.nodeValue = n.nodeValue.replace(/\smce_thref=/gi, " href=");
@@ -1939,7 +2036,7 @@ TinyMCE_Engine.prototype = {
}
// Content duplication bug fix
- if (tinyMCE.isMSIE && tinyMCE.settings['fix_content_duplication']) {
+ if (tinyMCE.isIE && tinyMCE.settings['fix_content_duplication']) {
// Remove P elements in P elements
var paras = doc.getElementsByTagName("P");
for (var i=0; i<paras.length; i++) {
@@ -2065,7 +2162,7 @@ TinyMCE_Engine.prototype = {
var csses = null;
// Just ignore any errors
- eval("try {var csses = tinyMCE.isMSIE ? doc.styleSheets(" + x + ").rules : styles[" + x + "].cssRules;} catch(e) {}");
+ eval("try {var csses = tinyMCE.isIE ? doc.styleSheets(" + x + ").rules : styles[" + x + "].cssRules;} catch(e) {}");
if (!csses)
return new Array();
@@ -2158,7 +2255,7 @@ TinyMCE_Engine.prototype = {
return '';
},
- evalFunc : function(f, idx, a) {
+ evalFunc : function(f, idx, a, o) {
var s = '(', i;
for (i=idx; i<a.length; i++) {
@@ -2170,7 +2267,7 @@ TinyMCE_Engine.prototype = {
s += ');';
- return eval("f" + s);
+ return o ? eval("o." + f + s) : eval("f" + s);
},
dispatchCallback : function(i, p, n) {
@@ -2199,7 +2296,7 @@ TinyMCE_Engine.prototype = {
for (i=0, l = ins.plugins; i<l.length; i++) {
o = tinyMCE.plugins[l[i]];
- if (o[n] && (v = tinyMCE.evalFunc(o[n], 3, a)) == s && m > 0)
+ if (o[n] && (v = tinyMCE.evalFunc(n, 3, a, o)) == s && m > 0)
return true;
}
}
@@ -2208,7 +2305,7 @@ TinyMCE_Engine.prototype = {
for (on in l) {
o = l[on];
- if (o[n] && (v = tinyMCE.evalFunc(o[n], 3, a)) == s && m > 0)
+ if (o[n] && (v = tinyMCE.evalFunc(n, 3, a, o)) == s && m > 0)
return true;
}
@@ -2216,14 +2313,26 @@ TinyMCE_Engine.prototype = {
},
xmlEncode : function(s) {
- s = "" + s;
- s = s.replace(/&/g, '&amp;');
- s = s.replace(new RegExp('"', 'g'), '&quot;');
- s = s.replace(/\'/g, '&#39;'); // &apos; is not working in MSIE
- s = s.replace(/</g, '&lt;');
- s = s.replace(/>/g, '&gt;');
+ return s ? ('' + s).replace(new RegExp('[<>&"\']', 'g'), function (c, b) {
+ switch (c) {
+ case '&':
+ return '&amp;';
- return s;
+ case '"':
+ return '&quot;';
+
+ case '\'':
+ return '&#39;'; // &apos; is not working in MSIE
+
+ case '<':
+ return '&lt;';
+
+ case '>':
+ return '&gt;';
+ }
+
+ return c;
+ }) : s;
},
extend : function(p, np) {
@@ -2252,19 +2361,9 @@ TinyMCE_Engine.prototype = {
tinyMCE.switchClass(e, tinyMCE.lastMenuBtnClass);
tinyMCE.lastSelectedMenuBtn = null;
}
- },
-
- explode : function(d, s) {
- var ar = s.split(d), oar = new Array(), i;
-
- for (i = 0; i<ar.length; i++) {
- if (ar[i] != "")
- oar[oar.length] = ar[i];
- }
-
- return oar;
}
-};
+
+ };
// Global instances
var TinyMCE = TinyMCE_Engine; // Compatiblity with gzip compressors
@@ -2289,10 +2388,13 @@ function TinyMCE_Control(settings) {
this.cleanup = new TinyMCE_Cleanup();
this.shortcuts = new Array();
this.hasMouseMoved = false;
+ this.foreColor = this.backColor = "#999999";
+ this.data = {};
this.cleanup.init({
valid_elements : s.valid_elements,
extended_valid_elements : s.extended_valid_elements,
+ valid_child_elements : s.valid_child_elements,
entities : s.entities,
entity_encoding : s.entity_encoding,
debug : s.cleanup_debug,
@@ -2345,6 +2447,21 @@ function TinyMCE_Control(settings) {
};
TinyMCE_Control.prototype = {
+ selection : null,
+
+ settings : null,
+
+ cleanup : null,
+
+ getData : function(na) {
+ var o = this.data[na];
+
+ if (!o)
+ o = this.data[na] = {};
+
+ return o;
+ },
+
hasPlugin : function(n) {
var i;
@@ -2364,12 +2481,14 @@ TinyMCE_Control.prototype = {
},
repaint : function() {
- if (tinyMCE.isMSIE && !tinyMCE.isOpera)
+ var s, b, ex;
+
+ if (tinyMCE.isRealIE)
return;
try {
- var s = this.selection;
- var b = s.getBookmark(true);
+ s = this.selection;
+ b = s.getBookmark(true);
this.getBody().style.display = 'none';
this.getDoc().execCommand('selectall', false, null);
this.getSel().collapseToStart();
@@ -2387,11 +2506,24 @@ TinyMCE_Control.prototype = {
}
},
+ select : function() {
+ var oldInst = tinyMCE.selectedInstance;
+
+ if (oldInst != this) {
+ if (oldInst)
+ oldInst.execCommand('mceEndTyping');
+
+ tinyMCE.dispatchCallback(this, 'select_instance_callback', 'selectInstance', this, oldInst);
+ tinyMCE.selectedInstance = this;
+ }
+ },
+
getBody : function() {
- return this.getDoc().body;
+ return this.contentBody ? this.contentBody : this.getDoc().body;
},
getDoc : function() {
+// return this.contentDocument ? this.contentDocument : this.contentWindow.document; // Removed due to IE 5.5 ?
return this.contentWindow.document;
},
@@ -2399,9 +2531,34 @@ TinyMCE_Control.prototype = {
return this.contentWindow;
},
+ getContainerWin : function() {
+ return this.containerWindow ? this.containerWindow : window;
+ },
+
+ getViewPort : function() {
+ return tinyMCE.getViewPort(this.getWin());
+ },
+
+ getParentNode : function(n, f) {
+ return tinyMCE.getParentNode(n, f, this.getBody());
+ },
+
+ getParentElement : function(n, na, f) {
+ return tinyMCE.getParentElement(n, na, f, this.getBody());
+ },
+
+ getParentBlockElement : function(n) {
+ return tinyMCE.getParentBlockElement(n, this.getBody());
+ },
+
+ resizeToContent : function() {
+ var d = this.getDoc(), b = d.body, de = d.documentElement;
+
+ this.iframeElement.style.height = (tinyMCE.isRealIE) ? b.scrollHeight : de.offsetHeight + 'px';
+ },
+
addShortcut : function(m, k, d, cmd, ui, va) {
- var n = typeof(k) == "number", ie = tinyMCE.isMSIE, c, sc, i;
- var scl = this.shortcuts;
+ var n = typeof(k) == "number", ie = tinyMCE.isIE, c, sc, i, scl = this.shortcuts;
if (!tinyMCE.getParam('custom_shortcuts'))
return false;
@@ -2440,6 +2597,7 @@ TinyMCE_Control.prototype = {
for (i=0; i<s.length; i++) {
o = s[i];
+
if (o.alt == e.altKey && o.ctrl == e.ctrlKey && (o.keyCode == e.keyCode || o.charCode == e.charCode)) {
if (o.cmd && (e.type == "keydown" || (e.type == "keypress" && !tinyMCE.isOpera)))
tinyMCE.execCommand(o.cmd, o.ui, o.val);
@@ -2454,15 +2612,17 @@ TinyMCE_Control.prototype = {
autoResetDesignMode : function() {
// Add fix for tab/style.display none/block problems in Gecko
- if (!tinyMCE.isMSIE && this.isHidden() && tinyMCE.getParam('auto_reset_designmode'))
- eval('try { this.getDoc().designMode = "On"; } catch(e) {}');
+ if (!tinyMCE.isIE && this.isHidden() && tinyMCE.getParam('auto_reset_designmode'))
+ eval('try { this.getDoc().designMode = "On"; this.useCSS = false; } catch(e) {}');
},
isHidden : function() {
- if (tinyMCE.isMSIE)
+ var s;
+
+ if (tinyMCE.isIE)
return false;
- var s = this.getSel();
+ s = this.getSel();
// Weird, wheres that cursor selection?
return (!s || !s.rangeCount || s.rangeCount == 0);
@@ -2470,7 +2630,7 @@ TinyMCE_Control.prototype = {
isDirty : function() {
// Is content modified and not in a submit procedure
- return this.startContent != tinyMCE.trim(this.getBody().innerHTML) && !tinyMCE.isNotDirty;
+ return tinyMCE.trim(this.startContent) != tinyMCE.trim(this.getBody().innerHTML) && !tinyMCE.isNotDirty;
},
_mergeElements : function(scmd, pa, ch, override) {
@@ -2486,7 +2646,8 @@ TinyMCE_Control.prototype = {
var stc = tinyMCE.parseStyle(tinyMCE.getAttrib(ch, "style"));
var className = tinyMCE.getAttrib(pa, "class");
- className += " " + tinyMCE.getAttrib(ch, "class");
+ // Removed class adding due to bug #1478272
+ className = tinyMCE.getAttrib(ch, "class");
if (override) {
for (var n in st) {
@@ -2526,21 +2687,14 @@ TinyMCE_Control.prototype = {
},
execCommand : function(command, user_interface, value) {
- var doc = this.getDoc();
- var win = this.getWin();
- var focusElm = this.getFocusElement();
+ var doc = this.getDoc(), win = this.getWin(), focusElm = this.getFocusElement();
- // Is non udno specific command
+ // Is not a undo specific command
if (!new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel', 'gi').test(command))
this.undoBookmark = null;
- if (this.lastSafariSelection && !new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel', 'gi').test(command)) {
- this.selection.moveToBookmark(this.lastSafariSelection);
- tinyMCE.selectedElement = this.lastSafariSelectedElement;
- }
-
// Mozilla issue
- if (!tinyMCE.isMSIE && !this.useCSS) {
+ if (!tinyMCE.isIE && !this.useCSS) {
this._setUseCSS(false);
this.useCSS = true;
}
@@ -2654,24 +2808,39 @@ TinyMCE_Control.prototype = {
this.repaint();
return true;
- case "InsertUnorderedList":
- case "InsertOrderedList":
- var tag = (command == "InsertUnorderedList") ? "ul" : "ol";
+ case "unlink":
+ // Unlink if caret is inside link
+ if (tinyMCE.isGecko && this.getSel().isCollapsed) {
+ focusElm = tinyMCE.getParentElement(focusElm, 'A');
- if (tinyMCE.isSafari)
- this.execCommand("mceInsertContent", false, "<" + tag + "><li>&nbsp;</li><" + tag + ">");
- else
- this.getDoc().execCommand(command, user_interface, value);
+ if (focusElm)
+ this.selection.selectNode(focusElm, false);
+ }
+
+ this.getDoc().execCommand(command, user_interface, value);
+
+ tinyMCE.isGecko && this.getSel().collapseToEnd();
tinyMCE.triggerNodeChange();
+
+ return true;
+
+ case "FormatBlock":
+ if (!this.cleanup.isValid(value))
+ return true;
+
+ this.getDoc().execCommand(command, user_interface, value);
+ tinyMCE.triggerNodeChange();
break;
- case "Strikethrough":
- if (tinyMCE.isSafari)
- this.execCommand("mceInsertContent", false, "<strike>" + this.selection.getSelectedHTML() + "</strike>");
- else
- this.getDoc().execCommand(command, user_interface, value);
+ case "InsertUnorderedList":
+ case "InsertOrderedList":
+ this.getDoc().execCommand(command, user_interface, value);
+ tinyMCE.triggerNodeChange();
+ break;
+ case "Strikethrough":
+ this.getDoc().execCommand(command, user_interface, value);
tinyMCE.triggerNodeChange();
break;
@@ -2691,7 +2860,7 @@ TinyMCE_Control.prototype = {
if (tinyMCE.isGecko && new RegExp('<(div|blockquote|code|dt|dd|dl|samp)>', 'gi').test(value))
value = value.replace(/[^a-z]/gi, '');
- if (tinyMCE.isMSIE && new RegExp('blockquote|code|samp', 'gi').test(value)) {
+ if (tinyMCE.isIE && new RegExp('blockquote|code|samp', 'gi').test(value)) {
var b = this.selection.getBookmark();
this.getDoc().execCommand("FormatBlock", false, '<p>');
tinyMCE.renameElement(tinyMCE.getParentBlockElement(this.getFocusElement()), value);
@@ -2708,7 +2877,7 @@ TinyMCE_Control.prototype = {
if (!value)
value = tinyMCE.getParentElement(this.getFocusElement());
- if (tinyMCE.isMSIE) {
+ if (tinyMCE.isIE) {
value.outerHTML = value.innerHTML;
} else {
var rng = value.ownerDocument.createRange();
@@ -2759,7 +2928,7 @@ TinyMCE_Control.prototype = {
var invalidParentsRe = tinyMCE.settings['merge_styles_invalid_parents'] != '' ? new RegExp(tinyMCE.settings['merge_styles_invalid_parents'], "gi") : null;
// Whole element selected check
- if (tinyMCE.isMSIE) {
+ if (tinyMCE.isIE) {
// Control range
if (rng.item)
parentElm = rng.item(0);
@@ -2953,10 +3122,20 @@ TinyMCE_Control.prototype = {
return;
case "forecolor":
+ value = value == null ? this.foreColor : value;
+ value = tinyMCE.trim(value);
+ value = value.charAt(0) != '#' ? (isNaN('0x' + value) ? value : '#' + value) : value;
+
+ this.foreColor = value;
this.getDoc().execCommand('forecolor', false, value);
break;
case "HiliteColor":
+ value = value == null ? this.backColor : value;
+ value = tinyMCE.trim(value);
+ value = value.charAt(0) != '#' ? (isNaN('0x' + value) ? value : '#' + value) : value;
+ this.backColor = value;
+
if (tinyMCE.isGecko) {
this._setUseCSS(true);
this.getDoc().execCommand('hilitecolor', false, value);
@@ -2994,9 +3173,14 @@ TinyMCE_Control.prototype = {
// Call custom cleanup code
value = tinyMCE.storeAwayURLs(value);
value = tinyMCE._customCleanup(this, "insert_to_editor", value);
- tinyMCE._setHTML(doc, value);
- tinyMCE.setInnerHTML(doc.body, tinyMCE._cleanupHTML(this, doc, tinyMCE.settings, doc.body));
- tinyMCE.convertAllRelativeURLs(doc.body);
+
+ if (this.getBody().nodeName == 'BODY')
+ tinyMCE._setHTML(doc, value);
+ else
+ this.getBody().innerHTML = value;
+
+ tinyMCE.setInnerHTML(this.getBody(), tinyMCE._cleanupHTML(this, doc, this.settings, this.getBody(), false, false, false, true));
+ tinyMCE.convertAllRelativeURLs(this.getBody());
// Cleanup any mess left from storyAwayURLs
tinyMCE._removeInternal(this.getBody());
@@ -3005,8 +3189,8 @@ TinyMCE_Control.prototype = {
if (tinyMCE.getParam("convert_fonts_to_spans"))
tinyMCE.convertSpansToFonts(doc);
- tinyMCE.handleVisualAid(doc.body, true, this.visualAid, this);
- tinyMCE._setEventsEnabled(doc.body, false);
+ tinyMCE.handleVisualAid(this.getBody(), true, this.visualAid, this);
+ tinyMCE._setEventsEnabled(this.getBody(), false);
return true;
case "mceCleanup":
@@ -3035,7 +3219,7 @@ TinyMCE_Control.prototype = {
var selectedText = "";
- if (tinyMCE.isMSIE) {
+ if (tinyMCE.isIE) {
var rng = doc.selection.createRange();
selectedText = rng.text;
} else
@@ -3074,8 +3258,8 @@ TinyMCE_Control.prototype = {
this.execCommand('mceInsertContent', false, key);
// Store away scroll pos
- var scrollX = this.getDoc().body.scrollLeft + this.getDoc().documentElement.scrollLeft;
- var scrollY = this.getDoc().body.scrollTop + this.getDoc().documentElement.scrollTop;
+ var scrollX = this.getBody().scrollLeft + this.getDoc().documentElement.scrollLeft;
+ var scrollY = this.getBody().scrollTop + this.getDoc().documentElement.scrollTop;
// Find marker and replace with RAW HTML
var html = this.getBody().innerHTML;
@@ -3095,7 +3279,9 @@ TinyMCE_Control.prototype = {
value = '';
var insertHTMLFailed = false;
- this.getWin().focus();
+
+ // Removed since it produced problems in IE
+ // this.getWin().focus();
if (tinyMCE.isGecko || tinyMCE.isOpera) {
try {
@@ -3131,15 +3317,7 @@ TinyMCE_Control.prototype = {
}
}
- // Ugly hack in Opera due to non working "inserthtml"
- if (tinyMCE.isOpera && insertHTMLFailed) {
- this.getDoc().execCommand("insertimage", false, tinyMCE.uniqueURL);
- var ar = tinyMCE.getElementsByAttributeValue(this.getBody(), "img", "src", tinyMCE.uniqueURL);
- ar[0].outerHTML = value;
- return;
- }
-
- if (!tinyMCE.isMSIE) {
+ if (!tinyMCE.isIE) {
var isHTML = value.indexOf('<') != -1;
var sel = this.getSel();
var rng = this.getRng();
@@ -3200,18 +3378,23 @@ TinyMCE_Control.prototype = {
tinyMCE.fixGeckoBaseHREFBug(2, this.getDoc(), value);
} else {
- var rng = doc.selection.createRange();
+ var rng = doc.selection.createRange(), tmpRng = null;
var c = value.indexOf('<!--') != -1;
// Fix comment bug, add tag before comments
if (c)
value = tinyMCE.uniqueTag + value;
+ // tmpRng = rng.duplicate(); // Store away range (Fixes Undo bookmark bug in IE)
+
if (rng.item)
rng.item(0).outerHTML = value;
else
rng.pasteHTML(value);
+ //if (tmpRng)
+ // tmpRng.select(); // Restore range (Fixes Undo bookmark bug in IE)
+
// Remove unique tag
if (c) {
var e = this.getDoc().getElementById('mceTMPElement');
@@ -3219,14 +3402,15 @@ TinyMCE_Control.prototype = {
}
}
+ tinyMCE.execCommand("mceAddUndoLevel");
tinyMCE.triggerNodeChange();
break;
case "mceStartTyping":
if (tinyMCE.settings['custom_undo_redo'] && this.undoRedo.typingUndoIndex == -1) {
this.undoRedo.typingUndoIndex = this.undoRedo.undoIndex;
+ tinyMCE.typingUndoIndex = tinyMCE.undoIndex;
this.execCommand('mceAddUndoLevel');
- //tinyMCE.debug("mceStartTyping");
}
break;
@@ -3234,8 +3418,9 @@ TinyMCE_Control.prototype = {
if (tinyMCE.settings['custom_undo_redo'] && this.undoRedo.typingUndoIndex != -1) {
this.execCommand('mceAddUndoLevel');
this.undoRedo.typingUndoIndex = -1;
- //tinyMCE.debug("mceEndTyping");
}
+
+ tinyMCE.typingUndoIndex = -1;
break;
case "mceBeginUndoLevel":
@@ -3281,7 +3466,8 @@ TinyMCE_Control.prototype = {
case "Indent":
this.getDoc().execCommand(command, user_interface, value);
tinyMCE.triggerNodeChange();
- if (tinyMCE.isMSIE) {
+
+ if (tinyMCE.isIE) {
var n = tinyMCE.getParentElement(this.getFocusElement(), "blockquote");
do {
if (n && n.nodeName == "BLOCKQUOTE") {
@@ -3300,7 +3486,7 @@ TinyMCE_Control.prototype = {
return;
}
- if (tinyMCE.isMSIE) {
+ if (tinyMCE.isIE) {
try {
var rng = doc.selection.createRange();
rng.execCommand("RemoveFormat", false, null);
@@ -3406,21 +3592,30 @@ TinyMCE_Control.prototype = {
this.settings['area_width'] += deltaWidth;
this.settings['area_height'] += deltaHeight;
+ this.settings['width_style'] = "" + this.settings['width'];
+ this.settings['height_style'] = "" + this.settings['height'];
+
// Special % handling
if (("" + this.settings['width']).indexOf('%') != -1)
this.settings['area_width'] = "100%";
+ else
+ this.settings['width_style'] += 'px';
if (("" + this.settings['height']).indexOf('%') != -1)
this.settings['area_height'] = "100%";
+ else
+ this.settings['height_style'] += 'px';
if (("" + replace_element.style.width).indexOf('%') != -1) {
this.settings['width'] = replace_element.style.width;
this.settings['area_width'] = "100%";
+ this.settings['width_style'] = "100%";
}
if (("" + replace_element.style.height).indexOf('%') != -1) {
this.settings['height'] = replace_element.style.height;
this.settings['area_height'] = "100%";
+ this.settings['height_style'] = "100%";
}
html = tinyMCE.applyTemplate(html);
@@ -3489,7 +3684,7 @@ TinyMCE_Control.prototype = {
var dynamicIFrame = false;
var tElm = targetDoc.getElementById(this.editorId);
- if (!tinyMCE.isMSIE) {
+ if (!tinyMCE.isIE) {
// Node case is preserved in XML strict mode
if (tElm && (tElm.nodeName == "SPAN" || tElm.nodeName == "span")) {
tElm = tinyMCE._createIFrame(tElm, targetDoc);
@@ -3543,7 +3738,7 @@ TinyMCE_Control.prototype = {
// This timeout is needed in MSIE 5.5 for some odd reason
// it seems that the document.frames isn't initialized yet?
- if (tinyMCE.isMSIE)
+ if (tinyMCE.isIE)
window.setTimeout("tinyMCE.addEventHandlers(tinyMCE.instances[\"" + this.editorId + "\"]);", 1);
tinyMCE.setupContent(this.editorId, true);
@@ -3573,6 +3768,25 @@ TinyMCE_Control.prototype = {
}
},
+ getHTML : function(r) {
+ var h, d = this.getDoc(), b = this.getBody();
+
+ if (r)
+ return b.innerHTML;
+
+ h = tinyMCE._cleanupHTML(this, d, this.settings, b, false, true, false, true);
+
+ if (tinyMCE.getParam("convert_fonts_to_spans"))
+ tinyMCE.convertSpansToFonts(d);
+
+ return h;
+ },
+
+ setHTML : function(h) {
+ this.execCommand('mceSetContent', false, h);
+ this.repaint();
+ },
+
getFocusElement : function() {
return this.selection.getFocusElement();
},
@@ -3586,13 +3800,13 @@ TinyMCE_Control.prototype = {
},
triggerSave : function(skip_cleanup, skip_callback) {
- var e, nl = new Array(), i, s;
+ var e, nl = [], i, s;
this.switchSettings();
s = tinyMCE.settings;
// Force hidden tabs visible while serializing
- if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
+ if (tinyMCE.isRealIE) {
e = this.iframeElement;
do {
@@ -3658,7 +3872,8 @@ TinyMCE_Control.prototype = {
nl[i].elm.className = s.hidden_tab_class;
}
}
-};
+
+ };
/* file:jscripts/tiny_mce/classes/TinyMCE_Cleanup.class.js */
@@ -3679,12 +3894,17 @@ TinyMCE_Engine.prototype.cleanupHTMLCode = function(s) {
s = s.replace(new RegExp('<(img|br|hr)([^>]*)><\\/(img|br|hr)>', 'gi'), '<$1$2 />');
// Weird MSIE bug, <p><hr /></p> breaks runtime?
- if (tinyMCE.isMSIE)
+ if (tinyMCE.isIE)
s = s.replace(new RegExp('<p><hr \\/><\\/p>', 'gi'), "<hr>");
+ // Weird tags will make IE error #bug: 1538495
+ if (tinyMCE.isIE)
+ s = s.replace(/<!(\s*)\/>/g, '');
+
// Convert relative anchors to absolute URLs ex: #something to file.htm#something
- if (tinyMCE.getParam('convert_urls'))
- s = s.replace(new RegExp('(href=\"{0,1})(\\s*#)', 'gi'), '$1' + tinyMCE.settings['document_base_url'] + "#");
+ // Removed: Since local document anchors should never be forced absolute example edit.php?id=something
+ //if (tinyMCE.getParam('convert_urls'))
+ // s = s.replace(new RegExp('(href=\"{0,1})(\\s*#)', 'gi'), '$1' + tinyMCE.settings['document_base_url'] + "#");
return s;
};
@@ -3826,7 +4046,7 @@ TinyMCE_Engine.prototype.convertSpansToFonts = function(doc) {
var h = doc.body.innerHTML;
h = h.replace(/<span/gi, '<font');
h = h.replace(/<\/span/gi, '</font');
- doc.body.innerHTML = h;
+ tinyMCE.setInnerHTML(doc.body, h);
var s = doc.getElementsByTagName("font");
for (var i=0; i<s.length; i++) {
@@ -3865,7 +4085,7 @@ TinyMCE_Engine.prototype.convertFontsToSpans = function(doc) {
var h = doc.body.innerHTML;
h = h.replace(/<font/gi, '<span');
h = h.replace(/<\/font/gi, '</span');
- doc.body.innerHTML = h;
+ tinyMCE.setInnerHTML(doc.body, h);
var fsClasses = tinyMCE.getParam('font_size_classes');
if (fsClasses != '')
@@ -3921,20 +4141,11 @@ TinyMCE_Engine.prototype.cleanupAnchors = function(doc) {
};
TinyMCE_Engine.prototype.getContent = function(editor_id) {
- var h;
-
if (typeof(editor_id) != "undefined")
- tinyMCE.selectedInstance = tinyMCE.getInstanceById(editor_id);
+ tinyMCE.getInstanceById(editor_id).select();
- if (tinyMCE.selectedInstance) {
- h = tinyMCE._cleanupHTML(this.selectedInstance, this.selectedInstance.getDoc(), tinyMCE.settings, this.selectedInstance.getBody(), false, true);
-
- // When editing always use fonts internaly
- if (tinyMCE.getParam("convert_fonts_to_spans"))
- tinyMCE.convertSpansToFonts(this.selectedInstance.getDoc());
-
- return h;
- }
+ if (tinyMCE.selectedInstance)
+ return tinyMCE.selectedInstance.getHTML();
return null;
};
@@ -3986,8 +4197,8 @@ TinyMCE_Engine.prototype._fixTables = function(d) {
}
};
-TinyMCE_Engine.prototype._cleanupHTML = function(inst, doc, config, elm, visual, on_save, on_submit) {
- var h, d, t1, t2, t3, t4, t5, c, s;
+TinyMCE_Engine.prototype._cleanupHTML = function(inst, doc, config, elm, visual, on_save, on_submit, inn) {
+ var h, d, t1, t2, t3, t4, t5, c, s, nb;
if (!tinyMCE.getParam('cleanup'))
return elm.innerHTML;
@@ -4025,25 +4236,28 @@ TinyMCE_Engine.prototype._cleanupHTML = function(inst, doc, config, elm, visual,
c.sourceIndex = -1;
if (s.cleanup_serializer == "xml")
- h = c.serializeNodeAsXML(elm);
+ h = c.serializeNodeAsXML(elm, inn);
else
- h = c.serializeNodeAsHTML(elm);
+ h = c.serializeNodeAsHTML(elm, inn);
if (d)
t3 = new Date().getTime();
// Post processing
+ nb = tinyMCE.getParam('entity_encoding') == 'numeric' ? '&#160;' : '&nbsp;';
h = h.replace(/<\/?(body|head|html)[^>]*>/gi, '');
h = h.replace(new RegExp(' (rowspan="1"|colspan="1")', 'g'), '');
h = h.replace(/<p><hr \/><\/p>/g, '<hr />');
h = h.replace(/<p>(&nbsp;|&#160;)<\/p><hr \/><p>(&nbsp;|&#160;)<\/p>/g, '<hr />');
- h = h.replace(/<td>\s*<br \/>\s*<\/td>/g, '<td>&nbsp;</td>');
- h = h.replace(/<p>\s*<br \/>\s*<\/p>/g, '<p>&nbsp;</p>');
- h = h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*(&nbsp;|&#160;)\s*<\/p>/g, '<p>&nbsp;</p>');
- h = h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*<\/p>/g, '<p>&nbsp;</p>');
- h = h.replace(/<p>\s*<br \/>\s*&nbsp;\s*<\/p>/g, '<p>&nbsp;</p>');
+ h = h.replace(/<td>\s*<br \/>\s*<\/td>/g, '<td>' + nb + '</td>');
+ h = h.replace(/<p>\s*<br \/>\s*<\/p>/g, '<p>' + nb + '</p>');
+ h = h.replace(/<br \/>$/, ''); // Remove last BR for Gecko
+ h = h.replace(/<br \/><\/p>/g, '</p>'); // Remove last BR in P tags for Gecko
+ h = h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*(&nbsp;|&#160;)\s*<\/p>/g, '<p>' + nb + '</p>');
+ h = h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*<\/p>/g, '<p>' + nb + '</p>');
+ h = h.replace(/<p>\s*<br \/>\s*&nbsp;\s*<\/p>/g, '<p>' + nb + '</p>');
h = h.replace(new RegExp('<a>(.*?)<\\/a>', 'g'), '$1');
- h = h.replace(/<p([^>]*)>\s*<\/p>/g, '<p$1>&nbsp;</p>');
+ h = h.replace(/<p([^>]*)>\s*<\/p>/g, '<p$1>' + nb + '</p>');
// Clean body
if (/^\s*(<br \/>|<p>&nbsp;<\/p>|<p>&#160;<\/p>|<p><\/p>)\s*$/.test(h))
@@ -4059,7 +4273,7 @@ TinyMCE_Engine.prototype._cleanupHTML = function(inst, doc, config, elm, visual,
// Gecko specific processing
if (tinyMCE.isGecko) {
h = h.replace(/<o:p _moz-userdefined="" \/>/g, '');
- h = h.replace(/<td([^>]*)>\s*<br \/>\s*<\/td>/g, '<td$1>&nbsp;</td>');
+ h = h.replace(/<td([^>]*)>\s*<br \/>\s*<\/td>/g, '<td$1>' + nb + '</td>');
}
if (s.force_br_newlines)
@@ -4097,7 +4311,7 @@ TinyMCE_Engine.prototype._cleanupHTML = function(inst, doc, config, elm, visual,
};
function TinyMCE_Cleanup() {
- this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
+ this.isIE = (navigator.appName == "Microsoft Internet Explorer");
this.rules = tinyMCE.clearArray(new Array());
// Default config
@@ -4118,7 +4332,7 @@ function TinyMCE_Cleanup() {
this.vElements = tinyMCE.clearArray(new Array());
this.vElementsRe = '';
- this.closeElementsRe = /^(IMG|BR|HR|LINK|META|BASE|INPUT|BUTTON|AREA)$/;
+ this.closeElementsRe = /^(IMG|BR|HR|LINK|META|BASE|INPUT|AREA)$/;
this.codeElementsRe = /^(SCRIPT|STYLE)$/;
this.serializationId = 0;
this.mceAttribs = {
@@ -4144,6 +4358,7 @@ TinyMCE_Cleanup.prototype = {
this.nlBeforeRe = this._arrayToRe(s.newline_before_elements.split(','), 'gi', '<(', ')([^>]*)>');
this.nlAfterRe = this._arrayToRe(s.newline_after_elements.split(','), 'gi', '<(', ')([^>]*)>');
this.nlBeforeAfterRe = this._arrayToRe(s.newline_before_after_elements.split(','), 'gi', '<(\\/?)(', ')([^>]*)>');
+ this.serializedNodes = [];
if (s.invalid_elements != '')
this.iveRe = this._arrayToRe(s.invalid_elements.toUpperCase().split(','), 'g', '^(', ')$');
@@ -4186,6 +4401,71 @@ TinyMCE_Cleanup.prototype = {
this.vElementsRe = this._arrayToRe(this.vElements, '');
},
+ isValid : function(n) {
+ this._setupRules(); // Will initialize cleanup rules
+
+ // Clean the name up a bit
+ n = n.replace(/[^a-z0-9]+/gi, '').toUpperCase();
+
+ return !tinyMCE.getParam('cleanup') || this.vElementsRe.test(n);
+ },
+
+ addChildRemoveRuleStr : function(s) {
+ var x, y, p, i, t, tn, ta, cl, r;
+
+ if (!s)
+ return;
+
+ ta = s.split(',');
+ for (x=0; x<ta.length; x++) {
+ s = ta[x];
+
+ // Split tag/children
+ p = this.split(/\[|\]/, s);
+ if (p == null || p.length < 1)
+ t = s.toUpperCase();
+ else
+ t = p[0].toUpperCase();
+
+ // Handle all tag names
+ tn = this.split('/', t);
+ for (y=0; y<tn.length; y++) {
+ r = "^(";
+
+ // Build regex
+ cl = this.split(/\|/, p[1]);
+ for (i=0; i<cl.length; i++) {
+ if (cl[i] == '%istrict')
+ r += tinyMCE.inlineStrict;
+ else if (cl[i] == '%itrans')
+ r += tinyMCE.inlineTransitional;
+ else if (cl[i] == '%istrict_na')
+ r += tinyMCE.inlineStrict.substring(2);
+ else if (cl[i] == '%itrans_na')
+ r += tinyMCE.inlineTransitional.substring(2);
+ else if (cl[i] == '%btrans')
+ r += tinyMCE.blockElms;
+ else if (cl[i] == '%strict')
+ r += tinyMCE.blockStrict;
+ else
+ r += (cl[i].charAt(0) != '#' ? cl[i].toUpperCase() : cl[i]);
+
+ r += (i != cl.length - 1 ? '|' : '');
+ }
+
+ r += ')$';
+//tinyMCE.debug(t + "=" + r);
+ if (this.childRules == null)
+ this.childRules = tinyMCE.clearArray(new Array());
+
+ this.childRules[tn[y]] = new RegExp(r);
+
+ if (p.length > 1)
+ this.childRules[tn[y]].wrapTag = p[2];
+ }
+ }
+ },
+
parseRuleStr : function(s) {
var ta, p, r, a, i, x, px, t, tn, y, av, or = tinyMCE.clearArray(new Array()), dv;
@@ -4233,6 +4513,15 @@ TinyMCE_Cleanup.prototype = {
for (i=0; i<a.length; i++) {
t = a[i];
+ if (t.charAt(0) == '!') {
+ a[i] = t = t.substring(1);
+
+ if (!r.reqAttribsRe)
+ r.reqAttribsRe = '\\s+(' + t;
+ else
+ r.reqAttribsRe += '|' + t;
+ }
+
av = new RegExp('(=|:|<)(.*?)$').exec(t);
t = t.replace(new RegExp('(=|:|<).*?$'), '');
if (av && av.length > 0) {
@@ -4252,7 +4541,7 @@ TinyMCE_Cleanup.prototype = {
if (!r.validAttribValues)
r.validAttribValues = tinyMCE.clearArray(new Array());
- r.validAttribValues[t.toLowerCase()] = this._arrayToRe(this.split('?', av[0].substring(1)), '');
+ r.validAttribValues[t.toLowerCase()] = this._arrayToRe(this.split('?', av[0].substring(1)), 'i');
}
}
@@ -4261,6 +4550,9 @@ TinyMCE_Cleanup.prototype = {
a[i] = t.toLowerCase();
}
+ if (r.reqAttribsRe)
+ r.reqAttribsRe = new RegExp(r.reqAttribsRe + ')=\"', 'g');
+
r.vAttribsRe += ')$';
r.vAttribsRe = this._wildcardToRe(r.vAttribsRe);
r.vAttribsReIsWild = new RegExp('\\*|\\?|\\+', 'g').test(r.vAttribsRe);
@@ -4285,7 +4577,7 @@ TinyMCE_Cleanup.prototype = {
var s, b;
if (!this.xmlDoc) {
- if (this.isMSIE) {
+ if (this.isIE) {
try {this.xmlDoc = new ActiveXObject('MSXML2.DOMDocument');} catch (e) {}
if (!this.xmlDoc)
@@ -4305,7 +4597,7 @@ TinyMCE_Cleanup.prototype = {
this._convertToXML(n, b);
- if (this.isMSIE)
+ if (this.isIE)
return this.xmlDoc.xml;
else
return new XMLSerializer().serializeToString(this.xmlDoc);
@@ -4356,23 +4648,36 @@ TinyMCE_Cleanup.prototype = {
}
},
- serializeNodeAsHTML : function(n) {
- var en, no, h = '', i, l, r, cn, va = false, f = false, at, hc;
+ serializeNodeAsHTML : function(n, inn) {
+ var en, no, h = '', i, l, t, st, r, cn, va = false, f = false, at, hc, cr;
this._setupRules(); // Will initialize cleanup rules
if (this._isDuplicate(n))
return '';
+ // Skip non valid child elements
+ if (n.parentNode && this.childRules != null) {
+ cr = this.childRules[n.parentNode.nodeName];
+
+ if (typeof(cr) != "undefined" && !cr.test(n.nodeName)) {
+ st = true;
+ t = null;
+ }
+ }
+
switch (n.nodeType) {
case 1: // Element
hc = n.hasChildNodes();
+ if (st)
+ break;
+
// MSIE sometimes produces <//tag>
- if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && n.nodeName.indexOf('/') != -1)
+ if ((tinyMCE.isRealIE) && n.nodeName.indexOf('/') != -1)
break;
- if (this.vElementsRe.test(n.nodeName) && (!this.iveRe || !this.iveRe.test(n.nodeName))) {
+ if (this.vElementsRe.test(n.nodeName) && (!this.iveRe || !this.iveRe.test(n.nodeName)) && !inn) {
va = true;
r = this.rules[n.nodeName];
@@ -4392,7 +4697,7 @@ TinyMCE_Cleanup.prototype = {
if (r.removeEmpty && !hc)
return "";
- h += '<' + en;
+ t = '<' + en;
if (r.vAttribsReIsWild) {
// Serialize wildcard attributes
@@ -4400,12 +4705,12 @@ TinyMCE_Cleanup.prototype = {
for (i=at.length-1; i>-1; i--) {
no = at[i];
if (no.specified && r.vAttribsRe.test(no.nodeName))
- h += this._serializeAttribute(n, r, no.nodeName);
+ t += this._serializeAttribute(n, r, no.nodeName);
}
} else {
// Serialize specific attributes
for (i=r.vAttribs.length-1; i>-1; i--)
- h += this._serializeAttribute(n, r, r.vAttribs[i]);
+ t += this._serializeAttribute(n, r, r.vAttribs[i]);
}
// Serialize mce_ atts
@@ -4414,28 +4719,39 @@ TinyMCE_Cleanup.prototype = {
for (no in at) {
if (at[no])
- h += this._serializeAttribute(n, r, at[no]);
+ t += this._serializeAttribute(n, r, at[no]);
}
}
+ // Check for required attribs
+ if (r.reqAttribsRe && !t.match(r.reqAttribsRe))
+ t = null;
+
// Close these
- if (this.closeElementsRe.test(n.nodeName))
- return h + ' />';
+ if (t != null && this.closeElementsRe.test(n.nodeName))
+ return t + ' />';
- h += '>';
+ if (t != null)
+ h += t + '>';
- if (this.isMSIE && this.codeElementsRe.test(n.nodeName))
+ if (this.isIE && this.codeElementsRe.test(n.nodeName))
h += n.innerHTML;
}
break;
case 3: // Text
+ if (st)
+ break;
+
if (n.parentNode && this.codeElementsRe.test(n.parentNode.nodeName))
- return this.isMSIE ? '' : n.nodeValue;
+ return this.isIE ? '' : n.nodeValue;
return this.xmlEncode(n.nodeValue);
case 8: // Comment
+ if (st)
+ break;
+
return "<!--" + this._trimComment(n.nodeValue) + "-->";
}
@@ -4451,7 +4767,7 @@ TinyMCE_Cleanup.prototype = {
h += this.fillStr;
// End element
- if (va)
+ if (t != null && va)
h += '</' + en + '>';
return h;
@@ -4488,8 +4804,12 @@ TinyMCE_Cleanup.prototype = {
if (av.length != 0 && av == "{$uid}")
av = "uid_" + (this.idCount++);
- if (av.length != 0)
- return " " + an + "=" + '"' + this.xmlEncode(av) + '"';
+ if (av.length != 0) {
+ if (an.indexOf('on') != 0)
+ av = this.xmlEncode(av);
+
+ return " " + an + "=" + '"' + av + '"';
+ }
return "";
},
@@ -4497,6 +4817,12 @@ TinyMCE_Cleanup.prototype = {
formatHTML : function(h) {
var s = this.settings, p = '', i = 0, li = 0, o = '', l;
+ // Replace BR in pre elements to \n
+ h = h.replace(/<pre([^>]*)>(.*?)<\/pre>/gi, function (a, b, c) {
+ c = c.replace(/<br\s*\/>/gi, '\n');
+ return '<pre' + b + '>' + c + '</pre>';
+ });
+
h = h.replace(/\r/g, ''); // Windows sux, isn't carriage return a thing of the past :)
h = '\n' + h;
h = h.replace(new RegExp('\\n\\s+', 'gi'), '\n'); // Remove previous formatting
@@ -4527,7 +4853,7 @@ TinyMCE_Cleanup.prototype = {
},
xmlEncode : function(s) {
- var i, l, e, o = '', c;
+ var cl = this;
this._setupEntities(); // Will intialize lookup table
@@ -4536,29 +4862,16 @@ TinyMCE_Cleanup.prototype = {
return tinyMCE.xmlEncode(s);
case "named":
- for (i=0, l=s.length; i<l; i++) {
- c = s.charCodeAt(i);
- e = this.entities[c];
+ return s.replace(new RegExp('[\u007F-\uFFFF<>&"\']', 'g'), function (c, b) {
+ b = cl.entities[c.charCodeAt(0)];
- if (e && e != '')
- o += '&' + e + ';';
- else
- o += String.fromCharCode(c);
- }
-
- return o;
+ return b ? '&' + b + ';' : c;
+ });
case "numeric":
- for (i=0, l=s.length; i<l; i++) {
- c = s.charCodeAt(i);
-
- if (c > 127 || c == 60 || c == 62 || c == 38 || c == 39 || c == 34)
- o += '&#' + c + ";";
- else
- o += String.fromCharCode(c);
- }
-
- return o;
+ return s.replace(new RegExp('[\u007F-\uFFFF<>&"\']', 'g'), function (c, b) {
+ return b ? '&#' + c.charCodeAt(0) + ';' : c;
+ });
}
return s;
@@ -4596,16 +4909,16 @@ TinyMCE_Cleanup.prototype = {
if (n == "class" && !v)
v = e.className;
- if (this.isMSIE && n == "http-equiv")
+ if (this.isIE && n == "http-equiv")
v = e.httpEquiv;
- if (this.isMSIE && e.nodeName == "FORM" && n == "enctype" && v == "application/x-www-form-urlencoded")
+ if (this.isIE && e.nodeName == "FORM" && n == "enctype" && v == "application/x-www-form-urlencoded")
v = "";
- if (this.isMSIE && e.nodeName == "INPUT" && n == "size" && v == "20")
+ if (this.isIE && e.nodeName == "INPUT" && n == "size" && v == "20")
v = "";
- if (this.isMSIE && e.nodeName == "INPUT" && n == "maxlength" && v == "2147483647")
+ if (this.isIE && e.nodeName == "INPUT" && n == "maxlength" && v == "2147483647")
v = "";
if (n == "style" && !tinyMCE.isOpera)
@@ -4679,6 +4992,7 @@ TinyMCE_Cleanup.prototype = {
if (!this.rulesDone) {
this.addRuleStr(s.valid_elements);
this.addRuleStr(s.extended_valid_elements);
+ this.addChildRemoveRuleStr(s.valid_child_elements);
this.rulesDone = true;
}
@@ -4690,7 +5004,7 @@ TinyMCE_Cleanup.prototype = {
if (!this.settings.fix_content_duplication)
return false;
- if (tinyMCE.isMSIE && !tinyMCE.isOpera && n.nodeType == 1) {
+ if (tinyMCE.isRealIE && n.nodeType == 1) {
// Mark elements
if (n.mce_serialized == this.serializationId)
return true;
@@ -4708,10 +5022,44 @@ TinyMCE_Cleanup.prototype = {
return false;
}
-};
+
+ };
/* file:jscripts/tiny_mce/classes/TinyMCE_DOMUtils.class.js */
+TinyMCE_Engine.prototype.createTagHTML = function(tn, a, h) {
+ var o = '', f = tinyMCE.xmlEncode;
+
+ o = '<' + tn;
+
+ if (a) {
+ for (n in a) {
+ if (typeof(a[n]) != 'function' && a[n] != null)
+ o += ' ' + f(n) + '="' + f('' + a[n]) + '"';
+ }
+ }
+
+ o += !h ? ' />' : '>' + h + '</' + tn + '>';
+
+ return o;
+};
+
+TinyMCE_Engine.prototype.createTag = function(d, tn, a, h) {
+ var o = d.createElement(tn);
+
+ if (a) {
+ for (n in a) {
+ if (typeof(a[n]) != 'function' && a[n] != null)
+ tinyMCE.setAttrib(o, n, a[n]);
+ }
+ }
+
+ if (h)
+ o.innerHTML = h;
+
+ return o;
+};
+
TinyMCE_Engine.prototype.getElementByAttributeValue = function(n, e, a, v) {
return (n = this.getElementsByAttributeValue(n, e, a, v)).length == 0 ? null : n[0];
};
@@ -4731,13 +5079,10 @@ TinyMCE_Engine.prototype.isBlockElement = function(n) {
return n != null && n.nodeType == 1 && this.blockRegExp.test(n.nodeName);
};
-TinyMCE_Engine.prototype.getParentBlockElement = function(n) {
- while (n) {
- if (this.isBlockElement(n))
- return n;
-
- n = n.parentNode;
- }
+TinyMCE_Engine.prototype.getParentBlockElement = function(n, r) {
+ return this.getParentNode(n, function(n) {
+ return tinyMCE.isBlockElement(n);
+ }, r);
return null;
};
@@ -4752,7 +5097,16 @@ TinyMCE_Engine.prototype.insertAfter = function(n, r){
TinyMCE_Engine.prototype.setInnerHTML = function(e, h) {
var i, nl, n;
- if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
+ // Convert all strong/em to b/i in Gecko
+ if (tinyMCE.isGecko) {
+ h = h.replace(/<strong/gi, '<b');
+ h = h.replace(/<em(\/?)/gi, '<i');
+ h = h.replace(/<em /gi, '<i');
+ h = h.replace(/<\/strong>/gi, '</b>');
+ h = h.replace(/<\/em>/gi, '</i>');
+ }
+
+ if (tinyMCE.isRealIE) {
// Since MSIE handles invalid HTML better that valid XHTML we
// need to make some things invalid. <hr /> gets converted to <hr>.
h = h.replace(/\s\/>/g, '>');
@@ -4782,23 +5136,28 @@ TinyMCE_Engine.prototype.setInnerHTML = function(e, h) {
};
TinyMCE_Engine.prototype.getOuterHTML = function(e) {
- if (tinyMCE.isMSIE)
+ if (tinyMCE.isIE)
return e.outerHTML;
var d = e.ownerDocument.createElement("body");
- d.appendChild(e);
+ d.appendChild(e.cloneNode(true));
return d.innerHTML;
};
-TinyMCE_Engine.prototype.setOuterHTML = function(e, h) {
- if (tinyMCE.isMSIE) {
+TinyMCE_Engine.prototype.setOuterHTML = function(e, h, d) {
+ var d = typeof(d) == "undefined" ? e.ownerDocument : d, i, nl, t;
+
+ if (tinyMCE.isIE && e.nodeType == 1)
e.outerHTML = h;
- return;
- }
+ else {
+ t = d.createElement("body");
+ t.innerHTML = h;
- var d = e.ownerDocument.createElement("body");
- d.innerHTML = h;
- e.parentNode.replaceChild(d.firstChild, e);
+ for (i=0, nl=t.childNodes; i<nl.length; i++)
+ e.parentNode.insertBefore(nl[i].cloneNode(true), e);
+
+ e.parentNode.removeChild(e);
+ }
};
TinyMCE_Engine.prototype._getElementById = function(id, d) {
@@ -4825,56 +5184,28 @@ TinyMCE_Engine.prototype._getElementById = function(id, d) {
};
TinyMCE_Engine.prototype.getNodeTree = function(n, na, t, nn) {
- var i;
-
- if (typeof(t) == "undefined" || n.nodeType == t && (typeof(nn) == "undefined" || n.nodeName == nn))
- na[na.length] = n;
-
- if (n.hasChildNodes()) {
- for (i=0; i<n.childNodes.length; i++)
- tinyMCE.getNodeTree(n.childNodes[i], na, t, nn);
- }
-
- return na;
+ return this.selectNodes(n, function(n) {
+ return (!t || n.nodeType == t) && (!nn || n.nodeName == nn);
+ }, na ? na : new Array());
};
-TinyMCE_Engine.prototype.getParentElement = function(node, names, attrib_name, attrib_value) {
- if (typeof(names) == "undefined") {
- if (node.nodeType == 1)
- return node;
-
- // Find parent node that is a element
- while ((node = node.parentNode) != null && node.nodeType != 1) ;
+TinyMCE_Engine.prototype.getParentElement = function(n, na, f, r) {
+ var re = na ? new RegExp('^(' + na.toUpperCase().replace(/,/g, '|') + ')$') : 0, v;
- return node;
- }
+ // Compatiblity with old scripts where f param was a attribute string
+ if (f && typeof(f) == 'string')
+ return this.getParentElement(n, na, function(no) {return tinyMCE.getAttrib(no, f) != '';});
- if (node == null)
- return null;
-
- var namesAr = names.toUpperCase().split(',');
-
- do {
- for (var i=0; i<namesAr.length; i++) {
- if (node.nodeName == namesAr[i] || names == "*") {
- if (typeof(attrib_name) == "undefined")
- return node;
- else if (node.getAttribute(attrib_name)) {
- if (typeof(attrib_value) == "undefined") {
- if (node.getAttribute(attrib_name) != "")
- return node;
- } else if (node.getAttribute(attrib_name) == attrib_value)
- return node;
- }
- }
- }
- } while ((node = node.parentNode) != null);
-
- return null;
+ return this.getParentNode(n, function(n) {
+ return ((n.nodeType == 1 && !re) || (re && re.test(n.nodeName))) && (!f || f(n));
+ }, r);
};
-TinyMCE_Engine.prototype.getParentNode = function(n, f) {
+TinyMCE_Engine.prototype.getParentNode = function(n, f, r) {
while (n) {
+ if (n == r)
+ return null;
+
if (f(n))
return n;
@@ -4884,15 +5215,17 @@ TinyMCE_Engine.prototype.getParentNode = function(n, f) {
return null;
};
-TinyMCE_Engine.prototype.getAttrib = function(elm, name, default_value) {
- if (typeof(default_value) == "undefined")
- default_value = "";
+TinyMCE_Engine.prototype.getAttrib = function(elm, name, dv) {
+ var v;
+
+ if (typeof(dv) == "undefined")
+ dv = "";
// Not a element
if (!elm || elm.nodeType != 1)
- return default_value;
+ return dv;
- var v = elm.getAttribute(name);
+ v = elm.getAttribute(name);
// Try className for class attrib
if (name == "class" && !v)
@@ -4906,47 +5239,46 @@ TinyMCE_Engine.prototype.getAttrib = function(elm, name, default_value) {
if (tinyMCE.isGecko && name == "href" && elm.href != null && elm.href != "")
v = elm.href;
- if (name == "http-equiv" && tinyMCE.isMSIE)
+ if (name == "http-equiv" && tinyMCE.isIE)
v = elm.httpEquiv;
if (name == "style" && !tinyMCE.isOpera)
v = elm.style.cssText;
- return (v && v != "") ? v : default_value;
+ return (v && v != "") ? v : dv;
};
-TinyMCE_Engine.prototype.setAttrib = function(element, name, value, fix_value) {
- if (typeof(value) == "number" && value != null)
- value = "" + value;
+TinyMCE_Engine.prototype.setAttrib = function(el, name, va, fix) {
+ if (typeof(va) == "number" && va != null)
+ va = "" + va;
- if (fix_value) {
- if (value == null)
- value = "";
+ if (fix) {
+ if (va == null)
+ va = "";
- var re = new RegExp('[^0-9%]', 'g');
- value = value.replace(re, '');
+ va = va.replace(/[^0-9%]/g, '');
}
if (name == "style")
- element.style.cssText = value;
+ el.style.cssText = va;
if (name == "class")
- element.className = value;
+ el.className = va;
- if (value != null && value != "" && value != -1)
- element.setAttribute(name, value);
+ if (va != null && va != "" && va != -1)
+ el.setAttribute(name, va);
else
- element.removeAttribute(name);
+ el.removeAttribute(name);
};
-TinyMCE_Engine.prototype.setStyleAttrib = function(elm, name, value) {
- eval('elm.style.' + name + '=value;');
+TinyMCE_Engine.prototype.setStyleAttrib = function(e, n, v) {
+ e.style[n] = v;
- // Style attrib deleted
- if (tinyMCE.isMSIE && value == null || value == '') {
- var str = tinyMCE.serializeStyle(tinyMCE.parseStyle(elm.style.cssText));
- elm.style.cssText = str;
- elm.setAttribute("style", str);
+ // Style attrib deleted in IE
+ if (tinyMCE.isIE && v == null || v == '') {
+ v = tinyMCE.serializeStyle(tinyMCE.parseStyle(e.style.cssText));
+ e.style.cssText = v;
+ e.setAttribute("style", v);
}
};
@@ -4967,16 +5299,16 @@ TinyMCE_Engine.prototype.switchClass = function(ei, c) {
}
};
-TinyMCE_Engine.prototype.getAbsPosition = function(n) {
- var p = {absLeft : 0, absTop : 0};
+TinyMCE_Engine.prototype.getAbsPosition = function(n, cn) {
+ var l = 0, t = 0;
- while (n) {
- p.absLeft += n.offsetLeft;
- p.absTop += n.offsetTop;
+ while (n && n != cn) {
+ l += n.offsetLeft;
+ t += n.offsetTop;
n = n.offsetParent;
}
- return p;
+ return {absLeft : l, absTop : t};
};
TinyMCE_Engine.prototype.prevNode = function(e, n) {
@@ -5005,6 +5337,16 @@ TinyMCE_Engine.prototype.nextNode = function(e, n) {
return null;
};
+TinyMCE_Engine.prototype.selectElements = function(n, na, f) {
+ var i, a = [], nl, x;
+
+ for (x=0, na = na.split(','); x<na.length; x++)
+ for (i=0, nl = n.getElementsByTagName(na[x]); i<nl.length; i++)
+ (!f || f(nl[i])) && a.push(nl[i]);
+
+ return a;
+};
+
TinyMCE_Engine.prototype.selectNodes = function(n, f, a) {
var i;
@@ -5024,19 +5366,16 @@ TinyMCE_Engine.prototype.selectNodes = function(n, f, a) {
TinyMCE_Engine.prototype.addCSSClass = function(e, c, b) {
var o = this.removeCSSClass(e, c);
-
return e.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
};
TinyMCE_Engine.prototype.removeCSSClass = function(e, c) {
- var a = this.explode(' ', e.className), i;
-
- for (i=0; i<a.length; i++) {
- if (a[i] == c)
- a[i] = '';
- }
+ c = e.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
+ return e.className = c != ' ' ? c : '';
+};
- return e.className = a.join(' ');
+TinyMCE_Engine.prototype.hasCSSClass = function(n, c) {
+ return new RegExp('\\b' + c + '\\b', 'g').test(n.className);
};
TinyMCE_Engine.prototype.renameElement = function(e, n, d) {
@@ -5061,6 +5400,17 @@ TinyMCE_Engine.prototype.renameElement = function(e, n, d) {
}
};
+TinyMCE_Engine.prototype.getViewPort = function(w) {
+ var d = w.document, m = d.compatMode == 'CSS1Compat', b = d.body, de = d.documentElement;
+
+ return {
+ left : w.pageXOffset || (m ? de.scrollLeft : b.scrollLeft),
+ top : w.pageYOffset || (m ? de.scrollTop : b.scrollTop),
+ width : w.innerWidth || (m ? de.clientWidth : b.clientWidth),
+ height : w.innerHeight || (m ? de.clientHeight : b.clientHeight)
+ };
+};
+
/* file:jscripts/tiny_mce/classes/TinyMCE_URL.class.js */
TinyMCE_Engine.prototype.parseURL = function(url_str) {
@@ -5228,10 +5578,10 @@ TinyMCE_Engine.prototype.convertAbsoluteURLToRelativeURL = function(base_url, ur
};
TinyMCE_Engine.prototype.convertRelativeToAbsoluteURL = function(base_url, relative_url) {
- var baseURL = this.parseURL(base_url);
+ var baseURL = this.parseURL(base_url), baseURLParts, relURLParts;
var relURL = this.parseURL(relative_url);
- if (relative_url == "" || relative_url.charAt(0) == '/' || relative_url.indexOf('://') != -1 || relative_url.indexOf('mailto:') != -1 || relative_url.indexOf('javascript:') != -1)
+ if (relative_url == "" || relative_url.indexOf('://') != -1 || /^(mailto:|javascript:|#|\/)/.test(relative_url))
return relative_url;
// Split parts
@@ -5306,7 +5656,7 @@ TinyMCE_Engine.prototype.convertURL = function(url, node, on_save) {
return url;
// Fix relative/Mozilla
- if (!tinyMCE.isMSIE && !on_save && url.indexOf("://") == -1 && url.charAt(0) != '/')
+ if (!tinyMCE.isIE && !on_save && url.indexOf("://") == -1 && url.charAt(0) != '/')
return tinyMCE.settings['base_href'] + url;
// Handle relative URLs
@@ -5353,12 +5703,14 @@ TinyMCE_Engine.prototype.convertURL = function(url, node, on_save) {
};
TinyMCE_Engine.prototype.convertAllRelativeURLs = function(body) {
+ var i, elms, src, href, mhref, msrc;
+
// Convert all image URL:s to absolute URL
- var elms = body.getElementsByTagName("img");
- for (var i=0; i<elms.length; i++) {
- var src = tinyMCE.getAttrib(elms[i], 'src');
+ elms = body.getElementsByTagName("img");
+ for (i=0; i<elms.length; i++) {
+ src = tinyMCE.getAttrib(elms[i], 'src');
- var msrc = tinyMCE.getAttrib(elms[i], 'mce_src');
+ msrc = tinyMCE.getAttrib(elms[i], 'mce_src');
if (msrc != "")
src = msrc;
@@ -5369,11 +5721,11 @@ TinyMCE_Engine.prototype.convertAllRelativeURLs = function(body) {
}
// Convert all link URL:s to absolute URL
- var elms = body.getElementsByTagName("a");
- for (var i=0; i<elms.length; i++) {
- var href = tinyMCE.getAttrib(elms[i], 'href');
+ elms = body.getElementsByTagName("a");
+ for (i=0; i<elms.length; i++) {
+ href = tinyMCE.getAttrib(elms[i], 'href');
- var mhref = tinyMCE.getAttrib(elms[i], 'mce_href');
+ mhref = tinyMCE.getAttrib(elms[i], 'mce_href');
if (mhref != "")
href = mhref;
@@ -5387,26 +5739,40 @@ TinyMCE_Engine.prototype.convertAllRelativeURLs = function(body) {
/* file:jscripts/tiny_mce/classes/TinyMCE_Array.class.js */
TinyMCE_Engine.prototype.clearArray = function(a) {
- for (var k in a)
- a[k] = null;
+ var n;
+
+ for (n in a)
+ a[n] = null;
return a;
};
+TinyMCE_Engine.prototype.explode = function(d, s) {
+ var ar = s.split(d), oar = new Array(), i;
+
+ for (i = 0; i<ar.length; i++) {
+ if (ar[i] != "")
+ oar[oar.length] = ar[i];
+ }
+
+ return oar;
+};
+
/* file:jscripts/tiny_mce/classes/TinyMCE_Event.class.js */
TinyMCE_Engine.prototype._setEventsEnabled = function(node, state) {
- var events = new Array('onfocus','onblur','onclick','ondblclick',
+ var evs, x, y, elms, i, event;
+ var events = ['onfocus','onblur','onclick','ondblclick',
'onmousedown','onmouseup','onmouseover','onmousemove',
- 'onmouseout','onkeypress','onkeydown','onkeydown','onkeyup');
+ 'onmouseout','onkeypress','onkeydown','onkeydown','onkeyup'];
- var evs = tinyMCE.settings['event_elements'].split(',');
- for (var y=0; y<evs.length; y++){
- var elms = node.getElementsByTagName(evs[y]);
- for (var i=0; i<elms.length; i++) {
- var event = "";
+ evs = tinyMCE.settings['event_elements'].split(',');
+ for (y=0; y<evs.length; y++){
+ elms = node.getElementsByTagName(evs[y]);
+ for (i=0; i<elms.length; i++) {
+ event = "";
- for (var x=0; x<events.length; x++) {
+ for (x=0; x<events.length; x++) {
if ((event = tinyMCE.getAttrib(elms[i], events[x])) != '') {
event = tinyMCE.cleanupEventStr("" + event);
@@ -5453,7 +5819,7 @@ TinyMCE_Engine.prototype._eventPatch = function(editor_id) {
if (!tinyMCE.isInstance(inst))
continue;
- tinyMCE.selectedInstance = inst;
+ inst.select();
win = inst.getWin();
if (win && win.event) {
@@ -5471,38 +5837,64 @@ TinyMCE_Engine.prototype._eventPatch = function(editor_id) {
}
};
+TinyMCE_Engine.prototype.findEvent = function(e) {
+ var n, inst;
+
+ if (e)
+ return e;
+
+ for (n in tinyMCE.instances) {
+ inst = tinyMCE.instances[n];
+
+ if (tinyMCE.isInstance(inst) && inst.getWin().event)
+ return inst.getWin().event;
+ }
+
+ return null;
+};
+
TinyMCE_Engine.prototype.unloadHandler = function() {
tinyMCE.triggerSave(true, true);
};
TinyMCE_Engine.prototype.addEventHandlers = function(inst) {
- var doc = inst.getDoc();
+ this.setEventHandlers(inst, 1);
+};
+
+TinyMCE_Engine.prototype.setEventHandlers = function(inst, s) {
+ var doc = inst.getDoc(), ie, ot, i, f = s ? tinyMCE.addEvent : tinyMCE.removeEvent;
+
+ ie = ['keypress', 'keyup', 'keydown', 'click', 'mouseup', 'mousedown', 'controlselect', 'dblclick'];
+ ot = ['keypress', 'keyup', 'keydown', 'click', 'mouseup', 'mousedown', 'focus', 'blur', 'dragdrop'];
inst.switchSettings();
- if (tinyMCE.isMSIE) {
- tinyMCE.addEvent(doc, "keypress", TinyMCE_Engine.prototype._eventPatch);
- tinyMCE.addEvent(doc, "keyup", TinyMCE_Engine.prototype._eventPatch);
- tinyMCE.addEvent(doc, "keydown", TinyMCE_Engine.prototype._eventPatch);
- tinyMCE.addEvent(doc, "mouseup", TinyMCE_Engine.prototype._eventPatch);
- tinyMCE.addEvent(doc, "mousedown", TinyMCE_Engine.prototype._eventPatch);
- tinyMCE.addEvent(doc, "click", TinyMCE_Engine.prototype._eventPatch);
+ if (tinyMCE.isIE) {
+ for (i=0; i<ie.length; i++)
+ f(doc, ie[i], TinyMCE_Engine.prototype._eventPatch);
} else {
- tinyMCE.addEvent(doc, "keypress", tinyMCE.handleEvent);
- tinyMCE.addEvent(doc, "keydown", tinyMCE.handleEvent);
- tinyMCE.addEvent(doc, "keyup", tinyMCE.handleEvent);
- tinyMCE.addEvent(doc, "click", tinyMCE.handleEvent);
- tinyMCE.addEvent(doc, "mouseup", tinyMCE.handleEvent);
- tinyMCE.addEvent(doc, "mousedown", tinyMCE.handleEvent);
- tinyMCE.addEvent(doc, "focus", tinyMCE.handleEvent);
- tinyMCE.addEvent(doc, "blur", tinyMCE.handleEvent);
+ for (i=0; i<ot.length; i++)
+ f(doc, ot[i], tinyMCE.handleEvent);
eval('try { doc.designMode = "On"; } catch(e) {}'); // Force designmode
}
};
TinyMCE_Engine.prototype.onMouseMove = function() {
- var inst;
+ var inst, lh;
+
+ // Fix for IE7 bug where it's not restoring hover on anchors correctly
+ if (tinyMCE.lastHover) {
+ lh = tinyMCE.lastHover;
+
+ // Call out on menus and refresh class on normal buttons
+ if (lh.className.indexOf('mceMenu') != -1)
+ tinyMCE._menuButtonEvent('out', lh);
+ else
+ lh.className = lh.className;
+
+ tinyMCE.lastHover = null;
+ }
if (!tinyMCE.hasMouseMoved) {
inst = tinyMCE.selectedInstance;
@@ -5519,20 +5911,52 @@ TinyMCE_Engine.prototype.onMouseMove = function() {
};
TinyMCE_Engine.prototype.cancelEvent = function(e) {
- if (tinyMCE.isMSIE) {
+ if (!e)
+ return false;
+
+ if (tinyMCE.isIE) {
e.returnValue = false;
e.cancelBubble = true;
- } else
+ } else {
e.preventDefault();
+ e.stopPropagation && e.stopPropagation();
+ }
+
+ return false;
};
TinyMCE_Engine.prototype.addEvent = function(o, n, h) {
+ // Add cleanup for all non unload events
+ if (n != 'unload') {
+ function clean() {
+ var ex;
+
+ try {
+ tinyMCE.removeEvent(o, n, h);
+ tinyMCE.removeEvent(window, 'unload', clean);
+ o = n = h = null;
+ } catch (ex) {
+ // IE may produce access denied exception on unload
+ }
+ }
+
+ // Add memory cleaner
+ tinyMCE.addEvent(window, 'unload', clean);
+ }
+
if (o.attachEvent)
o.attachEvent("on" + n, h);
else
o.addEventListener(n, h, false);
};
+TinyMCE_Engine.prototype.removeEvent = function(o, n, h) {
+ if (o.detachEvent)
+ o.detachEvent("on" + n, h);
+ else
+ o.removeEventListener(n, h, false);
+};
+
TinyMCE_Engine.prototype.addSelectAccessibility = function(e, s, w) {
// Add event handlers
if (!s._isAccessible) {
@@ -5547,8 +5971,8 @@ TinyMCE_Engine.prototype.addSelectAccessibility = function(e, s, w) {
TinyMCE_Engine.prototype.accessibleEventHandler = function(e) {
var win = this._win;
- e = tinyMCE.isMSIE ? win.event : e;
- var elm = tinyMCE.isMSIE ? e.srcElement : e.target;
+ e = tinyMCE.isIE ? win.event : e;
+ var elm = tinyMCE.isIE ? e.srcElement : e.target;
// Unpiggyback onchange on blur
if (e.type == "blur") {
@@ -5582,7 +6006,7 @@ TinyMCE_Engine.prototype.accessibleEventHandler = function(e) {
TinyMCE_Engine.prototype._resetIframeHeight = function() {
var ife;
- if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
+ if (tinyMCE.isRealIE) {
ife = tinyMCE.selectedInstance.iframeElement;
/* if (ife._oldWidth) {
@@ -5608,17 +6032,17 @@ TinyMCE_Selection.prototype = {
var inst = this.instance;
var e, r = this.getRng(), h;
- if (tinyMCE.isSafari) {
- // Not realy perfect!!
- return r.toString();
- }
+ if (!r)
+ return null;
e = document.createElement("body");
- if (tinyMCE.isGecko)
+ if (r.cloneContents)
e.appendChild(r.cloneContents());
- else
+ else if (typeof(r.item) != 'undefined' || typeof(r.htmlText) != 'undefined')
e.innerHTML = r.item ? r.item(0).outerHTML : r.htmlText;
+ else
+ e.innerHTML = r.toString(); // Failed, use text for now
h = tinyMCE._cleanupHTML(inst, inst.contentDocument, inst.settings, e, e, false, true, false);
@@ -5633,7 +6057,7 @@ TinyMCE_Selection.prototype = {
var inst = this.instance;
var d, r, s, t;
- if (tinyMCE.isMSIE) {
+ if (tinyMCE.isIE) {
d = inst.getDoc();
if (d.selection.type == "Text") {
@@ -5654,29 +6078,23 @@ TinyMCE_Selection.prototype = {
},
getBookmark : function(simple) {
+ var inst = this.instance;
var rng = this.getRng();
- var doc = this.instance.getDoc();
- var sp, le, s, e, nl, i, si, ei;
- var trng, sx, sy, xx = -999999999;
-
- // Skip Opera for now
- if (tinyMCE.isOpera)
- return null;
+ var doc = inst.getDoc(), b = inst.getBody();
+ var sp, le, s, e, nl, i, si, ei, w;
+ var trng, sx, sy, xx = -999999999, vp = inst.getViewPort();
- sx = doc.body.scrollLeft + doc.documentElement.scrollLeft;
- sy = doc.body.scrollTop + doc.documentElement.scrollTop;
+ sx = vp.left;
+ sy = vp.top;
- if (tinyMCE.isSafari || tinyMCE.isGecko)
+ if (tinyMCE.isSafari || tinyMCE.isOpera || simple)
return {rng : rng, scrollX : sx, scrollY : sy};
- if (tinyMCE.isMSIE) {
- if (simple)
- return {rng : rng};
-
+ if (tinyMCE.isIE) {
if (rng.item) {
e = rng.item(0);
- nl = doc.getElementsByTagName(e.nodeName);
+ nl = b.getElementsByTagName(e.nodeName);
for (i=0; i<nl.length; i++) {
if (e == nl[i]) {
sp = i;
@@ -5691,6 +6109,11 @@ TinyMCE_Selection.prototype = {
scrollY : sy
};
} else {
+ trng = doc.body.createTextRange();
+ trng.moveToElementText(inst.getBody());
+ trng.collapse(true);
+ bp = Math.abs(trng.move('character', xx));
+
trng = rng.duplicate();
trng.collapse(true);
sp = Math.abs(trng.move('character', xx));
@@ -5700,7 +6123,7 @@ TinyMCE_Selection.prototype = {
le = Math.abs(trng.move('character', xx)) - sp;
return {
- start : sp,
+ start : sp - bp,
length : le,
scrollX : sx,
scrollY : sy
@@ -5709,51 +6132,64 @@ TinyMCE_Selection.prototype = {
}
if (tinyMCE.isGecko) {
- s = tinyMCE.getParentElement(rng.startContainer);
- for (si=0; si<s.childNodes.length && s.childNodes[si] != rng.startContainer; si++) ;
+ s = this.getSel();
+ e = this.getFocusElement();
- nl = doc.getElementsByTagName(s.nodeName);
- for (i=0; i<nl.length; i++) {
- if (s == nl[i]) {
+ if (!s)
+ return null;
+
+ if (e && e.nodeName == 'IMG') {
+ /*nl = b.getElementsByTagName('IMG');
+ for (i=0; i<nl.length; i++) {
+ if (e == nl[i]) {
sp = i;
break;
}
+ }*/
+
+ return {
+ start : -1,
+ end : -1,
+ index : sp,
+ scrollX : sx,
+ scrollY : sy
+ };
}
- e = tinyMCE.getParentElement(rng.endContainer);
- for (ei=0; ei<e.childNodes.length && e.childNodes[ei] != rng.endContainer; ei++) ;
+ // Caret or selection
+ if (s.anchorNode == s.focusNode && s.anchorOffset == s.focusOffset) {
+ e = this._getPosText(b, s.anchorNode, s.focusNode);
- nl = doc.getElementsByTagName(e.nodeName);
- for (i=0; i<nl.length; i++) {
- if (e == nl[i]) {
- le = i;
- break;
- }
- }
+ if (!e)
+ return {scrollX : sx, scrollY : sy};
- //tinyMCE.debug(s.nodeName, sp, rng.startOffset, '-' , e.nodeName, le, rng.endOffset);
- //tinyMCE.debug(sx, sy);
-
- return {
- startTag : s.nodeName,
- start : sp,
- startIndex : si,
- endTag : e.nodeName,
- end : le,
- endIndex : ei,
- startOffset : rng.startOffset,
- endOffset : rng.endOffset,
- scrollX : sx,
- scrollY : sy
- };
+ return {
+ start : e.start + s.anchorOffset,
+ end : e.end + s.focusOffset,
+ scrollX : sx,
+ scrollY : sy
+ };
+ } else {
+ e = this._getPosText(b, rng.startContainer, rng.endContainer);
+
+ if (!e)
+ return {scrollX : sx, scrollY : sy};
+
+ return {
+ start : e.start + rng.startOffset,
+ end : e.end + rng.endOffset,
+ scrollX : sx,
+ scrollY : sy
+ };
+ }
}
return null;
},
moveToBookmark : function(bookmark) {
- var rng, nl, i;
var inst = this.instance;
+ var rng, nl, i, ex, b = inst.getBody(), sd;
var doc = inst.getDoc();
var win = inst.getWin();
var sel = this.getSel();
@@ -5762,22 +6198,27 @@ TinyMCE_Selection.prototype = {
return false;
if (tinyMCE.isSafari) {
- sel.setBaseAndExtent(bookmark.startContainer, bookmark.startOffset, bookmark.endContainer, bookmark.endOffset);
+ sel.setBaseAndExtent(bookmark.rng.startContainer, bookmark.rng.startOffset, bookmark.rng.endContainer, bookmark.rng.endOffset);
return true;
}
- if (tinyMCE.isMSIE) {
+ if (tinyMCE.isRealIE) {
if (bookmark.rng) {
- bookmark.rng.select();
+ try {
+ bookmark.rng.select();
+ } catch (ex) {
+ // Ignore
+ }
+
return true;
}
win.focus();
if (bookmark.tag) {
- rng = inst.getBody().createControlRange();
+ rng = b.createControlRange();
- nl = doc.getElementsByTagName(bookmark.tag);
+ nl = b.getElementsByTagName(bookmark.tag);
if (nl.length > bookmark.index) {
try {
@@ -5787,11 +6228,20 @@ TinyMCE_Selection.prototype = {
}
}
} else {
- rng = inst.getSel().createRange();
- rng.moveToElementText(inst.getBody());
- rng.collapse(true);
- rng.moveStart('character', bookmark.start);
- rng.moveEnd('character', bookmark.length);
+ // Try/catch needed since this operation breaks when TinyMCE is placed in hidden divs/tabs
+ try {
+ // Incorrect bookmark
+ if (bookmark.start < 0)
+ return true;
+
+ rng = inst.getSel().createRange();
+ rng.moveToElementText(inst.getBody());
+ rng.collapse(true);
+ rng.moveStart('character', bookmark.start);
+ rng.moveEnd('character', bookmark.length);
+ } catch (ex) {
+ return true;
+ }
}
rng.select();
@@ -5800,36 +6250,83 @@ TinyMCE_Selection.prototype = {
return true;
}
- if (tinyMCE.isGecko && bookmark.rng) {
- sel.removeAllRanges();
- sel.addRange(bookmark.rng);
+ if (tinyMCE.isGecko || tinyMCE.isOpera) {
+ if (bookmark.rng) {
+ sel.removeAllRanges();
+ sel.addRange(bookmark.rng);
+ }
+
+ if (bookmark.start != -1 && bookmark.end != -1) {
+ try {
+ sd = this._getTextPos(b, bookmark.start, bookmark.end);
+ rng = doc.createRange();
+ rng.setStart(sd.startNode, sd.startOffset);
+ rng.setEnd(sd.endNode, sd.endOffset);
+ sel.removeAllRanges();
+ sel.addRange(rng);
+ win.focus();
+ } catch (ex) {
+ // Ignore
+ }
+ }
+
+ /*
+ if (typeof(bookmark.index) != 'undefined') {
+ tinyMCE.selectElements(b, 'IMG', function (n) {
+ if (bookmark.index-- == 0) {
+ // Select image in Gecko here
+ }
+
+ return false;
+ });
+ }
+ */
+
win.scrollTo(bookmark.scrollX, bookmark.scrollY);
return true;
}
- if (tinyMCE.isGecko) {
- // try {
- rng = doc.createRange();
+ return false;
+ },
- nl = doc.getElementsByTagName(bookmark.startTag);
- if (nl.length > bookmark.start)
- rng.setStart(nl[bookmark.start].childNodes[bookmark.startIndex], bookmark.startOffset);
+ _getPosText : function(r, sn, en) {
+ var w = document.createTreeWalker(r, NodeFilter.SHOW_TEXT, null, false), n, p = 0, d = {};
- nl = doc.getElementsByTagName(bookmark.endTag);
- if (nl.length > bookmark.end)
- rng.setEnd(nl[bookmark.end].childNodes[bookmark.endIndex], bookmark.endOffset);
+ while ((n = w.nextNode()) != null) {
+ if (n == sn)
+ d.start = p;
- sel.removeAllRanges();
- sel.addRange(rng);
- /* } catch {
- // Ignore
- }*/
+ if (n == en) {
+ d.end = p;
+ return d;
+ }
- win.scrollTo(bookmark.scrollX, bookmark.scrollY);
- return true;
+ p += n.nodeValue ? n.nodeValue.length : 0;
}
- return false;
+ return null;
+ },
+
+ _getTextPos : function(r, sp, ep) {
+ var w = document.createTreeWalker(r, NodeFilter.SHOW_TEXT, null, false), n, p = 0, d = {};
+
+ while ((n = w.nextNode()) != null) {
+ p += n.nodeValue ? n.nodeValue.length : 0;
+
+ if (p >= sp && !d.startNode) {
+ d.startNode = n;
+ d.startOffset = sp - (p - n.nodeValue.length);
+ }
+
+ if (p >= ep) {
+ d.endNode = n;
+ d.endOffset = ep - (p - n.nodeValue.length);
+
+ return d;
+ }
+ }
+
+ return null;
},
selectNode : function(node, collapse, select_text_node, to_start) {
@@ -5847,8 +6344,11 @@ TinyMCE_Selection.prototype = {
if (typeof(to_start) == "undefined")
to_start = true;
- if (tinyMCE.isMSIE) {
- rng = inst.getBody().createTextRange();
+ if (inst.settings.auto_resize)
+ inst.resizeToContent();
+
+ if (tinyMCE.isRealIE) {
+ rng = inst.getDoc().body.createTextRange();
try {
rng.moveToElementText(node);
@@ -5915,69 +6415,79 @@ TinyMCE_Selection.prototype = {
},
scrollToNode : function(node) {
- var inst = this.instance;
- var pos, doc, scrollX, scrollY, height;
-
- // Scroll to node position
- pos = tinyMCE.getAbsPosition(node);
- doc = inst.getDoc();
- scrollX = doc.body.scrollLeft + doc.documentElement.scrollLeft;
- scrollY = doc.body.scrollTop + doc.documentElement.scrollTop;
- height = tinyMCE.isMSIE ? document.getElementById(inst.editorId).style.pixelHeight : inst.targetElement.clientHeight;
+ var inst = this.instance, w = inst.getWin(), vp = inst.getViewPort(), pos = tinyMCE.getAbsPosition(node), cvp, p, cwin;
// Only scroll if out of visible area
- if (!tinyMCE.settings['auto_resize'] && !(pos.absTop > scrollY && pos.absTop < (scrollY - 25 + height)))
- inst.contentWindow.scrollTo(pos.absLeft, pos.absTop - height + 25);
+ if (pos.absLeft < vp.left || pos.absLeft > vp.left + vp.width || pos.absTop < vp.top || pos.absTop > vp.top + (vp.height-25))
+ w.scrollTo(pos.absLeft, pos.absTop - vp.height + 25);
+
+ // Scroll container window
+ if (inst.settings.auto_resize) {
+ cwin = inst.getContainerWin();
+ cvp = tinyMCE.getViewPort(cwin);
+ p = this.getAbsPosition(node);
+
+ if (p.absLeft < cvp.left || p.absLeft > cvp.left + cvp.width || p.absTop < cvp.top || p.absTop > cvp.top + cvp.height)
+ cwin.scrollTo(p.absLeft, p.absTop - cvp.height + 25);
+ }
+ },
+
+ getAbsPosition : function(n) {
+ var pos = tinyMCE.getAbsPosition(n), ipos = tinyMCE.getAbsPosition(this.instance.iframeElement);
+
+ return {
+ absLeft : ipos.absLeft + pos.absLeft,
+ absTop : ipos.absTop + pos.absTop
+ };
},
getSel : function() {
var inst = this.instance;
- if (tinyMCE.isMSIE && !tinyMCE.isOpera)
+ if (tinyMCE.isRealIE)
return inst.getDoc().selection;
return inst.contentWindow.getSelection();
},
getRng : function() {
- var inst = this.instance;
- var sel = this.getSel();
+ var s = this.getSel();
- if (sel == null)
+ if (s == null)
return null;
- if (tinyMCE.isMSIE && !tinyMCE.isOpera)
- return sel.createRange();
+ if (tinyMCE.isRealIE)
+ return s.createRange();
- if (tinyMCE.isSafari && !sel.getRangeAt)
+ if (tinyMCE.isSafari && !s.getRangeAt)
return '' + window.getSelection();
- return sel.getRangeAt(0);
+ return s.getRangeAt(0);
},
getFocusElement : function() {
- var inst = this.instance;
+ var inst = this.instance, doc, rng, sel, elm;
- if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
- var doc = inst.getDoc();
- var rng = doc.selection.createRange();
+ if (tinyMCE.isRealIE) {
+ doc = inst.getDoc();
+ rng = doc.selection.createRange();
// if (rng.collapse)
// rng.collapse(true);
- var elm = rng.item ? rng.item(0) : rng.parentElement();
+ elm = rng.item ? rng.item(0) : rng.parentElement();
} else {
- if (inst.isHidden())
+ if (!tinyMCE.isSafari && inst.isHidden())
return inst.getBody();
- var sel = this.getSel();
- var rng = this.getRng();
+ sel = this.getSel();
+ rng = this.getRng();
if (!sel || !rng)
return null;
- var elm = rng.commonAncestorContainer;
- //var elm = (sel && sel.anchorNode) ? sel.anchorNode : null;
+ elm = rng.commonAncestorContainer;
+ //elm = (sel && sel.anchorNode) ? sel.anchorNode : null;
// Handle selection a image or other control like element such as anchors
if (!rng.collapsed) {
@@ -5999,7 +6509,8 @@ TinyMCE_Selection.prototype = {
return elm;
}
-};
+
+ };
/* file:jscripts/tiny_mce/classes/TinyMCE_UndoRedo.class.js */
@@ -6013,39 +6524,40 @@ function TinyMCE_UndoRedo(inst) {
TinyMCE_UndoRedo.prototype = {
add : function(l) {
- var b;
+ var b, customUndoLevels, newHTML, inst = this.instance, i, ul, ur;
if (l) {
this.undoLevels[this.undoLevels.length] = l;
return true;
}
- var inst = this.instance;
-
if (this.typingUndoIndex != -1) {
this.undoIndex = this.typingUndoIndex;
- // tinyMCE.debug("Override: " + this.undoIndex);
+
+ if (tinyMCE.typingUndoIndex != -1)
+ tinyMCE.undoIndex = tinyMCE.typingUndoIndex;
}
- var newHTML = tinyMCE.trim(inst.getBody().innerHTML);
+ newHTML = tinyMCE.trim(inst.getBody().innerHTML);
if (this.undoLevels[this.undoIndex] && newHTML != this.undoLevels[this.undoIndex].content) {
- //tinyMCE.debug(newHTML, this.undoLevels[this.undoIndex]);
+ //tinyMCE.debug(newHTML, this.undoLevels[this.undoIndex].content);
tinyMCE.dispatchCallback(inst, 'onchange_callback', 'onChange', inst);
// Time to compress
- var customUndoLevels = tinyMCE.settings['custom_undo_redo_levels'];
+ customUndoLevels = tinyMCE.settings['custom_undo_redo_levels'];
if (customUndoLevels != -1 && this.undoLevels.length > customUndoLevels) {
- for (var i=0; i<this.undoLevels.length-1; i++) {
- //tinyMCE.debug(this.undoLevels[i] + "=" + this.undoLevels[i+1]);
+ for (i=0; i<this.undoLevels.length-1; i++)
this.undoLevels[i] = this.undoLevels[i+1];
- }
this.undoLevels.length--;
this.undoIndex--;
+
+ // Todo: Implement global undo/redo logic here
}
b = inst.undoBookmark;
+
if (!b)
b = inst.selection.getBookmark();
@@ -6055,12 +6567,24 @@ TinyMCE_UndoRedo.prototype = {
bookmark : b
};
+ // Remove all above from global undo/redo
+ ul = tinyMCE.undoLevels;
+ for (i=tinyMCE.undoIndex + 1; i<ul.length; i++) {
+ ur = ul[i].undoRedo;
+
+ if (ur.undoIndex == ur.undoLevels.length -1)
+ ur.undoIndex--;
+
+ ur.undoLevels.length--;
+ }
+
+ // Add global undo level
+ tinyMCE.undoLevels[tinyMCE.undoIndex++] = inst;
+ tinyMCE.undoLevels.length = tinyMCE.undoIndex;
+
this.undoLevels.length = this.undoIndex + 1;
- //tinyMCE.debug("level added" + this.undoIndex);
return true;
-
- // tinyMCE.debug(this.undoIndex + "," + (this.undoLevels.length-1));
}
return false;
@@ -6072,13 +6596,13 @@ TinyMCE_UndoRedo.prototype = {
// Do undo
if (this.undoIndex > 0) {
this.undoIndex--;
+
tinyMCE.setInnerHTML(inst.getBody(), this.undoLevels[this.undoIndex].content);
inst.repaint();
+
if (inst.settings.custom_undo_redo_restore_selection)
inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark);
}
-
- // tinyMCE.debug("Undo - undo levels:" + this.undoLevels.length + ", undo index: " + this.undoIndex);
},
redo : function() {
@@ -6088,23 +6612,28 @@ TinyMCE_UndoRedo.prototype = {
if (this.undoIndex < (this.undoLevels.length-1)) {
this.undoIndex++;
+
tinyMCE.setInnerHTML(inst.getBody(), this.undoLevels[this.undoIndex].content);
inst.repaint();
-// if (this.undoIndex > 0)
-// inst.selection.moveToBookmark(this.undoLevels[this.undoIndex-1].bookmark);
+
if (inst.settings.custom_undo_redo_restore_selection)
inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark);
- // tinyMCE.debug("Redo - undo levels:" + this.undoLevels.length + ", undo index: " + this.undoIndex);
}
tinyMCE.triggerNodeChange();
}
-};
+
+ };
/* file:jscripts/tiny_mce/classes/TinyMCE_ForceParagraphs.class.js */
var TinyMCE_ForceParagraphs = {
_insertPara : function(inst, e) {
+ var doc = inst.getDoc(), sel = inst.getSel(), body = inst.getBody(), win = inst.contentWindow, rng = sel.getRangeAt(0);
+ var rootElm = doc.documentElement, blockName = "P", startNode, endNode, startBlock, endBlock;
+ var rngBefore, rngAfter, direct, startNode, startOffset, endNode, endOffset, b = tinyMCE.isOpera ? inst.selection.getBookmark() : null;
+ var paraBefore, paraAfter, startChop, endChop, contents;
+
function isEmpty(para) {
function isEmptyHTML(html) {
return html.replace(new RegExp('[ \t\r\n]+', 'g'), '').toLowerCase() == "";
@@ -6133,43 +6662,33 @@ var TinyMCE_ForceParagraphs = {
return true;
}
- var doc = inst.getDoc();
- var sel = inst.getSel();
- var win = inst.contentWindow;
- var rng = sel.getRangeAt(0);
- var body = doc.body;
- var rootElm = doc.documentElement;
- var blockName = "P";
-
// tinyMCE.debug(body.innerHTML);
// debug(e.target, sel.anchorNode.nodeName, sel.focusNode.nodeName, rng.startContainer, rng.endContainer, rng.commonAncestorContainer, sel.anchorOffset, sel.focusOffset, rng.toString());
// Setup before range
- var rngBefore = doc.createRange();
+ rngBefore = doc.createRange();
rngBefore.setStart(sel.anchorNode, sel.anchorOffset);
rngBefore.collapse(true);
// Setup after range
- var rngAfter = doc.createRange();
+ rngAfter = doc.createRange();
rngAfter.setStart(sel.focusNode, sel.focusOffset);
rngAfter.collapse(true);
// Setup start/end points
- var direct = rngBefore.compareBoundaryPoints(rngBefore.START_TO_END, rngAfter) < 0;
- var startNode = direct ? sel.anchorNode : sel.focusNode;
- var startOffset = direct ? sel.anchorOffset : sel.focusOffset;
- var endNode = direct ? sel.focusNode : sel.anchorNode;
- var endOffset = direct ? sel.focusOffset : sel.anchorOffset;
+ direct = rngBefore.compareBoundaryPoints(rngBefore.START_TO_END, rngAfter) < 0;
+ startNode = direct ? sel.anchorNode : sel.focusNode;
+ startOffset = direct ? sel.anchorOffset : sel.focusOffset;
+ endNode = direct ? sel.focusNode : sel.anchorNode;
+ endOffset = direct ? sel.focusOffset : sel.anchorOffset;
startNode = startNode.nodeName == "BODY" ? startNode.firstChild : startNode;
endNode = endNode.nodeName == "BODY" ? endNode.firstChild : endNode;
- // tinyMCE.debug(startNode, endNode);
-
// Get block elements
- var startBlock = tinyMCE.getParentBlockElement(startNode);
- var endBlock = tinyMCE.getParentBlockElement(endNode);
+ startBlock = inst.getParentBlockElement(startNode);
+ endBlock = inst.getParentBlockElement(endNode);
// If absolute force paragraph generation within
if (startBlock && new RegExp('absolute|relative|static', 'gi').test(startBlock.style.position))
@@ -6188,7 +6707,7 @@ var TinyMCE_ForceParagraphs = {
}
// Within a list use normal behaviour
- if (tinyMCE.getParentElement(startBlock, "OL,UL") != null)
+ if (tinyMCE.getParentElement(startBlock, "OL,UL", null, body) != null)
return false;
// Within a table create new paragraphs
@@ -6196,16 +6715,16 @@ var TinyMCE_ForceParagraphs = {
startBlock = endBlock = null;
// Setup new paragraphs
- var paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName);
- var paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName);
+ paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName);
+ paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName);
// Is header, then force paragraph under
if (/^(H[1-6])$/.test(blockName))
paraAfter = doc.createElement("p");
// Setup chop nodes
- var startChop = startNode;
- var endChop = endNode;
+ startChop = startNode;
+ endChop = endNode;
// Get startChop node
node = startChop;
@@ -6236,7 +6755,9 @@ var TinyMCE_ForceParagraphs = {
if (startBlock == null) {
// Delete selection
rng.deleteContents();
- sel.removeAllRanges();
+
+ if (!tinyMCE.isSafari)
+ sel.removeAllRanges();
if (startChop != rootElm && endChop != rootElm) {
// Insert paragraph before
@@ -6260,7 +6781,7 @@ var TinyMCE_ForceParagraphs = {
if (endChop.nodeName != "#text" && endChop.nodeName != "BODY")
rngBefore.setEndAfter(endChop);
- var contents = rng.cloneContents();
+ contents = rng.cloneContents();
if (contents.firstChild && (contents.firstChild.nodeName == blockName || contents.firstChild.nodeName == "BODY"))
paraAfter.innerHTML = contents.firstChild.innerHTML;
else
@@ -6280,17 +6801,25 @@ var TinyMCE_ForceParagraphs = {
rngBefore.deleteContents();
// Insert new paragraphs
- paraAfter.normalize();
- rngBefore.insertNode(paraAfter);
- paraBefore.normalize();
- rngBefore.insertNode(paraBefore);
+ if (tinyMCE.isOpera) {
+ paraBefore.normalize();
+ rngBefore.insertNode(paraBefore);
+ paraAfter.normalize();
+ rngBefore.insertNode(paraAfter);
+ } else {
+ paraAfter.normalize();
+ rngBefore.insertNode(paraAfter);
+ paraBefore.normalize();
+ rngBefore.insertNode(paraBefore);
+ }
- // tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML);
+ //tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML);
} else {
body.innerHTML = "<" + blockName + ">&nbsp;</" + blockName + "><" + blockName + ">&nbsp;</" + blockName + ">";
paraAfter = body.childNodes[1];
}
+ inst.selection.moveToBookmark(b);
inst.selection.selectNode(paraAfter, true, true);
return true;
@@ -6308,7 +6837,7 @@ var TinyMCE_ForceParagraphs = {
// Place secound part within new paragraph
rngAfter.setEndAfter(endChop);
rngAfter.setStart(endNode, endOffset);
- var contents = rngAfter.cloneContents();
+ contents = rngAfter.cloneContents();
if (contents.firstChild && contents.firstChild.nodeName == blockName) {
/* var nodes = contents.firstChild.childNodes;
@@ -6331,7 +6860,7 @@ var TinyMCE_ForceParagraphs = {
paraAfter.innerHTML = "&nbsp;";
// Create a range around everything
- var rng = doc.createRange();
+ rng = doc.createRange();
if (!startChop.previousSibling && startChop.parentNode.nodeName.toUpperCase() == blockName) {
rng.setStartBefore(startChop.parentNode);
@@ -6349,14 +6878,22 @@ var TinyMCE_ForceParagraphs = {
// Delete all contents and insert new paragraphs
rng.deleteContents();
- rng.insertNode(paraAfter);
- rng.insertNode(paraBefore);
+
+ if (tinyMCE.isOpera) {
+ rng.insertNode(paraBefore);
+ rng.insertNode(paraAfter);
+ } else {
+ rng.insertNode(paraAfter);
+ rng.insertNode(paraBefore);
+ }
+
//tinyMCE.debug("2", paraBefore.innerHTML, paraAfter.innerHTML);
// Normalize
paraAfter.normalize();
paraBefore.normalize();
+ inst.selection.moveToBookmark(b);
inst.selection.selectNode(paraAfter, true, true);
return true;
@@ -6365,21 +6902,26 @@ var TinyMCE_ForceParagraphs = {
_handleBackSpace : function(inst) {
var r = inst.getRng(), sn = r.startContainer, nv, s = false;
- if (sn && sn.nextSibling && sn.nextSibling.nodeName == "BR") {
+ // Added body check for bug #1527787
+ if (sn && sn.nextSibling && sn.nextSibling.nodeName == "BR" && sn.parentNode.nodeName != "BODY") {
nv = sn.nodeValue;
- // Handle if a backspace is pressed after a space character #bug 1466054
- if (nv != null && nv.length >= r.startOffset && nv.charAt(r.startOffset - 1) == ' ')
- s = true;
+ // Handle if a backspace is pressed after a space character #bug 1466054 removed since fix for #1527787
+ /*if (nv != null && nv.length >= r.startOffset && nv.charAt(r.startOffset - 1) == ' ')
+ s = true;*/
// Only remove BRs if we are at the end of line #bug 1464152
if (nv != null && r.startOffset == nv.length)
sn.nextSibling.parentNode.removeChild(sn.nextSibling);
}
+ if (inst.settings.auto_resize)
+ inst.resizeToContent();
+
return s;
}
-};
+
+ };
/* file:jscripts/tiny_mce/classes/TinyMCE_Layer.class.js */
@@ -6515,14 +7057,20 @@ TinyMCE_Layer.prototype = {
if (!this.blockerElement && this.blockMode) {
d = this.doc;
- b = d.createElement("iframe");
+ b = d.getElementById(this.id + "_blocker");
- b.style.cssText = 'display: none; position: absolute; left: 0; top: 0';
- b.src = 'javascript:false;';
- b.frameBorder = '0';
- b.scrolling = 'no';
+ if (!b) {
+ b = d.createElement("iframe");
+
+ b.setAttribute('id', this.id + "_blocker");
+ b.style.cssText = 'display: none; position: absolute; left: 0; top: 0';
+ b.src = 'javascript:false;';
+ b.frameBorder = '0';
+ b.scrolling = 'no';
+
+ d.body.appendChild(b);
+ }
- d.body.appendChild(b);
this.blockerElement = b;
}
@@ -6541,7 +7089,7 @@ TinyMCE_Layer.prototype = {
return p;
},
- create : function(n, c, p) {
+ create : function(n, c, p, h) {
var d = this.doc, e = d.createElement(n);
e.setAttribute('id', this.id);
@@ -6552,18 +7100,26 @@ TinyMCE_Layer.prototype = {
if (!p)
p = d.body;
+ if (h)
+ e.innerHTML = h;
+
p.appendChild(e);
return this.element = e;
},
+ exists : function() {
+ return this.doc.getElementById(this.id) != null;
+ },
+
parseInt : function(s) {
if (s == null || s == '')
return 0;
return parseInt(s);
}
-};
+
+ };
/* file:jscripts/tiny_mce/classes/TinyMCE_Menu.class.js */
@@ -6582,7 +7138,6 @@ function TinyMCE_Menu() {
this.needsUpdate = true;
};
-// Extends the TinyMCE_Layer class
TinyMCE_Menu.prototype = tinyMCE.extend(TinyMCE_Layer.prototype, {
init : function(s) {
var n;
@@ -6653,7 +7208,7 @@ TinyMCE_Menu.prototype = tinyMCE.extend(TinyMCE_Layer.prototype, {
break;
default:
- h += '<tr><td><a href="javascript:void(0);" onmousedown="' + tinyMCE.xmlEncode(m[i].js) + ';return false;"><span' + c +'>' + t + '</span></a>';
+ 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>';
}
h += '</td></tr>';
@@ -6690,30 +7245,40 @@ TinyMCE_Menu.prototype = tinyMCE.extend(TinyMCE_Layer.prototype, {
tinyMCE.lastMenu = this;
}
-});
-/* file:jscripts/tiny_mce/classes/TinyMCE_Debug.class.js */
+ });
-TinyMCE_Engine.prototype.debug = function() {
- var m = "", e, a, i;
+/* file:jscripts/tiny_mce/classes/TinyMCE_Compatibility.class.js */
- e = document.getElementById("tinymce_debug");
- if (!e) {
- var d = document.createElement("div");
- d.setAttribute("className", "debugger");
- d.className = "debugger";
- d.innerHTML = 'Debug output:<textarea id="tinymce_debug" style="width: 100%; height: 300px" wrap="nowrap" mce_editable="false"></textarea>';
+if (!Function.prototype.call) {
+ Function.prototype.call = function() {
+ var a = arguments, s = a[0], i, as = '', r, o;
- document.body.appendChild(d);
- e = document.getElementById("tinymce_debug");
- }
+ for (i=1; i<a.length; i++)
+ as += (i > 1 ? ',' : '') + 'a[' + i + ']';
+
+ o = s._fu;
+ s._fu = this;
+ r = eval('s._fu(' + as + ')');
+ s._fu = o;
- a = this.debug.arguments;
- for (i=0; i<a.length; i++) {
+ return r;
+ };
+};
+
+/* file:jscripts/tiny_mce/classes/TinyMCE_Debug.class.js */
+
+TinyMCE_Engine.prototype.debug = function() {
+ var m = "", a, i, l = tinyMCE.log.length;
+
+ for (i=0, a = this.debug.arguments; i<a.length; i++) {
m += a[i];
+
if (i<a.length-1)
m += ', ';
}
- e.value += m + "\n";
+ if (l < 1000)
+ tinyMCE.log[l] = "[debug] " + m;
};
+
diff --git a/wp-includes/js/tinymce/tiny_mce_popup.js b/wp-includes/js/tinymce/tiny_mce_popup.js
index cbcdf3e..c4db092 100644
--- a/wp-includes/js/tinymce/tiny_mce_popup.js
+++ b/wp-includes/js/tinymce/tiny_mce_popup.js
@@ -3,274 +3,286 @@
// Some global instances, this will be filled later
var tinyMCE = null, tinyMCELang = null;
-
function TinyMCE_Popup() {
};
+TinyMCE_Popup.prototype = {
+ findWin : function(w) {
+ var c;
-TinyMCE_Popup.prototype.init = function() {
- var win = window.opener ? window.opener : window.dialogArguments;
- var inst;
+ // Check parents
+ c = w;
+ while (c && (c = c.parent) != null) {
+ if (typeof(c.tinyMCE) != "undefined")
+ return c;
+ }
- if (!win) {
- // Try parent
- win = parent.parent;
+ // Check openers
+ c = w;
+ while (c && (c = c.opener) != null) {
+ if (typeof(c.tinyMCE) != "undefined")
+ return c;
+ }
// Try top
- if (typeof(win.tinyMCE) == "undefined")
- win = top;
- }
-
- window.opener = win;
- this.windowOpener = win;
- this.onLoadEval = "";
+ if (typeof(top.tinyMCE) != "undefined")
+ return top;
- // Setup parent references
- tinyMCE = win.tinyMCE;
- tinyMCELang = win.tinyMCELang;
+ return null;
+ },
- if (!tinyMCE) {
- alert("tinyMCE object reference not found from popup.");
- return;
- }
+ init : function() {
+ var win = window.opener ? window.opener : window.dialogArguments, c;
+ var inst;
- inst = tinyMCE.selectedInstance;
- this.isWindow = tinyMCE.getWindowArg('mce_inside_iframe', false) == false;
- this.storeSelection = (tinyMCE.isMSIE && !tinyMCE.isOpera) && !this.isWindow && tinyMCE.getWindowArg('mce_store_selection', true);
+ if (!win)
+ win = this.findWin(window);
- if (this.isWindow)
- window.focus();
+ if (!win) {
+ alert("tinyMCE object reference not found from popup.");
+ return;
+ }
- // Store selection
- if (this.storeSelection)
- inst.selectionBookmark = inst.selection.getBookmark(true);
+ window.opener = win;
+ this.windowOpener = win;
+ this.onLoadEval = "";
- // Setup dir
- if (tinyMCELang['lang_dir'])
- document.dir = tinyMCELang['lang_dir'];
+ // Setup parent references
+ tinyMCE = win.tinyMCE;
+ tinyMCELang = win.tinyMCELang;
- // Setup title
- var re = new RegExp('{|\\\$|}', 'g');
- var title = document.title.replace(re, "");
- if (typeof tinyMCELang[title] != "undefined") {
- var divElm = document.createElement("div");
- divElm.innerHTML = tinyMCELang[title];
- document.title = divElm.innerHTML;
+ inst = tinyMCE.selectedInstance;
+ this.isWindow = tinyMCE.getWindowArg('mce_inside_iframe', false) == false;
+ this.storeSelection = (tinyMCE.isRealIE) && !this.isWindow && tinyMCE.getWindowArg('mce_store_selection', true);
- if (tinyMCE.setWindowTitle != null)
- tinyMCE.setWindowTitle(window, divElm.innerHTML);
- }
+ if (this.isWindow)
+ window.focus();
- // Output Popup CSS class
- document.write('<link href="' + tinyMCE.getParam("popups_css") + '" rel="stylesheet" type="text/css">');
+ // Store selection
+ if (this.storeSelection)
+ inst.selectionBookmark = inst.selection.getBookmark(true);
- tinyMCE.addEvent(window, "load", this.onLoad);
-};
+ // Setup dir
+ if (tinyMCELang['lang_dir'])
+ document.dir = tinyMCELang['lang_dir'];
+ // Setup title
+ var re = new RegExp('{|\\\$|}', 'g');
+ var title = document.title.replace(re, "");
+ if (typeof tinyMCELang[title] != "undefined") {
+ var divElm = document.createElement("div");
+ divElm.innerHTML = tinyMCELang[title];
+ document.title = divElm.innerHTML;
-TinyMCE_Popup.prototype.onLoad = function() {
- var dir, i, elms, body = document.body;
-
- body.onkeydown = function (e) {
- e = e ? e : window.event;
- if ( e.keyCode == 27 && !e.shiftKey && !e.controlKey && !e.altKey ) {
- tinyMCE.closeWindow(window);
+ if (tinyMCE.setWindowTitle != null)
+ tinyMCE.setWindowTitle(window, divElm.innerHTML);
}
- }
- if (tinyMCE.getWindowArg('mce_replacevariables', true))
- body.innerHTML = tinyMCE.applyTemplate(body.innerHTML, tinyMCE.windowArgs);
+ // Output Popup CSS class
+ document.write('<link href="' + tinyMCE.getParam("popups_css") + '" rel="stylesheet" type="text/css">');
- dir = tinyMCE.selectedInstance.settings['directionality'];
- if (dir == "rtl" && document.forms && document.forms.length > 0) {
- elms = document.forms[0].elements;
- for (i=0; i<elms.length; i++) {
- if ((elms[i].type == "text" || elms[i].type == "textarea") && elms[i].getAttribute("dir") != "ltr")
- elms[i].dir = dir;
- }
- }
+ if (tinyMCE.getParam("popups_css_add")) {
+ c = tinyMCE.getParam("popups_css_add");
- if (body.style.display == 'none')
- body.style.display = 'block';
+ // Is relative
+ if (c.indexOf('://') == -1 && c.charAt(0) != '/')
+ c = tinyMCE.documentBasePath + "/" + c;
- // Execute real onload (Opera fix)
- if (tinyMCEPopup.onLoadEval != "")
- eval(tinyMCEPopup.onLoadEval);
-};
+ document.write('<link href="' + c + '" rel="stylesheet" type="text/css">');
+ }
+ tinyMCE.addEvent(window, "load", this.onLoad);
+ },
-TinyMCE_Popup.prototype.executeOnLoad = function(str) {
- if (tinyMCE.isOpera)
- this.onLoadEval = str;
- else
- eval(str);
-};
+ onLoad : function() {
+ var dir, i, elms, body = document.body;
+ if (tinyMCE.getWindowArg('mce_replacevariables', true))
+ body.innerHTML = tinyMCE.applyTemplate(body.innerHTML, tinyMCE.windowArgs);
-TinyMCE_Popup.prototype.resizeToInnerSize = function() {
- // Netscape 7.1 workaround
- if (this.isWindow && tinyMCE.isNS71) {
- window.resizeBy(0, 10);
- return;
- }
-
- if (this.isWindow) {
- var doc = document;
- var body = doc.body;
- var oldMargin, wrapper, iframe, nodes, dx, dy;
+ dir = tinyMCE.selectedInstance.settings['directionality'];
+ if (dir == "rtl" && document.forms && document.forms.length > 0) {
+ elms = document.forms[0].elements;
+ for (i=0; i<elms.length; i++) {
+ if ((elms[i].type == "text" || elms[i].type == "textarea") && elms[i].getAttribute("dir") != "ltr")
+ elms[i].dir = dir;
+ }
+ }
if (body.style.display == 'none')
body.style.display = 'block';
- // Remove margin
- oldMargin = body.style.margin;
- body.style.margin = '0';
-
- // Create wrapper
- wrapper = doc.createElement("div");
- wrapper.id = 'mcBodyWrapper';
- wrapper.style.display = 'none';
- wrapper.style.margin = '0';
-
- // Wrap body elements
- nodes = doc.body.childNodes;
- for (var i=nodes.length-1; i>=0; i--) {
- if (wrapper.hasChildNodes())
- wrapper.insertBefore(nodes[i].cloneNode(true), wrapper.firstChild);
- else
- wrapper.appendChild(nodes[i].cloneNode(true));
-
- nodes[i].parentNode.removeChild(nodes[i]);
+ // Execute real onload (Opera fix)
+ if (tinyMCEPopup.onLoadEval != "")
+ eval(tinyMCEPopup.onLoadEval);
+ },
+
+ executeOnLoad : function(str) {
+ if (tinyMCE.isOpera)
+ this.onLoadEval = str;
+ else
+ eval(str);
+ },
+
+ resizeToInnerSize : function() {
+ // Netscape 7.1 workaround
+ if (this.isWindow && tinyMCE.isNS71) {
+ window.resizeBy(0, 10);
+ return;
}
- // Add wrapper
- doc.body.appendChild(wrapper);
-
- // Create iframe
- iframe = document.createElement("iframe");
- iframe.id = "mcWinIframe";
- iframe.src = document.location.href.toLowerCase().indexOf('https') == -1 ? "about:blank" : tinyMCE.settings['default_document'];
- iframe.width = "100%";
- iframe.height = "100%";
- iframe.style.margin = '0';
-
- // Add iframe
- doc.body.appendChild(iframe);
-
- // Measure iframe
- iframe = document.getElementById('mcWinIframe');
- dx = tinyMCE.getWindowArg('mce_width') - iframe.clientWidth;
- dy = tinyMCE.getWindowArg('mce_height') - iframe.clientHeight;
-
- // Resize window
- // tinyMCE.debug(tinyMCE.getWindowArg('mce_width') + "," + tinyMCE.getWindowArg('mce_height') + " - " + dx + "," + dy);
- window.resizeBy(dx, dy);
-
- // Hide iframe and show wrapper
- body.style.margin = oldMargin;
- iframe.style.display = 'none';
- wrapper.style.display = 'block';
- }
-};
-
-
-TinyMCE_Popup.prototype.resizeToContent = function() {
- var isMSIE = (navigator.appName == "Microsoft Internet Explorer");
- var isOpera = (navigator.userAgent.indexOf("Opera") != -1);
-
- if (isOpera)
- return;
-
- if (isMSIE) {
- try { window.resizeTo(10, 10); } catch (e) {}
-
- var elm = document.body;
- var width = elm.offsetWidth;
- var height = elm.offsetHeight;
- var dx = (elm.scrollWidth - width) + 4;
- var dy = elm.scrollHeight - height;
-
- try { window.resizeBy(dx, dy); } catch (e) {}
- } else {
- window.scrollBy(1000, 1000);
- if (window.scrollX > 0 || window.scrollY > 0) {
- window.resizeBy(window.innerWidth * 2, window.innerHeight * 2);
- window.sizeToContent();
- window.scrollTo(0, 0);
- var x = parseInt(screen.width / 2.0) - (window.outerWidth / 2.0);
- var y = parseInt(screen.height / 2.0) - (window.outerHeight / 2.0);
- window.moveTo(x, y);
+ if (this.isWindow) {
+ var doc = document;
+ var body = doc.body;
+ var oldMargin, wrapper, iframe, nodes, dx, dy;
+
+ if (body.style.display == 'none')
+ body.style.display = 'block';
+
+ // Remove margin
+ oldMargin = body.style.margin;
+ body.style.margin = '0';
+
+ // Create wrapper
+ wrapper = doc.createElement("div");
+ wrapper.id = 'mcBodyWrapper';
+ wrapper.style.display = 'none';
+ wrapper.style.margin = '0';
+
+ // Wrap body elements
+ nodes = doc.body.childNodes;
+ for (var i=nodes.length-1; i>=0; i--) {
+ if (wrapper.hasChildNodes())
+ wrapper.insertBefore(nodes[i].cloneNode(true), wrapper.firstChild);
+ else
+ wrapper.appendChild(nodes[i].cloneNode(true));
+
+ nodes[i].parentNode.removeChild(nodes[i]);
+ }
+
+ // Add wrapper
+ doc.body.appendChild(wrapper);
+
+ // Create iframe
+ iframe = document.createElement("iframe");
+ iframe.id = "mcWinIframe";
+ iframe.src = document.location.href.toLowerCase().indexOf('https') == -1 ? "about:blank" : tinyMCE.settings['default_document'];
+ iframe.width = "100%";
+ iframe.height = "100%";
+ iframe.style.margin = '0';
+
+ // Add iframe
+ doc.body.appendChild(iframe);
+
+ // Measure iframe
+ iframe = document.getElementById('mcWinIframe');
+ dx = tinyMCE.getWindowArg('mce_width') - iframe.clientWidth;
+ dy = tinyMCE.getWindowArg('mce_height') - iframe.clientHeight;
+
+ // Resize window
+ // tinyMCE.debug(tinyMCE.getWindowArg('mce_width') + "," + tinyMCE.getWindowArg('mce_height') + " - " + dx + "," + dy);
+ window.resizeBy(dx, dy);
+
+ // Hide iframe and show wrapper
+ body.style.margin = oldMargin;
+ iframe.style.display = 'none';
+ wrapper.style.display = 'block';
}
- }
-};
-
-
-TinyMCE_Popup.prototype.getWindowArg = function(name, default_value) {
- return tinyMCE.getWindowArg(name, default_value);
-};
-
+ },
+
+ resizeToContent : function() {
+ var isMSIE = (navigator.appName == "Microsoft Internet Explorer");
+ var isOpera = (navigator.userAgent.indexOf("Opera") != -1);
+
+ if (isOpera)
+ return;
+
+ if (isMSIE) {
+ try { window.resizeTo(10, 10); } catch (e) {}
+
+ var elm = document.body;
+ var width = elm.offsetWidth;
+ var height = elm.offsetHeight;
+ var dx = (elm.scrollWidth - width) + 4;
+ var dy = elm.scrollHeight - height;
+
+ try { window.resizeBy(dx, dy); } catch (e) {}
+ } else {
+ window.scrollBy(1000, 1000);
+ if (window.scrollX > 0 || window.scrollY > 0) {
+ window.resizeBy(window.innerWidth * 2, window.innerHeight * 2);
+ window.sizeToContent();
+ window.scrollTo(0, 0);
+ var x = parseInt(screen.width / 2.0) - (window.outerWidth / 2.0);
+ var y = parseInt(screen.height / 2.0) - (window.outerHeight / 2.0);
+ window.moveTo(x, y);
+ }
+ }
+ },
-TinyMCE_Popup.prototype.restoreSelection = function() {
- if (this.storeSelection) {
- var inst = tinyMCE.selectedInstance;
+ getWindowArg : function(name, default_value) {
+ return tinyMCE.getWindowArg(name, default_value);
+ },
- inst.getWin().focus();
+ restoreSelection : function() {
+ if (this.storeSelection) {
+ var inst = tinyMCE.selectedInstance;
- if (inst.selectionBookmark)
- inst.selection.moveToBookmark(inst.selectionBookmark);
- }
-};
+ inst.getWin().focus();
+ if (inst.selectionBookmark)
+ inst.selection.moveToBookmark(inst.selectionBookmark);
+ }
+ },
-TinyMCE_Popup.prototype.execCommand = function(command, user_interface, value) {
- var inst = tinyMCE.selectedInstance;
-
- this.restoreSelection();
- inst.execCommand(command, user_interface, value);
-
- // Store selection
- if (this.storeSelection)
- inst.selectionBookmark = inst.selection.getBookmark(true);
-};
+ execCommand : function(command, user_interface, value) {
+ var inst = tinyMCE.selectedInstance;
+ this.restoreSelection();
+ inst.execCommand(command, user_interface, value);
-TinyMCE_Popup.prototype.close = function() {
- tinyMCE.closeWindow(window);
-};
+ // Store selection
+ if (this.storeSelection)
+ inst.selectionBookmark = inst.selection.getBookmark(true);
+ },
+ close : function() {
+ tinyMCE.closeWindow(window);
+ },
-TinyMCE_Popup.prototype.pickColor = function(e, element_id) {
- tinyMCE.selectedInstance.execCommand('mceColorPicker', true, {
- element_id : element_id,
- document : document,
- window : window,
- store_selection : false
- });
-};
+ pickColor : function(e, element_id) {
+ tinyMCE.selectedInstance.execCommand('mceColorPicker', true, {
+ element_id : element_id,
+ document : document,
+ window : window,
+ store_selection : false
+ });
+ },
+ openBrowser : function(element_id, type, option) {
+ var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
+ var url = document.getElementById(element_id).value;
-TinyMCE_Popup.prototype.openBrowser = function(element_id, type, option) {
- var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
- var url = document.getElementById(element_id).value;
+ tinyMCE.setWindowArg("window", window);
+ tinyMCE.setWindowArg("document", document);
- tinyMCE.setWindowArg("window", window);
- tinyMCE.setWindowArg("document", document);
+ // Call to external callback
+ if (eval('typeof(tinyMCEPopup.windowOpener.' + cb + ')') == "undefined")
+ alert("Callback function: " + cb + " could not be found.");
+ else
+ eval("tinyMCEPopup.windowOpener." + cb + "(element_id, url, type, window);");
+ },
- // Call to external callback
- if (eval('typeof(tinyMCEPopup.windowOpener.' + cb + ')') == "undefined")
- alert("Callback function: " + cb + " could not be found.");
- else
- eval("tinyMCEPopup.windowOpener." + cb + "(element_id, url, type, window);");
-};
+ importClass : function(c) {
+ window[c] = function() {};
-TinyMCE_Popup.prototype.importClass = function(c) {
- window[c] = function() {};
+ for (var n in window.opener[c].prototype)
+ window[c].prototype[n] = window.opener[c].prototype[n];
- for (var n in window.opener[c].prototype)
- window[c].prototype[n] = window.opener[c].prototype[n];
+ window[c].constructor = window.opener[c].constructor;
+ }
- window[c].constructor = window.opener[c].constructor;
-};
+ };
// Setup global instance
var tinyMCEPopup = new TinyMCE_Popup();
diff --git a/wp-includes/js/tinymce/utils/form_utils.js b/wp-includes/js/tinymce/utils/form_utils.js
index 0481815..c502943 100644
--- a/wp-includes/js/tinymce/utils/form_utils.js
+++ b/wp-includes/js/tinymce/utils/form_utils.js
@@ -1,7 +1,5 @@
/**
- * $RCSfile: form_utils.js,v $
- * $Revision: 1.10 $
- * $Date: 2006/03/22 12:21:24 $
+ * $Id: form_utils.js 43 2006-08-08 16:10:07Z spocke $
*
* Various form utilitiy functions.
*
@@ -9,18 +7,20 @@
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
+var themeBaseURL = tinyMCE.baseURL + '/themes/' + tinyMCE.getParam("theme");
+
function getColorPickerHTML(id, target_form_element) {
- var html = "";
+ var h = "";
- html += '<a id="' + id + '_link" href="javascript:void(0);" onkeydown="pickColor(event,\'' + target_form_element +'\');" onmousedown="pickColor(event,\'' + target_form_element +'\');return false;">';
- html += '<img id="' + id + '" src="../../themes/' + tinyMCE.getParam("theme") + '/images/color.gif"';
- html += ' onmouseover="this.className=\'mceButtonOver\'"';
- html += ' onmouseout="this.className=\'mceButtonNormal\'"';
- html += ' onmousedown="this.className=\'mceButtonDown\'"';
- html += ' width="20" height="16" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
- html += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
+ h += '<a id="' + id + '_link" href="javascript:void(0);" onkeydown="pickColor(event,\'' + target_form_element +'\');" onmousedown="pickColor(event,\'' + target_form_element +'\');return false;">';
+ h += '<img id="' + id + '" src="' + themeBaseURL + '/images/color.gif"';
+ h += ' onmouseover="this.className=\'mceButtonOver\'"';
+ h += ' onmouseout="this.className=\'mceButtonNormal\'"';
+ h += ' onmousedown="this.className=\'mceButtonDown\'"';
+ h += ' width="20" height="16" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
+ h += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
- return html;
+ return h;
}
function pickColor(e, target_form_element) {
@@ -57,7 +57,7 @@ function getBrowserHTML(id, target_form_element, type, prefix) {
var html = "";
html += '<a id="' + id + '_link" href="javascript:openBrower(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;">';
- html += '<img id="' + id + '" src="../../themes/' + tinyMCE.getParam("theme") + '/images/browse.gif"';
+ html += '<img id="' + id + '" src="' + themeBaseURL + '/images/browse.gif"';
html += ' onmouseover="this.className=\'mceButtonOver\';"';
html += ' onmouseout="this.className=\'mceButtonNormal\';"';
html += ' onmousedown="this.className=\'mceButtonDown\';"';
@@ -92,9 +92,10 @@ function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
}
if (!found && add_custom && value != '') {
- var option = new Option('Value: ' + value, value);
+ var option = new Option(value, value);
option.selected = true;
sel.options[sel.options.length] = option;
+ sel.selectedIndex = sel.options.length - 1;
}
return found;
diff --git a/wp-includes/js/tinymce/utils/mclayer.js b/wp-includes/js/tinymce/utils/mclayer.js
index 0a7837b..deac8b7 100644
--- a/wp-includes/js/tinymce/utils/mclayer.js
+++ b/wp-includes/js/tinymce/utils/mclayer.js
@@ -1,7 +1,5 @@
/**
- * $RCSfile: mclayer.js,v $
- * $Revision: 1.2 $
- * $Date: 2006/02/06 20:11:09 $
+ * $Id: mclayer.js 18 2006-06-29 14:11:23Z spocke $
*
* Moxiecode floating layer script.
*
@@ -209,4 +207,4 @@ MCLayer.prototype = {
return parseInt(s);
}
-} \ No newline at end of file
+}
diff --git a/wp-includes/js/tinymce/utils/mctabs.js b/wp-includes/js/tinymce/utils/mctabs.js
index c159360..354186e 100644
--- a/wp-includes/js/tinymce/utils/mctabs.js
+++ b/wp-includes/js/tinymce/utils/mctabs.js
@@ -1,7 +1,5 @@
/**
- * $RCSfile: mctabs.js,v $
- * $Revision: 1.2 $
- * $Date: 2006/02/06 20:11:09 $
+ * $Id: mctabs.js 18 2006-06-29 14:11:23Z spocke $
*
* Moxiecode DHTML Tabs script.
*
diff --git a/wp-includes/js/tinymce/utils/validate.js b/wp-includes/js/tinymce/utils/validate.js
index 747b62b..f329b13 100644
--- a/wp-includes/js/tinymce/utils/validate.js
+++ b/wp-includes/js/tinymce/utils/validate.js
@@ -1,7 +1,5 @@
/**
- * $RCSfile: validate.js,v $
- * $Revision: 1.3 $
- * $Date: 2006/02/06 20:11:09 $
+ * $Id: validate.js 65 2006-08-24 15:54:55Z spocke $
*
* Various form validation methods.
*
@@ -9,42 +7,213 @@
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
-function testRegExp(form_name, element_name, re) {
- return new RegExp(re).test(document.forms[form_name].elements[element_name].value);
-}
+/**
+ // String validation:
+
+ if (!Validator.isEmail('myemail'))
+ alert('Invalid email.');
+
+ // Form validation:
+
+ var f = document.forms['myform'];
+
+ if (!Validator.isEmail(f.myemail))
+ alert('Invalid email.');
+*/
+
+var Validator = {
+ isEmail : function(s) {
+ return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
+ },
+
+ isAbsUrl : function(s) {
+ return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$');
+ },
+
+ isSize : function(s) {
+ return this.test(s, '^[0-9]+(px|%)?$');
+ },
+
+ isId : function(s) {
+ return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$');
+ },
+
+ isEmpty : function(s) {
+ var nl, i;
+
+ if (s.nodeName == 'SELECT' && s.selectedIndex < 1)
+ return true;
+
+ if (s.type == 'checkbox' && !s.checked)
+ return true;
+
+ if (s.type == 'radio') {
+ for (i=0, nl = s.form.elements; i<nl.length; i++) {
+ if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked)
+ return false;
+ }
+
+ return true;
+ }
+
+ return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s);
+ },
+
+ isNumber : function(s, d) {
+ return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$'));
+ },
+
+ test : function(s, p) {
+ s = s.nodeType == 1 ? s.value : s;
+
+ return s == '' || new RegExp(p).test(s);
+ }
+};
+
+var AutoValidator = {
+ settings : {
+ id_cls : 'id',
+ int_cls : 'int',
+ url_cls : 'url',
+ number_cls : 'number',
+ email_cls : 'email',
+ size_cls : 'size',
+ required_cls : 'required',
+ invalid_cls : 'invalid',
+ min_cls : 'min',
+ max_cls : 'max'
+ },
+
+ init : function(s) {
+ var n;
+
+ for (n in s)
+ this.settings[n] = s[n];
+ },
+
+ validate : function(f) {
+ var i, nl, s = this.settings, c = 0;
+
+ nl = this.tags(f, 'label');
+ for (i=0; i<nl.length; i++)
+ this.removeClass(nl[i], s.invalid_cls);
+
+ c += this.validateElms(f, 'input');
+ c += this.validateElms(f, 'select');
+ c += this.validateElms(f, 'textarea');
+
+ return c == 3;
+ },
+
+ invalidate : function(n) {
+ this.mark(n.form, n);
+ },
+
+ reset : function(e) {
+ var t = new Array('label', 'input', 'select', 'textarea');
+ var i, j, nl, s = this.settings;
+
+ if (e == null)
+ return;
+
+ for (i=0; i<t.length; i++) {
+ nl = this.tags(e.form ? e.form : e, t[i]);
+ for (j=0; j<nl.length; j++)
+ this.removeClass(nl[j], s.invalid_cls);
+ }
+ },
+
+ validateElms : function(f, e) {
+ var nl, i, n, s = this.settings, st = true, va = Validator, v;
+
+ nl = this.tags(f, e);
+ for (i=0; i<nl.length; i++) {
+ n = nl[i];
+
+ this.removeClass(n, s.invalid_cls);
+
+ if (this.hasClass(n, s.required_cls) && va.isEmpty(n))
+ st = this.mark(f, n);
+
+ if (this.hasClass(n, s.number_cls) && !va.isNumber(n))
+ st = this.mark(f, n);
+
+ if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true))
+ st = this.mark(f, n);
+
+ if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n))
+ st = this.mark(f, n);
+
+ if (this.hasClass(n, s.email_cls) && !va.isEmail(n))
+ st = this.mark(f, n);
+
+ if (this.hasClass(n, s.size_cls) && !va.isSize(n))
+ st = this.mark(f, n);
+
+ if (this.hasClass(n, s.id_cls) && !va.isId(n))
+ st = this.mark(f, n);
+
+ if (this.hasClass(n, s.min_cls, true)) {
+ v = this.getNum(n, s.min_cls);
+
+ if (isNaN(v) || parseInt(n.value) < parseInt(v))
+ st = this.mark(f, n);
+ }
+
+ if (this.hasClass(n, s.max_cls, true)) {
+ v = this.getNum(n, s.max_cls);
+
+ if (isNaN(v) || parseInt(n.value) > parseInt(v))
+ st = this.mark(f, n);
+ }
+ }
+
+ return st;
+ },
+
+ hasClass : function(n, c, d) {
+ return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className);
+ },
+
+ getNum : function(n, c) {
+ c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0];
+ c = c.replace(/[^0-9]/g, '');
+
+ return c;
+ },
-function validateString(form_name, element_name) {
- return (document.forms[form_name].elements[element_name].value.length > 0);
-}
+ addClass : function(n, c, b) {
+ var o = this.removeClass(n, c);
+ n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
+ },
-function validateSelection(form_name, element_name) {
- return (document.forms[form_name].elements[element_name].selectedIndex > 0);
-}
+ removeClass : function(n, c) {
+ c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
+ return n.className = c != ' ' ? c : '';
+ },
-function validateCheckBox(form_name, element_name) {
- return document.forms[form_name].elements[element_name].checked;
-}
+ tags : function(f, s) {
+ return f.getElementsByTagName(s);
+ },
-function validateCleanString(form_name, element_name) {
- return testRegExp(form_name, element_name, '^[A-Za-z0-9_]+$');
-}
+ mark : function(f, n) {
+ var s = this.settings;
-function validateEmail(form_name, element_name) {
- return testRegExp(form_name, element_name, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
-}
+ this.addClass(n, s.invalid_cls);
+ this.markLabels(f, n, s.invalid_cls);
-function validateAbsUrl(form_name, element_name) {
- return testRegExp(form_name, element_name, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+$');
-}
+ return false;
+ },
-function validateNumber(form_name, element_name, allow_blank) {
- return (!allow_blank && value == '') ? false : testRegExp(form_name, element_name, '^-?[0-9]*\\.?[0-9]*$');
-}
+ markLabels : function(f, n, ic) {
+ var nl, i;
-function validateSize(form_name, element_name,) {
- return testRegExp(form_name, element_name, '^[0-9]+(px|%)?$');
-}
+ nl = this.tags(f, "label");
+ for (i=0; i<nl.length; i++) {
+ if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id)
+ this.addClass(nl[i], ic);
+ }
-function validateID(form_name, element_name,) {
- return testRegExp(form_name, element_name, '^[A-Za-z_]([A-Za-z0-9_])*$');
-}
+ return null;
+ }
+};