updated tinymce to 3.5.11

This commit is contained in:
hauke 2014-09-07 12:51:05 +02:00
parent a162ea7251
commit 386eadde3a
24 changed files with 1050 additions and 336 deletions

504
library/tinymce/LICENSE.TXT Normal file
View file

@ -0,0 +1,504 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
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 Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
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 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
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 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.
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.
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, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
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
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
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
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
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.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
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 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
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
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.
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.
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 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.
It may happen that this requirement contradicts the license
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
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
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 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
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
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 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.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
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
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
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!

View file

@ -1,3 +1,23 @@
Version 3.5.11 (2014-05-08)
Fixed bug in paste plugin word import with lists that have strikethrough on numbers.
Fixed bug in word count plugin where characters with diacritical marks were split as seperate words.
Fixed bug in IE 11 where the selection of images would fail when they where at the end of blocks.
Version 3.5.10 (2013-10-24)
Fixed bug where dialogs using inlinepopups plugin would display incorrectly sometimes
Fixed bug in paste plugin word import that was removing type from lists
Fixed bug where IE 11 wouldn't be properly detected if IE 10 emulation was enabled.
Version 3.5.9 (2013-10-10)
Added IE 11 compatibility. IE 11 is treated as Gecko but it has still many IE bugs.
Fixed bug where importing CSS classes would fail if it contained @import rules to remote domain on Gecko.
Fixed bug in spelling plugin where misspelt words are not always marked.
Fixed bug where script tag was removed when nested inside a div or p.
Fixed full screen plugin state migration from original editor.
Fixed edgecase on up/down arrow keys scrolling with native lists.
Fixed bug where space can scroll webpage when using keyboard to access toolbar buttons.
Fixed bug where up/down arrow keys scroll entire webpage when using keyboard nav in menu ui.
Fixed bug where applying ins/del as inline elements would apply them as blocks.
Fixed bug where backspace on a space after an image would produce a BR on WebKit.
Fixed bug where it wasn't possible to change block type of text blocks.
Version 3.5.8 (2012-11-20) Version 3.5.8 (2012-11-20)
Fixed bug where html5 data attributes where stripped from contents. Fixed bug where html5 data attributes where stripped from contents.
Fixed bug where toolbar was annouced multiple times with JAWS on Firefox. Fixed bug where toolbar was annouced multiple times with JAWS on Firefox.

View file

@ -20,7 +20,7 @@ free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You 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 can use it too, but we suggest you first think carefuly about whether
this license or the ordinary General Public License is the better this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below. strategy to use in any particular case, based on the explanations below.

File diff suppressed because one or more lines are too long

View file

