start copy from cimac web
@@ -0,0 +1 @@
|
||||
!function(){var f,c,u,p,d,s=[];d="undefined"!=typeof global?global:window,p=d.jQuery;var v=function(){return d.tinymce};p.fn.tinymce=function(o){var e,t,i,l=this,r="";if(!l.length)return l;if(!o)return v()?v().get(l[0].id):null;l.css("visibility","hidden");var n=function(){var a=[],c=0;u||(m(),u=!0),l.each(function(e,t){var n,i=t.id,r=o.oninit;i||(t.id=i=v().DOM.uniqueId()),v().get(i)||(n=v().createEditor(i,o),a.push(n),n.on("init",function(){var e,t=r;l.css("visibility",""),r&&++c==a.length&&("string"==typeof t&&(e=-1===t.indexOf(".")?null:v().resolve(t.replace(/\.\w+$/,"")),t=v().resolve(t)),t.apply(e||v(),a))}))}),p.each(a,function(e,t){t.render()})};if(d.tinymce||c||!(e=o.script_url))1===c?s.push(n):n();else{c=1,t=e.substring(0,e.lastIndexOf("/")),-1!=e.indexOf(".min")&&(r=".min"),d.tinymce=d.tinyMCEPreInit||{base:t,suffix:r},-1!=e.indexOf("gzip")&&(i=o.language||"en",e=e+(/\?/.test(e)?"&":"?")+"js=true&core=true&suffix="+escape(r)+"&themes="+escape(o.theme||"modern")+"&plugins="+escape(o.plugins||"")+"&languages="+(i||""),d.tinyMCE_GZ||(d.tinyMCE_GZ={start:function(){var n=function(e){v().ScriptLoader.markDone(v().baseURI.toAbsolute(e))};n("langs/"+i+".js"),n("themes/"+o.theme+"/theme"+r+".js"),n("themes/"+o.theme+"/langs/"+i+".js"),p.each(o.plugins.split(","),function(e,t){t&&(n("plugins/"+t+"/plugin"+r+".js"),n("plugins/"+t+"/langs/"+i+".js"))})},end:function(){}}));var a=document.createElement("script");a.type="text/javascript",a.onload=a.onreadystatechange=function(e){e=e||window.event,2===c||"load"!=e.type&&!/complete|loaded/.test(a.readyState)||(v().dom.Event.domLoaded=1,c=2,o.script_loaded&&o.script_loaded(),n(),p.each(s,function(e,t){t()}))},a.src=e,document.body.appendChild(a)}return l},p.extend(p.expr[":"],{tinymce:function(e){var t;return!!(e.id&&"tinymce"in d&&(t=v().get(e.id))&&t.editorManager===v())}});var m=function(){var r=function(e){"remove"===e&&this.each(function(e,t){var n=l(t);n&&n.remove()}),this.find("span.mceEditor,div.mceEditor").each(function(e,t){var n=v().get(t.id.replace(/_parent$/,""));n&&n.remove()})},o=function(i){var e,t=this;if(null!=i)r.call(t),t.each(function(e,t){var n;(n=v().get(t.id))&&n.setContent(i)});else if(0<t.length&&(e=v().get(t[0].id)))return e.getContent()},l=function(e){var t=null;return e&&e.id&&d.tinymce&&(t=v().get(e.id)),t},u=function(e){return!!(e&&e.length&&d.tinymce&&e.is(":tinymce"))},s={};p.each(["text","html","val"],function(e,t){var a=s[t]=p.fn[t],c="text"===t;p.fn[t]=function(e){var t=this;if(!u(t))return a.apply(t,arguments);if(e!==f)return o.call(t.filter(":tinymce"),e),a.apply(t.not(":tinymce"),arguments),t;var i="",r=arguments;return(c?t:t.eq(0)).each(function(e,t){var n=l(t);i+=n?c?n.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):n.getContent({save:!0}):a.apply(p(t),r)}),i}}),p.each(["append","prepend"],function(e,t){var n=s[t]=p.fn[t],r="prepend"===t;p.fn[t]=function(i){var e=this;return u(e)?i!==f?("string"==typeof i&&e.filter(":tinymce").each(function(e,t){var n=l(t);n&&n.setContent(r?i+n.getContent():n.getContent()+i)}),n.apply(e.not(":tinymce"),arguments),e):void 0:n.apply(e,arguments)}}),p.each(["remove","replaceWith","replaceAll","empty"],function(e,t){var n=s[t]=p.fn[t];p.fn[t]=function(){return r.call(this,t),n.apply(this,arguments)}}),s.attr=p.fn.attr,p.fn.attr=function(e,t){var n=this,i=arguments;if(!e||"value"!==e||!u(n))return s.attr.apply(n,i);if(t!==f)return o.call(n.filter(":tinymce"),t),s.attr.apply(n.not(":tinymce"),i),n;var r=n[0],a=l(r);return a?a.getContent({save:!0}):s.attr.apply(p(r),i)}}}();
|
||||
@@ -0,0 +1,99 @@
|
||||
TinyMCE - JavaScript Library for Rich Text Editing
|
||||
===================================================
|
||||
|
||||
Building TinyMCE
|
||||
-----------------
|
||||
Install [Node.js](https://nodejs.org/en/) on your system.
|
||||
Clone this repository on your system
|
||||
```
|
||||
$ git clone https://github.com/tinymce/tinymce.git
|
||||
```
|
||||
Open a console and go to the project directory.
|
||||
```
|
||||
$ cd tinymce/
|
||||
```
|
||||
Install `grunt` command line tool globally.
|
||||
```
|
||||
$ npm i -g grunt-cli
|
||||
```
|
||||
Install all package dependencies.
|
||||
```
|
||||
$ npm install
|
||||
```
|
||||
Now, build TinyMCE by using `grunt`.
|
||||
```
|
||||
$ grunt
|
||||
```
|
||||
|
||||
|
||||
Build tasks
|
||||
------------
|
||||
`grunt`
|
||||
Lints, compiles, minifies and creates release packages for TinyMCE. This will produce the production ready packages.
|
||||
|
||||
`grunt start`
|
||||
Starts a webpack-dev-server that compiles the core, themes, plugins and all demos. Go to `localhost:3000` for a list of links to all the demo pages.
|
||||
|
||||
`grunt dev`
|
||||
Runs tsc, webpack and less. This will only produce the bare essentials for a development build and is a lot faster.
|
||||
|
||||
`grunt test`
|
||||
Runs all tests on PhantomJS.
|
||||
|
||||
`grunt bedrock-manual`
|
||||
Runs all tests manually in a browser.
|
||||
|
||||
`grunt bedrock-auto:<browser>`
|
||||
Runs all tests through selenium browsers supported are chrome, firefox, ie, MicrosoftEdge, chrome-headless and phantomjs.
|
||||
|
||||
`grunt webpack:core`
|
||||
Builds the demo js files for the core part of tinymce this is required to get the core demos working.
|
||||
|
||||
`grunt webpack:plugins`
|
||||
Builds the demo js files for the plugins part of tinymce this is required to get the plugins demos working.
|
||||
|
||||
`grunt webpack:themes`
|
||||
Builds the demo js files for the themes part of tinymce this is required to get the themes demos working.
|
||||
|
||||
`grunt webpack:<name>-plugin`
|
||||
Builds the demo js files for the specific plugin.
|
||||
|
||||
`grunt webpack:<name>-theme`
|
||||
Builds the demo js files for the specific theme.
|
||||
|
||||
`grunt --help`
|
||||
Displays the various build tasks.
|
||||
|
||||
Bundle themes and plugins into a single file
|
||||
---------------------------------------------
|
||||
`grunt bundle --themes=modern --plugins=table,paste`
|
||||
|
||||
Minifies the core, adds the modern theme and adds the table and paste plugin into tinymce.min.js.
|
||||
|
||||
Contributing to the TinyMCE project
|
||||
------------------------------------
|
||||
TinyMCE is an open source software project and we encourage developers to contribute patches and code to be included in the main package of TinyMCE.
|
||||
|
||||
__Basic Rules__
|
||||
|
||||
* Contributed code will be licensed under the LGPL license but not limited to LGPL
|
||||
* Copyright notices will be changed to Ephox Corporation, contributors will get credit for their work
|
||||
* All third party code will be reviewed, tested and possibly modified before being released
|
||||
* All contributors will have to have signed the Contributor License Agreement
|
||||
|
||||
These basic rules ensures that the contributed code remains open source and under the LGPL license.
|
||||
|
||||
__How to Contribute to the Code__
|
||||
|
||||
The TinyMCE source code is [hosted on Github](https://github.com/tinymce/tinymce). Through Github you can submit pull requests and log new bugs and feature requests.
|
||||
|
||||
When you submit a pull request, you will get a notice about signing the __Contributors License Agreement (CLA)__.
|
||||
You should have a __valid email address on your GitHub account__, and you will be sent a key to verify your identity and digitally sign the agreement.
|
||||
|
||||
After you signed your pull request will automatically be ready for review & merge.
|
||||
|
||||
__How to Contribute to the Docs__
|
||||
|
||||
Docs are hosted on Github in the [tinymce-docs](https://github.com/tinymce/tinymce-docs) repo.
|
||||
|
||||
[How to contribute](https://www.tinymce.com/docs/advanced/contributing-docs/) to the docs, including a style guide, can be found on the TinyMCE website.
|
||||
@@ -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!
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// Exports the "advlist" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/advlist')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/advlist'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,160 @@
|
||||
(function () {
|
||||
var advlist = (function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var applyListFormat = function (editor, listName, styleValue) {
|
||||
var cmd = listName === 'UL' ? 'InsertUnorderedList' : 'InsertOrderedList';
|
||||
editor.execCommand(cmd, false, styleValue === false ? null : { 'list-style-type': styleValue });
|
||||
};
|
||||
var $_95my7l8fjkmcduce = { applyListFormat: applyListFormat };
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('ApplyUnorderedListStyle', function (ui, value) {
|
||||
$_95my7l8fjkmcduce.applyListFormat(editor, 'UL', value['list-style-type']);
|
||||
});
|
||||
editor.addCommand('ApplyOrderedListStyle', function (ui, value) {
|
||||
$_95my7l8fjkmcduce.applyListFormat(editor, 'OL', value['list-style-type']);
|
||||
});
|
||||
};
|
||||
var $_bxqo0v8ejkmcducd = { register: register };
|
||||
|
||||
var getNumberStyles = function (editor) {
|
||||
var styles = editor.getParam('advlist_number_styles', 'default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman');
|
||||
return styles ? styles.split(/[ ,]/) : [];
|
||||
};
|
||||
var getBulletStyles = function (editor) {
|
||||
var styles = editor.getParam('advlist_bullet_styles', 'default,circle,disc,square');
|
||||
return styles ? styles.split(/[ ,]/) : [];
|
||||
};
|
||||
var $_6wfe958hjkmcduch = {
|
||||
getNumberStyles: getNumberStyles,
|
||||
getBulletStyles: getBulletStyles
|
||||
};
|
||||
|
||||
var isChildOfBody = function (editor, elm) {
|
||||
return editor.$.contains(editor.getBody(), elm);
|
||||
};
|
||||
var isTableCellNode = function (node) {
|
||||
return node && /^(TH|TD)$/.test(node.nodeName);
|
||||
};
|
||||
var isListNode = function (editor) {
|
||||
return function (node) {
|
||||
return node && /^(OL|UL|DL)$/.test(node.nodeName) && isChildOfBody(editor, node);
|
||||
};
|
||||
};
|
||||
var getSelectedStyleType = function (editor) {
|
||||
var listElm = editor.dom.getParent(editor.selection.getNode(), 'ol,ul');
|
||||
return editor.dom.getStyle(listElm, 'listStyleType') || '';
|
||||
};
|
||||
var $_e03fgd8ijkmcduci = {
|
||||
isTableCellNode: isTableCellNode,
|
||||
isListNode: isListNode,
|
||||
getSelectedStyleType: getSelectedStyleType
|
||||
};
|
||||
|
||||
var styleValueToText = function (styleValue) {
|
||||
return styleValue.replace(/\-/g, ' ').replace(/\b\w/g, function (chr) {
|
||||
return chr.toUpperCase();
|
||||
});
|
||||
};
|
||||
var toMenuItems = function (styles) {
|
||||
return global$1.map(styles, function (styleValue) {
|
||||
var text = styleValueToText(styleValue);
|
||||
var data = styleValue === 'default' ? '' : styleValue;
|
||||
return {
|
||||
text: text,
|
||||
data: data
|
||||
};
|
||||
});
|
||||
};
|
||||
var $_z6zva8jjkmcducj = { toMenuItems: toMenuItems };
|
||||
|
||||
var findIndex = function (list, predicate) {
|
||||
for (var index = 0; index < list.length; index++) {
|
||||
var element = list[index];
|
||||
if (predicate(element)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
var listState = function (editor, listName) {
|
||||
return function (e) {
|
||||
var ctrl = e.control;
|
||||
editor.on('NodeChange', function (e) {
|
||||
var tableCellIndex = findIndex(e.parents, $_e03fgd8ijkmcduci.isTableCellNode);
|
||||
var parents = tableCellIndex !== -1 ? e.parents.slice(0, tableCellIndex) : e.parents;
|
||||
var lists = global$1.grep(parents, $_e03fgd8ijkmcduci.isListNode(editor));
|
||||
ctrl.active(lists.length > 0 && lists[0].nodeName === listName);
|
||||
});
|
||||
};
|
||||
};
|
||||
var updateSelection = function (editor) {
|
||||
return function (e) {
|
||||
var listStyleType = $_e03fgd8ijkmcduci.getSelectedStyleType(editor);
|
||||
e.control.items().each(function (ctrl) {
|
||||
ctrl.active(ctrl.settings.data === listStyleType);
|
||||
});
|
||||
};
|
||||
};
|
||||
var addSplitButton = function (editor, id, tooltip, cmd, nodeName, styles) {
|
||||
editor.addButton(id, {
|
||||
active: false,
|
||||
type: 'splitbutton',
|
||||
tooltip: tooltip,
|
||||
menu: $_z6zva8jjkmcducj.toMenuItems(styles),
|
||||
onPostRender: listState(editor, nodeName),
|
||||
onshow: updateSelection(editor),
|
||||
onselect: function (e) {
|
||||
$_95my7l8fjkmcduce.applyListFormat(editor, nodeName, e.control.settings.data);
|
||||
},
|
||||
onclick: function () {
|
||||
editor.execCommand(cmd);
|
||||
}
|
||||
});
|
||||
};
|
||||
var addButton = function (editor, id, tooltip, cmd, nodeName, styles) {
|
||||
editor.addButton(id, {
|
||||
active: false,
|
||||
type: 'button',
|
||||
tooltip: tooltip,
|
||||
onPostRender: listState(editor, nodeName),
|
||||
onclick: function () {
|
||||
editor.execCommand(cmd);
|
||||
}
|
||||
});
|
||||
};
|
||||
var addControl = function (editor, id, tooltip, cmd, nodeName, styles) {
|
||||
if (styles.length > 0) {
|
||||
addSplitButton(editor, id, tooltip, cmd, nodeName, styles);
|
||||
} else {
|
||||
addButton(editor, id, tooltip, cmd, nodeName, styles);
|
||||
}
|
||||
};
|
||||
var register$1 = function (editor) {
|
||||
addControl(editor, 'numlist', 'Numbered list', 'InsertOrderedList', 'OL', $_6wfe958hjkmcduch.getNumberStyles(editor));
|
||||
addControl(editor, 'bullist', 'Bullet list', 'InsertUnorderedList', 'UL', $_6wfe958hjkmcduch.getBulletStyles(editor));
|
||||
};
|
||||
var $_68do408gjkmcducf = { register: register$1 };
|
||||
|
||||
global.add('advlist', function (editor) {
|
||||
var hasPlugin = function (editor, plugin) {
|
||||
var plugins = editor.settings.plugins ? editor.settings.plugins : '';
|
||||
return global$1.inArray(plugins.split(/[ ,]/), plugin) !== -1;
|
||||
};
|
||||
if (hasPlugin(editor, 'lists')) {
|
||||
$_68do408gjkmcducf.register(editor);
|
||||
$_bxqo0v8ejkmcducd.register(editor);
|
||||
}
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
||||
@@ -0,0 +1 @@
|
||||
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=tinymce.util.Tools.resolve("tinymce.util.Tools"),s=function(t,e,n){var r="UL"===e?"InsertUnorderedList":"InsertOrderedList";t.execCommand(r,!1,!1===n?null:{"list-style-type":n})},o=function(n){n.addCommand("ApplyUnorderedListStyle",function(t,e){s(n,"UL",e["list-style-type"])}),n.addCommand("ApplyOrderedListStyle",function(t,e){s(n,"OL",e["list-style-type"])})},e=function(t){var e=t.getParam("advlist_number_styles","default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");return e?e.split(/[ ,]/):[]},n=function(t){var e=t.getParam("advlist_bullet_styles","default,circle,disc,square");return e?e.split(/[ ,]/):[]},u=function(t){return t&&/^(TH|TD)$/.test(t.nodeName)},c=function(r){return function(t){return t&&/^(OL|UL|DL)$/.test(t.nodeName)&&(n=t,(e=r).$.contains(e.getBody(),n));var e,n}},d=function(t){var e=t.dom.getParent(t.selection.getNode(),"ol,ul");return t.dom.getStyle(e,"listStyleType")||""},p=function(t){return a.map(t,function(t){return{text:t.replace(/\-/g," ").replace(/\b\w/g,function(t){return t.toUpperCase()}),data:"default"===t?"":t}})},f=function(i,l){return function(t){var o=t.control;i.on("NodeChange",function(t){var e=function(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return n;return-1}(t.parents,u),n=-1!==e?t.parents.slice(0,e):t.parents,r=a.grep(n,c(i));o.active(0<r.length&&r[0].nodeName===l)})}},m=function(e,t,n,r,o,i){var l;e.addButton(t,{active:!1,type:"splitbutton",tooltip:n,menu:p(i),onPostRender:f(e,o),onshow:(l=e,function(t){var e=d(l);t.control.items().each(function(t){t.active(t.settings.data===e)})}),onselect:function(t){s(e,o,t.control.settings.data)},onclick:function(){e.execCommand(r)}})},r=function(t,e,n,r,o,i){var l,a,s,u,c;0<i.length?m(t,e,n,r,o,i):(a=e,s=n,u=r,c=o,(l=t).addButton(a,{active:!1,type:"button",tooltip:s,onPostRender:f(l,c),onclick:function(){l.execCommand(u)}}))},i=function(t){r(t,"numlist","Numbered list","InsertOrderedList","OL",e(t)),r(t,"bullist","Bullet list","InsertUnorderedList","UL",n(t))};t.add("advlist",function(t){var e,n,r;n="lists",r=(e=t).settings.plugins?e.settings.plugins:"",-1!==a.inArray(r.split(/[ ,]/),n)&&(i(t),o(t))})}();
|
||||
@@ -0,0 +1,7 @@
|
||||
// Exports the "anchor" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/anchor')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/anchor'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,118 @@
|
||||
(function () {
|
||||
var anchor = (function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var isValidId = function (id) {
|
||||
return /^[A-Za-z][A-Za-z0-9\-:._]*$/.test(id);
|
||||
};
|
||||
var getId = function (editor) {
|
||||
var selectedNode = editor.selection.getNode();
|
||||
var isAnchor = selectedNode.tagName === 'A' && editor.dom.getAttrib(selectedNode, 'href') === '';
|
||||
return isAnchor ? selectedNode.id || selectedNode.name : '';
|
||||
};
|
||||
var insert = function (editor, id) {
|
||||
var selectedNode = editor.selection.getNode();
|
||||
var isAnchor = selectedNode.tagName === 'A' && editor.dom.getAttrib(selectedNode, 'href') === '';
|
||||
if (isAnchor) {
|
||||
selectedNode.removeAttribute('name');
|
||||
selectedNode.id = id;
|
||||
editor.undoManager.add();
|
||||
} else {
|
||||
editor.focus();
|
||||
editor.selection.collapse(true);
|
||||
editor.execCommand('mceInsertContent', false, editor.dom.createHTML('a', { id: id }));
|
||||
}
|
||||
};
|
||||
var $_5wbtpu8ojkmcdud1 = {
|
||||
isValidId: isValidId,
|
||||
getId: getId,
|
||||
insert: insert
|
||||
};
|
||||
|
||||
var insertAnchor = function (editor, newId) {
|
||||
if (!$_5wbtpu8ojkmcdud1.isValidId(newId)) {
|
||||
editor.windowManager.alert('Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.');
|
||||
return true;
|
||||
} else {
|
||||
$_5wbtpu8ojkmcdud1.insert(editor, newId);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
var open = function (editor) {
|
||||
var currentId = $_5wbtpu8ojkmcdud1.getId(editor);
|
||||
editor.windowManager.open({
|
||||
title: 'Anchor',
|
||||
body: {
|
||||
type: 'textbox',
|
||||
name: 'id',
|
||||
size: 40,
|
||||
label: 'Id',
|
||||
value: currentId
|
||||
},
|
||||
onsubmit: function (e) {
|
||||
var newId = e.data.id;
|
||||
if (insertAnchor(editor, newId)) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
var $_efx3us8njkmcdud0 = { open: open };
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('mceAnchor', function () {
|
||||
$_efx3us8njkmcdud0.open(editor);
|
||||
});
|
||||
};
|
||||
var $_8n8okh8mjkmcducy = { register: register };
|
||||
|
||||
var isAnchorNode = function (node) {
|
||||
return !node.attr('href') && (node.attr('id') || node.attr('name')) && !node.firstChild;
|
||||
};
|
||||
var setContentEditable = function (state) {
|
||||
return function (nodes) {
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
if (isAnchorNode(nodes[i])) {
|
||||
nodes[i].attr('contenteditable', state);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
var setup = function (editor) {
|
||||
editor.on('PreInit', function () {
|
||||
editor.parser.addNodeFilter('a', setContentEditable('false'));
|
||||
editor.serializer.addNodeFilter('a', setContentEditable(null));
|
||||
});
|
||||
};
|
||||
var $_bx87ma8pjkmcdud3 = { setup: setup };
|
||||
|
||||
var register$1 = function (editor) {
|
||||
editor.addButton('anchor', {
|
||||
icon: 'anchor',
|
||||
tooltip: 'Anchor',
|
||||
cmd: 'mceAnchor',
|
||||
stateSelector: 'a:not([href])'
|
||||
});
|
||||
editor.addMenuItem('anchor', {
|
||||
icon: 'anchor',
|
||||
text: 'Anchor',
|
||||
context: 'insert',
|
||||
cmd: 'mceAnchor'
|
||||
});
|
||||
};
|
||||
var $_300eym8qjkmcdud5 = { register: register$1 };
|
||||
|
||||
global.add('anchor', function (editor) {
|
||||
$_bx87ma8pjkmcdud3.setup(editor);
|
||||
$_8n8okh8mjkmcducy.register(editor);
|
||||
$_300eym8qjkmcdud5.register(editor);
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
||||
@@ -0,0 +1 @@
|
||||
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=function(t){return/^[A-Za-z][A-Za-z0-9\-:._]*$/.test(t)},e=function(t){var e=t.selection.getNode();return"A"===e.tagName&&""===t.dom.getAttrib(e,"href")?e.id||e.name:""},i=function(t,e){var n=t.selection.getNode();"A"===n.tagName&&""===t.dom.getAttrib(n,"href")?(n.removeAttribute("name"),n.id=e,t.undoManager.add()):(t.focus(),t.selection.collapse(!0),t.execCommand("mceInsertContent",!1,t.dom.createHTML("a",{id:e})))},n=function(r){var t=e(r);r.windowManager.open({title:"Anchor",body:{type:"textbox",name:"id",size:40,label:"Id",value:t},onsubmit:function(t){var e,n,o=t.data.id;e=r,(a(n=o)?(i(e,n),0):(e.windowManager.alert("Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores."),1))&&t.preventDefault()}})},o=function(t){t.addCommand("mceAnchor",function(){n(t)})},r=function(o){return function(t){for(var e=0;e<t.length;e++)(n=t[e]).attr("href")||!n.attr("id")&&!n.attr("name")||n.firstChild||t[e].attr("contenteditable",o);var n}},c=function(t){t.on("PreInit",function(){t.parser.addNodeFilter("a",r("false")),t.serializer.addNodeFilter("a",r(null))})},d=function(t){t.addButton("anchor",{icon:"anchor",tooltip:"Anchor",cmd:"mceAnchor",stateSelector:"a:not([href])"}),t.addMenuItem("anchor",{icon:"anchor",text:"Anchor",context:"insert",cmd:"mceAnchor"})};t.add("anchor",function(t){c(t),o(t),d(t)})}();
|
||||
@@ -0,0 +1,7 @@
|
||||
// Exports the "autolink" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/autolink')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/autolink'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,180 @@
|
||||
(function () {
|
||||
var autolink = (function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.Env');
|
||||
|
||||
var getAutoLinkPattern = function (editor) {
|
||||
return editor.getParam('autolink_pattern', /^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i);
|
||||
};
|
||||
var getDefaultLinkTarget = function (editor) {
|
||||
return editor.getParam('default_link_target', '');
|
||||
};
|
||||
var $_6iql828vjkmcdudj = {
|
||||
getAutoLinkPattern: getAutoLinkPattern,
|
||||
getDefaultLinkTarget: getDefaultLinkTarget
|
||||
};
|
||||
|
||||
var rangeEqualsDelimiterOrSpace = function (rangeString, delimiter) {
|
||||
return rangeString === delimiter || rangeString === ' ' || rangeString.charCodeAt(0) === 160;
|
||||
};
|
||||
var handleEclipse = function (editor) {
|
||||
parseCurrentLine(editor, -1, '(');
|
||||
};
|
||||
var handleSpacebar = function (editor) {
|
||||
parseCurrentLine(editor, 0, '');
|
||||
};
|
||||
var handleEnter = function (editor) {
|
||||
parseCurrentLine(editor, -1, '');
|
||||
};
|
||||
var scopeIndex = function (container, index) {
|
||||
if (index < 0) {
|
||||
index = 0;
|
||||
}
|
||||
if (container.nodeType === 3) {
|
||||
var len = container.data.length;
|
||||
if (index > len) {
|
||||
index = len;
|
||||
}
|
||||
}
|
||||
return index;
|
||||
};
|
||||
var setStart = function (rng, container, offset) {
|
||||
if (container.nodeType !== 1 || container.hasChildNodes()) {
|
||||
rng.setStart(container, scopeIndex(container, offset));
|
||||
} else {
|
||||
rng.setStartBefore(container);
|
||||
}
|
||||
};
|
||||
var setEnd = function (rng, container, offset) {
|
||||
if (container.nodeType !== 1 || container.hasChildNodes()) {
|
||||
rng.setEnd(container, scopeIndex(container, offset));
|
||||
} else {
|
||||
rng.setEndAfter(container);
|
||||
}
|
||||
};
|
||||
var parseCurrentLine = function (editor, endOffset, delimiter) {
|
||||
var rng, end, start, endContainer, bookmark, text, matches, prev, len, rngText;
|
||||
var autoLinkPattern = $_6iql828vjkmcdudj.getAutoLinkPattern(editor);
|
||||
var defaultLinkTarget = $_6iql828vjkmcdudj.getDefaultLinkTarget(editor);
|
||||
if (editor.selection.getNode().tagName === 'A') {
|
||||
return;
|
||||
}
|
||||
rng = editor.selection.getRng(true).cloneRange();
|
||||
if (rng.startOffset < 5) {
|
||||
prev = rng.endContainer.previousSibling;
|
||||
if (!prev) {
|
||||
if (!rng.endContainer.firstChild || !rng.endContainer.firstChild.nextSibling) {
|
||||
return;
|
||||
}
|
||||
prev = rng.endContainer.firstChild.nextSibling;
|
||||
}
|
||||
len = prev.length;
|
||||
setStart(rng, prev, len);
|
||||
setEnd(rng, prev, len);
|
||||
if (rng.endOffset < 5) {
|
||||
return;
|
||||
}
|
||||
end = rng.endOffset;
|
||||
endContainer = prev;
|
||||
} else {
|
||||
endContainer = rng.endContainer;
|
||||
if (endContainer.nodeType !== 3 && endContainer.firstChild) {
|
||||
while (endContainer.nodeType !== 3 && endContainer.firstChild) {
|
||||
endContainer = endContainer.firstChild;
|
||||
}
|
||||
if (endContainer.nodeType === 3) {
|
||||
setStart(rng, endContainer, 0);
|
||||
setEnd(rng, endContainer, endContainer.nodeValue.length);
|
||||
}
|
||||
}
|
||||
if (rng.endOffset === 1) {
|
||||
end = 2;
|
||||
} else {
|
||||
end = rng.endOffset - 1 - endOffset;
|
||||
}
|
||||
}
|
||||
start = end;
|
||||
do {
|
||||
setStart(rng, endContainer, end >= 2 ? end - 2 : 0);
|
||||
setEnd(rng, endContainer, end >= 1 ? end - 1 : 0);
|
||||
end -= 1;
|
||||
rngText = rng.toString();
|
||||
} while (rngText !== ' ' && rngText !== '' && rngText.charCodeAt(0) !== 160 && end - 2 >= 0 && rngText !== delimiter);
|
||||
if (rangeEqualsDelimiterOrSpace(rng.toString(), delimiter)) {
|
||||
setStart(rng, endContainer, end);
|
||||
setEnd(rng, endContainer, start);
|
||||
end += 1;
|
||||
} else if (rng.startOffset === 0) {
|
||||
setStart(rng, endContainer, 0);
|
||||
setEnd(rng, endContainer, start);
|
||||
} else {
|
||||
setStart(rng, endContainer, end);
|
||||
setEnd(rng, endContainer, start);
|
||||
}
|
||||
text = rng.toString();
|
||||
if (text.charAt(text.length - 1) === '.') {
|
||||
setEnd(rng, endContainer, start - 1);
|
||||
}
|
||||
text = rng.toString().trim();
|
||||
matches = text.match(autoLinkPattern);
|
||||
if (matches) {
|
||||
if (matches[1] === 'www.') {
|
||||
matches[1] = 'http://www.';
|
||||
} else if (/@$/.test(matches[1]) && !/^mailto:/.test(matches[1])) {
|
||||
matches[1] = 'mailto:' + matches[1];
|
||||
}
|
||||
bookmark = editor.selection.getBookmark();
|
||||
editor.selection.setRng(rng);
|
||||
editor.execCommand('createlink', false, matches[1] + matches[2]);
|
||||
if (defaultLinkTarget) {
|
||||
editor.dom.setAttrib(editor.selection.getNode(), 'target', defaultLinkTarget);
|
||||
}
|
||||
editor.selection.moveToBookmark(bookmark);
|
||||
editor.nodeChanged();
|
||||
}
|
||||
};
|
||||
var setup = function (editor) {
|
||||
var autoUrlDetectState;
|
||||
editor.on('keydown', function (e) {
|
||||
if (e.keyCode === 13) {
|
||||
return handleEnter(editor);
|
||||
}
|
||||
});
|
||||
if (global$1.ie) {
|
||||
editor.on('focus', function () {
|
||||
if (!autoUrlDetectState) {
|
||||
autoUrlDetectState = true;
|
||||
try {
|
||||
editor.execCommand('AutoUrlDetect', false, true);
|
||||
} catch (ex) {
|
||||
}
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
editor.on('keypress', function (e) {
|
||||
if (e.keyCode === 41) {
|
||||
return handleEclipse(editor);
|
||||
}
|
||||
});
|
||||
editor.on('keyup', function (e) {
|
||||
if (e.keyCode === 32) {
|
||||
return handleSpacebar(editor);
|
||||
}
|
||||
});
|
||||
};
|
||||
var $_9ihzuz8tjkmcdudg = { setup: setup };
|
||||
|
||||
global.add('autolink', function (editor) {
|
||||
$_9ihzuz8tjkmcdudg.setup(editor);
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
||||
@@ -0,0 +1 @@
|
||||
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),i=tinymce.util.Tools.resolve("tinymce.Env"),m=function(e){return e.getParam("autolink_pattern",/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i)},y=function(e){return e.getParam("default_link_target","")},o=function(e,t){if(t<0&&(t=0),3===e.nodeType){var n=e.data.length;n<t&&(t=n)}return t},k=function(e,t,n){1!==t.nodeType||t.hasChildNodes()?e.setStart(t,o(t,n)):e.setStartBefore(t)},p=function(e,t,n){1!==t.nodeType||t.hasChildNodes()?e.setEnd(t,o(t,n)):e.setEndAfter(t)},r=function(e,t,n){var i,o,r,a,f,s,d,l,c,u,g=m(e),h=y(e);if("A"!==e.selection.getNode().tagName){if((i=e.selection.getRng(!0).cloneRange()).startOffset<5){if(!(l=i.endContainer.previousSibling)){if(!i.endContainer.firstChild||!i.endContainer.firstChild.nextSibling)return;l=i.endContainer.firstChild.nextSibling}if(c=l.length,k(i,l,c),p(i,l,c),i.endOffset<5)return;o=i.endOffset,a=l}else{if(3!==(a=i.endContainer).nodeType&&a.firstChild){for(;3!==a.nodeType&&a.firstChild;)a=a.firstChild;3===a.nodeType&&(k(i,a,0),p(i,a,a.nodeValue.length))}o=1===i.endOffset?2:i.endOffset-1-t}for(r=o;k(i,a,2<=o?o-2:0),p(i,a,1<=o?o-1:0),o-=1," "!==(u=i.toString())&&""!==u&&160!==u.charCodeAt(0)&&0<=o-2&&u!==n;);var C;(C=i.toString())===n||" "===C||160===C.charCodeAt(0)?(k(i,a,o),p(i,a,r),o+=1):(0===i.startOffset?k(i,a,0):k(i,a,o),p(i,a,r)),"."===(s=i.toString()).charAt(s.length-1)&&p(i,a,r-1),(d=(s=i.toString().trim()).match(g))&&("www."===d[1]?d[1]="http://www.":/@$/.test(d[1])&&!/^mailto:/.test(d[1])&&(d[1]="mailto:"+d[1]),f=e.selection.getBookmark(),e.selection.setRng(i),e.execCommand("createlink",!1,d[1]+d[2]),h&&e.dom.setAttrib(e.selection.getNode(),"target",h),e.selection.moveToBookmark(f),e.nodeChanged())}},t=function(t){var n;t.on("keydown",function(e){13!==e.keyCode||r(t,-1,"")}),i.ie?t.on("focus",function(){if(!n){n=!0;try{t.execCommand("AutoUrlDetect",!1,!0)}catch(e){}}}):(t.on("keypress",function(e){41!==e.keyCode||r(t,-1,"(")}),t.on("keyup",function(e){32!==e.keyCode||r(t,0,"")}))};e.add("autolink",function(e){t(e)})}();
|
||||
@@ -0,0 +1,7 @@
|
||||
// Exports the "autoresize" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/autoresize')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/autoresize'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,169 @@
|
||||
(function () {
|
||||
var autoresize = (function () {
|
||||
'use strict';
|
||||
|
||||
var Cell = function (initial) {
|
||||
var value = initial;
|
||||
var get = function () {
|
||||
return value;
|
||||
};
|
||||
var set = function (v) {
|
||||
value = v;
|
||||
};
|
||||
var clone = function () {
|
||||
return Cell(get());
|
||||
};
|
||||
return {
|
||||
get: get,
|
||||
set: set,
|
||||
clone: clone
|
||||
};
|
||||
};
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.Env');
|
||||
|
||||
var global$2 = tinymce.util.Tools.resolve('tinymce.util.Delay');
|
||||
|
||||
var getAutoResizeMinHeight = function (editor) {
|
||||
return parseInt(editor.getParam('autoresize_min_height', editor.getElement().offsetHeight), 10);
|
||||
};
|
||||
var getAutoResizeMaxHeight = function (editor) {
|
||||
return parseInt(editor.getParam('autoresize_max_height', 0), 10);
|
||||
};
|
||||
var getAutoResizeOverflowPadding = function (editor) {
|
||||
return editor.getParam('autoresize_overflow_padding', 1);
|
||||
};
|
||||
var getAutoResizeBottomMargin = function (editor) {
|
||||
return editor.getParam('autoresize_bottom_margin', 50);
|
||||
};
|
||||
var shouldAutoResizeOnInit = function (editor) {
|
||||
return editor.getParam('autoresize_on_init', true);
|
||||
};
|
||||
var $_2j3qei93jkmcdue9 = {
|
||||
getAutoResizeMinHeight: getAutoResizeMinHeight,
|
||||
getAutoResizeMaxHeight: getAutoResizeMaxHeight,
|
||||
getAutoResizeOverflowPadding: getAutoResizeOverflowPadding,
|
||||
getAutoResizeBottomMargin: getAutoResizeBottomMargin,
|
||||
shouldAutoResizeOnInit: shouldAutoResizeOnInit
|
||||
};
|
||||
|
||||
var isFullscreen = function (editor) {
|
||||
return editor.plugins.fullscreen && editor.plugins.fullscreen.isFullscreen();
|
||||
};
|
||||
var wait = function (editor, oldSize, times, interval, callback) {
|
||||
global$2.setEditorTimeout(editor, function () {
|
||||
resize(editor, oldSize);
|
||||
if (times--) {
|
||||
wait(editor, oldSize, times, interval, callback);
|
||||
} else if (callback) {
|
||||
callback();
|
||||
}
|
||||
}, interval);
|
||||
};
|
||||
var toggleScrolling = function (editor, state) {
|
||||
var body = editor.getBody();
|
||||
if (body) {
|
||||
body.style.overflowY = state ? '' : 'hidden';
|
||||
if (!state) {
|
||||
body.scrollTop = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
var resize = function (editor, oldSize) {
|
||||
var deltaSize, doc, body, resizeHeight, myHeight;
|
||||
var marginTop, marginBottom, paddingTop, paddingBottom, borderTop, borderBottom;
|
||||
var dom = editor.dom;
|
||||
doc = editor.getDoc();
|
||||
if (!doc) {
|
||||
return;
|
||||
}
|
||||
if (isFullscreen(editor)) {
|
||||
toggleScrolling(editor, true);
|
||||
return;
|
||||
}
|
||||
body = doc.body;
|
||||
resizeHeight = $_2j3qei93jkmcdue9.getAutoResizeMinHeight(editor);
|
||||
marginTop = dom.getStyle(body, 'margin-top', true);
|
||||
marginBottom = dom.getStyle(body, 'margin-bottom', true);
|
||||
paddingTop = dom.getStyle(body, 'padding-top', true);
|
||||
paddingBottom = dom.getStyle(body, 'padding-bottom', true);
|
||||
borderTop = dom.getStyle(body, 'border-top-width', true);
|
||||
borderBottom = dom.getStyle(body, 'border-bottom-width', true);
|
||||
myHeight = body.offsetHeight + parseInt(marginTop, 10) + parseInt(marginBottom, 10) + parseInt(paddingTop, 10) + parseInt(paddingBottom, 10) + parseInt(borderTop, 10) + parseInt(borderBottom, 10);
|
||||
if (isNaN(myHeight) || myHeight <= 0) {
|
||||
myHeight = global$1.ie ? body.scrollHeight : global$1.webkit && body.clientHeight === 0 ? 0 : body.offsetHeight;
|
||||
}
|
||||
if (myHeight > $_2j3qei93jkmcdue9.getAutoResizeMinHeight(editor)) {
|
||||
resizeHeight = myHeight;
|
||||
}
|
||||
var maxHeight = $_2j3qei93jkmcdue9.getAutoResizeMaxHeight(editor);
|
||||
if (maxHeight && myHeight > maxHeight) {
|
||||
resizeHeight = maxHeight;
|
||||
toggleScrolling(editor, true);
|
||||
} else {
|
||||
toggleScrolling(editor, false);
|
||||
}
|
||||
if (resizeHeight !== oldSize.get()) {
|
||||
deltaSize = resizeHeight - oldSize.get();
|
||||
dom.setStyle(editor.iframeElement, 'height', resizeHeight + 'px');
|
||||
oldSize.set(resizeHeight);
|
||||
if (global$1.webkit && deltaSize < 0) {
|
||||
resize(editor, oldSize);
|
||||
}
|
||||
}
|
||||
};
|
||||
var setup = function (editor, oldSize) {
|
||||
editor.on('init', function () {
|
||||
var overflowPadding, bottomMargin;
|
||||
var dom = editor.dom;
|
||||
overflowPadding = $_2j3qei93jkmcdue9.getAutoResizeOverflowPadding(editor);
|
||||
bottomMargin = $_2j3qei93jkmcdue9.getAutoResizeBottomMargin(editor);
|
||||
if (overflowPadding !== false) {
|
||||
dom.setStyles(editor.getBody(), {
|
||||
paddingLeft: overflowPadding,
|
||||
paddingRight: overflowPadding
|
||||
});
|
||||
}
|
||||
if (bottomMargin !== false) {
|
||||
dom.setStyles(editor.getBody(), { paddingBottom: bottomMargin });
|
||||
}
|
||||
});
|
||||
editor.on('nodechange setcontent keyup FullscreenStateChanged', function (e) {
|
||||
resize(editor, oldSize);
|
||||
});
|
||||
if ($_2j3qei93jkmcdue9.shouldAutoResizeOnInit(editor)) {
|
||||
editor.on('init', function () {
|
||||
wait(editor, oldSize, 20, 100, function () {
|
||||
wait(editor, oldSize, 5, 1000);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
var $_6m3n9a90jkmcdue2 = {
|
||||
setup: setup,
|
||||
resize: resize
|
||||
};
|
||||
|
||||
var register = function (editor, oldSize) {
|
||||
editor.addCommand('mceAutoResize', function () {
|
||||
$_6m3n9a90jkmcdue2.resize(editor, oldSize);
|
||||
});
|
||||
};
|
||||
var $_8uhra38zjkmcdue0 = { register: register };
|
||||
|
||||
global.add('autoresize', function (editor) {
|
||||
if (!editor.inline) {
|
||||
var oldSize = Cell(0);
|
||||
$_8uhra38zjkmcdue0.register(editor, oldSize);
|
||||
$_6m3n9a90jkmcdue2.setup(editor, oldSize);
|
||||
}
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
||||
@@ -0,0 +1 @@
|
||||
!function(){"use strict";var i=function(t){var e=t,n=function(){return e};return{get:n,set:function(t){e=t},clone:function(){return i(n())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),y=tinymce.util.Tools.resolve("tinymce.Env"),r=tinymce.util.Tools.resolve("tinymce.util.Delay"),h=function(t){return parseInt(t.getParam("autoresize_min_height",t.getElement().offsetHeight),10)},v=function(t){return parseInt(t.getParam("autoresize_max_height",0),10)},o=function(t){return t.getParam("autoresize_overflow_padding",1)},a=function(t){return t.getParam("autoresize_bottom_margin",50)},n=function(t){return t.getParam("autoresize_on_init",!0)},u=function(t,e,n,i,o){r.setEditorTimeout(t,function(){_(t,e),n--?u(t,e,n,i,o):o&&o()},i)},S=function(t,e){var n=t.getBody();n&&(n.style.overflowY=e?"":"hidden",e||(n.scrollTop=0))},_=function(t,e){var n,i,o,r,a,u,s,l,g,c,f,d=t.dom;if(i=t.getDoc())if((m=t).plugins.fullscreen&&m.plugins.fullscreen.isFullscreen())S(t,!0);else{var m;o=i.body,r=h(t),u=d.getStyle(o,"margin-top",!0),s=d.getStyle(o,"margin-bottom",!0),l=d.getStyle(o,"padding-top",!0),g=d.getStyle(o,"padding-bottom",!0),c=d.getStyle(o,"border-top-width",!0),f=d.getStyle(o,"border-bottom-width",!0),a=o.offsetHeight+parseInt(u,10)+parseInt(s,10)+parseInt(l,10)+parseInt(g,10)+parseInt(c,10)+parseInt(f,10),(isNaN(a)||a<=0)&&(a=y.ie?o.scrollHeight:y.webkit&&0===o.clientHeight?0:o.offsetHeight),a>h(t)&&(r=a);var p=v(t);p&&p<a?(r=p,S(t,!0)):S(t,!1),r!==e.get()&&(n=r-e.get(),d.setStyle(t.iframeElement,"height",r+"px"),e.set(r),y.webkit&&n<0&&_(t,e))}},s={setup:function(i,e){i.on("init",function(){var t,e,n=i.dom;t=o(i),e=a(i),!1!==t&&n.setStyles(i.getBody(),{paddingLeft:t,paddingRight:t}),!1!==e&&n.setStyles(i.getBody(),{paddingBottom:e})}),i.on("nodechange setcontent keyup FullscreenStateChanged",function(t){_(i,e)}),n(i)&&i.on("init",function(){u(i,e,20,100,function(){u(i,e,5,1e3)})})},resize:_},l=function(t,e){t.addCommand("mceAutoResize",function(){s.resize(t,e)})};t.add("autoresize",function(t){if(!t.inline){var e=i(0);l(t,e),s.setup(t,e)}})}();
|
||||
@@ -0,0 +1,7 @@
|
||||
// Exports the "autosave" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/autosave')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/autosave'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,226 @@
|
||||
(function () {
|
||||
var autosave = (function () {
|
||||
'use strict';
|
||||
|
||||
var Cell = function (initial) {
|
||||
var value = initial;
|
||||
var get = function () {
|
||||
return value;
|
||||
};
|
||||
var set = function (v) {
|
||||
value = v;
|
||||
};
|
||||
var clone = function () {
|
||||
return Cell(get());
|
||||
};
|
||||
return {
|
||||
get: get,
|
||||
set: set,
|
||||
clone: clone
|
||||
};
|
||||
};
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.LocalStorage');
|
||||
|
||||
var global$2 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var fireRestoreDraft = function (editor) {
|
||||
return editor.fire('RestoreDraft');
|
||||
};
|
||||
var fireStoreDraft = function (editor) {
|
||||
return editor.fire('StoreDraft');
|
||||
};
|
||||
var fireRemoveDraft = function (editor) {
|
||||
return editor.fire('RemoveDraft');
|
||||
};
|
||||
var $_4quc5u9bjkmcdues = {
|
||||
fireRestoreDraft: fireRestoreDraft,
|
||||
fireStoreDraft: fireStoreDraft,
|
||||
fireRemoveDraft: fireRemoveDraft
|
||||
};
|
||||
|
||||
var parse = function (time, defaultTime) {
|
||||
var multiples = {
|
||||
s: 1000,
|
||||
m: 60000
|
||||
};
|
||||
time = /^(\d+)([ms]?)$/.exec('' + (time || defaultTime));
|
||||
return (time[2] ? multiples[time[2]] : 1) * parseInt(time, 10);
|
||||
};
|
||||
var $_ed5ijr9djkmcduev = { parse: parse };
|
||||
|
||||
var shouldAskBeforeUnload = function (editor) {
|
||||
return editor.getParam('autosave_ask_before_unload', true);
|
||||
};
|
||||
var getAutoSavePrefix = function (editor) {
|
||||
var prefix = editor.getParam('autosave_prefix', 'tinymce-autosave-{path}{query}{hash}-{id}-');
|
||||
prefix = prefix.replace(/\{path\}/g, document.location.pathname);
|
||||
prefix = prefix.replace(/\{query\}/g, document.location.search);
|
||||
prefix = prefix.replace(/\{hash\}/g, document.location.hash);
|
||||
prefix = prefix.replace(/\{id\}/g, editor.id);
|
||||
return prefix;
|
||||
};
|
||||
var shouldRestoreWhenEmpty = function (editor) {
|
||||
return editor.getParam('autosave_restore_when_empty', false);
|
||||
};
|
||||
var getAutoSaveInterval = function (editor) {
|
||||
return $_ed5ijr9djkmcduev.parse(editor.settings.autosave_interval, '30s');
|
||||
};
|
||||
var getAutoSaveRetention = function (editor) {
|
||||
return $_ed5ijr9djkmcduev.parse(editor.settings.autosave_retention, '20m');
|
||||
};
|
||||
var $_c041qd9cjkmcdueu = {
|
||||
shouldAskBeforeUnload: shouldAskBeforeUnload,
|
||||
getAutoSavePrefix: getAutoSavePrefix,
|
||||
shouldRestoreWhenEmpty: shouldRestoreWhenEmpty,
|
||||
getAutoSaveInterval: getAutoSaveInterval,
|
||||
getAutoSaveRetention: getAutoSaveRetention
|
||||
};
|
||||
|
||||
var isEmpty = function (editor, html) {
|
||||
var forcedRootBlockName = editor.settings.forced_root_block;
|
||||
html = global$2.trim(typeof html === 'undefined' ? editor.getBody().innerHTML : html);
|
||||
return html === '' || new RegExp('^<' + forcedRootBlockName + '[^>]*>((\xA0| |[ \t]|<br[^>]*>)+?|)</' + forcedRootBlockName + '>|<br>$', 'i').test(html);
|
||||
};
|
||||
var hasDraft = function (editor) {
|
||||
var time = parseInt(global$1.getItem($_c041qd9cjkmcdueu.getAutoSavePrefix(editor) + 'time'), 10) || 0;
|
||||
if (new Date().getTime() - time > $_c041qd9cjkmcdueu.getAutoSaveRetention(editor)) {
|
||||
removeDraft(editor, false);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
var removeDraft = function (editor, fire) {
|
||||
var prefix = $_c041qd9cjkmcdueu.getAutoSavePrefix(editor);
|
||||
global$1.removeItem(prefix + 'draft');
|
||||
global$1.removeItem(prefix + 'time');
|
||||
if (fire !== false) {
|
||||
$_4quc5u9bjkmcdues.fireRemoveDraft(editor);
|
||||
}
|
||||
};
|
||||
var storeDraft = function (editor) {
|
||||
var prefix = $_c041qd9cjkmcdueu.getAutoSavePrefix(editor);
|
||||
if (!isEmpty(editor) && editor.isDirty()) {
|
||||
global$1.setItem(prefix + 'draft', editor.getContent({
|
||||
format: 'raw',
|
||||
no_events: true
|
||||
}));
|
||||
global$1.setItem(prefix + 'time', new Date().getTime().toString());
|
||||
$_4quc5u9bjkmcdues.fireStoreDraft(editor);
|
||||
}
|
||||
};
|
||||
var restoreDraft = function (editor) {
|
||||
var prefix = $_c041qd9cjkmcdueu.getAutoSavePrefix(editor);
|
||||
if (hasDraft(editor)) {
|
||||
editor.setContent(global$1.getItem(prefix + 'draft'), { format: 'raw' });
|
||||
$_4quc5u9bjkmcdues.fireRestoreDraft(editor);
|
||||
}
|
||||
};
|
||||
var startStoreDraft = function (editor, started) {
|
||||
var interval = $_c041qd9cjkmcdueu.getAutoSaveInterval(editor);
|
||||
if (!started.get()) {
|
||||
setInterval(function () {
|
||||
if (!editor.removed) {
|
||||
storeDraft(editor);
|
||||
}
|
||||
}, interval);
|
||||
started.set(true);
|
||||
}
|
||||
};
|
||||
var restoreLastDraft = function (editor) {
|
||||
editor.undoManager.transact(function () {
|
||||
restoreDraft(editor);
|
||||
removeDraft(editor);
|
||||
});
|
||||
editor.focus();
|
||||
};
|
||||
var $_cjmygy98jkmcdueq = {
|
||||
isEmpty: isEmpty,
|
||||
hasDraft: hasDraft,
|
||||
removeDraft: removeDraft,
|
||||
storeDraft: storeDraft,
|
||||
restoreDraft: restoreDraft,
|
||||
startStoreDraft: startStoreDraft,
|
||||
restoreLastDraft: restoreLastDraft
|
||||
};
|
||||
|
||||
var curry = function (f, editor) {
|
||||
return function () {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
return f.apply(null, [editor].concat(args));
|
||||
};
|
||||
};
|
||||
var get = function (editor) {
|
||||
return {
|
||||
hasDraft: curry($_cjmygy98jkmcdueq.hasDraft, editor),
|
||||
storeDraft: curry($_cjmygy98jkmcdueq.storeDraft, editor),
|
||||
restoreDraft: curry($_cjmygy98jkmcdueq.restoreDraft, editor),
|
||||
removeDraft: curry($_cjmygy98jkmcdueq.removeDraft, editor),
|
||||
isEmpty: curry($_cjmygy98jkmcdueq.isEmpty, editor)
|
||||
};
|
||||
};
|
||||
var $_dc7zgx97jkmcduep = { get: get };
|
||||
|
||||
var global$3 = tinymce.util.Tools.resolve('tinymce.EditorManager');
|
||||
|
||||
global$3._beforeUnloadHandler = function () {
|
||||
var msg;
|
||||
global$2.each(global$3.get(), function (editor) {
|
||||
if (editor.plugins.autosave) {
|
||||
editor.plugins.autosave.storeDraft();
|
||||
}
|
||||
if (!msg && editor.isDirty() && $_c041qd9cjkmcdueu.shouldAskBeforeUnload(editor)) {
|
||||
msg = editor.translate('You have unsaved changes are you sure you want to navigate away?');
|
||||
}
|
||||
});
|
||||
return msg;
|
||||
};
|
||||
var setup = function (editor) {
|
||||
window.onbeforeunload = global$3._beforeUnloadHandler;
|
||||
};
|
||||
var $_943u7c9fjkmcdufa = { setup: setup };
|
||||
|
||||
var postRender = function (editor, started) {
|
||||
return function (e) {
|
||||
var ctrl = e.control;
|
||||
ctrl.disabled(!$_cjmygy98jkmcdueq.hasDraft(editor));
|
||||
editor.on('StoreDraft RestoreDraft RemoveDraft', function () {
|
||||
ctrl.disabled(!$_cjmygy98jkmcdueq.hasDraft(editor));
|
||||
});
|
||||
$_cjmygy98jkmcdueq.startStoreDraft(editor, started);
|
||||
};
|
||||
};
|
||||
var register = function (editor, started) {
|
||||
editor.addButton('restoredraft', {
|
||||
title: 'Restore last draft',
|
||||
onclick: function () {
|
||||
$_cjmygy98jkmcdueq.restoreLastDraft(editor);
|
||||
},
|
||||
onPostRender: postRender(editor, started)
|
||||
});
|
||||
editor.addMenuItem('restoredraft', {
|
||||
text: 'Restore last draft',
|
||||
onclick: function () {
|
||||
$_cjmygy98jkmcdueq.restoreLastDraft(editor);
|
||||
},
|
||||
onPostRender: postRender(editor, started),
|
||||
context: 'file'
|
||||
});
|
||||
};
|
||||
var $_24uuf9hjkmcdufc = { register: register };
|
||||
|
||||
global.add('autosave', function (editor) {
|
||||
var started = Cell(false);
|
||||
$_943u7c9fjkmcdufa.setup(editor);
|
||||
$_24uuf9hjkmcdufc.register(editor, started);
|
||||
return $_dc7zgx97jkmcduep.get(editor);
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
||||
@@ -0,0 +1 @@
|
||||
!function(){"use strict";var n=function(t){var e=t,r=function(){return e};return{get:r,set:function(t){e=t},clone:function(){return n(r())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),o=tinymce.util.Tools.resolve("tinymce.util.Tools"),r=function(t){return t.fire("RestoreDraft")},i=function(t){return t.fire("StoreDraft")},s=function(t){return t.fire("RemoveDraft")},e=function(t,e){return((t=/^(\d+)([ms]?)$/.exec(""+(t||e)))[2]?{s:1e3,m:6e4}[t[2]]:1)*parseInt(t,10)},u=function(t){return t.getParam("autosave_ask_before_unload",!0)},f=function(t){var e=t.getParam("autosave_prefix","tinymce-autosave-{path}{query}{hash}-{id}-");return e=(e=(e=(e=e.replace(/\{path\}/g,document.location.pathname)).replace(/\{query\}/g,document.location.search)).replace(/\{hash\}/g,document.location.hash)).replace(/\{id\}/g,t.id)},c=function(t){return e(t.settings.autosave_interval,"30s")},l=function(t){return e(t.settings.autosave_retention,"20m")},m=function(t,e){var r=t.settings.forced_root_block;return""===(e=o.trim(void 0===e?t.getBody().innerHTML:e))||new RegExp("^<"+r+"[^>]*>((\xa0| |[ \t]|<br[^>]*>)+?|)</"+r+">|<br>$","i").test(e)},v=function(t){var e=parseInt(a.getItem(f(t)+"time"),10)||0;return!((new Date).getTime()-e>l(t)&&(d(t,!1),1))},d=function(t,e){var r=f(t);a.removeItem(r+"draft"),a.removeItem(r+"time"),!1!==e&&s(t)},D=function(t){var e=f(t);!m(t)&&t.isDirty()&&(a.setItem(e+"draft",t.getContent({format:"raw",no_events:!0})),a.setItem(e+"time",(new Date).getTime().toString()),i(t))},g=function(t){var e=f(t);v(t)&&(t.setContent(a.getItem(e+"draft"),{format:"raw"}),r(t))},y={isEmpty:m,hasDraft:v,removeDraft:d,storeDraft:D,restoreDraft:g,startStoreDraft:function(t,e){var r=c(t);e.get()||(setInterval(function(){t.removed||D(t)},r),e.set(!0))},restoreLastDraft:function(t){t.undoManager.transact(function(){g(t),d(t)}),t.focus()}},p=function(e,r){return function(){var t=Array.prototype.slice.call(arguments);return e.apply(null,[r].concat(t))}},h=function(t){return{hasDraft:p(y.hasDraft,t),storeDraft:p(y.storeDraft,t),restoreDraft:p(y.restoreDraft,t),removeDraft:p(y.removeDraft,t),isEmpty:p(y.isEmpty,t)}},_=tinymce.util.Tools.resolve("tinymce.EditorManager");_._beforeUnloadHandler=function(){var e;return o.each(_.get(),function(t){t.plugins.autosave&&t.plugins.autosave.storeDraft(),!e&&t.isDirty()&&u(t)&&(e=t.translate("You have unsaved changes are you sure you want to navigate away?"))}),e};var b=function(t){window.onbeforeunload=_._beforeUnloadHandler},I=function(r,n){return function(t){var e=t.control;e.disabled(!y.hasDraft(r)),r.on("StoreDraft RestoreDraft RemoveDraft",function(){e.disabled(!y.hasDraft(r))}),y.startStoreDraft(r,n)}},w=function(t,e){t.addButton("restoredraft",{title:"Restore last draft",onclick:function(){y.restoreLastDraft(t)},onPostRender:I(t,e)}),t.addMenuItem("restoredraft",{text:"Restore last draft",onclick:function(){y.restoreLastDraft(t)},onPostRender:I(t,e),context:"file"})};t.add("autosave",function(t){var e=n(!1);return b(t),w(t,e),h(t)})}();
|
||||
@@ -0,0 +1,7 @@
|
||||
// Exports the "bbcode" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/bbcode')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/bbcode'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,101 @@
|
||||
(function () {
|
||||
var bbcode = (function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var html2bbcode = function (s) {
|
||||
s = global$1.trim(s);
|
||||
var rep = function (re, str) {
|
||||
s = s.replace(re, str);
|
||||
};
|
||||
rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi, '[url=$1]$2[/url]');
|
||||
rep(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi, '[code][color=$1]$2[/color][/code]');
|
||||
rep(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi, '[quote][color=$1]$2[/color][/quote]');
|
||||
rep(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi, '[code][color=$1]$2[/color][/code]');
|
||||
rep(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi, '[quote][color=$1]$2[/color][/quote]');
|
||||
rep(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi, '[color=$1]$2[/color]');
|
||||
rep(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi, '[color=$1]$2[/color]');
|
||||
rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi, '[size=$1]$2[/size]');
|
||||
rep(/<font>(.*?)<\/font>/gi, '$1');
|
||||
rep(/<img.*?src=\"(.*?)\".*?\/>/gi, '[img]$1[/img]');
|
||||
rep(/<span class=\"codeStyle\">(.*?)<\/span>/gi, '[code]$1[/code]');
|
||||
rep(/<span class=\"quoteStyle\">(.*?)<\/span>/gi, '[quote]$1[/quote]');
|
||||
rep(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi, '[code][b]$1[/b][/code]');
|
||||
rep(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi, '[quote][b]$1[/b][/quote]');
|
||||
rep(/<em class=\"codeStyle\">(.*?)<\/em>/gi, '[code][i]$1[/i][/code]');
|
||||
rep(/<em class=\"quoteStyle\">(.*?)<\/em>/gi, '[quote][i]$1[/i][/quote]');
|
||||
rep(/<u class=\"codeStyle\">(.*?)<\/u>/gi, '[code][u]$1[/u][/code]');
|
||||
rep(/<u class=\"quoteStyle\">(.*?)<\/u>/gi, '[quote][u]$1[/u][/quote]');
|
||||
rep(/<\/(strong|b)>/gi, '[/b]');
|
||||
rep(/<(strong|b)>/gi, '[b]');
|
||||
rep(/<\/(em|i)>/gi, '[/i]');
|
||||
rep(/<(em|i)>/gi, '[i]');
|
||||
rep(/<\/u>/gi, '[/u]');
|
||||
rep(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi, '[u]$1[/u]');
|
||||
rep(/<u>/gi, '[u]');
|
||||
rep(/<blockquote[^>]*>/gi, '[quote]');
|
||||
rep(/<\/blockquote>/gi, '[/quote]');
|
||||
rep(/<br \/>/gi, '\n');
|
||||
rep(/<br\/>/gi, '\n');
|
||||
rep(/<br>/gi, '\n');
|
||||
rep(/<p>/gi, '');
|
||||
rep(/<\/p>/gi, '\n');
|
||||
rep(/ |\u00a0/gi, ' ');
|
||||
rep(/"/gi, '"');
|
||||
rep(/</gi, '<');
|
||||
rep(/>/gi, '>');
|
||||
rep(/&/gi, '&');
|
||||
return s;
|
||||
};
|
||||
var bbcode2html = function (s) {
|
||||
s = global$1.trim(s);
|
||||
var rep = function (re, str) {
|
||||
s = s.replace(re, str);
|
||||
};
|
||||
rep(/\n/gi, '<br />');
|
||||
rep(/\[b\]/gi, '<strong>');
|
||||
rep(/\[\/b\]/gi, '</strong>');
|
||||
rep(/\[i\]/gi, '<em>');
|
||||
rep(/\[\/i\]/gi, '</em>');
|
||||
rep(/\[u\]/gi, '<u>');
|
||||
rep(/\[\/u\]/gi, '</u>');
|
||||
rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi, '<a href="$1">$2</a>');
|
||||
rep(/\[url\](.*?)\[\/url\]/gi, '<a href="$1">$1</a>');
|
||||
rep(/\[img\](.*?)\[\/img\]/gi, '<img src="$1" />');
|
||||
rep(/\[color=(.*?)\](.*?)\[\/color\]/gi, '<font color="$1">$2</font>');
|
||||
rep(/\[code\](.*?)\[\/code\]/gi, '<span class="codeStyle">$1</span> ');
|
||||
rep(/\[quote.*?\](.*?)\[\/quote\]/gi, '<span class="quoteStyle">$1</span> ');
|
||||
return s;
|
||||
};
|
||||
var $_9meifg9kjkmcdug9 = {
|
||||
html2bbcode: html2bbcode,
|
||||
bbcode2html: bbcode2html
|
||||
};
|
||||
|
||||
global.add('bbcode', function () {
|
||||
return {
|
||||
init: function (editor) {
|
||||
editor.on('beforeSetContent', function (e) {
|
||||
e.content = $_9meifg9kjkmcdug9.bbcode2html(e.content);
|
||||
});
|
||||
editor.on('postProcess', function (e) {
|
||||
if (e.set) {
|
||||
e.content = $_9meifg9kjkmcdug9.bbcode2html(e.content);
|
||||
}
|
||||
if (e.get) {
|
||||
e.content = $_9meifg9kjkmcdug9.html2bbcode(e.content);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
||||
@@ -0,0 +1 @@
|
||||
!function(){"use strict";var o=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.util.Tools"),e=function(e){e=t.trim(e);var o=function(o,t){e=e.replace(o,t)};return o(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]"),o(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),o(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),o(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),o(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),o(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]"),o(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]"),o(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]"),o(/<font>(.*?)<\/font>/gi,"$1"),o(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]"),o(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]"),o(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]"),o(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"),o(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"),o(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"),o(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"),o(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"),o(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]"),o(/<\/(strong|b)>/gi,"[/b]"),o(/<(strong|b)>/gi,"[b]"),o(/<\/(em|i)>/gi,"[/i]"),o(/<(em|i)>/gi,"[i]"),o(/<\/u>/gi,"[/u]"),o(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]"),o(/<u>/gi,"[u]"),o(/<blockquote[^>]*>/gi,"[quote]"),o(/<\/blockquote>/gi,"[/quote]"),o(/<br \/>/gi,"\n"),o(/<br\/>/gi,"\n"),o(/<br>/gi,"\n"),o(/<p>/gi,""),o(/<\/p>/gi,"\n"),o(/ |\u00a0/gi," "),o(/"/gi,'"'),o(/</gi,"<"),o(/>/gi,">"),o(/&/gi,"&"),e},i=function(e){e=t.trim(e);var o=function(o,t){e=e.replace(o,t)};return o(/\n/gi,"<br />"),o(/\[b\]/gi,"<strong>"),o(/\[\/b\]/gi,"</strong>"),o(/\[i\]/gi,"<em>"),o(/\[\/i\]/gi,"</em>"),o(/\[u\]/gi,"<u>"),o(/\[\/u\]/gi,"</u>"),o(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'<a href="$1">$2</a>'),o(/\[url\](.*?)\[\/url\]/gi,'<a href="$1">$1</a>'),o(/\[img\](.*?)\[\/img\]/gi,'<img src="$1" />'),o(/\[color=(.*?)\](.*?)\[\/color\]/gi,'<font color="$1">$2</font>'),o(/\[code\](.*?)\[\/code\]/gi,'<span class="codeStyle">$1</span> '),o(/\[quote.*?\](.*?)\[\/quote\]/gi,'<span class="quoteStyle">$1</span> '),e};o.add("bbcode",function(){return{init:function(o){o.on("beforeSetContent",function(o){o.content=i(o.content)}),o.on("postProcess",function(o){o.set&&(o.content=i(o.content)),o.get&&(o.content=e(o.content))})}}})}();
|
||||
@@ -0,0 +1,7 @@
|
||||
// Exports the "charmap" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/charmap')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/charmap'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,7 @@
|
||||
// Exports the "code" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/code')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/code'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,94 @@
|
||||
(function () {
|
||||
var code = (function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
|
||||
|
||||
var getMinWidth = function (editor) {
|
||||
return editor.getParam('code_dialog_width', 600);
|
||||
};
|
||||
var getMinHeight = function (editor) {
|
||||
return editor.getParam('code_dialog_height', Math.min(global$1.DOM.getViewPort().h - 200, 500));
|
||||
};
|
||||
var $_eflgpxa2jkmcduho = {
|
||||
getMinWidth: getMinWidth,
|
||||
getMinHeight: getMinHeight
|
||||
};
|
||||
|
||||
var setContent = function (editor, html) {
|
||||
editor.focus();
|
||||
editor.undoManager.transact(function () {
|
||||
editor.setContent(html);
|
||||
});
|
||||
editor.selection.setCursorLocation();
|
||||
editor.nodeChanged();
|
||||
};
|
||||
var getContent = function (editor) {
|
||||
return editor.getContent({ source_view: true });
|
||||
};
|
||||
var $_8flteaa4jkmcduhr = {
|
||||
setContent: setContent,
|
||||
getContent: getContent
|
||||
};
|
||||
|
||||
var open = function (editor) {
|
||||
var minWidth = $_eflgpxa2jkmcduho.getMinWidth(editor);
|
||||
var minHeight = $_eflgpxa2jkmcduho.getMinHeight(editor);
|
||||
var win = editor.windowManager.open({
|
||||
title: 'Source code',
|
||||
body: {
|
||||
type: 'textbox',
|
||||
name: 'code',
|
||||
multiline: true,
|
||||
minWidth: minWidth,
|
||||
minHeight: minHeight,
|
||||
spellcheck: false,
|
||||
style: 'direction: ltr; text-align: left'
|
||||
},
|
||||
onSubmit: function (e) {
|
||||
$_8flteaa4jkmcduhr.setContent(editor, e.data.code);
|
||||
}
|
||||
});
|
||||
win.find('#code').value($_8flteaa4jkmcduhr.getContent(editor));
|
||||
};
|
||||
var $_1t3809a1jkmcduhn = { open: open };
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('mceCodeEditor', function () {
|
||||
$_1t3809a1jkmcduhn.open(editor);
|
||||
});
|
||||
};
|
||||
var $_471po0a0jkmcduhm = { register: register };
|
||||
|
||||
var register$1 = function (editor) {
|
||||
editor.addButton('code', {
|
||||
icon: 'code',
|
||||
tooltip: 'Source code',
|
||||
onclick: function () {
|
||||
$_1t3809a1jkmcduhn.open(editor);
|
||||
}
|
||||
});
|
||||
editor.addMenuItem('code', {
|
||||
icon: 'code',
|
||||
text: 'Source code',
|
||||
onclick: function () {
|
||||
$_1t3809a1jkmcduhn.open(editor);
|
||||
}
|
||||
});
|
||||
};
|
||||
var $_4pay2da5jkmcduhs = { register: register$1 };
|
||||
|
||||
global.add('code', function (editor) {
|
||||
$_471po0a0jkmcduhm.register(editor);
|
||||
$_4pay2da5jkmcduhs.register(editor);
|
||||
return {};
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
||||
@@ -0,0 +1 @@
|
||||
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),o=function(t){return t.getParam("code_dialog_width",600)},i=function(t){return t.getParam("code_dialog_height",Math.min(n.DOM.getViewPort().h-200,500))},c=function(t,n){t.focus(),t.undoManager.transact(function(){t.setContent(n)}),t.selection.setCursorLocation(),t.nodeChanged()},d=function(t){return t.getContent({source_view:!0})},e=function(n){var t=o(n),e=i(n);n.windowManager.open({title:"Source code",body:{type:"textbox",name:"code",multiline:!0,minWidth:t,minHeight:e,spellcheck:!1,style:"direction: ltr; text-align: left"},onSubmit:function(t){c(n,t.data.code)}}).find("#code").value(d(n))},u=function(t){t.addCommand("mceCodeEditor",function(){e(t)})},a=function(t){t.addButton("code",{icon:"code",tooltip:"Source code",onclick:function(){e(t)}}),t.addMenuItem("code",{icon:"code",text:"Source code",onclick:function(){e(t)}})};t.add("code",function(t){return u(t),a(t),{}})}();
|
||||
@@ -0,0 +1,138 @@
|
||||
/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript */
|
||||
/**
|
||||
* prism.js default theme for JavaScript, CSS and HTML
|
||||
* Based on dabblet (http://dabblet.com)
|
||||
* @author Lea Verou
|
||||
*/
|
||||
|
||||
code[class*="language-"],
|
||||
pre[class*="language-"] {
|
||||
color: black;
|
||||
text-shadow: 0 1px white;
|
||||
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
|
||||
direction: ltr;
|
||||
text-align: left;
|
||||
white-space: pre;
|
||||
word-spacing: normal;
|
||||
word-break: normal;
|
||||
word-wrap: normal;
|
||||
line-height: 1.5;
|
||||
|
||||
-moz-tab-size: 4;
|
||||
-o-tab-size: 4;
|
||||
tab-size: 4;
|
||||
|
||||
-webkit-hyphens: none;
|
||||
-moz-hyphens: none;
|
||||
-ms-hyphens: none;
|
||||
hyphens: none;
|
||||
}
|
||||
|
||||
pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
|
||||
code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
|
||||
text-shadow: none;
|
||||
background: #b3d4fc;
|
||||
}
|
||||
|
||||
pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
|
||||
code[class*="language-"]::selection, code[class*="language-"] ::selection {
|
||||
text-shadow: none;
|
||||
background: #b3d4fc;
|
||||
}
|
||||
|
||||
@media print {
|
||||
code[class*="language-"],
|
||||
pre[class*="language-"] {
|
||||
text-shadow: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* Code blocks */
|
||||
pre[class*="language-"] {
|
||||
padding: 1em;
|
||||
margin: .5em 0;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
:not(pre) > code[class*="language-"],
|
||||
pre[class*="language-"] {
|
||||
background: #f5f2f0;
|
||||
}
|
||||
|
||||
/* Inline code */
|
||||
:not(pre) > code[class*="language-"] {
|
||||
padding: .1em;
|
||||
border-radius: .3em;
|
||||
}
|
||||
|
||||
.token.comment,
|
||||
.token.prolog,
|
||||
.token.doctype,
|
||||
.token.cdata {
|
||||
color: slategray;
|
||||
}
|
||||
|
||||
.token.punctuation {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.namespace {
|
||||
opacity: .7;
|
||||
}
|
||||
|
||||
.token.property,
|
||||
.token.tag,
|
||||
.token.boolean,
|
||||
.token.number,
|
||||
.token.constant,
|
||||
.token.symbol,
|
||||
.token.deleted {
|
||||
color: #905;
|
||||
}
|
||||
|
||||
.token.selector,
|
||||
.token.attr-name,
|
||||
.token.string,
|
||||
.token.char,
|
||||
.token.builtin,
|
||||
.token.inserted {
|
||||
color: #690;
|
||||
}
|
||||
|
||||
.token.operator,
|
||||
.token.entity,
|
||||
.token.url,
|
||||
.language-css .token.string,
|
||||
.style .token.string {
|
||||
color: #a67f59;
|
||||
background: hsla(0, 0%, 100%, .5);
|
||||
}
|
||||
|
||||
.token.atrule,
|
||||
.token.attr-value,
|
||||
.token.keyword {
|
||||
color: #07a;
|
||||
}
|
||||
|
||||
.token.function {
|
||||
color: #DD4A68;
|
||||
}
|
||||
|
||||
.token.regex,
|
||||
.token.important,
|
||||
.token.variable {
|
||||
color: #e90;
|
||||
}
|
||||
|
||||
.token.important,
|
||||
.token.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
.token.italic {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.token.entity {
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// Exports the "codesample" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/codesample')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/codesample'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,967 @@
|
||||
(function () {
|
||||
var codesample = (function () {
|
||||
'use strict';
|
||||
|
||||
var Cell = function (initial) {
|
||||
var value = initial;
|
||||
var get = function () {
|
||||
return value;
|
||||
};
|
||||
var set = function (v) {
|
||||
value = v;
|
||||
};
|
||||
var clone = function () {
|
||||
return Cell(get());
|
||||
};
|
||||
return {
|
||||
get: get,
|
||||
set: set,
|
||||
clone: clone
|
||||
};
|
||||
};
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
|
||||
|
||||
var getContentCss = function (editor) {
|
||||
return editor.settings.codesample_content_css;
|
||||
};
|
||||
var getLanguages = function (editor) {
|
||||
return editor.settings.codesample_languages;
|
||||
};
|
||||
var getDialogMinWidth = function (editor) {
|
||||
return Math.min(global$1.DOM.getViewPort().w, editor.getParam('codesample_dialog_width', 800));
|
||||
};
|
||||
var getDialogMinHeight = function (editor) {
|
||||
return Math.min(global$1.DOM.getViewPort().w, editor.getParam('codesample_dialog_height', 650));
|
||||
};
|
||||
var $_7mx4fhabjkmcduic = {
|
||||
getContentCss: getContentCss,
|
||||
getLanguages: getLanguages,
|
||||
getDialogMinWidth: getDialogMinWidth,
|
||||
getDialogMinHeight: getDialogMinHeight
|
||||
};
|
||||
|
||||
var window$$1 = {};
|
||||
var global$2 = window$$1;
|
||||
var _self = typeof window$$1 !== 'undefined' ? window$$1 : typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope ? self : {};
|
||||
var Prism = function () {
|
||||
var lang = /\blang(?:uage)?-(?!\*)(\w+)\b/i;
|
||||
var _ = _self.Prism = {
|
||||
util: {
|
||||
encode: function (tokens) {
|
||||
if (tokens instanceof Token) {
|
||||
return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias);
|
||||
} else if (_.util.type(tokens) === 'Array') {
|
||||
return tokens.map(_.util.encode);
|
||||
} else {
|
||||
return tokens.replace(/&/g, '&').replace(/</g, '<').replace(/\u00a0/g, ' ');
|
||||
}
|
||||
},
|
||||
type: function (o) {
|
||||
return Object.prototype.toString.call(o).match(/\[object (\w+)\]/)[1];
|
||||
},
|
||||
clone: function (o) {
|
||||
var type = _.util.type(o);
|
||||
switch (type) {
|
||||
case 'Object':
|
||||
var clone = {};
|
||||
for (var key in o) {
|
||||
if (o.hasOwnProperty(key)) {
|
||||
clone[key] = _.util.clone(o[key]);
|
||||
}
|
||||
}
|
||||
return clone;
|
||||
case 'Array':
|
||||
return o.map && o.map(function (v) {
|
||||
return _.util.clone(v);
|
||||
});
|
||||
}
|
||||
return o;
|
||||
}
|
||||
},
|
||||
languages: {
|
||||
extend: function (id, redef) {
|
||||
var lang = _.util.clone(_.languages[id]);
|
||||
for (var key in redef) {
|
||||
lang[key] = redef[key];
|
||||
}
|
||||
return lang;
|
||||
},
|
||||
insertBefore: function (inside, before, insert, root) {
|
||||
root = root || _.languages;
|
||||
var grammar = root[inside];
|
||||
if (arguments.length === 2) {
|
||||
insert = arguments[1];
|
||||
for (var newToken in insert) {
|
||||
if (insert.hasOwnProperty(newToken)) {
|
||||
grammar[newToken] = insert[newToken];
|
||||
}
|
||||
}
|
||||
return grammar;
|
||||
}
|
||||
var ret = {};
|
||||
for (var token in grammar) {
|
||||
if (grammar.hasOwnProperty(token)) {
|
||||
if (token === before) {
|
||||
for (var newToken in insert) {
|
||||
if (insert.hasOwnProperty(newToken)) {
|
||||
ret[newToken] = insert[newToken];
|
||||
}
|
||||
}
|
||||
}
|
||||
ret[token] = grammar[token];
|
||||
}
|
||||
}
|
||||
_.languages.DFS(_.languages, function (key, value) {
|
||||
if (value === root[inside] && key !== inside) {
|
||||
this[key] = ret;
|
||||
}
|
||||
});
|
||||
return root[inside] = ret;
|
||||
},
|
||||
DFS: function (o, callback, type) {
|
||||
for (var i in o) {
|
||||
if (o.hasOwnProperty(i)) {
|
||||
callback.call(o, i, o[i], type || i);
|
||||
if (_.util.type(o[i]) === 'Object') {
|
||||
_.languages.DFS(o[i], callback);
|
||||
} else if (_.util.type(o[i]) === 'Array') {
|
||||
_.languages.DFS(o[i], callback, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
plugins: {},
|
||||
highlightAll: function (async, callback) {
|
||||
var elements = document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code');
|
||||
for (var i = 0, element = void 0; element = elements[i++];) {
|
||||
_.highlightElement(element, async === true, callback);
|
||||
}
|
||||
},
|
||||
highlightElement: function (element, async, callback) {
|
||||
var language, grammar, parent$$1 = element;
|
||||
while (parent$$1 && !lang.test(parent$$1.className)) {
|
||||
parent$$1 = parent$$1.parentNode;
|
||||
}
|
||||
if (parent$$1) {
|
||||
language = (parent$$1.className.match(lang) || [
|
||||
,
|
||||
''
|
||||
])[1];
|
||||
grammar = _.languages[language];
|
||||
}
|
||||
element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
|
||||
parent$$1 = element.parentNode;
|
||||
if (/pre/i.test(parent$$1.nodeName)) {
|
||||
parent$$1.className = parent$$1.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
|
||||
}
|
||||
var code = element.textContent;
|
||||
var env = {
|
||||
element: element,
|
||||
language: language,
|
||||
grammar: grammar,
|
||||
code: code
|
||||
};
|
||||
if (!code || !grammar) {
|
||||
_.hooks.run('complete', env);
|
||||
return;
|
||||
}
|
||||
_.hooks.run('before-highlight', env);
|
||||
if (async && _self.Worker) {
|
||||
var worker = new Worker(_.filename);
|
||||
worker.onmessage = function (evt) {
|
||||
env.highlightedCode = evt.data;
|
||||
_.hooks.run('before-insert', env);
|
||||
env.element.innerHTML = env.highlightedCode;
|
||||
if (callback) {
|
||||
callback.call(env.element);
|
||||
}
|
||||
_.hooks.run('after-highlight', env);
|
||||
_.hooks.run('complete', env);
|
||||
};
|
||||
worker.postMessage(JSON.stringify({
|
||||
language: env.language,
|
||||
code: env.code,
|
||||
immediateClose: true
|
||||
}));
|
||||
} else {
|
||||
env.highlightedCode = _.highlight(env.code, env.grammar, env.language);
|
||||
_.hooks.run('before-insert', env);
|
||||
env.element.innerHTML = env.highlightedCode;
|
||||
if (callback) {
|
||||
callback.call(element);
|
||||
}
|
||||
_.hooks.run('after-highlight', env);
|
||||
_.hooks.run('complete', env);
|
||||
}
|
||||
},
|
||||
highlight: function (text, grammar, language) {
|
||||
var tokens = _.tokenize(text, grammar);
|
||||
return Token.stringify(_.util.encode(tokens), language);
|
||||
},
|
||||
tokenize: function (text, grammar, language) {
|
||||
var Token = _.Token;
|
||||
var strarr = [text];
|
||||
var rest = grammar.rest;
|
||||
if (rest) {
|
||||
for (var token in rest) {
|
||||
grammar[token] = rest[token];
|
||||
}
|
||||
delete grammar.rest;
|
||||
}
|
||||
tokenloop:
|
||||
for (var token in grammar) {
|
||||
if (!grammar.hasOwnProperty(token) || !grammar[token]) {
|
||||
continue;
|
||||
}
|
||||
var patterns = grammar[token];
|
||||
patterns = _.util.type(patterns) === 'Array' ? patterns : [patterns];
|
||||
for (var j = 0; j < patterns.length; ++j) {
|
||||
var pattern = patterns[j];
|
||||
var inside = pattern.inside;
|
||||
var lookbehind = !!pattern.lookbehind;
|
||||
var lookbehindLength = 0;
|
||||
var alias = pattern.alias;
|
||||
pattern = pattern.pattern || pattern;
|
||||
for (var i = 0; i < strarr.length; i++) {
|
||||
var str = strarr[i];
|
||||
if (strarr.length > text.length) {
|
||||
break tokenloop;
|
||||
}
|
||||
if (str instanceof Token) {
|
||||
continue;
|
||||
}
|
||||
pattern.lastIndex = 0;
|
||||
var match = pattern.exec(str);
|
||||
if (match) {
|
||||
if (lookbehind) {
|
||||
lookbehindLength = match[1].length;
|
||||
}
|
||||
var from = match.index - 1 + lookbehindLength;
|
||||
match = match[0].slice(lookbehindLength);
|
||||
var len = match.length, to = from + len, before = str.slice(0, from + 1), after = str.slice(to + 1);
|
||||
var args = [
|
||||
i,
|
||||
1
|
||||
];
|
||||
if (before) {
|
||||
args.push(before);
|
||||
}
|
||||
var wrapped = new Token(token, inside ? _.tokenize(match, inside) : match, alias);
|
||||
args.push(wrapped);
|
||||
if (after) {
|
||||
args.push(after);
|
||||
}
|
||||
Array.prototype.splice.apply(strarr, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return strarr;
|
||||
},
|
||||
hooks: {
|
||||
all: {},
|
||||
add: function (name$$1, callback) {
|
||||
var hooks = _.hooks.all;
|
||||
hooks[name$$1] = hooks[name$$1] || [];
|
||||
hooks[name$$1].push(callback);
|
||||
},
|
||||
run: function (name$$1, env) {
|
||||
var callbacks = _.hooks.all[name$$1];
|
||||
if (!callbacks || !callbacks.length) {
|
||||
return;
|
||||
}
|
||||
for (var i = 0, callback = void 0; callback = callbacks[i++];) {
|
||||
callback(env);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
var Token = _.Token = function (type, content, alias) {
|
||||
this.type = type;
|
||||
this.content = content;
|
||||
this.alias = alias;
|
||||
};
|
||||
Token.stringify = function (o, language, parent$$1) {
|
||||
if (typeof o === 'string') {
|
||||
return o;
|
||||
}
|
||||
if (_.util.type(o) === 'Array') {
|
||||
return o.map(function (element) {
|
||||
return Token.stringify(element, language, o);
|
||||
}).join('');
|
||||
}
|
||||
var env = {
|
||||
type: o.type,
|
||||
content: Token.stringify(o.content, language, parent$$1),
|
||||
tag: 'span',
|
||||
classes: [
|
||||
'token',
|
||||
o.type
|
||||
],
|
||||
attributes: {},
|
||||
language: language,
|
||||
parent: parent$$1
|
||||
};
|
||||
if (env.type === 'comment') {
|
||||
env.attributes.spellcheck = 'true';
|
||||
}
|
||||
if (o.alias) {
|
||||
var aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias];
|
||||
Array.prototype.push.apply(env.classes, aliases);
|
||||
}
|
||||
_.hooks.run('wrap', env);
|
||||
var attributes = '';
|
||||
for (var name$$1 in env.attributes) {
|
||||
attributes += (attributes ? ' ' : '') + name$$1 + '="' + (env.attributes[name$$1] || '') + '"';
|
||||
}
|
||||
return '<' + env.tag + ' class="' + env.classes.join(' ') + '" ' + attributes + '>' + env.content + '</' + env.tag + '>';
|
||||
};
|
||||
if (!_self.document) {
|
||||
if (!_self.addEventListener) {
|
||||
return _self.Prism;
|
||||
}
|
||||
_self.addEventListener('message', function (evt) {
|
||||
var message = JSON.parse(evt.data), lang = message.language, code = message.code, immediateClose = message.immediateClose;
|
||||
_self.postMessage(_.highlight(code, _.languages[lang], lang));
|
||||
if (immediateClose) {
|
||||
_self.close();
|
||||
}
|
||||
}, false);
|
||||
return _self.Prism;
|
||||
}
|
||||
}();
|
||||
if (typeof global$2 !== 'undefined') {
|
||||
global$2.Prism = Prism;
|
||||
}
|
||||
Prism.languages.markup = {
|
||||
comment: /<!--[\w\W]*?-->/,
|
||||
prolog: /<\?[\w\W]+?\?>/,
|
||||
doctype: /<!DOCTYPE[\w\W]+?>/,
|
||||
cdata: /<!\[CDATA\[[\w\W]*?]]>/i,
|
||||
tag: {
|
||||
pattern: /<\/?[^\s>\/=.]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,
|
||||
inside: {
|
||||
'tag': {
|
||||
pattern: /^<\/?[^\s>\/]+/i,
|
||||
inside: {
|
||||
punctuation: /^<\/?/,
|
||||
namespace: /^[^\s>\/:]+:/
|
||||
}
|
||||
},
|
||||
'attr-value': {
|
||||
pattern: /=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,
|
||||
inside: { punctuation: /[=>"']/ }
|
||||
},
|
||||
'punctuation': /\/?>/,
|
||||
'attr-name': {
|
||||
pattern: /[^\s>\/]+/,
|
||||
inside: { namespace: /^[^\s>\/:]+:/ }
|
||||
}
|
||||
}
|
||||
},
|
||||
entity: /&#?[\da-z]{1,8};/i
|
||||
};
|
||||
Prism.hooks.add('wrap', function (env) {
|
||||
if (env.type === 'entity') {
|
||||
env.attributes.title = env.content.replace(/&/, '&');
|
||||
}
|
||||
});
|
||||
Prism.languages.xml = Prism.languages.markup;
|
||||
Prism.languages.html = Prism.languages.markup;
|
||||
Prism.languages.mathml = Prism.languages.markup;
|
||||
Prism.languages.svg = Prism.languages.markup;
|
||||
Prism.languages.css = {
|
||||
comment: /\/\*[\w\W]*?\*\//,
|
||||
atrule: {
|
||||
pattern: /@[\w-]+?.*?(;|(?=\s*\{))/i,
|
||||
inside: { rule: /@[\w-]+/ }
|
||||
},
|
||||
url: /url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,
|
||||
selector: /[^\{\}\s][^\{\};]*?(?=\s*\{)/,
|
||||
string: /("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,
|
||||
property: /(\b|\B)[\w-]+(?=\s*:)/i,
|
||||
important: /\B!important\b/i,
|
||||
function: /[-a-z0-9]+(?=\()/i,
|
||||
punctuation: /[(){};:]/
|
||||
};
|
||||
Prism.languages.css.atrule.inside.rest = Prism.util.clone(Prism.languages.css);
|
||||
if (Prism.languages.markup) {
|
||||
Prism.languages.insertBefore('markup', 'tag', {
|
||||
style: {
|
||||
pattern: /<style[\w\W]*?>[\w\W]*?<\/style>/i,
|
||||
inside: {
|
||||
tag: {
|
||||
pattern: /<style[\w\W]*?>|<\/style>/i,
|
||||
inside: Prism.languages.markup.tag.inside
|
||||
},
|
||||
rest: Prism.languages.css
|
||||
},
|
||||
alias: 'language-css'
|
||||
}
|
||||
});
|
||||
Prism.languages.insertBefore('inside', 'attr-value', {
|
||||
'style-attr': {
|
||||
pattern: /\s*style=("|').*?\1/i,
|
||||
inside: {
|
||||
'attr-name': {
|
||||
pattern: /^\s*style/i,
|
||||
inside: Prism.languages.markup.tag.inside
|
||||
},
|
||||
'punctuation': /^\s*=\s*['"]|['"]\s*$/,
|
||||
'attr-value': {
|
||||
pattern: /.+/i,
|
||||
inside: Prism.languages.css
|
||||
}
|
||||
},
|
||||
alias: 'language-css'
|
||||
}
|
||||
}, Prism.languages.markup.tag);
|
||||
}
|
||||
Prism.languages.clike = {
|
||||
'comment': [
|
||||
{
|
||||
pattern: /(^|[^\\])\/\*[\w\W]*?\*\//,
|
||||
lookbehind: true
|
||||
},
|
||||
{
|
||||
pattern: /(^|[^\\:])\/\/.*/,
|
||||
lookbehind: true
|
||||
}
|
||||
],
|
||||
'string': /(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
|
||||
'class-name': {
|
||||
pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,
|
||||
lookbehind: true,
|
||||
inside: { punctuation: /(\.|\\)/ }
|
||||
},
|
||||
'keyword': /\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
|
||||
'boolean': /\b(true|false)\b/,
|
||||
'function': /[a-z0-9_]+(?=\()/i,
|
||||
'number': /\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,
|
||||
'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,
|
||||
'punctuation': /[{}[\];(),.:]/
|
||||
};
|
||||
Prism.languages.javascript = Prism.languages.extend('clike', {
|
||||
keyword: /\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/,
|
||||
number: /\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,
|
||||
function: /[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i
|
||||
});
|
||||
Prism.languages.insertBefore('javascript', 'keyword', {
|
||||
regex: {
|
||||
pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,
|
||||
lookbehind: true
|
||||
}
|
||||
});
|
||||
Prism.languages.insertBefore('javascript', 'class-name', {
|
||||
'template-string': {
|
||||
pattern: /`(?:\\`|\\?[^`])*`/,
|
||||
inside: {
|
||||
interpolation: {
|
||||
pattern: /\$\{[^}]+\}/,
|
||||
inside: {
|
||||
'interpolation-punctuation': {
|
||||
pattern: /^\$\{|\}$/,
|
||||
alias: 'punctuation'
|
||||
},
|
||||
'rest': Prism.languages.javascript
|
||||
}
|
||||
},
|
||||
string: /[\s\S]+/
|
||||
}
|
||||
}
|
||||
});
|
||||
if (Prism.languages.markup) {
|
||||
Prism.languages.insertBefore('markup', 'tag', {
|
||||
script: {
|
||||
pattern: /<script[\w\W]*?>[\w\W]*?<\/script>/i,
|
||||
inside: {
|
||||
tag: {
|
||||
pattern: /<script[\w\W]*?>|<\/script>/i,
|
||||
inside: Prism.languages.markup.tag.inside
|
||||
},
|
||||
rest: Prism.languages.javascript
|
||||
},
|
||||
alias: 'language-javascript'
|
||||
}
|
||||
});
|
||||
}
|
||||
Prism.languages.js = Prism.languages.javascript;
|
||||
Prism.languages.c = Prism.languages.extend('clike', {
|
||||
keyword: /\b(asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,
|
||||
operator: /\-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|?\||[~^%?*\/]/,
|
||||
number: /\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)[ful]*\b/i
|
||||
});
|
||||
Prism.languages.insertBefore('c', 'string', {
|
||||
macro: {
|
||||
pattern: /(^\s*)#\s*[a-z]+([^\r\n\\]|\\.|\\(?:\r\n?|\n))*/im,
|
||||
lookbehind: true,
|
||||
alias: 'property',
|
||||
inside: {
|
||||
string: {
|
||||
pattern: /(#\s*include\s*)(<.+?>|("|')(\\?.)+?\3)/,
|
||||
lookbehind: true
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
delete Prism.languages.c['class-name'];
|
||||
delete Prism.languages.c.boolean;
|
||||
Prism.languages.csharp = Prism.languages.extend('clike', {
|
||||
keyword: /\b(abstract|as|async|await|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|do|double|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|goto|if|implicit|in|int|interface|internal|is|lock|long|namespace|new|null|object|operator|out|override|params|private|protected|public|readonly|ref|return|sbyte|sealed|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|virtual|void|volatile|while|add|alias|ascending|async|await|descending|dynamic|from|get|global|group|into|join|let|orderby|partial|remove|select|set|value|var|where|yield)\b/,
|
||||
string: [
|
||||
/@("|')(\1\1|\\\1|\\?(?!\1)[\s\S])*\1/,
|
||||
/("|')(\\?.)*?\1/
|
||||
],
|
||||
number: /\b-?(0x[\da-f]+|\d*\.?\d+)\b/i
|
||||
});
|
||||
Prism.languages.insertBefore('csharp', 'keyword', {
|
||||
preprocessor: {
|
||||
pattern: /(^\s*)#.*/m,
|
||||
lookbehind: true
|
||||
}
|
||||
});
|
||||
Prism.languages.cpp = Prism.languages.extend('c', {
|
||||
keyword: /\b(alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,
|
||||
boolean: /\b(true|false)\b/,
|
||||
operator: /[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|:{1,2}|={1,2}|\^|~|%|&{1,2}|\|?\||\?|\*|\/|\b(and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/
|
||||
});
|
||||
Prism.languages.insertBefore('cpp', 'keyword', {
|
||||
'class-name': {
|
||||
pattern: /(class\s+)[a-z0-9_]+/i,
|
||||
lookbehind: true
|
||||
}
|
||||
});
|
||||
Prism.languages.java = Prism.languages.extend('clike', {
|
||||
keyword: /\b(abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/,
|
||||
number: /\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp\-]+\b|\b\d*\.?\d+(?:e[+-]?\d+)?[df]?\b/i,
|
||||
operator: {
|
||||
pattern: /(^|[^.])(?:\+[+=]?|-[-=]?|!=?|<<?=?|>>?>?=?|==?|&[&=]?|\|[|=]?|\*=?|\/=?|%=?|\^=?|[?:~])/m,
|
||||
lookbehind: true
|
||||
}
|
||||
});
|
||||
Prism.languages.php = Prism.languages.extend('clike', {
|
||||
keyword: /\b(and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i,
|
||||
constant: /\b[A-Z0-9_]{2,}\b/,
|
||||
comment: {
|
||||
pattern: /(^|[^\\])(?:\/\*[\w\W]*?\*\/|\/\/.*)/,
|
||||
lookbehind: true
|
||||
}
|
||||
});
|
||||
Prism.languages.insertBefore('php', 'class-name', {
|
||||
'shell-comment': {
|
||||
pattern: /(^|[^\\])#.*/,
|
||||
lookbehind: true,
|
||||
alias: 'comment'
|
||||
}
|
||||
});
|
||||
Prism.languages.insertBefore('php', 'keyword', {
|
||||
delimiter: /\?>|<\?(?:php)?/i,
|
||||
variable: /\$\w+\b/i,
|
||||
package: {
|
||||
pattern: /(\\|namespace\s+|use\s+)[\w\\]+/,
|
||||
lookbehind: true,
|
||||
inside: { punctuation: /\\/ }
|
||||
}
|
||||
});
|
||||
Prism.languages.insertBefore('php', 'operator', {
|
||||
property: {
|
||||
pattern: /(->)[\w]+/,
|
||||
lookbehind: true
|
||||
}
|
||||
});
|
||||
if (Prism.languages.markup) {
|
||||
Prism.hooks.add('before-highlight', function (env) {
|
||||
if (env.language !== 'php') {
|
||||
return;
|
||||
}
|
||||
env.tokenStack = [];
|
||||
env.backupCode = env.code;
|
||||
env.code = env.code.replace(/(?:<\?php|<\?)[\w\W]*?(?:\?>)/ig, function (match) {
|
||||
env.tokenStack.push(match);
|
||||
return '{{{PHP' + env.tokenStack.length + '}}}';
|
||||
});
|
||||
});
|
||||
Prism.hooks.add('before-insert', function (env) {
|
||||
if (env.language === 'php') {
|
||||
env.code = env.backupCode;
|
||||
delete env.backupCode;
|
||||
}
|
||||
});
|
||||
Prism.hooks.add('after-highlight', function (env) {
|
||||
if (env.language !== 'php') {
|
||||
return;
|
||||
}
|
||||
for (var i = 0, t = void 0; t = env.tokenStack[i]; i++) {
|
||||
env.highlightedCode = env.highlightedCode.replace('{{{PHP' + (i + 1) + '}}}', Prism.highlight(t, env.grammar, 'php').replace(/\$/g, '$$$$'));
|
||||
}
|
||||
env.element.innerHTML = env.highlightedCode;
|
||||
});
|
||||
Prism.hooks.add('wrap', function (env) {
|
||||
if (env.language === 'php' && env.type === 'markup') {
|
||||
env.content = env.content.replace(/(\{\{\{PHP[0-9]+\}\}\})/g, '<span class="token php">$1</span>');
|
||||
}
|
||||
});
|
||||
Prism.languages.insertBefore('php', 'comment', {
|
||||
markup: {
|
||||
pattern: /<[^?]\/?(.*?)>/,
|
||||
inside: Prism.languages.markup
|
||||
},
|
||||
php: /\{\{\{PHP[0-9]+\}\}\}/
|
||||
});
|
||||
}
|
||||
Prism.languages.python = {
|
||||
'comment': {
|
||||
pattern: /(^|[^\\])#.*/,
|
||||
lookbehind: true
|
||||
},
|
||||
'string': /"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(?:\\?.)*?\1/,
|
||||
'function': {
|
||||
pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_][a-zA-Z0-9_]*(?=\()/g,
|
||||
lookbehind: true
|
||||
},
|
||||
'class-name': {
|
||||
pattern: /(\bclass\s+)[a-z0-9_]+/i,
|
||||
lookbehind: true
|
||||
},
|
||||
'keyword': /\b(?:as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\b/,
|
||||
'boolean': /\b(?:True|False)\b/,
|
||||
'number': /\b-?(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i,
|
||||
'operator': /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/,
|
||||
'punctuation': /[{}[\];(),.:]/
|
||||
};
|
||||
(function (Prism) {
|
||||
Prism.languages.ruby = Prism.languages.extend('clike', {
|
||||
comment: /#(?!\{[^\r\n]*?\}).*/,
|
||||
keyword: /\b(alias|and|BEGIN|begin|break|case|class|def|define_method|defined|do|each|else|elsif|END|end|ensure|false|for|if|in|module|new|next|nil|not|or|raise|redo|require|rescue|retry|return|self|super|then|throw|true|undef|unless|until|when|while|yield)\b/
|
||||
});
|
||||
var interpolation = {
|
||||
pattern: /#\{[^}]+\}/,
|
||||
inside: {
|
||||
delimiter: {
|
||||
pattern: /^#\{|\}$/,
|
||||
alias: 'tag'
|
||||
},
|
||||
rest: Prism.util.clone(Prism.languages.ruby)
|
||||
}
|
||||
};
|
||||
Prism.languages.insertBefore('ruby', 'keyword', {
|
||||
regex: [
|
||||
{
|
||||
pattern: /%r([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1[gim]{0,3}/,
|
||||
inside: { interpolation: interpolation }
|
||||
},
|
||||
{
|
||||
pattern: /%r\((?:[^()\\]|\\[\s\S])*\)[gim]{0,3}/,
|
||||
inside: { interpolation: interpolation }
|
||||
},
|
||||
{
|
||||
pattern: /%r\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}[gim]{0,3}/,
|
||||
inside: { interpolation: interpolation }
|
||||
},
|
||||
{
|
||||
pattern: /%r\[(?:[^\[\]\\]|\\[\s\S])*\][gim]{0,3}/,
|
||||
inside: { interpolation: interpolation }
|
||||
},
|
||||
{
|
||||
pattern: /%r<(?:[^<>\\]|\\[\s\S])*>[gim]{0,3}/,
|
||||
inside: { interpolation: interpolation }
|
||||
},
|
||||
{
|
||||
pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/,
|
||||
lookbehind: true
|
||||
}
|
||||
],
|
||||
variable: /[@$]+[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/,
|
||||
symbol: /:[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/
|
||||
});
|
||||
Prism.languages.insertBefore('ruby', 'number', {
|
||||
builtin: /\b(Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Stat|File|Fixnum|Fload|Hash|Integer|IO|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|String|Struct|TMS|Symbol|ThreadGroup|Thread|Time|TrueClass)\b/,
|
||||
constant: /\b[A-Z][a-zA-Z_0-9]*(?:[?!]|\b)/
|
||||
});
|
||||
Prism.languages.ruby.string = [
|
||||
{
|
||||
pattern: /%[qQiIwWxs]?([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1/,
|
||||
inside: { interpolation: interpolation }
|
||||
},
|
||||
{
|
||||
pattern: /%[qQiIwWxs]?\((?:[^()\\]|\\[\s\S])*\)/,
|
||||
inside: { interpolation: interpolation }
|
||||
},
|
||||
{
|
||||
pattern: /%[qQiIwWxs]?\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}/,
|
||||
inside: { interpolation: interpolation }
|
||||
},
|
||||
{
|
||||
pattern: /%[qQiIwWxs]?\[(?:[^\[\]\\]|\\[\s\S])*\]/,
|
||||
inside: { interpolation: interpolation }
|
||||
},
|
||||
{
|
||||
pattern: /%[qQiIwWxs]?<(?:[^<>\\]|\\[\s\S])*>/,
|
||||
inside: { interpolation: interpolation }
|
||||
},
|
||||
{
|
||||
pattern: /("|')(#\{[^}]+\}|\\(?:\r?\n|\r)|\\?.)*?\1/,
|
||||
inside: { interpolation: interpolation }
|
||||
}
|
||||
];
|
||||
}(Prism));
|
||||
|
||||
function isCodeSample(elm) {
|
||||
return elm && elm.nodeName === 'PRE' && elm.className.indexOf('language-') !== -1;
|
||||
}
|
||||
function trimArg(predicateFn) {
|
||||
return function (arg1, arg2) {
|
||||
return predicateFn(arg2);
|
||||
};
|
||||
}
|
||||
var $_btvhviagjkmcdujm = {
|
||||
isCodeSample: isCodeSample,
|
||||
trimArg: trimArg
|
||||
};
|
||||
|
||||
var getSelectedCodeSample = function (editor) {
|
||||
var node = editor.selection.getNode();
|
||||
if ($_btvhviagjkmcdujm.isCodeSample(node)) {
|
||||
return node;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
var insertCodeSample = function (editor, language, code) {
|
||||
editor.undoManager.transact(function () {
|
||||
var node = getSelectedCodeSample(editor);
|
||||
code = global$1.DOM.encode(code);
|
||||
if (node) {
|
||||
editor.dom.setAttrib(node, 'class', 'language-' + language);
|
||||
node.innerHTML = code;
|
||||
Prism.highlightElement(node);
|
||||
editor.selection.select(node);
|
||||
} else {
|
||||
editor.insertContent('<pre id="__new" class="language-' + language + '">' + code + '</pre>');
|
||||
editor.selection.select(editor.$('#__new').removeAttr('id')[0]);
|
||||
}
|
||||
});
|
||||
};
|
||||
var getCurrentCode = function (editor) {
|
||||
var node = getSelectedCodeSample(editor);
|
||||
if (node) {
|
||||
return node.textContent;
|
||||
}
|
||||
return '';
|
||||
};
|
||||
var $_6vo0q2adjkmcduie = {
|
||||
getSelectedCodeSample: getSelectedCodeSample,
|
||||
insertCodeSample: insertCodeSample,
|
||||
getCurrentCode: getCurrentCode
|
||||
};
|
||||
|
||||
var getLanguages$1 = function (editor) {
|
||||
var defaultLanguages = [
|
||||
{
|
||||
text: 'HTML/XML',
|
||||
value: 'markup'
|
||||
},
|
||||
{
|
||||
text: 'JavaScript',
|
||||
value: 'javascript'
|
||||
},
|
||||
{
|
||||
text: 'CSS',
|
||||
value: 'css'
|
||||
},
|
||||
{
|
||||
text: 'PHP',
|
||||
value: 'php'
|
||||
},
|
||||
{
|
||||
text: 'Ruby',
|
||||
value: 'ruby'
|
||||
},
|
||||
{
|
||||
text: 'Python',
|
||||
value: 'python'
|
||||
},
|
||||
{
|
||||
text: 'Java',
|
||||
value: 'java'
|
||||
},
|
||||
{
|
||||
text: 'C',
|
||||
value: 'c'
|
||||
},
|
||||
{
|
||||
text: 'C#',
|
||||
value: 'csharp'
|
||||
},
|
||||
{
|
||||
text: 'C++',
|
||||
value: 'cpp'
|
||||
}
|
||||
];
|
||||
var customLanguages = $_7mx4fhabjkmcduic.getLanguages(editor);
|
||||
return customLanguages ? customLanguages : defaultLanguages;
|
||||
};
|
||||
var getCurrentLanguage = function (editor) {
|
||||
var matches;
|
||||
var node = $_6vo0q2adjkmcduie.getSelectedCodeSample(editor);
|
||||
if (node) {
|
||||
matches = node.className.match(/language-(\w+)/);
|
||||
return matches ? matches[1] : '';
|
||||
}
|
||||
return '';
|
||||
};
|
||||
var $_ekmkszahjkmcdujo = {
|
||||
getLanguages: getLanguages$1,
|
||||
getCurrentLanguage: getCurrentLanguage
|
||||
};
|
||||
|
||||
var $_kizlnaajkmcduib = {
|
||||
open: function (editor) {
|
||||
var minWidth = $_7mx4fhabjkmcduic.getDialogMinWidth(editor);
|
||||
var minHeight = $_7mx4fhabjkmcduic.getDialogMinHeight(editor);
|
||||
var currentLanguage = $_ekmkszahjkmcdujo.getCurrentLanguage(editor);
|
||||
var currentLanguages = $_ekmkszahjkmcdujo.getLanguages(editor);
|
||||
var currentCode = $_6vo0q2adjkmcduie.getCurrentCode(editor);
|
||||
editor.windowManager.open({
|
||||
title: 'Insert/Edit code sample',
|
||||
minWidth: minWidth,
|
||||
minHeight: minHeight,
|
||||
layout: 'flex',
|
||||
direction: 'column',
|
||||
align: 'stretch',
|
||||
body: [
|
||||
{
|
||||
type: 'listbox',
|
||||
name: 'language',
|
||||
label: 'Language',
|
||||
maxWidth: 200,
|
||||
value: currentLanguage,
|
||||
values: currentLanguages
|
||||
},
|
||||
{
|
||||
type: 'textbox',
|
||||
name: 'code',
|
||||
multiline: true,
|
||||
spellcheck: false,
|
||||
ariaLabel: 'Code view',
|
||||
flex: 1,
|
||||
style: 'direction: ltr; text-align: left',
|
||||
classes: 'monospace',
|
||||
value: currentCode,
|
||||
autofocus: true
|
||||
}
|
||||
],
|
||||
onSubmit: function (e) {
|
||||
$_6vo0q2adjkmcduie.insertCodeSample(editor, e.data.language, e.data.code);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('codesample', function () {
|
||||
var node = editor.selection.getNode();
|
||||
if (editor.selection.isCollapsed() || $_btvhviagjkmcdujm.isCodeSample(node)) {
|
||||
$_kizlnaajkmcduib.open(editor);
|
||||
} else {
|
||||
editor.formatter.toggle('code');
|
||||
}
|
||||
});
|
||||
};
|
||||
var $_6eu9r6a9jkmcduia = { register: register };
|
||||
|
||||
var setup = function (editor) {
|
||||
var $ = editor.$;
|
||||
editor.on('PreProcess', function (e) {
|
||||
$('pre[contenteditable=false]', e.node).filter($_btvhviagjkmcdujm.trimArg($_btvhviagjkmcdujm.isCodeSample)).each(function (idx, elm) {
|
||||
var $elm = $(elm), code = elm.textContent;
|
||||
$elm.attr('class', $.trim($elm.attr('class')));
|
||||
$elm.removeAttr('contentEditable');
|
||||
$elm.empty().append($('<code></code>').each(function () {
|
||||
this.textContent = code;
|
||||
}));
|
||||
});
|
||||
});
|
||||
editor.on('SetContent', function () {
|
||||
var unprocessedCodeSamples = $('pre').filter($_btvhviagjkmcdujm.trimArg($_btvhviagjkmcdujm.isCodeSample)).filter(function (idx, elm) {
|
||||
return elm.contentEditable !== 'false';
|
||||
});
|
||||
if (unprocessedCodeSamples.length) {
|
||||
editor.undoManager.transact(function () {
|
||||
unprocessedCodeSamples.each(function (idx, elm) {
|
||||
$(elm).find('br').each(function (idx, elm) {
|
||||
elm.parentNode.replaceChild(editor.getDoc().createTextNode('\n'), elm);
|
||||
});
|
||||
elm.contentEditable = false;
|
||||
elm.innerHTML = editor.dom.encode(elm.textContent);
|
||||
Prism.highlightElement(elm);
|
||||
elm.className = $.trim(elm.className);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
var $_euf5mqaijkmcdujp = { setup: setup };
|
||||
|
||||
var loadCss = function (editor, pluginUrl, addedInlineCss, addedCss) {
|
||||
var linkElm;
|
||||
var contentCss = $_7mx4fhabjkmcduic.getContentCss(editor);
|
||||
if (editor.inline && addedInlineCss.get()) {
|
||||
return;
|
||||
}
|
||||
if (!editor.inline && addedCss.get()) {
|
||||
return;
|
||||
}
|
||||
if (editor.inline) {
|
||||
addedInlineCss.set(true);
|
||||
} else {
|
||||
addedCss.set(true);
|
||||
}
|
||||
if (contentCss !== false) {
|
||||
linkElm = editor.dom.create('link', {
|
||||
rel: 'stylesheet',
|
||||
href: contentCss ? contentCss : pluginUrl + '/css/prism.css'
|
||||
});
|
||||
editor.getDoc().getElementsByTagName('head')[0].appendChild(linkElm);
|
||||
}
|
||||
};
|
||||
var $_4zcu6aajjkmcdujr = { loadCss: loadCss };
|
||||
|
||||
var register$1 = function (editor) {
|
||||
editor.addButton('codesample', {
|
||||
cmd: 'codesample',
|
||||
title: 'Insert/Edit code sample'
|
||||
});
|
||||
editor.addMenuItem('codesample', {
|
||||
cmd: 'codesample',
|
||||
text: 'Code sample',
|
||||
icon: 'codesample'
|
||||
});
|
||||
};
|
||||
var $_crosmaakjkmcdujs = { register: register$1 };
|
||||
|
||||
var addedInlineCss = Cell(false);
|
||||
global.add('codesample', function (editor, pluginUrl) {
|
||||
var addedCss = Cell(false);
|
||||
$_euf5mqaijkmcdujp.setup(editor);
|
||||
$_crosmaakjkmcdujs.register(editor);
|
||||
$_6eu9r6a9jkmcduia.register(editor);
|
||||
editor.on('init', function () {
|
||||
$_4zcu6aajjkmcdujr.loadCss(editor, pluginUrl, addedInlineCss, addedCss);
|
||||
});
|
||||
editor.on('dblclick', function (ev) {
|
||||
if ($_btvhviagjkmcdujm.isCodeSample(ev.target)) {
|
||||
$_kizlnaajkmcduib.open(editor);
|
||||
}
|
||||
});
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
||||
@@ -0,0 +1,7 @@
|
||||
// Exports the "colorpicker" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/colorpicker')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/colorpicker'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,126 @@
|
||||
(function () {
|
||||
var colorpicker = (function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Color');
|
||||
|
||||
var showPreview = function (win, hexColor) {
|
||||
win.find('#preview')[0].getEl().style.background = hexColor;
|
||||
};
|
||||
var setColor = function (win, value) {
|
||||
var color = global$1(value), rgb = color.toRgb();
|
||||
win.fromJSON({
|
||||
r: rgb.r,
|
||||
g: rgb.g,
|
||||
b: rgb.b,
|
||||
hex: color.toHex().substr(1)
|
||||
});
|
||||
showPreview(win, color.toHex());
|
||||
};
|
||||
var open = function (editor, callback, value) {
|
||||
var win = editor.windowManager.open({
|
||||
title: 'Color',
|
||||
items: {
|
||||
type: 'container',
|
||||
layout: 'flex',
|
||||
direction: 'row',
|
||||
align: 'stretch',
|
||||
padding: 5,
|
||||
spacing: 10,
|
||||
items: [
|
||||
{
|
||||
type: 'colorpicker',
|
||||
value: value,
|
||||
onchange: function () {
|
||||
var rgb = this.rgb();
|
||||
if (win) {
|
||||
win.find('#r').value(rgb.r);
|
||||
win.find('#g').value(rgb.g);
|
||||
win.find('#b').value(rgb.b);
|
||||
win.find('#hex').value(this.value().substr(1));
|
||||
showPreview(win, this.value());
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'form',
|
||||
padding: 0,
|
||||
labelGap: 5,
|
||||
defaults: {
|
||||
type: 'textbox',
|
||||
size: 7,
|
||||
value: '0',
|
||||
flex: 1,
|
||||
spellcheck: false,
|
||||
onchange: function () {
|
||||
var colorPickerCtrl = win.find('colorpicker')[0];
|
||||
var name, value;
|
||||
name = this.name();
|
||||
value = this.value();
|
||||
if (name === 'hex') {
|
||||
value = '#' + value;
|
||||
setColor(win, value);
|
||||
colorPickerCtrl.value(value);
|
||||
return;
|
||||
}
|
||||
value = {
|
||||
r: win.find('#r').value(),
|
||||
g: win.find('#g').value(),
|
||||
b: win.find('#b').value()
|
||||
};
|
||||
colorPickerCtrl.value(value);
|
||||
setColor(win, value);
|
||||
}
|
||||
},
|
||||
items: [
|
||||
{
|
||||
name: 'r',
|
||||
label: 'R',
|
||||
autofocus: 1
|
||||
},
|
||||
{
|
||||
name: 'g',
|
||||
label: 'G'
|
||||
},
|
||||
{
|
||||
name: 'b',
|
||||
label: 'B'
|
||||
},
|
||||
{
|
||||
name: 'hex',
|
||||
label: '#',
|
||||
value: '000000'
|
||||
},
|
||||
{
|
||||
name: 'preview',
|
||||
type: 'container',
|
||||
border: 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
onSubmit: function () {
|
||||
callback('#' + win.toJSON().hex);
|
||||
}
|
||||
});
|
||||
setColor(win, value);
|
||||
};
|
||||
var $_ghxddkanjkmcdul4 = { open: open };
|
||||
|
||||
global.add('colorpicker', function (editor) {
|
||||
if (!editor.settings.color_picker_callback) {
|
||||
editor.settings.color_picker_callback = function (callback, value) {
|
||||
$_ghxddkanjkmcdul4.open(editor, callback, value);
|
||||
};
|
||||
}
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
||||
@@ -0,0 +1 @@
|
||||
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),l=tinymce.util.Tools.resolve("tinymce.util.Color"),a=function(e,n){e.find("#preview")[0].getEl().style.background=n},o=function(e,n){var i=l(n),t=i.toRgb();e.fromJSON({r:t.r,g:t.g,b:t.b,hex:i.toHex().substr(1)}),a(e,i.toHex())},t=function(e,n,i){var t=e.windowManager.open({title:"Color",items:{type:"container",layout:"flex",direction:"row",align:"stretch",padding:5,spacing:10,items:[{type:"colorpicker",value:i,onchange:function(){var e=this.rgb();t&&(t.find("#r").value(e.r),t.find("#g").value(e.g),t.find("#b").value(e.b),t.find("#hex").value(this.value().substr(1)),a(t,this.value()))}},{type:"form",padding:0,labelGap:5,defaults:{type:"textbox",size:7,value:"0",flex:1,spellcheck:!1,onchange:function(){var e,n,i=t.find("colorpicker")[0];if(e=this.name(),n=this.value(),"hex"===e)return o(t,n="#"+n),void i.value(n);n={r:t.find("#r").value(),g:t.find("#g").value(),b:t.find("#b").value()},i.value(n),o(t,n)}},items:[{name:"r",label:"R",autofocus:1},{name:"g",label:"G"},{name:"b",label:"B"},{name:"hex",label:"#",value:"000000"},{name:"preview",type:"container",border:1}]}]},onSubmit:function(){n("#"+t.toJSON().hex)}});o(t,i)};e.add("colorpicker",function(i){i.settings.color_picker_callback||(i.settings.color_picker_callback=function(e,n){t(i,e,n)})})}();
|
||||
@@ -0,0 +1,7 @@
|
||||
// Exports the "contextmenu" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/contextmenu')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/contextmenu'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,168 @@
|
||||
(function () {
|
||||
var contextmenu = (function () {
|
||||
'use strict';
|
||||
|
||||
var Cell = function (initial) {
|
||||
var value = initial;
|
||||
var get = function () {
|
||||
return value;
|
||||
};
|
||||
var set = function (v) {
|
||||
value = v;
|
||||
};
|
||||
var clone = function () {
|
||||
return Cell(get());
|
||||
};
|
||||
return {
|
||||
get: get,
|
||||
set: set,
|
||||
clone: clone
|
||||
};
|
||||
};
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var get = function (visibleState) {
|
||||
var isContextMenuVisible = function () {
|
||||
return visibleState.get();
|
||||
};
|
||||
return { isContextMenuVisible: isContextMenuVisible };
|
||||
};
|
||||
var $_380q6yasjkmcduln = { get: get };
|
||||
|
||||
var shouldNeverUseNative = function (editor) {
|
||||
return editor.settings.contextmenu_never_use_native;
|
||||
};
|
||||
var getContextMenu = function (editor) {
|
||||
return editor.getParam('contextmenu', 'link openlink image inserttable | cell row column deletetable');
|
||||
};
|
||||
var $_eirsgjaujkmcdulp = {
|
||||
shouldNeverUseNative: shouldNeverUseNative,
|
||||
getContextMenu: getContextMenu
|
||||
};
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
|
||||
|
||||
var getUiContainer = function (editor) {
|
||||
return global$1.DOM.select(editor.settings.ui_container)[0];
|
||||
};
|
||||
|
||||
var nu = function (x, y) {
|
||||
return {
|
||||
x: x,
|
||||
y: y
|
||||
};
|
||||
};
|
||||
var transpose = function (pos, dx, dy) {
|
||||
return nu(pos.x + dx, pos.y + dy);
|
||||
};
|
||||
var fromPageXY = function (e) {
|
||||
return nu(e.pageX, e.pageY);
|
||||
};
|
||||
var fromClientXY = function (e) {
|
||||
return nu(e.clientX, e.clientY);
|
||||
};
|
||||
var transposeUiContainer = function (element, pos) {
|
||||
if (element && global$1.DOM.getStyle(element, 'position', true) !== 'static') {
|
||||
var containerPos = global$1.DOM.getPos(element);
|
||||
var dx = containerPos.x - element.scrollLeft;
|
||||
var dy = containerPos.y - element.scrollTop;
|
||||
return transpose(pos, -dx, -dy);
|
||||
} else {
|
||||
return transpose(pos, 0, 0);
|
||||
}
|
||||
};
|
||||
var transposeContentAreaContainer = function (element, pos) {
|
||||
var containerPos = global$1.DOM.getPos(element);
|
||||
return transpose(pos, containerPos.x, containerPos.y);
|
||||
};
|
||||
var getPos = function (editor, e) {
|
||||
if (editor.inline) {
|
||||
return transposeUiContainer(getUiContainer(editor), fromPageXY(e));
|
||||
} else {
|
||||
var iframePos = transposeContentAreaContainer(editor.getContentAreaContainer(), fromClientXY(e));
|
||||
return transposeUiContainer(getUiContainer(editor), iframePos);
|
||||
}
|
||||
};
|
||||
var $_fqpbdravjkmcdulr = { getPos: getPos };
|
||||
|
||||
var global$2 = tinymce.util.Tools.resolve('tinymce.ui.Factory');
|
||||
|
||||
var global$3 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var renderMenu = function (editor, visibleState) {
|
||||
var menu, contextmenu;
|
||||
var items = [];
|
||||
contextmenu = $_eirsgjaujkmcdulp.getContextMenu(editor);
|
||||
global$3.each(contextmenu.split(/[ ,]/), function (name) {
|
||||
var item = editor.menuItems[name];
|
||||
if (name === '|') {
|
||||
item = { text: name };
|
||||
}
|
||||
if (item) {
|
||||
item.shortcut = '';
|
||||
items.push(item);
|
||||
}
|
||||
});
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
if (items[i].text === '|') {
|
||||
if (i === 0 || i === items.length - 1) {
|
||||
items.splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
menu = global$2.create('menu', {
|
||||
items: items,
|
||||
context: 'contextmenu',
|
||||
classes: 'contextmenu'
|
||||
});
|
||||
menu.uiContainer = getUiContainer(editor);
|
||||
menu.renderTo(getUiContainer(editor));
|
||||
menu.on('hide', function (e) {
|
||||
if (e.control === this) {
|
||||
visibleState.set(false);
|
||||
}
|
||||
});
|
||||
editor.on('remove', function () {
|
||||
menu.remove();
|
||||
menu = null;
|
||||
});
|
||||
return menu;
|
||||
};
|
||||
var show = function (editor, pos, visibleState, menu) {
|
||||
if (menu.get() === null) {
|
||||
menu.set(renderMenu(editor, visibleState));
|
||||
} else {
|
||||
menu.get().show();
|
||||
}
|
||||
menu.get().moveTo(pos.x, pos.y);
|
||||
visibleState.set(true);
|
||||
};
|
||||
var $_19iftqayjkmcdulv = { show: show };
|
||||
|
||||
var isNativeOverrideKeyEvent = function (editor, e) {
|
||||
return e.ctrlKey && !$_eirsgjaujkmcdulp.shouldNeverUseNative(editor);
|
||||
};
|
||||
var setup = function (editor, visibleState, menu) {
|
||||
editor.on('contextmenu', function (e) {
|
||||
if (isNativeOverrideKeyEvent(editor, e)) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
$_19iftqayjkmcdulv.show(editor, $_fqpbdravjkmcdulr.getPos(editor, e), visibleState, menu);
|
||||
});
|
||||
};
|
||||
var $_ac9f3patjkmcdulo = { setup: setup };
|
||||
|
||||
global.add('contextmenu', function (editor) {
|
||||
var menu = Cell(null), visibleState = Cell(false);
|
||||
$_ac9f3patjkmcdulo.setup(editor, visibleState, menu);
|
||||
return $_380q6yasjkmcduln.get(visibleState);
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
||||
@@ -0,0 +1 @@
|
||||
!function(){"use strict";var o=function(t){var n=t,e=function(){return n};return{get:e,set:function(t){n=t},clone:function(){return o(e())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),i=function(t){return{isContextMenuVisible:function(){return t.get()}}},r=function(t){return t.settings.contextmenu_never_use_native},u=function(t){return t.getParam("contextmenu","link openlink image inserttable | cell row column deletetable")},l=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),s=function(t){return l.DOM.select(t.settings.ui_container)[0]},a=function(t,n){return{x:t,y:n}},f=function(t,n,e){return a(t.x+n,t.y+e)},m=function(t,n){if(t&&"static"!==l.DOM.getStyle(t,"position",!0)){var e=l.DOM.getPos(t),o=e.x-t.scrollLeft,i=e.y-t.scrollTop;return f(n,-o,-i)}return f(n,0,0)},c=function(t,n){if(t.inline)return m(s(t),a((u=n).pageX,u.pageY));var e,o,i,r,u,c=(e=t.getContentAreaContainer(),o=a((r=n).clientX,r.clientY),i=l.DOM.getPos(e),f(o,i.x,i.y));return m(s(t),c)},g=tinymce.util.Tools.resolve("tinymce.ui.Factory"),v=tinymce.util.Tools.resolve("tinymce.util.Tools"),y=function(t,n,e,o){null===o.get()?o.set(function(e,n){var t,o,i=[];o=u(e),v.each(o.split(/[ ,]/),function(t){var n=e.menuItems[t];"|"===t&&(n={text:t}),n&&(n.shortcut="",i.push(n))});for(var r=0;r<i.length;r++)"|"===i[r].text&&(0!==r&&r!==i.length-1||i.splice(r,1));return(t=g.create("menu",{items:i,context:"contextmenu",classes:"contextmenu"})).uiContainer=s(e),t.renderTo(s(e)),t.on("hide",function(t){t.control===this&&n.set(!1)}),e.on("remove",function(){t.remove(),t=null}),t}(t,e)):o.get().show(),o.get().moveTo(n.x,n.y),e.set(!0)},x=function(e,o,i){e.on("contextmenu",function(t){var n;n=e,(!t.ctrlKey||r(n))&&(t.preventDefault(),y(e,c(e,t),o,i))})};t.add("contextmenu",function(t){var n=o(null),e=o(!1);return x(t,e,n),i(e)})}();
|
||||
@@ -0,0 +1,7 @@
|
||||
// Exports the "directionality" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/directionality')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/directionality'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,66 @@
|
||||
(function () {
|
||||
var directionality = (function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var setDir = function (editor, dir) {
|
||||
var dom = editor.dom;
|
||||
var curDir;
|
||||
var blocks = editor.selection.getSelectedBlocks();
|
||||
if (blocks.length) {
|
||||
curDir = dom.getAttrib(blocks[0], 'dir');
|
||||
global$1.each(blocks, function (block) {
|
||||
if (!dom.getParent(block.parentNode, '*[dir="' + dir + '"]', dom.getRoot())) {
|
||||
dom.setAttrib(block, 'dir', curDir !== dir ? dir : null);
|
||||
}
|
||||
});
|
||||
editor.nodeChanged();
|
||||
}
|
||||
};
|
||||
var $_8ymyuhb4jkmcdumc = { setDir: setDir };
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('mceDirectionLTR', function () {
|
||||
$_8ymyuhb4jkmcdumc.setDir(editor, 'ltr');
|
||||
});
|
||||
editor.addCommand('mceDirectionRTL', function () {
|
||||
$_8ymyuhb4jkmcdumc.setDir(editor, 'rtl');
|
||||
});
|
||||
};
|
||||
var $_vmfeb3jkmcdumb = { register: register };
|
||||
|
||||
var generateSelector = function (dir) {
|
||||
var selector = [];
|
||||
global$1.each('h1 h2 h3 h4 h5 h6 div p'.split(' '), function (name) {
|
||||
selector.push(name + '[dir=' + dir + ']');
|
||||
});
|
||||
return selector.join(',');
|
||||
};
|
||||
var register$1 = function (editor) {
|
||||
editor.addButton('ltr', {
|
||||
title: 'Left to right',
|
||||
cmd: 'mceDirectionLTR',
|
||||
stateSelector: generateSelector('ltr')
|
||||
});
|
||||
editor.addButton('rtl', {
|
||||
title: 'Right to left',
|
||||
cmd: 'mceDirectionRTL',
|
||||
stateSelector: generateSelector('rtl')
|
||||
});
|
||||
};
|
||||
var $_bkkg12b6jkmcdumf = { register: register$1 };
|
||||
|
||||
global.add('directionality', function (editor) {
|
||||
$_vmfeb3jkmcdumb.register(editor);
|
||||
$_bkkg12b6jkmcdumf.register(editor);
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
||||
@@ -0,0 +1 @@
|
||||
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),c=tinymce.util.Tools.resolve("tinymce.util.Tools"),e=function(t,e){var i,n=t.dom,o=t.selection.getSelectedBlocks();o.length&&(i=n.getAttrib(o[0],"dir"),c.each(o,function(t){n.getParent(t.parentNode,'*[dir="'+e+'"]',n.getRoot())||n.setAttrib(t,"dir",i!==e?e:null)}),t.nodeChanged())},i=function(t){t.addCommand("mceDirectionLTR",function(){e(t,"ltr")}),t.addCommand("mceDirectionRTL",function(){e(t,"rtl")})},n=function(e){var i=[];return c.each("h1 h2 h3 h4 h5 h6 div p".split(" "),function(t){i.push(t+"[dir="+e+"]")}),i.join(",")},o=function(t){t.addButton("ltr",{title:"Left to right",cmd:"mceDirectionLTR",stateSelector:n("ltr")}),t.addButton("rtl",{title:"Right to left",cmd:"mceDirectionRTL",stateSelector:n("rtl")})};t.add("directionality",function(t){i(t),o(t)})}();
|
||||
|
After Width: | Height: | Size: 354 B |
|
After Width: | Height: | Size: 329 B |
|
After Width: | Height: | Size: 331 B |
|
After Width: | Height: | Size: 342 B |
|
After Width: | Height: | Size: 340 B |
|
After Width: | Height: | Size: 336 B |
|
After Width: | Height: | Size: 338 B |
|
After Width: | Height: | Size: 343 B |
|
After Width: | Height: | Size: 321 B |
|
After Width: | Height: | Size: 323 B |
|
After Width: | Height: | Size: 344 B |
|
After Width: | Height: | Size: 338 B |
|
After Width: | Height: | Size: 328 B |
|
After Width: | Height: | Size: 337 B |
|
After Width: | Height: | Size: 350 B |
|
After Width: | Height: | Size: 336 B |
@@ -0,0 +1,7 @@
|
||||
// Exports the "emoticons" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/emoticons')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/emoticons'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,87 @@
|
||||
(function () {
|
||||
var emoticons = (function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var emoticons = [
|
||||
[
|
||||
'cool',
|
||||
'cry',
|
||||
'embarassed',
|
||||
'foot-in-mouth'
|
||||
],
|
||||
[
|
||||
'frown',
|
||||
'innocent',
|
||||
'kiss',
|
||||
'laughing'
|
||||
],
|
||||
[
|
||||
'money-mouth',
|
||||
'sealed',
|
||||
'smile',
|
||||
'surprised'
|
||||
],
|
||||
[
|
||||
'tongue-out',
|
||||
'undecided',
|
||||
'wink',
|
||||
'yell'
|
||||
]
|
||||
];
|
||||
var getHtml = function (pluginUrl) {
|
||||
var emoticonsHtml;
|
||||
emoticonsHtml = '<table role="list" class="mce-grid">';
|
||||
global$1.each(emoticons, function (row) {
|
||||
emoticonsHtml += '<tr>';
|
||||
global$1.each(row, function (icon) {
|
||||
var emoticonUrl = pluginUrl + '/img/smiley-' + icon + '.gif';
|
||||
emoticonsHtml += '<td><a href="#" data-mce-url="' + emoticonUrl + '" data-mce-alt="' + icon + '" tabindex="-1" ' + 'role="option" aria-label="' + icon + '"><img src="' + emoticonUrl + '" style="width: 18px; height: 18px" role="presentation" /></a></td>';
|
||||
});
|
||||
emoticonsHtml += '</tr>';
|
||||
});
|
||||
emoticonsHtml += '</table>';
|
||||
return emoticonsHtml;
|
||||
};
|
||||
var $_bga4i6bajkmcdumt = { getHtml: getHtml };
|
||||
|
||||
var insertEmoticon = function (editor, src, alt) {
|
||||
editor.insertContent(editor.dom.createHTML('img', {
|
||||
src: src,
|
||||
alt: alt
|
||||
}));
|
||||
};
|
||||
var register = function (editor, pluginUrl) {
|
||||
var panelHtml = $_bga4i6bajkmcdumt.getHtml(pluginUrl);
|
||||
editor.addButton('emoticons', {
|
||||
type: 'panelbutton',
|
||||
panel: {
|
||||
role: 'application',
|
||||
autohide: true,
|
||||
html: panelHtml,
|
||||
onclick: function (e) {
|
||||
var linkElm = editor.dom.getParent(e.target, 'a');
|
||||
if (linkElm) {
|
||||
insertEmoticon(editor, linkElm.getAttribute('data-mce-url'), linkElm.getAttribute('data-mce-alt'));
|
||||
this.hide();
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: 'Emoticons'
|
||||
});
|
||||
};
|
||||
var $_dc90osb9jkmcdump = { register: register };
|
||||
|
||||
global.add('emoticons', function (editor, pluginUrl) {
|
||||
$_dc90osb9jkmcdump.register(editor, pluginUrl);
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
||||
@@ -0,0 +1 @@
|
||||
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=tinymce.util.Tools.resolve("tinymce.util.Tools"),n=[["cool","cry","embarassed","foot-in-mouth"],["frown","innocent","kiss","laughing"],["money-mouth","sealed","smile","surprised"],["tongue-out","undecided","wink","yell"]],i=function(i){var o;return o='<table role="list" class="mce-grid">',e.each(n,function(t){o+="<tr>",e.each(t,function(t){var e=i+"/img/smiley-"+t+".gif";o+='<td><a href="#" data-mce-url="'+e+'" data-mce-alt="'+t+'" tabindex="-1" role="option" aria-label="'+t+'"><img src="'+e+'" style="width: 18px; height: 18px" role="presentation" /></a></td>'}),o+="</tr>"}),o+="</table>"},o=function(a,t){var e=i(t);a.addButton("emoticons",{type:"panelbutton",panel:{role:"application",autohide:!0,html:e,onclick:function(t){var e,i,o,n=a.dom.getParent(t.target,"a");n&&(e=a,i=n.getAttribute("data-mce-url"),o=n.getAttribute("data-mce-alt"),e.insertContent(e.dom.createHTML("img",{src:i,alt:o})),this.hide())}},tooltip:"Emoticons"})};t.add("emoticons",function(t,e){o(t,e)})}();
|
||||
@@ -0,0 +1,7 @@
|
||||
// Exports the "fullpage" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/fullpage')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/fullpage'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,519 @@
|
||||
(function () {
|
||||
var fullpage = (function () {
|
||||
'use strict';
|
||||
|
||||
var Cell = function (initial) {
|
||||
var value = initial;
|
||||
var get = function () {
|
||||
return value;
|
||||
};
|
||||
var set = function (v) {
|
||||
value = v;
|
||||
};
|
||||
var clone = function () {
|
||||
return Cell(get());
|
||||
};
|
||||
return {
|
||||
get: get,
|
||||
set: set,
|
||||
clone: clone
|
||||
};
|
||||
};
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var global$2 = tinymce.util.Tools.resolve('tinymce.html.DomParser');
|
||||
|
||||
var global$3 = tinymce.util.Tools.resolve('tinymce.html.Node');
|
||||
|
||||
var global$4 = tinymce.util.Tools.resolve('tinymce.html.Serializer');
|
||||
|
||||
var shouldHideInSourceView = function (editor) {
|
||||
return editor.getParam('fullpage_hide_in_source_view');
|
||||
};
|
||||
var getDefaultXmlPi = function (editor) {
|
||||
return editor.getParam('fullpage_default_xml_pi');
|
||||
};
|
||||
var getDefaultEncoding = function (editor) {
|
||||
return editor.getParam('fullpage_default_encoding');
|
||||
};
|
||||
var getDefaultFontFamily = function (editor) {
|
||||
return editor.getParam('fullpage_default_font_family');
|
||||
};
|
||||
var getDefaultFontSize = function (editor) {
|
||||
return editor.getParam('fullpage_default_font_size');
|
||||
};
|
||||
var getDefaultTextColor = function (editor) {
|
||||
return editor.getParam('fullpage_default_text_color');
|
||||
};
|
||||
var getDefaultTitle = function (editor) {
|
||||
return editor.getParam('fullpage_default_title');
|
||||
};
|
||||
var getDefaultDocType = function (editor) {
|
||||
return editor.getParam('fullpage_default_doctype', '<!DOCTYPE html>');
|
||||
};
|
||||
var $_9uqi0uc7jkmcduuh = {
|
||||
shouldHideInSourceView: shouldHideInSourceView,
|
||||
getDefaultXmlPi: getDefaultXmlPi,
|
||||
getDefaultEncoding: getDefaultEncoding,
|
||||
getDefaultFontFamily: getDefaultFontFamily,
|
||||
getDefaultFontSize: getDefaultFontSize,
|
||||
getDefaultTextColor: getDefaultTextColor,
|
||||
getDefaultTitle: getDefaultTitle,
|
||||
getDefaultDocType: getDefaultDocType
|
||||
};
|
||||
|
||||
var parseHeader = function (head) {
|
||||
return global$2({
|
||||
validate: false,
|
||||
root_name: '#document'
|
||||
}).parse(head);
|
||||
};
|
||||
var htmlToData = function (editor, head) {
|
||||
var headerFragment = parseHeader(head);
|
||||
var data = {};
|
||||
var elm, matches;
|
||||
function getAttr(elm, name) {
|
||||
var value = elm.attr(name);
|
||||
return value || '';
|
||||
}
|
||||
data.fontface = $_9uqi0uc7jkmcduuh.getDefaultFontFamily(editor);
|
||||
data.fontsize = $_9uqi0uc7jkmcduuh.getDefaultFontSize(editor);
|
||||
elm = headerFragment.firstChild;
|
||||
if (elm.type === 7) {
|
||||
data.xml_pi = true;
|
||||
matches = /encoding="([^"]+)"/.exec(elm.value);
|
||||
if (matches) {
|
||||
data.docencoding = matches[1];
|
||||
}
|
||||
}
|
||||
elm = headerFragment.getAll('#doctype')[0];
|
||||
if (elm) {
|
||||
data.doctype = '<!DOCTYPE' + elm.value + '>';
|
||||
}
|
||||
elm = headerFragment.getAll('title')[0];
|
||||
if (elm && elm.firstChild) {
|
||||
data.title = elm.firstChild.value;
|
||||
}
|
||||
global$1.each(headerFragment.getAll('meta'), function (meta) {
|
||||
var name = meta.attr('name');
|
||||
var httpEquiv = meta.attr('http-equiv');
|
||||
var matches;
|
||||
if (name) {
|
||||
data[name.toLowerCase()] = meta.attr('content');
|
||||
} else if (httpEquiv === 'Content-Type') {
|
||||
matches = /charset\s*=\s*(.*)\s*/gi.exec(meta.attr('content'));
|
||||
if (matches) {
|
||||
data.docencoding = matches[1];
|
||||
}
|
||||
}
|
||||
});
|
||||
elm = headerFragment.getAll('html')[0];
|
||||
if (elm) {
|
||||
data.langcode = getAttr(elm, 'lang') || getAttr(elm, 'xml:lang');
|
||||
}
|
||||
data.stylesheets = [];
|
||||
global$1.each(headerFragment.getAll('link'), function (link) {
|
||||
if (link.attr('rel') === 'stylesheet') {
|
||||
data.stylesheets.push(link.attr('href'));
|
||||
}
|
||||
});
|
||||
elm = headerFragment.getAll('body')[0];
|
||||
if (elm) {
|
||||
data.langdir = getAttr(elm, 'dir');
|
||||
data.style = getAttr(elm, 'style');
|
||||
data.visited_color = getAttr(elm, 'vlink');
|
||||
data.link_color = getAttr(elm, 'link');
|
||||
data.active_color = getAttr(elm, 'alink');
|
||||
}
|
||||
return data;
|
||||
};
|
||||
var dataToHtml = function (editor, data, head) {
|
||||
var headerFragment, headElement, html, elm, value;
|
||||
var dom = editor.dom;
|
||||
function setAttr(elm, name, value) {
|
||||
elm.attr(name, value ? value : undefined);
|
||||
}
|
||||
function addHeadNode(node) {
|
||||
if (headElement.firstChild) {
|
||||
headElement.insert(node, headElement.firstChild);
|
||||
} else {
|
||||
headElement.append(node);
|
||||
}
|
||||
}
|
||||
headerFragment = parseHeader(head);
|
||||
headElement = headerFragment.getAll('head')[0];
|
||||
if (!headElement) {
|
||||
elm = headerFragment.getAll('html')[0];
|
||||
headElement = new global$3('head', 1);
|
||||
if (elm.firstChild) {
|
||||
elm.insert(headElement, elm.firstChild, true);
|
||||
} else {
|
||||
elm.append(headElement);
|
||||
}
|
||||
}
|
||||
elm = headerFragment.firstChild;
|
||||
if (data.xml_pi) {
|
||||
value = 'version="1.0"';
|
||||
if (data.docencoding) {
|
||||
value += ' encoding="' + data.docencoding + '"';
|
||||
}
|
||||
if (elm.type !== 7) {
|
||||
elm = new global$3('xml', 7);
|
||||
headerFragment.insert(elm, headerFragment.firstChild, true);
|
||||
}
|
||||
elm.value = value;
|
||||
} else if (elm && elm.type === 7) {
|
||||
elm.remove();
|
||||
}
|
||||
elm = headerFragment.getAll('#doctype')[0];
|
||||
if (data.doctype) {
|
||||
if (!elm) {
|
||||
elm = new global$3('#doctype', 10);
|
||||
if (data.xml_pi) {
|
||||
headerFragment.insert(elm, headerFragment.firstChild);
|
||||
} else {
|
||||
addHeadNode(elm);
|
||||
}
|
||||
}
|
||||
elm.value = data.doctype.substring(9, data.doctype.length - 1);
|
||||
} else if (elm) {
|
||||
elm.remove();
|
||||
}
|
||||
elm = null;
|
||||
global$1.each(headerFragment.getAll('meta'), function (meta) {
|
||||
if (meta.attr('http-equiv') === 'Content-Type') {
|
||||
elm = meta;
|
||||
}
|
||||
});
|
||||
if (data.docencoding) {
|
||||
if (!elm) {
|
||||
elm = new global$3('meta', 1);
|
||||
elm.attr('http-equiv', 'Content-Type');
|
||||
elm.shortEnded = true;
|
||||
addHeadNode(elm);
|
||||
}
|
||||
elm.attr('content', 'text/html; charset=' + data.docencoding);
|
||||
} else if (elm) {
|
||||
elm.remove();
|
||||
}
|
||||
elm = headerFragment.getAll('title')[0];
|
||||
if (data.title) {
|
||||
if (!elm) {
|
||||
elm = new global$3('title', 1);
|
||||
addHeadNode(elm);
|
||||
} else {
|
||||
elm.empty();
|
||||
}
|
||||
elm.append(new global$3('#text', 3)).value = data.title;
|
||||
} else if (elm) {
|
||||
elm.remove();
|
||||
}
|
||||
global$1.each('keywords,description,author,copyright,robots'.split(','), function (name) {
|
||||
var nodes = headerFragment.getAll('meta');
|
||||
var i, meta;
|
||||
var value = data[name];
|
||||
for (i = 0; i < nodes.length; i++) {
|
||||
meta = nodes[i];
|
||||
if (meta.attr('name') === name) {
|
||||
if (value) {
|
||||
meta.attr('content', value);
|
||||
} else {
|
||||
meta.remove();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (value) {
|
||||
elm = new global$3('meta', 1);
|
||||
elm.attr('name', name);
|
||||
elm.attr('content', value);
|
||||
elm.shortEnded = true;
|
||||
addHeadNode(elm);
|
||||
}
|
||||
});
|
||||
var currentStyleSheetsMap = {};
|
||||
global$1.each(headerFragment.getAll('link'), function (stylesheet) {
|
||||
if (stylesheet.attr('rel') === 'stylesheet') {
|
||||
currentStyleSheetsMap[stylesheet.attr('href')] = stylesheet;
|
||||
}
|
||||
});
|
||||
global$1.each(data.stylesheets, function (stylesheet) {
|
||||
if (!currentStyleSheetsMap[stylesheet]) {
|
||||
elm = new global$3('link', 1);
|
||||
elm.attr({
|
||||
rel: 'stylesheet',
|
||||
text: 'text/css',
|
||||
href: stylesheet
|
||||
});
|
||||
elm.shortEnded = true;
|
||||
addHeadNode(elm);
|
||||
}
|
||||
delete currentStyleSheetsMap[stylesheet];
|
||||
});
|
||||
global$1.each(currentStyleSheetsMap, function (stylesheet) {
|
||||
stylesheet.remove();
|
||||
});
|
||||
elm = headerFragment.getAll('body')[0];
|
||||
if (elm) {
|
||||
setAttr(elm, 'dir', data.langdir);
|
||||
setAttr(elm, 'style', data.style);
|
||||
setAttr(elm, 'vlink', data.visited_color);
|
||||
setAttr(elm, 'link', data.link_color);
|
||||
setAttr(elm, 'alink', data.active_color);
|
||||
dom.setAttribs(editor.getBody(), {
|
||||
style: data.style,
|
||||
dir: data.dir,
|
||||
vLink: data.visited_color,
|
||||
link: data.link_color,
|
||||
aLink: data.active_color
|
||||
});
|
||||
}
|
||||
elm = headerFragment.getAll('html')[0];
|
||||
if (elm) {
|
||||
setAttr(elm, 'lang', data.langcode);
|
||||
setAttr(elm, 'xml:lang', data.langcode);
|
||||
}
|
||||
if (!headElement.firstChild) {
|
||||
headElement.remove();
|
||||
}
|
||||
html = global$4({
|
||||
validate: false,
|
||||
indent: true,
|
||||
apply_source_formatting: true,
|
||||
indent_before: 'head,html,body,meta,title,script,link,style',
|
||||
indent_after: 'head,html,body,meta,title,script,link,style'
|
||||
}).serialize(headerFragment);
|
||||
return html.substring(0, html.indexOf('</body>'));
|
||||
};
|
||||
var $_5iey4vc3jkmcduub = {
|
||||
parseHeader: parseHeader,
|
||||
htmlToData: htmlToData,
|
||||
dataToHtml: dataToHtml
|
||||
};
|
||||
|
||||
var open = function (editor, headState) {
|
||||
var data = $_5iey4vc3jkmcduub.htmlToData(editor, headState.get());
|
||||
editor.windowManager.open({
|
||||
title: 'Document properties',
|
||||
data: data,
|
||||
defaults: {
|
||||
type: 'textbox',
|
||||
size: 40
|
||||
},
|
||||
body: [
|
||||
{
|
||||
name: 'title',
|
||||
label: 'Title'
|
||||
},
|
||||
{
|
||||
name: 'keywords',
|
||||
label: 'Keywords'
|
||||
},
|
||||
{
|
||||
name: 'description',
|
||||
label: 'Description'
|
||||
},
|
||||
{
|
||||
name: 'robots',
|
||||
label: 'Robots'
|
||||
},
|
||||
{
|
||||
name: 'author',
|
||||
label: 'Author'
|
||||
},
|
||||
{
|
||||
name: 'docencoding',
|
||||
label: 'Encoding'
|
||||
}
|
||||
],
|
||||
onSubmit: function (e) {
|
||||
var headHtml = $_5iey4vc3jkmcduub.dataToHtml(editor, global$1.extend(data, e.data), headState.get());
|
||||
headState.set(headHtml);
|
||||
}
|
||||
});
|
||||
};
|
||||
var $_kvluac1jkmcduu9 = { open: open };
|
||||
|
||||
var register = function (editor, headState) {
|
||||
editor.addCommand('mceFullPageProperties', function () {
|
||||
$_kvluac1jkmcduu9.open(editor, headState);
|
||||
});
|
||||
};
|
||||
var $_24h3jic0jkmcduu7 = { register: register };
|
||||
|
||||
var protectHtml = function (protect, html) {
|
||||
global$1.each(protect, function (pattern) {
|
||||
html = html.replace(pattern, function (str) {
|
||||
return '<!--mce:protected ' + escape(str) + '-->';
|
||||
});
|
||||
});
|
||||
return html;
|
||||
};
|
||||
var unprotectHtml = function (html) {
|
||||
return html.replace(/<!--mce:protected ([\s\S]*?)-->/g, function (a, m) {
|
||||
return unescape(m);
|
||||
});
|
||||
};
|
||||
var $_1tsu03c9jkmcduuq = {
|
||||
protectHtml: protectHtml,
|
||||
unprotectHtml: unprotectHtml
|
||||
};
|
||||
|
||||
var each = global$1.each;
|
||||
var low = function (s) {
|
||||
return s.replace(/<\/?[A-Z]+/g, function (a) {
|
||||
return a.toLowerCase();
|
||||
});
|
||||
};
|
||||
var handleSetContent = function (editor, headState, footState, evt) {
|
||||
var startPos, endPos, content, headerFragment, styles = '';
|
||||
var dom = editor.dom;
|
||||
var elm;
|
||||
if (evt.selection) {
|
||||
return;
|
||||
}
|
||||
content = $_1tsu03c9jkmcduuq.protectHtml(editor.settings.protect, evt.content);
|
||||
if (evt.format === 'raw' && headState.get()) {
|
||||
return;
|
||||
}
|
||||
if (evt.source_view && $_9uqi0uc7jkmcduuh.shouldHideInSourceView(editor)) {
|
||||
return;
|
||||
}
|
||||
if (content.length === 0 && !evt.source_view) {
|
||||
content = global$1.trim(headState.get()) + '\n' + global$1.trim(content) + '\n' + global$1.trim(footState.get());
|
||||
}
|
||||
content = content.replace(/<(\/?)BODY/gi, '<$1body');
|
||||
startPos = content.indexOf('<body');
|
||||
if (startPos !== -1) {
|
||||
startPos = content.indexOf('>', startPos);
|
||||
headState.set(low(content.substring(0, startPos + 1)));
|
||||
endPos = content.indexOf('</body', startPos);
|
||||
if (endPos === -1) {
|
||||
endPos = content.length;
|
||||
}
|
||||
evt.content = global$1.trim(content.substring(startPos + 1, endPos));
|
||||
footState.set(low(content.substring(endPos)));
|
||||
} else {
|
||||
headState.set(getDefaultHeader(editor));
|
||||
footState.set('\n</body>\n</html>');
|
||||
}
|
||||
headerFragment = $_5iey4vc3jkmcduub.parseHeader(headState.get());
|
||||
each(headerFragment.getAll('style'), function (node) {
|
||||
if (node.firstChild) {
|
||||
styles += node.firstChild.value;
|
||||
}
|
||||
});
|
||||
elm = headerFragment.getAll('body')[0];
|
||||
if (elm) {
|
||||
dom.setAttribs(editor.getBody(), {
|
||||
style: elm.attr('style') || '',
|
||||
dir: elm.attr('dir') || '',
|
||||
vLink: elm.attr('vlink') || '',
|
||||
link: elm.attr('link') || '',
|
||||
aLink: elm.attr('alink') || ''
|
||||
});
|
||||
}
|
||||
dom.remove('fullpage_styles');
|
||||
var headElm = editor.getDoc().getElementsByTagName('head')[0];
|
||||
if (styles) {
|
||||
dom.add(headElm, 'style', { id: 'fullpage_styles' }, styles);
|
||||
elm = dom.get('fullpage_styles');
|
||||
if (elm.styleSheet) {
|
||||
elm.styleSheet.cssText = styles;
|
||||
}
|
||||
}
|
||||
var currentStyleSheetsMap = {};
|
||||
global$1.each(headElm.getElementsByTagName('link'), function (stylesheet) {
|
||||
if (stylesheet.rel === 'stylesheet' && stylesheet.getAttribute('data-mce-fullpage')) {
|
||||
currentStyleSheetsMap[stylesheet.href] = stylesheet;
|
||||
}
|
||||
});
|
||||
global$1.each(headerFragment.getAll('link'), function (stylesheet) {
|
||||
var href = stylesheet.attr('href');
|
||||
if (!href) {
|
||||
return true;
|
||||
}
|
||||
if (!currentStyleSheetsMap[href] && stylesheet.attr('rel') === 'stylesheet') {
|
||||
dom.add(headElm, 'link', {
|
||||
'rel': 'stylesheet',
|
||||
'text': 'text/css',
|
||||
'href': href,
|
||||
'data-mce-fullpage': '1'
|
||||
});
|
||||
}
|
||||
delete currentStyleSheetsMap[href];
|
||||
});
|
||||
global$1.each(currentStyleSheetsMap, function (stylesheet) {
|
||||
stylesheet.parentNode.removeChild(stylesheet);
|
||||
});
|
||||
};
|
||||
var getDefaultHeader = function (editor) {
|
||||
var header = '', value, styles = '';
|
||||
if ($_9uqi0uc7jkmcduuh.getDefaultXmlPi(editor)) {
|
||||
var piEncoding = $_9uqi0uc7jkmcduuh.getDefaultEncoding(editor);
|
||||
header += '<?xml version="1.0" encoding="' + (piEncoding ? piEncoding : 'ISO-8859-1') + '" ?>\n';
|
||||
}
|
||||
header += $_9uqi0uc7jkmcduuh.getDefaultDocType(editor);
|
||||
header += '\n<html>\n<head>\n';
|
||||
if (value = $_9uqi0uc7jkmcduuh.getDefaultTitle(editor)) {
|
||||
header += '<title>' + value + '</title>\n';
|
||||
}
|
||||
if (value = $_9uqi0uc7jkmcduuh.getDefaultEncoding(editor)) {
|
||||
header += '<meta http-equiv="Content-Type" content="text/html; charset=' + value + '" />\n';
|
||||
}
|
||||
if (value = $_9uqi0uc7jkmcduuh.getDefaultFontFamily(editor)) {
|
||||
styles += 'font-family: ' + value + ';';
|
||||
}
|
||||
if (value = $_9uqi0uc7jkmcduuh.getDefaultFontSize(editor)) {
|
||||
styles += 'font-size: ' + value + ';';
|
||||
}
|
||||
if (value = $_9uqi0uc7jkmcduuh.getDefaultTextColor(editor)) {
|
||||
styles += 'color: ' + value + ';';
|
||||
}
|
||||
header += '</head>\n<body' + (styles ? ' style="' + styles + '"' : '') + '>\n';
|
||||
return header;
|
||||
};
|
||||
var handleGetContent = function (editor, head, foot, evt) {
|
||||
if (!evt.selection && (!evt.source_view || !$_9uqi0uc7jkmcduuh.shouldHideInSourceView(editor))) {
|
||||
evt.content = $_1tsu03c9jkmcduuq.unprotectHtml(global$1.trim(head) + '\n' + global$1.trim(evt.content) + '\n' + global$1.trim(foot));
|
||||
}
|
||||
};
|
||||
var setup = function (editor, headState, footState) {
|
||||
editor.on('BeforeSetContent', function (evt) {
|
||||
handleSetContent(editor, headState, footState, evt);
|
||||
});
|
||||
editor.on('GetContent', function (evt) {
|
||||
handleGetContent(editor, headState.get(), footState.get(), evt);
|
||||
});
|
||||
};
|
||||
var $_5r97gec8jkmcduuk = { setup: setup };
|
||||
|
||||
var register$1 = function (editor) {
|
||||
editor.addButton('fullpage', {
|
||||
title: 'Document properties',
|
||||
cmd: 'mceFullPageProperties'
|
||||
});
|
||||
editor.addMenuItem('fullpage', {
|
||||
text: 'Document properties',
|
||||
cmd: 'mceFullPageProperties',
|
||||
context: 'file'
|
||||
});
|
||||
};
|
||||
var $_aojecpcajkmcduur = { register: register$1 };
|
||||
|
||||
global.add('fullpage', function (editor) {
|
||||
var headState = Cell(''), footState = Cell('');
|
||||
$_24h3jic0jkmcduu7.register(editor, headState);
|
||||
$_aojecpcajkmcduur.register(editor);
|
||||
$_5r97gec8jkmcduuk.setup(editor, headState, footState);
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
||||
@@ -0,0 +1,7 @@
|
||||
// Exports the "fullscreen" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/fullscreen')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/fullscreen'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,177 @@
|
||||
(function () {
|
||||
var fullscreen = (function () {
|
||||
'use strict';
|
||||
|
||||
var Cell = function (initial) {
|
||||
var value = initial;
|
||||
var get = function () {
|
||||
return value;
|
||||
};
|
||||
var set = function (v) {
|
||||
value = v;
|
||||
};
|
||||
var clone = function () {
|
||||
return Cell(get());
|
||||
};
|
||||
return {
|
||||
get: get,
|
||||
set: set,
|
||||
clone: clone
|
||||
};
|
||||
};
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var get = function (fullscreenState) {
|
||||
return {
|
||||
isFullscreen: function () {
|
||||
return fullscreenState.get() !== null;
|
||||
}
|
||||
};
|
||||
};
|
||||
var $_hknf6cejkmcduvl = { get: get };
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
|
||||
|
||||
var fireFullscreenStateChanged = function (editor, state) {
|
||||
editor.fire('FullscreenStateChanged', { state: state });
|
||||
};
|
||||
var $_abs9j5cijkmcduvt = { fireFullscreenStateChanged: fireFullscreenStateChanged };
|
||||
|
||||
var DOM = global$1.DOM;
|
||||
var getWindowSize = function () {
|
||||
var w;
|
||||
var h;
|
||||
var win = window;
|
||||
var doc = document;
|
||||
var body = doc.body;
|
||||
if (body.offsetWidth) {
|
||||
w = body.offsetWidth;
|
||||
h = body.offsetHeight;
|
||||
}
|
||||
if (win.innerWidth && win.innerHeight) {
|
||||
w = win.innerWidth;
|
||||
h = win.innerHeight;
|
||||
}
|
||||
return {
|
||||
w: w,
|
||||
h: h
|
||||
};
|
||||
};
|
||||
var getScrollPos = function () {
|
||||
var vp = DOM.getViewPort();
|
||||
return {
|
||||
x: vp.x,
|
||||
y: vp.y
|
||||
};
|
||||
};
|
||||
var setScrollPos = function (pos) {
|
||||
window.scrollTo(pos.x, pos.y);
|
||||
};
|
||||
var toggleFullscreen = function (editor, fullscreenState) {
|
||||
var body = document.body;
|
||||
var documentElement = document.documentElement;
|
||||
var editorContainerStyle;
|
||||
var editorContainer, iframe, iframeStyle;
|
||||
var fullscreenInfo = fullscreenState.get();
|
||||
var resize = function () {
|
||||
DOM.setStyle(iframe, 'height', getWindowSize().h - (editorContainer.clientHeight - iframe.clientHeight));
|
||||
};
|
||||
var removeResize = function () {
|
||||
DOM.unbind(window, 'resize', resize);
|
||||
};
|
||||
editorContainer = editor.getContainer();
|
||||
editorContainerStyle = editorContainer.style;
|
||||
iframe = editor.getContentAreaContainer().firstChild;
|
||||
iframeStyle = iframe.style;
|
||||
if (!fullscreenInfo) {
|
||||
var newFullScreenInfo = {
|
||||
scrollPos: getScrollPos(),
|
||||
containerWidth: editorContainerStyle.width,
|
||||
containerHeight: editorContainerStyle.height,
|
||||
iframeWidth: iframeStyle.width,
|
||||
iframeHeight: iframeStyle.height,
|
||||
resizeHandler: resize,
|
||||
removeHandler: removeResize
|
||||
};
|
||||
iframeStyle.width = iframeStyle.height = '100%';
|
||||
editorContainerStyle.width = editorContainerStyle.height = '';
|
||||
DOM.addClass(body, 'mce-fullscreen');
|
||||
DOM.addClass(documentElement, 'mce-fullscreen');
|
||||
DOM.addClass(editorContainer, 'mce-fullscreen');
|
||||
DOM.bind(window, 'resize', resize);
|
||||
editor.on('remove', removeResize);
|
||||
resize();
|
||||
fullscreenState.set(newFullScreenInfo);
|
||||
$_abs9j5cijkmcduvt.fireFullscreenStateChanged(editor, true);
|
||||
} else {
|
||||
iframeStyle.width = fullscreenInfo.iframeWidth;
|
||||
iframeStyle.height = fullscreenInfo.iframeHeight;
|
||||
if (fullscreenInfo.containerWidth) {
|
||||
editorContainerStyle.width = fullscreenInfo.containerWidth;
|
||||
}
|
||||
if (fullscreenInfo.containerHeight) {
|
||||
editorContainerStyle.height = fullscreenInfo.containerHeight;
|
||||
}
|
||||
DOM.removeClass(body, 'mce-fullscreen');
|
||||
DOM.removeClass(documentElement, 'mce-fullscreen');
|
||||
DOM.removeClass(editorContainer, 'mce-fullscreen');
|
||||
setScrollPos(fullscreenInfo.scrollPos);
|
||||
DOM.unbind(window, 'resize', fullscreenInfo.resizeHandler);
|
||||
editor.off('remove', fullscreenInfo.removeHandler);
|
||||
fullscreenState.set(null);
|
||||
$_abs9j5cijkmcduvt.fireFullscreenStateChanged(editor, false);
|
||||
}
|
||||
};
|
||||
var $_xg7x8cgjkmcduvo = { toggleFullscreen: toggleFullscreen };
|
||||
|
||||
var register = function (editor, fullscreenState) {
|
||||
editor.addCommand('mceFullScreen', function () {
|
||||
$_xg7x8cgjkmcduvo.toggleFullscreen(editor, fullscreenState);
|
||||
});
|
||||
};
|
||||
var $_6hmlhucfjkmcduvm = { register: register };
|
||||
|
||||
var postRender = function (editor) {
|
||||
return function (e) {
|
||||
var ctrl = e.control;
|
||||
editor.on('FullscreenStateChanged', function (e) {
|
||||
ctrl.active(e.state);
|
||||
});
|
||||
};
|
||||
};
|
||||
var register$1 = function (editor) {
|
||||
editor.addMenuItem('fullscreen', {
|
||||
text: 'Fullscreen',
|
||||
shortcut: 'Ctrl+Shift+F',
|
||||
selectable: true,
|
||||
cmd: 'mceFullScreen',
|
||||
onPostRender: postRender(editor),
|
||||
context: 'view'
|
||||
});
|
||||
editor.addButton('fullscreen', {
|
||||
active: false,
|
||||
tooltip: 'Fullscreen',
|
||||
cmd: 'mceFullScreen',
|
||||
onPostRender: postRender(editor)
|
||||
});
|
||||
};
|
||||
var $_mpkgckjkmcduwa = { register: register$1 };
|
||||
|
||||
global.add('fullscreen', function (editor) {
|
||||
var fullscreenState = Cell(null);
|
||||
if (editor.settings.inline) {
|
||||
return $_hknf6cejkmcduvl.get(fullscreenState);
|
||||
}
|
||||
$_6hmlhucfjkmcduvm.register(editor, fullscreenState);
|
||||
$_mpkgckjkmcduwa.register(editor);
|
||||
editor.addShortcut('Ctrl+Shift+F', '', 'mceFullScreen');
|
||||
return $_hknf6cejkmcduvl.get(fullscreenState);
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
||||
@@ -0,0 +1 @@
|
||||
!function(){"use strict";var i=function(e){var n=e,t=function(){return n};return{get:t,set:function(e){n=e},clone:function(){return i(t())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=function(e){return{isFullscreen:function(){return null!==e.get()}}},n=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),m=function(e,n){e.fire("FullscreenStateChanged",{state:n})},g=n.DOM,r=function(e,n){var t,r,l,i,o,c,s=document.body,u=document.documentElement,d=n.get(),a=function(){var e,n,t,i;g.setStyle(l,"height",(t=window,i=document.body,i.offsetWidth&&(e=i.offsetWidth,n=i.offsetHeight),t.innerWidth&&t.innerHeight&&(e=t.innerWidth,n=t.innerHeight),{w:e,h:n}).h-(r.clientHeight-l.clientHeight))},h=function(){g.unbind(window,"resize",a)};if(t=(r=e.getContainer()).style,i=(l=e.getContentAreaContainer().firstChild).style,d)i.width=d.iframeWidth,i.height=d.iframeHeight,d.containerWidth&&(t.width=d.containerWidth),d.containerHeight&&(t.height=d.containerHeight),g.removeClass(s,"mce-fullscreen"),g.removeClass(u,"mce-fullscreen"),g.removeClass(r,"mce-fullscreen"),o=d.scrollPos,window.scrollTo(o.x,o.y),g.unbind(window,"resize",d.resizeHandler),e.off("remove",d.removeHandler),n.set(null),m(e,!1);else{var f={scrollPos:(c=g.getViewPort(),{x:c.x,y:c.y}),containerWidth:t.width,containerHeight:t.height,iframeWidth:i.width,iframeHeight:i.height,resizeHandler:a,removeHandler:h};i.width=i.height="100%",t.width=t.height="",g.addClass(s,"mce-fullscreen"),g.addClass(u,"mce-fullscreen"),g.addClass(r,"mce-fullscreen"),g.bind(window,"resize",a),e.on("remove",h),a(),n.set(f),m(e,!0)}},l=function(e,n){e.addCommand("mceFullScreen",function(){r(e,n)})},o=function(t){return function(e){var n=e.control;t.on("FullscreenStateChanged",function(e){n.active(e.state)})}},c=function(e){e.addMenuItem("fullscreen",{text:"Fullscreen",shortcut:"Ctrl+Shift+F",selectable:!0,cmd:"mceFullScreen",onPostRender:o(e),context:"view"}),e.addButton("fullscreen",{active:!1,tooltip:"Fullscreen",cmd:"mceFullScreen",onPostRender:o(e)})};e.add("fullscreen",function(e){var n=i(null);return e.settings.inline||(l(e,n),c(e),e.addShortcut("Ctrl+Shift+F","","mceFullScreen")),t(n)})}();
|
||||
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,7 @@
|
||||
// Exports the "help" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/help')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/help'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,727 @@
|
||||
(function () {
|
||||
var help = (function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var constant = function (value) {
|
||||
return function () {
|
||||
return value;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
var curry = function (f) {
|
||||
var x = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
x[_i - 1] = arguments[_i];
|
||||
}
|
||||
var args = new Array(arguments.length - 1);
|
||||
for (var i = 1; i < arguments.length; i++)
|
||||
args[i - 1] = arguments[i];
|
||||
return function () {
|
||||
var x = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
x[_i] = arguments[_i];
|
||||
}
|
||||
var newArgs = new Array(arguments.length);
|
||||
for (var j = 0; j < newArgs.length; j++)
|
||||
newArgs[j] = arguments[j];
|
||||
var all = args.concat(newArgs);
|
||||
return f.apply(null, all);
|
||||
};
|
||||
};
|
||||
var not = function (f) {
|
||||
return function () {
|
||||
var x = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
x[_i] = arguments[_i];
|
||||
}
|
||||
return !f.apply(null, arguments);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
var never = constant(false);
|
||||
var always = constant(true);
|
||||
|
||||
var never$1 = never;
|
||||
var always$1 = always;
|
||||
var none = function () {
|
||||
return NONE;
|
||||
};
|
||||
var NONE = function () {
|
||||
var eq = function (o) {
|
||||
return o.isNone();
|
||||
};
|
||||
var call$$1 = function (thunk) {
|
||||
return thunk();
|
||||
};
|
||||
var id = function (n) {
|
||||
return n;
|
||||
};
|
||||
var noop$$1 = function () {
|
||||
};
|
||||
var nul = function () {
|
||||
return null;
|
||||
};
|
||||
var undef = function () {
|
||||
return undefined;
|
||||
};
|
||||
var me = {
|
||||
fold: function (n, s) {
|
||||
return n();
|
||||
},
|
||||
is: never$1,
|
||||
isSome: never$1,
|
||||
isNone: always$1,
|
||||
getOr: id,
|
||||
getOrThunk: call$$1,
|
||||
getOrDie: function (msg) {
|
||||
throw new Error(msg || 'error: getOrDie called on none.');
|
||||
},
|
||||
getOrNull: nul,
|
||||
getOrUndefined: undef,
|
||||
or: id,
|
||||
orThunk: call$$1,
|
||||
map: none,
|
||||
ap: none,
|
||||
each: noop$$1,
|
||||
bind: none,
|
||||
flatten: none,
|
||||
exists: never$1,
|
||||
forall: always$1,
|
||||
filter: none,
|
||||
equals: eq,
|
||||
equals_: eq,
|
||||
toArray: function () {
|
||||
return [];
|
||||
},
|
||||
toString: constant('none()')
|
||||
};
|
||||
if (Object.freeze)
|
||||
Object.freeze(me);
|
||||
return me;
|
||||
}();
|
||||
var some = function (a) {
|
||||
var constant_a = function () {
|
||||
return a;
|
||||
};
|
||||
var self = function () {
|
||||
return me;
|
||||
};
|
||||
var map = function (f) {
|
||||
return some(f(a));
|
||||
};
|
||||
var bind = function (f) {
|
||||
return f(a);
|
||||
};
|
||||
var me = {
|
||||
fold: function (n, s) {
|
||||
return s(a);
|
||||
},
|
||||
is: function (v) {
|
||||
return a === v;
|
||||
},
|
||||
isSome: always$1,
|
||||
isNone: never$1,
|
||||
getOr: constant_a,
|
||||
getOrThunk: constant_a,
|
||||
getOrDie: constant_a,
|
||||
getOrNull: constant_a,
|
||||
getOrUndefined: constant_a,
|
||||
or: self,
|
||||
orThunk: self,
|
||||
map: map,
|
||||
ap: function (optfab) {
|
||||
return optfab.fold(none, function (fab) {
|
||||
return some(fab(a));
|
||||
});
|
||||
},
|
||||
each: function (f) {
|
||||
f(a);
|
||||
},
|
||||
bind: bind,
|
||||
flatten: constant_a,
|
||||
exists: bind,
|
||||
forall: bind,
|
||||
filter: function (f) {
|
||||
return f(a) ? me : NONE;
|
||||
},
|
||||
equals: function (o) {
|
||||
return o.is(a);
|
||||
},
|
||||
equals_: function (o, elementEq) {
|
||||
return o.fold(never$1, function (b) {
|
||||
return elementEq(a, b);
|
||||
});
|
||||
},
|
||||
toArray: function () {
|
||||
return [a];
|
||||
},
|
||||
toString: function () {
|
||||
return 'some(' + a + ')';
|
||||
}
|
||||
};
|
||||
return me;
|
||||
};
|
||||
var from = function (value) {
|
||||
return value === null || value === undefined ? NONE : some(value);
|
||||
};
|
||||
var Option = {
|
||||
some: some,
|
||||
none: none,
|
||||
from: from
|
||||
};
|
||||
|
||||
var typeOf = function (x) {
|
||||
if (x === null)
|
||||
return 'null';
|
||||
var t = typeof x;
|
||||
if (t === 'object' && Array.prototype.isPrototypeOf(x))
|
||||
return 'array';
|
||||
if (t === 'object' && String.prototype.isPrototypeOf(x))
|
||||
return 'string';
|
||||
return t;
|
||||
};
|
||||
var isType = function (type) {
|
||||
return function (value) {
|
||||
return typeOf(value) === type;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var isFunction = isType('function');
|
||||
|
||||
var rawIndexOf = function () {
|
||||
var pIndexOf = Array.prototype.indexOf;
|
||||
var fastIndex = function (xs, x) {
|
||||
return pIndexOf.call(xs, x);
|
||||
};
|
||||
var slowIndex = function (xs, x) {
|
||||
return slowIndexOf(xs, x);
|
||||
};
|
||||
return pIndexOf === undefined ? slowIndex : fastIndex;
|
||||
}();
|
||||
|
||||
var contains = function (xs, x) {
|
||||
return rawIndexOf(xs, x) > -1;
|
||||
};
|
||||
|
||||
|
||||
|
||||
var map = function (xs, f) {
|
||||
var len = xs.length;
|
||||
var r = new Array(len);
|
||||
for (var i = 0; i < len; i++) {
|
||||
var x = xs[i];
|
||||
r[i] = f(x, i, xs);
|
||||
}
|
||||
return r;
|
||||
};
|
||||
|
||||
|
||||
|
||||
var filter = function (xs, pred) {
|
||||
var r = [];
|
||||
for (var i = 0, len = xs.length; i < len; i++) {
|
||||
var x = xs[i];
|
||||
if (pred(x, i, xs)) {
|
||||
r.push(x);
|
||||
}
|
||||
}
|
||||
return r;
|
||||
};
|
||||
|
||||
|
||||
|
||||
var find = function (xs, pred) {
|
||||
for (var i = 0, len = xs.length; i < len; i++) {
|
||||
var x = xs[i];
|
||||
if (pred(x, i, xs)) {
|
||||
return Option.some(x);
|
||||
}
|
||||
}
|
||||
return Option.none();
|
||||
};
|
||||
|
||||
var slowIndexOf = function (xs, x) {
|
||||
for (var i = 0, len = xs.length; i < len; ++i) {
|
||||
if (xs[i] === x) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var slice = Array.prototype.slice;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var from$1 = isFunction(Array.from) ? Array.from : function (x) {
|
||||
return slice.call(x);
|
||||
};
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.I18n');
|
||||
|
||||
var global$2 = tinymce.util.Tools.resolve('tinymce.Env');
|
||||
|
||||
var meta = global$2.mac ? '\u2318' : 'Ctrl';
|
||||
var access = global$2.mac ? 'Ctrl + Alt' : 'Shift + Alt';
|
||||
var shortcuts = [
|
||||
{
|
||||
shortcut: meta + ' + B',
|
||||
action: 'Bold'
|
||||
},
|
||||
{
|
||||
shortcut: meta + ' + I',
|
||||
action: 'Italic'
|
||||
},
|
||||
{
|
||||
shortcut: meta + ' + U',
|
||||
action: 'Underline'
|
||||
},
|
||||
{
|
||||
shortcut: meta + ' + A',
|
||||
action: 'Select all'
|
||||
},
|
||||
{
|
||||
shortcut: meta + ' + Y or ' + meta + ' + Shift + Z',
|
||||
action: 'Redo'
|
||||
},
|
||||
{
|
||||
shortcut: meta + ' + Z',
|
||||
action: 'Undo'
|
||||
},
|
||||
{
|
||||
shortcut: access + ' + 1',
|
||||
action: 'Header 1'
|
||||
},
|
||||
{
|
||||
shortcut: access + ' + 2',
|
||||
action: 'Header 2'
|
||||
},
|
||||
{
|
||||
shortcut: access + ' + 3',
|
||||
action: 'Header 3'
|
||||
},
|
||||
{
|
||||
shortcut: access + ' + 4',
|
||||
action: 'Header 4'
|
||||
},
|
||||
{
|
||||
shortcut: access + ' + 5',
|
||||
action: 'Header 5'
|
||||
},
|
||||
{
|
||||
shortcut: access + ' + 6',
|
||||
action: 'Header 6'
|
||||
},
|
||||
{
|
||||
shortcut: access + ' + 7',
|
||||
action: 'Paragraph'
|
||||
},
|
||||
{
|
||||
shortcut: access + ' + 8',
|
||||
action: 'Div'
|
||||
},
|
||||
{
|
||||
shortcut: access + ' + 9',
|
||||
action: 'Address'
|
||||
},
|
||||
{
|
||||
shortcut: 'Alt + F9',
|
||||
action: 'Focus to menubar'
|
||||
},
|
||||
{
|
||||
shortcut: 'Alt + F10',
|
||||
action: 'Focus to toolbar'
|
||||
},
|
||||
{
|
||||
shortcut: 'Alt + F11',
|
||||
action: 'Focus to element path'
|
||||
},
|
||||
{
|
||||
shortcut: 'Ctrl + Shift + P > Ctrl + Shift + P',
|
||||
action: 'Focus to contextual toolbar'
|
||||
},
|
||||
{
|
||||
shortcut: meta + ' + K',
|
||||
action: 'Insert link (if link plugin activated)'
|
||||
},
|
||||
{
|
||||
shortcut: meta + ' + S',
|
||||
action: 'Save (if save plugin activated)'
|
||||
},
|
||||
{
|
||||
shortcut: meta + ' + F',
|
||||
action: 'Find (if searchreplace plugin activated)'
|
||||
}
|
||||
];
|
||||
var $_4t9ffhbmjkmcdunq = { shortcuts: shortcuts };
|
||||
|
||||
var makeTab = function () {
|
||||
var makeAriaLabel = function (shortcut) {
|
||||
return 'aria-label="Action: ' + shortcut.action + ', Shortcut: ' + shortcut.shortcut.replace(/Ctrl/g, 'Control') + '"';
|
||||
};
|
||||
var shortcutLisString = map($_4t9ffhbmjkmcdunq.shortcuts, function (shortcut) {
|
||||
return '<tr data-mce-tabstop="1" tabindex="-1" ' + makeAriaLabel(shortcut) + '>' + '<td>' + global$1.translate(shortcut.action) + '</td>' + '<td>' + shortcut.shortcut + '</td>' + '</tr>';
|
||||
}).join('');
|
||||
return {
|
||||
title: 'Handy Shortcuts',
|
||||
type: 'container',
|
||||
style: 'overflow-y: auto; overflow-x: hidden; max-height: 250px',
|
||||
items: [{
|
||||
type: 'container',
|
||||
html: '<div>' + '<table class="mce-table-striped">' + '<thead>' + '<th>' + global$1.translate('Action') + '</th>' + '<th>' + global$1.translate('Shortcut') + '</th>' + '</thead>' + shortcutLisString + '</table>' + '</div>'
|
||||
}]
|
||||
};
|
||||
};
|
||||
var $_abw5ymbgjkmcdun4 = { makeTab: makeTab };
|
||||
|
||||
var keys = Object.keys;
|
||||
|
||||
var supplant = function (str, obj) {
|
||||
var isStringOrNumber = function (a) {
|
||||
var t = typeof a;
|
||||
return t === 'string' || t === 'number';
|
||||
};
|
||||
return str.replace(/\$\{([^{}]*)\}/g, function (fullMatch, key) {
|
||||
var value = obj[key];
|
||||
return isStringOrNumber(value) ? value.toString() : fullMatch;
|
||||
});
|
||||
};
|
||||
|
||||
var urls = [
|
||||
{
|
||||
key: 'advlist',
|
||||
name: 'Advanced List'
|
||||
},
|
||||
{
|
||||
key: 'anchor',
|
||||
name: 'Anchor'
|
||||
},
|
||||
{
|
||||
key: 'autolink',
|
||||
name: 'Autolink'
|
||||
},
|
||||
{
|
||||
key: 'autoresize',
|
||||
name: 'Autoresize'
|
||||
},
|
||||
{
|
||||
key: 'autosave',
|
||||
name: 'Autosave'
|
||||
},
|
||||
{
|
||||
key: 'bbcode',
|
||||
name: 'BBCode'
|
||||
},
|
||||
{
|
||||
key: 'charmap',
|
||||
name: 'Character Map'
|
||||
},
|
||||
{
|
||||
key: 'code',
|
||||
name: 'Code'
|
||||
},
|
||||
{
|
||||
key: 'codesample',
|
||||
name: 'Code Sample'
|
||||
},
|
||||
{
|
||||
key: 'colorpicker',
|
||||
name: 'Color Picker'
|
||||
},
|
||||
{
|
||||
key: 'compat3x',
|
||||
name: '3.x Compatibility'
|
||||
},
|
||||
{
|
||||
key: 'contextmenu',
|
||||
name: 'Context Menu'
|
||||
},
|
||||
{
|
||||
key: 'directionality',
|
||||
name: 'Directionality'
|
||||
},
|
||||
{
|
||||
key: 'emoticons',
|
||||
name: 'Emoticons'
|
||||
},
|
||||
{
|
||||
key: 'fullpage',
|
||||
name: 'Full Page'
|
||||
},
|
||||
{
|
||||
key: 'fullscreen',
|
||||
name: 'Full Screen'
|
||||
},
|
||||
{
|
||||
key: 'help',
|
||||
name: 'Help'
|
||||
},
|
||||
{
|
||||
key: 'hr',
|
||||
name: 'Horizontal Rule'
|
||||
},
|
||||
{
|
||||
key: 'image',
|
||||
name: 'Image'
|
||||
},
|
||||
{
|
||||
key: 'imagetools',
|
||||
name: 'Image Tools'
|
||||
},
|
||||
{
|
||||
key: 'importcss',
|
||||
name: 'Import CSS'
|
||||
},
|
||||
{
|
||||
key: 'insertdatetime',
|
||||
name: 'Insert Date/Time'
|
||||
},
|
||||
{
|
||||
key: 'legacyoutput',
|
||||
name: 'Legacy Output'
|
||||
},
|
||||
{
|
||||
key: 'link',
|
||||
name: 'Link'
|
||||
},
|
||||
{
|
||||
key: 'lists',
|
||||
name: 'Lists'
|
||||
},
|
||||
{
|
||||
key: 'media',
|
||||
name: 'Media'
|
||||
},
|
||||
{
|
||||
key: 'nonbreaking',
|
||||
name: 'Nonbreaking'
|
||||
},
|
||||
{
|
||||
key: 'noneditable',
|
||||
name: 'Noneditable'
|
||||
},
|
||||
{
|
||||
key: 'pagebreak',
|
||||
name: 'Page Break'
|
||||
},
|
||||
{
|
||||
key: 'paste',
|
||||
name: 'Paste'
|
||||
},
|
||||
{
|
||||
key: 'preview',
|
||||
name: 'Preview'
|
||||
},
|
||||
{
|
||||
key: 'print',
|
||||
name: 'Print'
|
||||
},
|
||||
{
|
||||
key: 'save',
|
||||
name: 'Save'
|
||||
},
|
||||
{
|
||||
key: 'searchreplace',
|
||||
name: 'Search and Replace'
|
||||
},
|
||||
{
|
||||
key: 'spellchecker',
|
||||
name: 'Spell Checker'
|
||||
},
|
||||
{
|
||||
key: 'tabfocus',
|
||||
name: 'Tab Focus'
|
||||
},
|
||||
{
|
||||
key: 'table',
|
||||
name: 'Table'
|
||||
},
|
||||
{
|
||||
key: 'template',
|
||||
name: 'Template'
|
||||
},
|
||||
{
|
||||
key: 'textcolor',
|
||||
name: 'Text Color'
|
||||
},
|
||||
{
|
||||
key: 'textpattern',
|
||||
name: 'Text Pattern'
|
||||
},
|
||||
{
|
||||
key: 'toc',
|
||||
name: 'Table of Contents'
|
||||
},
|
||||
{
|
||||
key: 'visualblocks',
|
||||
name: 'Visual Blocks'
|
||||
},
|
||||
{
|
||||
key: 'visualchars',
|
||||
name: 'Visual Characters'
|
||||
},
|
||||
{
|
||||
key: 'wordcount',
|
||||
name: 'Word Count'
|
||||
}
|
||||
];
|
||||
var $_alfy21btjkmcduoc = { urls: urls };
|
||||
|
||||
var makeLink = curry(supplant, '<a href="${url}" target="_blank" rel="noopener">${name}</a>');
|
||||
var maybeUrlize = function (editor, key) {
|
||||
return find($_alfy21btjkmcduoc.urls, function (x) {
|
||||
return x.key === key;
|
||||
}).fold(function () {
|
||||
var getMetadata = editor.plugins[key].getMetadata;
|
||||
return typeof getMetadata === 'function' ? makeLink(getMetadata()) : key;
|
||||
}, function (x) {
|
||||
return makeLink({
|
||||
name: x.name,
|
||||
url: 'https://www.tinymce.com/docs/plugins/' + x.key
|
||||
});
|
||||
});
|
||||
};
|
||||
var getPluginKeys = function (editor) {
|
||||
var keys$$1 = keys(editor.plugins);
|
||||
return editor.settings.forced_plugins === undefined ? keys$$1 : filter(keys$$1, not(curry(contains, editor.settings.forced_plugins)));
|
||||
};
|
||||
var pluginLister = function (editor) {
|
||||
var pluginKeys = getPluginKeys(editor);
|
||||
var pluginLis = map(pluginKeys, function (key) {
|
||||
return '<li>' + maybeUrlize(editor, key) + '</li>';
|
||||
});
|
||||
var count = pluginLis.length;
|
||||
var pluginsString = pluginLis.join('');
|
||||
return '<p><b>' + global$1.translate([
|
||||
'Plugins installed ({0}):',
|
||||
count
|
||||
]) + '</b></p>' + '<ul>' + pluginsString + '</ul>';
|
||||
};
|
||||
var installedPlugins = function (editor) {
|
||||
return {
|
||||
type: 'container',
|
||||
html: '<div style="overflow-y: auto; overflow-x: hidden; max-height: 230px; height: 230px;" data-mce-tabstop="1" tabindex="-1">' + pluginLister(editor) + '</div>',
|
||||
flex: 1
|
||||
};
|
||||
};
|
||||
var availablePlugins = function () {
|
||||
return {
|
||||
type: 'container',
|
||||
html: '<div style="padding: 10px; background: #e3e7f4; height: 100%;" data-mce-tabstop="1" tabindex="-1">' + '<p><b>' + global$1.translate('Premium plugins:') + '</b></p>' + '<ul>' + '<li>PowerPaste</li>' + '<li>Spell Checker Pro</li>' + '<li>Accessibility Checker</li>' + '<li>Advanced Code Editor</li>' + '<li>Enhanced Media Embed</li>' + '<li>Link Checker</li>' + '</ul><br />' + '<p style="float: right;"><a href="https://www.tinymce.com/pricing/?utm_campaign=editor_referral&utm_medium=help_dialog&utm_source=tinymce" target="_blank">' + global$1.translate('Learn more...') + '</a></p>' + '</div>',
|
||||
flex: 1
|
||||
};
|
||||
};
|
||||
var makeTab$1 = function (editor) {
|
||||
return {
|
||||
title: 'Plugins',
|
||||
type: 'container',
|
||||
style: 'overflow-y: auto; overflow-x: hidden;',
|
||||
layout: 'flex',
|
||||
padding: 10,
|
||||
spacing: 10,
|
||||
items: [
|
||||
installedPlugins(editor),
|
||||
availablePlugins()
|
||||
]
|
||||
};
|
||||
};
|
||||
var $_gaamblbojkmcdunt = { makeTab: makeTab$1 };
|
||||
|
||||
var global$3 = tinymce.util.Tools.resolve('tinymce.EditorManager');
|
||||
|
||||
var getVersion = function (major, minor) {
|
||||
return major.indexOf('@') === 0 ? 'X.X.X' : major + '.' + minor;
|
||||
};
|
||||
var makeRow = function () {
|
||||
var version = getVersion(global$3.majorVersion, global$3.minorVersion);
|
||||
var changeLogLink = '<a href="https://www.tinymce.com/docs/changelog/?utm_campaign=editor_referral&utm_medium=help_dialog&utm_source=tinymce" target="_blank">TinyMCE ' + version + '</a>';
|
||||
return [
|
||||
{
|
||||
type: 'label',
|
||||
html: global$1.translate([
|
||||
'You are using {0}',
|
||||
changeLogLink
|
||||
])
|
||||
},
|
||||
{
|
||||
type: 'spacer',
|
||||
flex: 1
|
||||
},
|
||||
{
|
||||
text: 'Close',
|
||||
onclick: function () {
|
||||
this.parent().parent().close();
|
||||
}
|
||||
}
|
||||
];
|
||||
};
|
||||
var $_flzpmxbujkmcduoe = { makeRow: makeRow };
|
||||
|
||||
var open = function (editor, pluginUrl) {
|
||||
return function () {
|
||||
editor.windowManager.open({
|
||||
title: 'Help',
|
||||
bodyType: 'tabpanel',
|
||||
layout: 'flex',
|
||||
body: [
|
||||
$_abw5ymbgjkmcdun4.makeTab(),
|
||||
$_gaamblbojkmcdunt.makeTab(editor)
|
||||
],
|
||||
buttons: $_flzpmxbujkmcduoe.makeRow(),
|
||||
onPostRender: function () {
|
||||
var title = this.getEl('title');
|
||||
title.innerHTML = '<img src="' + pluginUrl + '/img/logo.png" alt="TinyMCE Logo" style="display: inline-block; width: 200px; height: 50px">';
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
var $_414lq7bfjkmcdun3 = { open: open };
|
||||
|
||||
var register = function (editor, pluginUrl) {
|
||||
editor.addCommand('mceHelp', $_414lq7bfjkmcdun3.open(editor, pluginUrl));
|
||||
};
|
||||
var $_2ujdrjbejkmcdun2 = { register: register };
|
||||
|
||||
var register$1 = function (editor, pluginUrl) {
|
||||
editor.addButton('help', {
|
||||
icon: 'help',
|
||||
onclick: $_414lq7bfjkmcdun3.open(editor, pluginUrl)
|
||||
});
|
||||
editor.addMenuItem('help', {
|
||||
text: 'Help',
|
||||
icon: 'help',
|
||||
context: 'help',
|
||||
onclick: $_414lq7bfjkmcdun3.open(editor, pluginUrl)
|
||||
});
|
||||
};
|
||||
var $_48ylg1bwjkmcduof = { register: register$1 };
|
||||
|
||||
global.add('help', function (editor, pluginUrl) {
|
||||
$_48ylg1bwjkmcduof.register(editor, pluginUrl);
|
||||
$_2ujdrjbejkmcdun2.register(editor, pluginUrl);
|
||||
editor.shortcuts.add('Alt+0', 'Open help dialog', 'mceHelp');
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
||||
@@ -0,0 +1,7 @@
|
||||
// Exports the "hr" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/hr')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/hr'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,39 @@
|
||||
(function () {
|
||||
var hr = (function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('InsertHorizontalRule', function () {
|
||||
editor.execCommand('mceInsertContent', false, '<hr />');
|
||||
});
|
||||
};
|
||||
var $_agtgdrcnjkmcdux2 = { register: register };
|
||||
|
||||
var register$1 = function (editor) {
|
||||
editor.addButton('hr', {
|
||||
icon: 'hr',
|
||||
tooltip: 'Horizontal line',
|
||||
cmd: 'InsertHorizontalRule'
|
||||
});
|
||||
editor.addMenuItem('hr', {
|
||||
icon: 'hr',
|
||||
text: 'Horizontal line',
|
||||
cmd: 'InsertHorizontalRule',
|
||||
context: 'insert'
|
||||
});
|
||||
};
|
||||
var $_4c3f2acojkmcdux3 = { register: register$1 };
|
||||
|
||||
global.add('hr', function (editor) {
|
||||
$_agtgdrcnjkmcdux2.register(editor);
|
||||
$_4c3f2acojkmcdux3.register(editor);
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
||||
@@ -0,0 +1 @@
|
||||
!function(){"use strict";var n=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=function(n){n.addCommand("InsertHorizontalRule",function(){n.execCommand("mceInsertContent",!1,"<hr />")})},o=function(n){n.addButton("hr",{icon:"hr",tooltip:"Horizontal line",cmd:"InsertHorizontalRule"}),n.addMenuItem("hr",{icon:"hr",text:"Horizontal line",cmd:"InsertHorizontalRule",context:"insert"})};n.add("hr",function(n){t(n),o(n)})}();
|
||||
@@ -0,0 +1,7 @@
|
||||
// Exports the "image" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/image')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/image'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,7 @@
|
||||
// Exports the "imagetools" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/imagetools')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/imagetools'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,7 @@
|
||||
// Exports the "importcss" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/importcss')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/importcss'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,264 @@
|
||||
(function () {
|
||||
var importcss = (function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
|
||||
|
||||
var global$2 = tinymce.util.Tools.resolve('tinymce.EditorManager');
|
||||
|
||||
var global$3 = tinymce.util.Tools.resolve('tinymce.Env');
|
||||
|
||||
var global$4 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var shouldMergeClasses = function (editor) {
|
||||
return editor.getParam('importcss_merge_classes');
|
||||
};
|
||||
var shouldImportExclusive = function (editor) {
|
||||
return editor.getParam('importcss_exclusive');
|
||||
};
|
||||
var getSelectorConverter = function (editor) {
|
||||
return editor.getParam('importcss_selector_converter');
|
||||
};
|
||||
var getSelectorFilter = function (editor) {
|
||||
return editor.getParam('importcss_selector_filter');
|
||||
};
|
||||
var getCssGroups = function (editor) {
|
||||
return editor.getParam('importcss_groups');
|
||||
};
|
||||
var shouldAppend = function (editor) {
|
||||
return editor.getParam('importcss_append');
|
||||
};
|
||||
var getFileFilter = function (editor) {
|
||||
return editor.getParam('importcss_file_filter');
|
||||
};
|
||||
var $_33utw3fcjkmcdvda = {
|
||||
shouldMergeClasses: shouldMergeClasses,
|
||||
shouldImportExclusive: shouldImportExclusive,
|
||||
getSelectorConverter: getSelectorConverter,
|
||||
getSelectorFilter: getSelectorFilter,
|
||||
getCssGroups: getCssGroups,
|
||||
shouldAppend: shouldAppend,
|
||||
getFileFilter: getFileFilter
|
||||
};
|
||||
|
||||
var removeCacheSuffix = function (url) {
|
||||
var cacheSuffix = global$3.cacheSuffix;
|
||||
if (typeof url === 'string') {
|
||||
url = url.replace('?' + cacheSuffix, '').replace('&' + cacheSuffix, '');
|
||||
}
|
||||
return url;
|
||||
};
|
||||
var isSkinContentCss = function (editor, href) {
|
||||
var settings = editor.settings, skin = settings.skin !== false ? settings.skin || 'lightgray' : false;
|
||||
if (skin) {
|
||||
var skinUrl = settings.skin_url ? editor.documentBaseURI.toAbsolute(settings.skin_url) : global$2.baseURL + '/skins/' + skin;
|
||||
return href === skinUrl + '/content' + (editor.inline ? '.inline' : '') + '.min.css';
|
||||
}
|
||||
return false;
|
||||
};
|
||||
var compileFilter = function (filter) {
|
||||
if (typeof filter === 'string') {
|
||||
return function (value) {
|
||||
return value.indexOf(filter) !== -1;
|
||||
};
|
||||
} else if (filter instanceof RegExp) {
|
||||
return function (value) {
|
||||
return filter.test(value);
|
||||
};
|
||||
}
|
||||
return filter;
|
||||
};
|
||||
var getSelectors = function (editor, doc, fileFilter) {
|
||||
var selectors = [], contentCSSUrls = {};
|
||||
function append(styleSheet, imported) {
|
||||
var href = styleSheet.href, rules;
|
||||
href = removeCacheSuffix(href);
|
||||
if (!href || !fileFilter(href, imported) || isSkinContentCss(editor, href)) {
|
||||
return;
|
||||
}
|
||||
global$4.each(styleSheet.imports, function (styleSheet) {
|
||||
append(styleSheet, true);
|
||||
});
|
||||
try {
|
||||
rules = styleSheet.cssRules || styleSheet.rules;
|
||||
} catch (e) {
|
||||
}
|
||||
global$4.each(rules, function (cssRule) {
|
||||
if (cssRule.styleSheet) {
|
||||
append(cssRule.styleSheet, true);
|
||||
} else if (cssRule.selectorText) {
|
||||
global$4.each(cssRule.selectorText.split(','), function (selector) {
|
||||
selectors.push(global$4.trim(selector));
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
global$4.each(editor.contentCSS, function (url) {
|
||||
contentCSSUrls[url] = true;
|
||||
});
|
||||
if (!fileFilter) {
|
||||
fileFilter = function (href, imported) {
|
||||
return imported || contentCSSUrls[href];
|
||||
};
|
||||
}
|
||||
try {
|
||||
global$4.each(doc.styleSheets, function (styleSheet) {
|
||||
append(styleSheet);
|
||||
});
|
||||
} catch (e) {
|
||||
}
|
||||
return selectors;
|
||||
};
|
||||
var defaultConvertSelectorToFormat = function (editor, selectorText) {
|
||||
var format;
|
||||
var selector = /^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(selectorText);
|
||||
if (!selector) {
|
||||
return;
|
||||
}
|
||||
var elementName = selector[1];
|
||||
var classes = selector[2].substr(1).split('.').join(' ');
|
||||
var inlineSelectorElements = global$4.makeMap('a,img');
|
||||
if (selector[1]) {
|
||||
format = { title: selectorText };
|
||||
if (editor.schema.getTextBlockElements()[elementName]) {
|
||||
format.block = elementName;
|
||||
} else if (editor.schema.getBlockElements()[elementName] || inlineSelectorElements[elementName.toLowerCase()]) {
|
||||
format.selector = elementName;
|
||||
} else {
|
||||
format.inline = elementName;
|
||||
}
|
||||
} else if (selector[2]) {
|
||||
format = {
|
||||
inline: 'span',
|
||||
title: selectorText.substr(1),
|
||||
classes: classes
|
||||
};
|
||||
}
|
||||
if ($_33utw3fcjkmcdvda.shouldMergeClasses(editor) !== false) {
|
||||
format.classes = classes;
|
||||
} else {
|
||||
format.attributes = { class: classes };
|
||||
}
|
||||
return format;
|
||||
};
|
||||
var getGroupsBySelector = function (groups, selector) {
|
||||
return global$4.grep(groups, function (group) {
|
||||
return !group.filter || group.filter(selector);
|
||||
});
|
||||
};
|
||||
var compileUserDefinedGroups = function (groups) {
|
||||
return global$4.map(groups, function (group) {
|
||||
return global$4.extend({}, group, {
|
||||
original: group,
|
||||
selectors: {},
|
||||
filter: compileFilter(group.filter),
|
||||
item: {
|
||||
text: group.title,
|
||||
menu: []
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
var isExclusiveMode = function (editor, group) {
|
||||
return group === null || $_33utw3fcjkmcdvda.shouldImportExclusive(editor) !== false;
|
||||
};
|
||||
var isUniqueSelector = function (editor, selector, group, globallyUniqueSelectors) {
|
||||
return !(isExclusiveMode(editor, group) ? selector in globallyUniqueSelectors : selector in group.selectors);
|
||||
};
|
||||
var markUniqueSelector = function (editor, selector, group, globallyUniqueSelectors) {
|
||||
if (isExclusiveMode(editor, group)) {
|
||||
globallyUniqueSelectors[selector] = true;
|
||||
} else {
|
||||
group.selectors[selector] = true;
|
||||
}
|
||||
};
|
||||
var convertSelectorToFormat = function (editor, plugin, selector, group) {
|
||||
var selectorConverter;
|
||||
if (group && group.selector_converter) {
|
||||
selectorConverter = group.selector_converter;
|
||||
} else if ($_33utw3fcjkmcdvda.getSelectorConverter(editor)) {
|
||||
selectorConverter = $_33utw3fcjkmcdvda.getSelectorConverter(editor);
|
||||
} else {
|
||||
selectorConverter = function () {
|
||||
return defaultConvertSelectorToFormat(editor, selector);
|
||||
};
|
||||
}
|
||||
return selectorConverter.call(plugin, selector, group);
|
||||
};
|
||||
var setup = function (editor) {
|
||||
editor.on('renderFormatsMenu', function (e) {
|
||||
var globallyUniqueSelectors = {};
|
||||
var selectorFilter = compileFilter($_33utw3fcjkmcdvda.getSelectorFilter(editor)), ctrl = e.control;
|
||||
var groups = compileUserDefinedGroups($_33utw3fcjkmcdvda.getCssGroups(editor));
|
||||
var processSelector = function (selector, group) {
|
||||
if (isUniqueSelector(editor, selector, group, globallyUniqueSelectors)) {
|
||||
markUniqueSelector(editor, selector, group, globallyUniqueSelectors);
|
||||
var format = convertSelectorToFormat(editor, editor.plugins.importcss, selector, group);
|
||||
if (format) {
|
||||
var formatName = format.name || global$1.DOM.uniqueId();
|
||||
editor.formatter.register(formatName, format);
|
||||
return global$4.extend({}, ctrl.settings.itemDefaults, {
|
||||
text: format.title,
|
||||
format: formatName
|
||||
});
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
if (!$_33utw3fcjkmcdvda.shouldAppend(editor)) {
|
||||
ctrl.items().remove();
|
||||
}
|
||||
global$4.each(getSelectors(editor, e.doc || editor.getDoc(), compileFilter($_33utw3fcjkmcdvda.getFileFilter(editor))), function (selector) {
|
||||
if (selector.indexOf('.mce-') === -1) {
|
||||
if (!selectorFilter || selectorFilter(selector)) {
|
||||
var selectorGroups = getGroupsBySelector(groups, selector);
|
||||
if (selectorGroups.length > 0) {
|
||||
global$4.each(selectorGroups, function (group) {
|
||||
var menuItem = processSelector(selector, group);
|
||||
if (menuItem) {
|
||||
group.item.menu.push(menuItem);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var menuItem = processSelector(selector, null);
|
||||
if (menuItem) {
|
||||
ctrl.add(menuItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
global$4.each(groups, function (group) {
|
||||
if (group.item.menu.length > 0) {
|
||||
ctrl.add(group.item);
|
||||
}
|
||||
});
|
||||
e.control.renderNew();
|
||||
});
|
||||
};
|
||||
var $_1uu6rcf7jkmcdvd3 = {
|
||||
defaultConvertSelectorToFormat: defaultConvertSelectorToFormat,
|
||||
setup: setup
|
||||
};
|
||||
|
||||
var get = function (editor) {
|
||||
var convertSelectorToFormat = function (selectorText) {
|
||||
return $_1uu6rcf7jkmcdvd3.defaultConvertSelectorToFormat(editor, selectorText);
|
||||
};
|
||||
return { convertSelectorToFormat: convertSelectorToFormat };
|
||||
};
|
||||
var $_2ooztdf6jkmcdvd1 = { get: get };
|
||||
|
||||
global.add('importcss', function (editor) {
|
||||
$_1uu6rcf7jkmcdvd3.setup(editor);
|
||||
return $_2ooztdf6jkmcdvd1.get(editor);
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
||||
@@ -0,0 +1 @@
|
||||
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),d=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),v=tinymce.util.Tools.resolve("tinymce.EditorManager"),h=tinymce.util.Tools.resolve("tinymce.Env"),y=tinymce.util.Tools.resolve("tinymce.util.Tools"),o=function(e){return e.getParam("importcss_merge_classes")},n=function(e){return e.getParam("importcss_exclusive")},_=function(e){return e.getParam("importcss_selector_converter")},r=function(e){return e.getParam("importcss_selector_filter")},i=function(e){return e.getParam("importcss_groups")},u=function(e){return e.getParam("importcss_append")},l=function(e){return e.getParam("importcss_file_filter")},a=function(t){return"string"==typeof t?function(e){return-1!==e.indexOf(t)}:t instanceof RegExp?function(e){return t.test(e)}:t},f=function(f,e,m){var g=[],n={};function p(e,t){var n,r,i,c=e.href;if(r=c,i=h.cacheSuffix,"string"==typeof r&&(r=r.replace("?"+i,"").replace("&"+i,"")),(c=r)&&m(c,t)&&(o=c,u=(s=f).settings,!(l=!1!==u.skin&&(u.skin||"lightgray"))||o!==(u.skin_url?s.documentBaseURI.toAbsolute(u.skin_url):v.baseURL+"/skins/"+l)+"/content"+(s.inline?".inline":"")+".min.css")){var s,o,u,l;y.each(e.imports,function(e){p(e,!0)});try{n=e.cssRules||e.rules}catch(a){}y.each(n,function(e){e.styleSheet?p(e.styleSheet,!0):e.selectorText&&y.each(e.selectorText.split(","),function(e){g.push(y.trim(e))})})}}y.each(f.contentCSS,function(e){n[e]=!0}),m||(m=function(e,t){return t||n[e]});try{y.each(e.styleSheets,function(e){p(e)})}catch(t){}return g},x=function(e,t){var n,r=/^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(t);if(r){var i=r[1],c=r[2].substr(1).split(".").join(" "),s=y.makeMap("a,img");return r[1]?(n={title:t},e.schema.getTextBlockElements()[i]?n.block=i:e.schema.getBlockElements()[i]||s[i.toLowerCase()]?n.selector=i:n.inline=i):r[2]&&(n={inline:"span",title:t.substr(1),classes:c}),!1!==o(e)?n.classes=c:n.attributes={"class":c},n}},T=function(e,t){return null===t||!1!==n(e)},c=x,t=function(h){h.on("renderFormatsMenu",function(e){var t,p={},c=a(r(h)),v=e.control,s=(t=i(h),y.map(t,function(e){return y.extend({},e,{original:e,selectors:{},filter:a(e.filter),item:{text:e.title,menu:[]}})})),o=function(e,t){if(f=e,g=p,!(T(h,m=t)?f in g:f in m.selectors)){u=e,a=p,T(h,l=t)?a[u]=!0:l.selectors[u]=!0;var n=(c=(i=h).plugins.importcss,s=e,((o=t)&&o.selector_converter?o.selector_converter:_(i)?_(i):function(){return x(i,s)}).call(c,s,o));if(n){var r=n.name||d.DOM.uniqueId();return h.formatter.register(r,n),y.extend({},v.settings.itemDefaults,{text:n.title,format:r})}}var i,c,s,o,u,l,a,f,m,g;return null};u(h)||v.items().remove(),y.each(f(h,e.doc||h.getDoc(),a(l(h))),function(n){if(-1===n.indexOf(".mce-")&&(!c||c(n))){var e=(r=s,i=n,y.grep(r,function(e){return!e.filter||e.filter(i)}));if(0<e.length)y.each(e,function(e){var t=o(n,e);t&&e.item.menu.push(t)});else{var t=o(n,null);t&&v.add(t)}}var r,i}),y.each(s,function(e){0<e.item.menu.length&&v.add(e.item)}),e.control.renderNew()})},s=function(t){return{convertSelectorToFormat:function(e){return c(t,e)}}};e.add("importcss",function(e){return t(e),s(e)})}();
|
||||
@@ -0,0 +1,7 @@
|
||||
// Exports the "insertdatetime" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/insertdatetime')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/insertdatetime'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,173 @@
|
||||
(function () {
|
||||
var insertdatetime = (function () {
|
||||
'use strict';
|
||||
|
||||
var Cell = function (initial) {
|
||||
var value = initial;
|
||||
var get = function () {
|
||||
return value;
|
||||
};
|
||||
var set = function (v) {
|
||||
value = v;
|
||||
};
|
||||
var clone = function () {
|
||||
return Cell(get());
|
||||
};
|
||||
return {
|
||||
get: get,
|
||||
set: set,
|
||||
clone: clone
|
||||
};
|
||||
};
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var getDateFormat = function (editor) {
|
||||
return editor.getParam('insertdatetime_dateformat', editor.translate('%Y-%m-%d'));
|
||||
};
|
||||
var getTimeFormat = function (editor) {
|
||||
return editor.getParam('insertdatetime_timeformat', editor.translate('%H:%M:%S'));
|
||||
};
|
||||
var getFormats = function (editor) {
|
||||
return editor.getParam('insertdatetime_formats', [
|
||||
'%H:%M:%S',
|
||||
'%Y-%m-%d',
|
||||
'%I:%M:%S %p',
|
||||
'%D'
|
||||
]);
|
||||
};
|
||||
var getDefaultDateTime = function (editor) {
|
||||
var formats = getFormats(editor);
|
||||
return formats.length > 0 ? formats[0] : getTimeFormat(editor);
|
||||
};
|
||||
var shouldInsertTimeElement = function (editor) {
|
||||
return editor.getParam('insertdatetime_element', false);
|
||||
};
|
||||
var $_geya0zfhjkmcdvdv = {
|
||||
getDateFormat: getDateFormat,
|
||||
getTimeFormat: getTimeFormat,
|
||||
getFormats: getFormats,
|
||||
getDefaultDateTime: getDefaultDateTime,
|
||||
shouldInsertTimeElement: shouldInsertTimeElement
|
||||
};
|
||||
|
||||
var daysShort = 'Sun Mon Tue Wed Thu Fri Sat Sun'.split(' ');
|
||||
var daysLong = 'Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday'.split(' ');
|
||||
var monthsShort = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' ');
|
||||
var monthsLong = 'January February March April May June July August September October November December'.split(' ');
|
||||
var addZeros = function (value, len) {
|
||||
value = '' + value;
|
||||
if (value.length < len) {
|
||||
for (var i = 0; i < len - value.length; i++) {
|
||||
value = '0' + value;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
};
|
||||
var getDateTime = function (editor, fmt, date) {
|
||||
date = date || new Date();
|
||||
fmt = fmt.replace('%D', '%m/%d/%Y');
|
||||
fmt = fmt.replace('%r', '%I:%M:%S %p');
|
||||
fmt = fmt.replace('%Y', '' + date.getFullYear());
|
||||
fmt = fmt.replace('%y', '' + date.getYear());
|
||||
fmt = fmt.replace('%m', addZeros(date.getMonth() + 1, 2));
|
||||
fmt = fmt.replace('%d', addZeros(date.getDate(), 2));
|
||||
fmt = fmt.replace('%H', '' + addZeros(date.getHours(), 2));
|
||||
fmt = fmt.replace('%M', '' + addZeros(date.getMinutes(), 2));
|
||||
fmt = fmt.replace('%S', '' + addZeros(date.getSeconds(), 2));
|
||||
fmt = fmt.replace('%I', '' + ((date.getHours() + 11) % 12 + 1));
|
||||
fmt = fmt.replace('%p', '' + (date.getHours() < 12 ? 'AM' : 'PM'));
|
||||
fmt = fmt.replace('%B', '' + editor.translate(monthsLong[date.getMonth()]));
|
||||
fmt = fmt.replace('%b', '' + editor.translate(monthsShort[date.getMonth()]));
|
||||
fmt = fmt.replace('%A', '' + editor.translate(daysLong[date.getDay()]));
|
||||
fmt = fmt.replace('%a', '' + editor.translate(daysShort[date.getDay()]));
|
||||
fmt = fmt.replace('%%', '%');
|
||||
return fmt;
|
||||
};
|
||||
var updateElement = function (editor, timeElm, computerTime, userTime) {
|
||||
var newTimeElm = editor.dom.create('time', { datetime: computerTime }, userTime);
|
||||
timeElm.parentNode.insertBefore(newTimeElm, timeElm);
|
||||
editor.dom.remove(timeElm);
|
||||
editor.selection.select(newTimeElm, true);
|
||||
editor.selection.collapse(false);
|
||||
};
|
||||
var insertDateTime = function (editor, format) {
|
||||
if ($_geya0zfhjkmcdvdv.shouldInsertTimeElement(editor)) {
|
||||
var userTime = getDateTime(editor, format);
|
||||
var computerTime = void 0;
|
||||
if (/%[HMSIp]/.test(format)) {
|
||||
computerTime = getDateTime(editor, '%Y-%m-%dT%H:%M');
|
||||
} else {
|
||||
computerTime = getDateTime(editor, '%Y-%m-%d');
|
||||
}
|
||||
var timeElm = editor.dom.getParent(editor.selection.getStart(), 'time');
|
||||
if (timeElm) {
|
||||
updateElement(editor, timeElm, computerTime, userTime);
|
||||
} else {
|
||||
editor.insertContent('<time datetime="' + computerTime + '">' + userTime + '</time>');
|
||||
}
|
||||
} else {
|
||||
editor.insertContent(getDateTime(editor, format));
|
||||
}
|
||||
};
|
||||
var $_gb83b6fijkmcdvdw = {
|
||||
insertDateTime: insertDateTime,
|
||||
getDateTime: getDateTime
|
||||
};
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('mceInsertDate', function () {
|
||||
$_gb83b6fijkmcdvdw.insertDateTime(editor, $_geya0zfhjkmcdvdv.getDateFormat(editor));
|
||||
});
|
||||
editor.addCommand('mceInsertTime', function () {
|
||||
$_gb83b6fijkmcdvdw.insertDateTime(editor, $_geya0zfhjkmcdvdv.getTimeFormat(editor));
|
||||
});
|
||||
};
|
||||
var $_358g7bfgjkmcdvdu = { register: register };
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var createMenuItems = function (editor, lastFormatState) {
|
||||
var formats = $_geya0zfhjkmcdvdv.getFormats(editor);
|
||||
return global$1.map(formats, function (fmt) {
|
||||
return {
|
||||
text: $_gb83b6fijkmcdvdw.getDateTime(editor, fmt),
|
||||
onclick: function () {
|
||||
lastFormatState.set(fmt);
|
||||
$_gb83b6fijkmcdvdw.insertDateTime(editor, fmt);
|
||||
}
|
||||
};
|
||||
});
|
||||
};
|
||||
var register$1 = function (editor, lastFormatState) {
|
||||
var menuItems = createMenuItems(editor, lastFormatState);
|
||||
editor.addButton('insertdatetime', {
|
||||
type: 'splitbutton',
|
||||
title: 'Insert date/time',
|
||||
menu: menuItems,
|
||||
onclick: function () {
|
||||
var lastFormat = lastFormatState.get();
|
||||
$_gb83b6fijkmcdvdw.insertDateTime(editor, lastFormat ? lastFormat : $_geya0zfhjkmcdvdv.getDefaultDateTime(editor));
|
||||
}
|
||||
});
|
||||
editor.addMenuItem('insertdatetime', {
|
||||
icon: 'date',
|
||||
text: 'Date/time',
|
||||
menu: menuItems,
|
||||
context: 'insert'
|
||||
});
|
||||
};
|
||||
var $_6qh1hqfjjkmcdvdz = { register: register$1 };
|
||||
|
||||
global.add('insertdatetime', function (editor) {
|
||||
var lastFormatState = Cell(null);
|
||||
$_358g7bfgjkmcdvdu.register(editor);
|
||||
$_6qh1hqfjjkmcdvdz.register(editor, lastFormatState);
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
||||
@@ -0,0 +1 @@
|
||||
!function(){"use strict";var r=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return r(n())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=function(e){return e.getParam("insertdatetime_timeformat",e.translate("%H:%M:%S"))},a=function(e){return e.getParam("insertdatetime_formats",["%H:%M:%S","%Y-%m-%d","%I:%M:%S %p","%D"])},t=function(e){return e.getParam("insertdatetime_dateformat",e.translate("%Y-%m-%d"))},i=n,o=a,u=function(e){var t=a(e);return 0<t.length?t[0]:n(e)},m=function(e){return e.getParam("insertdatetime_element",!1)},c="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),l="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),s="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),d="January February March April May June July August September October November December".split(" "),p=function(e,t){if((e=""+e).length<t)for(var n=0;n<t-e.length;n++)e="0"+e;return e},f=function(e,t,n){return n=n||new Date,t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace("%D","%m/%d/%Y")).replace("%r","%I:%M:%S %p")).replace("%Y",""+n.getFullYear())).replace("%y",""+n.getYear())).replace("%m",p(n.getMonth()+1,2))).replace("%d",p(n.getDate(),2))).replace("%H",""+p(n.getHours(),2))).replace("%M",""+p(n.getMinutes(),2))).replace("%S",""+p(n.getSeconds(),2))).replace("%I",""+((n.getHours()+11)%12+1))).replace("%p",n.getHours()<12?"AM":"PM")).replace("%B",""+e.translate(d[n.getMonth()]))).replace("%b",""+e.translate(s[n.getMonth()]))).replace("%A",""+e.translate(l[n.getDay()]))).replace("%a",""+e.translate(c[n.getDay()]))).replace("%%","%")},g=function(e,t){if(m(e)){var n=f(e,t),r=void 0;r=/%[HMSIp]/.test(t)?f(e,"%Y-%m-%dT%H:%M"):f(e,"%Y-%m-%d");var a=e.dom.getParent(e.selection.getStart(),"time");a?(o=a,u=r,c=n,l=(i=e).dom.create("time",{datetime:u},c),o.parentNode.insertBefore(l,o),i.dom.remove(o),i.selection.select(l,!0),i.selection.collapse(!1)):e.insertContent('<time datetime="'+r+'">'+n+"</time>")}else e.insertContent(f(e,t));var i,o,u,c,l},y=f,M=function(e){e.addCommand("mceInsertDate",function(){g(e,t(e))}),e.addCommand("mceInsertTime",function(){g(e,i(e))})},v=tinymce.util.Tools.resolve("tinymce.util.Tools"),S=function(t,n){var r,a,e,i=(a=n,e=o(r=t),v.map(e,function(e){return{text:y(r,e),onclick:function(){a.set(e),g(r,e)}}}));t.addButton("insertdatetime",{type:"splitbutton",title:"Insert date/time",menu:i,onclick:function(){var e=n.get();g(t,e||u(t))}}),t.addMenuItem("insertdatetime",{icon:"date",text:"Date/time",menu:i,context:"insert"})};e.add("insertdatetime",function(e){var t=r(null);M(e),S(e,t)})}();
|
||||
@@ -0,0 +1,7 @@
|
||||
// Exports the "legacyoutput" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/legacyoutput')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/legacyoutput'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,220 @@
|
||||
(function () {
|
||||
var legacyoutput = (function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var overrideFormats = function (editor) {
|
||||
var alignElements = 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', fontSizes = global$1.explode(editor.settings.font_size_style_values), schema = editor.schema;
|
||||
editor.formatter.register({
|
||||
alignleft: {
|
||||
selector: alignElements,
|
||||
attributes: { align: 'left' }
|
||||
},
|
||||
aligncenter: {
|
||||
selector: alignElements,
|
||||
attributes: { align: 'center' }
|
||||
},
|
||||
alignright: {
|
||||
selector: alignElements,
|
||||
attributes: { align: 'right' }
|
||||
},
|
||||
alignjustify: {
|
||||
selector: alignElements,
|
||||
attributes: { align: 'justify' }
|
||||
},
|
||||
bold: [
|
||||
{
|
||||
inline: 'b',
|
||||
remove: 'all'
|
||||
},
|
||||
{
|
||||
inline: 'strong',
|
||||
remove: 'all'
|
||||
},
|
||||
{
|
||||
inline: 'span',
|
||||
styles: { fontWeight: 'bold' }
|
||||
}
|
||||
],
|
||||
italic: [
|
||||
{
|
||||
inline: 'i',
|
||||
remove: 'all'
|
||||
},
|
||||
{
|
||||
inline: 'em',
|
||||
remove: 'all'
|
||||
},
|
||||
{
|
||||
inline: 'span',
|
||||
styles: { fontStyle: 'italic' }
|
||||
}
|
||||
],
|
||||
underline: [
|
||||
{
|
||||
inline: 'u',
|
||||
remove: 'all'
|
||||
},
|
||||
{
|
||||
inline: 'span',
|
||||
styles: { textDecoration: 'underline' },
|
||||
exact: true
|
||||
}
|
||||
],
|
||||
strikethrough: [
|
||||
{
|
||||
inline: 'strike',
|
||||
remove: 'all'
|
||||
},
|
||||
{
|
||||
inline: 'span',
|
||||
styles: { textDecoration: 'line-through' },
|
||||
exact: true
|
||||
}
|
||||
],
|
||||
fontname: {
|
||||
inline: 'font',
|
||||
attributes: { face: '%value' }
|
||||
},
|
||||
fontsize: {
|
||||
inline: 'font',
|
||||
attributes: {
|
||||
size: function (vars) {
|
||||
return global$1.inArray(fontSizes, vars.value) + 1;
|
||||
}
|
||||
}
|
||||
},
|
||||
forecolor: {
|
||||
inline: 'font',
|
||||
attributes: { color: '%value' }
|
||||
},
|
||||
hilitecolor: {
|
||||
inline: 'font',
|
||||
styles: { backgroundColor: '%value' }
|
||||
}
|
||||
});
|
||||
global$1.each('b,i,u,strike'.split(','), function (name) {
|
||||
schema.addValidElements(name + '[*]');
|
||||
});
|
||||
if (!schema.getElementRule('font')) {
|
||||
schema.addValidElements('font[face|size|color|style]');
|
||||
}
|
||||
global$1.each(alignElements.split(','), function (name) {
|
||||
var rule = schema.getElementRule(name);
|
||||
if (rule) {
|
||||
if (!rule.attributes.align) {
|
||||
rule.attributes.align = {};
|
||||
rule.attributesOrder.push('align');
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
var setup = function (editor) {
|
||||
editor.settings.inline_styles = false;
|
||||
editor.on('init', function () {
|
||||
overrideFormats(editor);
|
||||
});
|
||||
};
|
||||
var $_dtip4mfnjkmcdvec = { setup: setup };
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addButton('fontsizeselect', function () {
|
||||
var items = [], defaultFontsizeFormats = '8pt=1 10pt=2 12pt=3 14pt=4 18pt=5 24pt=6 36pt=7';
|
||||
var fontsizeFormats = editor.settings.fontsizeFormats || defaultFontsizeFormats;
|
||||
editor.$.each(fontsizeFormats.split(' '), function (i, item) {
|
||||
var text = item, value = item;
|
||||
var values = item.split('=');
|
||||
if (values.length > 1) {
|
||||
text = values[0];
|
||||
value = values[1];
|
||||
}
|
||||
items.push({
|
||||
text: text,
|
||||
value: value
|
||||
});
|
||||
});
|
||||
return {
|
||||
type: 'listbox',
|
||||
text: 'Font Sizes',
|
||||
tooltip: 'Font Sizes',
|
||||
values: items,
|
||||
fixedWidth: true,
|
||||
onPostRender: function () {
|
||||
var self = this;
|
||||
editor.on('NodeChange', function () {
|
||||
var fontElm;
|
||||
fontElm = editor.dom.getParent(editor.selection.getNode(), 'font');
|
||||
if (fontElm) {
|
||||
self.value(fontElm.size);
|
||||
} else {
|
||||
self.value('');
|
||||
}
|
||||
});
|
||||
},
|
||||
onclick: function (e) {
|
||||
if (e.control.settings.value) {
|
||||
editor.execCommand('FontSize', false, e.control.settings.value);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
editor.addButton('fontselect', function () {
|
||||
function createFormats(formats) {
|
||||
formats = formats.replace(/;$/, '').split(';');
|
||||
var i = formats.length;
|
||||
while (i--) {
|
||||
formats[i] = formats[i].split('=');
|
||||
}
|
||||
return formats;
|
||||
}
|
||||
var defaultFontsFormats = 'Andale Mono=andale mono,monospace;' + 'Arial=arial,helvetica,sans-serif;' + 'Arial Black=arial black,sans-serif;' + 'Book Antiqua=book antiqua,palatino,serif;' + 'Comic Sans MS=comic sans ms,sans-serif;' + 'Courier New=courier new,courier,monospace;' + 'Georgia=georgia,palatino,serif;' + 'Helvetica=helvetica,arial,sans-serif;' + 'Impact=impact,sans-serif;' + 'Symbol=symbol;' + 'Tahoma=tahoma,arial,helvetica,sans-serif;' + 'Terminal=terminal,monaco,monospace;' + 'Times New Roman=times new roman,times,serif;' + 'Trebuchet MS=trebuchet ms,geneva,sans-serif;' + 'Verdana=verdana,geneva,sans-serif;' + 'Webdings=webdings;' + 'Wingdings=wingdings,zapf dingbats';
|
||||
var items = [], fonts = createFormats(editor.settings.font_formats || defaultFontsFormats);
|
||||
editor.$.each(fonts, function (i, font) {
|
||||
items.push({
|
||||
text: { raw: font[0] },
|
||||
value: font[1],
|
||||
textStyle: font[1].indexOf('dings') === -1 ? 'font-family:' + font[1] : ''
|
||||
});
|
||||
});
|
||||
return {
|
||||
type: 'listbox',
|
||||
text: 'Font Family',
|
||||
tooltip: 'Font Family',
|
||||
values: items,
|
||||
fixedWidth: true,
|
||||
onPostRender: function () {
|
||||
var self = this;
|
||||
editor.on('NodeChange', function () {
|
||||
var fontElm;
|
||||
fontElm = editor.dom.getParent(editor.selection.getNode(), 'font');
|
||||
if (fontElm) {
|
||||
self.value(fontElm.face);
|
||||
} else {
|
||||
self.value('');
|
||||
}
|
||||
});
|
||||
},
|
||||
onselect: function (e) {
|
||||
if (e.control.settings.value) {
|
||||
editor.execCommand('FontName', false, e.control.settings.value);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
};
|
||||
var $_4lunwpfpjkmcdvef = { register: register };
|
||||
|
||||
global.add('legacyoutput', function (editor) {
|
||||
$_dtip4mfnjkmcdvec.setup(editor);
|
||||
$_4lunwpfpjkmcdvef.register(editor);
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
||||
@@ -0,0 +1 @@
|
||||
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),o=tinymce.util.Tools.resolve("tinymce.util.Tools"),t=function(a){a.settings.inline_styles=!1,a.on("init",function(){var e,t,n,i;e=a,t="p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",n=o.explode(e.settings.font_size_style_values),i=e.schema,e.formatter.register({alignleft:{selector:t,attributes:{align:"left"}},aligncenter:{selector:t,attributes:{align:"center"}},alignright:{selector:t,attributes:{align:"right"}},alignjustify:{selector:t,attributes:{align:"justify"}},bold:[{inline:"b",remove:"all"},{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}}],italic:[{inline:"i",remove:"all"},{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}}],underline:[{inline:"u",remove:"all"},{inline:"span",styles:{textDecoration:"underline"},exact:!0}],strikethrough:[{inline:"strike",remove:"all"},{inline:"span",styles:{textDecoration:"line-through"},exact:!0}],fontname:{inline:"font",attributes:{face:"%value"}},fontsize:{inline:"font",attributes:{size:function(e){return o.inArray(n,e.value)+1}}},forecolor:{inline:"font",attributes:{color:"%value"}},hilitecolor:{inline:"font",styles:{backgroundColor:"%value"}}}),o.each("b,i,u,strike".split(","),function(e){i.addValidElements(e+"[*]")}),i.getElementRule("font")||i.addValidElements("font[face|size|color|style]"),o.each(t.split(","),function(e){var t=i.getElementRule(e);t&&(t.attributes.align||(t.attributes.align={},t.attributesOrder.push("align")))})})},n=function(i){i.addButton("fontsizeselect",function(){var o=[],e=i.settings.fontsizeFormats||"8pt=1 10pt=2 12pt=3 14pt=4 18pt=5 24pt=6 36pt=7";return i.$.each(e.split(" "),function(e,t){var n=t,i=t,a=t.split("=");1<a.length&&(n=a[0],i=a[1]),o.push({text:n,value:i})}),{type:"listbox",text:"Font Sizes",tooltip:"Font Sizes",values:o,fixedWidth:!0,onPostRender:function(){var t=this;i.on("NodeChange",function(){var e;(e=i.dom.getParent(i.selection.getNode(),"font"))?t.value(e.size):t.value("")})},onclick:function(e){e.control.settings.value&&i.execCommand("FontSize",!1,e.control.settings.value)}}}),i.addButton("fontselect",function(){var n=[],e=function(e){for(var t=(e=e.replace(/;$/,"").split(";")).length;t--;)e[t]=e[t].split("=");return e}(i.settings.font_formats||"Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats");return i.$.each(e,function(e,t){n.push({text:{raw:t[0]},value:t[1],textStyle:-1===t[1].indexOf("dings")?"font-family:"+t[1]:""})}),{type:"listbox",text:"Font Family",tooltip:"Font Family",values:n,fixedWidth:!0,onPostRender:function(){var t=this;i.on("NodeChange",function(){var e;(e=i.dom.getParent(i.selection.getNode(),"font"))?t.value(e.face):t.value("")})},onselect:function(e){e.control.settings.value&&i.execCommand("FontName",!1,e.control.settings.value)}}})};e.add("legacyoutput",function(e){t(e),n(e)})}();
|
||||
@@ -0,0 +1,7 @@
|
||||
// Exports the "link" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/link')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/link'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,713 @@
|
||||
(function () {
|
||||
var link = (function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.VK');
|
||||
|
||||
var assumeExternalTargets = function (editorSettings) {
|
||||
return typeof editorSettings.link_assume_external_targets === 'boolean' ? editorSettings.link_assume_external_targets : false;
|
||||
};
|
||||
var hasContextToolbar = function (editorSettings) {
|
||||
return typeof editorSettings.link_context_toolbar === 'boolean' ? editorSettings.link_context_toolbar : false;
|
||||
};
|
||||
var getLinkList = function (editorSettings) {
|
||||
return editorSettings.link_list;
|
||||
};
|
||||
var hasDefaultLinkTarget = function (editorSettings) {
|
||||
return typeof editorSettings.default_link_target === 'string';
|
||||
};
|
||||
var getDefaultLinkTarget = function (editorSettings) {
|
||||
return editorSettings.default_link_target;
|
||||
};
|
||||
var getTargetList = function (editorSettings) {
|
||||
return editorSettings.target_list;
|
||||
};
|
||||
var setTargetList = function (editor, list) {
|
||||
editor.settings.target_list = list;
|
||||
};
|
||||
var shouldShowTargetList = function (editorSettings) {
|
||||
return getTargetList(editorSettings) !== false;
|
||||
};
|
||||
var getRelList = function (editorSettings) {
|
||||
return editorSettings.rel_list;
|
||||
};
|
||||
var hasRelList = function (editorSettings) {
|
||||
return getRelList(editorSettings) !== undefined;
|
||||
};
|
||||
var getLinkClassList = function (editorSettings) {
|
||||
return editorSettings.link_class_list;
|
||||
};
|
||||
var hasLinkClassList = function (editorSettings) {
|
||||
return getLinkClassList(editorSettings) !== undefined;
|
||||
};
|
||||
var shouldShowLinkTitle = function (editorSettings) {
|
||||
return editorSettings.link_title !== false;
|
||||
};
|
||||
var allowUnsafeLinkTarget = function (editorSettings) {
|
||||
return typeof editorSettings.allow_unsafe_link_target === 'boolean' ? editorSettings.allow_unsafe_link_target : false;
|
||||
};
|
||||
var $_6v02umfvjkmcdvey = {
|
||||
assumeExternalTargets: assumeExternalTargets,
|
||||
hasContextToolbar: hasContextToolbar,
|
||||
getLinkList: getLinkList,
|
||||
hasDefaultLinkTarget: hasDefaultLinkTarget,
|
||||
getDefaultLinkTarget: getDefaultLinkTarget,
|
||||
getTargetList: getTargetList,
|
||||
setTargetList: setTargetList,
|
||||
shouldShowTargetList: shouldShowTargetList,
|
||||
getRelList: getRelList,
|
||||
hasRelList: hasRelList,
|
||||
getLinkClassList: getLinkClassList,
|
||||
hasLinkClassList: hasLinkClassList,
|
||||
shouldShowLinkTitle: shouldShowLinkTitle,
|
||||
allowUnsafeLinkTarget: allowUnsafeLinkTarget
|
||||
};
|
||||
|
||||
var global$2 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
|
||||
|
||||
var global$3 = tinymce.util.Tools.resolve('tinymce.Env');
|
||||
|
||||
var appendClickRemove = function (link, evt) {
|
||||
document.body.appendChild(link);
|
||||
link.dispatchEvent(evt);
|
||||
document.body.removeChild(link);
|
||||
};
|
||||
var open$$1 = function (url) {
|
||||
if (!global$3.ie || global$3.ie > 10) {
|
||||
var link = document.createElement('a');
|
||||
link.target = '_blank';
|
||||
link.href = url;
|
||||
link.rel = 'noreferrer noopener';
|
||||
var evt = document.createEvent('MouseEvents');
|
||||
evt.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
||||
appendClickRemove(link, evt);
|
||||
} else {
|
||||
var win = window.open('', '_blank');
|
||||
if (win) {
|
||||
win.opener = null;
|
||||
var doc = win.document;
|
||||
doc.open();
|
||||
doc.write('<meta http-equiv="refresh" content="0; url=' + global$2.DOM.encode(url) + '">');
|
||||
doc.close();
|
||||
}
|
||||
}
|
||||
};
|
||||
var $_eajedefwjkmcdvf1 = { open: open$$1 };
|
||||
|
||||
var global$4 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var toggleTargetRules = function (rel, isUnsafe) {
|
||||
var rules = ['noopener'];
|
||||
var newRel = rel ? rel.split(/\s+/) : [];
|
||||
var toString = function (rel) {
|
||||
return global$4.trim(rel.sort().join(' '));
|
||||
};
|
||||
var addTargetRules = function (rel) {
|
||||
rel = removeTargetRules(rel);
|
||||
return rel.length ? rel.concat(rules) : rules;
|
||||
};
|
||||
var removeTargetRules = function (rel) {
|
||||
return rel.filter(function (val) {
|
||||
return global$4.inArray(rules, val) === -1;
|
||||
});
|
||||
};
|
||||
newRel = isUnsafe ? addTargetRules(newRel) : removeTargetRules(newRel);
|
||||
return newRel.length ? toString(newRel) : null;
|
||||
};
|
||||
var trimCaretContainers = function (text) {
|
||||
return text.replace(/\uFEFF/g, '');
|
||||
};
|
||||
var getAnchorElement = function (editor, selectedElm) {
|
||||
selectedElm = selectedElm || editor.selection.getNode();
|
||||
if (isImageFigure(selectedElm)) {
|
||||
return editor.dom.select('a[href]', selectedElm)[0];
|
||||
} else {
|
||||
return editor.dom.getParent(selectedElm, 'a[href]');
|
||||
}
|
||||
};
|
||||
var getAnchorText = function (selection, anchorElm) {
|
||||
var text = anchorElm ? anchorElm.innerText || anchorElm.textContent : selection.getContent({ format: 'text' });
|
||||
return trimCaretContainers(text);
|
||||
};
|
||||
var isLink = function (elm) {
|
||||
return elm && elm.nodeName === 'A' && elm.href;
|
||||
};
|
||||
var hasLinks = function (elements) {
|
||||
return global$4.grep(elements, isLink).length > 0;
|
||||
};
|
||||
var isOnlyTextSelected = function (html) {
|
||||
if (/</.test(html) && (!/^<a [^>]+>[^<]+<\/a>$/.test(html) || html.indexOf('href=') === -1)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
var isImageFigure = function (node) {
|
||||
return node && node.nodeName === 'FIGURE' && /\bimage\b/i.test(node.className);
|
||||
};
|
||||
var link = function (editor, attachState) {
|
||||
return function (data) {
|
||||
editor.undoManager.transact(function () {
|
||||
var selectedElm = editor.selection.getNode();
|
||||
var anchorElm = getAnchorElement(editor, selectedElm);
|
||||
var linkAttrs = {
|
||||
href: data.href,
|
||||
target: data.target ? data.target : null,
|
||||
rel: data.rel ? data.rel : null,
|
||||
class: data.class ? data.class : null,
|
||||
title: data.title ? data.title : null
|
||||
};
|
||||
if (!$_6v02umfvjkmcdvey.hasRelList(editor.settings) && $_6v02umfvjkmcdvey.allowUnsafeLinkTarget(editor.settings) === false) {
|
||||
linkAttrs.rel = toggleTargetRules(linkAttrs.rel, linkAttrs.target === '_blank');
|
||||
}
|
||||
if (data.href === attachState.href) {
|
||||
attachState.attach();
|
||||
attachState = {};
|
||||
}
|
||||
if (anchorElm) {
|
||||
editor.focus();
|
||||
if (data.hasOwnProperty('text')) {
|
||||
if ('innerText' in anchorElm) {
|
||||
anchorElm.innerText = data.text;
|
||||
} else {
|
||||
anchorElm.textContent = data.text;
|
||||
}
|
||||
}
|
||||
editor.dom.setAttribs(anchorElm, linkAttrs);
|
||||
editor.selection.select(anchorElm);
|
||||
editor.undoManager.add();
|
||||
} else {
|
||||
if (isImageFigure(selectedElm)) {
|
||||
linkImageFigure(editor, selectedElm, linkAttrs);
|
||||
} else if (data.hasOwnProperty('text')) {
|
||||
editor.insertContent(editor.dom.createHTML('a', linkAttrs, editor.dom.encode(data.text)));
|
||||
} else {
|
||||
editor.execCommand('mceInsertLink', false, linkAttrs);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
var unlink = function (editor) {
|
||||
return function () {
|
||||
editor.undoManager.transact(function () {
|
||||
var node = editor.selection.getNode();
|
||||
if (isImageFigure(node)) {
|
||||
unlinkImageFigure(editor, node);
|
||||
} else {
|
||||
editor.execCommand('unlink');
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
var unlinkImageFigure = function (editor, fig) {
|
||||
var a, img;
|
||||
img = editor.dom.select('img', fig)[0];
|
||||
if (img) {
|
||||
a = editor.dom.getParents(img, 'a[href]', fig)[0];
|
||||
if (a) {
|
||||
a.parentNode.insertBefore(img, a);
|
||||
editor.dom.remove(a);
|
||||
}
|
||||
}
|
||||
};
|
||||
var linkImageFigure = function (editor, fig, attrs) {
|
||||
var a, img;
|
||||
img = editor.dom.select('img', fig)[0];
|
||||
if (img) {
|
||||
a = editor.dom.create('a', attrs);
|
||||
img.parentNode.insertBefore(a, img);
|
||||
a.appendChild(img);
|
||||
}
|
||||
};
|
||||
var $_68cwlgg0jkmcdvff = {
|
||||
link: link,
|
||||
unlink: unlink,
|
||||
isLink: isLink,
|
||||
hasLinks: hasLinks,
|
||||
isOnlyTextSelected: isOnlyTextSelected,
|
||||
getAnchorElement: getAnchorElement,
|
||||
getAnchorText: getAnchorText,
|
||||
toggleTargetRules: toggleTargetRules
|
||||
};
|
||||
|
||||
var global$5 = tinymce.util.Tools.resolve('tinymce.util.Delay');
|
||||
|
||||
var global$6 = tinymce.util.Tools.resolve('tinymce.util.XHR');
|
||||
|
||||
var attachState = {};
|
||||
var createLinkList = function (editor, callback) {
|
||||
var linkList = $_6v02umfvjkmcdvey.getLinkList(editor.settings);
|
||||
if (typeof linkList === 'string') {
|
||||
global$6.send({
|
||||
url: linkList,
|
||||
success: function (text) {
|
||||
callback(editor, JSON.parse(text));
|
||||
}
|
||||
});
|
||||
} else if (typeof linkList === 'function') {
|
||||
linkList(function (list) {
|
||||
callback(editor, list);
|
||||
});
|
||||
} else {
|
||||
callback(editor, linkList);
|
||||
}
|
||||
};
|
||||
var buildListItems = function (inputList, itemCallback, startItems) {
|
||||
var appendItems = function (values, output) {
|
||||
output = output || [];
|
||||
global$4.each(values, function (item) {
|
||||
var menuItem = { text: item.text || item.title };
|
||||
if (item.menu) {
|
||||
menuItem.menu = appendItems(item.menu);
|
||||
} else {
|
||||
menuItem.value = item.value;
|
||||
if (itemCallback) {
|
||||
itemCallback(menuItem);
|
||||
}
|
||||
}
|
||||
output.push(menuItem);
|
||||
});
|
||||
return output;
|
||||
};
|
||||
return appendItems(inputList, startItems || []);
|
||||
};
|
||||
var delayedConfirm = function (editor, message, callback) {
|
||||
var rng = editor.selection.getRng();
|
||||
global$5.setEditorTimeout(editor, function () {
|
||||
editor.windowManager.confirm(message, function (state) {
|
||||
editor.selection.setRng(rng);
|
||||
callback(state);
|
||||
});
|
||||
});
|
||||
};
|
||||
var showDialog = function (editor, linkList) {
|
||||
var data = {};
|
||||
var selection = editor.selection;
|
||||
var dom = editor.dom;
|
||||
var anchorElm, initialText;
|
||||
var win, onlyText, textListCtrl, linkListCtrl, relListCtrl, targetListCtrl, classListCtrl, linkTitleCtrl, value;
|
||||
var linkListChangeHandler = function (e) {
|
||||
var textCtrl = win.find('#text');
|
||||
if (!textCtrl.value() || e.lastControl && textCtrl.value() === e.lastControl.text()) {
|
||||
textCtrl.value(e.control.text());
|
||||
}
|
||||
win.find('#href').value(e.control.value());
|
||||
};
|
||||
var buildAnchorListControl = function (url) {
|
||||
var anchorList = [];
|
||||
global$4.each(editor.dom.select('a:not([href])'), function (anchor) {
|
||||
var id = anchor.name || anchor.id;
|
||||
if (id) {
|
||||
anchorList.push({
|
||||
text: id,
|
||||
value: '#' + id,
|
||||
selected: url.indexOf('#' + id) !== -1
|
||||
});
|
||||
}
|
||||
});
|
||||
if (anchorList.length) {
|
||||
anchorList.unshift({
|
||||
text: 'None',
|
||||
value: ''
|
||||
});
|
||||
return {
|
||||
name: 'anchor',
|
||||
type: 'listbox',
|
||||
label: 'Anchors',
|
||||
values: anchorList,
|
||||
onselect: linkListChangeHandler
|
||||
};
|
||||
}
|
||||
};
|
||||
var updateText = function () {
|
||||
if (!initialText && onlyText && !data.text) {
|
||||
this.parent().parent().find('#text')[0].value(this.value());
|
||||
}
|
||||
};
|
||||
var urlChange = function (e) {
|
||||
var meta = e.meta || {};
|
||||
if (linkListCtrl) {
|
||||
linkListCtrl.value(editor.convertURL(this.value(), 'href'));
|
||||
}
|
||||
global$4.each(e.meta, function (value, key) {
|
||||
var inp = win.find('#' + key);
|
||||
if (key === 'text') {
|
||||
if (initialText.length === 0) {
|
||||
inp.value(value);
|
||||
data.text = value;
|
||||
}
|
||||
} else {
|
||||
inp.value(value);
|
||||
}
|
||||
});
|
||||
if (meta.attach) {
|
||||
attachState = {
|
||||
href: this.value(),
|
||||
attach: meta.attach
|
||||
};
|
||||
}
|
||||
if (!meta.text) {
|
||||
updateText.call(this);
|
||||
}
|
||||
};
|
||||
var onBeforeCall = function (e) {
|
||||
e.meta = win.toJSON();
|
||||
};
|
||||
onlyText = $_68cwlgg0jkmcdvff.isOnlyTextSelected(selection.getContent());
|
||||
anchorElm = $_68cwlgg0jkmcdvff.getAnchorElement(editor);
|
||||
data.text = initialText = $_68cwlgg0jkmcdvff.getAnchorText(editor.selection, anchorElm);
|
||||
data.href = anchorElm ? dom.getAttrib(anchorElm, 'href') : '';
|
||||
if (anchorElm) {
|
||||
data.target = dom.getAttrib(anchorElm, 'target');
|
||||
} else if ($_6v02umfvjkmcdvey.hasDefaultLinkTarget(editor.settings)) {
|
||||
data.target = $_6v02umfvjkmcdvey.getDefaultLinkTarget(editor.settings);
|
||||
}
|
||||
if (value = dom.getAttrib(anchorElm, 'rel')) {
|
||||
data.rel = value;
|
||||
}
|
||||
if (value = dom.getAttrib(anchorElm, 'class')) {
|
||||
data.class = value;
|
||||
}
|
||||
if (value = dom.getAttrib(anchorElm, 'title')) {
|
||||
data.title = value;
|
||||
}
|
||||
if (onlyText) {
|
||||
textListCtrl = {
|
||||
name: 'text',
|
||||
type: 'textbox',
|
||||
size: 40,
|
||||
label: 'Text to display',
|
||||
onchange: function () {
|
||||
data.text = this.value();
|
||||
}
|
||||
};
|
||||
}
|
||||
if (linkList) {
|
||||
linkListCtrl = {
|
||||
type: 'listbox',
|
||||
label: 'Link list',
|
||||
values: buildListItems(linkList, function (item) {
|
||||
item.value = editor.convertURL(item.value || item.url, 'href');
|
||||
}, [{
|
||||
text: 'None',
|
||||
value: ''
|
||||
}]),
|
||||
onselect: linkListChangeHandler,
|
||||
value: editor.convertURL(data.href, 'href'),
|
||||
onPostRender: function () {
|
||||
linkListCtrl = this;
|
||||
}
|
||||
};
|
||||
}
|
||||
if ($_6v02umfvjkmcdvey.shouldShowTargetList(editor.settings)) {
|
||||
if ($_6v02umfvjkmcdvey.getTargetList(editor.settings) === undefined) {
|
||||
$_6v02umfvjkmcdvey.setTargetList(editor, [
|
||||
{
|
||||
text: 'None',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
text: 'New window',
|
||||
value: '_blank'
|
||||
}
|
||||
]);
|
||||
}
|
||||
targetListCtrl = {
|
||||
name: 'target',
|
||||
type: 'listbox',
|
||||
label: 'Target',
|
||||
values: buildListItems($_6v02umfvjkmcdvey.getTargetList(editor.settings))
|
||||
};
|
||||
}
|
||||
if ($_6v02umfvjkmcdvey.hasRelList(editor.settings)) {
|
||||
relListCtrl = {
|
||||
name: 'rel',
|
||||
type: 'listbox',
|
||||
label: 'Rel',
|
||||
values: buildListItems($_6v02umfvjkmcdvey.getRelList(editor.settings), function (item) {
|
||||
if ($_6v02umfvjkmcdvey.allowUnsafeLinkTarget(editor.settings) === false) {
|
||||
item.value = $_68cwlgg0jkmcdvff.toggleTargetRules(item.value, data.target === '_blank');
|
||||
}
|
||||
})
|
||||
};
|
||||
}
|
||||
if ($_6v02umfvjkmcdvey.hasLinkClassList(editor.settings)) {
|
||||
classListCtrl = {
|
||||
name: 'class',
|
||||
type: 'listbox',
|
||||
label: 'Class',
|
||||
values: buildListItems($_6v02umfvjkmcdvey.getLinkClassList(editor.settings), function (item) {
|
||||
if (item.value) {
|
||||
item.textStyle = function () {
|
||||
return editor.formatter.getCssText({
|
||||
inline: 'a',
|
||||
classes: [item.value]
|
||||
});
|
||||
};
|
||||
}
|
||||
})
|
||||
};
|
||||
}
|
||||
if ($_6v02umfvjkmcdvey.shouldShowLinkTitle(editor.settings)) {
|
||||
linkTitleCtrl = {
|
||||
name: 'title',
|
||||
type: 'textbox',
|
||||
label: 'Title',
|
||||
value: data.title
|
||||
};
|
||||
}
|
||||
win = editor.windowManager.open({
|
||||
title: 'Insert link',
|
||||
data: data,
|
||||
body: [
|
||||
{
|
||||
name: 'href',
|
||||
type: 'filepicker',
|
||||
filetype: 'file',
|
||||
size: 40,
|
||||
autofocus: true,
|
||||
label: 'Url',
|
||||
onchange: urlChange,
|
||||
onkeyup: updateText,
|
||||
onpaste: updateText,
|
||||
onbeforecall: onBeforeCall
|
||||
},
|
||||
textListCtrl,
|
||||
linkTitleCtrl,
|
||||
buildAnchorListControl(data.href),
|
||||
linkListCtrl,
|
||||
relListCtrl,
|
||||
targetListCtrl,
|
||||
classListCtrl
|
||||
],
|
||||
onSubmit: function (e) {
|
||||
var assumeExternalTargets = $_6v02umfvjkmcdvey.assumeExternalTargets(editor.settings);
|
||||
var insertLink = $_68cwlgg0jkmcdvff.link(editor, attachState);
|
||||
var removeLink = $_68cwlgg0jkmcdvff.unlink(editor);
|
||||
var resultData = global$4.extend({}, data, e.data);
|
||||
var href = resultData.href;
|
||||
if (!href) {
|
||||
removeLink();
|
||||
return;
|
||||
}
|
||||
if (!onlyText || resultData.text === initialText) {
|
||||
delete resultData.text;
|
||||
}
|
||||
if (href.indexOf('@') > 0 && href.indexOf('//') === -1 && href.indexOf('mailto:') === -1) {
|
||||
delayedConfirm(editor, 'The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?', function (state) {
|
||||
if (state) {
|
||||
resultData.href = 'mailto:' + href;
|
||||
}
|
||||
insertLink(resultData);
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (assumeExternalTargets === true && !/^\w+:/i.test(href) || assumeExternalTargets === false && /^\s*www[\.|\d\.]/i.test(href)) {
|
||||
delayedConfirm(editor, 'The URL you entered seems to be an external link. Do you want to add the required http:// prefix?', function (state) {
|
||||
if (state) {
|
||||
resultData.href = 'http://' + href;
|
||||
}
|
||||
insertLink(resultData);
|
||||
});
|
||||
return;
|
||||
}
|
||||
insertLink(resultData);
|
||||
}
|
||||
});
|
||||
};
|
||||
var open$1 = function (editor) {
|
||||
createLinkList(editor, showDialog);
|
||||
};
|
||||
var $_botga4g2jkmcdvfj = { open: open$1 };
|
||||
|
||||
var getLink = function (editor, elm) {
|
||||
return editor.dom.getParent(elm, 'a[href]');
|
||||
};
|
||||
var getSelectedLink = function (editor) {
|
||||
return getLink(editor, editor.selection.getStart());
|
||||
};
|
||||
var getHref = function (elm) {
|
||||
var href = elm.getAttribute('data-mce-href');
|
||||
return href ? href : elm.getAttribute('href');
|
||||
};
|
||||
var isContextMenuVisible = function (editor) {
|
||||
var contextmenu = editor.plugins.contextmenu;
|
||||
return contextmenu ? contextmenu.isContextMenuVisible() : false;
|
||||
};
|
||||
var hasOnlyAltModifier = function (e) {
|
||||
return e.altKey === true && e.shiftKey === false && e.ctrlKey === false && e.metaKey === false;
|
||||
};
|
||||
var gotoLink = function (editor, a) {
|
||||
if (a) {
|
||||
var href = getHref(a);
|
||||
if (/^#/.test(href)) {
|
||||
var targetEl = editor.$(href);
|
||||
if (targetEl.length) {
|
||||
editor.selection.scrollIntoView(targetEl[0], true);
|
||||
}
|
||||
} else {
|
||||
$_eajedefwjkmcdvf1.open(a.href);
|
||||
}
|
||||
}
|
||||
};
|
||||
var openDialog = function (editor) {
|
||||
return function () {
|
||||
$_botga4g2jkmcdvfj.open(editor);
|
||||
};
|
||||
};
|
||||
var gotoSelectedLink = function (editor) {
|
||||
return function () {
|
||||
gotoLink(editor, getSelectedLink(editor));
|
||||
};
|
||||
};
|
||||
var leftClickedOnAHref = function (editor) {
|
||||
return function (elm) {
|
||||
var sel, rng, node;
|
||||
if ($_6v02umfvjkmcdvey.hasContextToolbar(editor.settings) && !isContextMenuVisible(editor) && $_68cwlgg0jkmcdvff.isLink(elm)) {
|
||||
sel = editor.selection;
|
||||
rng = sel.getRng();
|
||||
node = rng.startContainer;
|
||||
if (node.nodeType === 3 && sel.isCollapsed() && rng.startOffset > 0 && rng.startOffset < node.data.length) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
};
|
||||
var setupGotoLinks = function (editor) {
|
||||
editor.on('click', function (e) {
|
||||
var link = getLink(editor, e.target);
|
||||
if (link && global$1.metaKeyPressed(e)) {
|
||||
e.preventDefault();
|
||||
gotoLink(editor, link);
|
||||
}
|
||||
});
|
||||
editor.on('keydown', function (e) {
|
||||
var link = getSelectedLink(editor);
|
||||
if (link && e.keyCode === 13 && hasOnlyAltModifier(e)) {
|
||||
e.preventDefault();
|
||||
gotoLink(editor, link);
|
||||
}
|
||||
});
|
||||
};
|
||||
var toggleActiveState = function (editor) {
|
||||
return function () {
|
||||
var self = this;
|
||||
editor.on('nodechange', function (e) {
|
||||
self.active(!editor.readonly && !!$_68cwlgg0jkmcdvff.getAnchorElement(editor, e.element));
|
||||
});
|
||||
};
|
||||
};
|
||||
var toggleViewLinkState = function (editor) {
|
||||
return function () {
|
||||
var self = this;
|
||||
var toggleVisibility = function (e) {
|
||||
if ($_68cwlgg0jkmcdvff.hasLinks(e.parents)) {
|
||||
self.show();
|
||||
} else {
|
||||
self.hide();
|
||||
}
|
||||
};
|
||||
if (!$_68cwlgg0jkmcdvff.hasLinks(editor.dom.getParents(editor.selection.getStart()))) {
|
||||
self.hide();
|
||||
}
|
||||
editor.on('nodechange', toggleVisibility);
|
||||
self.on('remove', function () {
|
||||
editor.off('nodechange', toggleVisibility);
|
||||
});
|
||||
};
|
||||
};
|
||||
var $_dtnf6hftjkmcdvev = {
|
||||
openDialog: openDialog,
|
||||
gotoSelectedLink: gotoSelectedLink,
|
||||
leftClickedOnAHref: leftClickedOnAHref,
|
||||
setupGotoLinks: setupGotoLinks,
|
||||
toggleActiveState: toggleActiveState,
|
||||
toggleViewLinkState: toggleViewLinkState
|
||||
};
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('mceLink', $_dtnf6hftjkmcdvev.openDialog(editor));
|
||||
};
|
||||
var $_bp9jsufsjkmcdveu = { register: register };
|
||||
|
||||
var setup = function (editor) {
|
||||
editor.addShortcut('Meta+K', '', $_dtnf6hftjkmcdvev.openDialog(editor));
|
||||
};
|
||||
var $_7nese6g5jkmcdvfo = { setup: setup };
|
||||
|
||||
var setupButtons = function (editor) {
|
||||
editor.addButton('link', {
|
||||
active: false,
|
||||
icon: 'link',
|
||||
tooltip: 'Insert/edit link',
|
||||
onclick: $_dtnf6hftjkmcdvev.openDialog(editor),
|
||||
onpostrender: $_dtnf6hftjkmcdvev.toggleActiveState(editor)
|
||||
});
|
||||
editor.addButton('unlink', {
|
||||
active: false,
|
||||
icon: 'unlink',
|
||||
tooltip: 'Remove link',
|
||||
onclick: $_68cwlgg0jkmcdvff.unlink(editor),
|
||||
onpostrender: $_dtnf6hftjkmcdvev.toggleActiveState(editor)
|
||||
});
|
||||
if (editor.addContextToolbar) {
|
||||
editor.addButton('openlink', {
|
||||
icon: 'newtab',
|
||||
tooltip: 'Open link',
|
||||
onclick: $_dtnf6hftjkmcdvev.gotoSelectedLink(editor)
|
||||
});
|
||||
}
|
||||
};
|
||||
var setupMenuItems = function (editor) {
|
||||
editor.addMenuItem('openlink', {
|
||||
text: 'Open link',
|
||||
icon: 'newtab',
|
||||
onclick: $_dtnf6hftjkmcdvev.gotoSelectedLink(editor),
|
||||
onPostRender: $_dtnf6hftjkmcdvev.toggleViewLinkState(editor),
|
||||
prependToContext: true
|
||||
});
|
||||
editor.addMenuItem('link', {
|
||||
icon: 'link',
|
||||
text: 'Link',
|
||||
shortcut: 'Meta+K',
|
||||
onclick: $_dtnf6hftjkmcdvev.openDialog(editor),
|
||||
stateSelector: 'a[href]',
|
||||
context: 'insert',
|
||||
prependToContext: true
|
||||
});
|
||||
editor.addMenuItem('unlink', {
|
||||
icon: 'unlink',
|
||||
text: 'Remove link',
|
||||
onclick: $_68cwlgg0jkmcdvff.unlink(editor),
|
||||
stateSelector: 'a[href]'
|
||||
});
|
||||
};
|
||||
var setupContextToolbars = function (editor) {
|
||||
if (editor.addContextToolbar) {
|
||||
editor.addContextToolbar($_dtnf6hftjkmcdvev.leftClickedOnAHref(editor), 'openlink | link unlink');
|
||||
}
|
||||
};
|
||||
var $_80dwb6g6jkmcdvfp = {
|
||||
setupButtons: setupButtons,
|
||||
setupMenuItems: setupMenuItems,
|
||||
setupContextToolbars: setupContextToolbars
|
||||
};
|
||||
|
||||
global.add('link', function (editor) {
|
||||
$_80dwb6g6jkmcdvfp.setupButtons(editor);
|
||||
$_80dwb6g6jkmcdvfp.setupMenuItems(editor);
|
||||
$_80dwb6g6jkmcdvfp.setupContextToolbars(editor);
|
||||
$_dtnf6hftjkmcdvev.setupGotoLinks(editor);
|
||||
$_bp9jsufsjkmcdveu.register(editor);
|
||||
$_7nese6g5jkmcdvfo.setup(editor);
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
||||
@@ -0,0 +1,7 @@
|
||||
// Exports the "lists" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/lists')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/lists'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,7 @@
|
||||
// Exports the "media" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/media')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/media'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,7 @@
|
||||
// Exports the "nonbreaking" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/nonbreaking')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/nonbreaking'
|
||||
require('./plugin.js');
|
||||
@@ -0,0 +1,85 @@
|
||||
(function () {
|
||||
var nonbreaking = (function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var stringRepeat = function (string, repeats) {
|
||||
var str = '';
|
||||
for (var index = 0; index < repeats; index++) {
|
||||
str += string;
|
||||
}
|
||||
return str;
|
||||
};
|
||||
var isVisualCharsEnabled = function (editor) {
|
||||
return editor.plugins.visualchars ? editor.plugins.visualchars.isEnabled() : false;
|
||||
};
|
||||
var insertNbsp = function (editor, times) {
|
||||
var nbsp = isVisualCharsEnabled(editor) ? '<span class="mce-nbsp"> </span>' : ' ';
|
||||
editor.insertContent(stringRepeat(nbsp, times));
|
||||
editor.dom.setAttrib(editor.dom.select('span.mce-nbsp'), 'data-mce-bogus', '1');
|
||||
};
|
||||
var $_b02pxphtjkmcdvmj = { insertNbsp: insertNbsp };
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('mceNonBreaking', function () {
|
||||
$_b02pxphtjkmcdvmj.insertNbsp(editor, 1);
|
||||
});
|
||||
};
|
||||
var $_591usdhsjkmcdvmh = { register: register };
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.VK');
|
||||
|
||||
var getKeyboardSpaces = function (editor) {
|
||||
var spaces = editor.getParam('nonbreaking_force_tab', 0);
|
||||
if (typeof spaces === 'boolean') {
|
||||
return spaces === true ? 3 : 0;
|
||||
} else {
|
||||
return spaces;
|
||||
}
|
||||
};
|
||||
var $_1juuvohwjkmcdvml = { getKeyboardSpaces: getKeyboardSpaces };
|
||||
|
||||
var setup = function (editor) {
|
||||
var spaces = $_1juuvohwjkmcdvml.getKeyboardSpaces(editor);
|
||||
if (spaces > 0) {
|
||||
editor.on('keydown', function (e) {
|
||||
if (e.keyCode === global$1.TAB && !e.isDefaultPrevented()) {
|
||||
if (e.shiftKey) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
$_b02pxphtjkmcdvmj.insertNbsp(editor, spaces);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
var $_aplzkyhujkmcdvmk = { setup: setup };
|
||||
|
||||
var register$1 = function (editor) {
|
||||
editor.addButton('nonbreaking', {
|
||||
title: 'Nonbreaking space',
|
||||
cmd: 'mceNonBreaking'
|
||||
});
|
||||
editor.addMenuItem('nonbreaking', {
|
||||
icon: 'nonbreaking',
|
||||
text: 'Nonbreaking space',
|
||||
cmd: 'mceNonBreaking',
|
||||
context: 'insert'
|
||||
});
|
||||
};
|
||||
var $_cb0tvihxjkmcdvmm = { register: register$1 };
|
||||
|
||||
global.add('nonbreaking', function (editor) {
|
||||
$_591usdhsjkmcdvmh.register(editor);
|
||||
$_cb0tvihxjkmcdvmm.register(editor);
|
||||
$_aplzkyhujkmcdvmk.setup(editor);
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
||||
@@ -0,0 +1 @@
|
||||
!function(){"use strict";var n=tinymce.util.Tools.resolve("tinymce.PluginManager"),i=function(n,e){var t,i=(t=n).plugins.visualchars&&t.plugins.visualchars.isEnabled()?'<span class="mce-nbsp"> </span>':" ";n.insertContent(function(n,e){for(var t="",i=0;i<e;i++)t+=n;return t}(i,e)),n.dom.setAttrib(n.dom.select("span.mce-nbsp"),"data-mce-bogus","1")},e=function(n){n.addCommand("mceNonBreaking",function(){i(n,1)})},o=tinymce.util.Tools.resolve("tinymce.util.VK"),a=function(n){var e=n.getParam("nonbreaking_force_tab",0);return"boolean"==typeof e?!0===e?3:0:e},t=function(e){var t=a(e);0<t&&e.on("keydown",function(n){if(n.keyCode===o.TAB&&!n.isDefaultPrevented()){if(n.shiftKey)return;n.preventDefault(),n.stopImmediatePropagation(),i(e,t)}})},r=function(n){n.addButton("nonbreaking",{title:"Nonbreaking space",cmd:"mceNonBreaking"}),n.addMenuItem("nonbreaking",{icon:"nonbreaking",text:"Nonbreaking space",cmd:"mceNonBreaking",context:"insert"})};n.add("nonbreaking",function(n){e(n),r(n),t(n)})}();
|
||||
@@ -0,0 +1,7 @@
|
||||
// Exports the "noneditable" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/noneditable')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/noneditable'
|
||||
require('./plugin.js');
|
||||