@ -45,42 +45,7 @@
s = tinymce.trim(s); s = tinymce.trim(s);
function rep(re, str) { function rep(re, str) {
s = s.replace(re, str);
s = s.replace(re,str);
//modify code to keep stuff intact within [code][/code] blocks
//Waitman Gobble NO WARRANTY
/* This doesn't seem to work well with
[code]line1
line2[/code]
commenting out for now
*/
/*
var o = new Array();
var x = s.split("[code]");
var i = 0;
var si = "";
si = x.shift();
si = si.replace(re,str);
o.push(si);
for (i = 0; i < x.length; i++) {
var no = new Array();
var j = x.shift();
var g = j.split("[/code]");
no.push(g.shift());
si = g.shift();
si = si.replace(re,str);
no.push(si);
o.push(no.join("[/code]"));
}
s = o.join("[code]");
*/
}; };
@ -170,7 +135,7 @@
rep(/<\/blockquote>/gi,"[/quote]"); rep(/<\/blockquote>/gi,"[/quote]");
rep(/<hr \/>/gi,"[hr]"); rep(/<hr \/>/gi,"[hr]");
rep(/<br (.*?)\/>/gi,"\n"); rep(/<br (.*?)\/>/gi,"\n");
rep(/<br\/>/gi,"\n"); rep(/<br \/>/gi,"\n");
rep(/<br>/gi,"\n"); rep(/<br>/gi,"\n");
rep(/<p>/gi,""); rep(/<p>/gi,"");
rep(/<\/p>/gi,"\n"); rep(/<\/p>/gi,"\n");
@ -201,38 +166,8 @@
_dfrn_bbcode2html : function(s) { _dfrn_bbcode2html : function(s) {
s = tinymce.trim(s); s = tinymce.trim(s);
function rep(re, str) { function rep(re, str) {
/*//modify code to keep stuff intact within [code][/code] blocks
//Waitman Gobble NO WARRANTY
var o = new Array();
var x = s.split("[code]");
var i = 0;
var si = "";
si = x.shift();
si = si.replace(re,str);
o.push(si);
for (i = 0; i < x.length; i++) {
var no = new Array();
var j = x.shift();
var g = j.split("[/code]");
no.push(g.shift());
si = g.shift();
si = si.replace(re,str);
no.push(si);
o.push(no.join("[/code]"));
}
s = o.join("[code]");*/
s = s.replace(re, str); s = s.replace(re, str);
}; };

View file

@ -49,7 +49,7 @@
}, },
/** /**
* Creates control instances based in the incomming name. This method is normally not * Creates control instances based in the incoming name. This method is normally not
* needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
* but you sometimes need to create more complex controls like listboxes, split buttons etc then this * but you sometimes need to create more complex controls like listboxes, split buttons etc then this
* method can be used to create those. * method can be used to create those.

View file

@ -1 +1 @@
(function(){var a=tinymce.DOM;tinymce.create("tinymce.plugins.FullScreenPlugin",{init:function(d,e){var f=this,g={},c,b;f.editor=d;d.addCommand("mceFullScreen",function(){var i,j=a.doc.documentElement;if(d.getParam("fullscreen_is_enabled")){if(d.getParam("fullscreen_new_window")){closeFullscreen()}else{a.win.setTimeout(function(){tinymce.dom.Event.remove(a.win,"resize",f.resizeFunc);tinyMCE.get(d.getParam("fullscreen_editor_id")).setContent(d.getContent());tinyMCE.remove(d);a.remove("mce_fullscreen_container");j.style.overflow=d.getParam("fullscreen_html_overflow");a.setStyle(a.doc.body,"overflow",d.getParam("fullscreen_overflow"));a.win.scrollTo(d.getParam("fullscreen_scrollx"),d.getParam("fullscreen_scrolly"));tinyMCE.settings=tinyMCE.oldSettings},10)}return}if(d.getParam("fullscreen_new_window")){i=a.win.open(e+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{i.resizeTo(screen.availWidth,screen.availHeight)}catch(h){}}else{tinyMCE.oldSettings=tinyMCE.settings;g.fullscreen_overflow=a.getStyle(a.doc.body,"overflow",1)||"auto";g.fullscreen_html_overflow=a.getStyle(j,"overflow",1);c=a.getViewPort();g.fullscreen_scrollx=c.x;g.fullscreen_scrolly=c.y;if(tinymce.isOpera&&g.fullscreen_overflow=="visible"){g.fullscreen_overflow="auto"}if(tinymce.isIE&&g.fullscreen_overflow=="scroll"){g.fullscreen_overflow="auto"}if(tinymce.isIE&&(g.fullscreen_html_overflow=="visible"||g.fullscreen_html_overflow=="scroll")){g.fullscreen_html_overflow="auto"}if(g.fullscreen_overflow=="0px"){g.fullscreen_overflow=""}a.setStyle(a.doc.body,"overflow","hidden");j.style.overflow="hidden";c=a.getViewPort();a.win.scrollTo(0,0);if(tinymce.isIE){c.h-=1}if(tinymce.isIE6||document.compatMode=="BackCompat"){b="absolute;top:"+c.y}else{b="fixed;top:0"}n=a.add(a.doc.body,"div",{id:"mce_fullscreen_container",style:"position:"+b+";left:0;width:"+c.w+"px;height:"+c.h+"px;z-index:200000;"});a.add(n,"div",{id:"mce_fullscreen"});tinymce.each(d.settings,function(k,l){g[l]=k});g.id="mce_fullscreen";g.width=n.clientWidth;g.height=n.clientHeight-15;g.fullscreen_is_enabled=true;g.fullscreen_editor_id=d.id;g.theme_advanced_resizing=false;g.save_onsavecallback=function(){d.setContent(tinyMCE.get(g.id).getContent());d.execCommand("mceSave")};tinymce.each(d.getParam("fullscreen_settings"),function(m,l){g[l]=m});if(g.theme_advanced_toolbar_location==="external"){g.theme_advanced_toolbar_location="top"}f.fullscreenEditor=new tinymce.Editor("mce_fullscreen",g);f.fullscreenEditor.onInit.add(function(){f.fullscreenEditor.setContent(d.getContent());f.fullscreenEditor.focus()});f.fullscreenEditor.render();f.fullscreenElement=new tinymce.dom.Element("mce_fullscreen_container");f.fullscreenElement.update();f.resizeFunc=tinymce.dom.Event.add(a.win,"resize",function(){var o=tinymce.DOM.getViewPort(),l=f.fullscreenEditor,k,m;k=l.dom.getSize(l.getContainer().getElementsByTagName("table")[0]);m=l.dom.getSize(l.getContainer().getElementsByTagName("iframe")[0]);l.theme.resizeTo(o.w-k.w+m.w,o.h-k.h+m.h)})}});d.addButton("fullscreen",{title:"fullscreen.desc",cmd:"mceFullScreen"});d.onNodeChange.add(function(i,h){h.setActive("fullscreen",i.getParam("fullscreen_is_enabled"))})},getInfo:function(){return{longname:"Fullscreen",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("fullscreen",tinymce.plugins.FullScreenPlugin)})(); (function(){var b=tinymce.DOM;var a=function(d,f,e){var c=function(g){var i=d.controlManager.get(g);var h=f.controlManager.get(g);if(i&&h){h.displayColor(i.value)}};c("forecolor");c("backcolor");f.setContent(d.getContent({format:"raw"}),{format:"raw"});f.selection.moveToBookmark(e);if(d.plugins.spellchecker&&f.plugins.spellchecker){f.plugins.spellchecker.setLanguage(d.plugins.spellchecker.selectedLang)}};tinymce.create("tinymce.plugins.FullScreenPlugin",{init:function(i,c){var l=this,m={},k=b.doc.documentElement,d,o,h,g,f,e,j;i.addCommand("mceFullScreen",function(){var q,r;if(i.getParam("fullscreen_is_enabled")){if(i.getParam("fullscreen_new_window")){closeFullscreen()}else{b.win.setTimeout(function(){var t=i;var s=tinyMCE.get(t.getParam("fullscreen_editor_id"));s.plugins.fullscreen.saveState(t);tinyMCE.remove(t)},10)}return}if(i.getParam("fullscreen_new_window")){l.fullscreenSettings={bookmark:i.selection.getBookmark()};q=b.win.open(c+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{q.resizeTo(screen.availWidth,screen.availHeight)}catch(p){}}else{o=b.getStyle(b.doc.body,"overflow",1)||"auto";h=b.getStyle(k,"overflow",1);d=b.getViewPort();g=d.x;f=d.y;if(tinymce.isOpera&&o=="visible"){o="auto"}if(tinymce.isIE&&o=="scroll"){o="auto"}if(tinymce.isIE&&(h=="visible"||h=="scroll")){h="auto"}if(o=="0px"){o=""}b.setStyle(b.doc.body,"overflow","hidden");k.style.overflow="hidden";d=b.getViewPort();b.win.scrollTo(0,0);if(tinymce.isIE){d.h-=1}if(tinymce.isIE6||document.compatMode=="BackCompat"){e="absolute;top:"+d.y}else{e="fixed;top:0"}n=b.add(b.doc.body,"div",{id:"mce_fullscreen_container",style:"position:"+e+";left:0;width:"+d.w+"px;height:"+d.h+"px;z-index:200000;"});b.add(n,"div",{id:"mce_fullscreen"});tinymce.each(i.settings,function(s,t){m[t]=s});m.id="mce_fullscreen";m.width=n.clientWidth;m.height=n.clientHeight-15;m.fullscreen_is_enabled=true;m.fullscreen_editor_id=i.id;m.theme_advanced_resizing=false;m.save_onsavecallback=function(){i.setContent(tinyMCE.get(m.id).getContent());i.execCommand("mceSave")};tinymce.each(i.getParam("fullscreen_settings"),function(t,s){m[s]=t});l.fullscreenSettings={bookmark:i.selection.getBookmark(),fullscreen_overflow:o,fullscreen_html_overflow:h,fullscreen_scrollx:g,fullscreen_scrolly:f};if(m.theme_advanced_toolbar_location==="external"){m.theme_advanced_toolbar_location="top"}tinyMCE.oldSettings=tinyMCE.settings;l.fullscreenEditor=new tinymce.Editor("mce_fullscreen",m);l.fullscreenEditor.onInit.add(function(){l.loadState(l.fullscreenEditor)});l.fullscreenEditor.render();l.fullscreenElement=new tinymce.dom.Element("mce_fullscreen_container");l.fullscreenElement.update();l.resizeFunc=tinymce.dom.Event.add(b.win,"resize",function(){var v=tinymce.DOM.getViewPort(),t=l.fullscreenEditor,s,u;s=t.dom.getSize(t.getContainer().getElementsByTagName("table")[0]);u=t.dom.getSize(t.getContainer().getElementsByTagName("iframe")[0]);t.theme.resizeTo(v.w-s.w+u.w,v.h-s.h+u.h)})}});i.addButton("fullscreen",{title:"fullscreen.desc",cmd:"mceFullScreen"});i.onNodeChange.add(function(q,p){p.setActive("fullscreen",q.getParam("fullscreen_is_enabled"))});l.loadState=function(p){if(!(p&&l.fullscreenSettings)){throw"No fullscreen editor to load to"}a(i,p,l.fullscreenSettings.bookmark);p.focus()};l.saveState=function(q){if(!(q&&l.fullscreenSettings)){throw"No fullscreen editor to restore from"}var p=l.fullscreenSettings;a(q,i,q.selection.getBookmark());if(!i.getParam("fullscreen_new_window")){tinymce.dom.Event.remove(b.win,"resize",l.resizeFunc);delete l.resizeFunc;b.remove("mce_fullscreen_container");b.doc.documentElement.style.overflow=p.fullscreen_html_overflow;b.setStyle(b.doc.body,"overflow",p.fullscreen_overflow);b.win.scrollTo(p.fullscreen_scrollx,p.fullscreen_scrolly)}tinyMCE.settings=tinyMCE.oldSettings;delete tinyMCE.oldSettings;delete l.fullscreenEditor;delete l.fullscreenElement;delete l.fullscreenSettings;b.win.setTimeout(function(){i.selection.moveToBookmark(j);i.focus()},10)}},getInfo:function(){return{longname:"Fullscreen",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("fullscreen",tinymce.plugins.FullScreenPlugin)})();

View file

@ -11,29 +11,48 @@
(function() { (function() {
var DOM = tinymce.DOM; var DOM = tinymce.DOM;
// State Transfer function
var transferState = function(oldEditor, newEditor, bookmark) {
var transferColorButtonState = function(swapme) {
var c = oldEditor.controlManager.get(swapme);
var newC = newEditor.controlManager.get(swapme);
if (c && newC) {
newC.displayColor(c.value);
}
};
transferColorButtonState('forecolor');
transferColorButtonState('backcolor');
newEditor.setContent(oldEditor.getContent({format : 'raw'}), {format : 'raw'});
newEditor.selection.moveToBookmark(bookmark);
if (oldEditor.plugins.spellchecker && newEditor.plugins.spellchecker) {
newEditor.plugins.spellchecker.setLanguage(oldEditor.plugins.spellchecker.selectedLang);
}
};
tinymce.create('tinymce.plugins.FullScreenPlugin', { tinymce.create('tinymce.plugins.FullScreenPlugin', {
init : function(ed, url) { init : function(ed, url) {
var t = this, s = {}, vp, posCss; var t = this, s = {}, de = DOM.doc.documentElement, vp, fullscreen_overflow, fullscreen_html_overflow, fullscreen_scrollx, fullscreen_scrolly, posCss, bookmark;
t.editor = ed;
// Register commands // Register commands
ed.addCommand('mceFullScreen', function() { ed.addCommand('mceFullScreen', function() {
var win, de = DOM.doc.documentElement; var win, oed;
if (ed.getParam('fullscreen_is_enabled')) { if (ed.getParam('fullscreen_is_enabled')) {
if (ed.getParam('fullscreen_new_window')) if (ed.getParam('fullscreen_new_window'))
closeFullscreen(); // Call to close in new window closeFullscreen(); // Call to close in fullscreen.htm
else { else {
DOM.win.setTimeout(function() { DOM.win.setTimeout(function() {
tinymce.dom.Event.remove(DOM.win, 'resize', t.resizeFunc); var fullscreenEditor = ed;
tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent());
tinyMCE.remove(ed); // find the editor that opened this one, execute restore function there
DOM.remove('mce_fullscreen_container'); var originalEditor = tinyMCE.get(fullscreenEditor.getParam('fullscreen_editor_id'));
de.style.overflow = ed.getParam('fullscreen_html_overflow'); originalEditor.plugins.fullscreen.saveState(fullscreenEditor);
DOM.setStyle(DOM.doc.body, 'overflow', ed.getParam('fullscreen_overflow'));
DOM.win.scrollTo(ed.getParam('fullscreen_scrollx'), ed.getParam('fullscreen_scrolly')); tinyMCE.remove(fullscreenEditor);
tinyMCE.settings = tinyMCE.oldSettings; // Restore old settings
}, 10); }, 10);
} }
@ -41,6 +60,9 @@
} }
if (ed.getParam('fullscreen_new_window')) { if (ed.getParam('fullscreen_new_window')) {
t.fullscreenSettings = {
bookmark: ed.selection.getBookmark()
};
win = DOM.win.open(url + "/fullscreen.htm", "mceFullScreenPopup", "fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width=" + screen.availWidth + ",height=" + screen.availHeight); win = DOM.win.open(url + "/fullscreen.htm", "mceFullScreenPopup", "fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width=" + screen.availWidth + ",height=" + screen.availHeight);
try { try {
win.resizeTo(screen.availWidth, screen.availHeight); win.resizeTo(screen.availWidth, screen.availHeight);
@ -48,27 +70,26 @@
// Ignore // Ignore
} }
} else { } else {
tinyMCE.oldSettings = tinyMCE.settings; // Store old settings fullscreen_overflow = DOM.getStyle(DOM.doc.body, 'overflow', 1) || 'auto';
s.fullscreen_overflow = DOM.getStyle(DOM.doc.body, 'overflow', 1) || 'auto'; fullscreen_html_overflow = DOM.getStyle(de, 'overflow', 1);
s.fullscreen_html_overflow = DOM.getStyle(de, 'overflow', 1);
vp = DOM.getViewPort(); vp = DOM.getViewPort();
s.fullscreen_scrollx = vp.x; fullscreen_scrollx = vp.x;
s.fullscreen_scrolly = vp.y; fullscreen_scrolly = vp.y;
// Fixes an Opera bug where the scrollbars doesn't reappear // Fixes an Opera bug where the scrollbars doesn't reappear
if (tinymce.isOpera && s.fullscreen_overflow == 'visible') if (tinymce.isOpera && fullscreen_overflow == 'visible')
s.fullscreen_overflow = 'auto'; fullscreen_overflow = 'auto';
// Fixes an IE bug where horizontal scrollbars would appear // Fixes an IE bug where horizontal scrollbars would appear
if (tinymce.isIE && s.fullscreen_overflow == 'scroll') if (tinymce.isIE && fullscreen_overflow == 'scroll')
s.fullscreen_overflow = 'auto'; fullscreen_overflow = 'auto';
// Fixes an IE bug where the scrollbars doesn't reappear // Fixes an IE bug where the scrollbars doesn't reappear
if (tinymce.isIE && (s.fullscreen_html_overflow == 'visible' || s.fullscreen_html_overflow == 'scroll')) if (tinymce.isIE && (fullscreen_html_overflow == 'visible' || fullscreen_html_overflow == 'scroll'))
s.fullscreen_html_overflow = 'auto'; fullscreen_html_overflow = 'auto';
if (s.fullscreen_overflow == '0px') if (fullscreen_overflow == '0px')
s.fullscreen_overflow = ''; fullscreen_overflow = '';
DOM.setStyle(DOM.doc.body, 'overflow', 'hidden'); DOM.setStyle(DOM.doc.body, 'overflow', 'hidden');
de.style.overflow = 'hidden'; //Fix for IE6/7 de.style.overflow = 'hidden'; //Fix for IE6/7
@ -108,13 +129,21 @@
s[k] = v; s[k] = v;
}); });
t.fullscreenSettings = {
bookmark: ed.selection.getBookmark(),
fullscreen_overflow: fullscreen_overflow,
fullscreen_html_overflow: fullscreen_html_overflow,
fullscreen_scrollx: fullscreen_scrollx,
fullscreen_scrolly: fullscreen_scrolly
};
if (s.theme_advanced_toolbar_location === 'external') if (s.theme_advanced_toolbar_location === 'external')
s.theme_advanced_toolbar_location = 'top'; s.theme_advanced_toolbar_location = 'top';
tinyMCE.oldSettings = tinyMCE.settings; // Store old settings, the Editor constructor overwrites them
t.fullscreenEditor = new tinymce.Editor('mce_fullscreen', s); t.fullscreenEditor = new tinymce.Editor('mce_fullscreen', s);
t.fullscreenEditor.onInit.add(function() { t.fullscreenEditor.onInit.add(function() {
t.fullscreenEditor.setContent(ed.getContent()); t.loadState(t.fullscreenEditor);
t.fullscreenEditor.focus();
}); });
t.fullscreenEditor.render(); t.fullscreenEditor.render();
@ -141,6 +170,52 @@
ed.onNodeChange.add(function(ed, cm) { ed.onNodeChange.add(function(ed, cm) {
cm.setActive('fullscreen', ed.getParam('fullscreen_is_enabled')); cm.setActive('fullscreen', ed.getParam('fullscreen_is_enabled'));
}); });
// fullscreenEditor is a param here because in window mode we don't create it
t.loadState = function(fullscreenEditor) {
if (!(fullscreenEditor && t.fullscreenSettings)) {
throw "No fullscreen editor to load to";
}
transferState(ed, fullscreenEditor, t.fullscreenSettings.bookmark);
fullscreenEditor.focus();
};
// fullscreenEditor is a param here because in window mode we don't create it
t.saveState = function(fullscreenEditor) {
if (!(fullscreenEditor && t.fullscreenSettings)) {
throw "No fullscreen editor to restore from";
}
var settings = t.fullscreenSettings;
transferState(fullscreenEditor, ed, fullscreenEditor.selection.getBookmark());
// cleanup only required if window mode isn't used
if (!ed.getParam('fullscreen_new_window')) {
tinymce.dom.Event.remove(DOM.win, 'resize', t.resizeFunc);
delete t.resizeFunc;
DOM.remove('mce_fullscreen_container');
DOM.doc.documentElement.style.overflow = settings.fullscreen_html_overflow;
DOM.setStyle(DOM.doc.body, 'overflow', settings.fullscreen_overflow);
DOM.win.scrollTo(settings.fullscreen_scrollx, settings.fullscreen_scrolly);
}
tinyMCE.settings = tinyMCE.oldSettings; // Restore old settings
// clear variables
delete tinyMCE.oldSettings;
delete t.fullscreenEditor;
delete t.fullscreenElement;
delete t.fullscreenSettings;
// allow the fullscreen editor to be removed before restoring focus and selection
DOM.win.setTimeout(function() {
ed.selection.moveToBookmark(bookmark);
ed.focus();
}, 10);
};
}, },
getInfo : function() { getInfo : function() {

View file

@ -46,7 +46,7 @@
settings['strict_loading_mode'] = true; settings['strict_loading_mode'] = true;
settings.save_onsavecallback = function() { settings.save_onsavecallback = function() {
window.opener.tinyMCE.get(oeID).setContent(tinyMCE.get('fullscreenarea').getContent({format : 'raw'}), {format : 'raw'}); moveContent();
window.opener.tinyMCE.get(oeID).execCommand('mceSave'); window.opener.tinyMCE.get(oeID).execCommand('mceSave');
window.close(); window.close();
}; };
@ -56,11 +56,15 @@
} }
function moveContent() { function moveContent() {
window.opener.tinyMCE.get(oeID).setContent(tinyMCE.activeEditor.getContent()); // find the original editor, execute restore state in it's plugin instance
window.opener.tinyMCE.get(oeID).plugins.fullscreen.saveState(tinyMCE.activeEditor);
// prevent moveContent from being called twice - e.g. if the unloadHandler runs after moveContent()
tinymce.dom.Event.remove(window, "beforeunload", unloadHandler);
} }
function closeFullscreen() { function closeFullscreen() {
moveContent(); // moveContent() will be called by the unload handler
window.close(); window.close();
} }
@ -78,17 +82,20 @@
function render() { function render() {
var e = document.getElementById('fullscreenarea'), vp, ed, ow, oh, dom = tinymce.DOM; var e = document.getElementById('fullscreenarea'), vp, ed, ow, oh, dom = tinymce.DOM;
e.value = window.opener.tinyMCE.get(oeID).getContent();
vp = dom.getViewPort(); vp = dom.getViewPort();
settings.width = vp.w; settings.width = vp.w;
settings.height = vp.h - 15; settings.height = vp.h - 15;
settings.oninit = function() {
var ed = tinyMCE.activeEditor;
window.opener.tinyMCE.get(oeID).plugins.fullscreen.loadState(ed);
tinymce.dom.Event.add(window, 'resize', function() { tinymce.dom.Event.add(window, 'resize', function() {
var vp = dom.getViewPort(); var vp = dom.getViewPort();
tinyMCE.activeEditor.theme.resizeTo(vp.w, vp.h); tinyMCE.activeEditor.theme.resizeTo(vp.w, vp.h);
}); });
}
tinyMCE.init(settings); tinyMCE.init(settings);
} }

File diff suppressed because one or more lines are too long

View file

@ -60,7 +60,7 @@
if (!f.type) if (!f.type)
t.bookmark = ed.selection.getBookmark(1); t.bookmark = ed.selection.getBookmark(1);
id = DOM.uniqueId(); id = DOM.uniqueId("mce_inlinepopups_"); // Use a prefix so this can't conflict with other ids
vp = DOM.getViewPort(); vp = DOM.getViewPort();
f.width = parseInt(f.width || 320); f.width = parseInt(f.width || 320);
f.height = parseInt(f.height || 240) + (tinymce.isIE ? 8 : 0); f.height = parseInt(f.height || 240) + (tinymce.isIE ? 8 : 0);

File diff suppressed because one or more lines are too long

View file

@ -413,7 +413,9 @@
// If JavaScript had a RegExp look-behind, we could have integrated this with the last process() array and got rid of the loop. But alas, it does not, so we cannot. // If JavaScript had a RegExp look-behind, we could have integrated this with the last process() array and got rid of the loop. But alas, it does not, so we cannot.
do { do {
len = h.length; len = h.length;
h = h.replace(/(<[a-z][^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi, "$1"); // Don't remove the type attribute for lists so that non-default list types display correctly.
h = h.replace(/(<?!(ol|ul)[^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi, "$1");
h = h.replace(/(<(ol|ul)[^>]*\s)(?:id|name|language|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi, "$1");
} while (len != h.length); } while (len != h.length);
// Remove all spans if no styles is to be retained // Remove all spans if no styles is to be retained
@ -717,7 +719,7 @@
if (type == 'ul') if (type == 'ul')
html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*(&nbsp;|\u00a0)+\s*/, ''); html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*(&nbsp;|\u00a0)+\s*/, '');
else else
html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^\s*\w+\.(&nbsp;|\u00a0)+\s*/, ''); html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^\s*[\w|'<'|'>']+\.(&nbsp;|\u00a0)+\s*/, '');;
// Create li and add paragraph data into the new li // Create li and add paragraph data into the new li
li = listElm.appendChild(dom.create('li', 0, html)); li = listElm.appendChild(dom.create('li', 0, html));

View file

@ -14,6 +14,7 @@ var SearchReplaceDialog = {
mcTabs.onChange.add(function(tab_id, panel_id) { mcTabs.onChange.add(function(tab_id, panel_id) {
t.switchMode(tab_id.substring(0, tab_id.indexOf('_'))); t.switchMode(tab_id.substring(0, tab_id.indexOf('_')));
}); });
}, },
switchMode : function(m) { switchMode : function(m) {
@ -39,6 +40,11 @@ var SearchReplaceDialog = {
searchNext : function(a) { searchNext : function(a) {
var ed = tinyMCEPopup.editor, se = ed.selection, r = se.getRng(), f, m = this.lastMode, s, b, fl = 0, w = ed.getWin(), wm = ed.windowManager, fo = 0; var ed = tinyMCEPopup.editor, se = ed.selection, r = se.getRng(), f, m = this.lastMode, s, b, fl = 0, w = ed.getWin(), wm = ed.windowManager, fo = 0;
if (tinymce.isIE11 && !window.find) {
ed.windowManager.alert("This feature is not available in IE 11+. Upgrade TinyMCE to 4.x to get this functionallity back.");
return;
}
// Get input // Get input
f = document.forms[0]; f = document.forms[0];
s = f[m + '_panel_searchstring'].value; s = f[m + '_panel_searchstring'].value;
@ -87,6 +93,10 @@ var SearchReplaceDialog = {
if (b) { if (b) {
r.moveEnd("character", -(rs.length)); // Otherwise will loop forever r.moveEnd("character", -(rs.length)); // Otherwise will loop forever
} else {
// to avoid looping for ever in MSIE 9/10 when just
// changing the case
r.moveStart("character", rs.length);
} }
} }

File diff suppressed because one or more lines are too long

View file

@ -126,6 +126,7 @@
c.onRenderMenu.add(function(c, m) { c.onRenderMenu.add(function(c, m) {
m.add({title : 'spellchecker.langs', 'class' : 'mceMenuItemTitle'}).setDisabled(1); m.add({title : 'spellchecker.langs', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
t.menuItems = {};
each(t.languages, function(v, k) { each(t.languages, function(v, k) {
var o = {icon : 1}, mi; var o = {icon : 1}, mi;
@ -133,27 +134,60 @@
if (v == t.selectedLang) { if (v == t.selectedLang) {
return; return;
} }
mi.setSelected(1); t._updateMenu(mi);
t.selectedItem.setSelected(0);
t.selectedItem = mi;
t.selectedLang = v; t.selectedLang = v;
}; };
o.title = k; o.title = k;
mi = m.add(o); mi = m.add(o);
mi.setSelected(v == t.selectedLang); mi.setSelected(v == t.selectedLang);
t.menuItems[v] = mi;
if (v == t.selectedLang) if (v == t.selectedLang)
t.selectedItem = mi; t.selectedItem = mi;
})
}); });
});
return c; return c;
} }
}, },
setLanguage: function(lang) {
var t = this;
if (lang == t.selectedLang) {
// allowed
return;
}
if (tinymce.grep(t.languages, function(v) { return v === lang; }).length === 0) {
throw "Unknown language: " + lang;
}
t.selectedLang = lang;
// if the menu has been shown, update it as well
if (t.menuItems) {
t._updateMenu(t.menuItems[lang]);
}
if (t.active) {
// clear error in the old language.
t._done();
// Don't immediately block the UI to check spelling in the new language, this is an API not a user action.
}
},
// Internal functions // Internal functions
_updateMenu: function(mi) {
mi.setSelected(1);
this.selectedItem.setSelected(0);
this.selectedItem = mi;
},
_walk : function(n, f) { _walk : function(n, f) {
var d = this.editor.getDoc(), w; var d = this.editor.getDoc(), w;
@ -235,6 +269,7 @@
each(nl, function(n) { each(nl, function(n) {
var node, elem, txt, pos, v = n.nodeValue; var node, elem, txt, pos, v = n.nodeValue;
rx.lastIndex = 0;
if (rx.test(v)) { if (rx.test(v)) {
// Encode the content // Encode the content
v = dom.encode(v); v = dom.encode(v);

File diff suppressed because one or more lines are too long

View file

@ -166,7 +166,7 @@
// Add something to the inner node // Add something to the inner node
if (curNode) if (curNode)
curNode.innerHTML = tinymce.isIE ? '&nbsp;' : '<br data-mce-bogus="1" />'; curNode.innerHTML = tinymce.isIE && !tinymce.isIE11 ? '&nbsp;' : '<br data-mce-bogus="1" />';
return false; return false;
} }
@ -179,7 +179,7 @@
if (formatNode) { if (formatNode) {
cell.appendChild(formatNode); cell.appendChild(formatNode);
} else { } else {
if (!tinymce.isIE) if (!tinymce.isIE || tinymce.isIE11)
cell.innerHTML = '<br data-mce-bogus="1" />'; cell.innerHTML = '<br data-mce-bogus="1" />';
} }
@ -1249,7 +1249,7 @@
if (last && last.nodeName == 'TABLE') { if (last && last.nodeName == 'TABLE') {
if (ed.settings.forced_root_block) if (ed.settings.forced_root_block)
ed.dom.add(ed.getBody(), ed.settings.forced_root_block, null, tinymce.isIE ? '&nbsp;' : '<br data-mce-bogus="1" />'); ed.dom.add(ed.getBody(), ed.settings.forced_root_block, null, tinymce.isIE && !tinymce.isIE11 ? '&nbsp;' : '<br data-mce-bogus="1" />');
else else
ed.dom.add(ed.getBody(), 'br', {'data-mce-bogus': '1'}); ed.dom.add(ed.getBody(), 'br', {'data-mce-bogus': '1'});
} }

View file

@ -91,7 +91,7 @@ function insertTable() {
if (!capEl && caption) { if (!capEl && caption) {
capEl = elm.ownerDocument.createElement('caption'); capEl = elm.ownerDocument.createElement('caption');
if (!tinymce.isIE) if (!tinymce.isIE || tinymce.isIE11)
capEl.innerHTML = '<br data-mce-bogus="1"/>'; capEl.innerHTML = '<br data-mce-bogus="1"/>';
elm.insertBefore(capEl, elm.firstChild); elm.insertBefore(capEl, elm.firstChild);
@ -199,7 +199,7 @@ function insertTable() {
html += '>'; html += '>';
if (caption) { if (caption) {
if (!tinymce.isIE) if (!tinymce.isIE || tinymce.isIE11)
html += '<caption><br data-mce-bogus="1"/></caption>'; html += '<caption><br data-mce-bogus="1"/></caption>';
else else
html += '<caption></caption>'; html += '<caption></caption>';
@ -209,7 +209,7 @@ function insertTable() {
html += "<tr>"; html += "<tr>";
for (var x=0; x<cols; x++) { for (var x=0; x<cols; x++) {
if (!tinymce.isIE) if (!tinymce.isIE || tinymce.isIE11)
html += '<td><br data-mce-bogus="1"/></td>'; html += '<td><br data-mce-bogus="1"/></td>';
else else
html += '<td></td>'; html += '<td></td>';
@ -246,7 +246,7 @@ function insertTable() {
var tdorth = dom.select('td,th', node); var tdorth = dom.select('td,th', node);
// Fixes a bug in IE where the caret cannot be placed after the table if the table is at the end of the document // Fixes a bug in IE where the caret cannot be placed after the table if the table is at the end of the document
if (tinymce.isIE && node.nextSibling == null) { if (tinymce.isIE && !tinymce.isIE11 && node.nextSibling == null) {
if (inst.settings.forced_root_block) if (inst.settings.forced_root_block)
dom.insertAfter(dom.create(inst.settings.forced_root_block), node); dom.insertAfter(dom.create(inst.settings.forced_root_block), node);
else else

View file

@ -1 +1 @@
(function(){tinymce.create("tinymce.plugins.WordCount",{block:0,id:null,countre:null,cleanre:null,init:function(c,d){var e=this,f=0,g=tinymce.VK;e.countre=c.getParam("wordcount_countregex",/[\w\u2019\'-]+/g);e.cleanre=c.getParam("wordcount_cleanregex",/[0-9.(),;:!?%#$?\'\"_+=\\\/-]*/g);e.update_rate=c.getParam("wordcount_update_rate",2000);e.update_on_delete=c.getParam("wordcount_update_on_delete",false);e.id=c.id+"-word-count";c.onPostRender.add(function(i,h){var j,k;k=i.getParam("wordcount_target_id");if(!k){j=tinymce.DOM.get(i.id+"_path_row");if(j){tinymce.DOM.add(j.parentNode,"div",{style:"float: right"},i.getLang("wordcount.words","Words: ")+'<span id="'+e.id+'">0</span>')}}else{tinymce.DOM.add(k,"span",{},'<span id="'+e.id+'">0</span>')}});c.onInit.add(function(h){h.selection.onSetContent.add(function(){e._count(h)});e._count(h)});c.onSetContent.add(function(h){e._count(h)});function b(h){return h!==f&&(h===g.ENTER||f===g.SPACEBAR||a(f))}function a(h){return h===g.DELETE||h===g.BACKSPACE}c.onKeyUp.add(function(h,i){if(b(i.keyCode)||e.update_on_delete&&a(i.keyCode)){e._count(h)}f=i.keyCode})},_getCount:function(c){var a=0;var b=c.getContent({format:"raw"});if(b){b=b.replace(/\.\.\./g," ");b=b.replace(/<.[^<>]*?>/g," ").replace(/&nbsp;|&#160;/gi," ");b=b.replace(/(\w+)(&.+?;)+(\w+)/,"$1$3").replace(/&.+?;/g," ");b=b.replace(this.cleanre,"");var d=b.match(this.countre);if(d){a=d.length}}return a},_count:function(a){var b=this;if(b.block){return}b.block=1;setTimeout(function(){if(!a.destroyed){var c=b._getCount(a);tinymce.DOM.setHTML(b.id,c.toString());setTimeout(function(){b.block=0},b.update_rate)}},1)},getInfo:function(){return{longname:"Word Count plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/wordcount",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("wordcount",tinymce.plugins.WordCount)})(); (function(){tinymce.create("tinymce.plugins.WordCount",{block:0,id:null,countre:null,cleanre:null,init:function(c,d){var e=this,f=0,g=tinymce.VK;e.countre=c.getParam("wordcount_countregex",/[\w\u2019\u00co-\u00ff^\uc397^u00f7\'-]+/g);e.cleanre=c.getParam("wordcount_cleanregex",/[0-9.(),;:!?%#$?\'\"_+=\\\/-]*/g);e.update_rate=c.getParam("wordcount_update_rate",2000);e.update_on_delete=c.getParam("wordcount_update_on_delete",false);e.id=c.id+"-word-count";c.onPostRender.add(function(i,h){var j,k;k=i.getParam("wordcount_target_id");if(!k){j=tinymce.DOM.get(i.id+"_path_row");if(j){tinymce.DOM.add(j.parentNode,"div",{style:"float: right"},i.getLang("wordcount.words","Words: ")+'<span id="'+e.id+'">0</span>')}}else{tinymce.DOM.add(k,"span",{},'<span id="'+e.id+'">0</span>')}});c.onInit.add(function(h){h.selection.onSetContent.add(function(){e._count(h)});e._count(h)});c.onSetContent.add(function(h){e._count(h)});function b(h){return h!==f&&(h===g.ENTER||f===g.SPACEBAR||a(f))}function a(h){return h===g.DELETE||h===g.BACKSPACE}c.onKeyUp.add(function(h,i){if(b(i.keyCode)||e.update_on_delete&&a(i.keyCode)){e._count(h)}f=i.keyCode})},_getCount:function(c){var a=0;var b=c.getContent({format:"raw"});if(b){b=b.replace(/\.\.\./g," ");b=b.replace(/<.[^<>]*?>/g," ").replace(/&nbsp;|&#160;/gi," ");b=b.replace(/(\w+)(&.+?;)+(\w+)/,"$1$3").replace(/&.+?;/g," ");b=b.replace(this.cleanre,"");var d=b.match(this.countre);if(d){a=d.length}}return a},_count:function(a){var b=this;if(b.block){return}b.block=1;setTimeout(function(){if(!a.destroyed){var c=b._getCount(a);tinymce.DOM.setHTML(b.id,c.toString());setTimeout(function(){b.block=0},b.update_rate)}},1)},getInfo:function(){return{longname:"Word Count plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/wordcount",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("wordcount",tinymce.plugins.WordCount)})();

View file

@ -18,7 +18,7 @@
init : function(ed, url) { init : function(ed, url) {
var t = this, last = 0, VK = tinymce.VK; var t = this, last = 0, VK = tinymce.VK;
t.countre = ed.getParam('wordcount_countregex', /[\w\u2019\'-]+/g); // u2019 == &rsquo; t.countre = ed.getParam('wordcount_countregex', /[\w\u2019\u00co-\u00ff^\uc397^u00f7\'-]+/g); // u2019 == &rsquo; u00c0-u00ff extended latin chars with diacritical marks. exclude uc397 multiplication & u00f7 division
t.cleanre = ed.getParam('wordcount_cleanregex', /[0-9.(),;:!?%#$?\'\"_+=\\\/-]*/g); t.cleanre = ed.getParam('wordcount_cleanregex', /[0-9.(),;:!?%#$?\'\"_+=\\\/-]*/g);
t.update_rate = ed.getParam('wordcount_update_rate', 2000); t.update_rate = ed.getParam('wordcount_update_rate', 2000);
t.update_on_delete = ed.getParam('wordcount_update_on_delete', false); t.update_on_delete = ed.getParam('wordcount_update_on_delete', false);

File diff suppressed because one or more lines are too long

View file

@ -2,4 +2,4 @@
// Uncomment and change this document.domain value if you are loading the script cross subdomains // Uncomment and change this document.domain value if you are loading the script cross subdomains
// document.domain = 'moxiecode.com'; // document.domain = 'moxiecode.com';
var tinymce=null,tinyMCEPopup,tinyMCE;tinyMCEPopup={init:function(){var b=this,a,c;a=b.getWin();tinymce=a.tinymce;tinyMCE=a.tinyMCE;b.editor=tinymce.EditorManager.activeEditor;b.params=b.editor.windowManager.params;b.features=b.editor.windowManager.features;b.dom=b.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document,{ownEvents:true,proxy:tinyMCEPopup._eventProxy});b.dom.bind(window,"ready",b._onDOMLoaded,b);if(b.features.popup_css!==false){b.dom.loadCSS(b.features.popup_css||b.editor.settings.popup_css)}b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=!b.getWindowArg("mce_inline");b.id=b.getWindowArg("mce_window_id");b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return(!window.frameElement&&window.dialogArguments)||opener||parent||top},getWindowArg:function(c,b){var a=this.params[c];return tinymce.is(a)?a:b},getParam:function(b,a){return this.editor.getParam(b,a)},getLang:function(b,a){return this.editor.getLang(b,a)},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},resizeToInnerSize:function(){var a=this;setTimeout(function(){var b=a.dom.getViewPort(window);a.editor.windowManager.resizeBy(a.getWindowArg("mce_width")-b.w,a.getWindowArg("mce_height")-b.h,a.id||window)},10)},executeOnLoad:function(s){this.onInit.add(function(){eval(s)})},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(1)},restoreSelection:function(){var a=tinyMCEPopup;if(!a.isWindow&&tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},requireLangPack:function(){var b=this,a=b.getWindowArg("plugin_url")||b.getWindowArg("theme_url");if(a&&b.editor.settings.language&&b.features.translate_i18n!==false&&b.editor.settings.language_load!==false){a+="/langs/"+b.editor.settings.language+"_dlg.js";if(!tinymce.ScriptLoader.isDone(a)){document.write('<script type="text/javascript" src="'+tinymce._addVer(a)+'"><\/script>');tinymce.ScriptLoader.markDone(a)}}},pickColor:function(b,a){this.execCommand("mceColorPicker",true,{color:document.getElementById(a).value,func:function(e){document.getElementById(a).value=e;try{document.getElementById(a).onchange()}catch(d){}}})},openBrowser:function(a,c,b){tinyMCEPopup.restoreSelection();this.editor.execCallback("file_browser_callback",a,document.getElementById(a).value,c,window)},confirm:function(b,a,c){this.editor.windowManager.confirm(b,a,c,window)},alert:function(b,a,c){this.editor.windowManager.alert(b,a,c,window)},close:function(){var a=this;function b(){a.editor.windowManager.close(window);tinymce=tinyMCE=a.editor=a.params=a.dom=a.dom.doc=null}if(tinymce.isOpera){a.getWin().setTimeout(b,0)}else{b()}},_restoreSelection:function(){var a=window.event.srcElement;if(a.nodeName=="INPUT"&&(a.type=="submit"||a.type=="button")){tinyMCEPopup.restoreSelection()}},_onDOMLoaded:function(){var b=tinyMCEPopup,d=document.title,e,c,a;if(b.features.translate_i18n!==false){c=document.body.innerHTML;if(tinymce.isIE){c=c.replace(/ (value|title|alt)=([^"][^\s>]+)/gi,' $1="$2"')}document.dir=b.editor.getParam("directionality","");if((a=b.editor.translate(c))&&a!=c){document.body.innerHTML=a}if((a=b.editor.translate(d))&&a!=d){document.title=d=a}}if(!b.editor.getParam("browser_preferred_colors",false)||!b.isWindow){b.dom.addClass(document.body,"forceColors")}document.body.style.display="";if(tinymce.isIE){document.attachEvent("onmouseup",tinyMCEPopup._restoreSelection);b.dom.add(b.dom.select("head")[0],"base",{target:"_self"})}b.restoreSelection();b.resizeToInnerSize();if(!b.isWindow){b.editor.windowManager.setTitle(window,d)}else{window.focus()}if(!tinymce.isIE&&!b.isWindow){b.dom.bind(document,"focus",function(){b.editor.windowManager.focus(b.id)})}tinymce.each(b.dom.select("select"),function(f){f.onkeydown=tinyMCEPopup._accessHandler});tinymce.each(b.listeners,function(f){f.func.call(f.scope,b.editor)});if(b.getWindowArg("mce_auto_focus",true)){window.focus();tinymce.each(document.forms,function(g){tinymce.each(g.elements,function(f){if(b.dom.hasClass(f,"mceFocus")&&!f.disabled){f.focus();return false}})})}document.onkeyup=tinyMCEPopup._closeWinKeyHandler},_accessHandler:function(a){a=a||window.event;if(a.keyCode==13||a.keyCode==32){var b=a.target||a.srcElement;if(b.onchange){b.onchange()}return tinymce.dom.Event.cancel(a)}},_closeWinKeyHandler:function(a){a=a||window.event;if(a.keyCode==27){tinyMCEPopup.close()}},_eventProxy:function(a){return function(b){tinyMCEPopup.dom.events.callNativeHandler(a,b)}}};tinyMCEPopup.init(); var tinymce=null,tinyMCEPopup,tinyMCE;tinyMCEPopup={init:function(){var b=this,a,c;a=b.getWin();tinymce=a.tinymce;tinyMCE=a.tinyMCE;b.editor=tinymce.EditorManager.activeEditor;b.params=b.editor.windowManager.params;b.features=b.editor.windowManager.features;b.dom=b.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document,{ownEvents:true,proxy:tinyMCEPopup._eventProxy});b.dom.bind(window,"ready",b._onDOMLoaded,b);if(b.features.popup_css!==false){b.dom.loadCSS(b.features.popup_css||b.editor.settings.popup_css)}b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=!b.getWindowArg("mce_inline");b.id=b.getWindowArg("mce_window_id");b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return(!window.frameElement&&window.dialogArguments)||opener||parent||top},getWindowArg:function(c,b){var a=this.params[c];return tinymce.is(a)?a:b},getParam:function(b,a){return this.editor.getParam(b,a)},getLang:function(b,a){return this.editor.getLang(b,a)},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},resizeToInnerSize:function(){var a=this;setTimeout(function(){var b=a.dom.getViewPort(window);a.editor.windowManager.resizeBy(a.getWindowArg("mce_width")-b.w,a.getWindowArg("mce_height")-b.h,a.id||window)},10)},executeOnLoad:function(s){this.onInit.add(function(){eval(s)})},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(1)},restoreSelection:function(){var a=tinyMCEPopup;if(!a.isWindow&&tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},requireLangPack:function(){var b=this,a=b.getWindowArg("plugin_url")||b.getWindowArg("theme_url");if(a&&b.editor.settings.language&&b.features.translate_i18n!==false&&b.editor.settings.language_load!==false){a+="/langs/"+b.editor.settings.language+"_dlg.js";if(!tinymce.ScriptLoader.isDone(a)){document.write('<script type="text/javascript" src="'+tinymce._addVer(a)+'"><\/script>');tinymce.ScriptLoader.markDone(a)}}},pickColor:function(b,a){this.execCommand("mceColorPicker",true,{color:document.getElementById(a).value,func:function(e){document.getElementById(a).value=e;try{document.getElementById(a).onchange()}catch(d){}}})},openBrowser:function(a,c,b){tinyMCEPopup.restoreSelection();this.editor.execCallback("file_browser_callback",a,document.getElementById(a).value,c,window)},confirm:function(b,a,c){this.editor.windowManager.confirm(b,a,c,window)},alert:function(b,a,c){this.editor.windowManager.alert(b,a,c,window)},close:function(){var a=this;function b(){a.editor.windowManager.close(window);tinymce=tinyMCE=a.editor=a.params=a.dom=a.dom.doc=null}if(tinymce.isOpera){a.getWin().setTimeout(b,0)}else{b()}},_restoreSelection:function(a){var a=(a&&a.target)||window.event.srcElement;if(a.nodeName=="INPUT"&&(a.type=="submit"||a.type=="button")){tinyMCEPopup.restoreSelection()}},_onDOMLoaded:function(){var b=tinyMCEPopup,d=document.title,e,c,a;if(b.features.translate_i18n!==false){c=document.body.innerHTML;if(tinymce.isIE){c=c.replace(/ (value|title|alt)=([^"][^\s>]+)/gi,' $1="$2"')}document.dir=b.editor.getParam("directionality","");if((a=b.editor.translate(c))&&a!=c){document.body.innerHTML=a}if((a=b.editor.translate(d))&&a!=d){document.title=d=a}}if(!b.editor.getParam("browser_preferred_colors",false)||!b.isWindow){b.dom.addClass(document.body,"forceColors")}document.body.style.display="";if(tinymce.isIE&&!tinymce.isIE11){document.attachEvent("onmouseup",tinyMCEPopup._restoreSelection);b.dom.add(b.dom.select("head")[0],"base",{target:"_self"})}else{if(tinymce.isIE11){document.addEventListener("mouseup",tinyMCEPopup._restoreSelection,false)}}b.restoreSelection();b.resizeToInnerSize();if(!b.isWindow){b.editor.windowManager.setTitle(window,d)}else{window.focus()}if(!tinymce.isIE&&!b.isWindow){b.dom.bind(document,"focus",function(){b.editor.windowManager.focus(b.id)})}tinymce.each(b.dom.select("select"),function(f){f.onkeydown=tinyMCEPopup._accessHandler});tinymce.each(b.listeners,function(f){f.func.call(f.scope,b.editor)});if(b.getWindowArg("mce_auto_focus",true)){window.focus();tinymce.each(document.forms,function(g){tinymce.each(g.elements,function(f){if(b.dom.hasClass(f,"mceFocus")&&!f.disabled){f.focus();return false}})})}document.onkeyup=tinyMCEPopup._closeWinKeyHandler},_accessHandler:function(a){a=a||window.event;if(a.keyCode==13||a.keyCode==32){var b=a.target||a.srcElement;if(b.onchange){b.onchange()}return tinymce.dom.Event.cancel(a)}},_closeWinKeyHandler:function(a){a=a||window.event;if(a.keyCode==27){tinyMCEPopup.close()}},_eventProxy:function(a){return function(b){tinyMCEPopup.dom.events.callNativeHandler(a,b)}}};tinyMCEPopup.init();

View file

@ -6,18 +6,20 @@
var tinymce = { var tinymce = {
majorVersion : '3', majorVersion : '3',
minorVersion : '5.8', minorVersion : '5.11',
releaseDate : '2012-11-20', releaseDate : '2014-05-08',
_init : function() { _init : function() {
var t = this, d = document, na = navigator, ua = na.userAgent, i, nl, n, base, p, v; var t = this, d = document, na = navigator, ua = na.userAgent, i, nl, n, base, p, v;
t.isIE11 = ua.indexOf('Trident/') != -1 && (ua.indexOf('rv:') != -1 || na.appName.indexOf('Netscape') != -1);
t.isOpera = win.opera && opera.buildNumber; t.isOpera = win.opera && opera.buildNumber;
t.isWebKit = /WebKit/.test(ua); t.isWebKit = /WebKit/.test(ua);
t.isIE = !t.isWebKit && !t.isOpera && (/MSIE/gi).test(ua) && (/Explorer/gi).test(na.appName); t.isIE = !t.isWebKit && !t.isOpera && (/MSIE/gi).test(ua) && (/Explorer/gi).test(na.appName) || t.isIE11;
t.isIE6 = t.isIE && /MSIE [56]/.test(ua); t.isIE6 = t.isIE && /MSIE [56]/.test(ua);
@ -27,7 +29,7 @@
t.isIE9 = t.isIE && /MSIE [9]/.test(ua); t.isIE9 = t.isIE && /MSIE [9]/.test(ua);
t.isGecko = !t.isWebKit && /Gecko/.test(ua); t.isGecko = !t.isWebKit && !t.isIE11 && /Gecko/.test(ua);
t.isMac = ua.indexOf('Mac') != -1; t.isMac = ua.indexOf('Mac') != -1;
@ -1120,11 +1122,31 @@ tinymce.util.Quirks = function(editor) {
function cleanupStylesWhenDeleting() { function cleanupStylesWhenDeleting() {
function removeMergedFormatSpans(isDelete) { function removeMergedFormatSpans(isDelete) {
var rng, blockElm, node, clonedSpan; var rng, blockElm, wrapperElm, bookmark, container, offset, elm;
function isAtStartOrEndOfElm() {
if (container.nodeType == 3) {
if (isDelete && offset == container.length) {
return true;
}
if (!isDelete && offset === 0) {
return true;
}
}
}
rng = selection.getRng(); rng = selection.getRng();
var tmpRng = [rng.startContainer, rng.startOffset, rng.endContainer, rng.endOffset];
// Find root block if (!rng.collapsed) {
isDelete = true;
}
container = rng[(isDelete ? 'start' : 'end') + 'Container'];
offset = rng[(isDelete ? 'start' : 'end') + 'Offset'];
if (container.nodeType == 3) {
blockElm = dom.getParent(rng.startContainer, dom.isBlock); blockElm = dom.getParent(rng.startContainer, dom.isBlock);
// On delete clone the root span of the next block element // On delete clone the root span of the next block element
@ -1132,43 +1154,36 @@ tinymce.util.Quirks = function(editor) {
blockElm = dom.getNext(blockElm, dom.isBlock); blockElm = dom.getNext(blockElm, dom.isBlock);
} }
// Locate root span element and clone it since it would otherwise get merged by the "apple-style-span" on delete/backspace if (blockElm && (isAtStartOrEndOfElm() || !rng.collapsed)) {
if (blockElm) { // Wrap children of block in a EM and let WebKit stick is
node = blockElm.firstChild; // runtime styles junk into that EM
wrapperElm = dom.create('em', {'id': '__mceDel'});
// Ignore empty text nodes each(tinymce.grep(blockElm.childNodes), function(node) {
while (node && node.nodeType == 3 && node.nodeValue.length === 0) { wrapperElm.appendChild(node);
node = node.nextSibling;
}
if (node && node.nodeName === 'SPAN') {
clonedSpan = node.cloneNode(false);
}
}
each(dom.select('span', blockElm), function(span) {
span.setAttribute('data-mce-mark', '1');
}); });
blockElm.appendChild(wrapperElm);
}
}
// Do the backspace/delete action // Do the backspace/delete action
rng = dom.createRng();
rng.setStart(tmpRng[0], tmpRng[1]);
rng.setEnd(tmpRng[2], tmpRng[3]);
selection.setRng(rng);
editor.getDoc().execCommand(isDelete ? 'ForwardDelete' : 'Delete', false, null); editor.getDoc().execCommand(isDelete ? 'ForwardDelete' : 'Delete', false, null);
// Find all odd apple-style-spans // Remove temp wrapper element
blockElm = dom.getParent(rng.startContainer, dom.isBlock); if (wrapperElm) {
each(dom.select('span', blockElm), function(span) { bookmark = selection.getBookmark();
var bm = selection.getBookmark();
if (clonedSpan) { while (elm = dom.get('__mceDel')) {
dom.replace(clonedSpan.cloneNode(false), span, true); dom.remove(elm, true);
} else if (!span.getAttribute('data-mce-mark')) {
dom.remove(span, true);
} else {
span.removeAttribute('data-mce-mark');
} }
// Restore the selection selection.moveToBookmark(bookmark);
selection.moveToBookmark(bm); }
});
} }
editor.onKeyDown.add(function(editor, e) { editor.onKeyDown.add(function(editor, e) {
@ -1490,6 +1505,12 @@ tinymce.util.Quirks = function(editor) {
// Override delete if the start container is a text node and is at the beginning of text or // Override delete if the start container is a text node and is at the beginning of text or
// just before/after the last character to be deleted in collapsed mode // just before/after the last character to be deleted in collapsed mode
if (container.nodeType == 3 && container.nodeValue.length > 0 && ((offset === 0 && !collapsed) || (collapsed && offset === (isDelete ? 0 : 1)))) { if (container.nodeType == 3 && container.nodeValue.length > 0 && ((offset === 0 && !collapsed) || (collapsed && offset === (isDelete ? 0 : 1)))) {
// Edge case when deleting <p><b><img> |x</b></p>
sibling = container.previousSibling;
if (sibling && sibling.nodeName == "IMG") {
return;
}
nonEmptyElements = editor.schema.getNonEmptyElements(); nonEmptyElements = editor.schema.getNonEmptyElements();
// Prevent default logic since it's broken // Prevent default logic since it's broken
@ -1922,6 +1943,40 @@ tinymce.util.Quirks = function(editor) {
} }
} }
function bodyHeight() {
editor.contentStyles.push('body {min-height: 100px}');
editor.onClick.add(function(ed, e) {
if (e.target.nodeName == 'HTML') {
editor.execCommand('SelectAll');
editor.selection.collapse(true);
editor.nodeChanged();
}
});
}
function fixControlSelection() {
editor.onInit.add(function() {
var selectedRng;
editor.getBody().addEventListener('mscontrolselect', function(e) {
setTimeout(function() {
if (editor.selection.getNode() != e.target) {
selectedRng = editor.selection.getRng();
selection.fakeRng = editor.dom.createRng();
selection.fakeRng.setStartBefore(e.target);
selection.fakeRng.setEndAfter(e.target);
}
}, 0);
}, false);
editor.getDoc().addEventListener('selectionchange', function(e) {
if (selectedRng && !tinymce.dom.RangeUtils.compareRanges(editor.selection.getRng(), selectedRng)) {
selection.fakeRng = selectedRng = null;
}
}, false);
});
}
// All browsers // All browsers
disableBackspaceIntoATable(); disableBackspaceIntoATable();
removeBlockQuoteOnBackSpace(); removeBlockQuoteOnBackSpace();
@ -1945,7 +2000,7 @@ tinymce.util.Quirks = function(editor) {
} }
// IE // IE
if (tinymce.isIE) { if (tinymce.isIE && !tinymce.isIE11) {
removeHrOnBackspace(); removeHrOnBackspace();
ensureBodyHasRoleApplication(); ensureBodyHasRoleApplication();
addNewLinesBeforeBrInPre(); addNewLinesBeforeBrInPre();
@ -1955,8 +2010,14 @@ tinymce.util.Quirks = function(editor) {
keepNoScriptContents(); keepNoScriptContents();
} }
// IE 11+
if (tinymce.isIE11) {
bodyHeight();
fixControlSelection();
}
// Gecko // Gecko
if (tinymce.isGecko) { if (tinymce.isGecko && !tinymce.isIE11) {
removeHrOnBackspace(); removeHrOnBackspace();
focusBody(); focusBody();
removeStylesWhenDeletingAccrossBlockElements(); removeStylesWhenDeletingAccrossBlockElements();
@ -2193,6 +2254,12 @@ tinymce.html.Styles = function(settings, schema) {
function compress(prefix, suffix) { function compress(prefix, suffix) {
var top, right, bottom, left; var top, right, bottom, left;
// IE 11 will produce a border-image: none when getting the style attribute from <p style="border: 1px solid red"></p>
// So lets asume it shouldn't be there
if (styles['border-image'] === 'none') {
delete styles['border-image'];
}
// Get values and check it it needs compressing // Get values and check it it needs compressing
top = styles[prefix + '-top' + suffix]; top = styles[prefix + '-top' + suffix];
if (!top) if (!top)
@ -2715,7 +2782,7 @@ tinymce.html.Styles = function(settings, schema) {
selfClosingElementsMap = createLookupTable('self_closing_elements', 'colgroup dd dt li option p td tfoot th thead tr'); selfClosingElementsMap = createLookupTable('self_closing_elements', 'colgroup dd dt li option p td tfoot th thead tr');
shortEndedElementsMap = createLookupTable('short_ended_elements', 'area base basefont br col frame hr img input isindex link meta param embed source wbr'); shortEndedElementsMap = createLookupTable('short_ended_elements', 'area base basefont br col frame hr img input isindex link meta param embed source wbr');
boolAttrMap = createLookupTable('boolean_attributes', 'checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls'); boolAttrMap = createLookupTable('boolean_attributes', 'checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls');
nonEmptyElementsMap = createLookupTable('non_empty_elements', 'td th iframe video audio object', shortEndedElementsMap); nonEmptyElementsMap = createLookupTable('non_empty_elements', 'td th iframe video audio object script', shortEndedElementsMap);
textBlockElementsMap = createLookupTable('text_block_elements', 'h1 h2 h3 h4 h5 h6 p div address pre form ' + textBlockElementsMap = createLookupTable('text_block_elements', 'h1 h2 h3 h4 h5 h6 p div address pre form ' +
'blockquote center dir fieldset header footer article section hgroup aside nav figure'); 'blockquote center dir fieldset header footer article section hgroup aside nav figure');
blockElementsMap = createLookupTable('block_elements', 'hr table tbody thead tfoot ' + blockElementsMap = createLookupTable('block_elements', 'hr table tbody thead tfoot ' +
@ -5236,7 +5303,7 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
fixDoc: function(doc) { fixDoc: function(doc) {
var settings = this.settings, name; var settings = this.settings, name;
if (isIE && settings.schema) { if (isIE && !tinymce.isIE11 && settings.schema) {
// Add missing HTML 4/5 elements to IE // Add missing HTML 4/5 elements to IE
('abbr article aside audio canvas ' + ('abbr article aside audio canvas ' +
'details figcaption figure footer ' + 'details figcaption figure footer ' +
@ -5257,7 +5324,7 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
var self = this, clone, doc; var self = this, clone, doc;
// TODO: Add feature detection here in the future // TODO: Add feature detection here in the future
if (!isIE || node.nodeType !== 1 || deep) { if (!isIE || tinymce.isIE11 || node.nodeType !== 1 || deep) {
return node.cloneNode(deep); return node.cloneNode(deep);
} }
@ -5530,7 +5597,7 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
switch (na) { switch (na) {
case 'opacity': case 'opacity':
// IE specific opacity // IE specific opacity
if (isIE) { if (isIE && ! tinymce.isIE11) {
s.filter = v === '' ? '' : "alpha(opacity=" + (v * 100) + ")"; s.filter = v === '' ? '' : "alpha(opacity=" + (v * 100) + ")";
if (!n.currentStyle || !n.currentStyle.hasLayout) if (!n.currentStyle || !n.currentStyle.hasLayout)
@ -5542,7 +5609,7 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
break; break;
case 'float': case 'float':
isIE ? s.styleFloat = v : s.cssFloat = v; (isIE && ! tinymce.isIE11) ? s.styleFloat = v : s.cssFloat = v;
break; break;
default: default:
@ -5908,7 +5975,7 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
// IE 8 has a bug where dynamically loading stylesheets would produce a 1 item remaining bug // IE 8 has a bug where dynamically loading stylesheets would produce a 1 item remaining bug
// This fix seems to resolve that issue by realcing the document ones a stylesheet finishes loading // This fix seems to resolve that issue by realcing the document ones a stylesheet finishes loading
// It's ugly but it seems to work fine. // It's ugly but it seems to work fine.
if (isIE && d.documentMode && d.recalc) { if (isIE && !tinymce.isIE11 && d.documentMode && d.recalc) {
link.onload = function() { link.onload = function() {
if (d.recalc) if (d.recalc)
d.recalc(); d.recalc();
@ -6227,7 +6294,12 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
// Import // Import
case 3: case 3:
try {
addClasses(r.styleSheet); addClasses(r.styleSheet);
} catch (ex) {
// Ignore
}
break; break;
} }
}); });
@ -9329,7 +9401,7 @@ window.tinymce.dom.Sizzle = Sizzle;
if (!t.win.getSelection) if (!t.win.getSelection)
t.tridentSel = new tinymce.dom.TridentSelection(t); t.tridentSel = new tinymce.dom.TridentSelection(t);
if (tinymce.isIE && dom.boxModel) if (tinymce.isIE && ! tinymce.isIE11 && dom.boxModel)
this._fixIESelection(); this._fixIESelection();
// Prevent leaks // Prevent leaks
@ -9621,8 +9693,20 @@ window.tinymce.dom.Sizzle = Sizzle;
} }
// Handle simple range // Handle simple range
if (type) if (type) {
return {rng : t.getRng()}; rng = t.getRng();
if (rng.setStart) {
rng = {
startContainer: rng.startContainer,
startOffset: rng.startOffset,
endContainer: rng.endContainer,
endOffset: rng.endOffset
};
}
return {rng : rng};
}
rng = t.getRng(); rng = t.getRng();
id = dom.uniqueId(); id = dom.uniqueId();
@ -9688,7 +9772,7 @@ window.tinymce.dom.Sizzle = Sizzle;
}, },
moveToBookmark : function(bookmark) { moveToBookmark : function(bookmark) {
var t = this, dom = t.dom, marker1, marker2, rng, root, startContainer, endContainer, startOffset, endOffset; var t = this, dom = t.dom, marker1, marker2, rng, rng2, root, startContainer, endContainer, startOffset, endOffset;
function setEndPoint(start) { function setEndPoint(start) {
var point = bookmark[start ? 'start' : 'end'], i, node, offset, children; var point = bookmark[start ? 'start' : 'end'], i, node, offset, children;
@ -9818,8 +9902,24 @@ window.tinymce.dom.Sizzle = Sizzle;
} }
} else if (bookmark.name) { } else if (bookmark.name) {
t.select(dom.select(bookmark.name)[bookmark.index]); t.select(dom.select(bookmark.name)[bookmark.index]);
} else if (bookmark.rng) } else if (bookmark.rng) {
t.setRng(bookmark.rng); rng = bookmark.rng;
if (rng.startContainer) {
rng2 = t.dom.createRng();
try {
rng2.setStart(rng.startContainer, rng.startOffset);
rng2.setEnd(rng.endContainer, rng.endOffset);
} catch (e) {
// Might fail with index error
}
rng = rng2;
}
t.setRng(rng);
}
} }
}, },
@ -9904,6 +10004,11 @@ window.tinymce.dom.Sizzle = Sizzle;
getRng : function(w3c) { getRng : function(w3c) {
var self = this, selection, rng, elm, doc = self.win.document; var self = this, selection, rng, elm, doc = self.win.document;
// Workaround for IE 11 not being able to select images properly see #6613 see quirk fix
if (self.fakeRng) {
return self.fakeRng;
}
// Found tridentSel object then we need to use that one // Found tridentSel object then we need to use that one
if (w3c && self.tridentSel) { if (w3c && self.tridentSel) {
return self.tridentSel.getRangeAt(0); return self.tridentSel.getRangeAt(0);
@ -9918,7 +10023,7 @@ window.tinymce.dom.Sizzle = Sizzle;
} }
// We have W3C ranges and it's IE then fake control selection since IE9 doesn't handle that correctly yet // We have W3C ranges and it's IE then fake control selection since IE9 doesn't handle that correctly yet
if (tinymce.isIE && rng && rng.setStart && doc.selection.createRange().item) { if (tinymce.isIE && ! tinymce.isIE11 && rng && rng.setStart && doc.selection.createRange().item) {
elm = doc.selection.createRange().item(0); elm = doc.selection.createRange().item(0);
rng = doc.createRange(); rng = doc.createRange();
rng.setStartBefore(elm); rng.setStartBefore(elm);
@ -10783,7 +10888,7 @@ window.tinymce.dom.Sizzle = Sizzle;
// Add onload listener for non IE browsers since IE9 // Add onload listener for non IE browsers since IE9
// fires onload event before the script is parsed and executed // fires onload event before the script is parsed and executed
if (!tinymce.isIE) if (!tinymce.isIE || tinymce.isIE11)
elm.onload = done; elm.onload = done;
// Add onerror event will get fired on some browsers but not all of them // Add onerror event will get fired on some browsers but not all of them
@ -11196,18 +11301,22 @@ window.tinymce.dom.Sizzle = Sizzle;
switch (evt.keyCode) { switch (evt.keyCode) {
case DOM_VK_LEFT: case DOM_VK_LEFT:
if (enableLeftRight) t.moveFocus(-1); if (enableLeftRight) t.moveFocus(-1);
Event.cancel(evt);
break; break;
case DOM_VK_RIGHT: case DOM_VK_RIGHT:
if (enableLeftRight) t.moveFocus(1); if (enableLeftRight) t.moveFocus(1);
Event.cancel(evt);
break; break;
case DOM_VK_UP: case DOM_VK_UP:
if (enableUpDown) t.moveFocus(-1); if (enableUpDown) t.moveFocus(-1);
Event.cancel(evt);
break; break;
case DOM_VK_DOWN: case DOM_VK_DOWN:
if (enableUpDown) t.moveFocus(1); if (enableUpDown) t.moveFocus(1);
Event.cancel(evt);
break; break;
case DOM_VK_ESCAPE: case DOM_VK_ESCAPE:
@ -11929,9 +12038,11 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
return s.onclick.call(s.scope, e); return s.onclick.call(s.scope, e);
} }
}); });
tinymce.dom.Event.add(t.id, 'keyup', function(e) { tinymce.dom.Event.add(t.id, 'keydown', function(e) {
if (!t.isDisabled() && e.keyCode==tinymce.VK.SPACEBAR) if (!t.isDisabled() && e.keyCode==tinymce.VK.SPACEBAR) {
tinymce.dom.Event.cancel(e);
return s.onclick.call(s.scope, e); return s.onclick.call(s.scope, e);
}
}); });
} }
}); });
@ -12344,7 +12455,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
// Accessibility keyhandler // Accessibility keyhandler
Event.add(t.id, 'keydown', function(e) { Event.add(t.id, 'keydown', function(e) {
var bf; var bf, DOM_VK_LEFT = 37, DOM_VK_RIGHT = 39, DOM_VK_UP = 38, DOM_VK_DOWN = 40, DOM_VK_RETURN = 13, DOM_VK_SPACE = 32;
Event.remove(t.id, 'change', ch); Event.remove(t.id, 'change', ch);
changeListenerAdded = false; changeListenerAdded = false;
@ -12356,14 +12467,12 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
Event.remove(t.id, 'blur', bf); Event.remove(t.id, 'blur', bf);
}); });
//prevent default left and right keys on chrome - so that the keyboard navigation is used. if (e.keyCode == DOM_VK_RETURN || e.keyCode == DOM_VK_SPACE) {
if (tinymce.isWebKit && (e.keyCode==37 ||e.keyCode==39)) {
return Event.prevent(e);
}
if (e.keyCode == 13 || e.keyCode == 32) {
onChange(e); onChange(e);
return Event.cancel(e); return Event.cancel(e);
} else if (e.keyCode == DOM_VK_DOWN || e.keyCode == DOM_VK_UP) {
// allow native implementation (navigate select element options)
e.stopImmediatePropagation();
} }
}); });
@ -13252,7 +13361,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
ed.render(); ed.render();
// Fix IE memory leaks // Fix IE memory leaks
if (tinymce.isIE) { if (tinymce.isIE && ! tinymce.isIE11) {
w.attachEvent('onunload', clr); w.attachEvent('onunload', clr);
} }
@ -13650,10 +13759,16 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
// Store away the selection when it's changed to it can be restored later with a editor.focus() call // Store away the selection when it's changed to it can be restored later with a editor.focus() call
if (isIE) { if (isIE) {
t.onInit.add(function(ed) { t.onInit.add(function(ed) {
ed.dom.bind(ed.getBody(), 'beforedeactivate keydown', function() { ed.dom.bind(ed.getBody(), 'beforedeactivate keydown keyup', function() {
ed.lastIERng = ed.selection.getRng(); ed.bookmark = ed.selection.getBookmark(1);
}); });
}); });
t.onNodeChange.add(function(ed) {
if (document.activeElement.id == ed.id + "_ifr") {
ed.bookmark = ed.selection.getBookmark(1);
}
});
} }
} }
@ -13973,8 +14088,9 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
var oed, self = this, selection = self.selection, contentEditable = self.settings.content_editable, ieRng, controlElm, doc = self.getDoc(), body; var oed, self = this, selection = self.selection, contentEditable = self.settings.content_editable, ieRng, controlElm, doc = self.getDoc(), body;
if (!skip_focus) { if (!skip_focus) {
if (self.lastIERng) { if (self.bookmark) {
selection.setRng(self.lastIERng); selection.moveToBookmark(self.bookmark);
self.bookmark = null;
} }
// Get selected control element // Get selected control element
@ -13995,7 +14111,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
body = self.getBody(); body = self.getBody();
// Check for setActive since it doesn't scroll to the element // Check for setActive since it doesn't scroll to the element
if (body.setActive) { if (body.setActive && ! tinymce.isIE11) {
body.setActive(); body.setActive();
} else { } else {
body.focus(); body.focus();
@ -16405,7 +16521,11 @@ tinymce.ForceBlocks = function(editor) {
getContentEditable = dom.getContentEditable; getContentEditable = dom.getContentEditable;
function isTextBlock(name) { function isTextBlock(name) {
return !!ed.schema.getTextBlocks()[name.toLowerCase()]; if (name.nodeType) {
name = name.nodeName;
}
return !!ed.schema.getTextBlockElements()[name.toLowerCase()];
} }
function getParents(node, selector) { function getParents(node, selector) {
@ -16766,7 +16886,7 @@ tinymce.ForceBlocks = function(editor) {
// Is it valid to wrap this item // Is it valid to wrap this item
if (contentEditable && !hasContentEditableState && isValid(wrapName, nodeName) && isValid(parentName, wrapName) && if (contentEditable && !hasContentEditableState && isValid(wrapName, nodeName) && isValid(parentName, wrapName) &&
!(!node_specific && node.nodeType === 3 && node.nodeValue.length === 1 && node.nodeValue.charCodeAt(0) === 65279) && !isCaretNode(node)) { !(!node_specific && node.nodeType === 3 && node.nodeValue.length === 1 && node.nodeValue.charCodeAt(0) === 65279) && !isCaretNode(node) && (!format.inline || !isBlock(node))) {
// Start wrapping // Start wrapping
if (!currentWrapElm) { if (!currentWrapElm) {
// Wrap the node // Wrap the node
@ -18046,10 +18166,6 @@ tinymce.ForceBlocks = function(editor) {
return next; return next;
}; };
function isTextBlock(name) {
return /^(h[1-6]|p|div|pre|address|dl|dt|dd)$/.test(name);
};
function getContainer(rng, start) { function getContainer(rng, start) {
var container, offset, lastIdx, walker; var container, offset, lastIdx, walker;
@ -18285,11 +18401,23 @@ tinymce.ForceBlocks = function(editor) {
node.appendChild(dom.doc.createTextNode(INVISIBLE_CHAR)); node.appendChild(dom.doc.createTextNode(INVISIBLE_CHAR));
node = node.firstChild; node = node.firstChild;
var block = dom.getParent(formatNode, isTextBlock);
if (block && dom.isEmpty(block)) {
// Replace formatNode with caretContainer when removing format from empty block like <p><b>|</b></p>
formatNode.parentNode.replaceChild(caretContainer, formatNode);
} else {
// Insert caret container after the formated node // Insert caret container after the formated node
dom.insertAfter(caretContainer, formatNode); dom.insertAfter(caretContainer, formatNode);
}
// Move selection to text node // Move selection to text node
selection.setCursorLocation(node, 1); selection.setCursorLocation(node, 1);
// If the formatNode is empty, we can remove it safely.
if (dom.isEmpty(formatNode)) {
dom.remove(formatNode);
}
} }
}; };
@ -18479,7 +18607,7 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
function renderBlockOnIE(block) { function renderBlockOnIE(block) {
var oldRng; var oldRng;
if (tinymce.isIE && dom.isBlock(block)) { if (tinymce.isIE && !tinymce.isIE11 && dom.isBlock(block)) {
oldRng = selection.getRng(); oldRng = selection.getRng();
block.appendChild(dom.create('span', null, '\u00a0')); block.appendChild(dom.create('span', null, '\u00a0'));
selection.select(block); selection.select(block);
@ -18614,7 +18742,7 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
} }
// BR is needed in empty blocks on non IE browsers // BR is needed in empty blocks on non IE browsers
if (!tinymce.isIE) { if (!tinymce.isIE || tinymce.isIE11) {
caretNode.innerHTML = '<br data-mce-bogus="1">'; caretNode.innerHTML = '<br data-mce-bogus="1">';
} }
@ -18776,16 +18904,14 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
undoManager.add(); undoManager.add();
}; };
// Walks the parent block to the right and look for BR elements // Walks the parent block to the right and look for any contents
function hasRightSideBr() { function hasRightSideContent() {
var walker = new TreeWalker(container, parentBlock), node; var walker = new TreeWalker(container, parentBlock), node;
while (node = walker.current()) { while (node = walker.next()) {
if (node.nodeName == 'BR') { if (nonEmptyElementsMap[node.nodeName.toLowerCase()] || node.length > 0) {
return true; return true;
} }
node = walker.next();
} }
} }
@ -18795,7 +18921,7 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
if (container && container.nodeType == 3 && offset >= container.nodeValue.length) { if (container && container.nodeType == 3 && offset >= container.nodeValue.length) {
// Insert extra BR element at the end block elements // Insert extra BR element at the end block elements
if (!tinymce.isIE && !hasRightSideBr()) { if ((!tinymce.isIE || tinymce.isIE11) && !hasRightSideContent()) {
brElm = dom.create('br'); brElm = dom.create('br');
rng.insertNode(brElm); rng.insertNode(brElm);
rng.setStartAfter(brElm); rng.setStartAfter(brElm);
@ -18808,7 +18934,7 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
rng.insertNode(brElm); rng.insertNode(brElm);
// Rendering modes below IE8 doesn't display BR elements in PRE unless we have a \n before it // Rendering modes below IE8 doesn't display BR elements in PRE unless we have a \n before it
if (tinymce.isIE && parentBlockName == 'PRE' && (!documentMode || documentMode < 8)) { if ((tinymce.isIE && !tinymce.isIE11) && parentBlockName == 'PRE' && (!documentMode || documentMode < 8)) {
brElm.parentNode.insertBefore(dom.doc.createTextNode('\r'), brElm); brElm.parentNode.insertBefore(dom.doc.createTextNode('\r'), brElm);
} }
@ -18862,7 +18988,7 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
var lastChild; var lastChild;
// IE will render the blocks correctly other browsers needs a BR // IE will render the blocks correctly other browsers needs a BR
if (!tinymce.isIE) { if (!tinymce.isIE || tinymce.isIE11) {
block.normalize(); // Remove empty text nodes that got left behind by the extract block.normalize(); // Remove empty text nodes that got left behind by the extract
// Check if the block is empty or contains a floated last child // Check if the block is empty or contains a floated last child