Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
b9aac118aa
@ -76,9 +76,9 @@ script:
|
||||
# - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml --coverage-text test/phpunit/AllTests.php
|
||||
# - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml --coverage-text test/phpunit/BuildDocTest.php
|
||||
# - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/WebservicesOtherTest.php
|
||||
# - phpcs --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ .
|
||||
# - phpcs --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ htdocs/core/class/dolgraph.class.php
|
||||
- phpcs --warning-severity=0 -s --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ .
|
||||
- phpcs --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ .
|
||||
# - phpcs --warning-severity=0 -s --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ .
|
||||
- phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
||||
|
||||
after_script:
|
||||
|
||||
38
ChangeLog
38
ChangeLog
@ -6,8 +6,8 @@ English Dolibarr ChangeLog
|
||||
For users:
|
||||
- New: Add hidden option BANK_DISABLE_DIRECT_INPUT.
|
||||
- New: More options to select status of users into select user list.
|
||||
- New: [ task #862 ] Add ODT on shipments
|
||||
- New: [ task #149 ] Add # of notes and attachments in tabs
|
||||
- New: [ task #862 ] Add ODT on shipments.
|
||||
- New: [ task #149 ] Add # of notes and attachments in tabs.
|
||||
- New: Can edit customer ref at eny time.
|
||||
- New: [ task #877 ] Reorganize menus.
|
||||
- New: [ task #858 ] Holiday module: note on manual holiday assignation.
|
||||
@ -40,21 +40,23 @@ For users:
|
||||
- New: Add Maghreb regions and departments.
|
||||
- New: A more responsive desgin for statistic box of home page.
|
||||
- Qual: Implement same rule for return value of all command line scripts (0 when success, <>0 if error).
|
||||
- New: [ task #1005 ] Adapting to Spanish legislation bill numbering
|
||||
- New: [ task #1011 ] Now supplier order and invoice deal with payment terms and mode
|
||||
- New: [ task #1014 ] Add option to recursivly add parent category
|
||||
- New: [ task #1016 ] Can define a specific numbering for deposits
|
||||
- New: [ task #918 ] Stock replenishment
|
||||
- Fix: [ bug #992 ] Proforma invoices don't have a separated numeric count
|
||||
- New: Add pdf link into supplier invoice list and supplier order list
|
||||
- New: Genrate auto the PDF for supplier invoice
|
||||
- New: Add category into filter webservice thirdparty method getListOfThirdParties
|
||||
- New: Allow to define margin or mark rate during quoting, ordering, invoicing
|
||||
- New: User permissions on margin module
|
||||
- New: Add ref supplier into muscadet model
|
||||
- New: [ task #1005 ] Adapting to Spanish legislation bill numbering.
|
||||
- New: [ task #1011 ] Now supplier order and invoice deal with payment terms and mode.
|
||||
- New: [ task #1014 ] Add option to recursivly add parent category.
|
||||
- New: [ task #1016 ] Can define a specific numbering for deposits.
|
||||
- New: [ task #918 ] Stock replenishment.
|
||||
- Fix: [ bug #992 ] Proforma invoices don't have a separated numeric count.
|
||||
- New: Add pdf link into supplier invoice list and supplier order list.
|
||||
- New: Genrate auto the PDF for supplier invoice.
|
||||
- New: Add category into filter webservice thirdparty method getListOfThirdParties.
|
||||
- New: Allow to define margin or mark rate during quoting, ordering, invoicing.
|
||||
- New: User permissions on margin module.
|
||||
- New: Add ref supplier into muscadet model.
|
||||
- New: Can use tag {mm} before {yy} even when there is a reset into numbering masks.
|
||||
- New: [ task #1060 ] Register fields localtax(1|2)_type into details tables
|
||||
|
||||
- New: [ task #1060 ] Register fields localtax(1|2)_type into details tables.
|
||||
- New: [ task #923 ] Localtax support for ODT templates.
|
||||
- New: [ task #90 ] Barcode search.
|
||||
|
||||
For translators:
|
||||
- Qual: Normalized sort order of all languages files with english reference files.
|
||||
- New: Add language code files for South Africa, France new caledonia.
|
||||
@ -103,6 +105,8 @@ All content added must be tagged by a '<div>' with css class="login_block_elem"
|
||||
this was not a good pratice, since object->id is already known, there is no need to provide id as
|
||||
parameter. All methods addline in this case were modified to remove this parameter.
|
||||
|
||||
4) Method ->classer_facturee() is deprecated. It must be replace with ->classifyBilled().
|
||||
|
||||
|
||||
***** ChangeLog for 3.4.1 compared to 3.4.0 *****
|
||||
Fix: Display buying price on line edit when no supplier price is defined
|
||||
@ -127,7 +131,7 @@ Fix: Edit propal line was losing product supplier price id
|
||||
Fix: Delete linked element to supplier invoice when deleted
|
||||
Fix: [ bug #1061 ] Bad info shipped products
|
||||
Fix: [ bug #1062 ] Documents lost in propals and contracts validating
|
||||
Fix: Supplier price displayed on document lines didnt take discount
|
||||
Fix: Supplier price displayed on document lines and margin infos didnt take discount
|
||||
Qual: Add travis-ci integration
|
||||
|
||||
|
||||
|
||||
@ -10,9 +10,9 @@ with format .DEB (for Debian, Ubuntu, ...).
|
||||
|
||||
# To build a debian package, you need first
|
||||
# With Ubuntu 12.04
|
||||
# apt-get install debhelper dpkg-source gpg lintian git-buildpackage pkg-php-tools schroot sbuild
|
||||
# apt-get install debhelper dpkg-source gpg lintian git-buildpackage pkg-php-tools schroot sbuild dh-linktree dh-make-php
|
||||
# With Debian 7
|
||||
# apt-get install debhelper dpkg gnupg lintian git-buildpackage pkg-php-tools schroot sbuild
|
||||
# apt-get install debhelper dpkg gnupg lintian git-buildpackage pkg-php-tools schroot sbuild dh-linktree dh-make-php
|
||||
|
||||
|
||||
# To generate gpg key for email used into changelog
|
||||
@ -125,25 +125,29 @@ from origin/upstream and origin/pristine.
|
||||
* Staying into git root directory, run
|
||||
> git-import-orig -vv ../tcpdf_x.y.z+dfsg.orig.tar.xz
|
||||
|
||||
Note: If there was errors managed manually, you may need to make a git commit
|
||||
Note: If there was errors solved manually, you may need to make a git commit
|
||||
|
||||
* Add an entry into debian/changelog
|
||||
> dh "My comment" will add entry.
|
||||
For example: dch -v x.y.z-1 "New upstream release." for a new version
|
||||
|
||||
Warning: Date must have format reported by "date -R"
|
||||
Warning: Entry added here is used by next step. Name and email must match value into debian/control file.
|
||||
Warning: Name and email must match value into debian/control file (Entry added here is used by next step).
|
||||
|
||||
* We try to build package
|
||||
> rm -fr ../build-area
|
||||
> git-buildpackage -us -uc
|
||||
|
||||
Note: You can use git-buildpackage -us -uc --git-ignore-new if you want to test build with uncommited file
|
||||
|
||||
|
||||
* If package .deb is ok:
|
||||
Note: If there was errors managed manually, you may need to make a git commit but do not use option "amend" previous commit
|
||||
> git-buildpackage --git-tag
|
||||
> git push --all
|
||||
> git push --all ou git push origin --all
|
||||
> git push --tags
|
||||
|
||||
* Compilation par un développeur debian et envoi par
|
||||
* Compilation is then done by a debian developer and sent
|
||||
> sbuild ...
|
||||
> dput ...
|
||||
|
||||
@ -170,3 +174,41 @@ from git clone dir and make link to git.
|
||||
* If local branch upstream and pristine-tar does not exists, create it
|
||||
from origin/upstream and origin/pristine.
|
||||
|
||||
* If new upstream is available onto sourceforge, launch:
|
||||
> debian/get-orig-source.sh
|
||||
|
||||
* Staying into git root directory, run
|
||||
> git-import-orig -vv ../dolibarr-3.3.4.tgz
|
||||
|
||||
Note: If there was errors solved manually after get-orig-sources.sh, you may need to make a git commit
|
||||
|
||||
* Add an entry into debian/changelog
|
||||
> dh "My comment" will add entry.
|
||||
For example: dch -v x.y.z-1 "New upstream release." for a new version
|
||||
Then modify changelog to replace "unstable" with "UNRELEASED".
|
||||
|
||||
Warning: Date must have format reported by "date -R"
|
||||
Warning: Name and email must match value into debian/control file (Entry added here is used by next step).
|
||||
|
||||
* We try to build package
|
||||
> rm -fr ../build-area
|
||||
> git-buildpackage -us -uc
|
||||
|
||||
Note: You can use git-buildpackage -us -uc --git-ignore-new if you want to test build with uncommited file
|
||||
|
||||
* If package .deb is ok:
|
||||
Note: If there was errors managed manually, you may need to make a git commit but do not use option "amend" previous commit
|
||||
> git-buildpackage --git-tag
|
||||
> git push --all ou git push origin --all
|
||||
> git push --tags
|
||||
|
||||
* Compilation is then done by a debian developer and sent
|
||||
> sbuild ...
|
||||
> dput ...
|
||||
|
||||
* Go into page. You should see new package into unstable.
|
||||
http://packages.qa.debian.org/t/tcpdf.html
|
||||
|
||||
* Package will be into release when test will be moved as stable.
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
# run with
|
||||
# debian/get-orig-source.sh [x.y.z]
|
||||
# Scan for new official sources and download file
|
||||
# run with debian/get-orig-source.sh [x.y.z]
|
||||
|
||||
tmpdir=$(mktemp -d)
|
||||
echo "tmpdir = $tmpdir"
|
||||
@ -12,29 +12,12 @@ uscan --noconf --force-download --no-symlink --verbose --destdir=$tmpdir $uscan_
|
||||
|
||||
cd $tmpdir
|
||||
|
||||
tgzfile=$(echo *.tar.gz)
|
||||
version=$(echo "$tgzfile" | perl -pi -e 's/^dolibarr_//; s/\.zip$//; s/_/./g; s/\+nmu1//; s/$/+dfsg/;')
|
||||
|
||||
# Extract the zip file
|
||||
tar -xvf $tgzfile
|
||||
srcdir=$(find . -maxdepth 1 -mindepth 1 -type d | sed -e 's/\.\///')
|
||||
|
||||
if [ ! -d "$srcdir" ]; then
|
||||
echo "ERROR: Failed to identify the extracted directory in $tmpdir (got $srcdir)" >&2
|
||||
rm -rf $tmpdir
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Repack as tar.xz
|
||||
tar Jcf dolibarr_${version}.orig.tar.xz $srcdir
|
||||
tgzfile=$(echo *.tgz)
|
||||
version=$(echo "$tgzfile" | perl -pi -e 's/^dolibarr-//; s/\.tgz$//; s/_/./g; s/\+nmu1//; ')
|
||||
|
||||
cd - >/dev/null
|
||||
|
||||
if [ -e ../dolibarr_${version}.orig.tar.xz ]; then
|
||||
echo "Not overwriting ../dolibarr_${version}.orig.tar.xz";
|
||||
else
|
||||
echo "Created ../dolibarr_${version}.orig.tar.xz"
|
||||
mv $tmpdir/dolibarr_${version}.orig.tar.xz ../
|
||||
fi
|
||||
mv $tmpdir/dolibarr-${version}.tgz ../
|
||||
echo "File ../dolibarr-${version}.tgz is ready for git-import"
|
||||
|
||||
#rm -rf $tmpdir
|
||||
rm -rf $tmpdir
|
||||
|
||||
@ -2,4 +2,4 @@
|
||||
version=3
|
||||
|
||||
#http://sf.net/dolibarr/dolibarr-(.+)\.tgz
|
||||
http://www.dolibarr.org/files/stable/package_debian-ubuntu/dolibarr_(.+)\.tar\.gz
|
||||
http://www.dolibarr.org/files/stable/standard/dolibarr-(.+)\.tgz
|
||||
|
||||
@ -340,6 +340,7 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/template`; # Package not valid for most linux distributions (errors reported into compile.js). Package should be embed by modules to avoid problems.
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpmailer`; # Package not valid for most linux distributions (errors reported into file LICENSE). Package should be embed by modules to avoid problems.
|
||||
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/license.txt`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PDF`;
|
||||
|
||||
@ -31,5 +31,5 @@ How to have such a service ?
|
||||
Try to make "Add file" and select Remote URL and enter http://www.dolibarr.org/files/stable/package_rpm_generic/dolibarr-3.3.2-3.src.rpm
|
||||
|
||||
Then add into advanded - attributes
|
||||
OBS:Screenshots http://www.dolibarr.org/images/phocagallery/dolibarr_screenshot1.png
|
||||
OBS:QualityCategory Testing
|
||||
OBS:Screenshots http://www.dolibarr.org/images/dolibarr_screenshot1.png
|
||||
OBS:QualityCategory Testing
|
||||
|
||||
6
build/sitemap/README
Normal file
6
build/sitemap/README
Normal file
@ -0,0 +1,6 @@
|
||||
# Format of sitemap file is available at
|
||||
# http://www.sitemaps.org/protocol.html
|
||||
|
||||
# To build a sitemap from urllist-bing.txt, run
|
||||
# google-sitemapgen --config=config-bing.xml --testing
|
||||
|
||||
169
build/sitemap/config-bing.xml
Normal file
169
build/sitemap/config-bing.xml
Normal file
@ -0,0 +1,169 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
sitemap_gen.py example configuration script
|
||||
|
||||
This file specifies a set of sample input parameters for the
|
||||
sitemap_gen.py client.
|
||||
|
||||
You should copy this file into "config.xml" and modify it for
|
||||
your server.
|
||||
|
||||
|
||||
********************************************************* -->
|
||||
|
||||
|
||||
<!-- ** MODIFY **
|
||||
The "site" node describes your basic web site.
|
||||
|
||||
Required attributes:
|
||||
base_url - the top-level URL of the site being mapped
|
||||
store_into - the webserver path to the desired output file.
|
||||
This should end in '.xml' or '.xml.gz'
|
||||
(the script will create this file)
|
||||
|
||||
Optional attributes:
|
||||
verbose - an integer from 0 (quiet) to 3 (noisy) for
|
||||
how much diagnostic output the script gives
|
||||
suppress_search_engine_notify="1"
|
||||
- disables notifying search engines about the new map
|
||||
(same as the "testing" command-line argument.)
|
||||
default_encoding
|
||||
- names a character encoding to use for URLs and
|
||||
file paths. (Example: "UTF-8")
|
||||
-->
|
||||
<site
|
||||
base_url="http://wiki.dolibarr.org/"
|
||||
store_into="sitemap-wiki-bing.xml.gz"
|
||||
verbose="1"
|
||||
>
|
||||
|
||||
<!-- ********************************************************
|
||||
INPUTS
|
||||
|
||||
All the various nodes in this section control where the script
|
||||
looks to find URLs.
|
||||
|
||||
MODIFY or DELETE these entries as appropriate for your server.
|
||||
********************************************************* -->
|
||||
|
||||
<!-- ** MODIFY or DELETE **
|
||||
"url" nodes specify individual URLs to include in the map.
|
||||
|
||||
Required attributes:
|
||||
href - the URL
|
||||
|
||||
Optional attributes:
|
||||
lastmod - timestamp of last modification (ISO8601 format)
|
||||
changefreq - how often content at this URL is usually updated
|
||||
priority - value 0.0 to 1.0 of relative importance in your site
|
||||
-->
|
||||
<!--
|
||||
<url href="http://www.example.com/stats?q=name" />
|
||||
<url
|
||||
href="http://www.example.com/stats?q=age"
|
||||
lastmod="2004-11-14T01:00:00-07:00"
|
||||
changefreq="yearly"
|
||||
priority="0.3"
|
||||
/>
|
||||
-->
|
||||
|
||||
<!-- ** MODIFY or DELETE **
|
||||
"urllist" nodes name text files with lists of URLs.
|
||||
An example file "example_urllist.txt" is provided.
|
||||
|
||||
Required attributes:
|
||||
path - path to the file
|
||||
|
||||
Optional attributes:
|
||||
encoding - encoding of the file if not US-ASCII
|
||||
-->
|
||||
<urllist path="urllist-wiki.txt" encoding="UTF-8" />
|
||||
|
||||
<!-- ** MODIFY or DELETE **
|
||||
"directory" nodes tell the script to walk the file system
|
||||
and include all files and directories in the Sitemap.
|
||||
|
||||
Required attributes:
|
||||
path - path to begin walking from
|
||||
url - URL equivalent of that path
|
||||
|
||||
Optional attributes:
|
||||
default_file - name of the index or default file for directory URLs
|
||||
-->
|
||||
<!--
|
||||
<directory path="/var/www/icons" url="http://www.example.com/images/" />
|
||||
<directory
|
||||
path="/var/www/docroot"
|
||||
url="http://www.example.com/"
|
||||
default_file="index.html"
|
||||
/>
|
||||
-->
|
||||
|
||||
<!-- ** MODIFY or DELETE **
|
||||
"accesslog" nodes tell the script to scan webserver log files to
|
||||
extract URLs on your site. Both Common Logfile Format (Apache's default
|
||||
logfile) and Extended Logfile Format (IIS's default logfile) can be read.
|
||||
|
||||
Required attributes:
|
||||
path - path to the file
|
||||
|
||||
Optional attributes:
|
||||
encoding - encoding of the file if not US-ASCII
|
||||
-->
|
||||
<!--
|
||||
<accesslog path="/etc/httpd/logs/access.log" encoding="UTF-8" />
|
||||
<accesslog path="/etc/httpd/logs/access.log.0" encoding="UTF-8" />
|
||||
<accesslog path="/etc/httpd/logs/access.log.1.gz" encoding="UTF-8" />
|
||||
-->
|
||||
|
||||
<!-- ** MODIFY or DELETE **
|
||||
"sitemap" nodes tell the script to scan other Sitemap files. This can
|
||||
be useful to aggregate the results of multiple runs of this script into
|
||||
a single Sitemap.
|
||||
|
||||
Required attributes:
|
||||
path - path to the file
|
||||
-->
|
||||
<!--
|
||||
<sitemap path="/var/www/docroot/subpath/sitemap.xml" />
|
||||
-->
|
||||
|
||||
<!-- ********************************************************
|
||||
FILTERS
|
||||
|
||||
Filters specify wild-card patterns that the script compares
|
||||
against all URLs it finds. Filters can be used to exclude
|
||||
certain URLs from your Sitemap, for instance if you have
|
||||
hidden content that you hope the search engines don't find.
|
||||
|
||||
Filters can be either type="wildcard", which means standard
|
||||
path wildcards (* and ?) are used to compare against URLs,
|
||||
or type="regexp", which means regular expressions are used
|
||||
to compare.
|
||||
|
||||
Filters are applied in the order specified in this file.
|
||||
|
||||
An action="drop" filter causes exclusion of matching URLs.
|
||||
An action="pass" filter causes inclusion of matching URLs,
|
||||
shortcutting any other later filters that might also match.
|
||||
If no filter at all matches a URL, the URL will be included.
|
||||
Together you can build up fairly complex rules.
|
||||
|
||||
The default action is "drop".
|
||||
The default type is "wildcard".
|
||||
|
||||
You can MODIFY or DELETE these entries as appropriate for
|
||||
your site. However, unlike above, the example entries in
|
||||
this section are not contrived and may be useful to you as
|
||||
they are.
|
||||
********************************************************* -->
|
||||
|
||||
<!-- Exclude URLs that end with a '~' (IE: emacs backup files) -->
|
||||
<filter action="drop" type="wildcard" pattern="*~" />
|
||||
|
||||
<!-- Exclude URLs within UNIX-style hidden files or directories -->
|
||||
<filter action="drop" type="regexp" pattern="/\.[^/]*" />
|
||||
|
||||
<filter action="drop" type="regexp" pattern="title=" />
|
||||
|
||||
</site>
|
||||
1
build/sitemap/urllist-wiki.txt
Normal file
1
build/sitemap/urllist-wiki.txt
Normal file
@ -0,0 +1 @@
|
||||
http://wiki.dolibarr.org/
|
||||
@ -37,8 +37,6 @@ htdocs/customleave
|
||||
htdocs/customgoogle
|
||||
htdocs/document
|
||||
htdocs/documents
|
||||
htdocs/includes/ckeditor/_source
|
||||
htdocs/includes/ckeditor/*_source.js
|
||||
htdocs/includes/fckeditor/_samples
|
||||
htdocs/includes/fckeditor/_testcases
|
||||
htdocs/includes/nusoap/samples
|
||||
|
||||
@ -56,8 +56,8 @@ $contactid=GETPOST('contactid','int');
|
||||
$socid = GETPOST('socid','int');
|
||||
$id = GETPOST('id','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user,'societe',$id,'&societe');
|
||||
//$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', '', 'id');
|
||||
$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', '', 'id');
|
||||
if ($user->societe_id && $socid) $result = restrictedArea($user,'societe',$socid);
|
||||
|
||||
$error=GETPOST("error");
|
||||
$mesg='';
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -115,9 +116,13 @@ if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid;
|
||||
if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
||||
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ;
|
||||
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
||||
if ($search_nom) $sql.= " AND s.nom LIKE '%".$db->escape($search_nom)."%'";
|
||||
if ($search_nom) {
|
||||
$sql .= natural_search('s.nom', $search_nom);
|
||||
}
|
||||
if ($search_zipcode) $sql.= " AND s.zip LIKE '".$db->escape($search_zipcode)."%'";
|
||||
if ($search_town) $sql.= " AND s.town LIKE '%".$db->escape($search_town)."%'";
|
||||
if ($search_town) {
|
||||
$sql .= natural_search('s.town', $search_town);
|
||||
}
|
||||
if ($search_code) $sql.= " AND s.code_client LIKE '%".$db->escape($search_code)."%'";
|
||||
if ($search_compta) $sql.= " AND s.code_compta LIKE '%".$db->escape($search_compta)."%'";
|
||||
// Insert sale filter
|
||||
|
||||
@ -1807,6 +1807,7 @@ class Propal extends CommonObject
|
||||
* Class invoiced the Propal
|
||||
*
|
||||
* @return int <0 si ko, >0 si ok
|
||||
* @deprecated
|
||||
*/
|
||||
function classer_facturee()
|
||||
{
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -160,21 +161,17 @@ if (! $user->rights->societe->client->voir && ! $socid) //restriction
|
||||
{
|
||||
$sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
}
|
||||
if ($search_town) //restriction
|
||||
{
|
||||
$sql.= " AND s.town LIKE '%".$db->escape(trim($search_town))."%'";
|
||||
if ($search_town) {//restriction
|
||||
$sql .= natural_search('s.town', $search_town);
|
||||
}
|
||||
if ($search_ref)
|
||||
{
|
||||
$sql.= " AND p.ref LIKE '%".$db->escape(trim($search_ref))."%'";
|
||||
if ($search_ref) {
|
||||
$sql .= natural_search('p.ref', $search_ref);
|
||||
}
|
||||
if ($search_refcustomer)
|
||||
{
|
||||
$sql.= " AND p.ref_client LIKE '%".$db->escape(trim($search_refcustomer))."%'";
|
||||
if ($search_refcustomer) {
|
||||
$sql .= natural_search('p.ref_client', $search_refcustomer);
|
||||
}
|
||||
if ($search_societe)
|
||||
{
|
||||
$sql.= " AND s.nom LIKE '%".$db->escape(trim($search_societe))."%'";
|
||||
if ($search_societe) {
|
||||
$sql .= natural_search('s.nom', $search_societe);
|
||||
}
|
||||
if ($search_author)
|
||||
{
|
||||
@ -184,7 +181,13 @@ if ($search_montant_ht)
|
||||
{
|
||||
$sql.= " AND p.total_ht='".$db->escape(price2num(trim($search_montant_ht)))."'";
|
||||
}
|
||||
if ($sall) $sql.= " AND (s.nom LIKE '%".$db->escape($sall)."%' OR p.note_private LIKE '%".$db->escape($sall)."%' OR pd.description LIKE '%".$db->escape($sall)."%')";
|
||||
if ($sall) {
|
||||
/*$scrit = explode(' ', $sall);
|
||||
foreach ($scrit as $crit) {
|
||||
$sql.= " AND (s.nom LIKE '%".$db->escape($crit)."%' OR p.note LIKE '%".$db->escape($crit)."%' OR pd.description LIKE '%".$db->escape($crit)."%')";
|
||||
}*/
|
||||
$sql .= natural_search(array('s.nom', 'p.note_private', 'pd.description'), $sall);
|
||||
}
|
||||
if ($socid) $sql.= ' AND s.rowid = '.$socid;
|
||||
if ($viewstatut <> '')
|
||||
{
|
||||
@ -289,7 +292,7 @@ if ($result)
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" size="16" name="search_societe" value="'.$search_societe.'">';
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '<td class="liste_titre"><input class="flat" type="text" size="16" name="search_town" value="'.$search_town.'"></td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="10" type="text" name="search_refcustomer" value="'.$search_refcustomer.'">';
|
||||
print '</td>';
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -193,10 +194,16 @@ if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid;
|
||||
if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
||||
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ;
|
||||
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
||||
if ($search_nom) $sql .= " AND s.nom LIKE '%".$db->escape(strtolower($search_nom))."%'";
|
||||
if ($search_nom) {
|
||||
$sql .= natural_search('s.nom', $search_nom);
|
||||
}
|
||||
if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape(strtolower($search_zipcode))."%'";
|
||||
if ($search_town) $sql .= " AND s.town LIKE '%".$db->escape(strtolower($search_town))."%'";
|
||||
if ($search_state) $sql .= " AND d.nom LIKE '%".$db->escape(strtolower($search_state))."%'";
|
||||
if ($search_town) {
|
||||
$sql .= natural_search('s.town', $search_town);
|
||||
}
|
||||
if ($search_state) {
|
||||
$sql .= natural_search('d.nom', $search_state);
|
||||
}
|
||||
if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'";
|
||||
// Insert levels filters
|
||||
if ($search_levels)
|
||||
@ -208,9 +215,8 @@ if ($search_sale)
|
||||
{
|
||||
$sql .= " AND sc.fk_user = ".$db->escape($search_sale);
|
||||
}
|
||||
if ($socname)
|
||||
{
|
||||
$sql .= " AND s.nom LIKE '%".$db->escape($socname)."%'";
|
||||
if ($socname) {
|
||||
$sql .= natural_search('s.nom', $search_nom);
|
||||
$sortfield = "s.nom";
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
|
||||
@ -2222,6 +2222,7 @@ class Commande extends CommonOrder
|
||||
* Classify the order as invoiced
|
||||
*
|
||||
* @return int <0 if ko, >0 if ok
|
||||
* @deprecated
|
||||
*/
|
||||
function classer_facturee()
|
||||
{
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -125,13 +126,12 @@ $sql.= ' WHERE c.fk_soc = s.rowid';
|
||||
$sql.= ' AND c.entity = '.$conf->entity;
|
||||
if ($socid) $sql.= ' AND s.rowid = '.$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($sref)
|
||||
{
|
||||
$sql.= " AND c.ref LIKE '%".$db->escape($sref)."%'";
|
||||
if ($sref) {
|
||||
$sql .= natural_search('c.ref', $sref);
|
||||
}
|
||||
if ($sall)
|
||||
{
|
||||
$sql.= " AND (c.ref LIKE '%".$db->escape($sall)."%' OR c.note LIKE '%".$db->escape($sall)."%')";
|
||||
$sql .= natural_search(array('c.ref', 'c.note_private'), $sall);
|
||||
}
|
||||
if ($viewstatut <> '')
|
||||
{
|
||||
@ -187,7 +187,7 @@ else if ($deliveryyear > 0)
|
||||
}
|
||||
if (!empty($snom))
|
||||
{
|
||||
$sql.= ' AND s.nom LIKE \'%'.$db->escape($snom).'%\'';
|
||||
$sql .= natural_search('s.nom', $snom);
|
||||
}
|
||||
if (!empty($sref_client))
|
||||
{
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Andreu Bisquerra Gaya <jove@bisquerra.com>
|
||||
@ -96,9 +96,8 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
}
|
||||
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
|
||||
$langs->load('bills');
|
||||
$langs->load('products');
|
||||
$langs->load('main');
|
||||
@ -127,7 +126,7 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
|
||||
$lineid = GETPOST('lineid','int');
|
||||
$userid = GETPOST('userid','int');
|
||||
$search_ref = GETPOST('sf_ref')?GETPOST('sf_ref'):GETPOST('search_ref');
|
||||
$closeOrders = GETPOST('autocloseorders') != '' ? true : false;
|
||||
$closeOrders = GETPOST('autocloseorders') ? true : false;
|
||||
|
||||
// Security check
|
||||
$fieldid = GETPOST('ref','alpha')?'facnumber':'rowid';
|
||||
@ -214,8 +213,9 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
|
||||
$result=$objectsrc->fetch($orders_id[$ii]);
|
||||
if ($result > 0)
|
||||
{
|
||||
if($closeOrders) {
|
||||
$objectsrc->classer_facturee();
|
||||
if ($closeOrders)
|
||||
{
|
||||
$objectsrc->classifyBilled();
|
||||
$objectsrc->setStatut(3);
|
||||
}
|
||||
$lines = $objectsrc->lines;
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -75,11 +76,11 @@ if (trim($search_ref) != '')
|
||||
}
|
||||
if (trim($search_company) != '')
|
||||
{
|
||||
$sql.= ' AND d.societe LIKE \'%'.$db->escape(trim($search_company)) . '%\'';
|
||||
$sql .= natural_search('d.societe', $search_company);
|
||||
}
|
||||
if (trim($search_name) != '')
|
||||
{
|
||||
$sql.= ' AND d.lastname LIKE \'%'.$db->escape(trim($search_name)) . '%\' OR d.firstname LIKE \'%'.$db->escape(trim($search_name)) . '%\'';
|
||||
$sql .= natural_search(array('d.lastname', 'd.firstname'), $search_name);
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
@ -95,7 +95,8 @@ class FactureRec extends Facture
|
||||
|
||||
// Clean parameters
|
||||
$this->titre=trim($this->titre);
|
||||
|
||||
$this->usenewprice=empty($this->usenewprice)?0:$this->usenewprice;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Charge facture modele
|
||||
@ -122,9 +123,9 @@ class FactureRec extends Facture
|
||||
$sql.= ", usenewprice";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= "'".$this->titre."'";
|
||||
$sql.= ", '".$facsrc->socid."'";
|
||||
$sql.= ", ".$facsrc->socid;
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", ".$this->db->idate($now);
|
||||
$sql.= ", '".$this->db->idate($now)."'";
|
||||
$sql.= ", ".(!empty($facsrc->amount)?$facsrc->amount:'0');
|
||||
$sql.= ", ".(!empty($facsrc->remise)?$this->remise:'0');
|
||||
$sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
|
||||
@ -133,7 +134,7 @@ class FactureRec extends Facture
|
||||
$sql.= ", ".(! empty($facsrc->fk_project)?"'".$facsrc->fk_project."'":"null");
|
||||
$sql.= ", '".$facsrc->cond_reglement_id."'";
|
||||
$sql.= ", '".$facsrc->mode_reglement_id."'";
|
||||
$sql.= ", '".$this->usenewprice."'";
|
||||
$sql.= ", ".$this->usenewprice;
|
||||
$sql.= ")";
|
||||
|
||||
if ($this->db->query($sql))
|
||||
@ -575,5 +576,28 @@ class FactureRec extends Facture
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialise an instance with random values.
|
||||
* Used to build previews or test instances.
|
||||
* id must be 0 if object instance is a specimen.
|
||||
*
|
||||
* @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines
|
||||
* @return void
|
||||
*/
|
||||
function initAsSpecimen($option='')
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
|
||||
$now=dol_now();
|
||||
$arraynow=dol_getdate($now);
|
||||
$nownotime=dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']);
|
||||
|
||||
parent::initAsSpecimen($option);
|
||||
|
||||
$this->usenewprice = 1;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -174,11 +175,11 @@ if ($filtre)
|
||||
}
|
||||
if ($search_ref)
|
||||
{
|
||||
$sql.= ' AND f.facnumber LIKE \'%'.$db->escape(trim($search_ref)).'%\'';
|
||||
$sql .= natural_search('f.facnumber', $search_ref);
|
||||
}
|
||||
if ($search_societe)
|
||||
{
|
||||
$sql.= ' AND s.nom LIKE \'%'.$db->escape(trim($search_societe)).'%\'';
|
||||
$sql .= natural_search('s.nom', $search_societe);
|
||||
}
|
||||
if ($search_montant_ht)
|
||||
{
|
||||
@ -219,7 +220,7 @@ if (! $sall)
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.= ' AND (s.nom LIKE \'%'.$db->escape($sall).'%\' OR f.facnumber LIKE \'%'.$db->escape($sall).'%\' OR f.note LIKE \'%'.$db->escape($sall).'%\' OR fd.description LIKE \'%'.$db->escape($sall).'%\')';
|
||||
$sql .= natural_search(array('s.nom', 'f.facnumber', 'f.note_public', 'fd.description'), $sall);
|
||||
}
|
||||
$sql.= ' ORDER BY ';
|
||||
$listfield=explode(',',$sortfield);
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -112,7 +113,7 @@ else
|
||||
if (GETPOST("search_account") > 0) $sql .=" AND b.fk_account=".GETPOST("search_account",'int');
|
||||
if (GETPOST("search_paymenttype") != "") $sql .=" AND c.code='".GETPOST("search_paymenttype")."'";
|
||||
if (GETPOST("search_amount")) $sql .=" AND p.amount=".price2num(GETPOST("search_amount"));
|
||||
if (GETPOST("search_company")) $sql .=" AND s.nom LIKE '%".$db->escape(GETPOST("search_company"))."%'";
|
||||
if (GETPOST("search_company")) $sql .= natural_search('s.nom', GETPOST('search_company'));
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
@ -14,9 +14,10 @@
|
||||
// dolibarr_main_url_root
|
||||
// This parameter defines the root URL of your Dolibarr index.php page.
|
||||
// It must link to the htdocs directory htdocs.
|
||||
// In most cases, this is autodetected but it still required to show full
|
||||
// url bookmarks for some services (ie: agenda rss export url, ...) or
|
||||
// when using Apache dir aliases (autodetect fails).
|
||||
// In most cases, this is autodetected but it's still required
|
||||
// * to show full url bookmarks for some services (ie: agenda rss export url, ...)
|
||||
// * or when using Apache dir aliases (autodetect fails)
|
||||
// * or when using nginx (autodetect fails)
|
||||
// Examples:
|
||||
// $dolibarr_main_url_root='http://localhost';
|
||||
// $dolibarr_main_url_root='http://mydolibarrvirtualhost';
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -148,21 +149,17 @@ else
|
||||
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ;
|
||||
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
||||
|
||||
if ($search_lastname) // filter on lastname
|
||||
{
|
||||
$sql .= " AND p.lastname LIKE '%".$db->escape($search_lastname)."%'";
|
||||
if ($search_lastname) { // filter on lastname
|
||||
$sql .= natural_search('p.lastname', $search_lastname);
|
||||
}
|
||||
if ($search_firstname) // filter on firstname
|
||||
{
|
||||
$sql .= " AND p.firstname LIKE '%".$db->escape($search_firstname)."%'";
|
||||
if ($search_firstname) { // filter on firstname
|
||||
$sql .= natural_search('p.firstname', $search_firstname);
|
||||
}
|
||||
if ($search_societe) // filtre sur la societe
|
||||
{
|
||||
$sql .= " AND s.nom LIKE '%".$db->escape($search_societe)."%'";
|
||||
if ($search_societe) { // filtre sur la societe
|
||||
$sql .= natural_search('s.nom', $search_societe);
|
||||
}
|
||||
if (strlen($search_poste)) // filtre sur la societe
|
||||
{
|
||||
$sql .= " AND p.poste LIKE '%".$db->escape($search_poste)."%'";
|
||||
if (strlen($search_poste)) { // filtre sur la societe
|
||||
$sql .= natural_search('p.poste', $search_poste);
|
||||
}
|
||||
if (strlen($search_phone))
|
||||
{
|
||||
@ -206,11 +203,7 @@ else if ($type == "p") // filtre sur type
|
||||
}
|
||||
if ($sall)
|
||||
{
|
||||
// For natural search
|
||||
$scrit = explode(' ', $sall);
|
||||
foreach ($scrit as $crit) {
|
||||
$sql .= " AND (p.lastname LIKE '%".$db->escape($crit)."%' OR p.firstname LIKE '%".$db->escape($crit)."%' OR p.email LIKE '%".$db->escape($crit)."%')";
|
||||
}
|
||||
$sql .= natural_search(array('p.lastname', 'p.firstname', 'p.email'), $sall);
|
||||
}
|
||||
if (! empty($socid))
|
||||
{
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -79,9 +80,15 @@ $sql.= " WHERE c.fk_soc = s.rowid ";
|
||||
$sql.= " AND c.entity = ".$conf->entity;
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($search_nom) $sql.= " AND s.nom LIKE '%".$db->escape($search_nom)."%'";
|
||||
if ($search_contract) $sql.= " AND (".(is_numeric($search_contract)?"c.rowid = ".$db->escape($search_contract)." OR ":'')." c.ref LIKE '%".$db->escape($search_contract)."%')";
|
||||
if ($sall) $sql.= " AND (s.nom LIKE '%".$db->escape($sall)."%' OR cd.label LIKE '%".$db->escape($sall)."%' OR cd.description LIKE '%".$db->escape($sall)."%')";
|
||||
if ($search_nom) {
|
||||
$sql .= natural_search('s.nom', $search_nom);
|
||||
}
|
||||
if ($search_contract) {
|
||||
$sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract);
|
||||
}
|
||||
if ($sall) {
|
||||
$sql .= natural_search(array('s.nom', 'cd.label', 'cd.description'), $sall);
|
||||
}
|
||||
$sql.= " GROUP BY c.rowid, c.ref, c.datec, c.date_contrat, c.statut,";
|
||||
$sql.= " s.nom, s.rowid";
|
||||
$sql.= " ORDER BY $sortfield $sortorder";
|
||||
|
||||
@ -247,10 +247,20 @@ abstract class CommonDocGenerator
|
||||
$array_key.'_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement),
|
||||
$array_key.'_payment_term_code'=>$object->cond_reglement_code,
|
||||
$array_key.'_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code)!='PaymentCondition'.$object->cond_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code):$object->cond_reglement),
|
||||
$array_key.'_total_ht'=>price($object->total_ht),
|
||||
$array_key.'_total_vat'=>price($object->total_tva),
|
||||
$array_key.'_total_ttc'=>price($object->total_ttc),
|
||||
$array_key.'_total_discount_ht' => price($object->getTotalDiscount()),
|
||||
|
||||
$array_key.'_total_ht_locale'=>price($object->total_ht,0,$outputlangs),
|
||||
$array_key.'_total_vat_locale'=>price($object->total_tva,0,$outputlangs),
|
||||
$array_key.'_total_localtax1_locale'=>price($object->total_localtax1,0,$outputlangs),
|
||||
$array_key.'_total_localtax2_locale'=>price($object->total_localtax2,0,$outputlangs),
|
||||
$array_key.'_total_ttc_locale'=>price($object->total_ttc,0,$outputlangs),
|
||||
$array_key.'_total_discount_ht_locale' => price($object->getTotalDiscount(),0,$outputlangs),
|
||||
$array_key.'_total_ht'=>price2num($object->total_ht),
|
||||
$array_key.'_total_vat'=>price2num($object->total_tva),
|
||||
$array_key.'_total_localtax1'=>price2num($object->total_localtax1),
|
||||
$array_key.'_total_localtax2'=>price2num($object->total_localtax2),
|
||||
$array_key.'_total_ttc'=>price2num($object->total_ttc),
|
||||
$array_key.'_total_discount_ht' => price2num($object->getTotalDiscount()),
|
||||
|
||||
$array_key.'_vatrate'=>vatrate($object->tva),
|
||||
$array_key.'_note_private'=>$object->note,
|
||||
$array_key.'_note'=>$object->note_public,
|
||||
|
||||
@ -1471,14 +1471,15 @@ abstract class CommonObject
|
||||
|
||||
/**
|
||||
* Update total_ht, total_ttc, total_vat, total_localtax1, total_localtax2 for an object (sum of lines).
|
||||
* Must be called at end of methods addline, updateline.
|
||||
* Must be called at end of methods addline or updateline.
|
||||
*
|
||||
* @param int $exclspec Exclude special product (product_type=9)
|
||||
* @param int $roundingadjust -1=Use default method (MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND if defined, or 0), 0=Force use total of rounding, 1=Force use rounding of total
|
||||
* @param int $nodatabaseupdate 1=Do not update database. Update only properties of object.
|
||||
* @param Societe $seller If roundingadjust is 0, it means we recalculate total for lines before calculating total for object. For this, we need seller object.
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update_price($exclspec=0,$roundingadjust=-1,$nodatabaseupdate=0)
|
||||
function update_price($exclspec=0,$roundingadjust=-1,$nodatabaseupdate=0,$seller='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -1495,7 +1496,7 @@ abstract class CommonObject
|
||||
$fieldlocaltax1='total_localtax1';
|
||||
$fieldlocaltax2='total_localtax2';
|
||||
$fieldup='subprice';
|
||||
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier')
|
||||
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier')
|
||||
{
|
||||
$fieldtva='tva';
|
||||
$fieldup='pu_ht';
|
||||
@ -1535,7 +1536,8 @@ abstract class CommonObject
|
||||
// By default, no adjustement is required ($forcedroundingmode = -1)
|
||||
if ($forcedroundingmode == 0) // Check if we need adjustement onto line for vat
|
||||
{
|
||||
$tmpcal=calcul_price_total($obj->qty, $obj->up, $obj->remise_percent, $obj->vatrate, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->product_type);
|
||||
$localtax_array=array($obj->localtax1_type,$obj->localtax1_tx,$obj->localtax2_type,$obj->localtax2_tx);
|
||||
$tmpcal=calcul_price_total($obj->qty, $obj->up, $obj->remise_percent, $obj->vatrate, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->product_type, $seller, $localtax_array);
|
||||
$diff=price2num($tmpcal[1] - $obj->total_tva, 'MT', 1);
|
||||
if ($diff)
|
||||
{
|
||||
@ -1549,7 +1551,7 @@ abstract class CommonObject
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->total_ht += $obj->total_ht; // The only field visible at end of line detail
|
||||
$this->total_tva += $obj->total_tva;
|
||||
$this->total_localtax1 += $obj->total_localtax1;
|
||||
@ -3116,7 +3118,7 @@ abstract class CommonObject
|
||||
if (empty($line->pa_ht) && isset($line->fk_fournprice) && !$force_price) {
|
||||
$product = new ProductFournisseur($this->db);
|
||||
if ($product->fetch_product_fournisseur_price($line->fk_fournprice))
|
||||
$line->pa_ht = $product->fourn_unitprice;
|
||||
$line->pa_ht = $product->fourn_unitprice * (1 - $product->fourn_remise_percent / 100);
|
||||
if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == "2" && $product->fourn_unitcharges > 0)
|
||||
$line->pa_ht += $product->fourn_unitcharges;
|
||||
}
|
||||
@ -3249,7 +3251,7 @@ abstract class CommonObject
|
||||
|
||||
/**
|
||||
* Overwrite magic function to solve problem of cloning object that are kept as references
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function __clone()
|
||||
@ -3264,6 +3266,6 @@ abstract class CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@ -432,7 +432,7 @@ class FormMail
|
||||
if (! empty($this->withtocc) && is_array($this->withtocc))
|
||||
{
|
||||
$out.= " ".$langs->trans("or")." ";
|
||||
$out.= $form->selectarray("receivercc", $this->withto, GETPOST("receivercc"), 1);
|
||||
$out.= $form->selectarray("receivercc", $this->withtocc, GETPOST("receivercc"), 1);
|
||||
}
|
||||
}
|
||||
$out.= "</td></tr>\n";
|
||||
@ -454,7 +454,7 @@ class FormMail
|
||||
if (! empty($this->withtoccc) && is_array($this->withtoccc))
|
||||
{
|
||||
$out.= " ".$langs->trans("or")." ";
|
||||
$out.= $form->selectarray("receiverccc", $this->withto, GETPOST("receiverccc"), 1);
|
||||
$out.= $form->selectarray("receiverccc", $this->withtoccc, GETPOST("receiverccc"), 1);
|
||||
}
|
||||
}
|
||||
//if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print ' '.info_admin("+ ".$conf->global->MAIN_MAIL_AUTOCOPY_TO,1);
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -17,102 +16,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/login/functions_myopenid.php
|
||||
* \file htdocs/core/class/openid.class.php
|
||||
* \ingroup core
|
||||
* \brief Authentication functions for OpenId mode
|
||||
* \brief Class to manage authentication with OpenId
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Check validity of user/password/entity
|
||||
* If test is ko, reason must be filled into $_SESSION["dol_loginmesg"]
|
||||
*
|
||||
* @param string $usertotest Login
|
||||
* @param string $passwordtotest Password
|
||||
* @param int $entitytotest Number of instance (always 1 if module multicompany not enabled)
|
||||
* @return string Login if OK, '' if KO
|
||||
*/
|
||||
function check_user_password_myopenid($usertotest,$passwordtotest,$entitytotest)
|
||||
{
|
||||
global $_POST,$db,$conf,$langs;
|
||||
|
||||
dol_syslog("functions_dolibarr::check_user_password_myopenid usertotest=".$usertotest);
|
||||
|
||||
$login='';
|
||||
|
||||
// Get identity from user and redirect browser to OpenID Server
|
||||
if (isset($_POST['username']))
|
||||
{
|
||||
$openid = new SimpleOpenID();
|
||||
$openid->SetIdentity($_POST['username']);
|
||||
$protocol = ($conf->file->main_force_https ? 'https://' : 'http://');
|
||||
$openid->SetTrustRoot($protocol . $_SERVER["HTTP_HOST"]);
|
||||
$openid->SetRequiredFields(array('email','fullname'));
|
||||
$_SESSION['dol_entity'] = $_POST["entity"];
|
||||
//$openid->SetOptionalFields(array('dob','gender','postcode','country','language','timezone'));
|
||||
if ($openid->GetOpenIDServer())
|
||||
{
|
||||
$openid->SetApprovedURL($protocol . $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"]); // Send Response from OpenID server to this script
|
||||
$openid->Redirect(); // This will redirect user to OpenID Server
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = $openid->GetError();
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Perform HTTP Request to OpenID server to validate key
|
||||
elseif($_GET['openid_mode'] == 'id_res')
|
||||
{
|
||||
$openid = new SimpleOpenID();
|
||||
$openid->SetIdentity($_GET['openid_identity']);
|
||||
$openid_validation_result = $openid->ValidateWithServer();
|
||||
if ($openid_validation_result == true)
|
||||
{
|
||||
// OK HERE KEY IS VALID
|
||||
|
||||
$sql ="SELECT login";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."user";
|
||||
$sql.=" WHERE openid = '".$db->escape($_GET['openid_identity'])."'";
|
||||
$sql.=" AND entity IN (0," . ($_SESSION["dol_entity"] ? $_SESSION["dol_entity"] : 1) . ")";
|
||||
|
||||
dol_syslog("functions_dolibarr::check_user_password_myopenid sql=".$sql);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj=$db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$login=$obj->login;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if($openid->IsError() == true)
|
||||
{
|
||||
// ON THE WAY, WE GOT SOME ERROR
|
||||
$error = $openid->GetError();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Signature Verification Failed
|
||||
//echo "INVALID AUTHORIZATION";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if ($_GET['openid_mode'] == 'cancel')
|
||||
{
|
||||
// User Canceled your Request
|
||||
//echo "USER CANCELED REQUEST";
|
||||
return false;
|
||||
}
|
||||
|
||||
return $login;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage OpenID
|
||||
*/
|
||||
@ -416,9 +324,22 @@ class SimpleOpenID
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function GetOpenIDServer()
|
||||
|
||||
/**
|
||||
* Get openid server
|
||||
*
|
||||
* @param string $url Url to found endpoint
|
||||
* @return string Endpoint
|
||||
*/
|
||||
function GetOpenIDServer($url='')
|
||||
{
|
||||
$response = $this->CURL_Request($this->openid_url_identity);
|
||||
global $conf;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
|
||||
if (empty($url)) $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
|
||||
|
||||
$response = getURLContent($url);
|
||||
|
||||
list($servers, $delegates) = $this->HTML2OpenIDServer($response);
|
||||
if (count($servers) == 0){
|
||||
$this->ErrorStore('OPENID_NOSERVERSFOUND');
|
||||
@ -517,6 +438,61 @@ class SimpleOpenID
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get XRDS response and set possible servers.
|
||||
*
|
||||
* @param string $url Url of endpoint to request
|
||||
* @return string First endpoint OpenID server found. False if it failed to found.
|
||||
*/
|
||||
function sendDiscoveryRequestToGetXRDS($url='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
|
||||
if (empty($url)) $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
|
||||
|
||||
dol_syslog(get_class($this).'::sendDiscoveryRequestToGetXRDS get XRDS');
|
||||
|
||||
$addheaders=array('Accept: application/xrds+xml');
|
||||
$response = getURLContent($url, 'GET', '', 1, $addheaders);
|
||||
/* response should like this:
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xrds:XRDS xmlns:xrds="xri://$xrds" xmlns="xri://$xrd*($v*2.0)">
|
||||
<XRD>
|
||||
<Service priority="0">
|
||||
<Type>http://specs.openid.net/auth/2.0/server</Type>
|
||||
<Type>http://openid.net/srv/ax/1.0</Type>
|
||||
...
|
||||
<URI>https://www.google.com/accounts/o8/ud</URI>
|
||||
</Service>
|
||||
</XRD>
|
||||
</xrds:XRDS>
|
||||
*/
|
||||
$content=$response['content'];
|
||||
|
||||
$server='';
|
||||
if (preg_match('/'.preg_quote('<URI>','/').'(.*)'.preg_quote('</URI>','/').'/is', $content, $reg))
|
||||
{
|
||||
$server=$reg[1];
|
||||
}
|
||||
|
||||
if (empty($server))
|
||||
{
|
||||
$this->ErrorStore('OPENID_NOSERVERSFOUND');
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::sendDiscoveryRequestToGetXRDS found endpoint = '.$server);
|
||||
$this->SetOpenIDServer($server);
|
||||
return $server;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@ -209,7 +209,7 @@ class DoliDBPgsql extends DoliDB
|
||||
}
|
||||
|
||||
// tinyint type conversion
|
||||
$line=str_replace('tinyint','smallint',$line);
|
||||
$line=preg_replace('/tinyint\(?[0-9]*\)?/','smallint',$line);
|
||||
|
||||
// nuke unsigned
|
||||
$line=preg_replace('/(int\w+|smallint)\s+unsigned/i','\\1',$line);
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -60,6 +61,15 @@ function societe_prepare_head($object)
|
||||
$head[$h][2] = 'supplier';
|
||||
$h++;
|
||||
}
|
||||
|
||||
if (($object->localtax1_assuj || $object->localtax2_assuj) && (isset($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL > 0) )
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/localtaxes.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("LocalTaxes");
|
||||
$head[$h][2] = 'localtaxes';
|
||||
$h++;
|
||||
}
|
||||
|
||||
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id;
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -2870,13 +2871,13 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="")
|
||||
* Get type and rate of localtaxes for a particular vat rate/country fo thirdparty
|
||||
* TODO
|
||||
* This function is called to retrieve type for building PDF. Such call of function must be removed.
|
||||
* Instead this function must be called when adding a line to get array of localtax and type and
|
||||
* provide it to function calcul_price_total.
|
||||
*
|
||||
* Instead this function must be called when adding a line to get (array of localtax and type) and
|
||||
* provide it to the function calcul_price_total.
|
||||
*
|
||||
* @param real $vatrate VAT Rate
|
||||
* @param int $local Number of localtax (1 or 2, or 0 to return 1+2)
|
||||
* @param int $local Number of localtax (1 or 2, or 0 to return 1 & 2)
|
||||
* @param int $thirdparty Company object
|
||||
* @return array array(Type of local tax (1 to 7 / 0 if not found), rate or amount of localtax)
|
||||
* @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...)
|
||||
*/
|
||||
function getLocalTaxesFromRate($vatrate, $local, $thirdparty)
|
||||
{
|
||||
@ -2885,7 +2886,7 @@ function getLocalTaxesFromRate($vatrate, $local, $thirdparty)
|
||||
dol_syslog("getLocalTaxesFromRate vatrate=".$vatrate." local=".$local." thirdparty id=".(is_object($thirdparty)?$thirdparty->id:''));
|
||||
|
||||
// Search local taxes
|
||||
$sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type,t.accountancy_code_sell,t.accountancy_code_buy";
|
||||
$sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p";
|
||||
$sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$thirdparty->country_code."'";
|
||||
$sql .= " AND t.taux = ".$vatrate." AND t.active = 1";
|
||||
@ -3477,16 +3478,18 @@ function dol_html_entity_decode($a,$b,$c='UTF-8')
|
||||
|
||||
/**
|
||||
* Replace htmlentities functions to manage errors
|
||||
* http://php.net/manual/en/function.htmlentities.php
|
||||
*
|
||||
* @param string $a Operand a
|
||||
* @param string $b Operand b
|
||||
* @param string $c Operand c
|
||||
* @return string String encoded
|
||||
* @param string $string The input string.
|
||||
* @param int $flags Flags(see PHP doc above)
|
||||
* @param string $encoding Encoding
|
||||
* @param bool $double_encode When double_encode is turned off PHP will not encode existing html entities
|
||||
* @return string $ret Encoded string
|
||||
*/
|
||||
function dol_htmlentities($a,$b,$c='UTF-8')
|
||||
function dol_htmlentities($string, $flags=null, $encoding='UTF-8', $double_encode=false)
|
||||
{
|
||||
// We use @ to avoid warning on PHP4 that does not support entity decoding to UTF8;
|
||||
$ret=@htmlentities($a,$b,$c);
|
||||
$ret=@htmlentities($string, $flags, $encoding, $double_encode);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@ -4436,4 +4439,40 @@ if (! function_exists('getmypid'))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Natural search
|
||||
*
|
||||
* @param mixed $fields String or array of strings filled with the fields names in the SQL query
|
||||
* @param string $value The value to look for
|
||||
* @return string $res The statement to append to the SQL query
|
||||
*/
|
||||
function natural_search($fields, $value)
|
||||
{
|
||||
global $db;
|
||||
$crits = explode(' ', $value);
|
||||
$res = "";
|
||||
if (! is_array($fields)) {
|
||||
$fields = array($fields);
|
||||
}
|
||||
$end = count($fields);
|
||||
$end2 = count($crits);
|
||||
$j = 0;
|
||||
foreach ($crits as $crit) {
|
||||
$i = 0;
|
||||
foreach ($fields as $field) {
|
||||
if ( $i > 0 && $i < $end){
|
||||
$res .= " OR ";
|
||||
}
|
||||
$res .= $field . " LIKE '%" . $db->escape(trim($crit)) . "%'";
|
||||
$i++;
|
||||
}
|
||||
if ($end > 1) $res .= ')';
|
||||
if ($j < $end2 - 1) $res .= " AND ";
|
||||
if ($end > 1 && $j < $end2 - 1) $res .= '(';
|
||||
$j++;
|
||||
}
|
||||
return " AND " . ($end > 1? '(' : '') . $res;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -17,20 +17,21 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/lib/functions2.lib.php
|
||||
* \brief A set of functions for Dolibarr
|
||||
* This file contains all rare functions.
|
||||
* \file htdocs/core/lib/geturl.lib.php
|
||||
* \brief This file contains functions dedicated to get URL.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Function get content from an URL (use proxy if proxy defined)
|
||||
*
|
||||
* @param string $url URL to call.
|
||||
* @param string $postorget 'post' = POST, 'get='GET'
|
||||
* @param string $param Paraemeters of URL (x=value1&y=value2)
|
||||
* @return array returns an associtive array containing the response from the server.
|
||||
* @param string $url URL to call.
|
||||
* @param string $postorget 'POST', 'GET', 'HEAD'
|
||||
* @param string $param Paraemeters of URL (x=value1&y=value2)
|
||||
* @param string $followlocation 1=Follow location, 0=Do not follow
|
||||
* @param array $addheaders Array of string to add into header. Example: ('Accept: application/xrds+xml', ....)
|
||||
* @return array Returns an associative array containing the response from the server array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...)
|
||||
*/
|
||||
function getURLContent($url,$postorget='GET',$param='')
|
||||
function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addheaders=array())
|
||||
{
|
||||
//declaring of global variables
|
||||
global $conf, $langs;
|
||||
@ -52,6 +53,11 @@ function getURLContent($url,$postorget='GET',$param='')
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, 1);
|
||||
curl_setopt($ch, CURLOPT_SSLVERSION, 3); // Force SSLv3
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Dolibarr geturl function');
|
||||
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, ($followlocation?true:false));
|
||||
if (count($addheaders)) curl_setopt($ch, CURLOPT_HTTPHEADER, $addheaders);
|
||||
curl_setopt($ch, CURLINFO_HEADER_OUT, true); // To be able to retrieve request header and log it
|
||||
|
||||
//turning off the server and peer verification(TrustManager Concept).
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||
@ -60,9 +66,21 @@ function getURLContent($url,$postorget='GET',$param='')
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, empty($conf->global->MAIN_USE_CONNECT_TIMEOUT)?5:$conf->global->MAIN_USE_CONNECT_TIMEOUT);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT)?30:$conf->global->MAIN_USE_RESPONSE_TIMEOUT);
|
||||
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
|
||||
if ($postorget == 'POST') curl_setopt($ch, CURLOPT_POST, 1);
|
||||
else curl_setopt($ch, CURLOPT_POST, 0);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // We want response
|
||||
if ($postorget == 'POST')
|
||||
{
|
||||
curl_setopt($ch, CURLOPT_POST, 1); // POST
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // Setting param x=a&y=z as POST fields
|
||||
}
|
||||
else if ($postorget == 'HEAD')
|
||||
{
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD'); // HTTP request is 'HEAD'
|
||||
curl_setopt($ch, CURLOPT_NOBODY, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
curl_setopt($ch, CURLOPT_POST, 0); // GET
|
||||
}
|
||||
|
||||
//if USE_PROXY constant set to TRUE in Constants.php, then only proxy will be enabled.
|
||||
if ($USE_PROXY)
|
||||
@ -73,18 +91,18 @@ function getURLContent($url,$postorget='GET',$param='')
|
||||
if ($PROXY_USER) curl_setopt($ch, CURLOPT_PROXYUSERPWD, $PROXY_USER. ":" . $PROXY_PASS);
|
||||
}
|
||||
|
||||
//setting the nvpreq as POST FIELD to curl
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $param);
|
||||
|
||||
//getting response from server
|
||||
$response = curl_exec($ch);
|
||||
|
||||
$status = curl_getinfo($ch, CURLINFO_HEADER_OUT); // Reading of request must be done after sending request
|
||||
dol_syslog("getURLContent request=".$status);
|
||||
|
||||
dol_syslog("getURLContent response=".$response);
|
||||
|
||||
$rep=array();
|
||||
$rep['content']=$response;
|
||||
$rep['curl_error_no']='';
|
||||
$rep['curl_error_msg']='';
|
||||
|
||||
dol_syslog("getURLContent response=".$response);
|
||||
|
||||
if (curl_errno($ch))
|
||||
{
|
||||
@ -98,7 +116,7 @@ function getURLContent($url,$postorget='GET',$param='')
|
||||
{
|
||||
$info = curl_getinfo($ch);
|
||||
$rep['header_size']=$info['header_size'];
|
||||
|
||||
|
||||
//closing the curl
|
||||
curl_close($ch);
|
||||
}
|
||||
@ -106,3 +124,4 @@ function getURLContent($url,$postorget='GET',$param='')
|
||||
return $rep;
|
||||
}
|
||||
|
||||
?>
|
||||
@ -72,9 +72,9 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
|
||||
// Clean parameters
|
||||
if (empty($txtva)) $txtva=0;
|
||||
|
||||
if (empty($seller) || ! is_object($seller))
|
||||
{
|
||||
dol_syslog("calcul_price_total Warning: function is called with parameter seller that is missing", LOG_WARNING);
|
||||
if (! is_object($mysoc)) // mysoc may be not defined (during migration process)
|
||||
{
|
||||
$mysoc=new Societe($db);
|
||||
@ -83,9 +83,13 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
$seller=$mysoc; // If sell is done to a customer, $seller is not provided, we use $mysoc
|
||||
//var_dump($seller->country_id);exit;
|
||||
}
|
||||
if (empty($localtaxes_array) || ! is_array($localtaxes_array))
|
||||
{
|
||||
dol_syslog("calcul_price_total Warning: function is called with parameter localtaxes_array that is missing", LOG_WARNING);
|
||||
}
|
||||
// Too verbose. Enable for debug only
|
||||
//dol_syslog("calcul_price_total qty=".$qty." pu=".$pu." remiserpercent_ligne=".$remise_percent_ligne." txtva=".$txtva." uselocaltax1_rate=".$uselocaltax1_rate." uselocaltax2_rate=".$uselocaltax2_rate);
|
||||
|
||||
|
||||
$countryid=$seller->country_id;
|
||||
if ($uselocaltax1_rate < 0) $uselocaltax1_rate=$seller->localtax1_assuj;
|
||||
if ($uselocaltax2_rate < 0) $uselocaltax2_rate=$seller->localtax2_assuj;
|
||||
@ -93,7 +97,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
// Now we search localtaxes information ourself (rates and types).
|
||||
$localtax1_type=0;
|
||||
$localtax2_type=0;
|
||||
|
||||
|
||||
if (is_array($localtaxes_array))
|
||||
{
|
||||
$localtax1_type = $localtaxes_array[0];
|
||||
|
||||
116
htdocs/core/login/functions_openid.php
Normal file
116
htdocs/core/login/functions_openid.php
Normal file
@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/login/functions_openid.php
|
||||
* \ingroup core
|
||||
* \brief Authentication functions for OpenId mode
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/openid.class.php';
|
||||
|
||||
|
||||
/**
|
||||
* Check validity of user/password/entity
|
||||
* If test is ko, reason must be filled into $_SESSION["dol_loginmesg"]
|
||||
*
|
||||
* @param string $usertotest Login
|
||||
* @param string $passwordtotest Password
|
||||
* @param int $entitytotest Number of instance (always 1 if module multicompany not enabled)
|
||||
* @return string Login if OK, '' if KO
|
||||
*/
|
||||
function check_user_password_openid($usertotest,$passwordtotest,$entitytotest)
|
||||
{
|
||||
global $_POST,$db,$conf,$langs;
|
||||
|
||||
dol_syslog("functions_openid::check_user_password_openid usertotest=".$usertotest);
|
||||
|
||||
$login='';
|
||||
|
||||
// Get identity from user and redirect browser to OpenID Server
|
||||
if (isset($_POST['username']))
|
||||
{
|
||||
$openid = new SimpleOpenID();
|
||||
$openid->SetIdentity($_POST['username']);
|
||||
$protocol = ($conf->file->main_force_https ? 'https://' : 'http://');
|
||||
$openid->SetTrustRoot($protocol . $_SERVER["HTTP_HOST"]);
|
||||
$openid->SetRequiredFields(array('email','fullname'));
|
||||
$_SESSION['dol_entity'] = $_POST["entity"];
|
||||
//$openid->SetOptionalFields(array('dob','gender','postcode','country','language','timezone'));
|
||||
if ($openid->sendDiscoveryRequestToGetXRDS())
|
||||
{
|
||||
$openid->SetApprovedURL($protocol . $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"]); // Send Response from OpenID server to this script
|
||||
$openid->Redirect(); // This will redirect user to OpenID Server
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = $openid->GetError();
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Perform HTTP Request to OpenID server to validate key
|
||||
elseif($_GET['openid_mode'] == 'id_res')
|
||||
{
|
||||
$openid = new SimpleOpenID();
|
||||
$openid->SetIdentity($_GET['openid_identity']);
|
||||
$openid_validation_result = $openid->ValidateWithServer();
|
||||
if ($openid_validation_result == true)
|
||||
{
|
||||
// OK HERE KEY IS VALID
|
||||
|
||||
$sql ="SELECT login";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."user";
|
||||
$sql.=" WHERE openid = '".$db->escape($_GET['openid_identity'])."'";
|
||||
$sql.=" AND entity IN (0," . ($_SESSION["dol_entity"] ? $_SESSION["dol_entity"] : 1) . ")";
|
||||
|
||||
dol_syslog("functions_openid::check_user_password_openid sql=".$sql);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj=$db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$login=$obj->login;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if($openid->IsError() == true)
|
||||
{
|
||||
// ON THE WAY, WE GOT SOME ERROR
|
||||
$error = $openid->GetError();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Signature Verification Failed
|
||||
//echo "INVALID AUTHORIZATION";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if ($_GET['openid_mode'] == 'cancel')
|
||||
{
|
||||
// User Canceled your Request
|
||||
//echo "USER CANCELED REQUEST";
|
||||
return false;
|
||||
}
|
||||
|
||||
return $login;
|
||||
}
|
||||
|
||||
?>
|
||||
@ -114,10 +114,20 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
'object_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement),
|
||||
'object_payment_term_code'=>$object->cond_reglement_code,
|
||||
'object_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code)!='PaymentCondition'.$object->cond_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code):$object->cond_reglement),
|
||||
'object_total_ht'=>price($object->total_ht,0,$outputlangs),
|
||||
'object_total_vat'=>price($object->total_tva,0,$outputlangs),
|
||||
'object_total_ttc'=>price($object->total_ttc,0,$outputlangs),
|
||||
'object_total_discount_ht' => price($object->getTotalDiscount(), 0, $outputlangs),
|
||||
|
||||
'object_total_ht_locale'=>price($object->total_ht, 0, $outputlangs),
|
||||
'object_total_vat_locale'=>price($object->total_tva, 0, $outputlangs),
|
||||
'object_total_localtax1_locale'=>price($object->total_localtax1, 0, $outputlangs),
|
||||
'object_total_localtax2_locale'=>price($object->total_localtax2, 0, $outputlangs),
|
||||
'object_total_ttc_locale'=>price($object->total_ttc, 0, $outputlangs),
|
||||
'object_total_discount_ht_locale' => price($object->getTotalDiscount(), 0, $outputlangs),
|
||||
'object_total_ht'=>price2num($object->total_ht),
|
||||
'object_total_vat'=>price2num($object->total_tva),
|
||||
'object_total_localtax1'=>price2num($object->total_localtax1),
|
||||
'object_total_localtax2'=>price2num($object->total_localtax2),
|
||||
'object_total_ttc'=>price2num($object->total_ttc),
|
||||
'object_total_discount_ht' => price2num($object->getTotalDiscount()),
|
||||
|
||||
'object_vatrate'=>vatrate($object->tva),
|
||||
'object_note_private'=>$object->note,
|
||||
'object_note'=>$object->note_public,
|
||||
|
||||
@ -114,10 +114,20 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
|
||||
'object_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement),
|
||||
'object_payment_term_code'=>$object->cond_reglement_code,
|
||||
'object_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code)!='PaymentCondition'.$object->cond_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code):$object->cond_reglement),
|
||||
'object_total_ht'=>price($object->total_ht,0,$outputlangs),
|
||||
'object_total_vat'=>price($object->total_tva,0,$outputlangs),
|
||||
'object_total_ttc'=>price($object->total_ttc,0,$outputlangs),
|
||||
'object_total_discount_ht' => price($object->getTotalDiscount(), 0, $outputlangs),
|
||||
|
||||
'object_total_ht_locale'=>price($object->total_ht, 0, $outputlangs),
|
||||
'object_total_vat_locale'=>price($object->total_tva, 0, $outputlangs),
|
||||
'object_total_localtax1_locale'=>price($object->total_localtax1, 0, $outputlangs),
|
||||
'object_total_localtax2_locale'=>price($object->total_localtax2, 0, $outputlangs),
|
||||
'object_total_ttc_locale'=>price($object->total_ttc, 0, $outputlangs),
|
||||
'object_total_discount_ht_locale' => price($object->getTotalDiscount(), 0, $outputlangs),
|
||||
'object_total_ht'=>price2num($object->total_ht),
|
||||
'object_total_vat'=>price2num($object->total_tva),
|
||||
'object_total_localtax1'=>price2num($object->total_localtax1),
|
||||
'object_total_localtax2'=>price2num($object->total_localtax2),
|
||||
'object_total_ttc'=>price2num($object->total_ttc),
|
||||
'object_total_discount_ht' => price2num($object->getTotalDiscount()),
|
||||
|
||||
'object_vatrate'=>vatrate($object->tva),
|
||||
'object_note_private'=>$object->note,
|
||||
'object_note'=>$object->note_public,
|
||||
|
||||
@ -124,10 +124,20 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
'object_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement),
|
||||
'object_payment_term_code'=>$object->cond_reglement_code,
|
||||
'object_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code)!='PaymentCondition'.$object->cond_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code):$object->cond_reglement),
|
||||
|
||||
'object_total_ht_locale'=>price($object->total_ht, 0, $outputlangs),
|
||||
'object_total_vat_locale'=>price($object->total_tva, 0, $outputlangs),
|
||||
'object_total_localtax1_locale'=>price($object->total_localtax1, 0, $outputlangs),
|
||||
'object_total_localtax2_locale'=>price($object->total_localtax2, 0, $outputlangs),
|
||||
'object_total_ttc_locale'=>price($object->total_ttc, 0, $outputlangs),
|
||||
'object_total_discount_ht_locale' => price($object->getTotalDiscount(), 0, $outputlangs),
|
||||
'object_total_ht'=>price2num($object->total_ht),
|
||||
'object_total_vat'=>price2num($object->total_tva),
|
||||
'object_total_localtax1'=>price2num($object->total_localtax1),
|
||||
'object_total_localtax2'=>price2num($object->total_localtax2),
|
||||
'object_total_ttc'=>price2num($object->total_ttc),
|
||||
'object_total_discount_ht' => price2num($object->getTotalDiscount(), 0, $outputlangs),
|
||||
'object_total_discount_ht' => price2num($object->getTotalDiscount()),
|
||||
|
||||
'object_vatrate'=>(isset($object->tva)?vatrate($object->tva):''),
|
||||
'object_note_private'=>$object->note,
|
||||
'object_note'=>$object->note_public,
|
||||
|
||||
@ -152,6 +152,27 @@ if ($forgetpasslink || $helpcenterlink)
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication))
|
||||
{
|
||||
$langs->load("users");
|
||||
|
||||
//if (! empty($conf->global->MAIN_OPENIDURL_PERUSER)) $url=
|
||||
echo '<br>';
|
||||
echo '<div align="center" style="margin-top: 4px;">';
|
||||
|
||||
$url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
|
||||
if (! empty($url)) print '<a class="alogin" href="'.$url.'">'.$langs->trans("LoginUsingOpenID").'</a>';
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
print '<font class="warning">'.$langs->trans("ErrorOpenIDSetupNotComplete",'MAIN_AUTHENTICATION_OPENID_URL').'</font>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -73,9 +74,15 @@ $sql.= ", ".MAIN_DB_PREFIX."fichinter as f)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid ";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
if ($search_ref) $sql .= " AND f.ref LIKE '%".$db->escape($search_ref)."%'";
|
||||
if ($search_company) $sql .= " AND s.nom LIKE '%".$db->escape($search_company)."%'";
|
||||
if ($search_desc) $sql .= " AND (f.description LIKE '%".$db->escape($search_desc)."%' OR fd.description LIKE '%".$db->escape($search_desc)."%')";
|
||||
if ($search_ref) {
|
||||
$sql .= natural_search('f.ref', $search_ref);
|
||||
}
|
||||
if ($search_company) {
|
||||
$sql .= natural_search('s.nom', $search_company);
|
||||
}
|
||||
if ($search_desc) {
|
||||
$sql .= natural_search(array('f.description', 'fd.description'), $search_desc);
|
||||
}
|
||||
if (! $user->rights->societe->client->voir && empty($socid))
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid)
|
||||
|
||||
@ -145,12 +145,13 @@ if (empty($dolibarr_main_data_root))
|
||||
define('DOL_CLASS_PATH', 'class/'); // Filesystem path to class dir (defined only for some code that want to be compatible with old versions without this parameter)
|
||||
define('DOL_DATA_ROOT', $dolibarr_main_data_root); // Filesystem data (documents)
|
||||
define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem core php (htdocs)
|
||||
// Define DOL_MAIN_URL_ROOT and DOL_URL_ROOT
|
||||
// Try to autodetec DOL_MAIN_URL_ROOT and DOL_URL_ROOT.
|
||||
// Note: autodetect works only in case 1, 2, 3 and 4 of phpunit test CoreTest.php. For case 5, 6, only setting value into conf.php will works.
|
||||
$tmp='';
|
||||
$found=0;
|
||||
$real_dolibarr_main_document_root=str_replace('\\','/',realpath($dolibarr_main_document_root)); // A) Ex: C:/xxx/dolibarr/htdocs
|
||||
$pathroot=$_SERVER["DOCUMENT_ROOT"]; // B) Ex: C:/Program Files/wamp/www/
|
||||
$paths=explode('/',str_replace('\\','/',$_SERVER["SCRIPT_NAME"])); // C) Ex: /dolibarr/htdocs/admin/system/phpinfo.php
|
||||
$real_dolibarr_main_document_root=str_replace('\\','/',realpath($dolibarr_main_document_root)); // A) Value found into config file, to say where are store htdocs files. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs
|
||||
$pathroot=$_SERVER["DOCUMENT_ROOT"]; // B) Value reported by web server setup, to say where is root of web server instance. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs
|
||||
$paths=explode('/',str_replace('\\','/',$_SERVER["SCRIPT_NAME"])); // C) Value reported by web server, to say full path on filesystem of a file. Ex: /dolibarr/htdocs/admin/system/phpinfo.php
|
||||
$concatpath='';
|
||||
foreach($paths as $tmppath) // We check to find (B+start of C)=A
|
||||
{
|
||||
|
||||
@ -90,7 +90,7 @@ if (! empty($idprod))
|
||||
|
||||
$price = $unitprice;
|
||||
}
|
||||
if ($objp->unitcharges > 0 && ($conf->global->MARGIN_TYPE == "2"))
|
||||
if ($objp->unitcharges > 0 && ($conf->global->MARGIN_TYPE == "2"))
|
||||
{
|
||||
$title.=" + ";
|
||||
$title.= price($objp->unitcharges,0,$langs,0,0,-1,$conf->currency);
|
||||
|
||||
@ -1200,7 +1200,8 @@ class CommandeFournisseur extends CommonOrder
|
||||
}
|
||||
if ($result == 0 || $result == -1)
|
||||
{
|
||||
$this->error="No price found for this quantity. Quantity may be too low ?";
|
||||
$langs->load("errors");
|
||||
$this->error = "Ref " . $prod->ref . " " . $langs->trans("ErrorQtyTooLowForThisSupplier");
|
||||
$this->db->rollback();
|
||||
dol_syslog(get_class($this)."::addline result=".$result." - ".$this->error, LOG_DEBUG);
|
||||
return -1;
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -92,11 +93,11 @@ $sql.= " AND cf.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($sref)
|
||||
{
|
||||
$sql.= " AND cf.ref LIKE '%".$db->escape($sref)."%'";
|
||||
$sql .= natural_search('cf.ref', $sref);
|
||||
}
|
||||
if ($snom)
|
||||
{
|
||||
$sql.= " AND s.nom LIKE '%".$db->escape($snom)."%'";
|
||||
$sql .= natural_search('s.nom', $snom);
|
||||
}
|
||||
if ($suser)
|
||||
{
|
||||
@ -108,7 +109,7 @@ if ($sttc)
|
||||
}
|
||||
if ($sall)
|
||||
{
|
||||
$sql.= " AND (cf.ref LIKE '%".$db->escape($sall)."%' OR cf.note LIKE '%".$db->escape($sall)."%')";
|
||||
$sql .= natural_search(array('cf.ref', 'cf.note_public'), $sall);
|
||||
}
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
|
||||
|
||||
@ -926,10 +926,10 @@ elseif ($action == 'builddoc')
|
||||
elseif ($action == 'calculate')
|
||||
{
|
||||
$calculationrule=GETPOST('calculationrule');
|
||||
|
||||
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
$result=$object->update_price(0,($calculationrule=='totalofround'?0:1));
|
||||
$result=$object->update_price(0, ($calculationrule=='totalofround'?0:1), 0, $object->thirdparty);
|
||||
if ($result <= 0)
|
||||
{
|
||||
dol_print_error($db,$result);
|
||||
@ -1441,21 +1441,21 @@ else
|
||||
}
|
||||
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateBill'), $text, 'confirm_valid', $formquestion, 1, 1, 240);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Confirmation set paid
|
||||
if ($action == 'paid')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidBill', $object->ref), 'confirm_paid', '', 0, 1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Confirmation de la suppression de la facture fournisseur
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBill'), $langs->trans('ConfirmDeleteBill'), 'confirm_delete', '', 0, 1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1961,7 +1961,7 @@ else
|
||||
print '</td>';
|
||||
|
||||
print '<td align="center" width="16">';
|
||||
if ($object->statut == 0)
|
||||
if ($object->statut == 0)
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_delete_line&lineid='.$object->lines[$i]->rowid.'">'.img_delete().'</a>';
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -130,12 +131,12 @@ if (GETPOST('filtre'))
|
||||
|
||||
if (GETPOST("search_ref"))
|
||||
{
|
||||
if (is_numeric(GETPOST("search_ref"))) $sql .= " AND (fac.rowid = ".GETPOST("search_ref",'int')." OR fac.ref = '".$db->escape(GETPOST("search_ref"))."')"; // For backward compatibility
|
||||
else $sql .= " AND fac.ref LIKE '%".$db->escape(GETPOST("search_ref"))."%'";
|
||||
if (is_numeric(GETPOST("search_ref"))) $sql .= natural_search(array('fac.rowid', 'fac.ref'), GETPOST('search_ref'));// For backward compatibility
|
||||
else $sql .= natural_search('fac.ref', GETPOST("search_ref"));
|
||||
}
|
||||
if (GETPOST("search_ref_supplier"))
|
||||
{
|
||||
$sql .= " AND fac.ref_supplier LIKE '%".$db->escape(GETPOST("search_ref_supplier"))."%'";
|
||||
$sql .= natural_search('fac.ref_supplier', GETPOST('search_ref_supplier'));
|
||||
}
|
||||
if ($month > 0)
|
||||
{
|
||||
@ -150,12 +151,12 @@ else if ($year > 0)
|
||||
}
|
||||
if (GETPOST("search_libelle"))
|
||||
{
|
||||
$sql .= " AND fac.libelle LIKE '%".$db->escape(GETPOST("search_libelle"))."%'";
|
||||
$sql .= natural_search('fac.libelle', GETPOST('search_libelle'));
|
||||
}
|
||||
|
||||
if (GETPOST("search_societe"))
|
||||
{
|
||||
$sql .= " AND s.nom LIKE '%".$db->escape(GETPOST("search_societe"))."%'";
|
||||
$sql .= natural_search('s.nom', GETPOST('search_societe'));
|
||||
}
|
||||
|
||||
if (GETPOST("search_montant_ht"))
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -88,15 +89,18 @@ $sql.= " WHERE s.fk_stcomm = st.id AND s.fournisseur = 1";
|
||||
$sql.= " AND s.entity IN (".getEntity('societe', 1).")";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql .= " AND s.rowid = ".$socid;
|
||||
if ($socname)
|
||||
{
|
||||
$sql .= " AND s.nom LIKE '%".$db->escape($socname)."%'";
|
||||
if ($socname) {
|
||||
$sql .= natural_search('s.nom', $socname);
|
||||
$sortfield = "s.nom";
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
if ($search_nom) $sql .= " AND s.nom LIKE '%".$db->escape($search_nom)."%'";
|
||||
if ($search_nom) {
|
||||
$sql .= natural_search('s.nom', $search_nom);
|
||||
}
|
||||
if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape($search_zipcode)."%'";
|
||||
if ($search_town) $sql .= " AND s.town LIKE '%".$db->escape($search_town)."%'";
|
||||
if ($search_town) {
|
||||
$sql .= natural_search('s.town', $search_town);
|
||||
}
|
||||
if ($search_code_fournisseur) $sql .= " AND s.code_fournisseur LIKE '%".$db->escape($search_code_fournisseur)."%'";
|
||||
if ($search_compta_fournisseur) $sql .= " AND s.code_compta_fournisseur LIKE '%".$db->escape($search_compta_fournisseur)."%'";
|
||||
if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'";
|
||||
@ -229,4 +233,4 @@ else
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
?>
|
||||
?>
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -35,35 +36,32 @@ $langs->load("suppliers");
|
||||
|
||||
if (!$user->rights->produit->lire && !$user->rights->service->lire) accessforbidden();
|
||||
|
||||
$sref=isset($_GET["sref"])?$_GET["sref"]:$_POST["sref"];
|
||||
$sRefSupplier=isset($_GET["srefsupplier"])?$_GET["srefsupplier"]:$_POST["srefsupplier"];
|
||||
$snom=isset($_GET["snom"])?$_GET["snom"]:$_POST["snom"];
|
||||
$sref = GETPOST('sref');
|
||||
$sRefSupplier = GETPOST('srefsupplier');
|
||||
$snom = GETPOST('snom');
|
||||
$type = GETPOST('type');
|
||||
|
||||
$type=isset($_GET["type"])?$_GET["type"]:$_POST["type"];
|
||||
|
||||
$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
|
||||
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
||||
$page = $_GET["page"];
|
||||
$sortfield = GETPOST('sortfield');
|
||||
$sortorder = GETPOST('sortorder');
|
||||
$page = GETPOST('page');
|
||||
if ($page < 0) {
|
||||
$page = 0 ; }
|
||||
$page = 0 ;
|
||||
}
|
||||
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
if (! $sortfield) $sortfield="p.ref";
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield = 'p.ref';
|
||||
if (! $sortorder) $sortorder = 'DESC';
|
||||
|
||||
if (! empty($_POST["button_removefilter"]))
|
||||
if (GETPOST('button_removefilter'))
|
||||
{
|
||||
$sref="";
|
||||
$sRefSupplier="";
|
||||
$snom="";
|
||||
$sref = '';
|
||||
$sRefSupplier = '';
|
||||
$snom = '';
|
||||
}
|
||||
|
||||
if ($_GET["fourn_id"] > 0 || $_POST["fourn_id"] > 0)
|
||||
{
|
||||
$fourn_id = isset($_GET["fourn_id"])?$_GET["fourn_id"]:$_POST["fourn_id"];
|
||||
}
|
||||
$fourn_id = GETPOST('fourn_id', 'int');
|
||||
|
||||
if (isset($_REQUEST['catid']))
|
||||
{
|
||||
@ -96,38 +94,33 @@ if ($catid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.f
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as ppf ON p.rowid = ppf.fk_product";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ppf.fk_soc = s.rowid";
|
||||
$sql.= " WHERE p.entity IN (".getEntity('product', 1).")";
|
||||
if ($_POST["mode"] == 'search')
|
||||
if (GETPOST('mode', 'alpha') == 'search')
|
||||
{
|
||||
$sql .= " AND (p.ref LIKE '%".$_POST["sall"]."%'";
|
||||
$sql .= " OR p.label LIKE '%".$_POST["sall"]."%')";
|
||||
if ($sRefSupplier)
|
||||
{
|
||||
$sql .= " AND ppf.ref_fourn LIKE '%".$sRefSupplier."%'";
|
||||
}
|
||||
$sql .= natural_search(array('p.ref', 'p.label'), GETPOST('mode', 'alpha'));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($_GET["type"] || $_POST["type"])
|
||||
if (GETPOST('type'))
|
||||
{
|
||||
$sql .= " AND p.fk_product_type = ".(isset($_GET["type"])?$_GET["type"]:$_POST["type"]);
|
||||
$sql .= " AND p.fk_product_type = " . GETPOST('type','int');
|
||||
}
|
||||
if ($sref)
|
||||
{
|
||||
$sql .= " AND p.ref LIKE '%".$sref."%'";
|
||||
}
|
||||
if ($sRefSupplier)
|
||||
{
|
||||
$sql .= " AND ppf.ref_fourn LIKE '%".$sRefSupplier."%'";
|
||||
$sql .= natural_search('p.ref', $sref);
|
||||
}
|
||||
if ($snom)
|
||||
{
|
||||
$sql .= " AND p.label LIKE '%".$snom."%'";
|
||||
$sql .= natural_search('p.label', $snom);
|
||||
}
|
||||
if($catid)
|
||||
{
|
||||
$sql .= " AND cp.fk_categorie = ".$catid;
|
||||
}
|
||||
}
|
||||
if ($sRefSupplier)
|
||||
{
|
||||
$sql .= natural_search('ppf.ref_fourn', $sRefSupplier);
|
||||
}
|
||||
if ($fourn_id > 0)
|
||||
{
|
||||
$sql .= " AND ppf.fk_soc = ".$fourn_id;
|
||||
|
||||
612
htdocs/includes/ckeditor/_source/adapters/jquery.js
vendored
612
htdocs/includes/ckeditor/_source/adapters/jquery.js
vendored
@ -1,306 +1,306 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview jQuery adapter provides easy use of basic CKEditor functions
|
||||
* and access to internal API. It also integrates some aspects of CKEditor with
|
||||
* jQuery framework.
|
||||
*
|
||||
* Every TEXTAREA, DIV and P elements can be converted to working editor.
|
||||
*
|
||||
* Plugin exposes some of editor's event to jQuery event system. All of those are namespaces inside
|
||||
* ".ckeditor" namespace and can be binded/listened on supported textarea, div and p nodes.
|
||||
*
|
||||
* Available jQuery events:
|
||||
* - instanceReady.ckeditor( editor, rootNode )
|
||||
* Triggered when new instance is ready.
|
||||
* - destroy.ckeditor( editor )
|
||||
* Triggered when instance is destroyed.
|
||||
* - getData.ckeditor( editor, eventData )
|
||||
* Triggered when getData event is fired inside editor. It can change returned data using eventData reference.
|
||||
* - setData.ckeditor( editor )
|
||||
* Triggered when getData event is fired inside editor.
|
||||
*
|
||||
* @example
|
||||
* <script src="jquery.js"></script>
|
||||
* <script src="ckeditor.js"></script>
|
||||
* <script src="adapters/jquery/adapter.js"></script>
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
/**
|
||||
* Allows CKEditor to override jQuery.fn.val(), making it possible to use the val()
|
||||
* function on textareas, as usual, having it synchronized with CKEditor.<br>
|
||||
* <br>
|
||||
* This configuration option is global and executed during the jQuery Adapter loading.
|
||||
* It can't be customized across editor instances.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* <script>
|
||||
* CKEDITOR.config.jqueryOverrideVal = true;
|
||||
* </script>
|
||||
* <!-- Important: The JQuery adapter is loaded *after* setting jqueryOverrideVal -->
|
||||
* <script src="/ckeditor/adapters/jquery.js"></script>
|
||||
* @example
|
||||
* // ... then later in the code ...
|
||||
*
|
||||
* $( 'textarea' ).ckeditor();
|
||||
* // ...
|
||||
* $( 'textarea' ).val( 'New content' );
|
||||
*/
|
||||
CKEDITOR.config.jqueryOverrideVal = typeof CKEDITOR.config.jqueryOverrideVal == 'undefined'
|
||||
? true : CKEDITOR.config.jqueryOverrideVal;
|
||||
|
||||
var jQuery = window.jQuery;
|
||||
|
||||
if ( typeof jQuery == 'undefined' )
|
||||
return;
|
||||
|
||||
// jQuery object methods.
|
||||
jQuery.extend( jQuery.fn,
|
||||
/** @lends jQuery.fn */
|
||||
{
|
||||
/**
|
||||
* Return existing CKEditor instance for first matched element.
|
||||
* Allows to easily use internal API. Doesn't return jQuery object.
|
||||
*
|
||||
* Raised exception if editor doesn't exist or isn't ready yet.
|
||||
*
|
||||
* @name jQuery.ckeditorGet
|
||||
* @return CKEDITOR.editor
|
||||
* @see CKEDITOR.editor
|
||||
*/
|
||||
ckeditorGet: function()
|
||||
{
|
||||
var instance = this.eq( 0 ).data( 'ckeditorInstance' );
|
||||
if ( !instance )
|
||||
throw "CKEditor not yet initialized, use ckeditor() with callback.";
|
||||
return instance;
|
||||
},
|
||||
/**
|
||||
* Triggers creation of CKEditor in all matched elements (reduced to DIV, P and TEXTAREAs).
|
||||
* Binds callback to instanceReady event of all instances. If editor is already created, than
|
||||
* callback is fired right away.
|
||||
*
|
||||
* Mixed parameter order allowed.
|
||||
*
|
||||
* @param callback Function to be run on editor instance. Passed parameters: [ textarea ].
|
||||
* Callback is fiered in "this" scope being ckeditor instance and having source textarea as first param.
|
||||
*
|
||||
* @param config Configuration options for new instance(s) if not already created.
|
||||
* See URL
|
||||
*
|
||||
* @example
|
||||
* $( 'textarea' ).ckeditor( function( textarea ) {
|
||||
* $( textarea ).val( this.getData() )
|
||||
* } );
|
||||
*
|
||||
* @name jQuery.fn.ckeditor
|
||||
* @return jQuery.fn
|
||||
*/
|
||||
ckeditor: function( callback, config )
|
||||
{
|
||||
if ( !CKEDITOR.env.isCompatible )
|
||||
return this;
|
||||
|
||||
if ( !jQuery.isFunction( callback ))
|
||||
{
|
||||
var tmp = config;
|
||||
config = callback;
|
||||
callback = tmp;
|
||||
}
|
||||
config = config || {};
|
||||
|
||||
this.filter( 'textarea, div, p' ).each( function()
|
||||
{
|
||||
var $element = jQuery( this ),
|
||||
editor = $element.data( 'ckeditorInstance' ),
|
||||
instanceLock = $element.data( '_ckeditorInstanceLock' ),
|
||||
element = this;
|
||||
|
||||
if ( editor && !instanceLock )
|
||||
{
|
||||
if ( callback )
|
||||
callback.apply( editor, [ this ] );
|
||||
}
|
||||
else if ( !instanceLock )
|
||||
{
|
||||
// CREATE NEW INSTANCE
|
||||
|
||||
// Handle config.autoUpdateElement inside this plugin if desired.
|
||||
if ( config.autoUpdateElement
|
||||
|| ( typeof config.autoUpdateElement == 'undefined' && CKEDITOR.config.autoUpdateElement ) )
|
||||
{
|
||||
config.autoUpdateElementJquery = true;
|
||||
}
|
||||
|
||||
// Always disable config.autoUpdateElement.
|
||||
config.autoUpdateElement = false;
|
||||
$element.data( '_ckeditorInstanceLock', true );
|
||||
|
||||
// Set instance reference in element's data.
|
||||
editor = CKEDITOR.replace( element, config );
|
||||
$element.data( 'ckeditorInstance', editor );
|
||||
|
||||
// Register callback.
|
||||
editor.on( 'instanceReady', function( event )
|
||||
{
|
||||
var editor = event.editor;
|
||||
setTimeout( function()
|
||||
{
|
||||
// Delay bit more if editor is still not ready.
|
||||
if ( !editor.element )
|
||||
{
|
||||
setTimeout( arguments.callee, 100 );
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove this listener.
|
||||
event.removeListener( 'instanceReady', this.callee );
|
||||
|
||||
// Forward setData on dataReady.
|
||||
editor.on( 'dataReady', function()
|
||||
{
|
||||
$element.trigger( 'setData' + '.ckeditor', [ editor ] );
|
||||
});
|
||||
|
||||
// Forward getData.
|
||||
editor.on( 'getData', function( event ) {
|
||||
$element.trigger( 'getData' + '.ckeditor', [ editor, event.data ] );
|
||||
}, 999 );
|
||||
|
||||
// Forward destroy event.
|
||||
editor.on( 'destroy', function()
|
||||
{
|
||||
$element.trigger( 'destroy.ckeditor', [ editor ] );
|
||||
});
|
||||
|
||||
// Integrate with form submit.
|
||||
if ( editor.config.autoUpdateElementJquery && $element.is( 'textarea' ) && $element.parents( 'form' ).length )
|
||||
{
|
||||
var onSubmit = function()
|
||||
{
|
||||
$element.ckeditor( function()
|
||||
{
|
||||
editor.updateElement();
|
||||
});
|
||||
};
|
||||
|
||||
// Bind to submit event.
|
||||
$element.parents( 'form' ).submit( onSubmit );
|
||||
|
||||
// Bind to form-pre-serialize from jQuery Forms plugin.
|
||||
$element.parents( 'form' ).bind( 'form-pre-serialize', onSubmit );
|
||||
|
||||
// Unbind when editor destroyed.
|
||||
$element.bind( 'destroy.ckeditor', function()
|
||||
{
|
||||
$element.parents( 'form' ).unbind( 'submit', onSubmit );
|
||||
$element.parents( 'form' ).unbind( 'form-pre-serialize', onSubmit );
|
||||
});
|
||||
}
|
||||
|
||||
// Garbage collect on destroy.
|
||||
editor.on( 'destroy', function()
|
||||
{
|
||||
$element.data( 'ckeditorInstance', null );
|
||||
});
|
||||
|
||||
// Remove lock.
|
||||
$element.data( '_ckeditorInstanceLock', null );
|
||||
|
||||
// Fire instanceReady event.
|
||||
$element.trigger( 'instanceReady.ckeditor', [ editor ] );
|
||||
|
||||
// Run given (first) code.
|
||||
if ( callback )
|
||||
callback.apply( editor, [ element ] );
|
||||
}, 0 );
|
||||
}, null, null, 9999);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Editor is already during creation process, bind our code to the event.
|
||||
CKEDITOR.on( 'instanceReady', function( event )
|
||||
{
|
||||
var editor = event.editor;
|
||||
setTimeout( function()
|
||||
{
|
||||
// Delay bit more if editor is still not ready.
|
||||
if ( !editor.element )
|
||||
{
|
||||
setTimeout( arguments.callee, 100 );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( editor.element.$ == element )
|
||||
{
|
||||
// Run given code.
|
||||
if ( callback )
|
||||
callback.apply( editor, [ element ] );
|
||||
}
|
||||
}, 0 );
|
||||
}, null, null, 9999);
|
||||
}
|
||||
});
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
// New val() method for objects.
|
||||
if ( CKEDITOR.config.jqueryOverrideVal )
|
||||
{
|
||||
jQuery.fn.val = CKEDITOR.tools.override( jQuery.fn.val, function( oldValMethod )
|
||||
{
|
||||
/**
|
||||
* CKEditor-aware val() method.
|
||||
*
|
||||
* Acts same as original jQuery val(), but for textareas which have CKEditor instances binded to them, method
|
||||
* returns editor's content. It also works for settings values.
|
||||
*
|
||||
* @param oldValMethod
|
||||
* @name jQuery.fn.val
|
||||
*/
|
||||
return function( newValue, forceNative )
|
||||
{
|
||||
var isSetter = typeof newValue != 'undefined',
|
||||
result;
|
||||
|
||||
this.each( function()
|
||||
{
|
||||
var $this = jQuery( this ),
|
||||
editor = $this.data( 'ckeditorInstance' );
|
||||
|
||||
if ( !forceNative && $this.is( 'textarea' ) && editor )
|
||||
{
|
||||
if ( isSetter )
|
||||
editor.setData( newValue );
|
||||
else
|
||||
{
|
||||
result = editor.getData();
|
||||
// break;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( isSetter )
|
||||
oldValMethod.call( $this, newValue );
|
||||
else
|
||||
{
|
||||
result = oldValMethod.call( $this );
|
||||
// break;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
return isSetter ? this : result;
|
||||
};
|
||||
});
|
||||
}
|
||||
})();
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview jQuery adapter provides easy use of basic CKEditor functions
|
||||
* and access to internal API. It also integrates some aspects of CKEditor with
|
||||
* jQuery framework.
|
||||
*
|
||||
* Every TEXTAREA, DIV and P elements can be converted to working editor.
|
||||
*
|
||||
* Plugin exposes some of editor's event to jQuery event system. All of those are namespaces inside
|
||||
* ".ckeditor" namespace and can be binded/listened on supported textarea, div and p nodes.
|
||||
*
|
||||
* Available jQuery events:
|
||||
* - instanceReady.ckeditor( editor, rootNode )
|
||||
* Triggered when new instance is ready.
|
||||
* - destroy.ckeditor( editor )
|
||||
* Triggered when instance is destroyed.
|
||||
* - getData.ckeditor( editor, eventData )
|
||||
* Triggered when getData event is fired inside editor. It can change returned data using eventData reference.
|
||||
* - setData.ckeditor( editor )
|
||||
* Triggered when getData event is fired inside editor.
|
||||
*
|
||||
* @example
|
||||
* <script src="jquery.js"></script>
|
||||
* <script src="ckeditor.js"></script>
|
||||
* <script src="adapters/jquery/adapter.js"></script>
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
/**
|
||||
* Allows CKEditor to override jQuery.fn.val(), making it possible to use the val()
|
||||
* function on textareas, as usual, having it synchronized with CKEditor.<br>
|
||||
* <br>
|
||||
* This configuration option is global and executed during the jQuery Adapter loading.
|
||||
* It can't be customized across editor instances.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* <script>
|
||||
* CKEDITOR.config.jqueryOverrideVal = true;
|
||||
* </script>
|
||||
* <!-- Important: The JQuery adapter is loaded *after* setting jqueryOverrideVal -->
|
||||
* <script src="/ckeditor/adapters/jquery.js"></script>
|
||||
* @example
|
||||
* // ... then later in the code ...
|
||||
*
|
||||
* $( 'textarea' ).ckeditor();
|
||||
* // ...
|
||||
* $( 'textarea' ).val( 'New content' );
|
||||
*/
|
||||
CKEDITOR.config.jqueryOverrideVal = typeof CKEDITOR.config.jqueryOverrideVal == 'undefined'
|
||||
? true : CKEDITOR.config.jqueryOverrideVal;
|
||||
|
||||
var jQuery = window.jQuery;
|
||||
|
||||
if ( typeof jQuery == 'undefined' )
|
||||
return;
|
||||
|
||||
// jQuery object methods.
|
||||
jQuery.extend( jQuery.fn,
|
||||
/** @lends jQuery.fn */
|
||||
{
|
||||
/**
|
||||
* Return existing CKEditor instance for first matched element.
|
||||
* Allows to easily use internal API. Doesn't return jQuery object.
|
||||
*
|
||||
* Raised exception if editor doesn't exist or isn't ready yet.
|
||||
*
|
||||
* @name jQuery.ckeditorGet
|
||||
* @return CKEDITOR.editor
|
||||
* @see CKEDITOR.editor
|
||||
*/
|
||||
ckeditorGet: function()
|
||||
{
|
||||
var instance = this.eq( 0 ).data( 'ckeditorInstance' );
|
||||
if ( !instance )
|
||||
throw "CKEditor not yet initialized, use ckeditor() with callback.";
|
||||
return instance;
|
||||
},
|
||||
/**
|
||||
* Triggers creation of CKEditor in all matched elements (reduced to DIV, P and TEXTAREAs).
|
||||
* Binds callback to instanceReady event of all instances. If editor is already created, than
|
||||
* callback is fired right away.
|
||||
*
|
||||
* Mixed parameter order allowed.
|
||||
*
|
||||
* @param callback Function to be run on editor instance. Passed parameters: [ textarea ].
|
||||
* Callback is fiered in "this" scope being ckeditor instance and having source textarea as first param.
|
||||
*
|
||||
* @param config Configuration options for new instance(s) if not already created.
|
||||
* See URL
|
||||
*
|
||||
* @example
|
||||
* $( 'textarea' ).ckeditor( function( textarea ) {
|
||||
* $( textarea ).val( this.getData() )
|
||||
* } );
|
||||
*
|
||||
* @name jQuery.fn.ckeditor
|
||||
* @return jQuery.fn
|
||||
*/
|
||||
ckeditor: function( callback, config )
|
||||
{
|
||||
if ( !CKEDITOR.env.isCompatible )
|
||||
return this;
|
||||
|
||||
if ( !jQuery.isFunction( callback ))
|
||||
{
|
||||
var tmp = config;
|
||||
config = callback;
|
||||
callback = tmp;
|
||||
}
|
||||
config = config || {};
|
||||
|
||||
this.filter( 'textarea, div, p' ).each( function()
|
||||
{
|
||||
var $element = jQuery( this ),
|
||||
editor = $element.data( 'ckeditorInstance' ),
|
||||
instanceLock = $element.data( '_ckeditorInstanceLock' ),
|
||||
element = this;
|
||||
|
||||
if ( editor && !instanceLock )
|
||||
{
|
||||
if ( callback )
|
||||
callback.apply( editor, [ this ] );
|
||||
}
|
||||
else if ( !instanceLock )
|
||||
{
|
||||
// CREATE NEW INSTANCE
|
||||
|
||||
// Handle config.autoUpdateElement inside this plugin if desired.
|
||||
if ( config.autoUpdateElement
|
||||
|| ( typeof config.autoUpdateElement == 'undefined' && CKEDITOR.config.autoUpdateElement ) )
|
||||
{
|
||||
config.autoUpdateElementJquery = true;
|
||||
}
|
||||
|
||||
// Always disable config.autoUpdateElement.
|
||||
config.autoUpdateElement = false;
|
||||
$element.data( '_ckeditorInstanceLock', true );
|
||||
|
||||
// Set instance reference in element's data.
|
||||
editor = CKEDITOR.replace( element, config );
|
||||
$element.data( 'ckeditorInstance', editor );
|
||||
|
||||
// Register callback.
|
||||
editor.on( 'instanceReady', function( event )
|
||||
{
|
||||
var editor = event.editor;
|
||||
setTimeout( function()
|
||||
{
|
||||
// Delay bit more if editor is still not ready.
|
||||
if ( !editor.element )
|
||||
{
|
||||
setTimeout( arguments.callee, 100 );
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove this listener.
|
||||
event.removeListener( 'instanceReady', this.callee );
|
||||
|
||||
// Forward setData on dataReady.
|
||||
editor.on( 'dataReady', function()
|
||||
{
|
||||
$element.trigger( 'setData' + '.ckeditor', [ editor ] );
|
||||
});
|
||||
|
||||
// Forward getData.
|
||||
editor.on( 'getData', function( event ) {
|
||||
$element.trigger( 'getData' + '.ckeditor', [ editor, event.data ] );
|
||||
}, 999 );
|
||||
|
||||
// Forward destroy event.
|
||||
editor.on( 'destroy', function()
|
||||
{
|
||||
$element.trigger( 'destroy.ckeditor', [ editor ] );
|
||||
});
|
||||
|
||||
// Integrate with form submit.
|
||||
if ( editor.config.autoUpdateElementJquery && $element.is( 'textarea' ) && $element.parents( 'form' ).length )
|
||||
{
|
||||
var onSubmit = function()
|
||||
{
|
||||
$element.ckeditor( function()
|
||||
{
|
||||
editor.updateElement();
|
||||
});
|
||||
};
|
||||
|
||||
// Bind to submit event.
|
||||
$element.parents( 'form' ).submit( onSubmit );
|
||||
|
||||
// Bind to form-pre-serialize from jQuery Forms plugin.
|
||||
$element.parents( 'form' ).bind( 'form-pre-serialize', onSubmit );
|
||||
|
||||
// Unbind when editor destroyed.
|
||||
$element.bind( 'destroy.ckeditor', function()
|
||||
{
|
||||
$element.parents( 'form' ).unbind( 'submit', onSubmit );
|
||||
$element.parents( 'form' ).unbind( 'form-pre-serialize', onSubmit );
|
||||
});
|
||||
}
|
||||
|
||||
// Garbage collect on destroy.
|
||||
editor.on( 'destroy', function()
|
||||
{
|
||||
$element.data( 'ckeditorInstance', null );
|
||||
});
|
||||
|
||||
// Remove lock.
|
||||
$element.data( '_ckeditorInstanceLock', null );
|
||||
|
||||
// Fire instanceReady event.
|
||||
$element.trigger( 'instanceReady.ckeditor', [ editor ] );
|
||||
|
||||
// Run given (first) code.
|
||||
if ( callback )
|
||||
callback.apply( editor, [ element ] );
|
||||
}, 0 );
|
||||
}, null, null, 9999);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Editor is already during creation process, bind our code to the event.
|
||||
CKEDITOR.on( 'instanceReady', function( event )
|
||||
{
|
||||
var editor = event.editor;
|
||||
setTimeout( function()
|
||||
{
|
||||
// Delay bit more if editor is still not ready.
|
||||
if ( !editor.element )
|
||||
{
|
||||
setTimeout( arguments.callee, 100 );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( editor.element.$ == element )
|
||||
{
|
||||
// Run given code.
|
||||
if ( callback )
|
||||
callback.apply( editor, [ element ] );
|
||||
}
|
||||
}, 0 );
|
||||
}, null, null, 9999);
|
||||
}
|
||||
});
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
// New val() method for objects.
|
||||
if ( CKEDITOR.config.jqueryOverrideVal )
|
||||
{
|
||||
jQuery.fn.val = CKEDITOR.tools.override( jQuery.fn.val, function( oldValMethod )
|
||||
{
|
||||
/**
|
||||
* CKEditor-aware val() method.
|
||||
*
|
||||
* Acts same as original jQuery val(), but for textareas which have CKEditor instances binded to them, method
|
||||
* returns editor's content. It also works for settings values.
|
||||
*
|
||||
* @param oldValMethod
|
||||
* @name jQuery.fn.val
|
||||
*/
|
||||
return function( newValue, forceNative )
|
||||
{
|
||||
var isSetter = typeof newValue != 'undefined',
|
||||
result;
|
||||
|
||||
this.each( function()
|
||||
{
|
||||
var $this = jQuery( this ),
|
||||
editor = $this.data( 'ckeditorInstance' );
|
||||
|
||||
if ( !forceNative && $this.is( 'textarea' ) && editor )
|
||||
{
|
||||
if ( isSetter )
|
||||
editor.setData( newValue );
|
||||
else
|
||||
{
|
||||
result = editor.getData();
|
||||
// break;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( isSetter )
|
||||
oldValMethod.call( $this, newValue );
|
||||
else
|
||||
{
|
||||
result = oldValMethod.call( $this );
|
||||
// break;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
return isSetter ? this : result;
|
||||
};
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
@ -1,87 +1,87 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview API initialization code.
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
// Disable HC detaction in WebKit. (#5429)
|
||||
if ( CKEDITOR.env.webkit )
|
||||
{
|
||||
CKEDITOR.env.hc = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Check whether high contrast is active by creating a colored border.
|
||||
var hcDetect = CKEDITOR.dom.element.createFromHtml(
|
||||
'<div style="width:0px;height:0px;position:absolute;left:-10000px;' +
|
||||
'border: 1px solid;border-color: red blue;"></div>', CKEDITOR.document );
|
||||
|
||||
hcDetect.appendTo( CKEDITOR.document.getHead() );
|
||||
|
||||
// Update CKEDITOR.env.
|
||||
// Catch exception needed sometimes for FF. (#4230)
|
||||
try
|
||||
{
|
||||
CKEDITOR.env.hc = hcDetect.getComputedStyle( 'border-top-color' ) == hcDetect.getComputedStyle( 'border-right-color' );
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
CKEDITOR.env.hc = false;
|
||||
}
|
||||
|
||||
if ( CKEDITOR.env.hc )
|
||||
CKEDITOR.env.cssClass += ' cke_hc';
|
||||
|
||||
hcDetect.remove();
|
||||
})();
|
||||
|
||||
// Load core plugins.
|
||||
CKEDITOR.plugins.load( CKEDITOR.config.corePlugins.split( ',' ), function()
|
||||
{
|
||||
CKEDITOR.status = 'loaded';
|
||||
CKEDITOR.fire( 'loaded' );
|
||||
|
||||
// Process all instances created by the "basic" implementation.
|
||||
var pending = CKEDITOR._.pending;
|
||||
if ( pending )
|
||||
{
|
||||
delete CKEDITOR._.pending;
|
||||
|
||||
for ( var i = 0 ; i < pending.length ; i++ )
|
||||
CKEDITOR.add( pending[ i ] );
|
||||
}
|
||||
});
|
||||
|
||||
// Needed for IE6 to not request image (HTTP 200 or 304) for every CSS background. (#6187)
|
||||
if ( CKEDITOR.env.ie )
|
||||
{
|
||||
// Remove IE mouse flickering on IE6 because of background images.
|
||||
try
|
||||
{
|
||||
document.execCommand( 'BackgroundImageCache', false, true );
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
// We have been reported about loading problems caused by the above
|
||||
// line. For safety, let's just ignore errors.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on a High Contrast environment.
|
||||
* @name CKEDITOR.env.hc
|
||||
* @example
|
||||
* if ( CKEDITOR.env.hc )
|
||||
* alert( 'You're running on High Contrast mode. The editor interface will get adapted to provide you a better experience.' );
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired when a CKEDITOR core object is fully loaded and ready for interaction.
|
||||
* @name CKEDITOR#loaded
|
||||
* @event
|
||||
*/
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview API initialization code.
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
// Disable HC detaction in WebKit. (#5429)
|
||||
if ( CKEDITOR.env.webkit )
|
||||
{
|
||||
CKEDITOR.env.hc = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Check whether high contrast is active by creating a colored border.
|
||||
var hcDetect = CKEDITOR.dom.element.createFromHtml(
|
||||
'<div style="width:0px;height:0px;position:absolute;left:-10000px;' +
|
||||
'border: 1px solid;border-color: red blue;"></div>', CKEDITOR.document );
|
||||
|
||||
hcDetect.appendTo( CKEDITOR.document.getHead() );
|
||||
|
||||
// Update CKEDITOR.env.
|
||||
// Catch exception needed sometimes for FF. (#4230)
|
||||
try
|
||||
{
|
||||
CKEDITOR.env.hc = hcDetect.getComputedStyle( 'border-top-color' ) == hcDetect.getComputedStyle( 'border-right-color' );
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
CKEDITOR.env.hc = false;
|
||||
}
|
||||
|
||||
if ( CKEDITOR.env.hc )
|
||||
CKEDITOR.env.cssClass += ' cke_hc';
|
||||
|
||||
hcDetect.remove();
|
||||
})();
|
||||
|
||||
// Load core plugins.
|
||||
CKEDITOR.plugins.load( CKEDITOR.config.corePlugins.split( ',' ), function()
|
||||
{
|
||||
CKEDITOR.status = 'loaded';
|
||||
CKEDITOR.fire( 'loaded' );
|
||||
|
||||
// Process all instances created by the "basic" implementation.
|
||||
var pending = CKEDITOR._.pending;
|
||||
if ( pending )
|
||||
{
|
||||
delete CKEDITOR._.pending;
|
||||
|
||||
for ( var i = 0 ; i < pending.length ; i++ )
|
||||
CKEDITOR.add( pending[ i ] );
|
||||
}
|
||||
});
|
||||
|
||||
// Needed for IE6 to not request image (HTTP 200 or 304) for every CSS background. (#6187)
|
||||
if ( CKEDITOR.env.ie )
|
||||
{
|
||||
// Remove IE mouse flickering on IE6 because of background images.
|
||||
try
|
||||
{
|
||||
document.execCommand( 'BackgroundImageCache', false, true );
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
// We have been reported about loading problems caused by the above
|
||||
// line. For safety, let's just ignore errors.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on a High Contrast environment.
|
||||
* @name CKEDITOR.env.hc
|
||||
* @example
|
||||
* if ( CKEDITOR.env.hc )
|
||||
* alert( 'You're running on High Contrast mode. The editor interface will get adapted to provide you a better experience.' );
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired when a CKEDITOR core object is fully loaded and ready for interaction.
|
||||
* @name CKEDITOR#loaded
|
||||
* @event
|
||||
*/
|
||||
|
||||
282
htdocs/includes/ckeditor/_source/core/ckeditor.js
vendored
282
htdocs/includes/ckeditor/_source/core/ckeditor.js
vendored
@ -1,141 +1,141 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Contains the third and last part of the {@link CKEDITOR} object
|
||||
* definition.
|
||||
*/
|
||||
|
||||
// Remove the CKEDITOR.loadFullCore reference defined on ckeditor_basic.
|
||||
delete CKEDITOR.loadFullCore;
|
||||
|
||||
/**
|
||||
* Holds references to all editor instances created. The name of the properties
|
||||
* in this object correspond to instance names, and their values contains the
|
||||
* {@link CKEDITOR.editor} object representing them.
|
||||
* @type {Object}
|
||||
* @example
|
||||
* alert( <b>CKEDITOR.instances</b>.editor1.name ); // "editor1"
|
||||
*/
|
||||
CKEDITOR.instances = {};
|
||||
|
||||
/**
|
||||
* The document of the window holding the CKEDITOR object.
|
||||
* @type {CKEDITOR.dom.document}
|
||||
* @example
|
||||
* alert( <b>CKEDITOR.document</b>.getBody().getName() ); // "body"
|
||||
*/
|
||||
CKEDITOR.document = new CKEDITOR.dom.document( document );
|
||||
|
||||
/**
|
||||
* Adds an editor instance to the global {@link CKEDITOR} object. This function
|
||||
* is available for internal use mainly.
|
||||
* @param {CKEDITOR.editor} editor The editor instance to be added.
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.add = function( editor )
|
||||
{
|
||||
CKEDITOR.instances[ editor.name ] = editor;
|
||||
|
||||
editor.on( 'focus', function()
|
||||
{
|
||||
if ( CKEDITOR.currentInstance != editor )
|
||||
{
|
||||
CKEDITOR.currentInstance = editor;
|
||||
CKEDITOR.fire( 'currentInstance' );
|
||||
}
|
||||
});
|
||||
|
||||
editor.on( 'blur', function()
|
||||
{
|
||||
if ( CKEDITOR.currentInstance == editor )
|
||||
{
|
||||
CKEDITOR.currentInstance = null;
|
||||
CKEDITOR.fire( 'currentInstance' );
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes an editor instance from the global {@link CKEDITOR} object. This function
|
||||
* is available for internal use only. External code must use {@link CKEDITOR.editor.prototype.destroy}
|
||||
* to avoid memory leaks.
|
||||
* @param {CKEDITOR.editor} editor The editor instance to be removed.
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.remove = function( editor )
|
||||
{
|
||||
delete CKEDITOR.instances[ editor.name ];
|
||||
};
|
||||
|
||||
/**
|
||||
* Perform global clean up to free as much memory as possible
|
||||
* when there are no instances left
|
||||
*/
|
||||
CKEDITOR.on( 'instanceDestroyed', function ()
|
||||
{
|
||||
if ( CKEDITOR.tools.isEmpty( this.instances ) )
|
||||
CKEDITOR.fire( 'reset' );
|
||||
});
|
||||
|
||||
// Load the bootstrap script.
|
||||
CKEDITOR.loader.load( 'core/_bootstrap' ); // @Packager.RemoveLine
|
||||
|
||||
// Tri-state constants.
|
||||
|
||||
/**
|
||||
* Used to indicate the ON or ACTIVE state.
|
||||
* @constant
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.TRISTATE_ON = 1;
|
||||
|
||||
/**
|
||||
* Used to indicate the OFF or NON ACTIVE state.
|
||||
* @constant
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.TRISTATE_OFF = 2;
|
||||
|
||||
/**
|
||||
* Used to indicate DISABLED state.
|
||||
* @constant
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.TRISTATE_DISABLED = 0;
|
||||
|
||||
/**
|
||||
* The editor which is currently active (have user focus).
|
||||
* @name CKEDITOR.currentInstance
|
||||
* @type CKEDITOR.editor
|
||||
* @see CKEDITOR#currentInstance
|
||||
* @example
|
||||
* function showCurrentEditorName()
|
||||
* {
|
||||
* if ( CKEDITOR.currentInstance )
|
||||
* alert( CKEDITOR.currentInstance.name );
|
||||
* else
|
||||
* alert( 'Please focus an editor first.' );
|
||||
* }
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired when the CKEDITOR.currentInstance object reference changes. This may
|
||||
* happen when setting the focus on different editor instances in the page.
|
||||
* @name CKEDITOR#currentInstance
|
||||
* @event
|
||||
* var editor; // Variable to hold a reference to the current editor.
|
||||
* CKEDITOR.on( 'currentInstance' , function( e )
|
||||
* {
|
||||
* editor = CKEDITOR.currentInstance;
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired when the last instance has been destroyed. This event is used to perform
|
||||
* global memory clean up.
|
||||
* @name CKEDITOR#reset
|
||||
* @event
|
||||
*/
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Contains the third and last part of the {@link CKEDITOR} object
|
||||
* definition.
|
||||
*/
|
||||
|
||||
// Remove the CKEDITOR.loadFullCore reference defined on ckeditor_basic.
|
||||
delete CKEDITOR.loadFullCore;
|
||||
|
||||
/**
|
||||
* Holds references to all editor instances created. The name of the properties
|
||||
* in this object correspond to instance names, and their values contains the
|
||||
* {@link CKEDITOR.editor} object representing them.
|
||||
* @type {Object}
|
||||
* @example
|
||||
* alert( <b>CKEDITOR.instances</b>.editor1.name ); // "editor1"
|
||||
*/
|
||||
CKEDITOR.instances = {};
|
||||
|
||||
/**
|
||||
* The document of the window holding the CKEDITOR object.
|
||||
* @type {CKEDITOR.dom.document}
|
||||
* @example
|
||||
* alert( <b>CKEDITOR.document</b>.getBody().getName() ); // "body"
|
||||
*/
|
||||
CKEDITOR.document = new CKEDITOR.dom.document( document );
|
||||
|
||||
/**
|
||||
* Adds an editor instance to the global {@link CKEDITOR} object. This function
|
||||
* is available for internal use mainly.
|
||||
* @param {CKEDITOR.editor} editor The editor instance to be added.
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.add = function( editor )
|
||||
{
|
||||
CKEDITOR.instances[ editor.name ] = editor;
|
||||
|
||||
editor.on( 'focus', function()
|
||||
{
|
||||
if ( CKEDITOR.currentInstance != editor )
|
||||
{
|
||||
CKEDITOR.currentInstance = editor;
|
||||
CKEDITOR.fire( 'currentInstance' );
|
||||
}
|
||||
});
|
||||
|
||||
editor.on( 'blur', function()
|
||||
{
|
||||
if ( CKEDITOR.currentInstance == editor )
|
||||
{
|
||||
CKEDITOR.currentInstance = null;
|
||||
CKEDITOR.fire( 'currentInstance' );
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes an editor instance from the global {@link CKEDITOR} object. This function
|
||||
* is available for internal use only. External code must use {@link CKEDITOR.editor.prototype.destroy}
|
||||
* to avoid memory leaks.
|
||||
* @param {CKEDITOR.editor} editor The editor instance to be removed.
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.remove = function( editor )
|
||||
{
|
||||
delete CKEDITOR.instances[ editor.name ];
|
||||
};
|
||||
|
||||
/**
|
||||
* Perform global clean up to free as much memory as possible
|
||||
* when there are no instances left
|
||||
*/
|
||||
CKEDITOR.on( 'instanceDestroyed', function ()
|
||||
{
|
||||
if ( CKEDITOR.tools.isEmpty( this.instances ) )
|
||||
CKEDITOR.fire( 'reset' );
|
||||
});
|
||||
|
||||
// Load the bootstrap script.
|
||||
CKEDITOR.loader.load( 'core/_bootstrap' ); // @Packager.RemoveLine
|
||||
|
||||
// Tri-state constants.
|
||||
|
||||
/**
|
||||
* Used to indicate the ON or ACTIVE state.
|
||||
* @constant
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.TRISTATE_ON = 1;
|
||||
|
||||
/**
|
||||
* Used to indicate the OFF or NON ACTIVE state.
|
||||
* @constant
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.TRISTATE_OFF = 2;
|
||||
|
||||
/**
|
||||
* Used to indicate DISABLED state.
|
||||
* @constant
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.TRISTATE_DISABLED = 0;
|
||||
|
||||
/**
|
||||
* The editor which is currently active (have user focus).
|
||||
* @name CKEDITOR.currentInstance
|
||||
* @type CKEDITOR.editor
|
||||
* @see CKEDITOR#currentInstance
|
||||
* @example
|
||||
* function showCurrentEditorName()
|
||||
* {
|
||||
* if ( CKEDITOR.currentInstance )
|
||||
* alert( CKEDITOR.currentInstance.name );
|
||||
* else
|
||||
* alert( 'Please focus an editor first.' );
|
||||
* }
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired when the CKEDITOR.currentInstance object reference changes. This may
|
||||
* happen when setting the focus on different editor instances in the page.
|
||||
* @name CKEDITOR#currentInstance
|
||||
* @event
|
||||
* var editor; // Variable to hold a reference to the current editor.
|
||||
* CKEDITOR.on( 'currentInstance' , function( e )
|
||||
* {
|
||||
* editor = CKEDITOR.currentInstance;
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired when the last instance has been destroyed. This event is used to perform
|
||||
* global memory clean up.
|
||||
* @name CKEDITOR#reset
|
||||
* @event
|
||||
*/
|
||||
|
||||
@ -1,235 +1,235 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Contains the first and essential part of the {@link CKEDITOR}
|
||||
* object definition.
|
||||
*/
|
||||
|
||||
// #### Compressed Code
|
||||
// Must be updated on changes in the script as well as updated in the
|
||||
// ckeditor_source.js and ckeditor_basic_source.js files.
|
||||
|
||||
// if(!window.CKEDITOR)window.CKEDITOR=(function(){var a={timestamp:'',version:'3.6.4',revision:'7575',rnd:Math.floor(Math.random()*900)+100,_:{},status:'unloaded',basePath:(function(){var d=window.CKEDITOR_BASEPATH||'';if(!d){var e=document.getElementsByTagName('script');for(var f=0;f<e.length;f++){var g=e[f].src.match(/(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i);if(g){d=g[1];break;}}}if(d.indexOf(':/')==-1)if(d.indexOf('/')===0)d=location.href.match(/^.*?:\/\/[^\/]*/)[0]+d;else d=location.href.match(/^[^\?]*\/(?:)/)[0]+d;if(!d)throw 'The CKEditor installation path could not be automatically detected. Please set the global variable "CKEDITOR_BASEPATH" before creating editor instances.';return d;})(),getUrl:function(d){if(d.indexOf(':/')==-1&&d.indexOf('/')!==0)d=this.basePath+d;if(this.timestamp&&d.charAt(d.length-1)!='/'&&!/[&?]t=/.test(d))d+=(d.indexOf('?')>=0?'&':'?')+'t='+this.timestamp;return d;}},b=window.CKEDITOR_GETURL;if(b){var c=a.getUrl;a.getUrl=function(d){return b.call(a,d)||c.call(a,d);};}return a;})();
|
||||
|
||||
// #### Raw code
|
||||
// ATTENTION: read the above "Compressed Code" notes when changing this code.
|
||||
|
||||
/* @Packager.RemoveLine
|
||||
// Avoid having the editor code initialized twice. (#7588)
|
||||
// Use CKEDITOR.dom to check whether the full ckeditor.js code has been loaded
|
||||
// or just ckeditor_basic.js.
|
||||
// Remove these lines when compressing manually.
|
||||
if ( window.CKEDITOR && window.CKEDITOR.dom )
|
||||
return;
|
||||
@Packager.RemoveLine */
|
||||
|
||||
if ( !window.CKEDITOR )
|
||||
{
|
||||
/**
|
||||
* @name CKEDITOR
|
||||
* @namespace This is the API entry point. The entire CKEditor code runs under this object.
|
||||
* @example
|
||||
*/
|
||||
window.CKEDITOR = (function()
|
||||
{
|
||||
var CKEDITOR =
|
||||
/** @lends CKEDITOR */
|
||||
{
|
||||
|
||||
/**
|
||||
* A constant string unique for each release of CKEditor. Its value
|
||||
* is used, by default, to build the URL for all resources loaded
|
||||
* by the editor code, guaranteeing clean cache results when
|
||||
* upgrading.
|
||||
* @type String
|
||||
* @example
|
||||
* alert( CKEDITOR.timestamp ); // e.g. '87dm'
|
||||
*/
|
||||
// The production implementation contains a fixed timestamp, unique
|
||||
// for each release and generated by the releaser.
|
||||
// (Base 36 value of each component of YYMMDDHH - 4 chars total - e.g. 87bm == 08071122)
|
||||
timestamp : 'C6HH5UF',
|
||||
|
||||
/**
|
||||
* Contains the CKEditor version number.
|
||||
* @type String
|
||||
* @example
|
||||
* alert( CKEDITOR.version ); // e.g. 'CKEditor 3.4.1'
|
||||
*/
|
||||
version : '3.6.4',
|
||||
|
||||
/**
|
||||
* Contains the CKEditor revision number.
|
||||
* The revision number is incremented automatically, following each
|
||||
* modification to the CKEditor source code.
|
||||
* @type String
|
||||
* @example
|
||||
* alert( CKEDITOR.revision ); // e.g. '3975'
|
||||
*/
|
||||
revision : '7575',
|
||||
|
||||
/**
|
||||
* A 3-digit random integer, valid for the entire life of the CKEDITOR object.
|
||||
* @type Number
|
||||
* @example
|
||||
* alert( CKEDITOR.rnd ); // e.g. '319'
|
||||
*/
|
||||
rnd : Math.floor( Math.random() * ( 999/*Max*/ - 100/*Min*/ + 1 ) ) + 100/*Min*/,
|
||||
|
||||
/**
|
||||
* Private object used to hold core stuff. It should not be used outside of
|
||||
* the API code as properties defined here may change at any time
|
||||
* without notice.
|
||||
* @private
|
||||
*/
|
||||
_ : {},
|
||||
|
||||
/**
|
||||
* Indicates the API loading status. The following statuses are available:
|
||||
* <ul>
|
||||
* <li><b>unloaded</b>: the API is not yet loaded.</li>
|
||||
* <li><b>basic_loaded</b>: the basic API features are available.</li>
|
||||
* <li><b>basic_ready</b>: the basic API is ready to load the full core code.</li>
|
||||
* <li><b>loading</b>: the full API is being loaded.</li>
|
||||
* <li><b>loaded</b>: the API can be fully used.</li>
|
||||
* </ul>
|
||||
* @type String
|
||||
* @example
|
||||
* if ( <b>CKEDITOR.status</b> == 'loaded' )
|
||||
* {
|
||||
* // The API can now be fully used.
|
||||
* }
|
||||
*/
|
||||
status : 'unloaded',
|
||||
|
||||
/**
|
||||
* Contains the full URL for the CKEditor installation directory.
|
||||
* It is possible to manually provide the base path by setting a
|
||||
* global variable named CKEDITOR_BASEPATH. This global variable
|
||||
* must be set <strong>before</strong> the editor script loading.
|
||||
* @type String
|
||||
* @example
|
||||
* alert( <b>CKEDITOR.basePath</b> ); // "http://www.example.com/ckeditor/" (e.g.)
|
||||
*/
|
||||
basePath : (function()
|
||||
{
|
||||
// ATTENTION: fixes to this code must be ported to
|
||||
// var basePath in "core/loader.js".
|
||||
|
||||
// Find out the editor directory path, based on its <script> tag.
|
||||
var path = window.CKEDITOR_BASEPATH || '';
|
||||
|
||||
if ( !path )
|
||||
{
|
||||
var scripts = document.getElementsByTagName( 'script' );
|
||||
|
||||
for ( var i = 0 ; i < scripts.length ; i++ )
|
||||
{
|
||||
var match = scripts[i].src.match( /(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i );
|
||||
|
||||
if ( match )
|
||||
{
|
||||
path = match[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// In IE (only) the script.src string is the raw value entered in the
|
||||
// HTML source. Other browsers return the full resolved URL instead.
|
||||
if ( path.indexOf(':/') == -1 )
|
||||
{
|
||||
// Absolute path.
|
||||
if ( path.indexOf( '/' ) === 0 )
|
||||
path = location.href.match( /^.*?:\/\/[^\/]*/ )[0] + path;
|
||||
// Relative path.
|
||||
else
|
||||
path = location.href.match( /^[^\?]*\/(?:)/ )[0] + path;
|
||||
}
|
||||
|
||||
if ( !path )
|
||||
throw 'The CKEditor installation path could not be automatically detected. Please set the global variable "CKEDITOR_BASEPATH" before creating editor instances.';
|
||||
|
||||
return path;
|
||||
})(),
|
||||
|
||||
/**
|
||||
* Gets the full URL for CKEditor resources. By default, URLs
|
||||
* returned by this function contain a querystring parameter ("t")
|
||||
* set to the {@link CKEDITOR.timestamp} value.<br />
|
||||
* <br />
|
||||
* It is possible to provide a custom implementation of this
|
||||
* function by setting a global variable named CKEDITOR_GETURL.
|
||||
* This global variable must be set <strong>before</strong> the editor script
|
||||
* loading. If the custom implementation returns nothing (==null), the
|
||||
* default implementation is used.
|
||||
* @param {String} resource The resource whose full URL we want to get.
|
||||
* It may be a full, absolute, or relative URL.
|
||||
* @returns {String} The full URL.
|
||||
* @example
|
||||
* // e.g. http://www.example.com/ckeditor/skins/default/editor.css?t=87dm
|
||||
* alert( CKEDITOR.getUrl( 'skins/default/editor.css' ) );
|
||||
* @example
|
||||
* // e.g. http://www.example.com/skins/default/editor.css?t=87dm
|
||||
* alert( CKEDITOR.getUrl( '/skins/default/editor.css' ) );
|
||||
* @example
|
||||
* // e.g. http://www.somesite.com/skins/default/editor.css?t=87dm
|
||||
* alert( CKEDITOR.getUrl( 'http://www.somesite.com/skins/default/editor.css' ) );
|
||||
*/
|
||||
getUrl : function( resource )
|
||||
{
|
||||
// If this is not a full or absolute path.
|
||||
if ( resource.indexOf(':/') == -1 && resource.indexOf( '/' ) !== 0 )
|
||||
resource = this.basePath + resource;
|
||||
|
||||
// Add the timestamp, except for directories.
|
||||
if ( this.timestamp && resource.charAt( resource.length - 1 ) != '/' && !(/[&?]t=/).test( resource ) )
|
||||
resource += ( resource.indexOf( '?' ) >= 0 ? '&' : '?' ) + 't=' + this.timestamp;
|
||||
|
||||
return resource;
|
||||
}
|
||||
};
|
||||
|
||||
// Make it possible to override the getUrl function with a custom
|
||||
// implementation pointing to a global named CKEDITOR_GETURL.
|
||||
var newGetUrl = window.CKEDITOR_GETURL;
|
||||
if ( newGetUrl )
|
||||
{
|
||||
var originalGetUrl = CKEDITOR.getUrl;
|
||||
CKEDITOR.getUrl = function ( resource )
|
||||
{
|
||||
return newGetUrl.call( CKEDITOR, resource ) ||
|
||||
originalGetUrl.call( CKEDITOR, resource );
|
||||
};
|
||||
}
|
||||
|
||||
return CKEDITOR;
|
||||
})();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called upon loading a custom configuration file that can
|
||||
* modify the editor instance configuration ({@link CKEDITOR.editor#config }).
|
||||
* It is usually defined inside the custom configuration files that can
|
||||
* include developer defined settings.
|
||||
* @name CKEDITOR.editorConfig
|
||||
* @function
|
||||
* @param {CKEDITOR.config} config A configuration object containing the
|
||||
* settings defined for a {@link CKEDITOR.editor} instance up to this
|
||||
* function call. Note that not all settings may still be available. See
|
||||
* <a href="http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Setting_Configurations#Configuration_Loading_Order">Configuration Loading Order</a>
|
||||
* for details.
|
||||
* @example
|
||||
* // This is supposed to be placed in the config.js file.
|
||||
* CKEDITOR.editorConfig = function( config )
|
||||
* {
|
||||
* // Define changes to default configuration here. For example:
|
||||
* config.language = 'fr';
|
||||
* config.uiColor = '#AADC6E';
|
||||
* };
|
||||
*/
|
||||
|
||||
// PACKAGER_RENAME( CKEDITOR )
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Contains the first and essential part of the {@link CKEDITOR}
|
||||
* object definition.
|
||||
*/
|
||||
|
||||
// #### Compressed Code
|
||||
// Must be updated on changes in the script as well as updated in the
|
||||
// ckeditor_source.js and ckeditor_basic_source.js files.
|
||||
|
||||
// if(!window.CKEDITOR)window.CKEDITOR=(function(){var a={timestamp:'',version:'3.6.4',revision:'7575',rnd:Math.floor(Math.random()*900)+100,_:{},status:'unloaded',basePath:(function(){var d=window.CKEDITOR_BASEPATH||'';if(!d){var e=document.getElementsByTagName('script');for(var f=0;f<e.length;f++){var g=e[f].src.match(/(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i);if(g){d=g[1];break;}}}if(d.indexOf(':/')==-1)if(d.indexOf('/')===0)d=location.href.match(/^.*?:\/\/[^\/]*/)[0]+d;else d=location.href.match(/^[^\?]*\/(?:)/)[0]+d;if(!d)throw 'The CKEditor installation path could not be automatically detected. Please set the global variable "CKEDITOR_BASEPATH" before creating editor instances.';return d;})(),getUrl:function(d){if(d.indexOf(':/')==-1&&d.indexOf('/')!==0)d=this.basePath+d;if(this.timestamp&&d.charAt(d.length-1)!='/'&&!/[&?]t=/.test(d))d+=(d.indexOf('?')>=0?'&':'?')+'t='+this.timestamp;return d;}},b=window.CKEDITOR_GETURL;if(b){var c=a.getUrl;a.getUrl=function(d){return b.call(a,d)||c.call(a,d);};}return a;})();
|
||||
|
||||
// #### Raw code
|
||||
// ATTENTION: read the above "Compressed Code" notes when changing this code.
|
||||
|
||||
/* @Packager.RemoveLine
|
||||
// Avoid having the editor code initialized twice. (#7588)
|
||||
// Use CKEDITOR.dom to check whether the full ckeditor.js code has been loaded
|
||||
// or just ckeditor_basic.js.
|
||||
// Remove these lines when compressing manually.
|
||||
if ( window.CKEDITOR && window.CKEDITOR.dom )
|
||||
return;
|
||||
@Packager.RemoveLine */
|
||||
|
||||
if ( !window.CKEDITOR )
|
||||
{
|
||||
/**
|
||||
* @name CKEDITOR
|
||||
* @namespace This is the API entry point. The entire CKEditor code runs under this object.
|
||||
* @example
|
||||
*/
|
||||
window.CKEDITOR = (function()
|
||||
{
|
||||
var CKEDITOR =
|
||||
/** @lends CKEDITOR */
|
||||
{
|
||||
|
||||
/**
|
||||
* A constant string unique for each release of CKEditor. Its value
|
||||
* is used, by default, to build the URL for all resources loaded
|
||||
* by the editor code, guaranteeing clean cache results when
|
||||
* upgrading.
|
||||
* @type String
|
||||
* @example
|
||||
* alert( CKEDITOR.timestamp ); // e.g. '87dm'
|
||||
*/
|
||||
// The production implementation contains a fixed timestamp, unique
|
||||
// for each release and generated by the releaser.
|
||||
// (Base 36 value of each component of YYMMDDHH - 4 chars total - e.g. 87bm == 08071122)
|
||||
timestamp : 'C6HH5UF',
|
||||
|
||||
/**
|
||||
* Contains the CKEditor version number.
|
||||
* @type String
|
||||
* @example
|
||||
* alert( CKEDITOR.version ); // e.g. 'CKEditor 3.4.1'
|
||||
*/
|
||||
version : '3.6.4',
|
||||
|
||||
/**
|
||||
* Contains the CKEditor revision number.
|
||||
* The revision number is incremented automatically, following each
|
||||
* modification to the CKEditor source code.
|
||||
* @type String
|
||||
* @example
|
||||
* alert( CKEDITOR.revision ); // e.g. '3975'
|
||||
*/
|
||||
revision : '7575',
|
||||
|
||||
/**
|
||||
* A 3-digit random integer, valid for the entire life of the CKEDITOR object.
|
||||
* @type Number
|
||||
* @example
|
||||
* alert( CKEDITOR.rnd ); // e.g. '319'
|
||||
*/
|
||||
rnd : Math.floor( Math.random() * ( 999/*Max*/ - 100/*Min*/ + 1 ) ) + 100/*Min*/,
|
||||
|
||||
/**
|
||||
* Private object used to hold core stuff. It should not be used outside of
|
||||
* the API code as properties defined here may change at any time
|
||||
* without notice.
|
||||
* @private
|
||||
*/
|
||||
_ : {},
|
||||
|
||||
/**
|
||||
* Indicates the API loading status. The following statuses are available:
|
||||
* <ul>
|
||||
* <li><b>unloaded</b>: the API is not yet loaded.</li>
|
||||
* <li><b>basic_loaded</b>: the basic API features are available.</li>
|
||||
* <li><b>basic_ready</b>: the basic API is ready to load the full core code.</li>
|
||||
* <li><b>loading</b>: the full API is being loaded.</li>
|
||||
* <li><b>loaded</b>: the API can be fully used.</li>
|
||||
* </ul>
|
||||
* @type String
|
||||
* @example
|
||||
* if ( <b>CKEDITOR.status</b> == 'loaded' )
|
||||
* {
|
||||
* // The API can now be fully used.
|
||||
* }
|
||||
*/
|
||||
status : 'unloaded',
|
||||
|
||||
/**
|
||||
* Contains the full URL for the CKEditor installation directory.
|
||||
* It is possible to manually provide the base path by setting a
|
||||
* global variable named CKEDITOR_BASEPATH. This global variable
|
||||
* must be set <strong>before</strong> the editor script loading.
|
||||
* @type String
|
||||
* @example
|
||||
* alert( <b>CKEDITOR.basePath</b> ); // "http://www.example.com/ckeditor/" (e.g.)
|
||||
*/
|
||||
basePath : (function()
|
||||
{
|
||||
// ATTENTION: fixes to this code must be ported to
|
||||
// var basePath in "core/loader.js".
|
||||
|
||||
// Find out the editor directory path, based on its <script> tag.
|
||||
var path = window.CKEDITOR_BASEPATH || '';
|
||||
|
||||
if ( !path )
|
||||
{
|
||||
var scripts = document.getElementsByTagName( 'script' );
|
||||
|
||||
for ( var i = 0 ; i < scripts.length ; i++ )
|
||||
{
|
||||
var match = scripts[i].src.match( /(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i );
|
||||
|
||||
if ( match )
|
||||
{
|
||||
path = match[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// In IE (only) the script.src string is the raw value entered in the
|
||||
// HTML source. Other browsers return the full resolved URL instead.
|
||||
if ( path.indexOf(':/') == -1 )
|
||||
{
|
||||
// Absolute path.
|
||||
if ( path.indexOf( '/' ) === 0 )
|
||||
path = location.href.match( /^.*?:\/\/[^\/]*/ )[0] + path;
|
||||
// Relative path.
|
||||
else
|
||||
path = location.href.match( /^[^\?]*\/(?:)/ )[0] + path;
|
||||
}
|
||||
|
||||
if ( !path )
|
||||
throw 'The CKEditor installation path could not be automatically detected. Please set the global variable "CKEDITOR_BASEPATH" before creating editor instances.';
|
||||
|
||||
return path;
|
||||
})(),
|
||||
|
||||
/**
|
||||
* Gets the full URL for CKEditor resources. By default, URLs
|
||||
* returned by this function contain a querystring parameter ("t")
|
||||
* set to the {@link CKEDITOR.timestamp} value.<br />
|
||||
* <br />
|
||||
* It is possible to provide a custom implementation of this
|
||||
* function by setting a global variable named CKEDITOR_GETURL.
|
||||
* This global variable must be set <strong>before</strong> the editor script
|
||||
* loading. If the custom implementation returns nothing (==null), the
|
||||
* default implementation is used.
|
||||
* @param {String} resource The resource whose full URL we want to get.
|
||||
* It may be a full, absolute, or relative URL.
|
||||
* @returns {String} The full URL.
|
||||
* @example
|
||||
* // e.g. http://www.example.com/ckeditor/skins/default/editor.css?t=87dm
|
||||
* alert( CKEDITOR.getUrl( 'skins/default/editor.css' ) );
|
||||
* @example
|
||||
* // e.g. http://www.example.com/skins/default/editor.css?t=87dm
|
||||
* alert( CKEDITOR.getUrl( '/skins/default/editor.css' ) );
|
||||
* @example
|
||||
* // e.g. http://www.somesite.com/skins/default/editor.css?t=87dm
|
||||
* alert( CKEDITOR.getUrl( 'http://www.somesite.com/skins/default/editor.css' ) );
|
||||
*/
|
||||
getUrl : function( resource )
|
||||
{
|
||||
// If this is not a full or absolute path.
|
||||
if ( resource.indexOf(':/') == -1 && resource.indexOf( '/' ) !== 0 )
|
||||
resource = this.basePath + resource;
|
||||
|
||||
// Add the timestamp, except for directories.
|
||||
if ( this.timestamp && resource.charAt( resource.length - 1 ) != '/' && !(/[&?]t=/).test( resource ) )
|
||||
resource += ( resource.indexOf( '?' ) >= 0 ? '&' : '?' ) + 't=' + this.timestamp;
|
||||
|
||||
return resource;
|
||||
}
|
||||
};
|
||||
|
||||
// Make it possible to override the getUrl function with a custom
|
||||
// implementation pointing to a global named CKEDITOR_GETURL.
|
||||
var newGetUrl = window.CKEDITOR_GETURL;
|
||||
if ( newGetUrl )
|
||||
{
|
||||
var originalGetUrl = CKEDITOR.getUrl;
|
||||
CKEDITOR.getUrl = function ( resource )
|
||||
{
|
||||
return newGetUrl.call( CKEDITOR, resource ) ||
|
||||
originalGetUrl.call( CKEDITOR, resource );
|
||||
};
|
||||
}
|
||||
|
||||
return CKEDITOR;
|
||||
})();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called upon loading a custom configuration file that can
|
||||
* modify the editor instance configuration ({@link CKEDITOR.editor#config }).
|
||||
* It is usually defined inside the custom configuration files that can
|
||||
* include developer defined settings.
|
||||
* @name CKEDITOR.editorConfig
|
||||
* @function
|
||||
* @param {CKEDITOR.config} config A configuration object containing the
|
||||
* settings defined for a {@link CKEDITOR.editor} instance up to this
|
||||
* function call. Note that not all settings may still be available. See
|
||||
* <a href="http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Setting_Configurations#Configuration_Loading_Order">Configuration Loading Order</a>
|
||||
* for details.
|
||||
* @example
|
||||
* // This is supposed to be placed in the config.js file.
|
||||
* CKEDITOR.editorConfig = function( config )
|
||||
* {
|
||||
* // Define changes to default configuration here. For example:
|
||||
* config.language = 'fr';
|
||||
* config.uiColor = '#AADC6E';
|
||||
* };
|
||||
*/
|
||||
|
||||
// PACKAGER_RENAME( CKEDITOR )
|
||||
|
||||
@ -1,238 +1,238 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Contains the second part of the {@link CKEDITOR} object
|
||||
* definition, which defines the basic editor features to be available in
|
||||
* the root ckeditor_basic.js file.
|
||||
*/
|
||||
|
||||
if ( CKEDITOR.status == 'unloaded' )
|
||||
{
|
||||
(function()
|
||||
{
|
||||
CKEDITOR.event.implementOn( CKEDITOR );
|
||||
|
||||
/**
|
||||
* Forces the full CKEditor core code, in the case only the basic code has been
|
||||
* loaded (ckeditor_basic.js). This method self-destroys (becomes undefined) in
|
||||
* the first call or as soon as the full code is available.
|
||||
* @example
|
||||
* // Check if the full core code has been loaded and load it.
|
||||
* if ( CKEDITOR.loadFullCore )
|
||||
* <b>CKEDITOR.loadFullCore()</b>;
|
||||
*/
|
||||
CKEDITOR.loadFullCore = function()
|
||||
{
|
||||
// If not the basic code is not ready it, just mark it to be loaded.
|
||||
if ( CKEDITOR.status != 'basic_ready' )
|
||||
{
|
||||
CKEDITOR.loadFullCore._load = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
// Destroy this function.
|
||||
delete CKEDITOR.loadFullCore;
|
||||
|
||||
// Append the script to the head.
|
||||
var script = document.createElement( 'script' );
|
||||
script.type = 'text/javascript';
|
||||
script.src = CKEDITOR.basePath + 'ckeditor.js';
|
||||
|
||||
document.getElementsByTagName( 'head' )[0].appendChild( script );
|
||||
};
|
||||
|
||||
/**
|
||||
* The time to wait (in seconds) to load the full editor code after the
|
||||
* page load, if the "ckeditor_basic" file is used. If set to zero, the
|
||||
* editor is loaded on demand, as soon as an instance is created.
|
||||
*
|
||||
* This value must be set on the page before the page load completion.
|
||||
* @type Number
|
||||
* @default 0 (zero)
|
||||
* @example
|
||||
* // Loads the full source after five seconds.
|
||||
* CKEDITOR.loadFullCoreTimeout = 5;
|
||||
*/
|
||||
CKEDITOR.loadFullCoreTimeout = 0;
|
||||
|
||||
/**
|
||||
* The class name used to identify <textarea> elements to be replace
|
||||
* by CKEditor instances.
|
||||
* @type String
|
||||
* @default 'ckeditor'
|
||||
* @example
|
||||
* <b>CKEDITOR.replaceClass</b> = 'rich_editor';
|
||||
*/
|
||||
CKEDITOR.replaceClass = 'ckeditor';
|
||||
|
||||
/**
|
||||
* Enables the replacement of all textareas with class name matching
|
||||
* {@link CKEDITOR.replaceClass}.
|
||||
* @type Boolean
|
||||
* @default true
|
||||
* @example
|
||||
* // Disable the auto-replace feature.
|
||||
* <b>CKEDITOR.replaceByClassEnabled</b> = false;
|
||||
*/
|
||||
CKEDITOR.replaceByClassEnabled = 1;
|
||||
|
||||
var createInstance = function( elementOrIdOrName, config, creationFunction, data )
|
||||
{
|
||||
if ( CKEDITOR.env.isCompatible )
|
||||
{
|
||||
// Load the full core.
|
||||
if ( CKEDITOR.loadFullCore )
|
||||
CKEDITOR.loadFullCore();
|
||||
|
||||
var editor = creationFunction( elementOrIdOrName, config, data );
|
||||
CKEDITOR.add( editor );
|
||||
return editor;
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Replaces a <textarea> or a DOM element (DIV) with a CKEditor
|
||||
* instance. For textareas, the initial value in the editor will be the
|
||||
* textarea value. For DOM elements, their innerHTML will be used
|
||||
* instead. We recommend using TEXTAREA and DIV elements only.
|
||||
* @param {Object|String} elementOrIdOrName The DOM element (textarea), its
|
||||
* ID or name.
|
||||
* @param {Object} [config] The specific configurations to apply to this
|
||||
* editor instance. Configurations set here will override global CKEditor
|
||||
* settings.
|
||||
* @returns {CKEDITOR.editor} The editor instance created.
|
||||
* @example
|
||||
* <textarea id="myfield" name="myfield"><:/textarea>
|
||||
* ...
|
||||
* <b>CKEDITOR.replace( 'myfield' )</b>;
|
||||
* @example
|
||||
* var textarea = document.body.appendChild( document.createElement( 'textarea' ) );
|
||||
* <b>CKEDITOR.replace( textarea )</b>;
|
||||
*/
|
||||
CKEDITOR.replace = function( elementOrIdOrName, config )
|
||||
{
|
||||
return createInstance( elementOrIdOrName, config, CKEDITOR.editor.replace );
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a new editor instance inside a specific DOM element.
|
||||
* @param {Object|String} elementOrId The DOM element or its ID.
|
||||
* @param {Object} [config] The specific configurations to apply to this
|
||||
* editor instance. Configurations set here will override global CKEditor
|
||||
* settings.
|
||||
* @param {String} [data] Since 3.3. Initial value for the instance.
|
||||
* @returns {CKEDITOR.editor} The editor instance created.
|
||||
* @example
|
||||
* <div id="editorSpace"><:/div>
|
||||
* ...
|
||||
* <b>CKEDITOR.appendTo( 'editorSpace' )</b>;
|
||||
*/
|
||||
CKEDITOR.appendTo = function( elementOrId, config, data )
|
||||
{
|
||||
return createInstance( elementOrId, config, CKEDITOR.editor.appendTo, data );
|
||||
};
|
||||
|
||||
// Documented at ckeditor.js.
|
||||
CKEDITOR.add = function( editor )
|
||||
{
|
||||
// For now, just put the editor in the pending list. It will be
|
||||
// processed as soon as the full code gets loaded.
|
||||
var pending = this._.pending || ( this._.pending = [] );
|
||||
pending.push( editor );
|
||||
};
|
||||
|
||||
/**
|
||||
* Replace all <textarea> elements available in the document with
|
||||
* editor instances.
|
||||
* @example
|
||||
* // Replace all <textarea> elements in the page.
|
||||
* CKEDITOR.replaceAll();
|
||||
* @example
|
||||
* // Replace all <textarea class="myClassName"> elements in the page.
|
||||
* CKEDITOR.replaceAll( 'myClassName' );
|
||||
* @example
|
||||
* // Selectively replace <textarea> elements, based on custom assertions.
|
||||
* CKEDITOR.replaceAll( function( textarea, config )
|
||||
* {
|
||||
* // Custom code to evaluate the replace, returning false
|
||||
* // if it must not be done.
|
||||
* // It also passes the "config" parameter, so the
|
||||
* // developer can customize the instance.
|
||||
* } );
|
||||
*/
|
||||
CKEDITOR.replaceAll = function()
|
||||
{
|
||||
var textareas = document.getElementsByTagName( 'textarea' );
|
||||
|
||||
for ( var i = 0 ; i < textareas.length ; i++ )
|
||||
{
|
||||
var config = null,
|
||||
textarea = textareas[i];
|
||||
|
||||
// The "name" and/or "id" attribute must exist.
|
||||
if ( !textarea.name && !textarea.id )
|
||||
continue;
|
||||
|
||||
if ( typeof arguments[0] == 'string' )
|
||||
{
|
||||
// The textarea class name could be passed as the function
|
||||
// parameter.
|
||||
|
||||
var classRegex = new RegExp( '(?:^|\\s)' + arguments[0] + '(?:$|\\s)' );
|
||||
|
||||
if ( !classRegex.test( textarea.className ) )
|
||||
continue;
|
||||
}
|
||||
else if ( typeof arguments[0] == 'function' )
|
||||
{
|
||||
// An assertion function could be passed as the function parameter.
|
||||
// It must explicitly return "false" to ignore a specific <textarea>.
|
||||
config = {};
|
||||
if ( arguments[0]( textarea, config ) === false )
|
||||
continue;
|
||||
}
|
||||
|
||||
this.replace( textarea, config );
|
||||
}
|
||||
};
|
||||
|
||||
(function()
|
||||
{
|
||||
var onload = function()
|
||||
{
|
||||
var loadFullCore = CKEDITOR.loadFullCore,
|
||||
loadFullCoreTimeout = CKEDITOR.loadFullCoreTimeout;
|
||||
|
||||
// Replace all textareas with the default class name.
|
||||
if ( CKEDITOR.replaceByClassEnabled )
|
||||
CKEDITOR.replaceAll( CKEDITOR.replaceClass );
|
||||
|
||||
CKEDITOR.status = 'basic_ready';
|
||||
|
||||
if ( loadFullCore && loadFullCore._load )
|
||||
loadFullCore();
|
||||
else if ( loadFullCoreTimeout )
|
||||
{
|
||||
setTimeout( function()
|
||||
{
|
||||
if ( CKEDITOR.loadFullCore )
|
||||
CKEDITOR.loadFullCore();
|
||||
}
|
||||
, loadFullCoreTimeout * 1000 );
|
||||
}
|
||||
};
|
||||
|
||||
if ( window.addEventListener )
|
||||
window.addEventListener( 'load', onload, false );
|
||||
else if ( window.attachEvent )
|
||||
window.attachEvent( 'onload', onload );
|
||||
})();
|
||||
|
||||
CKEDITOR.status = 'basic_loaded';
|
||||
})();
|
||||
}
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Contains the second part of the {@link CKEDITOR} object
|
||||
* definition, which defines the basic editor features to be available in
|
||||
* the root ckeditor_basic.js file.
|
||||
*/
|
||||
|
||||
if ( CKEDITOR.status == 'unloaded' )
|
||||
{
|
||||
(function()
|
||||
{
|
||||
CKEDITOR.event.implementOn( CKEDITOR );
|
||||
|
||||
/**
|
||||
* Forces the full CKEditor core code, in the case only the basic code has been
|
||||
* loaded (ckeditor_basic.js). This method self-destroys (becomes undefined) in
|
||||
* the first call or as soon as the full code is available.
|
||||
* @example
|
||||
* // Check if the full core code has been loaded and load it.
|
||||
* if ( CKEDITOR.loadFullCore )
|
||||
* <b>CKEDITOR.loadFullCore()</b>;
|
||||
*/
|
||||
CKEDITOR.loadFullCore = function()
|
||||
{
|
||||
// If not the basic code is not ready it, just mark it to be loaded.
|
||||
if ( CKEDITOR.status != 'basic_ready' )
|
||||
{
|
||||
CKEDITOR.loadFullCore._load = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
// Destroy this function.
|
||||
delete CKEDITOR.loadFullCore;
|
||||
|
||||
// Append the script to the head.
|
||||
var script = document.createElement( 'script' );
|
||||
script.type = 'text/javascript';
|
||||
script.src = CKEDITOR.basePath + 'ckeditor.js';
|
||||
|
||||
document.getElementsByTagName( 'head' )[0].appendChild( script );
|
||||
};
|
||||
|
||||
/**
|
||||
* The time to wait (in seconds) to load the full editor code after the
|
||||
* page load, if the "ckeditor_basic" file is used. If set to zero, the
|
||||
* editor is loaded on demand, as soon as an instance is created.
|
||||
*
|
||||
* This value must be set on the page before the page load completion.
|
||||
* @type Number
|
||||
* @default 0 (zero)
|
||||
* @example
|
||||
* // Loads the full source after five seconds.
|
||||
* CKEDITOR.loadFullCoreTimeout = 5;
|
||||
*/
|
||||
CKEDITOR.loadFullCoreTimeout = 0;
|
||||
|
||||
/**
|
||||
* The class name used to identify <textarea> elements to be replace
|
||||
* by CKEditor instances.
|
||||
* @type String
|
||||
* @default 'ckeditor'
|
||||
* @example
|
||||
* <b>CKEDITOR.replaceClass</b> = 'rich_editor';
|
||||
*/
|
||||
CKEDITOR.replaceClass = 'ckeditor';
|
||||
|
||||
/**
|
||||
* Enables the replacement of all textareas with class name matching
|
||||
* {@link CKEDITOR.replaceClass}.
|
||||
* @type Boolean
|
||||
* @default true
|
||||
* @example
|
||||
* // Disable the auto-replace feature.
|
||||
* <b>CKEDITOR.replaceByClassEnabled</b> = false;
|
||||
*/
|
||||
CKEDITOR.replaceByClassEnabled = 1;
|
||||
|
||||
var createInstance = function( elementOrIdOrName, config, creationFunction, data )
|
||||
{
|
||||
if ( CKEDITOR.env.isCompatible )
|
||||
{
|
||||
// Load the full core.
|
||||
if ( CKEDITOR.loadFullCore )
|
||||
CKEDITOR.loadFullCore();
|
||||
|
||||
var editor = creationFunction( elementOrIdOrName, config, data );
|
||||
CKEDITOR.add( editor );
|
||||
return editor;
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Replaces a <textarea> or a DOM element (DIV) with a CKEditor
|
||||
* instance. For textareas, the initial value in the editor will be the
|
||||
* textarea value. For DOM elements, their innerHTML will be used
|
||||
* instead. We recommend using TEXTAREA and DIV elements only.
|
||||
* @param {Object|String} elementOrIdOrName The DOM element (textarea), its
|
||||
* ID or name.
|
||||
* @param {Object} [config] The specific configurations to apply to this
|
||||
* editor instance. Configurations set here will override global CKEditor
|
||||
* settings.
|
||||
* @returns {CKEDITOR.editor} The editor instance created.
|
||||
* @example
|
||||
* <textarea id="myfield" name="myfield"><:/textarea>
|
||||
* ...
|
||||
* <b>CKEDITOR.replace( 'myfield' )</b>;
|
||||
* @example
|
||||
* var textarea = document.body.appendChild( document.createElement( 'textarea' ) );
|
||||
* <b>CKEDITOR.replace( textarea )</b>;
|
||||
*/
|
||||
CKEDITOR.replace = function( elementOrIdOrName, config )
|
||||
{
|
||||
return createInstance( elementOrIdOrName, config, CKEDITOR.editor.replace );
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a new editor instance inside a specific DOM element.
|
||||
* @param {Object|String} elementOrId The DOM element or its ID.
|
||||
* @param {Object} [config] The specific configurations to apply to this
|
||||
* editor instance. Configurations set here will override global CKEditor
|
||||
* settings.
|
||||
* @param {String} [data] Since 3.3. Initial value for the instance.
|
||||
* @returns {CKEDITOR.editor} The editor instance created.
|
||||
* @example
|
||||
* <div id="editorSpace"><:/div>
|
||||
* ...
|
||||
* <b>CKEDITOR.appendTo( 'editorSpace' )</b>;
|
||||
*/
|
||||
CKEDITOR.appendTo = function( elementOrId, config, data )
|
||||
{
|
||||
return createInstance( elementOrId, config, CKEDITOR.editor.appendTo, data );
|
||||
};
|
||||
|
||||
// Documented at ckeditor.js.
|
||||
CKEDITOR.add = function( editor )
|
||||
{
|
||||
// For now, just put the editor in the pending list. It will be
|
||||
// processed as soon as the full code gets loaded.
|
||||
var pending = this._.pending || ( this._.pending = [] );
|
||||
pending.push( editor );
|
||||
};
|
||||
|
||||
/**
|
||||
* Replace all <textarea> elements available in the document with
|
||||
* editor instances.
|
||||
* @example
|
||||
* // Replace all <textarea> elements in the page.
|
||||
* CKEDITOR.replaceAll();
|
||||
* @example
|
||||
* // Replace all <textarea class="myClassName"> elements in the page.
|
||||
* CKEDITOR.replaceAll( 'myClassName' );
|
||||
* @example
|
||||
* // Selectively replace <textarea> elements, based on custom assertions.
|
||||
* CKEDITOR.replaceAll( function( textarea, config )
|
||||
* {
|
||||
* // Custom code to evaluate the replace, returning false
|
||||
* // if it must not be done.
|
||||
* // It also passes the "config" parameter, so the
|
||||
* // developer can customize the instance.
|
||||
* } );
|
||||
*/
|
||||
CKEDITOR.replaceAll = function()
|
||||
{
|
||||
var textareas = document.getElementsByTagName( 'textarea' );
|
||||
|
||||
for ( var i = 0 ; i < textareas.length ; i++ )
|
||||
{
|
||||
var config = null,
|
||||
textarea = textareas[i];
|
||||
|
||||
// The "name" and/or "id" attribute must exist.
|
||||
if ( !textarea.name && !textarea.id )
|
||||
continue;
|
||||
|
||||
if ( typeof arguments[0] == 'string' )
|
||||
{
|
||||
// The textarea class name could be passed as the function
|
||||
// parameter.
|
||||
|
||||
var classRegex = new RegExp( '(?:^|\\s)' + arguments[0] + '(?:$|\\s)' );
|
||||
|
||||
if ( !classRegex.test( textarea.className ) )
|
||||
continue;
|
||||
}
|
||||
else if ( typeof arguments[0] == 'function' )
|
||||
{
|
||||
// An assertion function could be passed as the function parameter.
|
||||
// It must explicitly return "false" to ignore a specific <textarea>.
|
||||
config = {};
|
||||
if ( arguments[0]( textarea, config ) === false )
|
||||
continue;
|
||||
}
|
||||
|
||||
this.replace( textarea, config );
|
||||
}
|
||||
};
|
||||
|
||||
(function()
|
||||
{
|
||||
var onload = function()
|
||||
{
|
||||
var loadFullCore = CKEDITOR.loadFullCore,
|
||||
loadFullCoreTimeout = CKEDITOR.loadFullCoreTimeout;
|
||||
|
||||
// Replace all textareas with the default class name.
|
||||
if ( CKEDITOR.replaceByClassEnabled )
|
||||
CKEDITOR.replaceAll( CKEDITOR.replaceClass );
|
||||
|
||||
CKEDITOR.status = 'basic_ready';
|
||||
|
||||
if ( loadFullCore && loadFullCore._load )
|
||||
loadFullCore();
|
||||
else if ( loadFullCoreTimeout )
|
||||
{
|
||||
setTimeout( function()
|
||||
{
|
||||
if ( CKEDITOR.loadFullCore )
|
||||
CKEDITOR.loadFullCore();
|
||||
}
|
||||
, loadFullCoreTimeout * 1000 );
|
||||
}
|
||||
};
|
||||
|
||||
if ( window.addEventListener )
|
||||
window.addEventListener( 'load', onload, false );
|
||||
else if ( window.attachEvent )
|
||||
window.attachEvent( 'onload', onload );
|
||||
})();
|
||||
|
||||
CKEDITOR.status = 'basic_loaded';
|
||||
})();
|
||||
}
|
||||
|
||||
@ -1,225 +1,225 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates a command class instance.
|
||||
* @class Represents a command that can be executed on an editor instance.
|
||||
* @param {CKEDITOR.editor} editor The editor instance this command will be
|
||||
* related to.
|
||||
* @param {CKEDITOR.commandDefinition} commandDefinition The command
|
||||
* definition.
|
||||
* @augments CKEDITOR.event
|
||||
* @example
|
||||
* var command = new CKEDITOR.command( editor,
|
||||
* {
|
||||
* exec : function( editor )
|
||||
* {
|
||||
* alert( editor.document.getBody().getHtml() );
|
||||
* }
|
||||
* });
|
||||
*/
|
||||
CKEDITOR.command = function( editor, commandDefinition )
|
||||
{
|
||||
/**
|
||||
* Lists UI items that are associated to this command. This list can be
|
||||
* used to interact with the UI on command execution (by the execution code
|
||||
* itself, for example).
|
||||
* @type Array
|
||||
* @example
|
||||
* alert( 'Number of UI items associated to this command: ' + command.<b>uiItems</b>.length );
|
||||
*/
|
||||
this.uiItems = [];
|
||||
|
||||
/**
|
||||
* Executes the command.
|
||||
* @param {Object} [data] Any data to pass to the command. Depends on the
|
||||
* command implementation and requirements.
|
||||
* @returns {Boolean} A boolean indicating that the command has been
|
||||
* successfully executed.
|
||||
* @example
|
||||
* command.<b>exec()</b>; // The command gets executed.
|
||||
*/
|
||||
this.exec = function( data )
|
||||
{
|
||||
if ( this.state == CKEDITOR.TRISTATE_DISABLED )
|
||||
return false;
|
||||
|
||||
if ( this.editorFocus ) // Give editor focus if necessary (#4355).
|
||||
editor.focus();
|
||||
|
||||
if ( this.fire( 'exec' ) === true )
|
||||
return true;
|
||||
|
||||
return ( commandDefinition.exec.call( this, editor, data ) !== false );
|
||||
};
|
||||
|
||||
/**
|
||||
* Explicitly update the status of the command, by firing the {@link CKEDITOR.command#event:refresh} event,
|
||||
* as well as invoke the {@link CKEDITOR.commandDefinition.prototype.refresh} method if defined, this method
|
||||
* is to allow different parts of the editor code to contribute in command status resolution.
|
||||
*/
|
||||
this.refresh = function()
|
||||
{
|
||||
if ( this.fire( 'refresh' ) === true )
|
||||
return true;
|
||||
|
||||
return ( commandDefinition.refresh && commandDefinition.refresh.apply( this, arguments ) !== false );
|
||||
};
|
||||
|
||||
CKEDITOR.tools.extend( this, commandDefinition,
|
||||
// Defaults
|
||||
/** @lends CKEDITOR.command.prototype */
|
||||
{
|
||||
/**
|
||||
* The editor modes within which the command can be executed. The
|
||||
* execution will have no action if the current mode is not listed
|
||||
* in this property.
|
||||
* @type Object
|
||||
* @default { wysiwyg : 1 }
|
||||
* @see CKEDITOR.editor.prototype.mode
|
||||
* @example
|
||||
* // Enable the command in both WYSIWYG and Source modes.
|
||||
* command.<b>modes</b> = { wysiwyg : 1, source : 1 };
|
||||
* @example
|
||||
* // Enable the command in Source mode only.
|
||||
* command.<b>modes</b> = { source : 1 };
|
||||
*/
|
||||
modes : { wysiwyg : 1 },
|
||||
|
||||
/**
|
||||
* Indicates that the editor will get the focus before executing
|
||||
* the command.
|
||||
* @type Boolean
|
||||
* @default true
|
||||
* @example
|
||||
* // Do not force the editor to have focus when executing the command.
|
||||
* command.<b>editorFocus</b> = false;
|
||||
*/
|
||||
editorFocus : 1,
|
||||
|
||||
/**
|
||||
* Indicates the editor state. Possible values are:
|
||||
* <ul>
|
||||
* <li>{@link CKEDITOR.TRISTATE_DISABLED}: the command is
|
||||
* disabled. It's execution will have no effect. Same as
|
||||
* {@link disable}.</li>
|
||||
* <li>{@link CKEDITOR.TRISTATE_ON}: the command is enabled
|
||||
* and currently active in the editor (for context sensitive commands,
|
||||
* for example).</li>
|
||||
* <li>{@link CKEDITOR.TRISTATE_OFF}: the command is enabled
|
||||
* and currently inactive in the editor (for context sensitive
|
||||
* commands, for example).</li>
|
||||
* </ul>
|
||||
* Do not set this property directly, using the {@link #setState}
|
||||
* method instead.
|
||||
* @type Number
|
||||
* @default {@link CKEDITOR.TRISTATE_OFF}
|
||||
* @example
|
||||
* if ( command.<b>state</b> == CKEDITOR.TRISTATE_DISABLED )
|
||||
* alert( 'This command is disabled' );
|
||||
*/
|
||||
state : CKEDITOR.TRISTATE_OFF
|
||||
});
|
||||
|
||||
// Call the CKEDITOR.event constructor to initialize this instance.
|
||||
CKEDITOR.event.call( this );
|
||||
};
|
||||
|
||||
CKEDITOR.command.prototype =
|
||||
{
|
||||
/**
|
||||
* Enables the command for execution. The command state (see
|
||||
* {@link CKEDITOR.command.prototype.state}) available before disabling it
|
||||
* is restored.
|
||||
* @example
|
||||
* command.<b>enable()</b>;
|
||||
* command.exec(); // Execute the command.
|
||||
*/
|
||||
enable : function()
|
||||
{
|
||||
if ( this.state == CKEDITOR.TRISTATE_DISABLED )
|
||||
this.setState( ( !this.preserveState || ( typeof this.previousState == 'undefined' ) ) ? CKEDITOR.TRISTATE_OFF : this.previousState );
|
||||
},
|
||||
|
||||
/**
|
||||
* Disables the command for execution. The command state (see
|
||||
* {@link CKEDITOR.command.prototype.state}) will be set to
|
||||
* {@link CKEDITOR.TRISTATE_DISABLED}.
|
||||
* @example
|
||||
* command.<b>disable()</b>;
|
||||
* command.exec(); // "false" - Nothing happens.
|
||||
*/
|
||||
disable : function()
|
||||
{
|
||||
this.setState( CKEDITOR.TRISTATE_DISABLED );
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the command state.
|
||||
* @param {Number} newState The new state. See {@link #state}.
|
||||
* @returns {Boolean} Returns "true" if the command state changed.
|
||||
* @example
|
||||
* command.<b>setState( CKEDITOR.TRISTATE_ON )</b>;
|
||||
* command.exec(); // Execute the command.
|
||||
* command.<b>setState( CKEDITOR.TRISTATE_DISABLED )</b>;
|
||||
* command.exec(); // "false" - Nothing happens.
|
||||
* command.<b>setState( CKEDITOR.TRISTATE_OFF )</b>;
|
||||
* command.exec(); // Execute the command.
|
||||
*/
|
||||
setState : function( newState )
|
||||
{
|
||||
// Do nothing if there is no state change.
|
||||
if ( this.state == newState )
|
||||
return false;
|
||||
|
||||
this.previousState = this.state;
|
||||
|
||||
// Set the new state.
|
||||
this.state = newState;
|
||||
|
||||
// Fire the "state" event, so other parts of the code can react to the
|
||||
// change.
|
||||
this.fire( 'state' );
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Toggles the on/off (active/inactive) state of the command. This is
|
||||
* mainly used internally by context sensitive commands.
|
||||
* @example
|
||||
* command.<b>toggleState()</b>;
|
||||
*/
|
||||
toggleState : function()
|
||||
{
|
||||
if ( this.state == CKEDITOR.TRISTATE_OFF )
|
||||
this.setState( CKEDITOR.TRISTATE_ON );
|
||||
else if ( this.state == CKEDITOR.TRISTATE_ON )
|
||||
this.setState( CKEDITOR.TRISTATE_OFF );
|
||||
}
|
||||
};
|
||||
|
||||
CKEDITOR.event.implementOn( CKEDITOR.command.prototype, true );
|
||||
|
||||
/**
|
||||
* Indicates the previous command state.
|
||||
* @name CKEDITOR.command.prototype.previousState
|
||||
* @type Number
|
||||
* @see #state
|
||||
* @example
|
||||
* alert( command.<b>previousState</b> );
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired when the command state changes.
|
||||
* @name CKEDITOR.command#state
|
||||
* @event
|
||||
* @example
|
||||
* command.on( <b>'state'</b> , function( e )
|
||||
* {
|
||||
* // Alerts the new state.
|
||||
* alert( this.state );
|
||||
* });
|
||||
*/
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates a command class instance.
|
||||
* @class Represents a command that can be executed on an editor instance.
|
||||
* @param {CKEDITOR.editor} editor The editor instance this command will be
|
||||
* related to.
|
||||
* @param {CKEDITOR.commandDefinition} commandDefinition The command
|
||||
* definition.
|
||||
* @augments CKEDITOR.event
|
||||
* @example
|
||||
* var command = new CKEDITOR.command( editor,
|
||||
* {
|
||||
* exec : function( editor )
|
||||
* {
|
||||
* alert( editor.document.getBody().getHtml() );
|
||||
* }
|
||||
* });
|
||||
*/
|
||||
CKEDITOR.command = function( editor, commandDefinition )
|
||||
{
|
||||
/**
|
||||
* Lists UI items that are associated to this command. This list can be
|
||||
* used to interact with the UI on command execution (by the execution code
|
||||
* itself, for example).
|
||||
* @type Array
|
||||
* @example
|
||||
* alert( 'Number of UI items associated to this command: ' + command.<b>uiItems</b>.length );
|
||||
*/
|
||||
this.uiItems = [];
|
||||
|
||||
/**
|
||||
* Executes the command.
|
||||
* @param {Object} [data] Any data to pass to the command. Depends on the
|
||||
* command implementation and requirements.
|
||||
* @returns {Boolean} A boolean indicating that the command has been
|
||||
* successfully executed.
|
||||
* @example
|
||||
* command.<b>exec()</b>; // The command gets executed.
|
||||
*/
|
||||
this.exec = function( data )
|
||||
{
|
||||
if ( this.state == CKEDITOR.TRISTATE_DISABLED )
|
||||
return false;
|
||||
|
||||
if ( this.editorFocus ) // Give editor focus if necessary (#4355).
|
||||
editor.focus();
|
||||
|
||||
if ( this.fire( 'exec' ) === true )
|
||||
return true;
|
||||
|
||||
return ( commandDefinition.exec.call( this, editor, data ) !== false );
|
||||
};
|
||||
|
||||
/**
|
||||
* Explicitly update the status of the command, by firing the {@link CKEDITOR.command#event:refresh} event,
|
||||
* as well as invoke the {@link CKEDITOR.commandDefinition.prototype.refresh} method if defined, this method
|
||||
* is to allow different parts of the editor code to contribute in command status resolution.
|
||||
*/
|
||||
this.refresh = function()
|
||||
{
|
||||
if ( this.fire( 'refresh' ) === true )
|
||||
return true;
|
||||
|
||||
return ( commandDefinition.refresh && commandDefinition.refresh.apply( this, arguments ) !== false );
|
||||
};
|
||||
|
||||
CKEDITOR.tools.extend( this, commandDefinition,
|
||||
// Defaults
|
||||
/** @lends CKEDITOR.command.prototype */
|
||||
{
|
||||
/**
|
||||
* The editor modes within which the command can be executed. The
|
||||
* execution will have no action if the current mode is not listed
|
||||
* in this property.
|
||||
* @type Object
|
||||
* @default { wysiwyg : 1 }
|
||||
* @see CKEDITOR.editor.prototype.mode
|
||||
* @example
|
||||
* // Enable the command in both WYSIWYG and Source modes.
|
||||
* command.<b>modes</b> = { wysiwyg : 1, source : 1 };
|
||||
* @example
|
||||
* // Enable the command in Source mode only.
|
||||
* command.<b>modes</b> = { source : 1 };
|
||||
*/
|
||||
modes : { wysiwyg : 1 },
|
||||
|
||||
/**
|
||||
* Indicates that the editor will get the focus before executing
|
||||
* the command.
|
||||
* @type Boolean
|
||||
* @default true
|
||||
* @example
|
||||
* // Do not force the editor to have focus when executing the command.
|
||||
* command.<b>editorFocus</b> = false;
|
||||
*/
|
||||
editorFocus : 1,
|
||||
|
||||
/**
|
||||
* Indicates the editor state. Possible values are:
|
||||
* <ul>
|
||||
* <li>{@link CKEDITOR.TRISTATE_DISABLED}: the command is
|
||||
* disabled. It's execution will have no effect. Same as
|
||||
* {@link disable}.</li>
|
||||
* <li>{@link CKEDITOR.TRISTATE_ON}: the command is enabled
|
||||
* and currently active in the editor (for context sensitive commands,
|
||||
* for example).</li>
|
||||
* <li>{@link CKEDITOR.TRISTATE_OFF}: the command is enabled
|
||||
* and currently inactive in the editor (for context sensitive
|
||||
* commands, for example).</li>
|
||||
* </ul>
|
||||
* Do not set this property directly, using the {@link #setState}
|
||||
* method instead.
|
||||
* @type Number
|
||||
* @default {@link CKEDITOR.TRISTATE_OFF}
|
||||
* @example
|
||||
* if ( command.<b>state</b> == CKEDITOR.TRISTATE_DISABLED )
|
||||
* alert( 'This command is disabled' );
|
||||
*/
|
||||
state : CKEDITOR.TRISTATE_OFF
|
||||
});
|
||||
|
||||
// Call the CKEDITOR.event constructor to initialize this instance.
|
||||
CKEDITOR.event.call( this );
|
||||
};
|
||||
|
||||
CKEDITOR.command.prototype =
|
||||
{
|
||||
/**
|
||||
* Enables the command for execution. The command state (see
|
||||
* {@link CKEDITOR.command.prototype.state}) available before disabling it
|
||||
* is restored.
|
||||
* @example
|
||||
* command.<b>enable()</b>;
|
||||
* command.exec(); // Execute the command.
|
||||
*/
|
||||
enable : function()
|
||||
{
|
||||
if ( this.state == CKEDITOR.TRISTATE_DISABLED )
|
||||
this.setState( ( !this.preserveState || ( typeof this.previousState == 'undefined' ) ) ? CKEDITOR.TRISTATE_OFF : this.previousState );
|
||||
},
|
||||
|
||||
/**
|
||||
* Disables the command for execution. The command state (see
|
||||
* {@link CKEDITOR.command.prototype.state}) will be set to
|
||||
* {@link CKEDITOR.TRISTATE_DISABLED}.
|
||||
* @example
|
||||
* command.<b>disable()</b>;
|
||||
* command.exec(); // "false" - Nothing happens.
|
||||
*/
|
||||
disable : function()
|
||||
{
|
||||
this.setState( CKEDITOR.TRISTATE_DISABLED );
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the command state.
|
||||
* @param {Number} newState The new state. See {@link #state}.
|
||||
* @returns {Boolean} Returns "true" if the command state changed.
|
||||
* @example
|
||||
* command.<b>setState( CKEDITOR.TRISTATE_ON )</b>;
|
||||
* command.exec(); // Execute the command.
|
||||
* command.<b>setState( CKEDITOR.TRISTATE_DISABLED )</b>;
|
||||
* command.exec(); // "false" - Nothing happens.
|
||||
* command.<b>setState( CKEDITOR.TRISTATE_OFF )</b>;
|
||||
* command.exec(); // Execute the command.
|
||||
*/
|
||||
setState : function( newState )
|
||||
{
|
||||
// Do nothing if there is no state change.
|
||||
if ( this.state == newState )
|
||||
return false;
|
||||
|
||||
this.previousState = this.state;
|
||||
|
||||
// Set the new state.
|
||||
this.state = newState;
|
||||
|
||||
// Fire the "state" event, so other parts of the code can react to the
|
||||
// change.
|
||||
this.fire( 'state' );
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Toggles the on/off (active/inactive) state of the command. This is
|
||||
* mainly used internally by context sensitive commands.
|
||||
* @example
|
||||
* command.<b>toggleState()</b>;
|
||||
*/
|
||||
toggleState : function()
|
||||
{
|
||||
if ( this.state == CKEDITOR.TRISTATE_OFF )
|
||||
this.setState( CKEDITOR.TRISTATE_ON );
|
||||
else if ( this.state == CKEDITOR.TRISTATE_ON )
|
||||
this.setState( CKEDITOR.TRISTATE_OFF );
|
||||
}
|
||||
};
|
||||
|
||||
CKEDITOR.event.implementOn( CKEDITOR.command.prototype, true );
|
||||
|
||||
/**
|
||||
* Indicates the previous command state.
|
||||
* @name CKEDITOR.command.prototype.previousState
|
||||
* @type Number
|
||||
* @see #state
|
||||
* @example
|
||||
* alert( command.<b>previousState</b> );
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired when the command state changes.
|
||||
* @name CKEDITOR.command#state
|
||||
* @event
|
||||
* @example
|
||||
* command.on( <b>'state'</b> , function( e )
|
||||
* {
|
||||
* // Alerts the new state.
|
||||
* alert( this.state );
|
||||
* });
|
||||
*/
|
||||
|
||||
@ -1,129 +1,129 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the "virtual" {@link CKEDITOR.commandDefinition} class,
|
||||
* which contains the defintion of a command. This file is for
|
||||
* documentation purposes only.
|
||||
*/
|
||||
|
||||
/**
|
||||
* (Virtual Class) Do not call this constructor. This class is not really part
|
||||
* of the API.
|
||||
* @name CKEDITOR.commandDefinition
|
||||
* @class Virtual class that illustrates the features of command objects to be
|
||||
* passed to the {@link CKEDITOR.editor.prototype.addCommand} function.
|
||||
* @example
|
||||
*/
|
||||
|
||||
/**
|
||||
* The function to be fired when the commend is executed.
|
||||
* @name CKEDITOR.commandDefinition.prototype.exec
|
||||
* @function
|
||||
* @param {CKEDITOR.editor} editor The editor within which run the command.
|
||||
* @param {Object} [data] Additional data to be used to execute the command.
|
||||
* @returns {Boolean} Whether the command has been successfully executed.
|
||||
* Defaults to "true", if nothing is returned.
|
||||
* @example
|
||||
* editorInstance.addCommand( 'sample',
|
||||
* {
|
||||
* exec : function( editor )
|
||||
* {
|
||||
* alert( 'Executing a command for the editor name "' + editor.name + '"!' );
|
||||
* }
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Whether the command need to be hooked into the redo/undo system.
|
||||
* @name CKEDITOR.commandDefinition.prototype.canUndo
|
||||
* @type {Boolean}
|
||||
* @default true
|
||||
* @field
|
||||
* @example
|
||||
* editorInstance.addCommand( 'alertName',
|
||||
* {
|
||||
* exec : function( editor )
|
||||
* {
|
||||
* alert( editor.name );
|
||||
* },
|
||||
* canUndo : false // No support for undo/redo
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Whether the command is asynchronous, which means that the
|
||||
* {@link CKEDITOR.editor#event:afterCommandExec} event will be fired by the
|
||||
* command itself manually, and that the return value of this command is not to
|
||||
* be returned by the {@link CKEDITOR.command#exec} function.
|
||||
* @name CKEDITOR.commandDefinition.prototype.async
|
||||
* @default false
|
||||
* @type {Boolean}
|
||||
* @example
|
||||
* editorInstance.addCommand( 'loadOptions',
|
||||
* {
|
||||
* exec : function( editor )
|
||||
* {
|
||||
* // Asynchronous operation below.
|
||||
* CKEDITOR.ajax.loadXml( 'data.xml', function()
|
||||
* {
|
||||
* editor.fire( 'afterCommandExec' );
|
||||
* ));
|
||||
* },
|
||||
* async : true // The command need some time to complete after exec function returns.
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Whether the command should give focus to the editor before execution.
|
||||
* @name CKEDITOR.commandDefinition.prototype.editorFocus
|
||||
* @type {Boolean}
|
||||
* @default true
|
||||
* @see CKEDITOR.command#editorFocus
|
||||
* @example
|
||||
* editorInstance.addCommand( 'maximize',
|
||||
* {
|
||||
* exec : function( editor )
|
||||
* {
|
||||
* // ...
|
||||
* },
|
||||
* editorFocus : false // The command doesn't require focusing the editing document.
|
||||
* });
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Whether the command state should be set to {@link CKEDITOR.TRISTATE_DISABLED} on startup.
|
||||
* @name CKEDITOR.commandDefinition.prototype.startDisabled
|
||||
* @type {Boolean}
|
||||
* @default false
|
||||
* @example
|
||||
* editorInstance.addCommand( 'unlink',
|
||||
* {
|
||||
* exec : function( editor )
|
||||
* {
|
||||
* // ...
|
||||
* },
|
||||
* startDisabled : true // Command is unavailable until selection is inside a link.
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* The editor modes within which the command can be executed. The execution
|
||||
* will have no action if the current mode is not listed in this property.
|
||||
* @name CKEDITOR.commandDefinition.prototype.modes
|
||||
* @type Object
|
||||
* @default { wysiwyg : 1 }
|
||||
* @see CKEDITOR.command#modes
|
||||
* @example
|
||||
* editorInstance.addCommand( 'link',
|
||||
* {
|
||||
* exec : function( editor )
|
||||
* {
|
||||
* // ...
|
||||
* },
|
||||
* modes : { wysiwyg : 1 } // Command is available in wysiwyg mode only.
|
||||
* });
|
||||
*/
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the "virtual" {@link CKEDITOR.commandDefinition} class,
|
||||
* which contains the defintion of a command. This file is for
|
||||
* documentation purposes only.
|
||||
*/
|
||||
|
||||
/**
|
||||
* (Virtual Class) Do not call this constructor. This class is not really part
|
||||
* of the API.
|
||||
* @name CKEDITOR.commandDefinition
|
||||
* @class Virtual class that illustrates the features of command objects to be
|
||||
* passed to the {@link CKEDITOR.editor.prototype.addCommand} function.
|
||||
* @example
|
||||
*/
|
||||
|
||||
/**
|
||||
* The function to be fired when the commend is executed.
|
||||
* @name CKEDITOR.commandDefinition.prototype.exec
|
||||
* @function
|
||||
* @param {CKEDITOR.editor} editor The editor within which run the command.
|
||||
* @param {Object} [data] Additional data to be used to execute the command.
|
||||
* @returns {Boolean} Whether the command has been successfully executed.
|
||||
* Defaults to "true", if nothing is returned.
|
||||
* @example
|
||||
* editorInstance.addCommand( 'sample',
|
||||
* {
|
||||
* exec : function( editor )
|
||||
* {
|
||||
* alert( 'Executing a command for the editor name "' + editor.name + '"!' );
|
||||
* }
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Whether the command need to be hooked into the redo/undo system.
|
||||
* @name CKEDITOR.commandDefinition.prototype.canUndo
|
||||
* @type {Boolean}
|
||||
* @default true
|
||||
* @field
|
||||
* @example
|
||||
* editorInstance.addCommand( 'alertName',
|
||||
* {
|
||||
* exec : function( editor )
|
||||
* {
|
||||
* alert( editor.name );
|
||||
* },
|
||||
* canUndo : false // No support for undo/redo
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Whether the command is asynchronous, which means that the
|
||||
* {@link CKEDITOR.editor#event:afterCommandExec} event will be fired by the
|
||||
* command itself manually, and that the return value of this command is not to
|
||||
* be returned by the {@link CKEDITOR.command#exec} function.
|
||||
* @name CKEDITOR.commandDefinition.prototype.async
|
||||
* @default false
|
||||
* @type {Boolean}
|
||||
* @example
|
||||
* editorInstance.addCommand( 'loadOptions',
|
||||
* {
|
||||
* exec : function( editor )
|
||||
* {
|
||||
* // Asynchronous operation below.
|
||||
* CKEDITOR.ajax.loadXml( 'data.xml', function()
|
||||
* {
|
||||
* editor.fire( 'afterCommandExec' );
|
||||
* ));
|
||||
* },
|
||||
* async : true // The command need some time to complete after exec function returns.
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Whether the command should give focus to the editor before execution.
|
||||
* @name CKEDITOR.commandDefinition.prototype.editorFocus
|
||||
* @type {Boolean}
|
||||
* @default true
|
||||
* @see CKEDITOR.command#editorFocus
|
||||
* @example
|
||||
* editorInstance.addCommand( 'maximize',
|
||||
* {
|
||||
* exec : function( editor )
|
||||
* {
|
||||
* // ...
|
||||
* },
|
||||
* editorFocus : false // The command doesn't require focusing the editing document.
|
||||
* });
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Whether the command state should be set to {@link CKEDITOR.TRISTATE_DISABLED} on startup.
|
||||
* @name CKEDITOR.commandDefinition.prototype.startDisabled
|
||||
* @type {Boolean}
|
||||
* @default false
|
||||
* @example
|
||||
* editorInstance.addCommand( 'unlink',
|
||||
* {
|
||||
* exec : function( editor )
|
||||
* {
|
||||
* // ...
|
||||
* },
|
||||
* startDisabled : true // Command is unavailable until selection is inside a link.
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* The editor modes within which the command can be executed. The execution
|
||||
* will have no action if the current mode is not listed in this property.
|
||||
* @name CKEDITOR.commandDefinition.prototype.modes
|
||||
* @type Object
|
||||
* @default { wysiwyg : 1 }
|
||||
* @see CKEDITOR.command#modes
|
||||
* @example
|
||||
* editorInstance.addCommand( 'link',
|
||||
* {
|
||||
* exec : function( editor )
|
||||
* {
|
||||
* // ...
|
||||
* },
|
||||
* modes : { wysiwyg : 1 } // Command is available in wysiwyg mode only.
|
||||
* });
|
||||
*/
|
||||
|
||||
@ -1,447 +1,447 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the <code>{@link CKEDITOR.config}</code> object that stores the
|
||||
* default configuration settings.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Used in conjunction with <code>{@link CKEDITOR.config.enterMode}</code>
|
||||
* and <code>{@link CKEDITOR.config.shiftEnterMode}</code> configuration
|
||||
* settings to make the editor produce <code><p></code> tags when
|
||||
* using the <em>Enter</em> key.
|
||||
* @constant
|
||||
*/
|
||||
CKEDITOR.ENTER_P = 1;
|
||||
|
||||
/**
|
||||
* Used in conjunction with <code>{@link CKEDITOR.config.enterMode}</code>
|
||||
* and <code>{@link CKEDITOR.config.shiftEnterMode}</code> configuration
|
||||
* settings to make the editor produce <code><br></code> tags when
|
||||
* using the <em>Enter</em> key.
|
||||
* @constant
|
||||
*/
|
||||
CKEDITOR.ENTER_BR = 2;
|
||||
|
||||
/**
|
||||
* Used in conjunction with <code>{@link CKEDITOR.config.enterMode}</code>
|
||||
* and <code>{@link CKEDITOR.config.shiftEnterMode}</code> configuration
|
||||
* settings to make the editor produce <code><div></code> tags when
|
||||
* using the <em>Enter</em> key.
|
||||
* @constant
|
||||
*/
|
||||
CKEDITOR.ENTER_DIV = 3;
|
||||
|
||||
/**
|
||||
* @namespace Stores default configuration settings. Changes to this object are
|
||||
* reflected in all editor instances, if not specified otherwise for a particular
|
||||
* instance.
|
||||
*/
|
||||
CKEDITOR.config =
|
||||
{
|
||||
/**
|
||||
* The URL path for the custom configuration file to be loaded. If not
|
||||
* overloaded with inline configuration, it defaults to the <code>config.js</code>
|
||||
* file present in the root of the CKEditor installation directory.<br /><br />
|
||||
*
|
||||
* CKEditor will recursively load custom configuration files defined inside
|
||||
* other custom configuration files.
|
||||
* @type String
|
||||
* @default <code>'<em><CKEditor folder></em>/config.js'</code>
|
||||
* @example
|
||||
* // Load a specific configuration file.
|
||||
* CKEDITOR.replace( 'myfield', { customConfig : '/myconfig.js' } );
|
||||
* @example
|
||||
* // Do not load any custom configuration file.
|
||||
* CKEDITOR.replace( 'myfield', { customConfig : '' } );
|
||||
*/
|
||||
customConfig : 'config.js',
|
||||
|
||||
/**
|
||||
* Whether the replaced element (usually a <code><textarea></code>)
|
||||
* is to be updated automatically when posting the form containing the editor.
|
||||
* @type Boolean
|
||||
* @default <code>true</code>
|
||||
* @example
|
||||
* config.autoUpdateElement = true;
|
||||
*/
|
||||
autoUpdateElement : true,
|
||||
|
||||
/**
|
||||
* The base href URL used to resolve relative and absolute URLs in the
|
||||
* editor content.
|
||||
* @type String
|
||||
* @default <code>''</code> (empty)
|
||||
* @example
|
||||
* config.baseHref = 'http://www.example.com/path/';
|
||||
*/
|
||||
baseHref : '',
|
||||
|
||||
/**
|
||||
* The CSS file(s) to be used to apply style to editor contents. It should
|
||||
* reflect the CSS used in the final pages where the contents are to be
|
||||
* used.
|
||||
* @type String|Array
|
||||
* @default <code>'<em><CKEditor folder></em>/contents.css'</code>
|
||||
* @example
|
||||
* config.contentsCss = '/css/mysitestyles.css';
|
||||
* config.contentsCss = ['/css/mysitestyles.css', '/css/anotherfile.css'];
|
||||
*/
|
||||
contentsCss : CKEDITOR.basePath + 'contents.css',
|
||||
|
||||
/**
|
||||
* The writing direction of the language used to create the editor
|
||||
* contents. Allowed values are:
|
||||
* <ul>
|
||||
* <li><code>'ui'</code> – indicates that content direction will be the same as the user interface language direction;</li>
|
||||
* <li><code>'ltr'</code> – for Left-To-Right language (like English);</li>
|
||||
* <li><code>'rtl'</code> – for Right-To-Left languages (like Arabic).</li>
|
||||
* </ul>
|
||||
* @default <code>'ui'</code>
|
||||
* @type String
|
||||
* @example
|
||||
* config.contentsLangDirection = 'rtl';
|
||||
*/
|
||||
contentsLangDirection : 'ui',
|
||||
|
||||
/**
|
||||
* Language code of the writing language which is used to create the editor
|
||||
* contents.
|
||||
* @default Same value as editor UI language.
|
||||
* @type String
|
||||
* @example
|
||||
* config.contentsLanguage = 'fr';
|
||||
*/
|
||||
contentsLanguage : '',
|
||||
|
||||
/**
|
||||
* The user interface language localization to use. If left empty, the editor
|
||||
* will automatically be localized to the user language. If the user language is not supported,
|
||||
* the language specified in the <code>{@link CKEDITOR.config.defaultLanguage}</code>
|
||||
* configuration setting is used.
|
||||
* @default <code>''</code> (empty)
|
||||
* @type String
|
||||
* @example
|
||||
* // Load the German interface.
|
||||
* config.language = 'de';
|
||||
*/
|
||||
language : '',
|
||||
|
||||
/**
|
||||
* The language to be used if the <code>{@link CKEDITOR.config.language}</code>
|
||||
* setting is left empty and it is not possible to localize the editor to the user language.
|
||||
* @default <code>'en'</code>
|
||||
* @type String
|
||||
* @example
|
||||
* config.defaultLanguage = 'it';
|
||||
*/
|
||||
defaultLanguage : 'en',
|
||||
|
||||
/**
|
||||
* Sets the behavior of the <em>Enter</em> key. It also determines other behavior
|
||||
* rules of the editor, like whether the <code><br></code> element is to be used
|
||||
* as a paragraph separator when indenting text.
|
||||
* The allowed values are the following constants that cause the behavior outlined below:
|
||||
* <ul>
|
||||
* <li><code>{@link CKEDITOR.ENTER_P}</code> (1) – new <code><p></code> paragraphs are created;</li>
|
||||
* <li><code>{@link CKEDITOR.ENTER_BR}</code> (2) – lines are broken with <code><br></code> elements;</li>
|
||||
* <li><code>{@link CKEDITOR.ENTER_DIV}</code> (3) – new <code><div></code> blocks are created.</li>
|
||||
* </ul>
|
||||
* <strong>Note</strong>: It is recommended to use the
|
||||
* <code>{@link CKEDITOR.ENTER_P}</code> setting because of its semantic value and
|
||||
* correctness. The editor is optimized for this setting.
|
||||
* @type Number
|
||||
* @default <code>{@link CKEDITOR.ENTER_P}</code>
|
||||
* @example
|
||||
* // Not recommended.
|
||||
* config.enterMode = CKEDITOR.ENTER_BR;
|
||||
*/
|
||||
enterMode : CKEDITOR.ENTER_P,
|
||||
|
||||
/**
|
||||
* Force the use of <code>{@link CKEDITOR.config.enterMode}</code> as line break regardless
|
||||
* of the context. If, for example, <code>{@link CKEDITOR.config.enterMode}</code> is set
|
||||
* to <code>{@link CKEDITOR.ENTER_P}</code>, pressing the <em>Enter</em> key inside a
|
||||
* <code><div></code> element will create a new paragraph with <code><p></code>
|
||||
* instead of a <code><div></code>.
|
||||
* @since 3.2.1
|
||||
* @type Boolean
|
||||
* @default <code>false</code>
|
||||
* @example
|
||||
* // Not recommended.
|
||||
* config.forceEnterMode = true;
|
||||
*/
|
||||
forceEnterMode : false,
|
||||
|
||||
/**
|
||||
* Similarly to the <code>{@link CKEDITOR.config.enterMode}</code> setting, it defines the behavior
|
||||
* of the <em>Shift+Enter</em> key combination.
|
||||
* The allowed values are the following constants the behavior outlined below:
|
||||
* <ul>
|
||||
* <li><code>{@link CKEDITOR.ENTER_P}</code> (1) – new <code><p></code> paragraphs are created;</li>
|
||||
* <li><code>{@link CKEDITOR.ENTER_BR}</code> (2) – lines are broken with <code><br></code> elements;</li>
|
||||
* <li><code>{@link CKEDITOR.ENTER_DIV}</code> (3) – new <code><div></code> blocks are created.</li>
|
||||
* </ul>
|
||||
* @type Number
|
||||
* @default <code>{@link CKEDITOR.ENTER_BR}</code>
|
||||
* @example
|
||||
* config.shiftEnterMode = CKEDITOR.ENTER_P;
|
||||
*/
|
||||
shiftEnterMode : CKEDITOR.ENTER_BR,
|
||||
|
||||
/**
|
||||
* A comma separated list of plugins that are not related to editor
|
||||
* instances. Reserved for plugins that extend the core code only.<br /><br />
|
||||
*
|
||||
* There are no ways to override this setting except by editing the source
|
||||
* code of CKEditor (<code>_source/core/config.js</code>).
|
||||
* @type String
|
||||
* @example
|
||||
*/
|
||||
corePlugins : '',
|
||||
|
||||
/**
|
||||
* Sets the <code>DOCTYPE</code> to be used when loading the editor content as HTML.
|
||||
* @type String
|
||||
* @default <code>'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'</code>
|
||||
* @example
|
||||
* // Set the DOCTYPE to the HTML 4 (Quirks) mode.
|
||||
* config.docType = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
|
||||
*/
|
||||
docType : '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
|
||||
|
||||
/**
|
||||
* Sets the <code>id</code> attribute to be used on the <code>body</code> element
|
||||
* of the editing area. This can be useful when you intend to reuse the original CSS
|
||||
* file you are using on your live website and want to assign the editor the same ID
|
||||
* as the section that will include the contents. In this way ID-specific CSS rules will
|
||||
* be enabled.
|
||||
* @since 3.1
|
||||
* @type String
|
||||
* @default <code>''</code> (empty)
|
||||
* @example
|
||||
* config.bodyId = 'contents_id';
|
||||
*/
|
||||
bodyId : '',
|
||||
|
||||
/**
|
||||
* Sets the <code>class</code> attribute to be used on the <code>body</code> element
|
||||
* of the editing area. This can be useful when you intend to reuse the original CSS
|
||||
* file you are using on your live website and want to assign the editor the same class
|
||||
* as the section that will include the contents. In this way class-specific CSS rules will
|
||||
* be enabled.
|
||||
* @since 3.1
|
||||
* @type String
|
||||
* @default <code>''</code> (empty)
|
||||
* @example
|
||||
* config.bodyClass = 'contents';
|
||||
*/
|
||||
bodyClass : '',
|
||||
|
||||
/**
|
||||
* Indicates whether the contents to be edited are being input as a full
|
||||
* HTML page. A full page includes the <code><html></code>,
|
||||
* <code><head></code>, and <code><body></code> elements.
|
||||
* The final output will also reflect this setting, including the
|
||||
* <code><body></code> contents only if this setting is disabled.
|
||||
* @since 3.1
|
||||
* @type Boolean
|
||||
* @default <code>false</code>
|
||||
* @example
|
||||
* config.fullPage = true;
|
||||
*/
|
||||
fullPage : false,
|
||||
|
||||
/**
|
||||
* The height of the editing area (that includes the editor content). This
|
||||
* can be an integer, for pixel sizes, or any CSS-defined length unit.<br>
|
||||
* <br>
|
||||
* <strong>Note:</strong> Percent units (%) are not supported.
|
||||
* @type Number|String
|
||||
* @default <code>200</code>
|
||||
* @example
|
||||
* config.height = 500; // 500 pixels.
|
||||
* @example
|
||||
* config.height = '25em'; // CSS length.
|
||||
* @example
|
||||
* config.height = '300px'; // CSS length.
|
||||
*/
|
||||
height : 200,
|
||||
|
||||
/**
|
||||
* Comma separated list of plugins to be loaded and initialized for an editor
|
||||
* instance. This setting should rarely be changed. It is recommended to use the
|
||||
* <code>{@link CKEDITOR.config.extraPlugins}</code> and
|
||||
* <code>{@link CKEDITOR.config.removePlugins}</code> for customization purposes instead.
|
||||
* @type String
|
||||
* @example
|
||||
*/
|
||||
plugins :
|
||||
'about,' +
|
||||
'a11yhelp,' +
|
||||
'basicstyles,' +
|
||||
'bidi,' +
|
||||
'blockquote,' +
|
||||
'button,' +
|
||||
'clipboard,' +
|
||||
'colorbutton,' +
|
||||
'colordialog,' +
|
||||
'contextmenu,' +
|
||||
'dialogadvtab,' +
|
||||
'div,' +
|
||||
'elementspath,' +
|
||||
'enterkey,' +
|
||||
'entities,' +
|
||||
'filebrowser,' +
|
||||
'find,' +
|
||||
'flash,' +
|
||||
'font,' +
|
||||
'format,' +
|
||||
'forms,' +
|
||||
'horizontalrule,' +
|
||||
'htmldataprocessor,' +
|
||||
'iframe,' +
|
||||
'image,' +
|
||||
'indent,' +
|
||||
'justify,' +
|
||||
'keystrokes,' +
|
||||
'link,' +
|
||||
'list,' +
|
||||
'liststyle,' +
|
||||
'maximize,' +
|
||||
'newpage,' +
|
||||
'pagebreak,' +
|
||||
'pastefromword,' +
|
||||
'pastetext,' +
|
||||
'popup,' +
|
||||
'preview,' +
|
||||
'print,' +
|
||||
'removeformat,' +
|
||||
'resize,' +
|
||||
'save,' +
|
||||
'scayt,' +
|
||||
'showblocks,' +
|
||||
'showborders,' +
|
||||
'smiley,' +
|
||||
'sourcearea,' +
|
||||
'specialchar,' +
|
||||
'stylescombo,' +
|
||||
'tab,' +
|
||||
'table,' +
|
||||
'tabletools,' +
|
||||
'templates,' +
|
||||
'toolbar,' +
|
||||
'undo,' +
|
||||
'wsc,' +
|
||||
'wysiwygarea',
|
||||
|
||||
/**
|
||||
* A list of additional plugins to be loaded. This setting makes it easier
|
||||
* to add new plugins without having to touch and potentially break the
|
||||
* <code>{@link CKEDITOR.config.plugins}</code> setting.
|
||||
* @type String
|
||||
* @example
|
||||
* config.extraPlugins = 'myplugin,anotherplugin';
|
||||
*/
|
||||
extraPlugins : '',
|
||||
|
||||
/**
|
||||
* A list of plugins that must not be loaded. This setting makes it possible
|
||||
* to avoid loading some plugins defined in the <code>{@link CKEDITOR.config.plugins}</code>
|
||||
* setting, without having to touch it and potentially break it.
|
||||
* @type String
|
||||
* @example
|
||||
* config.removePlugins = 'elementspath,save,font';
|
||||
*/
|
||||
removePlugins : '',
|
||||
|
||||
/**
|
||||
* List of regular expressions to be executed on input HTML,
|
||||
* indicating HTML source code that when matched, must <strong>not</strong> be available in the WYSIWYG
|
||||
* mode for editing.
|
||||
* @type Array
|
||||
* @default <code>[]</code> (empty array)
|
||||
* @example
|
||||
* config.protectedSource.push( /<\?[\s\S]*?\?>/g ); // PHP code
|
||||
* config.protectedSource.push( /<%[\s\S]*?%>/g ); // ASP code
|
||||
* config.protectedSource.push( /(<asp:[^\>]+>[\s|\S]*?<\/asp:[^\>]+>)|(<asp:[^\>]+\/>)/gi ); // ASP.Net code
|
||||
*/
|
||||
protectedSource : [],
|
||||
|
||||
/**
|
||||
* The editor <code>tabindex</code> value.
|
||||
* @type Number
|
||||
* @default <code>0</code> (zero)
|
||||
* @example
|
||||
* config.tabIndex = 1;
|
||||
*/
|
||||
tabIndex : 0,
|
||||
|
||||
/**
|
||||
* The theme to be used to build the user interface.
|
||||
* @type String
|
||||
* @default <code>'default'</code>
|
||||
* @see CKEDITOR.config.skin
|
||||
* @example
|
||||
* config.theme = 'default';
|
||||
*/
|
||||
theme : 'default',
|
||||
|
||||
/**
|
||||
* The skin to load. It may be the name of the skin folder inside the
|
||||
* editor installation path, or the name and the path separated by a comma.
|
||||
* @type String
|
||||
* @default <code>'default'</code>
|
||||
* @example
|
||||
* config.skin = 'v2';
|
||||
* @example
|
||||
* config.skin = 'myskin,/customstuff/myskin/';
|
||||
*/
|
||||
skin : 'kama',
|
||||
|
||||
/**
|
||||
* The editor UI outer width. This can be an integer, for pixel sizes, or
|
||||
* any CSS-defined unit.<br>
|
||||
* <br>
|
||||
* Unlike the <code>{@link CKEDITOR.config.height}</code> setting, this
|
||||
* one will set the outer width of the entire editor UI, not for the
|
||||
* editing area only.
|
||||
* @type String|Number
|
||||
* @default <code>''</code> (empty)
|
||||
* @example
|
||||
* config.width = 850; // 850 pixels wide.
|
||||
* @example
|
||||
* config.width = '75%'; // CSS unit.
|
||||
*/
|
||||
width : '',
|
||||
|
||||
/**
|
||||
* The base Z-index for floating dialog windows and popups.
|
||||
* @type Number
|
||||
* @default <code>10000</code>
|
||||
* @example
|
||||
* config.baseFloatZIndex = 2000
|
||||
*/
|
||||
baseFloatZIndex : 10000
|
||||
};
|
||||
|
||||
/**
|
||||
* Indicates that some of the editor features, like alignment and text
|
||||
* direction, should use the "computed value" of the feature to indicate its
|
||||
* on/off state instead of using the "real value".<br />
|
||||
* <br />
|
||||
* If enabled in a Left-To-Right written document, the "Left Justify"
|
||||
* alignment button will be shown as active, even if the alignment style is not
|
||||
* explicitly applied to the current paragraph in the editor.
|
||||
* @name CKEDITOR.config.useComputedState
|
||||
* @type Boolean
|
||||
* @default <code>true</code>
|
||||
* @since 3.4
|
||||
* @example
|
||||
* config.useComputedState = false;
|
||||
*/
|
||||
|
||||
// PACKAGER_RENAME( CKEDITOR.config )
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the <code>{@link CKEDITOR.config}</code> object that stores the
|
||||
* default configuration settings.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Used in conjunction with <code>{@link CKEDITOR.config.enterMode}</code>
|
||||
* and <code>{@link CKEDITOR.config.shiftEnterMode}</code> configuration
|
||||
* settings to make the editor produce <code><p></code> tags when
|
||||
* using the <em>Enter</em> key.
|
||||
* @constant
|
||||
*/
|
||||
CKEDITOR.ENTER_P = 1;
|
||||
|
||||
/**
|
||||
* Used in conjunction with <code>{@link CKEDITOR.config.enterMode}</code>
|
||||
* and <code>{@link CKEDITOR.config.shiftEnterMode}</code> configuration
|
||||
* settings to make the editor produce <code><br></code> tags when
|
||||
* using the <em>Enter</em> key.
|
||||
* @constant
|
||||
*/
|
||||
CKEDITOR.ENTER_BR = 2;
|
||||
|
||||
/**
|
||||
* Used in conjunction with <code>{@link CKEDITOR.config.enterMode}</code>
|
||||
* and <code>{@link CKEDITOR.config.shiftEnterMode}</code> configuration
|
||||
* settings to make the editor produce <code><div></code> tags when
|
||||
* using the <em>Enter</em> key.
|
||||
* @constant
|
||||
*/
|
||||
CKEDITOR.ENTER_DIV = 3;
|
||||
|
||||
/**
|
||||
* @namespace Stores default configuration settings. Changes to this object are
|
||||
* reflected in all editor instances, if not specified otherwise for a particular
|
||||
* instance.
|
||||
*/
|
||||
CKEDITOR.config =
|
||||
{
|
||||
/**
|
||||
* The URL path for the custom configuration file to be loaded. If not
|
||||
* overloaded with inline configuration, it defaults to the <code>config.js</code>
|
||||
* file present in the root of the CKEditor installation directory.<br /><br />
|
||||
*
|
||||
* CKEditor will recursively load custom configuration files defined inside
|
||||
* other custom configuration files.
|
||||
* @type String
|
||||
* @default <code>'<em><CKEditor folder></em>/config.js'</code>
|
||||
* @example
|
||||
* // Load a specific configuration file.
|
||||
* CKEDITOR.replace( 'myfield', { customConfig : '/myconfig.js' } );
|
||||
* @example
|
||||
* // Do not load any custom configuration file.
|
||||
* CKEDITOR.replace( 'myfield', { customConfig : '' } );
|
||||
*/
|
||||
customConfig : 'config.js',
|
||||
|
||||
/**
|
||||
* Whether the replaced element (usually a <code><textarea></code>)
|
||||
* is to be updated automatically when posting the form containing the editor.
|
||||
* @type Boolean
|
||||
* @default <code>true</code>
|
||||
* @example
|
||||
* config.autoUpdateElement = true;
|
||||
*/
|
||||
autoUpdateElement : true,
|
||||
|
||||
/**
|
||||
* The base href URL used to resolve relative and absolute URLs in the
|
||||
* editor content.
|
||||
* @type String
|
||||
* @default <code>''</code> (empty)
|
||||
* @example
|
||||
* config.baseHref = 'http://www.example.com/path/';
|
||||
*/
|
||||
baseHref : '',
|
||||
|
||||
/**
|
||||
* The CSS file(s) to be used to apply style to editor contents. It should
|
||||
* reflect the CSS used in the final pages where the contents are to be
|
||||
* used.
|
||||
* @type String|Array
|
||||
* @default <code>'<em><CKEditor folder></em>/contents.css'</code>
|
||||
* @example
|
||||
* config.contentsCss = '/css/mysitestyles.css';
|
||||
* config.contentsCss = ['/css/mysitestyles.css', '/css/anotherfile.css'];
|
||||
*/
|
||||
contentsCss : CKEDITOR.basePath + 'contents.css',
|
||||
|
||||
/**
|
||||
* The writing direction of the language used to create the editor
|
||||
* contents. Allowed values are:
|
||||
* <ul>
|
||||
* <li><code>'ui'</code> – indicates that content direction will be the same as the user interface language direction;</li>
|
||||
* <li><code>'ltr'</code> – for Left-To-Right language (like English);</li>
|
||||
* <li><code>'rtl'</code> – for Right-To-Left languages (like Arabic).</li>
|
||||
* </ul>
|
||||
* @default <code>'ui'</code>
|
||||
* @type String
|
||||
* @example
|
||||
* config.contentsLangDirection = 'rtl';
|
||||
*/
|
||||
contentsLangDirection : 'ui',
|
||||
|
||||
/**
|
||||
* Language code of the writing language which is used to create the editor
|
||||
* contents.
|
||||
* @default Same value as editor UI language.
|
||||
* @type String
|
||||
* @example
|
||||
* config.contentsLanguage = 'fr';
|
||||
*/
|
||||
contentsLanguage : '',
|
||||
|
||||
/**
|
||||
* The user interface language localization to use. If left empty, the editor
|
||||
* will automatically be localized to the user language. If the user language is not supported,
|
||||
* the language specified in the <code>{@link CKEDITOR.config.defaultLanguage}</code>
|
||||
* configuration setting is used.
|
||||
* @default <code>''</code> (empty)
|
||||
* @type String
|
||||
* @example
|
||||
* // Load the German interface.
|
||||
* config.language = 'de';
|
||||
*/
|
||||
language : '',
|
||||
|
||||
/**
|
||||
* The language to be used if the <code>{@link CKEDITOR.config.language}</code>
|
||||
* setting is left empty and it is not possible to localize the editor to the user language.
|
||||
* @default <code>'en'</code>
|
||||
* @type String
|
||||
* @example
|
||||
* config.defaultLanguage = 'it';
|
||||
*/
|
||||
defaultLanguage : 'en',
|
||||
|
||||
/**
|
||||
* Sets the behavior of the <em>Enter</em> key. It also determines other behavior
|
||||
* rules of the editor, like whether the <code><br></code> element is to be used
|
||||
* as a paragraph separator when indenting text.
|
||||
* The allowed values are the following constants that cause the behavior outlined below:
|
||||
* <ul>
|
||||
* <li><code>{@link CKEDITOR.ENTER_P}</code> (1) – new <code><p></code> paragraphs are created;</li>
|
||||
* <li><code>{@link CKEDITOR.ENTER_BR}</code> (2) – lines are broken with <code><br></code> elements;</li>
|
||||
* <li><code>{@link CKEDITOR.ENTER_DIV}</code> (3) – new <code><div></code> blocks are created.</li>
|
||||
* </ul>
|
||||
* <strong>Note</strong>: It is recommended to use the
|
||||
* <code>{@link CKEDITOR.ENTER_P}</code> setting because of its semantic value and
|
||||
* correctness. The editor is optimized for this setting.
|
||||
* @type Number
|
||||
* @default <code>{@link CKEDITOR.ENTER_P}</code>
|
||||
* @example
|
||||
* // Not recommended.
|
||||
* config.enterMode = CKEDITOR.ENTER_BR;
|
||||
*/
|
||||
enterMode : CKEDITOR.ENTER_P,
|
||||
|
||||
/**
|
||||
* Force the use of <code>{@link CKEDITOR.config.enterMode}</code> as line break regardless
|
||||
* of the context. If, for example, <code>{@link CKEDITOR.config.enterMode}</code> is set
|
||||
* to <code>{@link CKEDITOR.ENTER_P}</code>, pressing the <em>Enter</em> key inside a
|
||||
* <code><div></code> element will create a new paragraph with <code><p></code>
|
||||
* instead of a <code><div></code>.
|
||||
* @since 3.2.1
|
||||
* @type Boolean
|
||||
* @default <code>false</code>
|
||||
* @example
|
||||
* // Not recommended.
|
||||
* config.forceEnterMode = true;
|
||||
*/
|
||||
forceEnterMode : false,
|
||||
|
||||
/**
|
||||
* Similarly to the <code>{@link CKEDITOR.config.enterMode}</code> setting, it defines the behavior
|
||||
* of the <em>Shift+Enter</em> key combination.
|
||||
* The allowed values are the following constants the behavior outlined below:
|
||||
* <ul>
|
||||
* <li><code>{@link CKEDITOR.ENTER_P}</code> (1) – new <code><p></code> paragraphs are created;</li>
|
||||
* <li><code>{@link CKEDITOR.ENTER_BR}</code> (2) – lines are broken with <code><br></code> elements;</li>
|
||||
* <li><code>{@link CKEDITOR.ENTER_DIV}</code> (3) – new <code><div></code> blocks are created.</li>
|
||||
* </ul>
|
||||
* @type Number
|
||||
* @default <code>{@link CKEDITOR.ENTER_BR}</code>
|
||||
* @example
|
||||
* config.shiftEnterMode = CKEDITOR.ENTER_P;
|
||||
*/
|
||||
shiftEnterMode : CKEDITOR.ENTER_BR,
|
||||
|
||||
/**
|
||||
* A comma separated list of plugins that are not related to editor
|
||||
* instances. Reserved for plugins that extend the core code only.<br /><br />
|
||||
*
|
||||
* There are no ways to override this setting except by editing the source
|
||||
* code of CKEditor (<code>_source/core/config.js</code>).
|
||||
* @type String
|
||||
* @example
|
||||
*/
|
||||
corePlugins : '',
|
||||
|
||||
/**
|
||||
* Sets the <code>DOCTYPE</code> to be used when loading the editor content as HTML.
|
||||
* @type String
|
||||
* @default <code>'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'</code>
|
||||
* @example
|
||||
* // Set the DOCTYPE to the HTML 4 (Quirks) mode.
|
||||
* config.docType = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
|
||||
*/
|
||||
docType : '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
|
||||
|
||||
/**
|
||||
* Sets the <code>id</code> attribute to be used on the <code>body</code> element
|
||||
* of the editing area. This can be useful when you intend to reuse the original CSS
|
||||
* file you are using on your live website and want to assign the editor the same ID
|
||||
* as the section that will include the contents. In this way ID-specific CSS rules will
|
||||
* be enabled.
|
||||
* @since 3.1
|
||||
* @type String
|
||||
* @default <code>''</code> (empty)
|
||||
* @example
|
||||
* config.bodyId = 'contents_id';
|
||||
*/
|
||||
bodyId : '',
|
||||
|
||||
/**
|
||||
* Sets the <code>class</code> attribute to be used on the <code>body</code> element
|
||||
* of the editing area. This can be useful when you intend to reuse the original CSS
|
||||
* file you are using on your live website and want to assign the editor the same class
|
||||
* as the section that will include the contents. In this way class-specific CSS rules will
|
||||
* be enabled.
|
||||
* @since 3.1
|
||||
* @type String
|
||||
* @default <code>''</code> (empty)
|
||||
* @example
|
||||
* config.bodyClass = 'contents';
|
||||
*/
|
||||
bodyClass : '',
|
||||
|
||||
/**
|
||||
* Indicates whether the contents to be edited are being input as a full
|
||||
* HTML page. A full page includes the <code><html></code>,
|
||||
* <code><head></code>, and <code><body></code> elements.
|
||||
* The final output will also reflect this setting, including the
|
||||
* <code><body></code> contents only if this setting is disabled.
|
||||
* @since 3.1
|
||||
* @type Boolean
|
||||
* @default <code>false</code>
|
||||
* @example
|
||||
* config.fullPage = true;
|
||||
*/
|
||||
fullPage : false,
|
||||
|
||||
/**
|
||||
* The height of the editing area (that includes the editor content). This
|
||||
* can be an integer, for pixel sizes, or any CSS-defined length unit.<br>
|
||||
* <br>
|
||||
* <strong>Note:</strong> Percent units (%) are not supported.
|
||||
* @type Number|String
|
||||
* @default <code>200</code>
|
||||
* @example
|
||||
* config.height = 500; // 500 pixels.
|
||||
* @example
|
||||
* config.height = '25em'; // CSS length.
|
||||
* @example
|
||||
* config.height = '300px'; // CSS length.
|
||||
*/
|
||||
height : 200,
|
||||
|
||||
/**
|
||||
* Comma separated list of plugins to be loaded and initialized for an editor
|
||||
* instance. This setting should rarely be changed. It is recommended to use the
|
||||
* <code>{@link CKEDITOR.config.extraPlugins}</code> and
|
||||
* <code>{@link CKEDITOR.config.removePlugins}</code> for customization purposes instead.
|
||||
* @type String
|
||||
* @example
|
||||
*/
|
||||
plugins :
|
||||
'about,' +
|
||||
'a11yhelp,' +
|
||||
'basicstyles,' +
|
||||
'bidi,' +
|
||||
'blockquote,' +
|
||||
'button,' +
|
||||
'clipboard,' +
|
||||
'colorbutton,' +
|
||||
'colordialog,' +
|
||||
'contextmenu,' +
|
||||
'dialogadvtab,' +
|
||||
'div,' +
|
||||
'elementspath,' +
|
||||
'enterkey,' +
|
||||
'entities,' +
|
||||
'filebrowser,' +
|
||||
'find,' +
|
||||
'flash,' +
|
||||
'font,' +
|
||||
'format,' +
|
||||
'forms,' +
|
||||
'horizontalrule,' +
|
||||
'htmldataprocessor,' +
|
||||
'iframe,' +
|
||||
'image,' +
|
||||
'indent,' +
|
||||
'justify,' +
|
||||
'keystrokes,' +
|
||||
'link,' +
|
||||
'list,' +
|
||||
'liststyle,' +
|
||||
'maximize,' +
|
||||
'newpage,' +
|
||||
'pagebreak,' +
|
||||
'pastefromword,' +
|
||||
'pastetext,' +
|
||||
'popup,' +
|
||||
'preview,' +
|
||||
'print,' +
|
||||
'removeformat,' +
|
||||
'resize,' +
|
||||
'save,' +
|
||||
'scayt,' +
|
||||
'showblocks,' +
|
||||
'showborders,' +
|
||||
'smiley,' +
|
||||
'sourcearea,' +
|
||||
'specialchar,' +
|
||||
'stylescombo,' +
|
||||
'tab,' +
|
||||
'table,' +
|
||||
'tabletools,' +
|
||||
'templates,' +
|
||||
'toolbar,' +
|
||||
'undo,' +
|
||||
'wsc,' +
|
||||
'wysiwygarea',
|
||||
|
||||
/**
|
||||
* A list of additional plugins to be loaded. This setting makes it easier
|
||||
* to add new plugins without having to touch and potentially break the
|
||||
* <code>{@link CKEDITOR.config.plugins}</code> setting.
|
||||
* @type String
|
||||
* @example
|
||||
* config.extraPlugins = 'myplugin,anotherplugin';
|
||||
*/
|
||||
extraPlugins : '',
|
||||
|
||||
/**
|
||||
* A list of plugins that must not be loaded. This setting makes it possible
|
||||
* to avoid loading some plugins defined in the <code>{@link CKEDITOR.config.plugins}</code>
|
||||
* setting, without having to touch it and potentially break it.
|
||||
* @type String
|
||||
* @example
|
||||
* config.removePlugins = 'elementspath,save,font';
|
||||
*/
|
||||
removePlugins : '',
|
||||
|
||||
/**
|
||||
* List of regular expressions to be executed on input HTML,
|
||||
* indicating HTML source code that when matched, must <strong>not</strong> be available in the WYSIWYG
|
||||
* mode for editing.
|
||||
* @type Array
|
||||
* @default <code>[]</code> (empty array)
|
||||
* @example
|
||||
* config.protectedSource.push( /<\?[\s\S]*?\?>/g ); // PHP code
|
||||
* config.protectedSource.push( /<%[\s\S]*?%>/g ); // ASP code
|
||||
* config.protectedSource.push( /(<asp:[^\>]+>[\s|\S]*?<\/asp:[^\>]+>)|(<asp:[^\>]+\/>)/gi ); // ASP.Net code
|
||||
*/
|
||||
protectedSource : [],
|
||||
|
||||
/**
|
||||
* The editor <code>tabindex</code> value.
|
||||
* @type Number
|
||||
* @default <code>0</code> (zero)
|
||||
* @example
|
||||
* config.tabIndex = 1;
|
||||
*/
|
||||
tabIndex : 0,
|
||||
|
||||
/**
|
||||
* The theme to be used to build the user interface.
|
||||
* @type String
|
||||
* @default <code>'default'</code>
|
||||
* @see CKEDITOR.config.skin
|
||||
* @example
|
||||
* config.theme = 'default';
|
||||
*/
|
||||
theme : 'default',
|
||||
|
||||
/**
|
||||
* The skin to load. It may be the name of the skin folder inside the
|
||||
* editor installation path, or the name and the path separated by a comma.
|
||||
* @type String
|
||||
* @default <code>'default'</code>
|
||||
* @example
|
||||
* config.skin = 'v2';
|
||||
* @example
|
||||
* config.skin = 'myskin,/customstuff/myskin/';
|
||||
*/
|
||||
skin : 'kama',
|
||||
|
||||
/**
|
||||
* The editor UI outer width. This can be an integer, for pixel sizes, or
|
||||
* any CSS-defined unit.<br>
|
||||
* <br>
|
||||
* Unlike the <code>{@link CKEDITOR.config.height}</code> setting, this
|
||||
* one will set the outer width of the entire editor UI, not for the
|
||||
* editing area only.
|
||||
* @type String|Number
|
||||
* @default <code>''</code> (empty)
|
||||
* @example
|
||||
* config.width = 850; // 850 pixels wide.
|
||||
* @example
|
||||
* config.width = '75%'; // CSS unit.
|
||||
*/
|
||||
width : '',
|
||||
|
||||
/**
|
||||
* The base Z-index for floating dialog windows and popups.
|
||||
* @type Number
|
||||
* @default <code>10000</code>
|
||||
* @example
|
||||
* config.baseFloatZIndex = 2000
|
||||
*/
|
||||
baseFloatZIndex : 10000
|
||||
};
|
||||
|
||||
/**
|
||||
* Indicates that some of the editor features, like alignment and text
|
||||
* direction, should use the "computed value" of the feature to indicate its
|
||||
* on/off state instead of using the "real value".<br />
|
||||
* <br />
|
||||
* If enabled in a Left-To-Right written document, the "Left Justify"
|
||||
* alignment button will be shown as active, even if the alignment style is not
|
||||
* explicitly applied to the current paragraph in the editor.
|
||||
* @name CKEDITOR.config.useComputedState
|
||||
* @type Boolean
|
||||
* @default <code>true</code>
|
||||
* @since 3.4
|
||||
* @example
|
||||
* config.useComputedState = false;
|
||||
*/
|
||||
|
||||
// PACKAGER_RENAME( CKEDITOR.config )
|
||||
|
||||
@ -1,65 +1,65 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the "virtual" {@link CKEDITOR.dataProcessor} class, which
|
||||
* defines the basic structure of data processor objects to be
|
||||
* set to {@link CKEDITOR.editor.dataProcessor}.
|
||||
*/
|
||||
|
||||
/**
|
||||
* If defined, points to the data processor which is responsible to translate
|
||||
* and transform the editor data on input and output.
|
||||
* Generaly it will point to an instance of {@link CKEDITOR.htmlDataProcessor},
|
||||
* which handles HTML data. The editor may also handle other data formats by
|
||||
* using different data processors provided by specific plugins.
|
||||
* @name CKEDITOR.editor.prototype.dataProcessor
|
||||
* @type CKEDITOR.dataProcessor
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class is here for documentation purposes only and is not really part of
|
||||
* the API. It serves as the base ("interface") for data processors
|
||||
* implementation.
|
||||
* @name CKEDITOR.dataProcessor
|
||||
* @class Represents a data processor, which is responsible to translate and
|
||||
* transform the editor data on input and output.
|
||||
* @example
|
||||
*/
|
||||
|
||||
/**
|
||||
* Transforms input data into HTML to be loaded in the editor.
|
||||
* While the editor is able to handle non HTML data (like BBCode), at runtime
|
||||
* it can handle HTML data only. The role of the data processor is transforming
|
||||
* the input data into HTML through this function.
|
||||
* @name CKEDITOR.dataProcessor.prototype.toHtml
|
||||
* @function
|
||||
* @param {String} data The input data to be transformed.
|
||||
* @param {String} [fixForBody] The tag name to be used if the data must be
|
||||
* fixed because it is supposed to be loaded direcly into the <body>
|
||||
* tag. This is generally not used by non-HTML data processors.
|
||||
* @example
|
||||
* // Tranforming BBCode data, having a custom BBCode data processor.
|
||||
* var data = 'This is [b]an example[/b].';
|
||||
* var html = editor.dataProcessor.toHtml( data ); // '<p>This is <b>an example</b>.</p>'
|
||||
*/
|
||||
|
||||
/**
|
||||
* Transforms HTML into data to be outputted by the editor, in the format
|
||||
* expected by the data processor.
|
||||
* While the editor is able to handle non HTML data (like BBCode), at runtime
|
||||
* it can handle HTML data only. The role of the data processor is transforming
|
||||
* the HTML data containined by the editor into a specific data format through
|
||||
* this function.
|
||||
* @name CKEDITOR.dataProcessor.prototype.toDataFormat
|
||||
* @function
|
||||
* @param {String} html The HTML to be transformed.
|
||||
* @param {String} fixForBody The tag name to be used if the output data is
|
||||
* coming from <body> and may be eventually fixed for it. This is
|
||||
* generally not used by non-HTML data processors.
|
||||
* // Tranforming into BBCode data, having a custom BBCode data processor.
|
||||
* var html = '<p>This is <b>an example</b>.</p>';
|
||||
* var data = editor.dataProcessor.toDataFormat( html ); // 'This is [b]an example[/b].'
|
||||
*/
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the "virtual" {@link CKEDITOR.dataProcessor} class, which
|
||||
* defines the basic structure of data processor objects to be
|
||||
* set to {@link CKEDITOR.editor.dataProcessor}.
|
||||
*/
|
||||
|
||||
/**
|
||||
* If defined, points to the data processor which is responsible to translate
|
||||
* and transform the editor data on input and output.
|
||||
* Generaly it will point to an instance of {@link CKEDITOR.htmlDataProcessor},
|
||||
* which handles HTML data. The editor may also handle other data formats by
|
||||
* using different data processors provided by specific plugins.
|
||||
* @name CKEDITOR.editor.prototype.dataProcessor
|
||||
* @type CKEDITOR.dataProcessor
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class is here for documentation purposes only and is not really part of
|
||||
* the API. It serves as the base ("interface") for data processors
|
||||
* implementation.
|
||||
* @name CKEDITOR.dataProcessor
|
||||
* @class Represents a data processor, which is responsible to translate and
|
||||
* transform the editor data on input and output.
|
||||
* @example
|
||||
*/
|
||||
|
||||
/**
|
||||
* Transforms input data into HTML to be loaded in the editor.
|
||||
* While the editor is able to handle non HTML data (like BBCode), at runtime
|
||||
* it can handle HTML data only. The role of the data processor is transforming
|
||||
* the input data into HTML through this function.
|
||||
* @name CKEDITOR.dataProcessor.prototype.toHtml
|
||||
* @function
|
||||
* @param {String} data The input data to be transformed.
|
||||
* @param {String} [fixForBody] The tag name to be used if the data must be
|
||||
* fixed because it is supposed to be loaded direcly into the <body>
|
||||
* tag. This is generally not used by non-HTML data processors.
|
||||
* @example
|
||||
* // Tranforming BBCode data, having a custom BBCode data processor.
|
||||
* var data = 'This is [b]an example[/b].';
|
||||
* var html = editor.dataProcessor.toHtml( data ); // '<p>This is <b>an example</b>.</p>'
|
||||
*/
|
||||
|
||||
/**
|
||||
* Transforms HTML into data to be outputted by the editor, in the format
|
||||
* expected by the data processor.
|
||||
* While the editor is able to handle non HTML data (like BBCode), at runtime
|
||||
* it can handle HTML data only. The role of the data processor is transforming
|
||||
* the HTML data containined by the editor into a specific data format through
|
||||
* this function.
|
||||
* @name CKEDITOR.dataProcessor.prototype.toDataFormat
|
||||
* @function
|
||||
* @param {String} html The HTML to be transformed.
|
||||
* @param {String} fixForBody The tag name to be used if the output data is
|
||||
* coming from <body> and may be eventually fixed for it. This is
|
||||
* generally not used by non-HTML data processors.
|
||||
* // Tranforming into BBCode data, having a custom BBCode data processor.
|
||||
* var html = '<p>This is <b>an example</b>.</p>';
|
||||
* var data = editor.dataProcessor.toDataFormat( html ); // 'This is [b]an example[/b].'
|
||||
*/
|
||||
|
||||
@ -1,20 +1,20 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.dom} object, which contains DOM
|
||||
* manipulation objects and function.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @namespace DOM manipulation objects, classes and functions.
|
||||
* @see CKEDITOR.dom.element
|
||||
* @see CKEDITOR.dom.node
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.dom =
|
||||
{};
|
||||
|
||||
// PACKAGER_RENAME( CKEDITOR.dom )
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.dom} object, which contains DOM
|
||||
* manipulation objects and function.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @namespace DOM manipulation objects, classes and functions.
|
||||
* @see CKEDITOR.dom.element
|
||||
* @see CKEDITOR.dom.node
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.dom =
|
||||
{};
|
||||
|
||||
// PACKAGER_RENAME( CKEDITOR.dom )
|
||||
|
||||
@ -1,44 +1,44 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.dom.comment} class, which represents
|
||||
* a DOM comment node.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a DOM comment node.
|
||||
* @constructor
|
||||
* @augments CKEDITOR.dom.node
|
||||
* @param {Object|String} comment A native DOM comment node or a string containing
|
||||
* the text to use to create a new comment node.
|
||||
* @param {CKEDITOR.dom.document} [ownerDocument] The document that will contain
|
||||
* the node in case of new node creation. Defaults to the current document.
|
||||
* @example
|
||||
* var nativeNode = document.createComment( 'Example' );
|
||||
* var comment = CKEDITOR.dom.comment( nativeNode );
|
||||
* @example
|
||||
* var comment = CKEDITOR.dom.comment( 'Example' );
|
||||
*/
|
||||
CKEDITOR.dom.comment = function( comment, ownerDocument )
|
||||
{
|
||||
if ( typeof comment == 'string' )
|
||||
comment = ( ownerDocument ? ownerDocument.$ : document ).createComment( comment );
|
||||
|
||||
CKEDITOR.dom.domObject.call( this, comment );
|
||||
};
|
||||
|
||||
CKEDITOR.dom.comment.prototype = new CKEDITOR.dom.node();
|
||||
|
||||
CKEDITOR.tools.extend( CKEDITOR.dom.comment.prototype,
|
||||
/** @lends CKEDITOR.dom.comment.prototype */
|
||||
{
|
||||
type : CKEDITOR.NODE_COMMENT,
|
||||
|
||||
getOuterHtml : function()
|
||||
{
|
||||
return '<!--' + this.$.nodeValue + '-->';
|
||||
}
|
||||
});
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.dom.comment} class, which represents
|
||||
* a DOM comment node.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a DOM comment node.
|
||||
* @constructor
|
||||
* @augments CKEDITOR.dom.node
|
||||
* @param {Object|String} comment A native DOM comment node or a string containing
|
||||
* the text to use to create a new comment node.
|
||||
* @param {CKEDITOR.dom.document} [ownerDocument] The document that will contain
|
||||
* the node in case of new node creation. Defaults to the current document.
|
||||
* @example
|
||||
* var nativeNode = document.createComment( 'Example' );
|
||||
* var comment = CKEDITOR.dom.comment( nativeNode );
|
||||
* @example
|
||||
* var comment = CKEDITOR.dom.comment( 'Example' );
|
||||
*/
|
||||
CKEDITOR.dom.comment = function( comment, ownerDocument )
|
||||
{
|
||||
if ( typeof comment == 'string' )
|
||||
comment = ( ownerDocument ? ownerDocument.$ : document ).createComment( comment );
|
||||
|
||||
CKEDITOR.dom.domObject.call( this, comment );
|
||||
};
|
||||
|
||||
CKEDITOR.dom.comment.prototype = new CKEDITOR.dom.node();
|
||||
|
||||
CKEDITOR.tools.extend( CKEDITOR.dom.comment.prototype,
|
||||
/** @lends CKEDITOR.dom.comment.prototype */
|
||||
{
|
||||
type : CKEDITOR.NODE_COMMENT,
|
||||
|
||||
getOuterHtml : function()
|
||||
{
|
||||
return '<!--' + this.$.nodeValue + '-->';
|
||||
}
|
||||
});
|
||||
|
||||
@ -1,251 +1,251 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.dom.document} class, which
|
||||
* represents a DOM document.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a DOM document.
|
||||
* @constructor
|
||||
* @augments CKEDITOR.dom.domObject
|
||||
* @param {Object} domDocument A native DOM document.
|
||||
* @example
|
||||
* var document = new CKEDITOR.dom.document( document );
|
||||
*/
|
||||
CKEDITOR.dom.document = function( domDocument )
|
||||
{
|
||||
CKEDITOR.dom.domObject.call( this, domDocument );
|
||||
};
|
||||
|
||||
// PACKAGER_RENAME( CKEDITOR.dom.document )
|
||||
|
||||
CKEDITOR.dom.document.prototype = new CKEDITOR.dom.domObject();
|
||||
|
||||
CKEDITOR.tools.extend( CKEDITOR.dom.document.prototype,
|
||||
/** @lends CKEDITOR.dom.document.prototype */
|
||||
{
|
||||
/**
|
||||
* Appends a CSS file to the document.
|
||||
* @param {String} cssFileUrl The CSS file URL.
|
||||
* @example
|
||||
* <b>CKEDITOR.document.appendStyleSheet( '/mystyles.css' )</b>;
|
||||
*/
|
||||
appendStyleSheet : function( cssFileUrl )
|
||||
{
|
||||
if ( this.$.createStyleSheet )
|
||||
this.$.createStyleSheet( cssFileUrl );
|
||||
else
|
||||
{
|
||||
var link = new CKEDITOR.dom.element( 'link' );
|
||||
link.setAttributes(
|
||||
{
|
||||
rel :'stylesheet',
|
||||
type : 'text/css',
|
||||
href : cssFileUrl
|
||||
});
|
||||
|
||||
this.getHead().append( link );
|
||||
}
|
||||
},
|
||||
|
||||
appendStyleText : function( cssStyleText )
|
||||
{
|
||||
if ( this.$.createStyleSheet )
|
||||
{
|
||||
var styleSheet = this.$.createStyleSheet( "" );
|
||||
styleSheet.cssText = cssStyleText ;
|
||||
}
|
||||
else
|
||||
{
|
||||
var style = new CKEDITOR.dom.element( 'style', this );
|
||||
style.append( new CKEDITOR.dom.text( cssStyleText, this ) );
|
||||
this.getHead().append( style );
|
||||
}
|
||||
},
|
||||
|
||||
createElement : function( name, attribsAndStyles )
|
||||
{
|
||||
var element = new CKEDITOR.dom.element( name, this );
|
||||
|
||||
if ( attribsAndStyles )
|
||||
{
|
||||
if ( attribsAndStyles.attributes )
|
||||
element.setAttributes( attribsAndStyles.attributes );
|
||||
|
||||
if ( attribsAndStyles.styles )
|
||||
element.setStyles( attribsAndStyles.styles );
|
||||
}
|
||||
|
||||
return element;
|
||||
},
|
||||
|
||||
createText : function( text )
|
||||
{
|
||||
return new CKEDITOR.dom.text( text, this );
|
||||
},
|
||||
|
||||
focus : function()
|
||||
{
|
||||
this.getWindow().focus();
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets and element based on its id.
|
||||
* @param {String} elementId The element id.
|
||||
* @returns {CKEDITOR.dom.element} The element instance, or null if not found.
|
||||
* @example
|
||||
* var element = <b>CKEDITOR.document.getById( 'myElement' )</b>;
|
||||
* alert( element.getId() ); // "myElement"
|
||||
*/
|
||||
getById : function( elementId )
|
||||
{
|
||||
var $ = this.$.getElementById( elementId );
|
||||
return $ ? new CKEDITOR.dom.element( $ ) : null;
|
||||
},
|
||||
|
||||
getByAddress : function( address, normalized )
|
||||
{
|
||||
var $ = this.$.documentElement;
|
||||
|
||||
for ( var i = 0 ; $ && i < address.length ; i++ )
|
||||
{
|
||||
var target = address[ i ];
|
||||
|
||||
if ( !normalized )
|
||||
{
|
||||
$ = $.childNodes[ target ];
|
||||
continue;
|
||||
}
|
||||
|
||||
var currentIndex = -1;
|
||||
|
||||
for (var j = 0 ; j < $.childNodes.length ; j++ )
|
||||
{
|
||||
var candidate = $.childNodes[ j ];
|
||||
|
||||
if ( normalized === true &&
|
||||
candidate.nodeType == 3 &&
|
||||
candidate.previousSibling &&
|
||||
candidate.previousSibling.nodeType == 3 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
currentIndex++;
|
||||
|
||||
if ( currentIndex == target )
|
||||
{
|
||||
$ = candidate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $ ? new CKEDITOR.dom.node( $ ) : null;
|
||||
},
|
||||
|
||||
getElementsByTag : function( tagName, namespace )
|
||||
{
|
||||
if ( !( CKEDITOR.env.ie && ! ( document.documentMode > 8 ) ) && namespace )
|
||||
tagName = namespace + ':' + tagName;
|
||||
return new CKEDITOR.dom.nodeList( this.$.getElementsByTagName( tagName ) );
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the <head> element for this document.
|
||||
* @returns {CKEDITOR.dom.element} The <head> element.
|
||||
* @example
|
||||
* var element = <b>CKEDITOR.document.getHead()</b>;
|
||||
* alert( element.getName() ); // "head"
|
||||
*/
|
||||
getHead : function()
|
||||
{
|
||||
var head = this.$.getElementsByTagName( 'head' )[0];
|
||||
if ( !head )
|
||||
head = this.getDocumentElement().append( new CKEDITOR.dom.element( 'head' ), true );
|
||||
else
|
||||
head = new CKEDITOR.dom.element( head );
|
||||
|
||||
return (
|
||||
this.getHead = function()
|
||||
{
|
||||
return head;
|
||||
})();
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the <body> element for this document.
|
||||
* @returns {CKEDITOR.dom.element} The <body> element.
|
||||
* @example
|
||||
* var element = <b>CKEDITOR.document.getBody()</b>;
|
||||
* alert( element.getName() ); // "body"
|
||||
*/
|
||||
getBody : function()
|
||||
{
|
||||
var body = new CKEDITOR.dom.element( this.$.body );
|
||||
|
||||
return (
|
||||
this.getBody = function()
|
||||
{
|
||||
return body;
|
||||
})();
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the DOM document element for this document.
|
||||
* @returns {CKEDITOR.dom.element} The DOM document element.
|
||||
*/
|
||||
getDocumentElement : function()
|
||||
{
|
||||
var documentElement = new CKEDITOR.dom.element( this.$.documentElement );
|
||||
|
||||
return (
|
||||
this.getDocumentElement = function()
|
||||
{
|
||||
return documentElement;
|
||||
})();
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the window object that holds this document.
|
||||
* @returns {CKEDITOR.dom.window} The window object.
|
||||
*/
|
||||
getWindow : function()
|
||||
{
|
||||
var win = new CKEDITOR.dom.window( this.$.parentWindow || this.$.defaultView );
|
||||
|
||||
return (
|
||||
this.getWindow = function()
|
||||
{
|
||||
return win;
|
||||
})();
|
||||
},
|
||||
|
||||
/**
|
||||
* Defines the document contents through document.write. Note that the
|
||||
* previous document contents will be lost (cleaned).
|
||||
* @since 3.5
|
||||
* @param {String} html The HTML defining the document contents.
|
||||
* @example
|
||||
* document.write(
|
||||
* '<html>' +
|
||||
* '<head><title>Sample Doc</title></head>' +
|
||||
* '<body>Document contents created by code</body>' +
|
||||
* '</html>' );
|
||||
*/
|
||||
write : function( html )
|
||||
{
|
||||
// Don't leave any history log in IE. (#5657)
|
||||
this.$.open( 'text/html', 'replace' );
|
||||
|
||||
// Support for custom document.domain in IE.
|
||||
CKEDITOR.env.isCustomDomain() && ( this.$.domain = document.domain );
|
||||
|
||||
this.$.write( html );
|
||||
this.$.close();
|
||||
}
|
||||
});
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.dom.document} class, which
|
||||
* represents a DOM document.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a DOM document.
|
||||
* @constructor
|
||||
* @augments CKEDITOR.dom.domObject
|
||||
* @param {Object} domDocument A native DOM document.
|
||||
* @example
|
||||
* var document = new CKEDITOR.dom.document( document );
|
||||
*/
|
||||
CKEDITOR.dom.document = function( domDocument )
|
||||
{
|
||||
CKEDITOR.dom.domObject.call( this, domDocument );
|
||||
};
|
||||
|
||||
// PACKAGER_RENAME( CKEDITOR.dom.document )
|
||||
|
||||
CKEDITOR.dom.document.prototype = new CKEDITOR.dom.domObject();
|
||||
|
||||
CKEDITOR.tools.extend( CKEDITOR.dom.document.prototype,
|
||||
/** @lends CKEDITOR.dom.document.prototype */
|
||||
{
|
||||
/**
|
||||
* Appends a CSS file to the document.
|
||||
* @param {String} cssFileUrl The CSS file URL.
|
||||
* @example
|
||||
* <b>CKEDITOR.document.appendStyleSheet( '/mystyles.css' )</b>;
|
||||
*/
|
||||
appendStyleSheet : function( cssFileUrl )
|
||||
{
|
||||
if ( this.$.createStyleSheet )
|
||||
this.$.createStyleSheet( cssFileUrl );
|
||||
else
|
||||
{
|
||||
var link = new CKEDITOR.dom.element( 'link' );
|
||||
link.setAttributes(
|
||||
{
|
||||
rel :'stylesheet',
|
||||
type : 'text/css',
|
||||
href : cssFileUrl
|
||||
});
|
||||
|
||||
this.getHead().append( link );
|
||||
}
|
||||
},
|
||||
|
||||
appendStyleText : function( cssStyleText )
|
||||
{
|
||||
if ( this.$.createStyleSheet )
|
||||
{
|
||||
var styleSheet = this.$.createStyleSheet( "" );
|
||||
styleSheet.cssText = cssStyleText ;
|
||||
}
|
||||
else
|
||||
{
|
||||
var style = new CKEDITOR.dom.element( 'style', this );
|
||||
style.append( new CKEDITOR.dom.text( cssStyleText, this ) );
|
||||
this.getHead().append( style );
|
||||
}
|
||||
},
|
||||
|
||||
createElement : function( name, attribsAndStyles )
|
||||
{
|
||||
var element = new CKEDITOR.dom.element( name, this );
|
||||
|
||||
if ( attribsAndStyles )
|
||||
{
|
||||
if ( attribsAndStyles.attributes )
|
||||
element.setAttributes( attribsAndStyles.attributes );
|
||||
|
||||
if ( attribsAndStyles.styles )
|
||||
element.setStyles( attribsAndStyles.styles );
|
||||
}
|
||||
|
||||
return element;
|
||||
},
|
||||
|
||||
createText : function( text )
|
||||
{
|
||||
return new CKEDITOR.dom.text( text, this );
|
||||
},
|
||||
|
||||
focus : function()
|
||||
{
|
||||
this.getWindow().focus();
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets and element based on its id.
|
||||
* @param {String} elementId The element id.
|
||||
* @returns {CKEDITOR.dom.element} The element instance, or null if not found.
|
||||
* @example
|
||||
* var element = <b>CKEDITOR.document.getById( 'myElement' )</b>;
|
||||
* alert( element.getId() ); // "myElement"
|
||||
*/
|
||||
getById : function( elementId )
|
||||
{
|
||||
var $ = this.$.getElementById( elementId );
|
||||
return $ ? new CKEDITOR.dom.element( $ ) : null;
|
||||
},
|
||||
|
||||
getByAddress : function( address, normalized )
|
||||
{
|
||||
var $ = this.$.documentElement;
|
||||
|
||||
for ( var i = 0 ; $ && i < address.length ; i++ )
|
||||
{
|
||||
var target = address[ i ];
|
||||
|
||||
if ( !normalized )
|
||||
{
|
||||
$ = $.childNodes[ target ];
|
||||
continue;
|
||||
}
|
||||
|
||||
var currentIndex = -1;
|
||||
|
||||
for (var j = 0 ; j < $.childNodes.length ; j++ )
|
||||
{
|
||||
var candidate = $.childNodes[ j ];
|
||||
|
||||
if ( normalized === true &&
|
||||
candidate.nodeType == 3 &&
|
||||
candidate.previousSibling &&
|
||||
candidate.previousSibling.nodeType == 3 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
currentIndex++;
|
||||
|
||||
if ( currentIndex == target )
|
||||
{
|
||||
$ = candidate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $ ? new CKEDITOR.dom.node( $ ) : null;
|
||||
},
|
||||
|
||||
getElementsByTag : function( tagName, namespace )
|
||||
{
|
||||
if ( !( CKEDITOR.env.ie && ! ( document.documentMode > 8 ) ) && namespace )
|
||||
tagName = namespace + ':' + tagName;
|
||||
return new CKEDITOR.dom.nodeList( this.$.getElementsByTagName( tagName ) );
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the <head> element for this document.
|
||||
* @returns {CKEDITOR.dom.element} The <head> element.
|
||||
* @example
|
||||
* var element = <b>CKEDITOR.document.getHead()</b>;
|
||||
* alert( element.getName() ); // "head"
|
||||
*/
|
||||
getHead : function()
|
||||
{
|
||||
var head = this.$.getElementsByTagName( 'head' )[0];
|
||||
if ( !head )
|
||||
head = this.getDocumentElement().append( new CKEDITOR.dom.element( 'head' ), true );
|
||||
else
|
||||
head = new CKEDITOR.dom.element( head );
|
||||
|
||||
return (
|
||||
this.getHead = function()
|
||||
{
|
||||
return head;
|
||||
})();
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the <body> element for this document.
|
||||
* @returns {CKEDITOR.dom.element} The <body> element.
|
||||
* @example
|
||||
* var element = <b>CKEDITOR.document.getBody()</b>;
|
||||
* alert( element.getName() ); // "body"
|
||||
*/
|
||||
getBody : function()
|
||||
{
|
||||
var body = new CKEDITOR.dom.element( this.$.body );
|
||||
|
||||
return (
|
||||
this.getBody = function()
|
||||
{
|
||||
return body;
|
||||
})();
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the DOM document element for this document.
|
||||
* @returns {CKEDITOR.dom.element} The DOM document element.
|
||||
*/
|
||||
getDocumentElement : function()
|
||||
{
|
||||
var documentElement = new CKEDITOR.dom.element( this.$.documentElement );
|
||||
|
||||
return (
|
||||
this.getDocumentElement = function()
|
||||
{
|
||||
return documentElement;
|
||||
})();
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the window object that holds this document.
|
||||
* @returns {CKEDITOR.dom.window} The window object.
|
||||
*/
|
||||
getWindow : function()
|
||||
{
|
||||
var win = new CKEDITOR.dom.window( this.$.parentWindow || this.$.defaultView );
|
||||
|
||||
return (
|
||||
this.getWindow = function()
|
||||
{
|
||||
return win;
|
||||
})();
|
||||
},
|
||||
|
||||
/**
|
||||
* Defines the document contents through document.write. Note that the
|
||||
* previous document contents will be lost (cleaned).
|
||||
* @since 3.5
|
||||
* @param {String} html The HTML defining the document contents.
|
||||
* @example
|
||||
* document.write(
|
||||
* '<html>' +
|
||||
* '<head><title>Sample Doc</title></head>' +
|
||||
* '<body>Document contents created by code</body>' +
|
||||
* '</html>' );
|
||||
*/
|
||||
write : function( html )
|
||||
{
|
||||
// Don't leave any history log in IE. (#5657)
|
||||
this.$.open( 'text/html', 'replace' );
|
||||
|
||||
// Support for custom document.domain in IE.
|
||||
CKEDITOR.env.isCustomDomain() && ( this.$.domain = document.domain );
|
||||
|
||||
this.$.write( html );
|
||||
this.$.close();
|
||||
}
|
||||
});
|
||||
|
||||
@ -1,49 +1,49 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @class DocumentFragment is a "lightweight" or "minimal" Document object. It is
|
||||
* commonly used to extract a portion of a document's tree or to create a new
|
||||
* fragment of a document. Various operations may take DocumentFragment objects
|
||||
* as arguments and results in all the child nodes of the DocumentFragment being
|
||||
* moved to the child list of this node.
|
||||
* @param {Object} ownerDocument
|
||||
*/
|
||||
CKEDITOR.dom.documentFragment = function( ownerDocument )
|
||||
{
|
||||
ownerDocument = ownerDocument || CKEDITOR.document;
|
||||
this.$ = ownerDocument.$.createDocumentFragment();
|
||||
};
|
||||
|
||||
CKEDITOR.tools.extend( CKEDITOR.dom.documentFragment.prototype,
|
||||
CKEDITOR.dom.element.prototype,
|
||||
{
|
||||
type : CKEDITOR.NODE_DOCUMENT_FRAGMENT,
|
||||
insertAfterNode : function( node )
|
||||
{
|
||||
node = node.$;
|
||||
node.parentNode.insertBefore( this.$, node.nextSibling );
|
||||
}
|
||||
},
|
||||
true,
|
||||
{
|
||||
'append' : 1,
|
||||
'appendBogus' : 1,
|
||||
'getFirst' : 1,
|
||||
'getLast' : 1,
|
||||
'appendTo' : 1,
|
||||
'moveChildren' : 1,
|
||||
'insertBefore' : 1,
|
||||
'insertAfterNode' : 1,
|
||||
'replace' : 1,
|
||||
'trim' : 1,
|
||||
'type' : 1,
|
||||
'ltrim' : 1,
|
||||
'rtrim' : 1,
|
||||
'getDocument' : 1,
|
||||
'getChildCount' : 1,
|
||||
'getChild' : 1,
|
||||
'getChildren' : 1
|
||||
} );
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @class DocumentFragment is a "lightweight" or "minimal" Document object. It is
|
||||
* commonly used to extract a portion of a document's tree or to create a new
|
||||
* fragment of a document. Various operations may take DocumentFragment objects
|
||||
* as arguments and results in all the child nodes of the DocumentFragment being
|
||||
* moved to the child list of this node.
|
||||
* @param {Object} ownerDocument
|
||||
*/
|
||||
CKEDITOR.dom.documentFragment = function( ownerDocument )
|
||||
{
|
||||
ownerDocument = ownerDocument || CKEDITOR.document;
|
||||
this.$ = ownerDocument.$.createDocumentFragment();
|
||||
};
|
||||
|
||||
CKEDITOR.tools.extend( CKEDITOR.dom.documentFragment.prototype,
|
||||
CKEDITOR.dom.element.prototype,
|
||||
{
|
||||
type : CKEDITOR.NODE_DOCUMENT_FRAGMENT,
|
||||
insertAfterNode : function( node )
|
||||
{
|
||||
node = node.$;
|
||||
node.parentNode.insertBefore( this.$, node.nextSibling );
|
||||
}
|
||||
},
|
||||
true,
|
||||
{
|
||||
'append' : 1,
|
||||
'appendBogus' : 1,
|
||||
'getFirst' : 1,
|
||||
'getLast' : 1,
|
||||
'appendTo' : 1,
|
||||
'moveChildren' : 1,
|
||||
'insertBefore' : 1,
|
||||
'insertAfterNode' : 1,
|
||||
'replace' : 1,
|
||||
'trim' : 1,
|
||||
'type' : 1,
|
||||
'ltrim' : 1,
|
||||
'rtrim' : 1,
|
||||
'getDocument' : 1,
|
||||
'getChildCount' : 1,
|
||||
'getChild' : 1,
|
||||
'getChildren' : 1
|
||||
} );
|
||||
|
||||
@ -1,258 +1,258 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.editor} class, which is the base
|
||||
* for other classes representing DOM objects.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a DOM object. This class is not intended to be used directly. It
|
||||
* serves as the base class for other classes representing specific DOM
|
||||
* objects.
|
||||
* @constructor
|
||||
* @param {Object} nativeDomObject A native DOM object.
|
||||
* @augments CKEDITOR.event
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.dom.domObject = function( nativeDomObject )
|
||||
{
|
||||
if ( nativeDomObject )
|
||||
{
|
||||
/**
|
||||
* The native DOM object represented by this class instance.
|
||||
* @type Object
|
||||
* @example
|
||||
* var element = new CKEDITOR.dom.element( 'span' );
|
||||
* alert( element.$.nodeType ); // "1"
|
||||
*/
|
||||
this.$ = nativeDomObject;
|
||||
}
|
||||
};
|
||||
|
||||
CKEDITOR.dom.domObject.prototype = (function()
|
||||
{
|
||||
// Do not define other local variables here. We want to keep the native
|
||||
// listener closures as clean as possible.
|
||||
|
||||
var getNativeListener = function( domObject, eventName )
|
||||
{
|
||||
return function( domEvent )
|
||||
{
|
||||
// In FF, when reloading the page with the editor focused, it may
|
||||
// throw an error because the CKEDITOR global is not anymore
|
||||
// available. So, we check it here first. (#2923)
|
||||
if ( typeof CKEDITOR != 'undefined' )
|
||||
domObject.fire( eventName, new CKEDITOR.dom.event( domEvent ) );
|
||||
};
|
||||
};
|
||||
|
||||
return /** @lends CKEDITOR.dom.domObject.prototype */ {
|
||||
|
||||
getPrivate : function()
|
||||
{
|
||||
var priv;
|
||||
|
||||
// Get the main private function from the custom data. Create it if not
|
||||
// defined.
|
||||
if ( !( priv = this.getCustomData( '_' ) ) )
|
||||
this.setCustomData( '_', ( priv = {} ) );
|
||||
|
||||
return priv;
|
||||
},
|
||||
|
||||
/** @ignore */
|
||||
on : function( eventName )
|
||||
{
|
||||
// We customize the "on" function here. The basic idea is that we'll have
|
||||
// only one listener for a native event, which will then call all listeners
|
||||
// set to the event.
|
||||
|
||||
// Get the listeners holder object.
|
||||
var nativeListeners = this.getCustomData( '_cke_nativeListeners' );
|
||||
|
||||
if ( !nativeListeners )
|
||||
{
|
||||
nativeListeners = {};
|
||||
this.setCustomData( '_cke_nativeListeners', nativeListeners );
|
||||
}
|
||||
|
||||
// Check if we have a listener for that event.
|
||||
if ( !nativeListeners[ eventName ] )
|
||||
{
|
||||
var listener = nativeListeners[ eventName ] = getNativeListener( this, eventName );
|
||||
|
||||
if ( this.$.addEventListener )
|
||||
this.$.addEventListener( eventName, listener, !!CKEDITOR.event.useCapture );
|
||||
else if ( this.$.attachEvent )
|
||||
this.$.attachEvent( 'on' + eventName, listener );
|
||||
}
|
||||
|
||||
// Call the original implementation.
|
||||
return CKEDITOR.event.prototype.on.apply( this, arguments );
|
||||
},
|
||||
|
||||
/** @ignore */
|
||||
removeListener : function( eventName )
|
||||
{
|
||||
// Call the original implementation.
|
||||
CKEDITOR.event.prototype.removeListener.apply( this, arguments );
|
||||
|
||||
// If we don't have listeners for this event, clean the DOM up.
|
||||
if ( !this.hasListeners( eventName ) )
|
||||
{
|
||||
var nativeListeners = this.getCustomData( '_cke_nativeListeners' );
|
||||
var listener = nativeListeners && nativeListeners[ eventName ];
|
||||
if ( listener )
|
||||
{
|
||||
if ( this.$.removeEventListener )
|
||||
this.$.removeEventListener( eventName, listener, false );
|
||||
else if ( this.$.detachEvent )
|
||||
this.$.detachEvent( 'on' + eventName, listener );
|
||||
|
||||
delete nativeListeners[ eventName ];
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes any listener set on this object.
|
||||
* To avoid memory leaks we must assure that there are no
|
||||
* references left after the object is no longer needed.
|
||||
*/
|
||||
removeAllListeners : function()
|
||||
{
|
||||
var nativeListeners = this.getCustomData( '_cke_nativeListeners' );
|
||||
for ( var eventName in nativeListeners )
|
||||
{
|
||||
var listener = nativeListeners[ eventName ];
|
||||
if ( this.$.detachEvent )
|
||||
this.$.detachEvent( 'on' + eventName, listener );
|
||||
else if ( this.$.removeEventListener )
|
||||
this.$.removeEventListener( eventName, listener, false );
|
||||
|
||||
delete nativeListeners[ eventName ];
|
||||
}
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(function( domObjectProto )
|
||||
{
|
||||
var customData = {};
|
||||
|
||||
CKEDITOR.on( 'reset', function()
|
||||
{
|
||||
customData = {};
|
||||
});
|
||||
|
||||
/**
|
||||
* Determines whether the specified object is equal to the current object.
|
||||
* @name CKEDITOR.dom.domObject.prototype.equals
|
||||
* @function
|
||||
* @param {Object} object The object to compare with the current object.
|
||||
* @returns {Boolean} "true" if the object is equal.
|
||||
* @example
|
||||
* var doc = new CKEDITOR.dom.document( document );
|
||||
* alert( doc.equals( CKEDITOR.document ) ); // "true"
|
||||
* alert( doc == CKEDITOR.document ); // "false"
|
||||
*/
|
||||
domObjectProto.equals = function( object )
|
||||
{
|
||||
return ( object && object.$ === this.$ );
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets a data slot value for this object. These values are shared by all
|
||||
* instances pointing to that same DOM object.
|
||||
* <strong>Note:</strong> The created data slot is only guarantied to be available on this unique dom node,
|
||||
* thus any wish to continue access it from other element clones (either created by clone node or from innerHtml)
|
||||
* will fail, for such usage, please use {@link CKEDITOR.dom.element::setAttribute} instead.
|
||||
* @name CKEDITOR.dom.domObject.prototype.setCustomData
|
||||
* @function
|
||||
* @param {String} key A key used to identify the data slot.
|
||||
* @param {Object} value The value to set to the data slot.
|
||||
* @returns {CKEDITOR.dom.domObject} This DOM object instance.
|
||||
* @see CKEDITOR.dom.domObject.prototype.getCustomData
|
||||
* @example
|
||||
* var element = new CKEDITOR.dom.element( 'span' );
|
||||
* element.setCustomData( 'hasCustomData', true );
|
||||
*/
|
||||
domObjectProto.setCustomData = function( key, value )
|
||||
{
|
||||
var expandoNumber = this.getUniqueId(),
|
||||
dataSlot = customData[ expandoNumber ] || ( customData[ expandoNumber ] = {} );
|
||||
|
||||
dataSlot[ key ] = value;
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the value set to a data slot in this object.
|
||||
* @name CKEDITOR.dom.domObject.prototype.getCustomData
|
||||
* @function
|
||||
* @param {String} key The key used to identify the data slot.
|
||||
* @returns {Object} This value set to the data slot.
|
||||
* @see CKEDITOR.dom.domObject.prototype.setCustomData
|
||||
* @example
|
||||
* var element = new CKEDITOR.dom.element( 'span' );
|
||||
* alert( element.getCustomData( 'hasCustomData' ) ); // e.g. 'true'
|
||||
*/
|
||||
domObjectProto.getCustomData = function( key )
|
||||
{
|
||||
var expandoNumber = this.$[ 'data-cke-expando' ],
|
||||
dataSlot = expandoNumber && customData[ expandoNumber ];
|
||||
|
||||
return dataSlot && dataSlot[ key ];
|
||||
};
|
||||
|
||||
/**
|
||||
* @name CKEDITOR.dom.domObject.prototype.removeCustomData
|
||||
*/
|
||||
domObjectProto.removeCustomData = function( key )
|
||||
{
|
||||
var expandoNumber = this.$[ 'data-cke-expando' ],
|
||||
dataSlot = expandoNumber && customData[ expandoNumber ],
|
||||
retval = dataSlot && dataSlot[ key ];
|
||||
|
||||
if ( typeof retval != 'undefined' )
|
||||
delete dataSlot[ key ];
|
||||
|
||||
return retval || null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes any data stored on this object.
|
||||
* To avoid memory leaks we must assure that there are no
|
||||
* references left after the object is no longer needed.
|
||||
* @name CKEDITOR.dom.domObject.prototype.clearCustomData
|
||||
* @function
|
||||
*/
|
||||
domObjectProto.clearCustomData = function()
|
||||
{
|
||||
// Clear all event listeners
|
||||
this.removeAllListeners();
|
||||
|
||||
var expandoNumber = this.$[ 'data-cke-expando' ];
|
||||
expandoNumber && delete customData[ expandoNumber ];
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets an ID that can be used to identiquely identify this DOM object in
|
||||
* the running session.
|
||||
* @name CKEDITOR.dom.domObject.prototype.getUniqueId
|
||||
* @function
|
||||
* @returns {Number} A unique ID.
|
||||
*/
|
||||
domObjectProto.getUniqueId = function()
|
||||
{
|
||||
return this.$[ 'data-cke-expando' ] || ( this.$[ 'data-cke-expando' ] = CKEDITOR.tools.getNextNumber() );
|
||||
};
|
||||
|
||||
// Implement CKEDITOR.event.
|
||||
CKEDITOR.event.implementOn( domObjectProto );
|
||||
|
||||
})( CKEDITOR.dom.domObject.prototype );
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.editor} class, which is the base
|
||||
* for other classes representing DOM objects.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a DOM object. This class is not intended to be used directly. It
|
||||
* serves as the base class for other classes representing specific DOM
|
||||
* objects.
|
||||
* @constructor
|
||||
* @param {Object} nativeDomObject A native DOM object.
|
||||
* @augments CKEDITOR.event
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.dom.domObject = function( nativeDomObject )
|
||||
{
|
||||
if ( nativeDomObject )
|
||||
{
|
||||
/**
|
||||
* The native DOM object represented by this class instance.
|
||||
* @type Object
|
||||
* @example
|
||||
* var element = new CKEDITOR.dom.element( 'span' );
|
||||
* alert( element.$.nodeType ); // "1"
|
||||
*/
|
||||
this.$ = nativeDomObject;
|
||||
}
|
||||
};
|
||||
|
||||
CKEDITOR.dom.domObject.prototype = (function()
|
||||
{
|
||||
// Do not define other local variables here. We want to keep the native
|
||||
// listener closures as clean as possible.
|
||||
|
||||
var getNativeListener = function( domObject, eventName )
|
||||
{
|
||||
return function( domEvent )
|
||||
{
|
||||
// In FF, when reloading the page with the editor focused, it may
|
||||
// throw an error because the CKEDITOR global is not anymore
|
||||
// available. So, we check it here first. (#2923)
|
||||
if ( typeof CKEDITOR != 'undefined' )
|
||||
domObject.fire( eventName, new CKEDITOR.dom.event( domEvent ) );
|
||||
};
|
||||
};
|
||||
|
||||
return /** @lends CKEDITOR.dom.domObject.prototype */ {
|
||||
|
||||
getPrivate : function()
|
||||
{
|
||||
var priv;
|
||||
|
||||
// Get the main private function from the custom data. Create it if not
|
||||
// defined.
|
||||
if ( !( priv = this.getCustomData( '_' ) ) )
|
||||
this.setCustomData( '_', ( priv = {} ) );
|
||||
|
||||
return priv;
|
||||
},
|
||||
|
||||
/** @ignore */
|
||||
on : function( eventName )
|
||||
{
|
||||
// We customize the "on" function here. The basic idea is that we'll have
|
||||
// only one listener for a native event, which will then call all listeners
|
||||
// set to the event.
|
||||
|
||||
// Get the listeners holder object.
|
||||
var nativeListeners = this.getCustomData( '_cke_nativeListeners' );
|
||||
|
||||
if ( !nativeListeners )
|
||||
{
|
||||
nativeListeners = {};
|
||||
this.setCustomData( '_cke_nativeListeners', nativeListeners );
|
||||
}
|
||||
|
||||
// Check if we have a listener for that event.
|
||||
if ( !nativeListeners[ eventName ] )
|
||||
{
|
||||
var listener = nativeListeners[ eventName ] = getNativeListener( this, eventName );
|
||||
|
||||
if ( this.$.addEventListener )
|
||||
this.$.addEventListener( eventName, listener, !!CKEDITOR.event.useCapture );
|
||||
else if ( this.$.attachEvent )
|
||||
this.$.attachEvent( 'on' + eventName, listener );
|
||||
}
|
||||
|
||||
// Call the original implementation.
|
||||
return CKEDITOR.event.prototype.on.apply( this, arguments );
|
||||
},
|
||||
|
||||
/** @ignore */
|
||||
removeListener : function( eventName )
|
||||
{
|
||||
// Call the original implementation.
|
||||
CKEDITOR.event.prototype.removeListener.apply( this, arguments );
|
||||
|
||||
// If we don't have listeners for this event, clean the DOM up.
|
||||
if ( !this.hasListeners( eventName ) )
|
||||
{
|
||||
var nativeListeners = this.getCustomData( '_cke_nativeListeners' );
|
||||
var listener = nativeListeners && nativeListeners[ eventName ];
|
||||
if ( listener )
|
||||
{
|
||||
if ( this.$.removeEventListener )
|
||||
this.$.removeEventListener( eventName, listener, false );
|
||||
else if ( this.$.detachEvent )
|
||||
this.$.detachEvent( 'on' + eventName, listener );
|
||||
|
||||
delete nativeListeners[ eventName ];
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes any listener set on this object.
|
||||
* To avoid memory leaks we must assure that there are no
|
||||
* references left after the object is no longer needed.
|
||||
*/
|
||||
removeAllListeners : function()
|
||||
{
|
||||
var nativeListeners = this.getCustomData( '_cke_nativeListeners' );
|
||||
for ( var eventName in nativeListeners )
|
||||
{
|
||||
var listener = nativeListeners[ eventName ];
|
||||
if ( this.$.detachEvent )
|
||||
this.$.detachEvent( 'on' + eventName, listener );
|
||||
else if ( this.$.removeEventListener )
|
||||
this.$.removeEventListener( eventName, listener, false );
|
||||
|
||||
delete nativeListeners[ eventName ];
|
||||
}
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(function( domObjectProto )
|
||||
{
|
||||
var customData = {};
|
||||
|
||||
CKEDITOR.on( 'reset', function()
|
||||
{
|
||||
customData = {};
|
||||
});
|
||||
|
||||
/**
|
||||
* Determines whether the specified object is equal to the current object.
|
||||
* @name CKEDITOR.dom.domObject.prototype.equals
|
||||
* @function
|
||||
* @param {Object} object The object to compare with the current object.
|
||||
* @returns {Boolean} "true" if the object is equal.
|
||||
* @example
|
||||
* var doc = new CKEDITOR.dom.document( document );
|
||||
* alert( doc.equals( CKEDITOR.document ) ); // "true"
|
||||
* alert( doc == CKEDITOR.document ); // "false"
|
||||
*/
|
||||
domObjectProto.equals = function( object )
|
||||
{
|
||||
return ( object && object.$ === this.$ );
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets a data slot value for this object. These values are shared by all
|
||||
* instances pointing to that same DOM object.
|
||||
* <strong>Note:</strong> The created data slot is only guarantied to be available on this unique dom node,
|
||||
* thus any wish to continue access it from other element clones (either created by clone node or from innerHtml)
|
||||
* will fail, for such usage, please use {@link CKEDITOR.dom.element::setAttribute} instead.
|
||||
* @name CKEDITOR.dom.domObject.prototype.setCustomData
|
||||
* @function
|
||||
* @param {String} key A key used to identify the data slot.
|
||||
* @param {Object} value The value to set to the data slot.
|
||||
* @returns {CKEDITOR.dom.domObject} This DOM object instance.
|
||||
* @see CKEDITOR.dom.domObject.prototype.getCustomData
|
||||
* @example
|
||||
* var element = new CKEDITOR.dom.element( 'span' );
|
||||
* element.setCustomData( 'hasCustomData', true );
|
||||
*/
|
||||
domObjectProto.setCustomData = function( key, value )
|
||||
{
|
||||
var expandoNumber = this.getUniqueId(),
|
||||
dataSlot = customData[ expandoNumber ] || ( customData[ expandoNumber ] = {} );
|
||||
|
||||
dataSlot[ key ] = value;
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the value set to a data slot in this object.
|
||||
* @name CKEDITOR.dom.domObject.prototype.getCustomData
|
||||
* @function
|
||||
* @param {String} key The key used to identify the data slot.
|
||||
* @returns {Object} This value set to the data slot.
|
||||
* @see CKEDITOR.dom.domObject.prototype.setCustomData
|
||||
* @example
|
||||
* var element = new CKEDITOR.dom.element( 'span' );
|
||||
* alert( element.getCustomData( 'hasCustomData' ) ); // e.g. 'true'
|
||||
*/
|
||||
domObjectProto.getCustomData = function( key )
|
||||
{
|
||||
var expandoNumber = this.$[ 'data-cke-expando' ],
|
||||
dataSlot = expandoNumber && customData[ expandoNumber ];
|
||||
|
||||
return dataSlot && dataSlot[ key ];
|
||||
};
|
||||
|
||||
/**
|
||||
* @name CKEDITOR.dom.domObject.prototype.removeCustomData
|
||||
*/
|
||||
domObjectProto.removeCustomData = function( key )
|
||||
{
|
||||
var expandoNumber = this.$[ 'data-cke-expando' ],
|
||||
dataSlot = expandoNumber && customData[ expandoNumber ],
|
||||
retval = dataSlot && dataSlot[ key ];
|
||||
|
||||
if ( typeof retval != 'undefined' )
|
||||
delete dataSlot[ key ];
|
||||
|
||||
return retval || null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes any data stored on this object.
|
||||
* To avoid memory leaks we must assure that there are no
|
||||
* references left after the object is no longer needed.
|
||||
* @name CKEDITOR.dom.domObject.prototype.clearCustomData
|
||||
* @function
|
||||
*/
|
||||
domObjectProto.clearCustomData = function()
|
||||
{
|
||||
// Clear all event listeners
|
||||
this.removeAllListeners();
|
||||
|
||||
var expandoNumber = this.$[ 'data-cke-expando' ];
|
||||
expandoNumber && delete customData[ expandoNumber ];
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets an ID that can be used to identiquely identify this DOM object in
|
||||
* the running session.
|
||||
* @name CKEDITOR.dom.domObject.prototype.getUniqueId
|
||||
* @function
|
||||
* @returns {Number} A unique ID.
|
||||
*/
|
||||
domObjectProto.getUniqueId = function()
|
||||
{
|
||||
return this.$[ 'data-cke-expando' ] || ( this.$[ 'data-cke-expando' ] = CKEDITOR.tools.getNextNumber() );
|
||||
};
|
||||
|
||||
// Implement CKEDITOR.event.
|
||||
CKEDITOR.event.implementOn( domObjectProto );
|
||||
|
||||
})( CKEDITOR.dom.domObject.prototype );
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,117 +1,117 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
// Elements that may be considered the "Block boundary" in an element path.
|
||||
var pathBlockElements = { address:1,blockquote:1,dl:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1,li:1,dt:1,dd:1, legend:1,caption:1 };
|
||||
|
||||
// Elements that may be considered the "Block limit" in an element path.
|
||||
var pathBlockLimitElements = { body:1,div:1,table:1,tbody:1,tr:1,td:1,th:1,form:1,fieldset:1 };
|
||||
|
||||
// Check if an element contains any block element.
|
||||
var checkHasBlock = function( element )
|
||||
{
|
||||
var childNodes = element.getChildren();
|
||||
|
||||
for ( var i = 0, count = childNodes.count() ; i < count ; i++ )
|
||||
{
|
||||
var child = childNodes.getItem( i );
|
||||
|
||||
if ( child.type == CKEDITOR.NODE_ELEMENT && CKEDITOR.dtd.$block[ child.getName() ] )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* @class
|
||||
*/
|
||||
CKEDITOR.dom.elementPath = function( lastNode )
|
||||
{
|
||||
var block = null;
|
||||
var blockLimit = null;
|
||||
var elements = [];
|
||||
|
||||
var e = lastNode;
|
||||
|
||||
while ( e )
|
||||
{
|
||||
if ( e.type == CKEDITOR.NODE_ELEMENT )
|
||||
{
|
||||
if ( !this.lastElement )
|
||||
this.lastElement = e;
|
||||
|
||||
var elementName = e.getName();
|
||||
|
||||
if ( !blockLimit )
|
||||
{
|
||||
if ( !block && pathBlockElements[ elementName ] )
|
||||
block = e;
|
||||
|
||||
if ( pathBlockLimitElements[ elementName ] )
|
||||
{
|
||||
// DIV is considered the Block, if no block is available (#525)
|
||||
// and if it doesn't contain other blocks.
|
||||
if ( !block && elementName == 'div' && !checkHasBlock( e ) )
|
||||
block = e;
|
||||
else
|
||||
blockLimit = e;
|
||||
}
|
||||
}
|
||||
|
||||
elements.push( e );
|
||||
|
||||
if ( elementName == 'body' )
|
||||
break;
|
||||
}
|
||||
e = e.getParent();
|
||||
}
|
||||
|
||||
this.block = block;
|
||||
this.blockLimit = blockLimit;
|
||||
this.elements = elements;
|
||||
};
|
||||
})();
|
||||
|
||||
CKEDITOR.dom.elementPath.prototype =
|
||||
{
|
||||
/**
|
||||
* Compares this element path with another one.
|
||||
* @param {CKEDITOR.dom.elementPath} otherPath The elementPath object to be
|
||||
* compared with this one.
|
||||
* @returns {Boolean} "true" if the paths are equal, containing the same
|
||||
* number of elements and the same elements in the same order.
|
||||
*/
|
||||
compare : function( otherPath )
|
||||
{
|
||||
var thisElements = this.elements;
|
||||
var otherElements = otherPath && otherPath.elements;
|
||||
|
||||
if ( !otherElements || thisElements.length != otherElements.length )
|
||||
return false;
|
||||
|
||||
for ( var i = 0 ; i < thisElements.length ; i++ )
|
||||
{
|
||||
if ( !thisElements[ i ].equals( otherElements[ i ] ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
contains : function( tagNames )
|
||||
{
|
||||
var elements = this.elements;
|
||||
for ( var i = 0 ; i < elements.length ; i++ )
|
||||
{
|
||||
if ( elements[ i ].getName() in tagNames )
|
||||
return elements[ i ];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
// Elements that may be considered the "Block boundary" in an element path.
|
||||
var pathBlockElements = { address:1,blockquote:1,dl:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1,li:1,dt:1,dd:1, legend:1,caption:1 };
|
||||
|
||||
// Elements that may be considered the "Block limit" in an element path.
|
||||
var pathBlockLimitElements = { body:1,div:1,table:1,tbody:1,tr:1,td:1,th:1,form:1,fieldset:1 };
|
||||
|
||||
// Check if an element contains any block element.
|
||||
var checkHasBlock = function( element )
|
||||
{
|
||||
var childNodes = element.getChildren();
|
||||
|
||||
for ( var i = 0, count = childNodes.count() ; i < count ; i++ )
|
||||
{
|
||||
var child = childNodes.getItem( i );
|
||||
|
||||
if ( child.type == CKEDITOR.NODE_ELEMENT && CKEDITOR.dtd.$block[ child.getName() ] )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* @class
|
||||
*/
|
||||
CKEDITOR.dom.elementPath = function( lastNode )
|
||||
{
|
||||
var block = null;
|
||||
var blockLimit = null;
|
||||
var elements = [];
|
||||
|
||||
var e = lastNode;
|
||||
|
||||
while ( e )
|
||||
{
|
||||
if ( e.type == CKEDITOR.NODE_ELEMENT )
|
||||
{
|
||||
if ( !this.lastElement )
|
||||
this.lastElement = e;
|
||||
|
||||
var elementName = e.getName();
|
||||
|
||||
if ( !blockLimit )
|
||||
{
|
||||
if ( !block && pathBlockElements[ elementName ] )
|
||||
block = e;
|
||||
|
||||
if ( pathBlockLimitElements[ elementName ] )
|
||||
{
|
||||
// DIV is considered the Block, if no block is available (#525)
|
||||
// and if it doesn't contain other blocks.
|
||||
if ( !block && elementName == 'div' && !checkHasBlock( e ) )
|
||||
block = e;
|
||||
else
|
||||
blockLimit = e;
|
||||
}
|
||||
}
|
||||
|
||||
elements.push( e );
|
||||
|
||||
if ( elementName == 'body' )
|
||||
break;
|
||||
}
|
||||
e = e.getParent();
|
||||
}
|
||||
|
||||
this.block = block;
|
||||
this.blockLimit = blockLimit;
|
||||
this.elements = elements;
|
||||
};
|
||||
})();
|
||||
|
||||
CKEDITOR.dom.elementPath.prototype =
|
||||
{
|
||||
/**
|
||||
* Compares this element path with another one.
|
||||
* @param {CKEDITOR.dom.elementPath} otherPath The elementPath object to be
|
||||
* compared with this one.
|
||||
* @returns {Boolean} "true" if the paths are equal, containing the same
|
||||
* number of elements and the same elements in the same order.
|
||||
*/
|
||||
compare : function( otherPath )
|
||||
{
|
||||
var thisElements = this.elements;
|
||||
var otherElements = otherPath && otherPath.elements;
|
||||
|
||||
if ( !otherElements || thisElements.length != otherElements.length )
|
||||
return false;
|
||||
|
||||
for ( var i = 0 ; i < thisElements.length ; i++ )
|
||||
{
|
||||
if ( !thisElements[ i ].equals( otherElements[ i ] ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
contains : function( tagNames )
|
||||
{
|
||||
var elements = this.elements;
|
||||
for ( var i = 0 ; i < elements.length ; i++ )
|
||||
{
|
||||
if ( elements[ i ].getName() in tagNames )
|
||||
return elements[ i ];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
@ -1,145 +1,145 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.dom.event} class, which
|
||||
* represents the a native DOM event object.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a native DOM event object.
|
||||
* @constructor
|
||||
* @param {Object} domEvent A native DOM event object.
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.dom.event = function( domEvent )
|
||||
{
|
||||
/**
|
||||
* The native DOM event object represented by this class instance.
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
this.$ = domEvent;
|
||||
};
|
||||
|
||||
CKEDITOR.dom.event.prototype =
|
||||
{
|
||||
/**
|
||||
* Gets the key code associated to the event.
|
||||
* @returns {Number} The key code.
|
||||
* @example
|
||||
* alert( event.getKey() ); "65" is "a" has been pressed
|
||||
*/
|
||||
getKey : function()
|
||||
{
|
||||
return this.$.keyCode || this.$.which;
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets a number represeting the combination of the keys pressed during the
|
||||
* event. It is the sum with the current key code and the {@link CKEDITOR.CTRL},
|
||||
* {@link CKEDITOR.SHIFT} and {@link CKEDITOR.ALT} constants.
|
||||
* @returns {Number} The number representing the keys combination.
|
||||
* @example
|
||||
* alert( event.getKeystroke() == 65 ); // "a" key
|
||||
* alert( event.getKeystroke() == CKEDITOR.CTRL + 65 ); // CTRL + "a" key
|
||||
* alert( event.getKeystroke() == CKEDITOR.CTRL + CKEDITOR.SHIFT + 65 ); // CTRL + SHIFT + "a" key
|
||||
*/
|
||||
getKeystroke : function()
|
||||
{
|
||||
var keystroke = this.getKey();
|
||||
|
||||
if ( this.$.ctrlKey || this.$.metaKey )
|
||||
keystroke += CKEDITOR.CTRL;
|
||||
|
||||
if ( this.$.shiftKey )
|
||||
keystroke += CKEDITOR.SHIFT;
|
||||
|
||||
if ( this.$.altKey )
|
||||
keystroke += CKEDITOR.ALT;
|
||||
|
||||
return keystroke;
|
||||
},
|
||||
|
||||
/**
|
||||
* Prevents the original behavior of the event to happen. It can optionally
|
||||
* stop propagating the event in the event chain.
|
||||
* @param {Boolean} [stopPropagation] Stop propagating this event in the
|
||||
* event chain.
|
||||
* @example
|
||||
* var element = CKEDITOR.document.getById( 'myElement' );
|
||||
* element.on( 'click', function( ev )
|
||||
* {
|
||||
* // The DOM event object is passed by the "data" property.
|
||||
* var domEvent = ev.data;
|
||||
* // Prevent the click to chave any effect in the element.
|
||||
* domEvent.preventDefault();
|
||||
* });
|
||||
*/
|
||||
preventDefault : function( stopPropagation )
|
||||
{
|
||||
var $ = this.$;
|
||||
if ( $.preventDefault )
|
||||
$.preventDefault();
|
||||
else
|
||||
$.returnValue = false;
|
||||
|
||||
if ( stopPropagation )
|
||||
this.stopPropagation();
|
||||
},
|
||||
|
||||
stopPropagation : function()
|
||||
{
|
||||
var $ = this.$;
|
||||
if ( $.stopPropagation )
|
||||
$.stopPropagation();
|
||||
else
|
||||
$.cancelBubble = true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the DOM node where the event was targeted to.
|
||||
* @returns {CKEDITOR.dom.node} The target DOM node.
|
||||
* @example
|
||||
* var element = CKEDITOR.document.getById( 'myElement' );
|
||||
* element.on( 'click', function( ev )
|
||||
* {
|
||||
* // The DOM event object is passed by the "data" property.
|
||||
* var domEvent = ev.data;
|
||||
* // Add a CSS class to the event target.
|
||||
* domEvent.getTarget().addClass( 'clicked' );
|
||||
* });
|
||||
*/
|
||||
|
||||
getTarget : function()
|
||||
{
|
||||
var rawNode = this.$.target || this.$.srcElement;
|
||||
return rawNode ? new CKEDITOR.dom.node( rawNode ) : null;
|
||||
}
|
||||
};
|
||||
|
||||
// For the followind constants, we need to go over the Unicode boundaries
|
||||
// (0x10FFFF) to avoid collision.
|
||||
|
||||
/**
|
||||
* CTRL key (0x110000).
|
||||
* @constant
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.CTRL = 0x110000;
|
||||
|
||||
/**
|
||||
* SHIFT key (0x220000).
|
||||
* @constant
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.SHIFT = 0x220000;
|
||||
|
||||
/**
|
||||
* ALT key (0x440000).
|
||||
* @constant
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.ALT = 0x440000;
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.dom.event} class, which
|
||||
* represents the a native DOM event object.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a native DOM event object.
|
||||
* @constructor
|
||||
* @param {Object} domEvent A native DOM event object.
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.dom.event = function( domEvent )
|
||||
{
|
||||
/**
|
||||
* The native DOM event object represented by this class instance.
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
this.$ = domEvent;
|
||||
};
|
||||
|
||||
CKEDITOR.dom.event.prototype =
|
||||
{
|
||||
/**
|
||||
* Gets the key code associated to the event.
|
||||
* @returns {Number} The key code.
|
||||
* @example
|
||||
* alert( event.getKey() ); "65" is "a" has been pressed
|
||||
*/
|
||||
getKey : function()
|
||||
{
|
||||
return this.$.keyCode || this.$.which;
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets a number represeting the combination of the keys pressed during the
|
||||
* event. It is the sum with the current key code and the {@link CKEDITOR.CTRL},
|
||||
* {@link CKEDITOR.SHIFT} and {@link CKEDITOR.ALT} constants.
|
||||
* @returns {Number} The number representing the keys combination.
|
||||
* @example
|
||||
* alert( event.getKeystroke() == 65 ); // "a" key
|
||||
* alert( event.getKeystroke() == CKEDITOR.CTRL + 65 ); // CTRL + "a" key
|
||||
* alert( event.getKeystroke() == CKEDITOR.CTRL + CKEDITOR.SHIFT + 65 ); // CTRL + SHIFT + "a" key
|
||||
*/
|
||||
getKeystroke : function()
|
||||
{
|
||||
var keystroke = this.getKey();
|
||||
|
||||
if ( this.$.ctrlKey || this.$.metaKey )
|
||||
keystroke += CKEDITOR.CTRL;
|
||||
|
||||
if ( this.$.shiftKey )
|
||||
keystroke += CKEDITOR.SHIFT;
|
||||
|
||||
if ( this.$.altKey )
|
||||
keystroke += CKEDITOR.ALT;
|
||||
|
||||
return keystroke;
|
||||
},
|
||||
|
||||
/**
|
||||
* Prevents the original behavior of the event to happen. It can optionally
|
||||
* stop propagating the event in the event chain.
|
||||
* @param {Boolean} [stopPropagation] Stop propagating this event in the
|
||||
* event chain.
|
||||
* @example
|
||||
* var element = CKEDITOR.document.getById( 'myElement' );
|
||||
* element.on( 'click', function( ev )
|
||||
* {
|
||||
* // The DOM event object is passed by the "data" property.
|
||||
* var domEvent = ev.data;
|
||||
* // Prevent the click to chave any effect in the element.
|
||||
* domEvent.preventDefault();
|
||||
* });
|
||||
*/
|
||||
preventDefault : function( stopPropagation )
|
||||
{
|
||||
var $ = this.$;
|
||||
if ( $.preventDefault )
|
||||
$.preventDefault();
|
||||
else
|
||||
$.returnValue = false;
|
||||
|
||||
if ( stopPropagation )
|
||||
this.stopPropagation();
|
||||
},
|
||||
|
||||
stopPropagation : function()
|
||||
{
|
||||
var $ = this.$;
|
||||
if ( $.stopPropagation )
|
||||
$.stopPropagation();
|
||||
else
|
||||
$.cancelBubble = true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the DOM node where the event was targeted to.
|
||||
* @returns {CKEDITOR.dom.node} The target DOM node.
|
||||
* @example
|
||||
* var element = CKEDITOR.document.getById( 'myElement' );
|
||||
* element.on( 'click', function( ev )
|
||||
* {
|
||||
* // The DOM event object is passed by the "data" property.
|
||||
* var domEvent = ev.data;
|
||||
* // Add a CSS class to the event target.
|
||||
* domEvent.getTarget().addClass( 'clicked' );
|
||||
* });
|
||||
*/
|
||||
|
||||
getTarget : function()
|
||||
{
|
||||
var rawNode = this.$.target || this.$.srcElement;
|
||||
return rawNode ? new CKEDITOR.dom.node( rawNode ) : null;
|
||||
}
|
||||
};
|
||||
|
||||
// For the followind constants, we need to go over the Unicode boundaries
|
||||
// (0x10FFFF) to avoid collision.
|
||||
|
||||
/**
|
||||
* CTRL key (0x110000).
|
||||
* @constant
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.CTRL = 0x110000;
|
||||
|
||||
/**
|
||||
* SHIFT key (0x220000).
|
||||
* @constant
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.SHIFT = 0x220000;
|
||||
|
||||
/**
|
||||
* ALT key (0x440000).
|
||||
* @constant
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.ALT = 0x440000;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,26 +1,26 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @class
|
||||
*/
|
||||
CKEDITOR.dom.nodeList = function( nativeList )
|
||||
{
|
||||
this.$ = nativeList;
|
||||
};
|
||||
|
||||
CKEDITOR.dom.nodeList.prototype =
|
||||
{
|
||||
count : function()
|
||||
{
|
||||
return this.$.length;
|
||||
},
|
||||
|
||||
getItem : function( index )
|
||||
{
|
||||
var $node = this.$[ index ];
|
||||
return $node ? new CKEDITOR.dom.node( $node ) : null;
|
||||
}
|
||||
};
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @class
|
||||
*/
|
||||
CKEDITOR.dom.nodeList = function( nativeList )
|
||||
{
|
||||
this.$ = nativeList;
|
||||
};
|
||||
|
||||
CKEDITOR.dom.nodeList.prototype =
|
||||
{
|
||||
count : function()
|
||||
{
|
||||
return this.$.length;
|
||||
},
|
||||
|
||||
getItem : function( index )
|
||||
{
|
||||
var $node = this.$[ index ];
|
||||
return $node ? new CKEDITOR.dom.node( $node ) : null;
|
||||
}
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,213 +1,213 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
/**
|
||||
* Represents a list os CKEDITOR.dom.range objects, which can be easily
|
||||
* iterated sequentially.
|
||||
* @constructor
|
||||
* @param {CKEDITOR.dom.range|Array} [ranges] The ranges contained on this list.
|
||||
* Note that, if an array of ranges is specified, the range sequence
|
||||
* should match its DOM order. This class will not help to sort them.
|
||||
*/
|
||||
CKEDITOR.dom.rangeList = function( ranges )
|
||||
{
|
||||
if ( ranges instanceof CKEDITOR.dom.rangeList )
|
||||
return ranges;
|
||||
|
||||
if ( !ranges )
|
||||
ranges = [];
|
||||
else if ( ranges instanceof CKEDITOR.dom.range )
|
||||
ranges = [ ranges ];
|
||||
|
||||
return CKEDITOR.tools.extend( ranges, mixins );
|
||||
};
|
||||
|
||||
var mixins =
|
||||
/** @lends CKEDITOR.dom.rangeList.prototype */
|
||||
{
|
||||
/**
|
||||
* Creates an instance of the rangeList iterator, it should be used
|
||||
* only when the ranges processing could be DOM intrusive, which
|
||||
* means it may pollute and break other ranges in this list.
|
||||
* Otherwise, it's enough to just iterate over this array in a for loop.
|
||||
* @returns {CKEDITOR.dom.rangeListIterator}
|
||||
*/
|
||||
createIterator : function()
|
||||
{
|
||||
var rangeList = this,
|
||||
bookmark = CKEDITOR.dom.walker.bookmark(),
|
||||
guard = function( node ) { return ! ( node.is && node.is( 'tr' ) ); },
|
||||
bookmarks = [],
|
||||
current;
|
||||
|
||||
/**
|
||||
* @lends CKEDITOR.dom.rangeListIterator.prototype
|
||||
*/
|
||||
return {
|
||||
|
||||
/**
|
||||
* Retrieves the next range in the list.
|
||||
* @param {Boolean} mergeConsequent Whether join two adjacent ranges into single, e.g. consequent table cells.
|
||||
*/
|
||||
getNextRange : function( mergeConsequent )
|
||||
{
|
||||
current = current == undefined ? 0 : current + 1;
|
||||
|
||||
var range = rangeList[ current ];
|
||||
|
||||
// Multiple ranges might be mangled by each other.
|
||||
if ( range && rangeList.length > 1 )
|
||||
{
|
||||
// Bookmarking all other ranges on the first iteration,
|
||||
// the range correctness after it doesn't matter since we'll
|
||||
// restore them before the next iteration.
|
||||
if ( !current )
|
||||
{
|
||||
// Make sure bookmark correctness by reverse processing.
|
||||
for ( var i = rangeList.length - 1; i >= 0; i-- )
|
||||
bookmarks.unshift( rangeList[ i ].createBookmark( true ) );
|
||||
}
|
||||
|
||||
if ( mergeConsequent )
|
||||
{
|
||||
// Figure out how many ranges should be merged.
|
||||
var mergeCount = 0;
|
||||
while ( rangeList[ current + mergeCount + 1 ] )
|
||||
{
|
||||
var doc = range.document,
|
||||
found = 0,
|
||||
left = doc.getById( bookmarks[ mergeCount ].endNode ),
|
||||
right = doc.getById( bookmarks[ mergeCount + 1 ].startNode ),
|
||||
next;
|
||||
|
||||
// Check subsequent range.
|
||||
while ( 1 )
|
||||
{
|
||||
next = left.getNextSourceNode( false );
|
||||
if ( !right.equals( next ) )
|
||||
{
|
||||
// This could be yet another bookmark or
|
||||
// walking across block boundaries.
|
||||
if ( bookmark( next ) || ( next.type == CKEDITOR.NODE_ELEMENT && next.isBlockBoundary() ) )
|
||||
{
|
||||
left = next;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
found = 1;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !found )
|
||||
break;
|
||||
|
||||
mergeCount++;
|
||||
}
|
||||
}
|
||||
|
||||
range.moveToBookmark( bookmarks.shift() );
|
||||
|
||||
// Merge ranges finally after moving to bookmarks.
|
||||
while( mergeCount-- )
|
||||
{
|
||||
next = rangeList[ ++current ];
|
||||
next.moveToBookmark( bookmarks.shift() );
|
||||
range.setEnd( next.endContainer, next.endOffset );
|
||||
}
|
||||
}
|
||||
|
||||
return range;
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
createBookmarks : function( serializable )
|
||||
{
|
||||
var retval = [], bookmark;
|
||||
for ( var i = 0; i < this.length ; i++ )
|
||||
{
|
||||
retval.push( bookmark = this[ i ].createBookmark( serializable, true) );
|
||||
|
||||
// Updating the container & offset values for ranges
|
||||
// that have been touched.
|
||||
for ( var j = i + 1; j < this.length; j++ )
|
||||
{
|
||||
this[ j ] = updateDirtyRange( bookmark, this[ j ] );
|
||||
this[ j ] = updateDirtyRange( bookmark, this[ j ], true );
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
},
|
||||
|
||||
createBookmarks2 : function( normalized )
|
||||
{
|
||||
var bookmarks = [];
|
||||
|
||||
for ( var i = 0 ; i < this.length ; i++ )
|
||||
bookmarks.push( this[ i ].createBookmark2( normalized ) );
|
||||
|
||||
return bookmarks;
|
||||
},
|
||||
|
||||
/**
|
||||
* Move each range in the list to the position specified by a list of bookmarks.
|
||||
* @param {Array} bookmarks The list of bookmarks, each one matching a range in the list.
|
||||
*/
|
||||
moveToBookmarks : function( bookmarks )
|
||||
{
|
||||
for ( var i = 0 ; i < this.length ; i++ )
|
||||
this[ i ].moveToBookmark( bookmarks[ i ] );
|
||||
}
|
||||
};
|
||||
|
||||
// Update the specified range which has been mangled by previous insertion of
|
||||
// range bookmark nodes.(#3256)
|
||||
function updateDirtyRange( bookmark, dirtyRange, checkEnd )
|
||||
{
|
||||
var serializable = bookmark.serializable,
|
||||
container = dirtyRange[ checkEnd ? 'endContainer' : 'startContainer' ],
|
||||
offset = checkEnd ? 'endOffset' : 'startOffset';
|
||||
|
||||
var bookmarkStart = serializable ?
|
||||
dirtyRange.document.getById( bookmark.startNode )
|
||||
: bookmark.startNode;
|
||||
|
||||
var bookmarkEnd = serializable ?
|
||||
dirtyRange.document.getById( bookmark.endNode )
|
||||
: bookmark.endNode;
|
||||
|
||||
if ( container.equals( bookmarkStart.getPrevious() ) )
|
||||
{
|
||||
dirtyRange.startOffset = dirtyRange.startOffset
|
||||
- container.getLength()
|
||||
- bookmarkEnd.getPrevious().getLength();
|
||||
container = bookmarkEnd.getNext();
|
||||
}
|
||||
else if ( container.equals( bookmarkEnd.getPrevious() ) )
|
||||
{
|
||||
dirtyRange.startOffset = dirtyRange.startOffset - container.getLength();
|
||||
container = bookmarkEnd.getNext();
|
||||
}
|
||||
|
||||
container.equals( bookmarkStart.getParent() ) && dirtyRange[ offset ]++;
|
||||
container.equals( bookmarkEnd.getParent() ) && dirtyRange[ offset ]++;
|
||||
|
||||
// Update and return this range.
|
||||
dirtyRange[ checkEnd ? 'endContainer' : 'startContainer' ] = container;
|
||||
return dirtyRange;
|
||||
}
|
||||
})();
|
||||
|
||||
/**
|
||||
* (Virtual Class) Do not call this constructor. This class is not really part
|
||||
* of the API. It just describes the return type of {@link CKEDITOR.dom.rangeList#createIterator}.
|
||||
* @name CKEDITOR.dom.rangeListIterator
|
||||
* @constructor
|
||||
* @example
|
||||
*/
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
/**
|
||||
* Represents a list os CKEDITOR.dom.range objects, which can be easily
|
||||
* iterated sequentially.
|
||||
* @constructor
|
||||
* @param {CKEDITOR.dom.range|Array} [ranges] The ranges contained on this list.
|
||||
* Note that, if an array of ranges is specified, the range sequence
|
||||
* should match its DOM order. This class will not help to sort them.
|
||||
*/
|
||||
CKEDITOR.dom.rangeList = function( ranges )
|
||||
{
|
||||
if ( ranges instanceof CKEDITOR.dom.rangeList )
|
||||
return ranges;
|
||||
|
||||
if ( !ranges )
|
||||
ranges = [];
|
||||
else if ( ranges instanceof CKEDITOR.dom.range )
|
||||
ranges = [ ranges ];
|
||||
|
||||
return CKEDITOR.tools.extend( ranges, mixins );
|
||||
};
|
||||
|
||||
var mixins =
|
||||
/** @lends CKEDITOR.dom.rangeList.prototype */
|
||||
{
|
||||
/**
|
||||
* Creates an instance of the rangeList iterator, it should be used
|
||||
* only when the ranges processing could be DOM intrusive, which
|
||||
* means it may pollute and break other ranges in this list.
|
||||
* Otherwise, it's enough to just iterate over this array in a for loop.
|
||||
* @returns {CKEDITOR.dom.rangeListIterator}
|
||||
*/
|
||||
createIterator : function()
|
||||
{
|
||||
var rangeList = this,
|
||||
bookmark = CKEDITOR.dom.walker.bookmark(),
|
||||
guard = function( node ) { return ! ( node.is && node.is( 'tr' ) ); },
|
||||
bookmarks = [],
|
||||
current;
|
||||
|
||||
/**
|
||||
* @lends CKEDITOR.dom.rangeListIterator.prototype
|
||||
*/
|
||||
return {
|
||||
|
||||
/**
|
||||
* Retrieves the next range in the list.
|
||||
* @param {Boolean} mergeConsequent Whether join two adjacent ranges into single, e.g. consequent table cells.
|
||||
*/
|
||||
getNextRange : function( mergeConsequent )
|
||||
{
|
||||
current = current == undefined ? 0 : current + 1;
|
||||
|
||||
var range = rangeList[ current ];
|
||||
|
||||
// Multiple ranges might be mangled by each other.
|
||||
if ( range && rangeList.length > 1 )
|
||||
{
|
||||
// Bookmarking all other ranges on the first iteration,
|
||||
// the range correctness after it doesn't matter since we'll
|
||||
// restore them before the next iteration.
|
||||
if ( !current )
|
||||
{
|
||||
// Make sure bookmark correctness by reverse processing.
|
||||
for ( var i = rangeList.length - 1; i >= 0; i-- )
|
||||
bookmarks.unshift( rangeList[ i ].createBookmark( true ) );
|
||||
}
|
||||
|
||||
if ( mergeConsequent )
|
||||
{
|
||||
// Figure out how many ranges should be merged.
|
||||
var mergeCount = 0;
|
||||
while ( rangeList[ current + mergeCount + 1 ] )
|
||||
{
|
||||
var doc = range.document,
|
||||
found = 0,
|
||||
left = doc.getById( bookmarks[ mergeCount ].endNode ),
|
||||
right = doc.getById( bookmarks[ mergeCount + 1 ].startNode ),
|
||||
next;
|
||||
|
||||
// Check subsequent range.
|
||||
while ( 1 )
|
||||
{
|
||||
next = left.getNextSourceNode( false );
|
||||
if ( !right.equals( next ) )
|
||||
{
|
||||
// This could be yet another bookmark or
|
||||
// walking across block boundaries.
|
||||
if ( bookmark( next ) || ( next.type == CKEDITOR.NODE_ELEMENT && next.isBlockBoundary() ) )
|
||||
{
|
||||
left = next;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
found = 1;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !found )
|
||||
break;
|
||||
|
||||
mergeCount++;
|
||||
}
|
||||
}
|
||||
|
||||
range.moveToBookmark( bookmarks.shift() );
|
||||
|
||||
// Merge ranges finally after moving to bookmarks.
|
||||
while( mergeCount-- )
|
||||
{
|
||||
next = rangeList[ ++current ];
|
||||
next.moveToBookmark( bookmarks.shift() );
|
||||
range.setEnd( next.endContainer, next.endOffset );
|
||||
}
|
||||
}
|
||||
|
||||
return range;
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
createBookmarks : function( serializable )
|
||||
{
|
||||
var retval = [], bookmark;
|
||||
for ( var i = 0; i < this.length ; i++ )
|
||||
{
|
||||
retval.push( bookmark = this[ i ].createBookmark( serializable, true) );
|
||||
|
||||
// Updating the container & offset values for ranges
|
||||
// that have been touched.
|
||||
for ( var j = i + 1; j < this.length; j++ )
|
||||
{
|
||||
this[ j ] = updateDirtyRange( bookmark, this[ j ] );
|
||||
this[ j ] = updateDirtyRange( bookmark, this[ j ], true );
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
},
|
||||
|
||||
createBookmarks2 : function( normalized )
|
||||
{
|
||||
var bookmarks = [];
|
||||
|
||||
for ( var i = 0 ; i < this.length ; i++ )
|
||||
bookmarks.push( this[ i ].createBookmark2( normalized ) );
|
||||
|
||||
return bookmarks;
|
||||
},
|
||||
|
||||
/**
|
||||
* Move each range in the list to the position specified by a list of bookmarks.
|
||||
* @param {Array} bookmarks The list of bookmarks, each one matching a range in the list.
|
||||
*/
|
||||
moveToBookmarks : function( bookmarks )
|
||||
{
|
||||
for ( var i = 0 ; i < this.length ; i++ )
|
||||
this[ i ].moveToBookmark( bookmarks[ i ] );
|
||||
}
|
||||
};
|
||||
|
||||
// Update the specified range which has been mangled by previous insertion of
|
||||
// range bookmark nodes.(#3256)
|
||||
function updateDirtyRange( bookmark, dirtyRange, checkEnd )
|
||||
{
|
||||
var serializable = bookmark.serializable,
|
||||
container = dirtyRange[ checkEnd ? 'endContainer' : 'startContainer' ],
|
||||
offset = checkEnd ? 'endOffset' : 'startOffset';
|
||||
|
||||
var bookmarkStart = serializable ?
|
||||
dirtyRange.document.getById( bookmark.startNode )
|
||||
: bookmark.startNode;
|
||||
|
||||
var bookmarkEnd = serializable ?
|
||||
dirtyRange.document.getById( bookmark.endNode )
|
||||
: bookmark.endNode;
|
||||
|
||||
if ( container.equals( bookmarkStart.getPrevious() ) )
|
||||
{
|
||||
dirtyRange.startOffset = dirtyRange.startOffset
|
||||
- container.getLength()
|
||||
- bookmarkEnd.getPrevious().getLength();
|
||||
container = bookmarkEnd.getNext();
|
||||
}
|
||||
else if ( container.equals( bookmarkEnd.getPrevious() ) )
|
||||
{
|
||||
dirtyRange.startOffset = dirtyRange.startOffset - container.getLength();
|
||||
container = bookmarkEnd.getNext();
|
||||
}
|
||||
|
||||
container.equals( bookmarkStart.getParent() ) && dirtyRange[ offset ]++;
|
||||
container.equals( bookmarkEnd.getParent() ) && dirtyRange[ offset ]++;
|
||||
|
||||
// Update and return this range.
|
||||
dirtyRange[ checkEnd ? 'endContainer' : 'startContainer' ] = container;
|
||||
return dirtyRange;
|
||||
}
|
||||
})();
|
||||
|
||||
/**
|
||||
* (Virtual Class) Do not call this constructor. This class is not really part
|
||||
* of the API. It just describes the return type of {@link CKEDITOR.dom.rangeList#createIterator}.
|
||||
* @name CKEDITOR.dom.rangeListIterator
|
||||
* @constructor
|
||||
* @example
|
||||
*/
|
||||
|
||||
@ -1,128 +1,128 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.dom.text} class, which represents
|
||||
* a DOM text node.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a DOM text node.
|
||||
* @constructor
|
||||
* @augments CKEDITOR.dom.node
|
||||
* @param {Object|String} text A native DOM text node or a string containing
|
||||
* the text to use to create a new text node.
|
||||
* @param {CKEDITOR.dom.document} [ownerDocument] The document that will contain
|
||||
* the node in case of new node creation. Defaults to the current document.
|
||||
* @example
|
||||
* var nativeNode = document.createTextNode( 'Example' );
|
||||
* var text = CKEDITOR.dom.text( nativeNode );
|
||||
* @example
|
||||
* var text = CKEDITOR.dom.text( 'Example' );
|
||||
*/
|
||||
CKEDITOR.dom.text = function( text, ownerDocument )
|
||||
{
|
||||
if ( typeof text == 'string' )
|
||||
text = ( ownerDocument ? ownerDocument.$ : document ).createTextNode( text );
|
||||
|
||||
// Theoretically, we should call the base constructor here
|
||||
// (not CKEDITOR.dom.node though). But, IE doesn't support expando
|
||||
// properties on text node, so the features provided by domObject will not
|
||||
// work for text nodes (which is not a big issue for us).
|
||||
//
|
||||
// CKEDITOR.dom.domObject.call( this, element );
|
||||
|
||||
/**
|
||||
* The native DOM text node represented by this class instance.
|
||||
* @type Object
|
||||
* @example
|
||||
* var element = new CKEDITOR.dom.text( 'Example' );
|
||||
* alert( element.$.nodeType ); // "3"
|
||||
*/
|
||||
this.$ = text;
|
||||
};
|
||||
|
||||
CKEDITOR.dom.text.prototype = new CKEDITOR.dom.node();
|
||||
|
||||
CKEDITOR.tools.extend( CKEDITOR.dom.text.prototype,
|
||||
/** @lends CKEDITOR.dom.text.prototype */
|
||||
{
|
||||
/**
|
||||
* The node type. This is a constant value set to
|
||||
* {@link CKEDITOR.NODE_TEXT}.
|
||||
* @type Number
|
||||
* @example
|
||||
*/
|
||||
type : CKEDITOR.NODE_TEXT,
|
||||
|
||||
getLength : function()
|
||||
{
|
||||
return this.$.nodeValue.length;
|
||||
},
|
||||
|
||||
getText : function()
|
||||
{
|
||||
return this.$.nodeValue;
|
||||
},
|
||||
|
||||
setText : function( text )
|
||||
{
|
||||
this.$.nodeValue = text;
|
||||
},
|
||||
|
||||
/**
|
||||
* Breaks this text node into two nodes at the specified offset,
|
||||
* keeping both in the tree as siblings. This node then only contains
|
||||
* all the content up to the offset point. A new text node, which is
|
||||
* inserted as the next sibling of this node, contains all the content
|
||||
* at and after the offset point. When the offset is equal to the
|
||||
* length of this node, the new node has no data.
|
||||
* @param {Number} The position at which to split, starting from zero.
|
||||
* @returns {CKEDITOR.dom.text} The new text node.
|
||||
*/
|
||||
split : function( offset )
|
||||
{
|
||||
// If the offset is after the last char, IE creates the text node
|
||||
// on split, but don't include it into the DOM. So, we have to do
|
||||
// that manually here.
|
||||
if ( CKEDITOR.env.ie && offset == this.getLength() )
|
||||
{
|
||||
var next = this.getDocument().createText( '' );
|
||||
next.insertAfter( this );
|
||||
return next;
|
||||
}
|
||||
|
||||
var doc = this.getDocument();
|
||||
var retval = new CKEDITOR.dom.text( this.$.splitText( offset ), doc );
|
||||
|
||||
// IE BUG: IE8 does not update the childNodes array in DOM after splitText(),
|
||||
// we need to make some DOM changes to make it update. (#3436)
|
||||
if ( CKEDITOR.env.ie8 )
|
||||
{
|
||||
var workaround = new CKEDITOR.dom.text( '', doc );
|
||||
workaround.insertAfter( retval );
|
||||
workaround.remove();
|
||||
}
|
||||
|
||||
return retval;
|
||||
},
|
||||
|
||||
/**
|
||||
* Extracts characters from indexA up to but not including indexB.
|
||||
* @param {Number} indexA An integer between 0 and one less than the
|
||||
* length of the text.
|
||||
* @param {Number} [indexB] An integer between 0 and the length of the
|
||||
* string. If omitted, extracts characters to the end of the text.
|
||||
*/
|
||||
substring : function( indexA, indexB )
|
||||
{
|
||||
// We need the following check due to a Firefox bug
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=458886
|
||||
if ( typeof indexB != 'number' )
|
||||
return this.$.nodeValue.substr( indexA );
|
||||
else
|
||||
return this.$.nodeValue.substring( indexA, indexB );
|
||||
}
|
||||
});
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.dom.text} class, which represents
|
||||
* a DOM text node.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a DOM text node.
|
||||
* @constructor
|
||||
* @augments CKEDITOR.dom.node
|
||||
* @param {Object|String} text A native DOM text node or a string containing
|
||||
* the text to use to create a new text node.
|
||||
* @param {CKEDITOR.dom.document} [ownerDocument] The document that will contain
|
||||
* the node in case of new node creation. Defaults to the current document.
|
||||
* @example
|
||||
* var nativeNode = document.createTextNode( 'Example' );
|
||||
* var text = CKEDITOR.dom.text( nativeNode );
|
||||
* @example
|
||||
* var text = CKEDITOR.dom.text( 'Example' );
|
||||
*/
|
||||
CKEDITOR.dom.text = function( text, ownerDocument )
|
||||
{
|
||||
if ( typeof text == 'string' )
|
||||
text = ( ownerDocument ? ownerDocument.$ : document ).createTextNode( text );
|
||||
|
||||
// Theoretically, we should call the base constructor here
|
||||
// (not CKEDITOR.dom.node though). But, IE doesn't support expando
|
||||
// properties on text node, so the features provided by domObject will not
|
||||
// work for text nodes (which is not a big issue for us).
|
||||
//
|
||||
// CKEDITOR.dom.domObject.call( this, element );
|
||||
|
||||
/**
|
||||
* The native DOM text node represented by this class instance.
|
||||
* @type Object
|
||||
* @example
|
||||
* var element = new CKEDITOR.dom.text( 'Example' );
|
||||
* alert( element.$.nodeType ); // "3"
|
||||
*/
|
||||
this.$ = text;
|
||||
};
|
||||
|
||||
CKEDITOR.dom.text.prototype = new CKEDITOR.dom.node();
|
||||
|
||||
CKEDITOR.tools.extend( CKEDITOR.dom.text.prototype,
|
||||
/** @lends CKEDITOR.dom.text.prototype */
|
||||
{
|
||||
/**
|
||||
* The node type. This is a constant value set to
|
||||
* {@link CKEDITOR.NODE_TEXT}.
|
||||
* @type Number
|
||||
* @example
|
||||
*/
|
||||
type : CKEDITOR.NODE_TEXT,
|
||||
|
||||
getLength : function()
|
||||
{
|
||||
return this.$.nodeValue.length;
|
||||
},
|
||||
|
||||
getText : function()
|
||||
{
|
||||
return this.$.nodeValue;
|
||||
},
|
||||
|
||||
setText : function( text )
|
||||
{
|
||||
this.$.nodeValue = text;
|
||||
},
|
||||
|
||||
/**
|
||||
* Breaks this text node into two nodes at the specified offset,
|
||||
* keeping both in the tree as siblings. This node then only contains
|
||||
* all the content up to the offset point. A new text node, which is
|
||||
* inserted as the next sibling of this node, contains all the content
|
||||
* at and after the offset point. When the offset is equal to the
|
||||
* length of this node, the new node has no data.
|
||||
* @param {Number} The position at which to split, starting from zero.
|
||||
* @returns {CKEDITOR.dom.text} The new text node.
|
||||
*/
|
||||
split : function( offset )
|
||||
{
|
||||
// If the offset is after the last char, IE creates the text node
|
||||
// on split, but don't include it into the DOM. So, we have to do
|
||||
// that manually here.
|
||||
if ( CKEDITOR.env.ie && offset == this.getLength() )
|
||||
{
|
||||
var next = this.getDocument().createText( '' );
|
||||
next.insertAfter( this );
|
||||
return next;
|
||||
}
|
||||
|
||||
var doc = this.getDocument();
|
||||
var retval = new CKEDITOR.dom.text( this.$.splitText( offset ), doc );
|
||||
|
||||
// IE BUG: IE8 does not update the childNodes array in DOM after splitText(),
|
||||
// we need to make some DOM changes to make it update. (#3436)
|
||||
if ( CKEDITOR.env.ie8 )
|
||||
{
|
||||
var workaround = new CKEDITOR.dom.text( '', doc );
|
||||
workaround.insertAfter( retval );
|
||||
workaround.remove();
|
||||
}
|
||||
|
||||
return retval;
|
||||
},
|
||||
|
||||
/**
|
||||
* Extracts characters from indexA up to but not including indexB.
|
||||
* @param {Number} indexA An integer between 0 and one less than the
|
||||
* length of the text.
|
||||
* @param {Number} [indexB] An integer between 0 and the length of the
|
||||
* string. If omitted, extracts characters to the end of the text.
|
||||
*/
|
||||
substring : function( indexA, indexB )
|
||||
{
|
||||
// We need the following check due to a Firefox bug
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=458886
|
||||
if ( typeof indexB != 'number' )
|
||||
return this.$.nodeValue.substr( indexA );
|
||||
else
|
||||
return this.$.nodeValue.substring( indexA, indexB );
|
||||
}
|
||||
});
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,96 +1,96 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.dom.document} class, which
|
||||
* represents a DOM document.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a DOM window.
|
||||
* @constructor
|
||||
* @augments CKEDITOR.dom.domObject
|
||||
* @param {Object} domWindow A native DOM window.
|
||||
* @example
|
||||
* var document = new CKEDITOR.dom.window( window );
|
||||
*/
|
||||
CKEDITOR.dom.window = function( domWindow )
|
||||
{
|
||||
CKEDITOR.dom.domObject.call( this, domWindow );
|
||||
};
|
||||
|
||||
CKEDITOR.dom.window.prototype = new CKEDITOR.dom.domObject();
|
||||
|
||||
CKEDITOR.tools.extend( CKEDITOR.dom.window.prototype,
|
||||
/** @lends CKEDITOR.dom.window.prototype */
|
||||
{
|
||||
/**
|
||||
* Moves the selection focus to this window.
|
||||
* @function
|
||||
* @example
|
||||
* var win = new CKEDITOR.dom.window( window );
|
||||
* <b>win.focus()</b>;
|
||||
*/
|
||||
focus : function()
|
||||
{
|
||||
// Webkit is sometimes failed to focus iframe, blur it first(#3835).
|
||||
if ( CKEDITOR.env.webkit && this.$.parent )
|
||||
this.$.parent.focus();
|
||||
this.$.focus();
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the width and height of this window's viewable area.
|
||||
* @function
|
||||
* @returns {Object} An object with the "width" and "height"
|
||||
* properties containing the size.
|
||||
* @example
|
||||
* var win = new CKEDITOR.dom.window( window );
|
||||
* var size = <b>win.getViewPaneSize()</b>;
|
||||
* alert( size.width );
|
||||
* alert( size.height );
|
||||
*/
|
||||
getViewPaneSize : function()
|
||||
{
|
||||
var doc = this.$.document,
|
||||
stdMode = doc.compatMode == 'CSS1Compat';
|
||||
return {
|
||||
width : ( stdMode ? doc.documentElement.clientWidth : doc.body.clientWidth ) || 0,
|
||||
height : ( stdMode ? doc.documentElement.clientHeight : doc.body.clientHeight ) || 0
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the current position of the window's scroll.
|
||||
* @function
|
||||
* @returns {Object} An object with the "x" and "y" properties
|
||||
* containing the scroll position.
|
||||
* @example
|
||||
* var win = new CKEDITOR.dom.window( window );
|
||||
* var pos = <b>win.getScrollPosition()</b>;
|
||||
* alert( pos.x );
|
||||
* alert( pos.y );
|
||||
*/
|
||||
getScrollPosition : function()
|
||||
{
|
||||
var $ = this.$;
|
||||
|
||||
if ( 'pageXOffset' in $ )
|
||||
{
|
||||
return {
|
||||
x : $.pageXOffset || 0,
|
||||
y : $.pageYOffset || 0
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
var doc = $.document;
|
||||
return {
|
||||
x : doc.documentElement.scrollLeft || doc.body.scrollLeft || 0,
|
||||
y : doc.documentElement.scrollTop || doc.body.scrollTop || 0
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.dom.document} class, which
|
||||
* represents a DOM document.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a DOM window.
|
||||
* @constructor
|
||||
* @augments CKEDITOR.dom.domObject
|
||||
* @param {Object} domWindow A native DOM window.
|
||||
* @example
|
||||
* var document = new CKEDITOR.dom.window( window );
|
||||
*/
|
||||
CKEDITOR.dom.window = function( domWindow )
|
||||
{
|
||||
CKEDITOR.dom.domObject.call( this, domWindow );
|
||||
};
|
||||
|
||||
CKEDITOR.dom.window.prototype = new CKEDITOR.dom.domObject();
|
||||
|
||||
CKEDITOR.tools.extend( CKEDITOR.dom.window.prototype,
|
||||
/** @lends CKEDITOR.dom.window.prototype */
|
||||
{
|
||||
/**
|
||||
* Moves the selection focus to this window.
|
||||
* @function
|
||||
* @example
|
||||
* var win = new CKEDITOR.dom.window( window );
|
||||
* <b>win.focus()</b>;
|
||||
*/
|
||||
focus : function()
|
||||
{
|
||||
// Webkit is sometimes failed to focus iframe, blur it first(#3835).
|
||||
if ( CKEDITOR.env.webkit && this.$.parent )
|
||||
this.$.parent.focus();
|
||||
this.$.focus();
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the width and height of this window's viewable area.
|
||||
* @function
|
||||
* @returns {Object} An object with the "width" and "height"
|
||||
* properties containing the size.
|
||||
* @example
|
||||
* var win = new CKEDITOR.dom.window( window );
|
||||
* var size = <b>win.getViewPaneSize()</b>;
|
||||
* alert( size.width );
|
||||
* alert( size.height );
|
||||
*/
|
||||
getViewPaneSize : function()
|
||||
{
|
||||
var doc = this.$.document,
|
||||
stdMode = doc.compatMode == 'CSS1Compat';
|
||||
return {
|
||||
width : ( stdMode ? doc.documentElement.clientWidth : doc.body.clientWidth ) || 0,
|
||||
height : ( stdMode ? doc.documentElement.clientHeight : doc.body.clientHeight ) || 0
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the current position of the window's scroll.
|
||||
* @function
|
||||
* @returns {Object} An object with the "x" and "y" properties
|
||||
* containing the scroll position.
|
||||
* @example
|
||||
* var win = new CKEDITOR.dom.window( window );
|
||||
* var pos = <b>win.getScrollPosition()</b>;
|
||||
* alert( pos.x );
|
||||
* alert( pos.y );
|
||||
*/
|
||||
getScrollPosition : function()
|
||||
{
|
||||
var $ = this.$;
|
||||
|
||||
if ( 'pageXOffset' in $ )
|
||||
{
|
||||
return {
|
||||
x : $.pageXOffset || 0,
|
||||
y : $.pageYOffset || 0
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
var doc = $.document;
|
||||
return {
|
||||
x : doc.documentElement.scrollLeft || doc.body.scrollLeft || 0,
|
||||
y : doc.documentElement.scrollTop || doc.body.scrollTop || 0
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -1,266 +1,266 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.dtd} object, which holds the DTD
|
||||
* mapping for XHTML 1.0 Transitional. This file was automatically
|
||||
* generated from the file: xhtml1-transitional.dtd.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @namespace Holds and object representation of the HTML DTD to be used by the
|
||||
* editor in its internal operations.<br />
|
||||
* <br />
|
||||
* Each element in the DTD is represented by a property in this object. Each
|
||||
* property contains the list of elements that can be contained by the element.
|
||||
* Text is represented by the "#" property.<br />
|
||||
* <br />
|
||||
* Several special grouping properties are also available. Their names start
|
||||
* with the "$" character.
|
||||
* @example
|
||||
* // Check if "div" can be contained in a "p" element.
|
||||
* alert( !!CKEDITOR.dtd[ 'p' ][ 'div' ] ); "false"
|
||||
* @example
|
||||
* // Check if "p" can be contained in a "div" element.
|
||||
* alert( !!CKEDITOR.dtd[ 'div' ][ 'p' ] ); "true"
|
||||
* @example
|
||||
* // Check if "p" is a block element.
|
||||
* alert( !!CKEDITOR.dtd.$block[ 'p' ] ); "true"
|
||||
*/
|
||||
CKEDITOR.dtd = (function()
|
||||
{
|
||||
var X = CKEDITOR.tools.extend,
|
||||
|
||||
A = {isindex:1,fieldset:1},
|
||||
B = {input:1,button:1,select:1,textarea:1,label:1},
|
||||
C = X({a:1},B),
|
||||
D = X({iframe:1},C),
|
||||
E = {hr:1,ul:1,menu:1,div:1,section:1,header:1,footer:1,nav:1,article:1,aside:1,figure:1,dialog:1,hgroup:1,mark:1,time:1,meter:1,command:1,keygen:1,output:1,progress:1,audio:1,video:1,details:1,datagrid:1,datalist:1,blockquote:1,noscript:1,table:1,center:1,address:1,dir:1,pre:1,h5:1,dl:1,h4:1,noframes:1,h6:1,ol:1,h1:1,h3:1,h2:1},
|
||||
F = {ins:1,del:1,script:1,style:1},
|
||||
G = X({b:1,acronym:1,bdo:1,'var':1,'#':1,abbr:1,code:1,br:1,i:1,cite:1,kbd:1,u:1,strike:1,s:1,tt:1,strong:1,q:1,samp:1,em:1,dfn:1,span:1,wbr:1},F),
|
||||
H = X({sub:1,img:1,object:1,sup:1,basefont:1,map:1,applet:1,font:1,big:1,small:1,mark:1},G),
|
||||
I = X({p:1},H),
|
||||
J = X({iframe:1},H,B),
|
||||
K = {img:1,noscript:1,br:1,kbd:1,center:1,button:1,basefont:1,h5:1,h4:1,samp:1,h6:1,ol:1,h1:1,h3:1,h2:1,form:1,font:1,'#':1,select:1,menu:1,ins:1,abbr:1,label:1,code:1,table:1,script:1,cite:1,input:1,iframe:1,strong:1,textarea:1,noframes:1,big:1,small:1,span:1,hr:1,sub:1,bdo:1,'var':1,div:1,section:1,header:1,footer:1,nav:1,article:1,aside:1,figure:1,dialog:1,hgroup:1,mark:1,time:1,meter:1,menu:1,command:1,keygen:1,output:1,progress:1,audio:1,video:1,details:1,datagrid:1,datalist:1,object:1,sup:1,strike:1,dir:1,map:1,dl:1,applet:1,del:1,isindex:1,fieldset:1,ul:1,b:1,acronym:1,a:1,blockquote:1,i:1,u:1,s:1,tt:1,address:1,q:1,pre:1,p:1,em:1,dfn:1},
|
||||
|
||||
L = X({a:1},J),
|
||||
M = {tr:1},
|
||||
N = {'#':1},
|
||||
O = X({param:1},K),
|
||||
P = X({form:1},A,D,E,I),
|
||||
Q = {li:1},
|
||||
R = {style:1,script:1},
|
||||
S = {base:1,link:1,meta:1,title:1},
|
||||
T = X(S,R),
|
||||
U = {head:1,body:1},
|
||||
V = {html:1};
|
||||
|
||||
var block = {address:1,blockquote:1,center:1,dir:1,div:1,section:1,header:1,footer:1,nav:1,article:1,aside:1,figure:1,dialog:1,hgroup:1,time:1,meter:1,menu:1,command:1,keygen:1,output:1,progress:1,audio:1,video:1,details:1,datagrid:1,datalist:1,dl:1,fieldset:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,isindex:1,noframes:1,ol:1,p:1,pre:1,table:1,ul:1};
|
||||
|
||||
return /** @lends CKEDITOR.dtd */ {
|
||||
|
||||
// The "$" items have been added manually.
|
||||
|
||||
// List of elements living outside body.
|
||||
$nonBodyContent: X(V,U,S),
|
||||
|
||||
/**
|
||||
* List of block elements, like "p" or "div".
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
$block : block,
|
||||
|
||||
/**
|
||||
* List of block limit elements.
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
$blockLimit : { body:1,div:1,section:1,header:1,footer:1,nav:1,article:1,aside:1,figure:1,dialog:1,hgroup:1,time:1,meter:1,menu:1,command:1,keygen:1,output:1,progress:1,audio:1,video:1,details:1,datagrid:1,datalist:1,td:1,th:1,caption:1,form:1 },
|
||||
|
||||
/**
|
||||
* List of inline (<span> like) elements.
|
||||
*/
|
||||
$inline : L, // Just like span.
|
||||
|
||||
/**
|
||||
* list of elements that can be children at <body>.
|
||||
*/
|
||||
$body : X({script:1,style:1}, block),
|
||||
|
||||
$cdata : {script:1,style:1},
|
||||
|
||||
/**
|
||||
* List of empty (self-closing) elements, like "br" or "img".
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
$empty : {area:1,base:1,br:1,col:1,hr:1,img:1,input:1,link:1,meta:1,param:1,wbr:1},
|
||||
|
||||
/**
|
||||
* List of list item elements, like "li" or "dd".
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
$listItem : {dd:1,dt:1,li:1},
|
||||
|
||||
/**
|
||||
* List of list root elements.
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
$list: {ul:1,ol:1,dl:1},
|
||||
|
||||
/**
|
||||
* Elements that accept text nodes, but are not possible to edit into
|
||||
* the browser.
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
$nonEditable : {applet:1,button:1,embed:1,iframe:1,map:1,object:1,option:1,script:1,textarea:1,param:1,audio:1,video:1},
|
||||
|
||||
/**
|
||||
* List of block tags with each one a singleton element lives in the corresponding structure for description.
|
||||
*/
|
||||
$captionBlock : { caption:1, legend:1 },
|
||||
|
||||
/**
|
||||
* List of elements that can be ignored if empty, like "b" or "span".
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
$removeEmpty : {abbr:1,acronym:1,address:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,s:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1,mark:1},
|
||||
|
||||
/**
|
||||
* List of elements that have tabindex set to zero by default.
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
$tabIndex : {a:1,area:1,button:1,input:1,object:1,select:1,textarea:1},
|
||||
|
||||
/**
|
||||
* List of elements used inside the "table" element, like "tbody" or "td".
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
$tableContent : {caption:1,col:1,colgroup:1,tbody:1,td:1,tfoot:1,th:1,thead:1,tr:1},
|
||||
|
||||
html: U,
|
||||
head: T,
|
||||
style: N,
|
||||
script: N,
|
||||
body: P,
|
||||
base: {},
|
||||
link: {},
|
||||
meta: {},
|
||||
title: N,
|
||||
col : {},
|
||||
tr : {td:1,th:1},
|
||||
img : {},
|
||||
colgroup : {col:1},
|
||||
noscript : P,
|
||||
td : P,
|
||||
br : {},
|
||||
wbr : {},
|
||||
th : P,
|
||||
center : P,
|
||||
kbd : L,
|
||||
button : X(I,E),
|
||||
basefont : {},
|
||||
h5 : L,
|
||||
h4 : L,
|
||||
samp : L,
|
||||
h6 : L,
|
||||
ol : Q,
|
||||
h1 : L,
|
||||
h3 : L,
|
||||
option : N,
|
||||
h2 : L,
|
||||
form : X(A,D,E,I),
|
||||
select : {optgroup:1,option:1},
|
||||
font : L,
|
||||
ins : L,
|
||||
menu : Q,
|
||||
abbr : L,
|
||||
label : L,
|
||||
table : {thead:1,col:1,tbody:1,tr:1,colgroup:1,caption:1,tfoot:1},
|
||||
code : L,
|
||||
tfoot : M,
|
||||
cite : L,
|
||||
li : P,
|
||||
input : {},
|
||||
iframe : P,
|
||||
strong : L,
|
||||
textarea : N,
|
||||
noframes : P,
|
||||
big : L,
|
||||
small : L,
|
||||
span : L,
|
||||
hr : {},
|
||||
dt : L,
|
||||
sub : L,
|
||||
optgroup : {option:1},
|
||||
param : {},
|
||||
bdo : L,
|
||||
'var' : L,
|
||||
div : P,
|
||||
object : O,
|
||||
sup : L,
|
||||
dd : P,
|
||||
strike : L,
|
||||
area : {},
|
||||
dir : Q,
|
||||
map : X({area:1,form:1,p:1},A,F,E),
|
||||
applet : O,
|
||||
dl : {dt:1,dd:1},
|
||||
del : L,
|
||||
isindex : {},
|
||||
fieldset : X({legend:1},K),
|
||||
thead : M,
|
||||
ul : Q,
|
||||
acronym : L,
|
||||
b : L,
|
||||
a : J,
|
||||
blockquote : P,
|
||||
caption : L,
|
||||
i : L,
|
||||
u : L,
|
||||
tbody : M,
|
||||
s : L,
|
||||
address : X(D,I),
|
||||
tt : L,
|
||||
legend : L,
|
||||
q : L,
|
||||
pre : X(G,C),
|
||||
p : L,
|
||||
em : L,
|
||||
dfn : L,
|
||||
//HTML5
|
||||
section : P,
|
||||
header : P,
|
||||
footer : P,
|
||||
nav : P,
|
||||
article : P,
|
||||
aside : P,
|
||||
figure: P,
|
||||
dialog : P,
|
||||
hgroup : P,
|
||||
mark : L,
|
||||
time : L,
|
||||
meter : L,
|
||||
menu : L,
|
||||
command : L,
|
||||
keygen : L,
|
||||
output : L,
|
||||
progress : O,
|
||||
audio : O,
|
||||
video : O,
|
||||
details : O,
|
||||
datagrid : O,
|
||||
datalist : O
|
||||
};
|
||||
})();
|
||||
|
||||
// PACKAGER_RENAME( CKEDITOR.dtd )
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.dtd} object, which holds the DTD
|
||||
* mapping for XHTML 1.0 Transitional. This file was automatically
|
||||
* generated from the file: xhtml1-transitional.dtd.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @namespace Holds and object representation of the HTML DTD to be used by the
|
||||
* editor in its internal operations.<br />
|
||||
* <br />
|
||||
* Each element in the DTD is represented by a property in this object. Each
|
||||
* property contains the list of elements that can be contained by the element.
|
||||
* Text is represented by the "#" property.<br />
|
||||
* <br />
|
||||
* Several special grouping properties are also available. Their names start
|
||||
* with the "$" character.
|
||||
* @example
|
||||
* // Check if "div" can be contained in a "p" element.
|
||||
* alert( !!CKEDITOR.dtd[ 'p' ][ 'div' ] ); "false"
|
||||
* @example
|
||||
* // Check if "p" can be contained in a "div" element.
|
||||
* alert( !!CKEDITOR.dtd[ 'div' ][ 'p' ] ); "true"
|
||||
* @example
|
||||
* // Check if "p" is a block element.
|
||||
* alert( !!CKEDITOR.dtd.$block[ 'p' ] ); "true"
|
||||
*/
|
||||
CKEDITOR.dtd = (function()
|
||||
{
|
||||
var X = CKEDITOR.tools.extend,
|
||||
|
||||
A = {isindex:1,fieldset:1},
|
||||
B = {input:1,button:1,select:1,textarea:1,label:1},
|
||||
C = X({a:1},B),
|
||||
D = X({iframe:1},C),
|
||||
E = {hr:1,ul:1,menu:1,div:1,section:1,header:1,footer:1,nav:1,article:1,aside:1,figure:1,dialog:1,hgroup:1,mark:1,time:1,meter:1,command:1,keygen:1,output:1,progress:1,audio:1,video:1,details:1,datagrid:1,datalist:1,blockquote:1,noscript:1,table:1,center:1,address:1,dir:1,pre:1,h5:1,dl:1,h4:1,noframes:1,h6:1,ol:1,h1:1,h3:1,h2:1},
|
||||
F = {ins:1,del:1,script:1,style:1},
|
||||
G = X({b:1,acronym:1,bdo:1,'var':1,'#':1,abbr:1,code:1,br:1,i:1,cite:1,kbd:1,u:1,strike:1,s:1,tt:1,strong:1,q:1,samp:1,em:1,dfn:1,span:1,wbr:1},F),
|
||||
H = X({sub:1,img:1,object:1,sup:1,basefont:1,map:1,applet:1,font:1,big:1,small:1,mark:1},G),
|
||||
I = X({p:1},H),
|
||||
J = X({iframe:1},H,B),
|
||||
K = {img:1,noscript:1,br:1,kbd:1,center:1,button:1,basefont:1,h5:1,h4:1,samp:1,h6:1,ol:1,h1:1,h3:1,h2:1,form:1,font:1,'#':1,select:1,menu:1,ins:1,abbr:1,label:1,code:1,table:1,script:1,cite:1,input:1,iframe:1,strong:1,textarea:1,noframes:1,big:1,small:1,span:1,hr:1,sub:1,bdo:1,'var':1,div:1,section:1,header:1,footer:1,nav:1,article:1,aside:1,figure:1,dialog:1,hgroup:1,mark:1,time:1,meter:1,menu:1,command:1,keygen:1,output:1,progress:1,audio:1,video:1,details:1,datagrid:1,datalist:1,object:1,sup:1,strike:1,dir:1,map:1,dl:1,applet:1,del:1,isindex:1,fieldset:1,ul:1,b:1,acronym:1,a:1,blockquote:1,i:1,u:1,s:1,tt:1,address:1,q:1,pre:1,p:1,em:1,dfn:1},
|
||||
|
||||
L = X({a:1},J),
|
||||
M = {tr:1},
|
||||
N = {'#':1},
|
||||
O = X({param:1},K),
|
||||
P = X({form:1},A,D,E,I),
|
||||
Q = {li:1},
|
||||
R = {style:1,script:1},
|
||||
S = {base:1,link:1,meta:1,title:1},
|
||||
T = X(S,R),
|
||||
U = {head:1,body:1},
|
||||
V = {html:1};
|
||||
|
||||
var block = {address:1,blockquote:1,center:1,dir:1,div:1,section:1,header:1,footer:1,nav:1,article:1,aside:1,figure:1,dialog:1,hgroup:1,time:1,meter:1,menu:1,command:1,keygen:1,output:1,progress:1,audio:1,video:1,details:1,datagrid:1,datalist:1,dl:1,fieldset:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,isindex:1,noframes:1,ol:1,p:1,pre:1,table:1,ul:1};
|
||||
|
||||
return /** @lends CKEDITOR.dtd */ {
|
||||
|
||||
// The "$" items have been added manually.
|
||||
|
||||
// List of elements living outside body.
|
||||
$nonBodyContent: X(V,U,S),
|
||||
|
||||
/**
|
||||
* List of block elements, like "p" or "div".
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
$block : block,
|
||||
|
||||
/**
|
||||
* List of block limit elements.
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
$blockLimit : { body:1,div:1,section:1,header:1,footer:1,nav:1,article:1,aside:1,figure:1,dialog:1,hgroup:1,time:1,meter:1,menu:1,command:1,keygen:1,output:1,progress:1,audio:1,video:1,details:1,datagrid:1,datalist:1,td:1,th:1,caption:1,form:1 },
|
||||
|
||||
/**
|
||||
* List of inline (<span> like) elements.
|
||||
*/
|
||||
$inline : L, // Just like span.
|
||||
|
||||
/**
|
||||
* list of elements that can be children at <body>.
|
||||
*/
|
||||
$body : X({script:1,style:1}, block),
|
||||
|
||||
$cdata : {script:1,style:1},
|
||||
|
||||
/**
|
||||
* List of empty (self-closing) elements, like "br" or "img".
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
$empty : {area:1,base:1,br:1,col:1,hr:1,img:1,input:1,link:1,meta:1,param:1,wbr:1},
|
||||
|
||||
/**
|
||||
* List of list item elements, like "li" or "dd".
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
$listItem : {dd:1,dt:1,li:1},
|
||||
|
||||
/**
|
||||
* List of list root elements.
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
$list: {ul:1,ol:1,dl:1},
|
||||
|
||||
/**
|
||||
* Elements that accept text nodes, but are not possible to edit into
|
||||
* the browser.
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
$nonEditable : {applet:1,button:1,embed:1,iframe:1,map:1,object:1,option:1,script:1,textarea:1,param:1,audio:1,video:1},
|
||||
|
||||
/**
|
||||
* List of block tags with each one a singleton element lives in the corresponding structure for description.
|
||||
*/
|
||||
$captionBlock : { caption:1, legend:1 },
|
||||
|
||||
/**
|
||||
* List of elements that can be ignored if empty, like "b" or "span".
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
$removeEmpty : {abbr:1,acronym:1,address:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,s:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1,mark:1},
|
||||
|
||||
/**
|
||||
* List of elements that have tabindex set to zero by default.
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
$tabIndex : {a:1,area:1,button:1,input:1,object:1,select:1,textarea:1},
|
||||
|
||||
/**
|
||||
* List of elements used inside the "table" element, like "tbody" or "td".
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
$tableContent : {caption:1,col:1,colgroup:1,tbody:1,td:1,tfoot:1,th:1,thead:1,tr:1},
|
||||
|
||||
html: U,
|
||||
head: T,
|
||||
style: N,
|
||||
script: N,
|
||||
body: P,
|
||||
base: {},
|
||||
link: {},
|
||||
meta: {},
|
||||
title: N,
|
||||
col : {},
|
||||
tr : {td:1,th:1},
|
||||
img : {},
|
||||
colgroup : {col:1},
|
||||
noscript : P,
|
||||
td : P,
|
||||
br : {},
|
||||
wbr : {},
|
||||
th : P,
|
||||
center : P,
|
||||
kbd : L,
|
||||
button : X(I,E),
|
||||
basefont : {},
|
||||
h5 : L,
|
||||
h4 : L,
|
||||
samp : L,
|
||||
h6 : L,
|
||||
ol : Q,
|
||||
h1 : L,
|
||||
h3 : L,
|
||||
option : N,
|
||||
h2 : L,
|
||||
form : X(A,D,E,I),
|
||||
select : {optgroup:1,option:1},
|
||||
font : L,
|
||||
ins : L,
|
||||
menu : Q,
|
||||
abbr : L,
|
||||
label : L,
|
||||
table : {thead:1,col:1,tbody:1,tr:1,colgroup:1,caption:1,tfoot:1},
|
||||
code : L,
|
||||
tfoot : M,
|
||||
cite : L,
|
||||
li : P,
|
||||
input : {},
|
||||
iframe : P,
|
||||
strong : L,
|
||||
textarea : N,
|
||||
noframes : P,
|
||||
big : L,
|
||||
small : L,
|
||||
span : L,
|
||||
hr : {},
|
||||
dt : L,
|
||||
sub : L,
|
||||
optgroup : {option:1},
|
||||
param : {},
|
||||
bdo : L,
|
||||
'var' : L,
|
||||
div : P,
|
||||
object : O,
|
||||
sup : L,
|
||||
dd : P,
|
||||
strike : L,
|
||||
area : {},
|
||||
dir : Q,
|
||||
map : X({area:1,form:1,p:1},A,F,E),
|
||||
applet : O,
|
||||
dl : {dt:1,dd:1},
|
||||
del : L,
|
||||
isindex : {},
|
||||
fieldset : X({legend:1},K),
|
||||
thead : M,
|
||||
ul : Q,
|
||||
acronym : L,
|
||||
b : L,
|
||||
a : J,
|
||||
blockquote : P,
|
||||
caption : L,
|
||||
i : L,
|
||||
u : L,
|
||||
tbody : M,
|
||||
s : L,
|
||||
address : X(D,I),
|
||||
tt : L,
|
||||
legend : L,
|
||||
q : L,
|
||||
pre : X(G,C),
|
||||
p : L,
|
||||
em : L,
|
||||
dfn : L,
|
||||
//HTML5
|
||||
section : P,
|
||||
header : P,
|
||||
footer : P,
|
||||
nav : P,
|
||||
article : P,
|
||||
aside : P,
|
||||
figure: P,
|
||||
dialog : P,
|
||||
hgroup : P,
|
||||
mark : L,
|
||||
time : L,
|
||||
meter : L,
|
||||
menu : L,
|
||||
command : L,
|
||||
keygen : L,
|
||||
output : L,
|
||||
progress : O,
|
||||
audio : O,
|
||||
video : O,
|
||||
details : O,
|
||||
datagrid : O,
|
||||
datalist : O
|
||||
};
|
||||
})();
|
||||
|
||||
// PACKAGER_RENAME( CKEDITOR.dtd )
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,186 +1,186 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
if ( !CKEDITOR.editor )
|
||||
{
|
||||
/**
|
||||
* No element is linked to the editor instance.
|
||||
* @constant
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.ELEMENT_MODE_NONE = 0;
|
||||
|
||||
/**
|
||||
* The element is to be replaced by the editor instance.
|
||||
* @constant
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.ELEMENT_MODE_REPLACE = 1;
|
||||
|
||||
/**
|
||||
* The editor is to be created inside the element.
|
||||
* @constant
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.ELEMENT_MODE_APPENDTO = 2;
|
||||
|
||||
/**
|
||||
* Creates an editor class instance. This constructor should be rarely
|
||||
* used, in favor of the {@link CKEDITOR} editor creation functions.
|
||||
* @ class Represents an editor instance.
|
||||
* @param {Object} instanceConfig Configuration values for this specific
|
||||
* instance.
|
||||
* @param {CKEDITOR.dom.element} [element] The element linked to this
|
||||
* instance.
|
||||
* @param {Number} [mode] The mode in which the element is linked to this
|
||||
* instance. See {@link #elementMode}.
|
||||
* @param {String} [data] Since 3.3. Initial value for the instance.
|
||||
* @augments CKEDITOR.event
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.editor = function( instanceConfig, element, mode, data )
|
||||
{
|
||||
this._ =
|
||||
{
|
||||
// Save the config to be processed later by the full core code.
|
||||
instanceConfig : instanceConfig,
|
||||
element : element,
|
||||
data : data
|
||||
};
|
||||
|
||||
/**
|
||||
* The mode in which the {@link #element} is linked to this editor
|
||||
* instance. It can be any of the following values:
|
||||
* <ul>
|
||||
* <li>{@link CKEDITOR.ELEMENT_MODE_NONE}: No element is linked to the
|
||||
* editor instance.</li>
|
||||
* <li>{@link CKEDITOR.ELEMENT_MODE_REPLACE}: The element is to be
|
||||
* replaced by the editor instance.</li>
|
||||
* <li>{@link CKEDITOR.ELEMENT_MODE_APPENDTO}: The editor is to be
|
||||
* created inside the element.</li>
|
||||
* </ul>
|
||||
* @name CKEDITOR.editor.prototype.elementMode
|
||||
* @type Number
|
||||
* @example
|
||||
* var editor = CKEDITOR.replace( 'editor1' );
|
||||
* alert( <b>editor.elementMode</b> ); "1"
|
||||
*/
|
||||
this.elementMode = mode || CKEDITOR.ELEMENT_MODE_NONE;
|
||||
|
||||
// Call the CKEDITOR.event constructor to initialize this instance.
|
||||
CKEDITOR.event.call( this );
|
||||
|
||||
this._init();
|
||||
};
|
||||
|
||||
/**
|
||||
* Replaces a <textarea> or a DOM element (DIV) with a CKEditor
|
||||
* instance. For textareas, the initial value in the editor will be the
|
||||
* textarea value. For DOM elements, their innerHTML will be used
|
||||
* instead. We recommend using TEXTAREA and DIV elements only. Do not use
|
||||
* this function directly. Use {@link CKEDITOR.replace} instead.
|
||||
* @param {Object|String} elementOrIdOrName The DOM element (textarea), its
|
||||
* ID or name.
|
||||
* @param {Object} [config] The specific configurations to apply to this
|
||||
* editor instance. Configurations set here will override global CKEditor
|
||||
* settings.
|
||||
* @returns {CKEDITOR.editor} The editor instance created.
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.editor.replace = function( elementOrIdOrName, config )
|
||||
{
|
||||
var element = elementOrIdOrName;
|
||||
|
||||
if ( typeof element != 'object' )
|
||||
{
|
||||
// Look for the element by id. We accept any kind of element here.
|
||||
element = document.getElementById( elementOrIdOrName );
|
||||
|
||||
// Elements that should go into head are unacceptable (#6791).
|
||||
if ( element && element.tagName.toLowerCase() in {style:1,script:1,base:1,link:1,meta:1,title:1} )
|
||||
element = null;
|
||||
|
||||
// If not found, look for elements by name. In this case we accept only
|
||||
// textareas.
|
||||
if ( !element )
|
||||
{
|
||||
var i = 0,
|
||||
textareasByName = document.getElementsByName( elementOrIdOrName );
|
||||
|
||||
while ( ( element = textareasByName[ i++ ] ) && element.tagName.toLowerCase() != 'textarea' )
|
||||
{ /*jsl:pass*/ }
|
||||
}
|
||||
|
||||
if ( !element )
|
||||
throw '[CKEDITOR.editor.replace] The element with id or name "' + elementOrIdOrName + '" was not found.';
|
||||
}
|
||||
|
||||
// Do not replace the textarea right now, just hide it. The effective
|
||||
// replacement will be done by the _init function.
|
||||
element.style.visibility = 'hidden';
|
||||
|
||||
// Create the editor instance.
|
||||
return new CKEDITOR.editor( config, element, CKEDITOR.ELEMENT_MODE_REPLACE );
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a new editor instance inside a specific DOM element. Do not use
|
||||
* this function directly. Use {@link CKEDITOR.appendTo} instead.
|
||||
* @param {Object|String} elementOrId The DOM element or its ID.
|
||||
* @param {Object} [config] The specific configurations to apply to this
|
||||
* editor instance. Configurations set here will override global CKEditor
|
||||
* settings.
|
||||
* @param {String} [data] Since 3.3. Initial value for the instance.
|
||||
* @returns {CKEDITOR.editor} The editor instance created.
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.editor.appendTo = function( elementOrId, config, data )
|
||||
{
|
||||
var element = elementOrId;
|
||||
if ( typeof element != 'object' )
|
||||
{
|
||||
element = document.getElementById( elementOrId );
|
||||
|
||||
if ( !element )
|
||||
throw '[CKEDITOR.editor.appendTo] The element with id "' + elementOrId + '" was not found.';
|
||||
}
|
||||
|
||||
// Create the editor instance.
|
||||
return new CKEDITOR.editor( config, element, CKEDITOR.ELEMENT_MODE_APPENDTO, data );
|
||||
};
|
||||
|
||||
CKEDITOR.editor.prototype =
|
||||
{
|
||||
/**
|
||||
* Initializes the editor instance. This function will be overriden by the
|
||||
* full CKEDITOR.editor implementation (editor.js).
|
||||
* @private
|
||||
*/
|
||||
_init : function()
|
||||
{
|
||||
var pending = CKEDITOR.editor._pending || ( CKEDITOR.editor._pending = [] );
|
||||
pending.push( this );
|
||||
},
|
||||
|
||||
// Both fire and fireOnce will always pass this editor instance as the
|
||||
// "editor" param in CKEDITOR.event.fire. So, we override it to do that
|
||||
// automaticaly.
|
||||
|
||||
/** @ignore */
|
||||
fire : function( eventName, data )
|
||||
{
|
||||
return CKEDITOR.event.prototype.fire.call( this, eventName, data, this );
|
||||
},
|
||||
|
||||
/** @ignore */
|
||||
fireOnce : function( eventName, data )
|
||||
{
|
||||
return CKEDITOR.event.prototype.fireOnce.call( this, eventName, data, this );
|
||||
}
|
||||
};
|
||||
|
||||
// "Inherit" (copy actually) from CKEDITOR.event.
|
||||
CKEDITOR.event.implementOn( CKEDITOR.editor.prototype, true );
|
||||
}
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
if ( !CKEDITOR.editor )
|
||||
{
|
||||
/**
|
||||
* No element is linked to the editor instance.
|
||||
* @constant
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.ELEMENT_MODE_NONE = 0;
|
||||
|
||||
/**
|
||||
* The element is to be replaced by the editor instance.
|
||||
* @constant
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.ELEMENT_MODE_REPLACE = 1;
|
||||
|
||||
/**
|
||||
* The editor is to be created inside the element.
|
||||
* @constant
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.ELEMENT_MODE_APPENDTO = 2;
|
||||
|
||||
/**
|
||||
* Creates an editor class instance. This constructor should be rarely
|
||||
* used, in favor of the {@link CKEDITOR} editor creation functions.
|
||||
* @ class Represents an editor instance.
|
||||
* @param {Object} instanceConfig Configuration values for this specific
|
||||
* instance.
|
||||
* @param {CKEDITOR.dom.element} [element] The element linked to this
|
||||
* instance.
|
||||
* @param {Number} [mode] The mode in which the element is linked to this
|
||||
* instance. See {@link #elementMode}.
|
||||
* @param {String} [data] Since 3.3. Initial value for the instance.
|
||||
* @augments CKEDITOR.event
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.editor = function( instanceConfig, element, mode, data )
|
||||
{
|
||||
this._ =
|
||||
{
|
||||
// Save the config to be processed later by the full core code.
|
||||
instanceConfig : instanceConfig,
|
||||
element : element,
|
||||
data : data
|
||||
};
|
||||
|
||||
/**
|
||||
* The mode in which the {@link #element} is linked to this editor
|
||||
* instance. It can be any of the following values:
|
||||
* <ul>
|
||||
* <li>{@link CKEDITOR.ELEMENT_MODE_NONE}: No element is linked to the
|
||||
* editor instance.</li>
|
||||
* <li>{@link CKEDITOR.ELEMENT_MODE_REPLACE}: The element is to be
|
||||
* replaced by the editor instance.</li>
|
||||
* <li>{@link CKEDITOR.ELEMENT_MODE_APPENDTO}: The editor is to be
|
||||
* created inside the element.</li>
|
||||
* </ul>
|
||||
* @name CKEDITOR.editor.prototype.elementMode
|
||||
* @type Number
|
||||
* @example
|
||||
* var editor = CKEDITOR.replace( 'editor1' );
|
||||
* alert( <b>editor.elementMode</b> ); "1"
|
||||
*/
|
||||
this.elementMode = mode || CKEDITOR.ELEMENT_MODE_NONE;
|
||||
|
||||
// Call the CKEDITOR.event constructor to initialize this instance.
|
||||
CKEDITOR.event.call( this );
|
||||
|
||||
this._init();
|
||||
};
|
||||
|
||||
/**
|
||||
* Replaces a <textarea> or a DOM element (DIV) with a CKEditor
|
||||
* instance. For textareas, the initial value in the editor will be the
|
||||
* textarea value. For DOM elements, their innerHTML will be used
|
||||
* instead. We recommend using TEXTAREA and DIV elements only. Do not use
|
||||
* this function directly. Use {@link CKEDITOR.replace} instead.
|
||||
* @param {Object|String} elementOrIdOrName The DOM element (textarea), its
|
||||
* ID or name.
|
||||
* @param {Object} [config] The specific configurations to apply to this
|
||||
* editor instance. Configurations set here will override global CKEditor
|
||||
* settings.
|
||||
* @returns {CKEDITOR.editor} The editor instance created.
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.editor.replace = function( elementOrIdOrName, config )
|
||||
{
|
||||
var element = elementOrIdOrName;
|
||||
|
||||
if ( typeof element != 'object' )
|
||||
{
|
||||
// Look for the element by id. We accept any kind of element here.
|
||||
element = document.getElementById( elementOrIdOrName );
|
||||
|
||||
// Elements that should go into head are unacceptable (#6791).
|
||||
if ( element && element.tagName.toLowerCase() in {style:1,script:1,base:1,link:1,meta:1,title:1} )
|
||||
element = null;
|
||||
|
||||
// If not found, look for elements by name. In this case we accept only
|
||||
// textareas.
|
||||
if ( !element )
|
||||
{
|
||||
var i = 0,
|
||||
textareasByName = document.getElementsByName( elementOrIdOrName );
|
||||
|
||||
while ( ( element = textareasByName[ i++ ] ) && element.tagName.toLowerCase() != 'textarea' )
|
||||
{ /*jsl:pass*/ }
|
||||
}
|
||||
|
||||
if ( !element )
|
||||
throw '[CKEDITOR.editor.replace] The element with id or name "' + elementOrIdOrName + '" was not found.';
|
||||
}
|
||||
|
||||
// Do not replace the textarea right now, just hide it. The effective
|
||||
// replacement will be done by the _init function.
|
||||
element.style.visibility = 'hidden';
|
||||
|
||||
// Create the editor instance.
|
||||
return new CKEDITOR.editor( config, element, CKEDITOR.ELEMENT_MODE_REPLACE );
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a new editor instance inside a specific DOM element. Do not use
|
||||
* this function directly. Use {@link CKEDITOR.appendTo} instead.
|
||||
* @param {Object|String} elementOrId The DOM element or its ID.
|
||||
* @param {Object} [config] The specific configurations to apply to this
|
||||
* editor instance. Configurations set here will override global CKEditor
|
||||
* settings.
|
||||
* @param {String} [data] Since 3.3. Initial value for the instance.
|
||||
* @returns {CKEDITOR.editor} The editor instance created.
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.editor.appendTo = function( elementOrId, config, data )
|
||||
{
|
||||
var element = elementOrId;
|
||||
if ( typeof element != 'object' )
|
||||
{
|
||||
element = document.getElementById( elementOrId );
|
||||
|
||||
if ( !element )
|
||||
throw '[CKEDITOR.editor.appendTo] The element with id "' + elementOrId + '" was not found.';
|
||||
}
|
||||
|
||||
// Create the editor instance.
|
||||
return new CKEDITOR.editor( config, element, CKEDITOR.ELEMENT_MODE_APPENDTO, data );
|
||||
};
|
||||
|
||||
CKEDITOR.editor.prototype =
|
||||
{
|
||||
/**
|
||||
* Initializes the editor instance. This function will be overriden by the
|
||||
* full CKEDITOR.editor implementation (editor.js).
|
||||
* @private
|
||||
*/
|
||||
_init : function()
|
||||
{
|
||||
var pending = CKEDITOR.editor._pending || ( CKEDITOR.editor._pending = [] );
|
||||
pending.push( this );
|
||||
},
|
||||
|
||||
// Both fire and fireOnce will always pass this editor instance as the
|
||||
// "editor" param in CKEDITOR.event.fire. So, we override it to do that
|
||||
// automaticaly.
|
||||
|
||||
/** @ignore */
|
||||
fire : function( eventName, data )
|
||||
{
|
||||
return CKEDITOR.event.prototype.fire.call( this, eventName, data, this );
|
||||
},
|
||||
|
||||
/** @ignore */
|
||||
fireOnce : function( eventName, data )
|
||||
{
|
||||
return CKEDITOR.event.prototype.fireOnce.call( this, eventName, data, this );
|
||||
}
|
||||
};
|
||||
|
||||
// "Inherit" (copy actually) from CKEDITOR.event.
|
||||
CKEDITOR.event.implementOn( CKEDITOR.editor.prototype, true );
|
||||
}
|
||||
|
||||
@ -1,305 +1,305 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.env} object, which constains
|
||||
* environment and browser information.
|
||||
*/
|
||||
|
||||
if ( !CKEDITOR.env )
|
||||
{
|
||||
/**
|
||||
* @namespace Environment and browser information.
|
||||
*/
|
||||
CKEDITOR.env = (function()
|
||||
{
|
||||
var agent = navigator.userAgent.toLowerCase();
|
||||
var opera = window.opera;
|
||||
|
||||
var env =
|
||||
/** @lends CKEDITOR.env */
|
||||
{
|
||||
/**
|
||||
* Indicates that CKEditor is running on Internet Explorer.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.ie )
|
||||
* alert( "I'm on IE!" );
|
||||
*/
|
||||
ie : /*@cc_on!@*/false,
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on Opera.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.opera )
|
||||
* alert( "I'm on Opera!" );
|
||||
*/
|
||||
opera : ( !!opera && opera.version ),
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on a WebKit based browser, like
|
||||
* Safari.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.webkit )
|
||||
* alert( "I'm on WebKit!" );
|
||||
*/
|
||||
webkit : ( agent.indexOf( ' applewebkit/' ) > -1 ),
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on Adobe AIR.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.air )
|
||||
* alert( "I'm on AIR!" );
|
||||
*/
|
||||
air : ( agent.indexOf( ' adobeair/' ) > -1 ),
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on Macintosh.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.mac )
|
||||
* alert( "I love apples!" );
|
||||
*/
|
||||
mac : ( agent.indexOf( 'macintosh' ) > -1 ),
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on a quirks mode environemnt.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.quirks )
|
||||
* alert( "Nooooo!" );
|
||||
*/
|
||||
quirks : ( document.compatMode == 'BackCompat' ),
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on a mobile like environemnt.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.mobile )
|
||||
* alert( "I'm running with CKEditor today!" );
|
||||
*/
|
||||
mobile : ( agent.indexOf( 'mobile' ) > -1 ),
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on Apple iPhone/iPad/iPod devices.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.iOS )
|
||||
* alert( "I like little apples!" );
|
||||
*/
|
||||
iOS : /(ipad|iphone|ipod)/.test(agent),
|
||||
|
||||
/**
|
||||
* Indicates that the browser has a custom domain enabled. This has
|
||||
* been set with "document.domain".
|
||||
* @returns {Boolean} "true" if a custom domain is enabled.
|
||||
* @example
|
||||
* if ( CKEDITOR.env.isCustomDomain() )
|
||||
* alert( "I'm in a custom domain!" );
|
||||
*/
|
||||
isCustomDomain : function()
|
||||
{
|
||||
if ( !this.ie )
|
||||
return false;
|
||||
|
||||
var domain = document.domain,
|
||||
hostname = window.location.hostname;
|
||||
|
||||
return domain != hostname &&
|
||||
domain != ( '[' + hostname + ']' ); // IPv6 IP support (#5434)
|
||||
},
|
||||
|
||||
/**
|
||||
* Indicates that page is running under an encrypted connection.
|
||||
* @returns {Boolean} "true" if the page has an encrypted connection.
|
||||
* @example
|
||||
* if ( CKEDITOR.env.secure )
|
||||
* alert( "I'm in SSL!" );
|
||||
*/
|
||||
secure : location.protocol == 'https:'
|
||||
};
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on a Gecko based browser, like
|
||||
* Firefox.
|
||||
* @name CKEDITOR.env.gecko
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.gecko )
|
||||
* alert( "I'm riding a gecko!" );
|
||||
*/
|
||||
env.gecko = ( navigator.product == 'Gecko' && !env.webkit && !env.opera );
|
||||
|
||||
var version = 0;
|
||||
|
||||
// Internet Explorer 6.0+
|
||||
if ( env.ie )
|
||||
{
|
||||
version = parseFloat( agent.match( /msie (\d+)/ )[1] );
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on Internet Explorer 8.
|
||||
* @name CKEDITOR.env.ie8
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.ie8 )
|
||||
* alert( "I'm on IE8!" );
|
||||
*/
|
||||
env.ie8 = !!document.documentMode;
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on Internet Explorer 8 on
|
||||
* standards mode.
|
||||
* @name CKEDITOR.env.ie8Compat
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.ie8Compat )
|
||||
* alert( "Now I'm on IE8, for real!" );
|
||||
*/
|
||||
env.ie8Compat = document.documentMode == 8;
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on Internet Explorer 9's standards mode.
|
||||
* @name CKEDITOR.env.ie9Compat
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.ie9Compat )
|
||||
* alert( "IE9, the beauty of the web!" );
|
||||
*/
|
||||
env.ie9Compat = document.documentMode == 9;
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on an IE7-like environment, which
|
||||
* includes IE7 itself and IE8's IE7 document mode.
|
||||
* @name CKEDITOR.env.ie7Compat
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.ie8Compat )
|
||||
* alert( "I'm on IE7 or on an IE7 like IE8!" );
|
||||
*/
|
||||
env.ie7Compat = ( ( version == 7 && !document.documentMode )
|
||||
|| document.documentMode == 7 );
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on an IE6-like environment, which
|
||||
* includes IE6 itself and IE7 and IE8 quirks mode.
|
||||
* @name CKEDITOR.env.ie6Compat
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.ie6Compat )
|
||||
* alert( "I'm on IE6 or quirks mode!" );
|
||||
*/
|
||||
env.ie6Compat = ( version < 7 || env.quirks );
|
||||
}
|
||||
|
||||
// Gecko.
|
||||
if ( env.gecko )
|
||||
{
|
||||
var geckoRelease = agent.match( /rv:([\d\.]+)/ );
|
||||
if ( geckoRelease )
|
||||
{
|
||||
geckoRelease = geckoRelease[1].split( '.' );
|
||||
version = geckoRelease[0] * 10000 + ( geckoRelease[1] || 0 ) * 100 + ( geckoRelease[2] || 0 ) * 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Opera 9.50+
|
||||
if ( env.opera )
|
||||
version = parseFloat( opera.version() );
|
||||
|
||||
// Adobe AIR 1.0+
|
||||
// Checked before Safari because AIR have the WebKit rich text editor
|
||||
// features from Safari 3.0.4, but the version reported is 420.
|
||||
if ( env.air )
|
||||
version = parseFloat( agent.match( / adobeair\/(\d+)/ )[1] );
|
||||
|
||||
// WebKit 522+ (Safari 3+)
|
||||
if ( env.webkit )
|
||||
version = parseFloat( agent.match( / applewebkit\/(\d+)/ )[1] );
|
||||
|
||||
/**
|
||||
* Contains the browser version.<br />
|
||||
* <br />
|
||||
* For gecko based browsers (like Firefox) it contains the revision
|
||||
* number with first three parts concatenated with a padding zero
|
||||
* (e.g. for revision 1.9.0.2 we have 10900).<br />
|
||||
* <br />
|
||||
* For webkit based browser (like Safari and Chrome) it contains the
|
||||
* WebKit build version (e.g. 522).
|
||||
* @name CKEDITOR.env.version
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.ie && <b>CKEDITOR.env.version</b> <= 6 )
|
||||
* alert( "Ouch!" );
|
||||
*/
|
||||
env.version = version;
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on a compatible browser.
|
||||
* @name CKEDITOR.env.isCompatible
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.isCompatible )
|
||||
* alert( "Your browser is pretty cool!" );
|
||||
*/
|
||||
env.isCompatible =
|
||||
|
||||
// White list of mobile devices that supports.
|
||||
env.iOS && version >= 534 ||
|
||||
|
||||
!env.mobile && (
|
||||
|
||||
( env.ie && version >= 6 ) ||
|
||||
( env.gecko && version >= 10801 ) ||
|
||||
( env.opera && version >= 9.5 ) ||
|
||||
( env.air && version >= 1 ) ||
|
||||
( env.webkit && version >= 522 ) ||
|
||||
false );
|
||||
|
||||
/**
|
||||
* The CSS class to be appended on the main UI containers, making it
|
||||
* easy to apply browser specific styles to it.
|
||||
* @name CKEDITOR.env.cssClass
|
||||
* @type String
|
||||
* @example
|
||||
* myDiv.className = CKEDITOR.env.cssClass;
|
||||
*/
|
||||
env.cssClass =
|
||||
'cke_browser_' + (
|
||||
env.ie ? 'ie' :
|
||||
env.gecko ? 'gecko' :
|
||||
env.opera ? 'opera' :
|
||||
env.webkit ? 'webkit' :
|
||||
'unknown' );
|
||||
|
||||
if ( env.quirks )
|
||||
env.cssClass += ' cke_browser_quirks';
|
||||
|
||||
if ( env.ie )
|
||||
{
|
||||
env.cssClass += ' cke_browser_ie' + (
|
||||
env.version < 7 ? '6' :
|
||||
env.version >= 8 ? document.documentMode:
|
||||
'7' );
|
||||
|
||||
if ( env.quirks )
|
||||
env.cssClass += ' cke_browser_iequirks';
|
||||
}
|
||||
|
||||
if ( env.gecko && version < 10900 )
|
||||
env.cssClass += ' cke_browser_gecko18';
|
||||
|
||||
if ( env.air )
|
||||
env.cssClass += ' cke_browser_air';
|
||||
|
||||
return env;
|
||||
})();
|
||||
}
|
||||
|
||||
// PACKAGER_RENAME( CKEDITOR.env )
|
||||
// PACKAGER_RENAME( CKEDITOR.env.ie )
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.env} object, which constains
|
||||
* environment and browser information.
|
||||
*/
|
||||
|
||||
if ( !CKEDITOR.env )
|
||||
{
|
||||
/**
|
||||
* @namespace Environment and browser information.
|
||||
*/
|
||||
CKEDITOR.env = (function()
|
||||
{
|
||||
var agent = navigator.userAgent.toLowerCase();
|
||||
var opera = window.opera;
|
||||
|
||||
var env =
|
||||
/** @lends CKEDITOR.env */
|
||||
{
|
||||
/**
|
||||
* Indicates that CKEditor is running on Internet Explorer.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.ie )
|
||||
* alert( "I'm on IE!" );
|
||||
*/
|
||||
ie : /*@cc_on!@*/false,
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on Opera.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.opera )
|
||||
* alert( "I'm on Opera!" );
|
||||
*/
|
||||
opera : ( !!opera && opera.version ),
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on a WebKit based browser, like
|
||||
* Safari.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.webkit )
|
||||
* alert( "I'm on WebKit!" );
|
||||
*/
|
||||
webkit : ( agent.indexOf( ' applewebkit/' ) > -1 ),
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on Adobe AIR.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.air )
|
||||
* alert( "I'm on AIR!" );
|
||||
*/
|
||||
air : ( agent.indexOf( ' adobeair/' ) > -1 ),
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on Macintosh.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.mac )
|
||||
* alert( "I love apples!" );
|
||||
*/
|
||||
mac : ( agent.indexOf( 'macintosh' ) > -1 ),
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on a quirks mode environemnt.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.quirks )
|
||||
* alert( "Nooooo!" );
|
||||
*/
|
||||
quirks : ( document.compatMode == 'BackCompat' ),
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on a mobile like environemnt.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.mobile )
|
||||
* alert( "I'm running with CKEditor today!" );
|
||||
*/
|
||||
mobile : ( agent.indexOf( 'mobile' ) > -1 ),
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on Apple iPhone/iPad/iPod devices.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.iOS )
|
||||
* alert( "I like little apples!" );
|
||||
*/
|
||||
iOS : /(ipad|iphone|ipod)/.test(agent),
|
||||
|
||||
/**
|
||||
* Indicates that the browser has a custom domain enabled. This has
|
||||
* been set with "document.domain".
|
||||
* @returns {Boolean} "true" if a custom domain is enabled.
|
||||
* @example
|
||||
* if ( CKEDITOR.env.isCustomDomain() )
|
||||
* alert( "I'm in a custom domain!" );
|
||||
*/
|
||||
isCustomDomain : function()
|
||||
{
|
||||
if ( !this.ie )
|
||||
return false;
|
||||
|
||||
var domain = document.domain,
|
||||
hostname = window.location.hostname;
|
||||
|
||||
return domain != hostname &&
|
||||
domain != ( '[' + hostname + ']' ); // IPv6 IP support (#5434)
|
||||
},
|
||||
|
||||
/**
|
||||
* Indicates that page is running under an encrypted connection.
|
||||
* @returns {Boolean} "true" if the page has an encrypted connection.
|
||||
* @example
|
||||
* if ( CKEDITOR.env.secure )
|
||||
* alert( "I'm in SSL!" );
|
||||
*/
|
||||
secure : location.protocol == 'https:'
|
||||
};
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on a Gecko based browser, like
|
||||
* Firefox.
|
||||
* @name CKEDITOR.env.gecko
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.gecko )
|
||||
* alert( "I'm riding a gecko!" );
|
||||
*/
|
||||
env.gecko = ( navigator.product == 'Gecko' && !env.webkit && !env.opera );
|
||||
|
||||
var version = 0;
|
||||
|
||||
// Internet Explorer 6.0+
|
||||
if ( env.ie )
|
||||
{
|
||||
version = parseFloat( agent.match( /msie (\d+)/ )[1] );
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on Internet Explorer 8.
|
||||
* @name CKEDITOR.env.ie8
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.ie8 )
|
||||
* alert( "I'm on IE8!" );
|
||||
*/
|
||||
env.ie8 = !!document.documentMode;
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on Internet Explorer 8 on
|
||||
* standards mode.
|
||||
* @name CKEDITOR.env.ie8Compat
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.ie8Compat )
|
||||
* alert( "Now I'm on IE8, for real!" );
|
||||
*/
|
||||
env.ie8Compat = document.documentMode == 8;
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on Internet Explorer 9's standards mode.
|
||||
* @name CKEDITOR.env.ie9Compat
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.ie9Compat )
|
||||
* alert( "IE9, the beauty of the web!" );
|
||||
*/
|
||||
env.ie9Compat = document.documentMode == 9;
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on an IE7-like environment, which
|
||||
* includes IE7 itself and IE8's IE7 document mode.
|
||||
* @name CKEDITOR.env.ie7Compat
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.ie8Compat )
|
||||
* alert( "I'm on IE7 or on an IE7 like IE8!" );
|
||||
*/
|
||||
env.ie7Compat = ( ( version == 7 && !document.documentMode )
|
||||
|| document.documentMode == 7 );
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on an IE6-like environment, which
|
||||
* includes IE6 itself and IE7 and IE8 quirks mode.
|
||||
* @name CKEDITOR.env.ie6Compat
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.ie6Compat )
|
||||
* alert( "I'm on IE6 or quirks mode!" );
|
||||
*/
|
||||
env.ie6Compat = ( version < 7 || env.quirks );
|
||||
}
|
||||
|
||||
// Gecko.
|
||||
if ( env.gecko )
|
||||
{
|
||||
var geckoRelease = agent.match( /rv:([\d\.]+)/ );
|
||||
if ( geckoRelease )
|
||||
{
|
||||
geckoRelease = geckoRelease[1].split( '.' );
|
||||
version = geckoRelease[0] * 10000 + ( geckoRelease[1] || 0 ) * 100 + ( geckoRelease[2] || 0 ) * 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Opera 9.50+
|
||||
if ( env.opera )
|
||||
version = parseFloat( opera.version() );
|
||||
|
||||
// Adobe AIR 1.0+
|
||||
// Checked before Safari because AIR have the WebKit rich text editor
|
||||
// features from Safari 3.0.4, but the version reported is 420.
|
||||
if ( env.air )
|
||||
version = parseFloat( agent.match( / adobeair\/(\d+)/ )[1] );
|
||||
|
||||
// WebKit 522+ (Safari 3+)
|
||||
if ( env.webkit )
|
||||
version = parseFloat( agent.match( / applewebkit\/(\d+)/ )[1] );
|
||||
|
||||
/**
|
||||
* Contains the browser version.<br />
|
||||
* <br />
|
||||
* For gecko based browsers (like Firefox) it contains the revision
|
||||
* number with first three parts concatenated with a padding zero
|
||||
* (e.g. for revision 1.9.0.2 we have 10900).<br />
|
||||
* <br />
|
||||
* For webkit based browser (like Safari and Chrome) it contains the
|
||||
* WebKit build version (e.g. 522).
|
||||
* @name CKEDITOR.env.version
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.ie && <b>CKEDITOR.env.version</b> <= 6 )
|
||||
* alert( "Ouch!" );
|
||||
*/
|
||||
env.version = version;
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on a compatible browser.
|
||||
* @name CKEDITOR.env.isCompatible
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.isCompatible )
|
||||
* alert( "Your browser is pretty cool!" );
|
||||
*/
|
||||
env.isCompatible =
|
||||
|
||||
// White list of mobile devices that supports.
|
||||
env.iOS && version >= 534 ||
|
||||
|
||||
!env.mobile && (
|
||||
|
||||
( env.ie && version >= 6 ) ||
|
||||
( env.gecko && version >= 10801 ) ||
|
||||
( env.opera && version >= 9.5 ) ||
|
||||
( env.air && version >= 1 ) ||
|
||||
( env.webkit && version >= 522 ) ||
|
||||
false );
|
||||
|
||||
/**
|
||||
* The CSS class to be appended on the main UI containers, making it
|
||||
* easy to apply browser specific styles to it.
|
||||
* @name CKEDITOR.env.cssClass
|
||||
* @type String
|
||||
* @example
|
||||
* myDiv.className = CKEDITOR.env.cssClass;
|
||||
*/
|
||||
env.cssClass =
|
||||
'cke_browser_' + (
|
||||
env.ie ? 'ie' :
|
||||
env.gecko ? 'gecko' :
|
||||
env.opera ? 'opera' :
|
||||
env.webkit ? 'webkit' :
|
||||
'unknown' );
|
||||
|
||||
if ( env.quirks )
|
||||
env.cssClass += ' cke_browser_quirks';
|
||||
|
||||
if ( env.ie )
|
||||
{
|
||||
env.cssClass += ' cke_browser_ie' + (
|
||||
env.version < 7 ? '6' :
|
||||
env.version >= 8 ? document.documentMode:
|
||||
'7' );
|
||||
|
||||
if ( env.quirks )
|
||||
env.cssClass += ' cke_browser_iequirks';
|
||||
}
|
||||
|
||||
if ( env.gecko && version < 10900 )
|
||||
env.cssClass += ' cke_browser_gecko18';
|
||||
|
||||
if ( env.air )
|
||||
env.cssClass += ' cke_browser_air';
|
||||
|
||||
return env;
|
||||
})();
|
||||
}
|
||||
|
||||
// PACKAGER_RENAME( CKEDITOR.env )
|
||||
// PACKAGER_RENAME( CKEDITOR.env.ie )
|
||||
|
||||
@ -1,342 +1,342 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.event} class, which serves as the
|
||||
* base for classes and objects that require event handling features.
|
||||
*/
|
||||
|
||||
if ( !CKEDITOR.event )
|
||||
{
|
||||
/**
|
||||
* Creates an event class instance. This constructor is rearely used, being
|
||||
* the {@link #.implementOn} function used in class prototypes directly
|
||||
* instead.
|
||||
* @class This is a base class for classes and objects that require event
|
||||
* handling features.<br />
|
||||
* <br />
|
||||
* Do not confuse this class with {@link CKEDITOR.dom.event} which is
|
||||
* instead used for DOM events. The CKEDITOR.event class implements the
|
||||
* internal event system used by the CKEditor to fire API related events.
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.event = function()
|
||||
{};
|
||||
|
||||
/**
|
||||
* Implements the {@link CKEDITOR.event} features in an object.
|
||||
* @param {Object} targetObject The object into which implement the features.
|
||||
* @example
|
||||
* var myObject = { message : 'Example' };
|
||||
* <b>CKEDITOR.event.implementOn( myObject }</b>;
|
||||
* myObject.on( 'testEvent', function()
|
||||
* {
|
||||
* alert( this.message ); // "Example"
|
||||
* });
|
||||
* myObject.fire( 'testEvent' );
|
||||
*/
|
||||
CKEDITOR.event.implementOn = function( targetObject )
|
||||
{
|
||||
var eventProto = CKEDITOR.event.prototype;
|
||||
|
||||
for ( var prop in eventProto )
|
||||
{
|
||||
if ( targetObject[ prop ] == undefined )
|
||||
targetObject[ prop ] = eventProto[ prop ];
|
||||
}
|
||||
};
|
||||
|
||||
CKEDITOR.event.prototype = (function()
|
||||
{
|
||||
// Returns the private events object for a given object.
|
||||
var getPrivate = function( obj )
|
||||
{
|
||||
var _ = ( obj.getPrivate && obj.getPrivate() ) || obj._ || ( obj._ = {} );
|
||||
return _.events || ( _.events = {} );
|
||||
};
|
||||
|
||||
var eventEntry = function( eventName )
|
||||
{
|
||||
this.name = eventName;
|
||||
this.listeners = [];
|
||||
};
|
||||
|
||||
eventEntry.prototype =
|
||||
{
|
||||
// Get the listener index for a specified function.
|
||||
// Returns -1 if not found.
|
||||
getListenerIndex : function( listenerFunction )
|
||||
{
|
||||
for ( var i = 0, listeners = this.listeners ; i < listeners.length ; i++ )
|
||||
{
|
||||
if ( listeners[i].fn == listenerFunction )
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
return /** @lends CKEDITOR.event.prototype */ {
|
||||
/**
|
||||
* Registers a listener to a specific event in the current object.
|
||||
* @param {String} eventName The event name to which listen.
|
||||
* @param {Function} listenerFunction The function listening to the
|
||||
* event. A single {@link CKEDITOR.eventInfo} object instanced
|
||||
* is passed to this function containing all the event data.
|
||||
* @param {Object} [scopeObj] The object used to scope the listener
|
||||
* call (the this object. If omitted, the current object is used.
|
||||
* @param {Object} [listenerData] Data to be sent as the
|
||||
* {@link CKEDITOR.eventInfo#listenerData} when calling the
|
||||
* listener.
|
||||
* @param {Number} [priority] The listener priority. Lower priority
|
||||
* listeners are called first. Listeners with the same priority
|
||||
* value are called in registration order. Defaults to 10.
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function()
|
||||
* {
|
||||
* alert( this == someObject ); // "true"
|
||||
* });
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function()
|
||||
* {
|
||||
* alert( this == anotherObject ); // "true"
|
||||
* }
|
||||
* , anotherObject );
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* alert( event.listenerData ); // "Example"
|
||||
* }
|
||||
* , null, 'Example' );
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function() { ... } ); // 2nd called
|
||||
* someObject.on( 'someEvent', function() { ... }, null, null, 100 ); // 3rd called
|
||||
* someObject.on( 'someEvent', function() { ... }, null, null, 1 ); // 1st called
|
||||
*/
|
||||
on : function( eventName, listenerFunction, scopeObj, listenerData, priority )
|
||||
{
|
||||
// Get the event entry (create it if needed).
|
||||
var events = getPrivate( this ),
|
||||
event = events[ eventName ] || ( events[ eventName ] = new eventEntry( eventName ) );
|
||||
|
||||
if ( event.getListenerIndex( listenerFunction ) < 0 )
|
||||
{
|
||||
// Get the listeners.
|
||||
var listeners = event.listeners;
|
||||
|
||||
// Fill the scope.
|
||||
if ( !scopeObj )
|
||||
scopeObj = this;
|
||||
|
||||
// Default the priority, if needed.
|
||||
if ( isNaN( priority ) )
|
||||
priority = 10;
|
||||
|
||||
var me = this;
|
||||
|
||||
// Create the function to be fired for this listener.
|
||||
var listenerFirer = function( editor, publisherData, stopFn, cancelFn )
|
||||
{
|
||||
var ev =
|
||||
{
|
||||
name : eventName,
|
||||
sender : this,
|
||||
editor : editor,
|
||||
data : publisherData,
|
||||
listenerData : listenerData,
|
||||
stop : stopFn,
|
||||
cancel : cancelFn,
|
||||
removeListener : function()
|
||||
{
|
||||
me.removeListener( eventName, listenerFunction );
|
||||
}
|
||||
};
|
||||
|
||||
listenerFunction.call( scopeObj, ev );
|
||||
|
||||
return ev.data;
|
||||
};
|
||||
listenerFirer.fn = listenerFunction;
|
||||
listenerFirer.priority = priority;
|
||||
|
||||
// Search for the right position for this new listener, based on its
|
||||
// priority.
|
||||
for ( var i = listeners.length - 1 ; i >= 0 ; i-- )
|
||||
{
|
||||
// Find the item which should be before the new one.
|
||||
if ( listeners[ i ].priority <= priority )
|
||||
{
|
||||
// Insert the listener in the array.
|
||||
listeners.splice( i + 1, 0, listenerFirer );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// If no position has been found (or zero length), put it in
|
||||
// the front of list.
|
||||
listeners.unshift( listenerFirer );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Fires an specific event in the object. All registered listeners are
|
||||
* called at this point.
|
||||
* @function
|
||||
* @param {String} eventName The event name to fire.
|
||||
* @param {Object} [data] Data to be sent as the
|
||||
* {@link CKEDITOR.eventInfo#data} when calling the
|
||||
* listeners.
|
||||
* @param {CKEDITOR.editor} [editor] The editor instance to send as the
|
||||
* {@link CKEDITOR.eventInfo#editor} when calling the
|
||||
* listener.
|
||||
* @returns {Boolean|Object} A booloan indicating that the event is to be
|
||||
* canceled, or data returned by one of the listeners.
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function() { ... } );
|
||||
* someObject.on( 'someEvent', function() { ... } );
|
||||
* <b>someObject.fire( 'someEvent' )</b>; // both listeners are called
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* alert( event.data ); // "Example"
|
||||
* });
|
||||
* <b>someObject.fire( 'someEvent', 'Example' )</b>;
|
||||
*/
|
||||
fire : (function()
|
||||
{
|
||||
// Create the function that marks the event as stopped.
|
||||
var stopped = false;
|
||||
var stopEvent = function()
|
||||
{
|
||||
stopped = true;
|
||||
};
|
||||
|
||||
// Create the function that marks the event as canceled.
|
||||
var canceled = false;
|
||||
var cancelEvent = function()
|
||||
{
|
||||
canceled = true;
|
||||
};
|
||||
|
||||
return function( eventName, data, editor )
|
||||
{
|
||||
// Get the event entry.
|
||||
var event = getPrivate( this )[ eventName ];
|
||||
|
||||
// Save the previous stopped and cancelled states. We may
|
||||
// be nesting fire() calls.
|
||||
var previousStopped = stopped,
|
||||
previousCancelled = canceled;
|
||||
|
||||
// Reset the stopped and canceled flags.
|
||||
stopped = canceled = false;
|
||||
|
||||
if ( event )
|
||||
{
|
||||
var listeners = event.listeners;
|
||||
|
||||
if ( listeners.length )
|
||||
{
|
||||
// As some listeners may remove themselves from the
|
||||
// event, the original array length is dinamic. So,
|
||||
// let's make a copy of all listeners, so we are
|
||||
// sure we'll call all of them.
|
||||
listeners = listeners.slice( 0 );
|
||||
|
||||
// Loop through all listeners.
|
||||
for ( var i = 0 ; i < listeners.length ; i++ )
|
||||
{
|
||||
// Call the listener, passing the event data.
|
||||
var retData = listeners[i].call( this, editor, data, stopEvent, cancelEvent );
|
||||
|
||||
if ( typeof retData != 'undefined' )
|
||||
data = retData;
|
||||
|
||||
// No further calls is stopped or canceled.
|
||||
if ( stopped || canceled )
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var ret = canceled || ( typeof data == 'undefined' ? false : data );
|
||||
|
||||
// Restore the previous stopped and canceled states.
|
||||
stopped = previousStopped;
|
||||
canceled = previousCancelled;
|
||||
|
||||
return ret;
|
||||
};
|
||||
})(),
|
||||
|
||||
/**
|
||||
* Fires an specific event in the object, releasing all listeners
|
||||
* registered to that event. The same listeners are not called again on
|
||||
* successive calls of it or of {@link #fire}.
|
||||
* @param {String} eventName The event name to fire.
|
||||
* @param {Object} [data] Data to be sent as the
|
||||
* {@link CKEDITOR.eventInfo#data} when calling the
|
||||
* listeners.
|
||||
* @param {CKEDITOR.editor} [editor] The editor instance to send as the
|
||||
* {@link CKEDITOR.eventInfo#editor} when calling the
|
||||
* listener.
|
||||
* @returns {Boolean|Object} A booloan indicating that the event is to be
|
||||
* canceled, or data returned by one of the listeners.
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function() { ... } );
|
||||
* someObject.fire( 'someEvent' ); // above listener called
|
||||
* <b>someObject.fireOnce( 'someEvent' )</b>; // above listener called
|
||||
* someObject.fire( 'someEvent' ); // no listeners called
|
||||
*/
|
||||
fireOnce : function( eventName, data, editor )
|
||||
{
|
||||
var ret = this.fire( eventName, data, editor );
|
||||
delete getPrivate( this )[ eventName ];
|
||||
return ret;
|
||||
},
|
||||
|
||||
/**
|
||||
* Unregisters a listener function from being called at the specified
|
||||
* event. No errors are thrown if the listener has not been
|
||||
* registered previously.
|
||||
* @param {String} eventName The event name.
|
||||
* @param {Function} listenerFunction The listener function to unregister.
|
||||
* @example
|
||||
* var myListener = function() { ... };
|
||||
* someObject.on( 'someEvent', myListener );
|
||||
* someObject.fire( 'someEvent' ); // myListener called
|
||||
* <b>someObject.removeListener( 'someEvent', myListener )</b>;
|
||||
* someObject.fire( 'someEvent' ); // myListener not called
|
||||
*/
|
||||
removeListener : function( eventName, listenerFunction )
|
||||
{
|
||||
// Get the event entry.
|
||||
var event = getPrivate( this )[ eventName ];
|
||||
|
||||
if ( event )
|
||||
{
|
||||
var index = event.getListenerIndex( listenerFunction );
|
||||
if ( index >= 0 )
|
||||
event.listeners.splice( index, 1 );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks if there is any listener registered to a given event.
|
||||
* @param {String} eventName The event name.
|
||||
* @example
|
||||
* var myListener = function() { ... };
|
||||
* someObject.on( 'someEvent', myListener );
|
||||
* alert( someObject.<b>hasListeners( 'someEvent' )</b> ); // "true"
|
||||
* alert( someObject.<b>hasListeners( 'noEvent' )</b> ); // "false"
|
||||
*/
|
||||
hasListeners : function( eventName )
|
||||
{
|
||||
var event = getPrivate( this )[ eventName ];
|
||||
return ( event && event.listeners.length > 0 ) ;
|
||||
}
|
||||
};
|
||||
})();
|
||||
}
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.event} class, which serves as the
|
||||
* base for classes and objects that require event handling features.
|
||||
*/
|
||||
|
||||
if ( !CKEDITOR.event )
|
||||
{
|
||||
/**
|
||||
* Creates an event class instance. This constructor is rearely used, being
|
||||
* the {@link #.implementOn} function used in class prototypes directly
|
||||
* instead.
|
||||
* @class This is a base class for classes and objects that require event
|
||||
* handling features.<br />
|
||||
* <br />
|
||||
* Do not confuse this class with {@link CKEDITOR.dom.event} which is
|
||||
* instead used for DOM events. The CKEDITOR.event class implements the
|
||||
* internal event system used by the CKEditor to fire API related events.
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.event = function()
|
||||
{};
|
||||
|
||||
/**
|
||||
* Implements the {@link CKEDITOR.event} features in an object.
|
||||
* @param {Object} targetObject The object into which implement the features.
|
||||
* @example
|
||||
* var myObject = { message : 'Example' };
|
||||
* <b>CKEDITOR.event.implementOn( myObject }</b>;
|
||||
* myObject.on( 'testEvent', function()
|
||||
* {
|
||||
* alert( this.message ); // "Example"
|
||||
* });
|
||||
* myObject.fire( 'testEvent' );
|
||||
*/
|
||||
CKEDITOR.event.implementOn = function( targetObject )
|
||||
{
|
||||
var eventProto = CKEDITOR.event.prototype;
|
||||
|
||||
for ( var prop in eventProto )
|
||||
{
|
||||
if ( targetObject[ prop ] == undefined )
|
||||
targetObject[ prop ] = eventProto[ prop ];
|
||||
}
|
||||
};
|
||||
|
||||
CKEDITOR.event.prototype = (function()
|
||||
{
|
||||
// Returns the private events object for a given object.
|
||||
var getPrivate = function( obj )
|
||||
{
|
||||
var _ = ( obj.getPrivate && obj.getPrivate() ) || obj._ || ( obj._ = {} );
|
||||
return _.events || ( _.events = {} );
|
||||
};
|
||||
|
||||
var eventEntry = function( eventName )
|
||||
{
|
||||
this.name = eventName;
|
||||
this.listeners = [];
|
||||
};
|
||||
|
||||
eventEntry.prototype =
|
||||
{
|
||||
// Get the listener index for a specified function.
|
||||
// Returns -1 if not found.
|
||||
getListenerIndex : function( listenerFunction )
|
||||
{
|
||||
for ( var i = 0, listeners = this.listeners ; i < listeners.length ; i++ )
|
||||
{
|
||||
if ( listeners[i].fn == listenerFunction )
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
return /** @lends CKEDITOR.event.prototype */ {
|
||||
/**
|
||||
* Registers a listener to a specific event in the current object.
|
||||
* @param {String} eventName The event name to which listen.
|
||||
* @param {Function} listenerFunction The function listening to the
|
||||
* event. A single {@link CKEDITOR.eventInfo} object instanced
|
||||
* is passed to this function containing all the event data.
|
||||
* @param {Object} [scopeObj] The object used to scope the listener
|
||||
* call (the this object. If omitted, the current object is used.
|
||||
* @param {Object} [listenerData] Data to be sent as the
|
||||
* {@link CKEDITOR.eventInfo#listenerData} when calling the
|
||||
* listener.
|
||||
* @param {Number} [priority] The listener priority. Lower priority
|
||||
* listeners are called first. Listeners with the same priority
|
||||
* value are called in registration order. Defaults to 10.
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function()
|
||||
* {
|
||||
* alert( this == someObject ); // "true"
|
||||
* });
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function()
|
||||
* {
|
||||
* alert( this == anotherObject ); // "true"
|
||||
* }
|
||||
* , anotherObject );
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* alert( event.listenerData ); // "Example"
|
||||
* }
|
||||
* , null, 'Example' );
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function() { ... } ); // 2nd called
|
||||
* someObject.on( 'someEvent', function() { ... }, null, null, 100 ); // 3rd called
|
||||
* someObject.on( 'someEvent', function() { ... }, null, null, 1 ); // 1st called
|
||||
*/
|
||||
on : function( eventName, listenerFunction, scopeObj, listenerData, priority )
|
||||
{
|
||||
// Get the event entry (create it if needed).
|
||||
var events = getPrivate( this ),
|
||||
event = events[ eventName ] || ( events[ eventName ] = new eventEntry( eventName ) );
|
||||
|
||||
if ( event.getListenerIndex( listenerFunction ) < 0 )
|
||||
{
|
||||
// Get the listeners.
|
||||
var listeners = event.listeners;
|
||||
|
||||
// Fill the scope.
|
||||
if ( !scopeObj )
|
||||
scopeObj = this;
|
||||
|
||||
// Default the priority, if needed.
|
||||
if ( isNaN( priority ) )
|
||||
priority = 10;
|
||||
|
||||
var me = this;
|
||||
|
||||
// Create the function to be fired for this listener.
|
||||
var listenerFirer = function( editor, publisherData, stopFn, cancelFn )
|
||||
{
|
||||
var ev =
|
||||
{
|
||||
name : eventName,
|
||||
sender : this,
|
||||
editor : editor,
|
||||
data : publisherData,
|
||||
listenerData : listenerData,
|
||||
stop : stopFn,
|
||||
cancel : cancelFn,
|
||||
removeListener : function()
|
||||
{
|
||||
me.removeListener( eventName, listenerFunction );
|
||||
}
|
||||
};
|
||||
|
||||
listenerFunction.call( scopeObj, ev );
|
||||
|
||||
return ev.data;
|
||||
};
|
||||
listenerFirer.fn = listenerFunction;
|
||||
listenerFirer.priority = priority;
|
||||
|
||||
// Search for the right position for this new listener, based on its
|
||||
// priority.
|
||||
for ( var i = listeners.length - 1 ; i >= 0 ; i-- )
|
||||
{
|
||||
// Find the item which should be before the new one.
|
||||
if ( listeners[ i ].priority <= priority )
|
||||
{
|
||||
// Insert the listener in the array.
|
||||
listeners.splice( i + 1, 0, listenerFirer );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// If no position has been found (or zero length), put it in
|
||||
// the front of list.
|
||||
listeners.unshift( listenerFirer );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Fires an specific event in the object. All registered listeners are
|
||||
* called at this point.
|
||||
* @function
|
||||
* @param {String} eventName The event name to fire.
|
||||
* @param {Object} [data] Data to be sent as the
|
||||
* {@link CKEDITOR.eventInfo#data} when calling the
|
||||
* listeners.
|
||||
* @param {CKEDITOR.editor} [editor] The editor instance to send as the
|
||||
* {@link CKEDITOR.eventInfo#editor} when calling the
|
||||
* listener.
|
||||
* @returns {Boolean|Object} A booloan indicating that the event is to be
|
||||
* canceled, or data returned by one of the listeners.
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function() { ... } );
|
||||
* someObject.on( 'someEvent', function() { ... } );
|
||||
* <b>someObject.fire( 'someEvent' )</b>; // both listeners are called
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* alert( event.data ); // "Example"
|
||||
* });
|
||||
* <b>someObject.fire( 'someEvent', 'Example' )</b>;
|
||||
*/
|
||||
fire : (function()
|
||||
{
|
||||
// Create the function that marks the event as stopped.
|
||||
var stopped = false;
|
||||
var stopEvent = function()
|
||||
{
|
||||
stopped = true;
|
||||
};
|
||||
|
||||
// Create the function that marks the event as canceled.
|
||||
var canceled = false;
|
||||
var cancelEvent = function()
|
||||
{
|
||||
canceled = true;
|
||||
};
|
||||
|
||||
return function( eventName, data, editor )
|
||||
{
|
||||
// Get the event entry.
|
||||
var event = getPrivate( this )[ eventName ];
|
||||
|
||||
// Save the previous stopped and cancelled states. We may
|
||||
// be nesting fire() calls.
|
||||
var previousStopped = stopped,
|
||||
previousCancelled = canceled;
|
||||
|
||||
// Reset the stopped and canceled flags.
|
||||
stopped = canceled = false;
|
||||
|
||||
if ( event )
|
||||
{
|
||||
var listeners = event.listeners;
|
||||
|
||||
if ( listeners.length )
|
||||
{
|
||||
// As some listeners may remove themselves from the
|
||||
// event, the original array length is dinamic. So,
|
||||
// let's make a copy of all listeners, so we are
|
||||
// sure we'll call all of them.
|
||||
listeners = listeners.slice( 0 );
|
||||
|
||||
// Loop through all listeners.
|
||||
for ( var i = 0 ; i < listeners.length ; i++ )
|
||||
{
|
||||
// Call the listener, passing the event data.
|
||||
var retData = listeners[i].call( this, editor, data, stopEvent, cancelEvent );
|
||||
|
||||
if ( typeof retData != 'undefined' )
|
||||
data = retData;
|
||||
|
||||
// No further calls is stopped or canceled.
|
||||
if ( stopped || canceled )
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var ret = canceled || ( typeof data == 'undefined' ? false : data );
|
||||
|
||||
// Restore the previous stopped and canceled states.
|
||||
stopped = previousStopped;
|
||||
canceled = previousCancelled;
|
||||
|
||||
return ret;
|
||||
};
|
||||
})(),
|
||||
|
||||
/**
|
||||
* Fires an specific event in the object, releasing all listeners
|
||||
* registered to that event. The same listeners are not called again on
|
||||
* successive calls of it or of {@link #fire}.
|
||||
* @param {String} eventName The event name to fire.
|
||||
* @param {Object} [data] Data to be sent as the
|
||||
* {@link CKEDITOR.eventInfo#data} when calling the
|
||||
* listeners.
|
||||
* @param {CKEDITOR.editor} [editor] The editor instance to send as the
|
||||
* {@link CKEDITOR.eventInfo#editor} when calling the
|
||||
* listener.
|
||||
* @returns {Boolean|Object} A booloan indicating that the event is to be
|
||||
* canceled, or data returned by one of the listeners.
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function() { ... } );
|
||||
* someObject.fire( 'someEvent' ); // above listener called
|
||||
* <b>someObject.fireOnce( 'someEvent' )</b>; // above listener called
|
||||
* someObject.fire( 'someEvent' ); // no listeners called
|
||||
*/
|
||||
fireOnce : function( eventName, data, editor )
|
||||
{
|
||||
var ret = this.fire( eventName, data, editor );
|
||||
delete getPrivate( this )[ eventName ];
|
||||
return ret;
|
||||
},
|
||||
|
||||
/**
|
||||
* Unregisters a listener function from being called at the specified
|
||||
* event. No errors are thrown if the listener has not been
|
||||
* registered previously.
|
||||
* @param {String} eventName The event name.
|
||||
* @param {Function} listenerFunction The listener function to unregister.
|
||||
* @example
|
||||
* var myListener = function() { ... };
|
||||
* someObject.on( 'someEvent', myListener );
|
||||
* someObject.fire( 'someEvent' ); // myListener called
|
||||
* <b>someObject.removeListener( 'someEvent', myListener )</b>;
|
||||
* someObject.fire( 'someEvent' ); // myListener not called
|
||||
*/
|
||||
removeListener : function( eventName, listenerFunction )
|
||||
{
|
||||
// Get the event entry.
|
||||
var event = getPrivate( this )[ eventName ];
|
||||
|
||||
if ( event )
|
||||
{
|
||||
var index = event.getListenerIndex( listenerFunction );
|
||||
if ( index >= 0 )
|
||||
event.listeners.splice( index, 1 );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks if there is any listener registered to a given event.
|
||||
* @param {String} eventName The event name.
|
||||
* @example
|
||||
* var myListener = function() { ... };
|
||||
* someObject.on( 'someEvent', myListener );
|
||||
* alert( someObject.<b>hasListeners( 'someEvent' )</b> ); // "true"
|
||||
* alert( someObject.<b>hasListeners( 'noEvent' )</b> ); // "false"
|
||||
*/
|
||||
hasListeners : function( eventName )
|
||||
{
|
||||
var event = getPrivate( this )[ eventName ];
|
||||
return ( event && event.listeners.length > 0 ) ;
|
||||
}
|
||||
};
|
||||
})();
|
||||
}
|
||||
|
||||
@ -1,132 +1,132 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the "virtual" {@link CKEDITOR.eventInfo} class, which
|
||||
* contains the defintions of the event object passed to event listeners.
|
||||
* This file is for documentation purposes only.
|
||||
*/
|
||||
|
||||
/**
|
||||
* (Virtual Class) Do not call this constructor. This class is not really part
|
||||
* of the API.
|
||||
* @class Virtual class that illustrates the features of the event object to be
|
||||
* passed to event listeners by a {@link CKEDITOR.event} based object.
|
||||
* @name CKEDITOR.eventInfo
|
||||
* @example
|
||||
* // Do not do this.
|
||||
* var myEvent = new CKEDITOR.eventInfo(); // Error: CKEDITOR.eventInfo is undefined
|
||||
*/
|
||||
|
||||
/**
|
||||
* The event name.
|
||||
* @name CKEDITOR.eventInfo.prototype.name
|
||||
* @field
|
||||
* @type String
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* alert( <b>event.name</b> ); // "someEvent"
|
||||
* });
|
||||
* someObject.fire( 'someEvent' );
|
||||
*/
|
||||
|
||||
/**
|
||||
* The object that publishes (sends) the event.
|
||||
* @name CKEDITOR.eventInfo.prototype.sender
|
||||
* @field
|
||||
* @type Object
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* alert( <b>event.sender</b> == someObject ); // "true"
|
||||
* });
|
||||
* someObject.fire( 'someEvent' );
|
||||
*/
|
||||
|
||||
/**
|
||||
* The editor instance that holds the sender. May be the same as sender. May be
|
||||
* null if the sender is not part of an editor instance, like a component
|
||||
* running in standalone mode.
|
||||
* @name CKEDITOR.eventInfo.prototype.editor
|
||||
* @field
|
||||
* @type CKEDITOR.editor
|
||||
* @example
|
||||
* myButton.on( 'someEvent', function( event )
|
||||
* {
|
||||
* alert( <b>event.editor</b> == myEditor ); // "true"
|
||||
* });
|
||||
* myButton.fire( 'someEvent', null, <b>myEditor</b> );
|
||||
*/
|
||||
|
||||
/**
|
||||
* Any kind of additional data. Its format and usage is event dependent.
|
||||
* @name CKEDITOR.eventInfo.prototype.data
|
||||
* @field
|
||||
* @type Object
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* alert( <b>event.data</b> ); // "Example"
|
||||
* });
|
||||
* someObject.fire( 'someEvent', <b>'Example'</b> );
|
||||
*/
|
||||
|
||||
/**
|
||||
* Any extra data appended during the listener registration.
|
||||
* @name CKEDITOR.eventInfo.prototype.listenerData
|
||||
* @field
|
||||
* @type Object
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* alert( <b>event.listenerData</b> ); // "Example"
|
||||
* }
|
||||
* , null, <b>'Example'</b> );
|
||||
*/
|
||||
|
||||
/**
|
||||
* Indicates that no further listeners are to be called.
|
||||
* @name CKEDITOR.eventInfo.prototype.stop
|
||||
* @function
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* <b>event.stop()</b>;
|
||||
* });
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* // This one will not be called.
|
||||
* });
|
||||
* alert( someObject.fire( 'someEvent' ) ); // "false"
|
||||
*/
|
||||
|
||||
/**
|
||||
* Indicates that the event is to be cancelled (if cancelable).
|
||||
* @name CKEDITOR.eventInfo.prototype.cancel
|
||||
* @function
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* <b>event.cancel()</b>;
|
||||
* });
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* // This one will not be called.
|
||||
* });
|
||||
* alert( someObject.fire( 'someEvent' ) ); // "true"
|
||||
*/
|
||||
|
||||
/**
|
||||
* Removes the current listener.
|
||||
* @name CKEDITOR.eventInfo.prototype.removeListener
|
||||
* @function
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* <b>event.removeListener()</b>;
|
||||
* // Now this function won't be called again by 'someEvent'
|
||||
* });
|
||||
*/
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the "virtual" {@link CKEDITOR.eventInfo} class, which
|
||||
* contains the defintions of the event object passed to event listeners.
|
||||
* This file is for documentation purposes only.
|
||||
*/
|
||||
|
||||
/**
|
||||
* (Virtual Class) Do not call this constructor. This class is not really part
|
||||
* of the API.
|
||||
* @class Virtual class that illustrates the features of the event object to be
|
||||
* passed to event listeners by a {@link CKEDITOR.event} based object.
|
||||
* @name CKEDITOR.eventInfo
|
||||
* @example
|
||||
* // Do not do this.
|
||||
* var myEvent = new CKEDITOR.eventInfo(); // Error: CKEDITOR.eventInfo is undefined
|
||||
*/
|
||||
|
||||
/**
|
||||
* The event name.
|
||||
* @name CKEDITOR.eventInfo.prototype.name
|
||||
* @field
|
||||
* @type String
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* alert( <b>event.name</b> ); // "someEvent"
|
||||
* });
|
||||
* someObject.fire( 'someEvent' );
|
||||
*/
|
||||
|
||||
/**
|
||||
* The object that publishes (sends) the event.
|
||||
* @name CKEDITOR.eventInfo.prototype.sender
|
||||
* @field
|
||||
* @type Object
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* alert( <b>event.sender</b> == someObject ); // "true"
|
||||
* });
|
||||
* someObject.fire( 'someEvent' );
|
||||
*/
|
||||
|
||||
/**
|
||||
* The editor instance that holds the sender. May be the same as sender. May be
|
||||
* null if the sender is not part of an editor instance, like a component
|
||||
* running in standalone mode.
|
||||
* @name CKEDITOR.eventInfo.prototype.editor
|
||||
* @field
|
||||
* @type CKEDITOR.editor
|
||||
* @example
|
||||
* myButton.on( 'someEvent', function( event )
|
||||
* {
|
||||
* alert( <b>event.editor</b> == myEditor ); // "true"
|
||||
* });
|
||||
* myButton.fire( 'someEvent', null, <b>myEditor</b> );
|
||||
*/
|
||||
|
||||
/**
|
||||
* Any kind of additional data. Its format and usage is event dependent.
|
||||
* @name CKEDITOR.eventInfo.prototype.data
|
||||
* @field
|
||||
* @type Object
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* alert( <b>event.data</b> ); // "Example"
|
||||
* });
|
||||
* someObject.fire( 'someEvent', <b>'Example'</b> );
|
||||
*/
|
||||
|
||||
/**
|
||||
* Any extra data appended during the listener registration.
|
||||
* @name CKEDITOR.eventInfo.prototype.listenerData
|
||||
* @field
|
||||
* @type Object
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* alert( <b>event.listenerData</b> ); // "Example"
|
||||
* }
|
||||
* , null, <b>'Example'</b> );
|
||||
*/
|
||||
|
||||
/**
|
||||
* Indicates that no further listeners are to be called.
|
||||
* @name CKEDITOR.eventInfo.prototype.stop
|
||||
* @function
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* <b>event.stop()</b>;
|
||||
* });
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* // This one will not be called.
|
||||
* });
|
||||
* alert( someObject.fire( 'someEvent' ) ); // "false"
|
||||
*/
|
||||
|
||||
/**
|
||||
* Indicates that the event is to be cancelled (if cancelable).
|
||||
* @name CKEDITOR.eventInfo.prototype.cancel
|
||||
* @function
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* <b>event.cancel()</b>;
|
||||
* });
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* // This one will not be called.
|
||||
* });
|
||||
* alert( someObject.fire( 'someEvent' ) ); // "true"
|
||||
*/
|
||||
|
||||
/**
|
||||
* Removes the current listener.
|
||||
* @name CKEDITOR.eventInfo.prototype.removeListener
|
||||
* @function
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* <b>event.removeListener()</b>;
|
||||
* // Now this function won't be called again by 'someEvent'
|
||||
* });
|
||||
*/
|
||||
|
||||
@ -1,152 +1,152 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.focusManager} class, which is used
|
||||
* to handle the focus on editor instances..
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates a focusManager class instance.
|
||||
* @class Manages the focus activity in an editor instance. This class is to be
|
||||
* used mainly by UI elements coders when adding interface elements that need
|
||||
* to set the focus state of the editor.
|
||||
* @param {CKEDITOR.editor} editor The editor instance.
|
||||
* @example
|
||||
* var focusManager = <b>new CKEDITOR.focusManager( editor )</b>;
|
||||
* focusManager.focus();
|
||||
*/
|
||||
CKEDITOR.focusManager = function( editor )
|
||||
{
|
||||
if ( editor.focusManager )
|
||||
return editor.focusManager;
|
||||
|
||||
/**
|
||||
* Indicates that the editor instance has focus.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* alert( CKEDITOR.instances.editor1.focusManager.hasFocus ); // e.g "true"
|
||||
*/
|
||||
this.hasFocus = false;
|
||||
|
||||
/**
|
||||
* Object used to hold private stuff.
|
||||
* @private
|
||||
*/
|
||||
this._ =
|
||||
{
|
||||
editor : editor
|
||||
};
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
CKEDITOR.focusManager.prototype =
|
||||
{
|
||||
/**
|
||||
* Used to indicate that the editor instance has the focus.<br />
|
||||
* <br />
|
||||
* Note that this function will not explicitelly set the focus in the
|
||||
* editor (for example, making the caret blinking on it). Use
|
||||
* {@link CKEDITOR.editor#focus} for it instead.
|
||||
* @example
|
||||
* var editor = CKEDITOR.instances.editor1;
|
||||
* <b>editor.focusManager.focus()</b>;
|
||||
*/
|
||||
focus : function()
|
||||
{
|
||||
if ( this._.timer )
|
||||
clearTimeout( this._.timer );
|
||||
|
||||
if ( !this.hasFocus )
|
||||
{
|
||||
// If another editor has the current focus, we first "blur" it. In
|
||||
// this way the events happen in a more logical sequence, like:
|
||||
// "focus 1" > "blur 1" > "focus 2"
|
||||
// ... instead of:
|
||||
// "focus 1" > "focus 2" > "blur 1"
|
||||
if ( CKEDITOR.currentInstance )
|
||||
CKEDITOR.currentInstance.focusManager.forceBlur();
|
||||
|
||||
var editor = this._.editor;
|
||||
|
||||
editor.container.getChild( 1 ).addClass( 'cke_focus' );
|
||||
|
||||
this.hasFocus = true;
|
||||
editor.fire( 'focus' );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Used to indicate that the editor instance has lost the focus.<br />
|
||||
* <br />
|
||||
* Note that this functions acts asynchronously with a delay of 100ms to
|
||||
* avoid subsequent blur/focus effects. If you want the "blur" to happen
|
||||
* immediately, use the {@link #forceBlur} function instead.
|
||||
* @example
|
||||
* var editor = CKEDITOR.instances.editor1;
|
||||
* <b>editor.focusManager.blur()</b>;
|
||||
*/
|
||||
blur : function()
|
||||
{
|
||||
var focusManager = this;
|
||||
|
||||
if ( focusManager._.timer )
|
||||
clearTimeout( focusManager._.timer );
|
||||
|
||||
focusManager._.timer = setTimeout(
|
||||
function()
|
||||
{
|
||||
delete focusManager._.timer;
|
||||
focusManager.forceBlur();
|
||||
}
|
||||
, 100 );
|
||||
},
|
||||
|
||||
/**
|
||||
* Used to indicate that the editor instance has lost the focus. Unlike
|
||||
* {@link #blur}, this function is synchronous, marking the instance as
|
||||
* "blured" immediately.
|
||||
* @example
|
||||
* var editor = CKEDITOR.instances.editor1;
|
||||
* <b>editor.focusManager.forceBlur()</b>;
|
||||
*/
|
||||
forceBlur : function()
|
||||
{
|
||||
if ( this.hasFocus )
|
||||
{
|
||||
var editor = this._.editor;
|
||||
|
||||
editor.container.getChild( 1 ).removeClass( 'cke_focus' );
|
||||
|
||||
this.hasFocus = false;
|
||||
editor.fire( 'blur' );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Fired when the editor instance receives the input focus.
|
||||
* @name CKEDITOR.editor#focus
|
||||
* @event
|
||||
* @param {CKEDITOR.editor} editor The editor instance.
|
||||
* @example
|
||||
* editor.on( 'focus', function( e )
|
||||
* {
|
||||
* alert( 'The editor named ' + e.editor.name + ' is now focused' );
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired when the editor instance loses the input focus.
|
||||
* @name CKEDITOR.editor#blur
|
||||
* @event
|
||||
* @param {CKEDITOR.editor} editor The editor instance.
|
||||
* @example
|
||||
* editor.on( 'blur', function( e )
|
||||
* {
|
||||
* alert( 'The editor named ' + e.editor.name + ' lost the focus' );
|
||||
* });
|
||||
*/
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.focusManager} class, which is used
|
||||
* to handle the focus on editor instances..
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates a focusManager class instance.
|
||||
* @class Manages the focus activity in an editor instance. This class is to be
|
||||
* used mainly by UI elements coders when adding interface elements that need
|
||||
* to set the focus state of the editor.
|
||||
* @param {CKEDITOR.editor} editor The editor instance.
|
||||
* @example
|
||||
* var focusManager = <b>new CKEDITOR.focusManager( editor )</b>;
|
||||
* focusManager.focus();
|
||||
*/
|
||||
CKEDITOR.focusManager = function( editor )
|
||||
{
|
||||
if ( editor.focusManager )
|
||||
return editor.focusManager;
|
||||
|
||||
/**
|
||||
* Indicates that the editor instance has focus.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* alert( CKEDITOR.instances.editor1.focusManager.hasFocus ); // e.g "true"
|
||||
*/
|
||||
this.hasFocus = false;
|
||||
|
||||
/**
|
||||
* Object used to hold private stuff.
|
||||
* @private
|
||||
*/
|
||||
this._ =
|
||||
{
|
||||
editor : editor
|
||||
};
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
CKEDITOR.focusManager.prototype =
|
||||
{
|
||||
/**
|
||||
* Used to indicate that the editor instance has the focus.<br />
|
||||
* <br />
|
||||
* Note that this function will not explicitelly set the focus in the
|
||||
* editor (for example, making the caret blinking on it). Use
|
||||
* {@link CKEDITOR.editor#focus} for it instead.
|
||||
* @example
|
||||
* var editor = CKEDITOR.instances.editor1;
|
||||
* <b>editor.focusManager.focus()</b>;
|
||||
*/
|
||||
focus : function()
|
||||
{
|
||||
if ( this._.timer )
|
||||
clearTimeout( this._.timer );
|
||||
|
||||
if ( !this.hasFocus )
|
||||
{
|
||||
// If another editor has the current focus, we first "blur" it. In
|
||||
// this way the events happen in a more logical sequence, like:
|
||||
// "focus 1" > "blur 1" > "focus 2"
|
||||
// ... instead of:
|
||||
// "focus 1" > "focus 2" > "blur 1"
|
||||
if ( CKEDITOR.currentInstance )
|
||||
CKEDITOR.currentInstance.focusManager.forceBlur();
|
||||
|
||||
var editor = this._.editor;
|
||||
|
||||
editor.container.getChild( 1 ).addClass( 'cke_focus' );
|
||||
|
||||
this.hasFocus = true;
|
||||
editor.fire( 'focus' );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Used to indicate that the editor instance has lost the focus.<br />
|
||||
* <br />
|
||||
* Note that this functions acts asynchronously with a delay of 100ms to
|
||||
* avoid subsequent blur/focus effects. If you want the "blur" to happen
|
||||
* immediately, use the {@link #forceBlur} function instead.
|
||||
* @example
|
||||
* var editor = CKEDITOR.instances.editor1;
|
||||
* <b>editor.focusManager.blur()</b>;
|
||||
*/
|
||||
blur : function()
|
||||
{
|
||||
var focusManager = this;
|
||||
|
||||
if ( focusManager._.timer )
|
||||
clearTimeout( focusManager._.timer );
|
||||
|
||||
focusManager._.timer = setTimeout(
|
||||
function()
|
||||
{
|
||||
delete focusManager._.timer;
|
||||
focusManager.forceBlur();
|
||||
}
|
||||
, 100 );
|
||||
},
|
||||
|
||||
/**
|
||||
* Used to indicate that the editor instance has lost the focus. Unlike
|
||||
* {@link #blur}, this function is synchronous, marking the instance as
|
||||
* "blured" immediately.
|
||||
* @example
|
||||
* var editor = CKEDITOR.instances.editor1;
|
||||
* <b>editor.focusManager.forceBlur()</b>;
|
||||
*/
|
||||
forceBlur : function()
|
||||
{
|
||||
if ( this.hasFocus )
|
||||
{
|
||||
var editor = this._.editor;
|
||||
|
||||
editor.container.getChild( 1 ).removeClass( 'cke_focus' );
|
||||
|
||||
this.hasFocus = false;
|
||||
editor.fire( 'blur' );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Fired when the editor instance receives the input focus.
|
||||
* @name CKEDITOR.editor#focus
|
||||
* @event
|
||||
* @param {CKEDITOR.editor} editor The editor instance.
|
||||
* @example
|
||||
* editor.on( 'focus', function( e )
|
||||
* {
|
||||
* alert( 'The editor named ' + e.editor.name + ' is now focused' );
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired when the editor instance loses the input focus.
|
||||
* @name CKEDITOR.editor#blur
|
||||
* @event
|
||||
* @param {CKEDITOR.editor} editor The editor instance.
|
||||
* @example
|
||||
* editor.on( 'blur', function( e )
|
||||
* {
|
||||
* alert( 'The editor named ' + e.editor.name + ' lost the focus' );
|
||||
* });
|
||||
*/
|
||||
|
||||
@ -1,224 +1,224 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates a {@link CKEDITOR.htmlParser} class instance.
|
||||
* @class Provides an "event like" system to parse strings of HTML data.
|
||||
* @example
|
||||
* var parser = new CKEDITOR.htmlParser();
|
||||
* parser.onTagOpen = function( tagName, attributes, selfClosing )
|
||||
* {
|
||||
* alert( tagName );
|
||||
* };
|
||||
* parser.parse( '<p>Some <b>text</b>.</p>' );
|
||||
*/
|
||||
CKEDITOR.htmlParser = function()
|
||||
{
|
||||
this._ =
|
||||
{
|
||||
htmlPartsRegex : new RegExp( '<(?:(?:\\/([^>]+)>)|(?:!--([\\S|\\s]*?)-->)|(?:([^\\s>]+)\\s*((?:(?:"[^"]*")|(?:\'[^\']*\')|[^"\'>])*)\\/?>))', 'g' )
|
||||
};
|
||||
};
|
||||
|
||||
(function()
|
||||
{
|
||||
var attribsRegex = /([\w\-:.]+)(?:(?:\s*=\s*(?:(?:"([^"]*)")|(?:'([^']*)')|([^\s>]+)))|(?=\s|$))/g,
|
||||
emptyAttribs = {checked:1,compact:1,declare:1,defer:1,disabled:1,ismap:1,multiple:1,nohref:1,noresize:1,noshade:1,nowrap:1,readonly:1,selected:1};
|
||||
|
||||
CKEDITOR.htmlParser.prototype =
|
||||
{
|
||||
/**
|
||||
* Function to be fired when a tag opener is found. This function
|
||||
* should be overriden when using this class.
|
||||
* @param {String} tagName The tag name. The name is guarantted to be
|
||||
* lowercased.
|
||||
* @param {Object} attributes An object containing all tag attributes. Each
|
||||
* property in this object represent and attribute name and its
|
||||
* value is the attribute value.
|
||||
* @param {Boolean} selfClosing true if the tag closes itself, false if the
|
||||
* tag doesn't.
|
||||
* @example
|
||||
* var parser = new CKEDITOR.htmlParser();
|
||||
* parser.onTagOpen = function( tagName, attributes, selfClosing )
|
||||
* {
|
||||
* alert( tagName ); // e.g. "b"
|
||||
* });
|
||||
* parser.parse( "<!-- Example --><b>Hello</b>" );
|
||||
*/
|
||||
onTagOpen : function() {},
|
||||
|
||||
/**
|
||||
* Function to be fired when a tag closer is found. This function
|
||||
* should be overriden when using this class.
|
||||
* @param {String} tagName The tag name. The name is guarantted to be
|
||||
* lowercased.
|
||||
* @example
|
||||
* var parser = new CKEDITOR.htmlParser();
|
||||
* parser.onTagClose = function( tagName )
|
||||
* {
|
||||
* alert( tagName ); // e.g. "b"
|
||||
* });
|
||||
* parser.parse( "<!-- Example --><b>Hello</b>" );
|
||||
*/
|
||||
onTagClose : function() {},
|
||||
|
||||
/**
|
||||
* Function to be fired when text is found. This function
|
||||
* should be overriden when using this class.
|
||||
* @param {String} text The text found.
|
||||
* @example
|
||||
* var parser = new CKEDITOR.htmlParser();
|
||||
* parser.onText = function( text )
|
||||
* {
|
||||
* alert( text ); // e.g. "Hello"
|
||||
* });
|
||||
* parser.parse( "<!-- Example --><b>Hello</b>" );
|
||||
*/
|
||||
onText : function() {},
|
||||
|
||||
/**
|
||||
* Function to be fired when CDATA section is found. This function
|
||||
* should be overriden when using this class.
|
||||
* @param {String} cdata The CDATA been found.
|
||||
* @example
|
||||
* var parser = new CKEDITOR.htmlParser();
|
||||
* parser.onCDATA = function( cdata )
|
||||
* {
|
||||
* alert( cdata ); // e.g. "var hello;"
|
||||
* });
|
||||
* parser.parse( "<script>var hello;</script>" );
|
||||
*/
|
||||
onCDATA : function() {},
|
||||
|
||||
/**
|
||||
* Function to be fired when a commend is found. This function
|
||||
* should be overriden when using this class.
|
||||
* @param {String} comment The comment text.
|
||||
* @example
|
||||
* var parser = new CKEDITOR.htmlParser();
|
||||
* parser.onComment = function( comment )
|
||||
* {
|
||||
* alert( comment ); // e.g. " Example "
|
||||
* });
|
||||
* parser.parse( "<!-- Example --><b>Hello</b>" );
|
||||
*/
|
||||
onComment : function() {},
|
||||
|
||||
/**
|
||||
* Parses text, looking for HTML tokens, like tag openers or closers,
|
||||
* or comments. This function fires the onTagOpen, onTagClose, onText
|
||||
* and onComment function during its execution.
|
||||
* @param {String} html The HTML to be parsed.
|
||||
* @example
|
||||
* var parser = new CKEDITOR.htmlParser();
|
||||
* // The onTagOpen, onTagClose, onText and onComment should be overriden
|
||||
* // at this point.
|
||||
* parser.parse( "<!-- Example --><b>Hello</b>" );
|
||||
*/
|
||||
parse : function( html )
|
||||
{
|
||||
var parts,
|
||||
tagName,
|
||||
nextIndex = 0,
|
||||
cdata; // The collected data inside a CDATA section.
|
||||
|
||||
while ( ( parts = this._.htmlPartsRegex.exec( html ) ) )
|
||||
{
|
||||
var tagIndex = parts.index;
|
||||
if ( tagIndex > nextIndex )
|
||||
{
|
||||
var text = html.substring( nextIndex, tagIndex );
|
||||
|
||||
if ( cdata )
|
||||
cdata.push( text );
|
||||
else
|
||||
this.onText( text );
|
||||
}
|
||||
|
||||
nextIndex = this._.htmlPartsRegex.lastIndex;
|
||||
|
||||
/*
|
||||
"parts" is an array with the following items:
|
||||
0 : The entire match for opening/closing tags and comments.
|
||||
1 : Group filled with the tag name for closing tags.
|
||||
2 : Group filled with the comment text.
|
||||
3 : Group filled with the tag name for opening tags.
|
||||
4 : Group filled with the attributes part of opening tags.
|
||||
*/
|
||||
|
||||
// Closing tag
|
||||
if ( ( tagName = parts[ 1 ] ) )
|
||||
{
|
||||
tagName = tagName.toLowerCase();
|
||||
|
||||
if ( cdata && CKEDITOR.dtd.$cdata[ tagName ] )
|
||||
{
|
||||
// Send the CDATA data.
|
||||
this.onCDATA( cdata.join('') );
|
||||
cdata = null;
|
||||
}
|
||||
|
||||
if ( !cdata )
|
||||
{
|
||||
this.onTagClose( tagName );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// If CDATA is enabled, just save the raw match.
|
||||
if ( cdata )
|
||||
{
|
||||
cdata.push( parts[ 0 ] );
|
||||
continue;
|
||||
}
|
||||
|
||||
// Opening tag
|
||||
if ( ( tagName = parts[ 3 ] ) )
|
||||
{
|
||||
tagName = tagName.toLowerCase();
|
||||
|
||||
// There are some tag names that can break things, so let's
|
||||
// simply ignore them when parsing. (#5224)
|
||||
if ( /="/.test( tagName ) )
|
||||
continue;
|
||||
|
||||
var attribs = {},
|
||||
attribMatch,
|
||||
attribsPart = parts[ 4 ],
|
||||
selfClosing = !!( attribsPart && attribsPart.charAt( attribsPart.length - 1 ) == '/' );
|
||||
|
||||
if ( attribsPart )
|
||||
{
|
||||
while ( ( attribMatch = attribsRegex.exec( attribsPart ) ) )
|
||||
{
|
||||
var attName = attribMatch[1].toLowerCase(),
|
||||
attValue = attribMatch[2] || attribMatch[3] || attribMatch[4] || '';
|
||||
|
||||
if ( !attValue && emptyAttribs[ attName ] )
|
||||
attribs[ attName ] = attName;
|
||||
else
|
||||
attribs[ attName ] = attValue;
|
||||
}
|
||||
}
|
||||
|
||||
this.onTagOpen( tagName, attribs, selfClosing );
|
||||
|
||||
// Open CDATA mode when finding the appropriate tags.
|
||||
if ( !cdata && CKEDITOR.dtd.$cdata[ tagName ] )
|
||||
cdata = [];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// Comment
|
||||
if ( ( tagName = parts[ 2 ] ) )
|
||||
this.onComment( tagName );
|
||||
}
|
||||
|
||||
if ( html.length > nextIndex )
|
||||
this.onText( html.substring( nextIndex, html.length ) );
|
||||
}
|
||||
};
|
||||
})();
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates a {@link CKEDITOR.htmlParser} class instance.
|
||||
* @class Provides an "event like" system to parse strings of HTML data.
|
||||
* @example
|
||||
* var parser = new CKEDITOR.htmlParser();
|
||||
* parser.onTagOpen = function( tagName, attributes, selfClosing )
|
||||
* {
|
||||
* alert( tagName );
|
||||
* };
|
||||
* parser.parse( '<p>Some <b>text</b>.</p>' );
|
||||
*/
|
||||
CKEDITOR.htmlParser = function()
|
||||
{
|
||||
this._ =
|
||||
{
|
||||
htmlPartsRegex : new RegExp( '<(?:(?:\\/([^>]+)>)|(?:!--([\\S|\\s]*?)-->)|(?:([^\\s>]+)\\s*((?:(?:"[^"]*")|(?:\'[^\']*\')|[^"\'>])*)\\/?>))', 'g' )
|
||||
};
|
||||
};
|
||||
|
||||
(function()
|
||||
{
|
||||
var attribsRegex = /([\w\-:.]+)(?:(?:\s*=\s*(?:(?:"([^"]*)")|(?:'([^']*)')|([^\s>]+)))|(?=\s|$))/g,
|
||||
emptyAttribs = {checked:1,compact:1,declare:1,defer:1,disabled:1,ismap:1,multiple:1,nohref:1,noresize:1,noshade:1,nowrap:1,readonly:1,selected:1};
|
||||
|
||||
CKEDITOR.htmlParser.prototype =
|
||||
{
|
||||
/**
|
||||
* Function to be fired when a tag opener is found. This function
|
||||
* should be overriden when using this class.
|
||||
* @param {String} tagName The tag name. The name is guarantted to be
|
||||
* lowercased.
|
||||
* @param {Object} attributes An object containing all tag attributes. Each
|
||||
* property in this object represent and attribute name and its
|
||||
* value is the attribute value.
|
||||
* @param {Boolean} selfClosing true if the tag closes itself, false if the
|
||||
* tag doesn't.
|
||||
* @example
|
||||
* var parser = new CKEDITOR.htmlParser();
|
||||
* parser.onTagOpen = function( tagName, attributes, selfClosing )
|
||||
* {
|
||||
* alert( tagName ); // e.g. "b"
|
||||
* });
|
||||
* parser.parse( "<!-- Example --><b>Hello</b>" );
|
||||
*/
|
||||
onTagOpen : function() {},
|
||||
|
||||
/**
|
||||
* Function to be fired when a tag closer is found. This function
|
||||
* should be overriden when using this class.
|
||||
* @param {String} tagName The tag name. The name is guarantted to be
|
||||
* lowercased.
|
||||
* @example
|
||||
* var parser = new CKEDITOR.htmlParser();
|
||||
* parser.onTagClose = function( tagName )
|
||||
* {
|
||||
* alert( tagName ); // e.g. "b"
|
||||
* });
|
||||
* parser.parse( "<!-- Example --><b>Hello</b>" );
|
||||
*/
|
||||
onTagClose : function() {},
|
||||
|
||||
/**
|
||||
* Function to be fired when text is found. This function
|
||||
* should be overriden when using this class.
|
||||
* @param {String} text The text found.
|
||||
* @example
|
||||
* var parser = new CKEDITOR.htmlParser();
|
||||
* parser.onText = function( text )
|
||||
* {
|
||||
* alert( text ); // e.g. "Hello"
|
||||
* });
|
||||
* parser.parse( "<!-- Example --><b>Hello</b>" );
|
||||
*/
|
||||
onText : function() {},
|
||||
|
||||
/**
|
||||
* Function to be fired when CDATA section is found. This function
|
||||
* should be overriden when using this class.
|
||||
* @param {String} cdata The CDATA been found.
|
||||
* @example
|
||||
* var parser = new CKEDITOR.htmlParser();
|
||||
* parser.onCDATA = function( cdata )
|
||||
* {
|
||||
* alert( cdata ); // e.g. "var hello;"
|
||||
* });
|
||||
* parser.parse( "<script>var hello;</script>" );
|
||||
*/
|
||||
onCDATA : function() {},
|
||||
|
||||
/**
|
||||
* Function to be fired when a commend is found. This function
|
||||
* should be overriden when using this class.
|
||||
* @param {String} comment The comment text.
|
||||
* @example
|
||||
* var parser = new CKEDITOR.htmlParser();
|
||||
* parser.onComment = function( comment )
|
||||
* {
|
||||
* alert( comment ); // e.g. " Example "
|
||||
* });
|
||||
* parser.parse( "<!-- Example --><b>Hello</b>" );
|
||||
*/
|
||||
onComment : function() {},
|
||||
|
||||
/**
|
||||
* Parses text, looking for HTML tokens, like tag openers or closers,
|
||||
* or comments. This function fires the onTagOpen, onTagClose, onText
|
||||
* and onComment function during its execution.
|
||||
* @param {String} html The HTML to be parsed.
|
||||
* @example
|
||||
* var parser = new CKEDITOR.htmlParser();
|
||||
* // The onTagOpen, onTagClose, onText and onComment should be overriden
|
||||
* // at this point.
|
||||
* parser.parse( "<!-- Example --><b>Hello</b>" );
|
||||
*/
|
||||
parse : function( html )
|
||||
{
|
||||
var parts,
|
||||
tagName,
|
||||
nextIndex = 0,
|
||||
cdata; // The collected data inside a CDATA section.
|
||||
|
||||
while ( ( parts = this._.htmlPartsRegex.exec( html ) ) )
|
||||
{
|
||||
var tagIndex = parts.index;
|
||||
if ( tagIndex > nextIndex )
|
||||
{
|
||||
var text = html.substring( nextIndex, tagIndex );
|
||||
|
||||
if ( cdata )
|
||||
cdata.push( text );
|
||||
else
|
||||
this.onText( text );
|
||||
}
|
||||
|
||||
nextIndex = this._.htmlPartsRegex.lastIndex;
|
||||
|
||||
/*
|
||||
"parts" is an array with the following items:
|
||||
0 : The entire match for opening/closing tags and comments.
|
||||
1 : Group filled with the tag name for closing tags.
|
||||
2 : Group filled with the comment text.
|
||||
3 : Group filled with the tag name for opening tags.
|
||||
4 : Group filled with the attributes part of opening tags.
|
||||
*/
|
||||
|
||||
// Closing tag
|
||||
if ( ( tagName = parts[ 1 ] ) )
|
||||
{
|
||||
tagName = tagName.toLowerCase();
|
||||
|
||||
if ( cdata && CKEDITOR.dtd.$cdata[ tagName ] )
|
||||
{
|
||||
// Send the CDATA data.
|
||||
this.onCDATA( cdata.join('') );
|
||||
cdata = null;
|
||||
}
|
||||
|
||||
if ( !cdata )
|
||||
{
|
||||
this.onTagClose( tagName );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// If CDATA is enabled, just save the raw match.
|
||||
if ( cdata )
|
||||
{
|
||||
cdata.push( parts[ 0 ] );
|
||||
continue;
|
||||
}
|
||||
|
||||
// Opening tag
|
||||
if ( ( tagName = parts[ 3 ] ) )
|
||||
{
|
||||
tagName = tagName.toLowerCase();
|
||||
|
||||
// There are some tag names that can break things, so let's
|
||||
// simply ignore them when parsing. (#5224)
|
||||
if ( /="/.test( tagName ) )
|
||||
continue;
|
||||
|
||||
var attribs = {},
|
||||
attribMatch,
|
||||
attribsPart = parts[ 4 ],
|
||||
selfClosing = !!( attribsPart && attribsPart.charAt( attribsPart.length - 1 ) == '/' );
|
||||
|
||||
if ( attribsPart )
|
||||
{
|
||||
while ( ( attribMatch = attribsRegex.exec( attribsPart ) ) )
|
||||
{
|
||||
var attName = attribMatch[1].toLowerCase(),
|
||||
attValue = attribMatch[2] || attribMatch[3] || attribMatch[4] || '';
|
||||
|
||||
if ( !attValue && emptyAttribs[ attName ] )
|
||||
attribs[ attName ] = attName;
|
||||
else
|
||||
attribs[ attName ] = attValue;
|
||||
}
|
||||
}
|
||||
|
||||
this.onTagOpen( tagName, attribs, selfClosing );
|
||||
|
||||
// Open CDATA mode when finding the appropriate tags.
|
||||
if ( !cdata && CKEDITOR.dtd.$cdata[ tagName ] )
|
||||
cdata = [];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// Comment
|
||||
if ( ( tagName = parts[ 2 ] ) )
|
||||
this.onComment( tagName );
|
||||
}
|
||||
|
||||
if ( html.length > nextIndex )
|
||||
this.onText( html.substring( nextIndex, html.length ) );
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
@ -1,145 +1,145 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.htmlParser.basicWriter = CKEDITOR.tools.createClass(
|
||||
{
|
||||
$ : function()
|
||||
{
|
||||
this._ =
|
||||
{
|
||||
output : []
|
||||
};
|
||||
},
|
||||
|
||||
proto :
|
||||
{
|
||||
/**
|
||||
* Writes the tag opening part for a opener tag.
|
||||
* @param {String} tagName The element name for this tag.
|
||||
* @param {Object} attributes The attributes defined for this tag. The
|
||||
* attributes could be used to inspect the tag.
|
||||
* @example
|
||||
* // Writes "<p".
|
||||
* writer.openTag( 'p', { class : 'MyClass', id : 'MyId' } );
|
||||
*/
|
||||
openTag : function( tagName, attributes )
|
||||
{
|
||||
this._.output.push( '<', tagName );
|
||||
},
|
||||
|
||||
/**
|
||||
* Writes the tag closing part for a opener tag.
|
||||
* @param {String} tagName The element name for this tag.
|
||||
* @param {Boolean} isSelfClose Indicates that this is a self-closing tag,
|
||||
* like "br" or "img".
|
||||
* @example
|
||||
* // Writes ">".
|
||||
* writer.openTagClose( 'p', false );
|
||||
* @example
|
||||
* // Writes " />".
|
||||
* writer.openTagClose( 'br', true );
|
||||
*/
|
||||
openTagClose : function( tagName, isSelfClose )
|
||||
{
|
||||
if ( isSelfClose )
|
||||
this._.output.push( ' />' );
|
||||
else
|
||||
this._.output.push( '>' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Writes an attribute. This function should be called after opening the
|
||||
* tag with {@link #openTagClose}.
|
||||
* @param {String} attName The attribute name.
|
||||
* @param {String} attValue The attribute value.
|
||||
* @example
|
||||
* // Writes ' class="MyClass"'.
|
||||
* writer.attribute( 'class', 'MyClass' );
|
||||
*/
|
||||
attribute : function( attName, attValue )
|
||||
{
|
||||
// Browsers don't always escape special character in attribute values. (#4683, #4719).
|
||||
if ( typeof attValue == 'string' )
|
||||
attValue = CKEDITOR.tools.htmlEncodeAttr( attValue );
|
||||
|
||||
this._.output.push( ' ', attName, '="', attValue, '"' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Writes a closer tag.
|
||||
* @param {String} tagName The element name for this tag.
|
||||
* @example
|
||||
* // Writes "</p>".
|
||||
* writer.closeTag( 'p' );
|
||||
*/
|
||||
closeTag : function( tagName )
|
||||
{
|
||||
this._.output.push( '</', tagName, '>' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Writes text.
|
||||
* @param {String} text The text value
|
||||
* @example
|
||||
* // Writes "Hello Word".
|
||||
* writer.text( 'Hello Word' );
|
||||
*/
|
||||
text : function( text )
|
||||
{
|
||||
this._.output.push( text );
|
||||
},
|
||||
|
||||
/**
|
||||
* Writes a comment.
|
||||
* @param {String} comment The comment text.
|
||||
* @example
|
||||
* // Writes "<!-- My comment -->".
|
||||
* writer.comment( ' My comment ' );
|
||||
*/
|
||||
comment : function( comment )
|
||||
{
|
||||
this._.output.push( '<!--', comment, '-->' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Writes any kind of data to the ouput.
|
||||
* @example
|
||||
* writer.write( 'This is an <b>example</b>.' );
|
||||
*/
|
||||
write : function( data )
|
||||
{
|
||||
this._.output.push( data );
|
||||
},
|
||||
|
||||
/**
|
||||
* Empties the current output buffer.
|
||||
* @example
|
||||
* writer.reset();
|
||||
*/
|
||||
reset : function()
|
||||
{
|
||||
this._.output = [];
|
||||
this._.indent = false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Empties the current output buffer.
|
||||
* @param {Boolean} reset Indicates that the {@link reset} function is to
|
||||
* be automatically called after retrieving the HTML.
|
||||
* @returns {String} The HTML written to the writer so far.
|
||||
* @example
|
||||
* var html = writer.getHtml();
|
||||
*/
|
||||
getHtml : function( reset )
|
||||
{
|
||||
var html = this._.output.join( '' );
|
||||
|
||||
if ( reset )
|
||||
this.reset();
|
||||
|
||||
return html;
|
||||
}
|
||||
}
|
||||
});
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.htmlParser.basicWriter = CKEDITOR.tools.createClass(
|
||||
{
|
||||
$ : function()
|
||||
{
|
||||
this._ =
|
||||
{
|
||||
output : []
|
||||
};
|
||||
},
|
||||
|
||||
proto :
|
||||
{
|
||||
/**
|
||||
* Writes the tag opening part for a opener tag.
|
||||
* @param {String} tagName The element name for this tag.
|
||||
* @param {Object} attributes The attributes defined for this tag. The
|
||||
* attributes could be used to inspect the tag.
|
||||
* @example
|
||||
* // Writes "<p".
|
||||
* writer.openTag( 'p', { class : 'MyClass', id : 'MyId' } );
|
||||
*/
|
||||
openTag : function( tagName, attributes )
|
||||
{
|
||||
this._.output.push( '<', tagName );
|
||||
},
|
||||
|
||||
/**
|
||||
* Writes the tag closing part for a opener tag.
|
||||
* @param {String} tagName The element name for this tag.
|
||||
* @param {Boolean} isSelfClose Indicates that this is a self-closing tag,
|
||||
* like "br" or "img".
|
||||
* @example
|
||||
* // Writes ">".
|
||||
* writer.openTagClose( 'p', false );
|
||||
* @example
|
||||
* // Writes " />".
|
||||
* writer.openTagClose( 'br', true );
|
||||
*/
|
||||
openTagClose : function( tagName, isSelfClose )
|
||||
{
|
||||
if ( isSelfClose )
|
||||
this._.output.push( ' />' );
|
||||
else
|
||||
this._.output.push( '>' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Writes an attribute. This function should be called after opening the
|
||||
* tag with {@link #openTagClose}.
|
||||
* @param {String} attName The attribute name.
|
||||
* @param {String} attValue The attribute value.
|
||||
* @example
|
||||
* // Writes ' class="MyClass"'.
|
||||
* writer.attribute( 'class', 'MyClass' );
|
||||
*/
|
||||
attribute : function( attName, attValue )
|
||||
{
|
||||
// Browsers don't always escape special character in attribute values. (#4683, #4719).
|
||||
if ( typeof attValue == 'string' )
|
||||
attValue = CKEDITOR.tools.htmlEncodeAttr( attValue );
|
||||
|
||||
this._.output.push( ' ', attName, '="', attValue, '"' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Writes a closer tag.
|
||||
* @param {String} tagName The element name for this tag.
|
||||
* @example
|
||||
* // Writes "</p>".
|
||||
* writer.closeTag( 'p' );
|
||||
*/
|
||||
closeTag : function( tagName )
|
||||
{
|
||||
this._.output.push( '</', tagName, '>' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Writes text.
|
||||
* @param {String} text The text value
|
||||
* @example
|
||||
* // Writes "Hello Word".
|
||||
* writer.text( 'Hello Word' );
|
||||
*/
|
||||
text : function( text )
|
||||
{
|
||||
this._.output.push( text );
|
||||
},
|
||||
|
||||
/**
|
||||
* Writes a comment.
|
||||
* @param {String} comment The comment text.
|
||||
* @example
|
||||
* // Writes "<!-- My comment -->".
|
||||
* writer.comment( ' My comment ' );
|
||||
*/
|
||||
comment : function( comment )
|
||||
{
|
||||
this._.output.push( '<!--', comment, '-->' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Writes any kind of data to the ouput.
|
||||
* @example
|
||||
* writer.write( 'This is an <b>example</b>.' );
|
||||
*/
|
||||
write : function( data )
|
||||
{
|
||||
this._.output.push( data );
|
||||
},
|
||||
|
||||
/**
|
||||
* Empties the current output buffer.
|
||||
* @example
|
||||
* writer.reset();
|
||||
*/
|
||||
reset : function()
|
||||
{
|
||||
this._.output = [];
|
||||
this._.indent = false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Empties the current output buffer.
|
||||
* @param {Boolean} reset Indicates that the {@link reset} function is to
|
||||
* be automatically called after retrieving the HTML.
|
||||
* @returns {String} The HTML written to the writer so far.
|
||||
* @example
|
||||
* var html = writer.getHtml();
|
||||
*/
|
||||
getHtml : function( reset )
|
||||
{
|
||||
var html = this._.output.join( '' );
|
||||
|
||||
if ( reset )
|
||||
this.reset();
|
||||
|
||||
return html;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -1,43 +1,43 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
|
||||
/**
|
||||
* A lightweight representation of HTML text.
|
||||
* @constructor
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.htmlParser.cdata = function( value )
|
||||
{
|
||||
/**
|
||||
* The CDATA value.
|
||||
* @type String
|
||||
* @example
|
||||
*/
|
||||
this.value = value;
|
||||
};
|
||||
|
||||
CKEDITOR.htmlParser.cdata.prototype =
|
||||
{
|
||||
/**
|
||||
* CDATA has the same type as {@link CKEDITOR.htmlParser.text} This is
|
||||
* a constant value set to {@link CKEDITOR.NODE_TEXT}.
|
||||
* @type Number
|
||||
* @example
|
||||
*/
|
||||
type : CKEDITOR.NODE_TEXT,
|
||||
|
||||
/**
|
||||
* Writes write the CDATA with no special manipulations.
|
||||
* @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
|
||||
*/
|
||||
writeHtml : function( writer )
|
||||
{
|
||||
writer.write( this.value );
|
||||
}
|
||||
};
|
||||
})();
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
|
||||
/**
|
||||
* A lightweight representation of HTML text.
|
||||
* @constructor
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.htmlParser.cdata = function( value )
|
||||
{
|
||||
/**
|
||||
* The CDATA value.
|
||||
* @type String
|
||||
* @example
|
||||
*/
|
||||
this.value = value;
|
||||
};
|
||||
|
||||
CKEDITOR.htmlParser.cdata.prototype =
|
||||
{
|
||||
/**
|
||||
* CDATA has the same type as {@link CKEDITOR.htmlParser.text} This is
|
||||
* a constant value set to {@link CKEDITOR.NODE_TEXT}.
|
||||
* @type Number
|
||||
* @example
|
||||
*/
|
||||
type : CKEDITOR.NODE_TEXT,
|
||||
|
||||
/**
|
||||
* Writes write the CDATA with no special manipulations.
|
||||
* @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
|
||||
*/
|
||||
writeHtml : function( writer )
|
||||
{
|
||||
writer.write( this.value );
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
@ -1,60 +1,60 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* A lightweight representation of an HTML comment.
|
||||
* @constructor
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.htmlParser.comment = function( value )
|
||||
{
|
||||
/**
|
||||
* The comment text.
|
||||
* @type String
|
||||
* @example
|
||||
*/
|
||||
this.value = value;
|
||||
|
||||
/** @private */
|
||||
this._ =
|
||||
{
|
||||
isBlockLike : false
|
||||
};
|
||||
};
|
||||
|
||||
CKEDITOR.htmlParser.comment.prototype =
|
||||
{
|
||||
/**
|
||||
* The node type. This is a constant value set to {@link CKEDITOR.NODE_COMMENT}.
|
||||
* @type Number
|
||||
* @example
|
||||
*/
|
||||
type : CKEDITOR.NODE_COMMENT,
|
||||
|
||||
/**
|
||||
* Writes the HTML representation of this comment to a CKEDITOR.htmlWriter.
|
||||
* @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
|
||||
* @example
|
||||
*/
|
||||
writeHtml : function( writer, filter )
|
||||
{
|
||||
var comment = this.value;
|
||||
|
||||
if ( filter )
|
||||
{
|
||||
if ( !( comment = filter.onComment( comment, this ) ) )
|
||||
return;
|
||||
|
||||
if ( typeof comment != 'string' )
|
||||
{
|
||||
comment.parent = this.parent;
|
||||
comment.writeHtml( writer, filter );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
writer.comment( comment );
|
||||
}
|
||||
};
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* A lightweight representation of an HTML comment.
|
||||
* @constructor
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.htmlParser.comment = function( value )
|
||||
{
|
||||
/**
|
||||
* The comment text.
|
||||
* @type String
|
||||
* @example
|
||||
*/
|
||||
this.value = value;
|
||||
|
||||
/** @private */
|
||||
this._ =
|
||||
{
|
||||
isBlockLike : false
|
||||
};
|
||||
};
|
||||
|
||||
CKEDITOR.htmlParser.comment.prototype =
|
||||
{
|
||||
/**
|
||||
* The node type. This is a constant value set to {@link CKEDITOR.NODE_COMMENT}.
|
||||
* @type Number
|
||||
* @example
|
||||
*/
|
||||
type : CKEDITOR.NODE_COMMENT,
|
||||
|
||||
/**
|
||||
* Writes the HTML representation of this comment to a CKEDITOR.htmlWriter.
|
||||
* @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
|
||||
* @example
|
||||
*/
|
||||
writeHtml : function( writer, filter )
|
||||
{
|
||||
var comment = this.value;
|
||||
|
||||
if ( filter )
|
||||
{
|
||||
if ( !( comment = filter.onComment( comment, this ) ) )
|
||||
return;
|
||||
|
||||
if ( typeof comment != 'string' )
|
||||
{
|
||||
comment.parent = this.parent;
|
||||
comment.writeHtml( writer, filter );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
writer.comment( comment );
|
||||
}
|
||||
};
|
||||
|
||||
@ -1,306 +1,306 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* A lightweight representation of an HTML element.
|
||||
* @param {String} name The element name.
|
||||
* @param {Object} attributes And object holding all attributes defined for
|
||||
* this element.
|
||||
* @constructor
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.htmlParser.element = function( name, attributes )
|
||||
{
|
||||
/**
|
||||
* The element name.
|
||||
* @type String
|
||||
* @example
|
||||
*/
|
||||
this.name = name;
|
||||
|
||||
/**
|
||||
* Holds the attributes defined for this element.
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
this.attributes = attributes || {};
|
||||
|
||||
/**
|
||||
* The nodes that are direct children of this element.
|
||||
* @type Array
|
||||
* @example
|
||||
*/
|
||||
this.children = [];
|
||||
|
||||
// Reveal the real semantic of our internal custom tag name (#6639),
|
||||
// when resolving whether it's block like.
|
||||
var realName = name || '',
|
||||
prefixed = realName.match( /^cke:(.*)/ );
|
||||
prefixed && ( realName = prefixed[ 1 ] );
|
||||
|
||||
var isBlockLike = !!( CKEDITOR.dtd.$nonBodyContent[ realName ]
|
||||
|| CKEDITOR.dtd.$block[ realName ]
|
||||
|| CKEDITOR.dtd.$listItem[ realName ]
|
||||
|| CKEDITOR.dtd.$tableContent[ realName ]
|
||||
|| CKEDITOR.dtd.$nonEditable[ realName ]
|
||||
|| realName == 'br' );
|
||||
|
||||
this.isEmpty = !!CKEDITOR.dtd.$empty[ name ];
|
||||
this.isUnknown = !CKEDITOR.dtd[ name ];
|
||||
|
||||
/** @private */
|
||||
this._ =
|
||||
{
|
||||
isBlockLike : isBlockLike,
|
||||
hasInlineStarted : this.isEmpty || !isBlockLike
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Object presentation of CSS style declaration text.
|
||||
* @param {CKEDITOR.htmlParser.element|String} elementOrStyleText A html parser element or the inline style text.
|
||||
*/
|
||||
CKEDITOR.htmlParser.cssStyle = function()
|
||||
{
|
||||
var styleText,
|
||||
arg = arguments[ 0 ],
|
||||
rules = {};
|
||||
|
||||
styleText = arg instanceof CKEDITOR.htmlParser.element ? arg.attributes.style : arg;
|
||||
|
||||
// html-encoded quote might be introduced by 'font-family'
|
||||
// from MS-Word which confused the following regexp. e.g.
|
||||
//'font-family: "Lucida, Console"'
|
||||
( styleText || '' )
|
||||
.replace( /"/g, '"' )
|
||||
.replace( /\s*([^ :;]+)\s*:\s*([^;]+)\s*(?=;|$)/g,
|
||||
function( match, name, value )
|
||||
{
|
||||
name == 'font-family' && ( value = value.replace( /["']/g, '' ) );
|
||||
rules[ name.toLowerCase() ] = value;
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
rules : rules,
|
||||
|
||||
/**
|
||||
* Apply the styles onto the specified element or object.
|
||||
* @param {CKEDITOR.htmlParser.element|CKEDITOR.dom.element|Object} obj
|
||||
*/
|
||||
populate : function( obj )
|
||||
{
|
||||
var style = this.toString();
|
||||
if ( style )
|
||||
{
|
||||
obj instanceof CKEDITOR.dom.element ?
|
||||
obj.setAttribute( 'style', style ) :
|
||||
obj instanceof CKEDITOR.htmlParser.element ?
|
||||
obj.attributes.style = style :
|
||||
obj.style = style;
|
||||
}
|
||||
},
|
||||
|
||||
toString : function()
|
||||
{
|
||||
var output = [];
|
||||
for ( var i in rules )
|
||||
rules[ i ] && output.push( i, ':', rules[ i ], ';' );
|
||||
return output.join( '' );
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
(function()
|
||||
{
|
||||
// Used to sort attribute entries in an array, where the first element of
|
||||
// each object is the attribute name.
|
||||
var sortAttribs = function( a, b )
|
||||
{
|
||||
a = a[0];
|
||||
b = b[0];
|
||||
return a < b ? -1 : a > b ? 1 : 0;
|
||||
};
|
||||
|
||||
CKEDITOR.htmlParser.element.prototype =
|
||||
{
|
||||
/**
|
||||
* The node type. This is a constant value set to {@link CKEDITOR.NODE_ELEMENT}.
|
||||
* @type Number
|
||||
* @example
|
||||
*/
|
||||
type : CKEDITOR.NODE_ELEMENT,
|
||||
|
||||
/**
|
||||
* Adds a node to the element children list.
|
||||
* @param {Object} node The node to be added. It can be any of of the
|
||||
* following types: {@link CKEDITOR.htmlParser.element},
|
||||
* {@link CKEDITOR.htmlParser.text} and
|
||||
* {@link CKEDITOR.htmlParser.comment}.
|
||||
* @function
|
||||
* @example
|
||||
*/
|
||||
add : CKEDITOR.htmlParser.fragment.prototype.add,
|
||||
|
||||
/**
|
||||
* Clone this element.
|
||||
* @returns {CKEDITOR.htmlParser.element} The element clone.
|
||||
* @example
|
||||
*/
|
||||
clone : function()
|
||||
{
|
||||
return new CKEDITOR.htmlParser.element( this.name, this.attributes );
|
||||
},
|
||||
|
||||
/**
|
||||
* Writes the element HTML to a CKEDITOR.htmlWriter.
|
||||
* @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
|
||||
* @example
|
||||
*/
|
||||
writeHtml : function( writer, filter )
|
||||
{
|
||||
var attributes = this.attributes;
|
||||
|
||||
// Ignore cke: prefixes when writing HTML.
|
||||
var element = this,
|
||||
writeName = element.name,
|
||||
a, newAttrName, value;
|
||||
|
||||
var isChildrenFiltered;
|
||||
|
||||
/**
|
||||
* Providing an option for bottom-up filtering order ( element
|
||||
* children to be pre-filtered before the element itself ).
|
||||
*/
|
||||
element.filterChildren = function()
|
||||
{
|
||||
if ( !isChildrenFiltered )
|
||||
{
|
||||
var writer = new CKEDITOR.htmlParser.basicWriter();
|
||||
CKEDITOR.htmlParser.fragment.prototype.writeChildrenHtml.call( element, writer, filter );
|
||||
element.children = new CKEDITOR.htmlParser.fragment.fromHtml( writer.getHtml(), 0, element.clone() ).children;
|
||||
isChildrenFiltered = 1;
|
||||
}
|
||||
};
|
||||
|
||||
if ( filter )
|
||||
{
|
||||
while ( true )
|
||||
{
|
||||
if ( !( writeName = filter.onElementName( writeName ) ) )
|
||||
return;
|
||||
|
||||
element.name = writeName;
|
||||
|
||||
if ( !( element = filter.onElement( element ) ) )
|
||||
return;
|
||||
|
||||
element.parent = this.parent;
|
||||
|
||||
if ( element.name == writeName )
|
||||
break;
|
||||
|
||||
// If the element has been replaced with something of a
|
||||
// different type, then make the replacement write itself.
|
||||
if ( element.type != CKEDITOR.NODE_ELEMENT )
|
||||
{
|
||||
element.writeHtml( writer, filter );
|
||||
return;
|
||||
}
|
||||
|
||||
writeName = element.name;
|
||||
|
||||
// This indicate that the element has been dropped by
|
||||
// filter but not the children.
|
||||
if ( !writeName )
|
||||
{
|
||||
// Fix broken parent refs.
|
||||
for ( var c = 0, length = this.children.length ; c < length ; c++ )
|
||||
this.children[ c ].parent = element.parent;
|
||||
|
||||
this.writeChildrenHtml.call( element, writer, isChildrenFiltered ? null : filter );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// The element may have been changed, so update the local
|
||||
// references.
|
||||
attributes = element.attributes;
|
||||
}
|
||||
|
||||
// Open element tag.
|
||||
writer.openTag( writeName, attributes );
|
||||
|
||||
// Copy all attributes to an array.
|
||||
var attribsArray = [];
|
||||
// Iterate over the attributes twice since filters may alter
|
||||
// other attributes.
|
||||
for ( var i = 0 ; i < 2; i++ )
|
||||
{
|
||||
for ( a in attributes )
|
||||
{
|
||||
newAttrName = a;
|
||||
value = attributes[ a ];
|
||||
if ( i == 1 )
|
||||
attribsArray.push( [ a, value ] );
|
||||
else if ( filter )
|
||||
{
|
||||
while ( true )
|
||||
{
|
||||
if ( !( newAttrName = filter.onAttributeName( a ) ) )
|
||||
{
|
||||
delete attributes[ a ];
|
||||
break;
|
||||
}
|
||||
else if ( newAttrName != a )
|
||||
{
|
||||
delete attributes[ a ];
|
||||
a = newAttrName;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
if ( newAttrName )
|
||||
{
|
||||
if ( ( value = filter.onAttribute( element, newAttrName, value ) ) === false )
|
||||
delete attributes[ newAttrName ];
|
||||
else
|
||||
attributes [ newAttrName ] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Sort the attributes by name.
|
||||
if ( writer.sortAttributes )
|
||||
attribsArray.sort( sortAttribs );
|
||||
|
||||
// Send the attributes.
|
||||
var len = attribsArray.length;
|
||||
for ( i = 0 ; i < len ; i++ )
|
||||
{
|
||||
var attrib = attribsArray[ i ];
|
||||
writer.attribute( attrib[0], attrib[1] );
|
||||
}
|
||||
|
||||
// Close the tag.
|
||||
writer.openTagClose( writeName, element.isEmpty );
|
||||
|
||||
if ( !element.isEmpty )
|
||||
{
|
||||
this.writeChildrenHtml.call( element, writer, isChildrenFiltered ? null : filter );
|
||||
// Close the element.
|
||||
writer.closeTag( writeName );
|
||||
}
|
||||
},
|
||||
|
||||
writeChildrenHtml : function( writer, filter )
|
||||
{
|
||||
// Send children.
|
||||
CKEDITOR.htmlParser.fragment.prototype.writeChildrenHtml.apply( this, arguments );
|
||||
|
||||
}
|
||||
};
|
||||
})();
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* A lightweight representation of an HTML element.
|
||||
* @param {String} name The element name.
|
||||
* @param {Object} attributes And object holding all attributes defined for
|
||||
* this element.
|
||||
* @constructor
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.htmlParser.element = function( name, attributes )
|
||||
{
|
||||
/**
|
||||
* The element name.
|
||||
* @type String
|
||||
* @example
|
||||
*/
|
||||
this.name = name;
|
||||
|
||||
/**
|
||||
* Holds the attributes defined for this element.
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
this.attributes = attributes || {};
|
||||
|
||||
/**
|
||||
* The nodes that are direct children of this element.
|
||||
* @type Array
|
||||
* @example
|
||||
*/
|
||||
this.children = [];
|
||||
|
||||
// Reveal the real semantic of our internal custom tag name (#6639),
|
||||
// when resolving whether it's block like.
|
||||
var realName = name || '',
|
||||
prefixed = realName.match( /^cke:(.*)/ );
|
||||
prefixed && ( realName = prefixed[ 1 ] );
|
||||
|
||||
var isBlockLike = !!( CKEDITOR.dtd.$nonBodyContent[ realName ]
|
||||
|| CKEDITOR.dtd.$block[ realName ]
|
||||
|| CKEDITOR.dtd.$listItem[ realName ]
|
||||
|| CKEDITOR.dtd.$tableContent[ realName ]
|
||||
|| CKEDITOR.dtd.$nonEditable[ realName ]
|
||||
|| realName == 'br' );
|
||||
|
||||
this.isEmpty = !!CKEDITOR.dtd.$empty[ name ];
|
||||
this.isUnknown = !CKEDITOR.dtd[ name ];
|
||||
|
||||
/** @private */
|
||||
this._ =
|
||||
{
|
||||
isBlockLike : isBlockLike,
|
||||
hasInlineStarted : this.isEmpty || !isBlockLike
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Object presentation of CSS style declaration text.
|
||||
* @param {CKEDITOR.htmlParser.element|String} elementOrStyleText A html parser element or the inline style text.
|
||||
*/
|
||||
CKEDITOR.htmlParser.cssStyle = function()
|
||||
{
|
||||
var styleText,
|
||||
arg = arguments[ 0 ],
|
||||
rules = {};
|
||||
|
||||
styleText = arg instanceof CKEDITOR.htmlParser.element ? arg.attributes.style : arg;
|
||||
|
||||
// html-encoded quote might be introduced by 'font-family'
|
||||
// from MS-Word which confused the following regexp. e.g.
|
||||
//'font-family: "Lucida, Console"'
|
||||
( styleText || '' )
|
||||
.replace( /"/g, '"' )
|
||||
.replace( /\s*([^ :;]+)\s*:\s*([^;]+)\s*(?=;|$)/g,
|
||||
function( match, name, value )
|
||||
{
|
||||
name == 'font-family' && ( value = value.replace( /["']/g, '' ) );
|
||||
rules[ name.toLowerCase() ] = value;
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
rules : rules,
|
||||
|
||||
/**
|
||||
* Apply the styles onto the specified element or object.
|
||||
* @param {CKEDITOR.htmlParser.element|CKEDITOR.dom.element|Object} obj
|
||||
*/
|
||||
populate : function( obj )
|
||||
{
|
||||
var style = this.toString();
|
||||
if ( style )
|
||||
{
|
||||
obj instanceof CKEDITOR.dom.element ?
|
||||
obj.setAttribute( 'style', style ) :
|
||||
obj instanceof CKEDITOR.htmlParser.element ?
|
||||
obj.attributes.style = style :
|
||||
obj.style = style;
|
||||
}
|
||||
},
|
||||
|
||||
toString : function()
|
||||
{
|
||||
var output = [];
|
||||
for ( var i in rules )
|
||||
rules[ i ] && output.push( i, ':', rules[ i ], ';' );
|
||||
return output.join( '' );
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
(function()
|
||||
{
|
||||
// Used to sort attribute entries in an array, where the first element of
|
||||
// each object is the attribute name.
|
||||
var sortAttribs = function( a, b )
|
||||
{
|
||||
a = a[0];
|
||||
b = b[0];
|
||||
return a < b ? -1 : a > b ? 1 : 0;
|
||||
};
|
||||
|
||||
CKEDITOR.htmlParser.element.prototype =
|
||||
{
|
||||
/**
|
||||
* The node type. This is a constant value set to {@link CKEDITOR.NODE_ELEMENT}.
|
||||
* @type Number
|
||||
* @example
|
||||
*/
|
||||
type : CKEDITOR.NODE_ELEMENT,
|
||||
|
||||
/**
|
||||
* Adds a node to the element children list.
|
||||
* @param {Object} node The node to be added. It can be any of of the
|
||||
* following types: {@link CKEDITOR.htmlParser.element},
|
||||
* {@link CKEDITOR.htmlParser.text} and
|
||||
* {@link CKEDITOR.htmlParser.comment}.
|
||||
* @function
|
||||
* @example
|
||||
*/
|
||||
add : CKEDITOR.htmlParser.fragment.prototype.add,
|
||||
|
||||
/**
|
||||
* Clone this element.
|
||||
* @returns {CKEDITOR.htmlParser.element} The element clone.
|
||||
* @example
|
||||
*/
|
||||
clone : function()
|
||||
{
|
||||
return new CKEDITOR.htmlParser.element( this.name, this.attributes );
|
||||
},
|
||||
|
||||
/**
|
||||
* Writes the element HTML to a CKEDITOR.htmlWriter.
|
||||
* @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
|
||||
* @example
|
||||
*/
|
||||
writeHtml : function( writer, filter )
|
||||
{
|
||||
var attributes = this.attributes;
|
||||
|
||||
// Ignore cke: prefixes when writing HTML.
|
||||
var element = this,
|
||||
writeName = element.name,
|
||||
a, newAttrName, value;
|
||||
|
||||
var isChildrenFiltered;
|
||||
|
||||
/**
|
||||
* Providing an option for bottom-up filtering order ( element
|
||||
* children to be pre-filtered before the element itself ).
|
||||
*/
|
||||
element.filterChildren = function()
|
||||
{
|
||||
if ( !isChildrenFiltered )
|
||||
{
|
||||
var writer = new CKEDITOR.htmlParser.basicWriter();
|
||||
CKEDITOR.htmlParser.fragment.prototype.writeChildrenHtml.call( element, writer, filter );
|
||||
element.children = new CKEDITOR.htmlParser.fragment.fromHtml( writer.getHtml(), 0, element.clone() ).children;
|
||||
isChildrenFiltered = 1;
|
||||
}
|
||||
};
|
||||
|
||||
if ( filter )
|
||||
{
|
||||
while ( true )
|
||||
{
|
||||
if ( !( writeName = filter.onElementName( writeName ) ) )
|
||||
return;
|
||||
|
||||
element.name = writeName;
|
||||
|
||||
if ( !( element = filter.onElement( element ) ) )
|
||||
return;
|
||||
|
||||
element.parent = this.parent;
|
||||
|
||||
if ( element.name == writeName )
|
||||
break;
|
||||
|
||||
// If the element has been replaced with something of a
|
||||
// different type, then make the replacement write itself.
|
||||
if ( element.type != CKEDITOR.NODE_ELEMENT )
|
||||
{
|
||||
element.writeHtml( writer, filter );
|
||||
return;
|
||||
}
|
||||
|
||||
writeName = element.name;
|
||||
|
||||
// This indicate that the element has been dropped by
|
||||
// filter but not the children.
|
||||
if ( !writeName )
|
||||
{
|
||||
// Fix broken parent refs.
|
||||
for ( var c = 0, length = this.children.length ; c < length ; c++ )
|
||||
this.children[ c ].parent = element.parent;
|
||||
|
||||
this.writeChildrenHtml.call( element, writer, isChildrenFiltered ? null : filter );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// The element may have been changed, so update the local
|
||||
// references.
|
||||
attributes = element.attributes;
|
||||
}
|
||||
|
||||
// Open element tag.
|
||||
writer.openTag( writeName, attributes );
|
||||
|
||||
// Copy all attributes to an array.
|
||||
var attribsArray = [];
|
||||
// Iterate over the attributes twice since filters may alter
|
||||
// other attributes.
|
||||
for ( var i = 0 ; i < 2; i++ )
|
||||
{
|
||||
for ( a in attributes )
|
||||
{
|
||||
newAttrName = a;
|
||||
value = attributes[ a ];
|
||||
if ( i == 1 )
|
||||
attribsArray.push( [ a, value ] );
|
||||
else if ( filter )
|
||||
{
|
||||
while ( true )
|
||||
{
|
||||
if ( !( newAttrName = filter.onAttributeName( a ) ) )
|
||||
{
|
||||
delete attributes[ a ];
|
||||
break;
|
||||
}
|
||||
else if ( newAttrName != a )
|
||||
{
|
||||
delete attributes[ a ];
|
||||
a = newAttrName;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
if ( newAttrName )
|
||||
{
|
||||
if ( ( value = filter.onAttribute( element, newAttrName, value ) ) === false )
|
||||
delete attributes[ newAttrName ];
|
||||
else
|
||||
attributes [ newAttrName ] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Sort the attributes by name.
|
||||
if ( writer.sortAttributes )
|
||||
attribsArray.sort( sortAttribs );
|
||||
|
||||
// Send the attributes.
|
||||
var len = attribsArray.length;
|
||||
for ( i = 0 ; i < len ; i++ )
|
||||
{
|
||||
var attrib = attribsArray[ i ];
|
||||
writer.attribute( attrib[0], attrib[1] );
|
||||
}
|
||||
|
||||
// Close the tag.
|
||||
writer.openTagClose( writeName, element.isEmpty );
|
||||
|
||||
if ( !element.isEmpty )
|
||||
{
|
||||
this.writeChildrenHtml.call( element, writer, isChildrenFiltered ? null : filter );
|
||||
// Close the element.
|
||||
writer.closeTag( writeName );
|
||||
}
|
||||
},
|
||||
|
||||
writeChildrenHtml : function( writer, filter )
|
||||
{
|
||||
// Send children.
|
||||
CKEDITOR.htmlParser.fragment.prototype.writeChildrenHtml.apply( this, arguments );
|
||||
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
@ -1,288 +1,288 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
CKEDITOR.htmlParser.filter = CKEDITOR.tools.createClass(
|
||||
{
|
||||
$ : function( rules )
|
||||
{
|
||||
this._ =
|
||||
{
|
||||
elementNames : [],
|
||||
attributeNames : [],
|
||||
elements : { $length : 0 },
|
||||
attributes : { $length : 0 }
|
||||
};
|
||||
|
||||
if ( rules )
|
||||
this.addRules( rules, 10 );
|
||||
},
|
||||
|
||||
proto :
|
||||
{
|
||||
addRules : function( rules, priority )
|
||||
{
|
||||
if ( typeof priority != 'number' )
|
||||
priority = 10;
|
||||
|
||||
// Add the elementNames.
|
||||
addItemsToList( this._.elementNames, rules.elementNames, priority );
|
||||
|
||||
// Add the attributeNames.
|
||||
addItemsToList( this._.attributeNames, rules.attributeNames, priority );
|
||||
|
||||
// Add the elements.
|
||||
addNamedItems( this._.elements, rules.elements, priority );
|
||||
|
||||
// Add the attributes.
|
||||
addNamedItems( this._.attributes, rules.attributes, priority );
|
||||
|
||||
// Add the text.
|
||||
this._.text = transformNamedItem( this._.text, rules.text, priority ) || this._.text;
|
||||
|
||||
// Add the comment.
|
||||
this._.comment = transformNamedItem( this._.comment, rules.comment, priority ) || this._.comment;
|
||||
|
||||
// Add root fragment.
|
||||
this._.root = transformNamedItem( this._.root, rules.root, priority ) || this._.root;
|
||||
},
|
||||
|
||||
onElementName : function( name )
|
||||
{
|
||||
return filterName( name, this._.elementNames );
|
||||
},
|
||||
|
||||
onAttributeName : function( name )
|
||||
{
|
||||
return filterName( name, this._.attributeNames );
|
||||
},
|
||||
|
||||
onText : function( text )
|
||||
{
|
||||
var textFilter = this._.text;
|
||||
return textFilter ? textFilter.filter( text ) : text;
|
||||
},
|
||||
|
||||
onComment : function( commentText, comment )
|
||||
{
|
||||
var textFilter = this._.comment;
|
||||
return textFilter ? textFilter.filter( commentText, comment ) : commentText;
|
||||
},
|
||||
|
||||
onFragment : function( element )
|
||||
{
|
||||
var rootFilter = this._.root;
|
||||
return rootFilter ? rootFilter.filter( element ) : element;
|
||||
},
|
||||
|
||||
onElement : function( element )
|
||||
{
|
||||
// We must apply filters set to the specific element name as
|
||||
// well as those set to the generic $ name. So, add both to an
|
||||
// array and process them in a small loop.
|
||||
var filters = [ this._.elements[ '^' ], this._.elements[ element.name ], this._.elements.$ ],
|
||||
filter, ret;
|
||||
|
||||
for ( var i = 0 ; i < 3 ; i++ )
|
||||
{
|
||||
filter = filters[ i ];
|
||||
if ( filter )
|
||||
{
|
||||
ret = filter.filter( element, this );
|
||||
|
||||
if ( ret === false )
|
||||
return null;
|
||||
|
||||
if ( ret && ret != element )
|
||||
return this.onNode( ret );
|
||||
|
||||
// The non-root element has been dismissed by one of the filters.
|
||||
if ( element.parent && !element.name )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return element;
|
||||
},
|
||||
|
||||
onNode : function( node )
|
||||
{
|
||||
var type = node.type;
|
||||
|
||||
return type == CKEDITOR.NODE_ELEMENT ? this.onElement( node ) :
|
||||
type == CKEDITOR.NODE_TEXT ? new CKEDITOR.htmlParser.text( this.onText( node.value ) ) :
|
||||
type == CKEDITOR.NODE_COMMENT ? new CKEDITOR.htmlParser.comment( this.onComment( node.value ) ):
|
||||
null;
|
||||
},
|
||||
|
||||
onAttribute : function( element, name, value )
|
||||
{
|
||||
var filter = this._.attributes[ name ];
|
||||
|
||||
if ( filter )
|
||||
{
|
||||
var ret = filter.filter( value, element, this );
|
||||
|
||||
if ( ret === false )
|
||||
return false;
|
||||
|
||||
if ( typeof ret != 'undefined' )
|
||||
return ret;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function filterName( name, filters )
|
||||
{
|
||||
for ( var i = 0 ; name && i < filters.length ; i++ )
|
||||
{
|
||||
var filter = filters[ i ];
|
||||
name = name.replace( filter[ 0 ], filter[ 1 ] );
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
function addItemsToList( list, items, priority )
|
||||
{
|
||||
if ( typeof items == 'function' )
|
||||
items = [ items ];
|
||||
|
||||
var i, j,
|
||||
listLength = list.length,
|
||||
itemsLength = items && items.length;
|
||||
|
||||
if ( itemsLength )
|
||||
{
|
||||
// Find the index to insert the items at.
|
||||
for ( i = 0 ; i < listLength && list[ i ].pri < priority ; i++ )
|
||||
{ /*jsl:pass*/ }
|
||||
|
||||
// Add all new items to the list at the specific index.
|
||||
for ( j = itemsLength - 1 ; j >= 0 ; j-- )
|
||||
{
|
||||
var item = items[ j ];
|
||||
if ( item )
|
||||
{
|
||||
item.pri = priority;
|
||||
list.splice( i, 0, item );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addNamedItems( hashTable, items, priority )
|
||||
{
|
||||
if ( items )
|
||||
{
|
||||
for ( var name in items )
|
||||
{
|
||||
var current = hashTable[ name ];
|
||||
|
||||
hashTable[ name ] =
|
||||
transformNamedItem(
|
||||
current,
|
||||
items[ name ],
|
||||
priority );
|
||||
|
||||
if ( !current )
|
||||
hashTable.$length++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function transformNamedItem( current, item, priority )
|
||||
{
|
||||
if ( item )
|
||||
{
|
||||
item.pri = priority;
|
||||
|
||||
if ( current )
|
||||
{
|
||||
// If the current item is not an Array, transform it.
|
||||
if ( !current.splice )
|
||||
{
|
||||
if ( current.pri > priority )
|
||||
current = [ item, current ];
|
||||
else
|
||||
current = [ current, item ];
|
||||
|
||||
current.filter = callItems;
|
||||
}
|
||||
else
|
||||
addItemsToList( current, item, priority );
|
||||
|
||||
return current;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.filter = item;
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Invoke filters sequentially on the array, break the iteration
|
||||
// when it doesn't make sense to continue anymore.
|
||||
function callItems( currentEntry )
|
||||
{
|
||||
var isNode = currentEntry.type
|
||||
|| currentEntry instanceof CKEDITOR.htmlParser.fragment;
|
||||
|
||||
for ( var i = 0 ; i < this.length ; i++ )
|
||||
{
|
||||
// Backup the node info before filtering.
|
||||
if ( isNode )
|
||||
{
|
||||
var orgType = currentEntry.type,
|
||||
orgName = currentEntry.name;
|
||||
}
|
||||
|
||||
var item = this[ i ],
|
||||
ret = item.apply( window, arguments );
|
||||
|
||||
if ( ret === false )
|
||||
return ret;
|
||||
|
||||
// We're filtering node (element/fragment).
|
||||
if ( isNode )
|
||||
{
|
||||
// No further filtering if it's not anymore
|
||||
// fitable for the subsequent filters.
|
||||
if ( ret && ( ret.name != orgName
|
||||
|| ret.type != orgType ) )
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
// Filtering value (nodeName/textValue/attrValue).
|
||||
else
|
||||
{
|
||||
// No further filtering if it's not
|
||||
// any more values.
|
||||
if ( typeof ret != 'string' )
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret != undefined && ( currentEntry = ret );
|
||||
}
|
||||
|
||||
return currentEntry;
|
||||
}
|
||||
})();
|
||||
|
||||
// "entities" plugin
|
||||
/*
|
||||
{
|
||||
text : function( text )
|
||||
{
|
||||
// TODO : Process entities.
|
||||
return text.toUpperCase();
|
||||
}
|
||||
};
|
||||
*/
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
CKEDITOR.htmlParser.filter = CKEDITOR.tools.createClass(
|
||||
{
|
||||
$ : function( rules )
|
||||
{
|
||||
this._ =
|
||||
{
|
||||
elementNames : [],
|
||||
attributeNames : [],
|
||||
elements : { $length : 0 },
|
||||
attributes : { $length : 0 }
|
||||
};
|
||||
|
||||
if ( rules )
|
||||
this.addRules( rules, 10 );
|
||||
},
|
||||
|
||||
proto :
|
||||
{
|
||||
addRules : function( rules, priority )
|
||||
{
|
||||
if ( typeof priority != 'number' )
|
||||
priority = 10;
|
||||
|
||||
// Add the elementNames.
|
||||
addItemsToList( this._.elementNames, rules.elementNames, priority );
|
||||
|
||||
// Add the attributeNames.
|
||||
addItemsToList( this._.attributeNames, rules.attributeNames, priority );
|
||||
|
||||
// Add the elements.
|
||||
addNamedItems( this._.elements, rules.elements, priority );
|
||||
|
||||
// Add the attributes.
|
||||
addNamedItems( this._.attributes, rules.attributes, priority );
|
||||
|
||||
// Add the text.
|
||||
this._.text = transformNamedItem( this._.text, rules.text, priority ) || this._.text;
|
||||
|
||||
// Add the comment.
|
||||
this._.comment = transformNamedItem( this._.comment, rules.comment, priority ) || this._.comment;
|
||||
|
||||
// Add root fragment.
|
||||
this._.root = transformNamedItem( this._.root, rules.root, priority ) || this._.root;
|
||||
},
|
||||
|
||||
onElementName : function( name )
|
||||
{
|
||||
return filterName( name, this._.elementNames );
|
||||
},
|
||||
|
||||
onAttributeName : function( name )
|
||||
{
|
||||
return filterName( name, this._.attributeNames );
|
||||
},
|
||||
|
||||
onText : function( text )
|
||||
{
|
||||
var textFilter = this._.text;
|
||||
return textFilter ? textFilter.filter( text ) : text;
|
||||
},
|
||||
|
||||
onComment : function( commentText, comment )
|
||||
{
|
||||
var textFilter = this._.comment;
|
||||
return textFilter ? textFilter.filter( commentText, comment ) : commentText;
|
||||
},
|
||||
|
||||
onFragment : function( element )
|
||||
{
|
||||
var rootFilter = this._.root;
|
||||
return rootFilter ? rootFilter.filter( element ) : element;
|
||||
},
|
||||
|
||||
onElement : function( element )
|
||||
{
|
||||
// We must apply filters set to the specific element name as
|
||||
// well as those set to the generic $ name. So, add both to an
|
||||
// array and process them in a small loop.
|
||||
var filters = [ this._.elements[ '^' ], this._.elements[ element.name ], this._.elements.$ ],
|
||||
filter, ret;
|
||||
|
||||
for ( var i = 0 ; i < 3 ; i++ )
|
||||
{
|
||||
filter = filters[ i ];
|
||||
if ( filter )
|
||||
{
|
||||
ret = filter.filter( element, this );
|
||||
|
||||
if ( ret === false )
|
||||
return null;
|
||||
|
||||
if ( ret && ret != element )
|
||||
return this.onNode( ret );
|
||||
|
||||
// The non-root element has been dismissed by one of the filters.
|
||||
if ( element.parent && !element.name )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return element;
|
||||
},
|
||||
|
||||
onNode : function( node )
|
||||
{
|
||||
var type = node.type;
|
||||
|
||||
return type == CKEDITOR.NODE_ELEMENT ? this.onElement( node ) :
|
||||
type == CKEDITOR.NODE_TEXT ? new CKEDITOR.htmlParser.text( this.onText( node.value ) ) :
|
||||
type == CKEDITOR.NODE_COMMENT ? new CKEDITOR.htmlParser.comment( this.onComment( node.value ) ):
|
||||
null;
|
||||
},
|
||||
|
||||
onAttribute : function( element, name, value )
|
||||
{
|
||||
var filter = this._.attributes[ name ];
|
||||
|
||||
if ( filter )
|
||||
{
|
||||
var ret = filter.filter( value, element, this );
|
||||
|
||||
if ( ret === false )
|
||||
return false;
|
||||
|
||||
if ( typeof ret != 'undefined' )
|
||||
return ret;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function filterName( name, filters )
|
||||
{
|
||||
for ( var i = 0 ; name && i < filters.length ; i++ )
|
||||
{
|
||||
var filter = filters[ i ];
|
||||
name = name.replace( filter[ 0 ], filter[ 1 ] );
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
function addItemsToList( list, items, priority )
|
||||
{
|
||||
if ( typeof items == 'function' )
|
||||
items = [ items ];
|
||||
|
||||
var i, j,
|
||||
listLength = list.length,
|
||||
itemsLength = items && items.length;
|
||||
|
||||
if ( itemsLength )
|
||||
{
|
||||
// Find the index to insert the items at.
|
||||
for ( i = 0 ; i < listLength && list[ i ].pri < priority ; i++ )
|
||||
{ /*jsl:pass*/ }
|
||||
|
||||
// Add all new items to the list at the specific index.
|
||||
for ( j = itemsLength - 1 ; j >= 0 ; j-- )
|
||||
{
|
||||
var item = items[ j ];
|
||||
if ( item )
|
||||
{
|
||||
item.pri = priority;
|
||||
list.splice( i, 0, item );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addNamedItems( hashTable, items, priority )
|
||||
{
|
||||
if ( items )
|
||||
{
|
||||
for ( var name in items )
|
||||
{
|
||||
var current = hashTable[ name ];
|
||||
|
||||
hashTable[ name ] =
|
||||
transformNamedItem(
|
||||
current,
|
||||
items[ name ],
|
||||
priority );
|
||||
|
||||
if ( !current )
|
||||
hashTable.$length++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function transformNamedItem( current, item, priority )
|
||||
{
|
||||
if ( item )
|
||||
{
|
||||
item.pri = priority;
|
||||
|
||||
if ( current )
|
||||
{
|
||||
// If the current item is not an Array, transform it.
|
||||
if ( !current.splice )
|
||||
{
|
||||
if ( current.pri > priority )
|
||||
current = [ item, current ];
|
||||
else
|
||||
current = [ current, item ];
|
||||
|
||||
current.filter = callItems;
|
||||
}
|
||||
else
|
||||
addItemsToList( current, item, priority );
|
||||
|
||||
return current;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.filter = item;
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Invoke filters sequentially on the array, break the iteration
|
||||
// when it doesn't make sense to continue anymore.
|
||||
function callItems( currentEntry )
|
||||
{
|
||||
var isNode = currentEntry.type
|
||||
|| currentEntry instanceof CKEDITOR.htmlParser.fragment;
|
||||
|
||||
for ( var i = 0 ; i < this.length ; i++ )
|
||||
{
|
||||
// Backup the node info before filtering.
|
||||
if ( isNode )
|
||||
{
|
||||
var orgType = currentEntry.type,
|
||||
orgName = currentEntry.name;
|
||||
}
|
||||
|
||||
var item = this[ i ],
|
||||
ret = item.apply( window, arguments );
|
||||
|
||||
if ( ret === false )
|
||||
return ret;
|
||||
|
||||
// We're filtering node (element/fragment).
|
||||
if ( isNode )
|
||||
{
|
||||
// No further filtering if it's not anymore
|
||||
// fitable for the subsequent filters.
|
||||
if ( ret && ( ret.name != orgName
|
||||
|| ret.type != orgType ) )
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
// Filtering value (nodeName/textValue/attrValue).
|
||||
else
|
||||
{
|
||||
// No further filtering if it's not
|
||||
// any more values.
|
||||
if ( typeof ret != 'string' )
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret != undefined && ( currentEntry = ret );
|
||||
}
|
||||
|
||||
return currentEntry;
|
||||
}
|
||||
})();
|
||||
|
||||
// "entities" plugin
|
||||
/*
|
||||
{
|
||||
text : function( text )
|
||||
{
|
||||
// TODO : Process entities.
|
||||
return text.toUpperCase();
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,53 +1,53 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
/**
|
||||
* A lightweight representation of HTML text.
|
||||
* @constructor
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.htmlParser.text = function( value )
|
||||
{
|
||||
/**
|
||||
* The text value.
|
||||
* @type String
|
||||
* @example
|
||||
*/
|
||||
this.value = value;
|
||||
|
||||
/** @private */
|
||||
this._ =
|
||||
{
|
||||
isBlockLike : false
|
||||
};
|
||||
};
|
||||
|
||||
CKEDITOR.htmlParser.text.prototype =
|
||||
{
|
||||
/**
|
||||
* The node type. This is a constant value set to {@link CKEDITOR.NODE_TEXT}.
|
||||
* @type Number
|
||||
* @example
|
||||
*/
|
||||
type : CKEDITOR.NODE_TEXT,
|
||||
|
||||
/**
|
||||
* Writes the HTML representation of this text to a CKEDITOR.htmlWriter.
|
||||
* @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
|
||||
* @example
|
||||
*/
|
||||
writeHtml : function( writer, filter )
|
||||
{
|
||||
var text = this.value;
|
||||
|
||||
if ( filter && !( text = filter.onText( text, this ) ) )
|
||||
return;
|
||||
|
||||
writer.text( text );
|
||||
}
|
||||
};
|
||||
})();
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
/**
|
||||
* A lightweight representation of HTML text.
|
||||
* @constructor
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.htmlParser.text = function( value )
|
||||
{
|
||||
/**
|
||||
* The text value.
|
||||
* @type String
|
||||
* @example
|
||||
*/
|
||||
this.value = value;
|
||||
|
||||
/** @private */
|
||||
this._ =
|
||||
{
|
||||
isBlockLike : false
|
||||
};
|
||||
};
|
||||
|
||||
CKEDITOR.htmlParser.text.prototype =
|
||||
{
|
||||
/**
|
||||
* The node type. This is a constant value set to {@link CKEDITOR.NODE_TEXT}.
|
||||
* @type Number
|
||||
* @example
|
||||
*/
|
||||
type : CKEDITOR.NODE_TEXT,
|
||||
|
||||
/**
|
||||
* Writes the HTML representation of this text to a CKEDITOR.htmlWriter.
|
||||
* @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
|
||||
* @example
|
||||
*/
|
||||
writeHtml : function( writer, filter )
|
||||
{
|
||||
var text = this.value;
|
||||
|
||||
if ( filter && !( text = filter.onText( text, this ) ) )
|
||||
return;
|
||||
|
||||
writer.text( text );
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
@ -1,157 +1,157 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
var loadedLangs = {};
|
||||
|
||||
/**
|
||||
* @namespace Holds language related functions.
|
||||
*/
|
||||
CKEDITOR.lang =
|
||||
{
|
||||
/**
|
||||
* The list of languages available in the editor core.
|
||||
* @type Object
|
||||
* @example
|
||||
* alert( CKEDITOR.lang.en ); // "true"
|
||||
*/
|
||||
languages :
|
||||
{
|
||||
'af' : 1,
|
||||
'ar' : 1,
|
||||
'bg' : 1,
|
||||
'bn' : 1,
|
||||
'bs' : 1,
|
||||
'ca' : 1,
|
||||
'cs' : 1,
|
||||
'cy' : 1,
|
||||
'da' : 1,
|
||||
'de' : 1,
|
||||
'el' : 1,
|
||||
'en-au' : 1,
|
||||
'en-ca' : 1,
|
||||
'en-gb' : 1,
|
||||
'en' : 1,
|
||||
'eo' : 1,
|
||||
'es' : 1,
|
||||
'et' : 1,
|
||||
'eu' : 1,
|
||||
'fa' : 1,
|
||||
'fi' : 1,
|
||||
'fo' : 1,
|
||||
'fr-ca' : 1,
|
||||
'fr' : 1,
|
||||
'gl' : 1,
|
||||
'gu' : 1,
|
||||
'he' : 1,
|
||||
'hi' : 1,
|
||||
'hr' : 1,
|
||||
'hu' : 1,
|
||||
'is' : 1,
|
||||
'it' : 1,
|
||||
'ja' : 1,
|
||||
'ka' : 1,
|
||||
'km' : 1,
|
||||
'ko' : 1,
|
||||
'lt' : 1,
|
||||
'lv' : 1,
|
||||
'mn' : 1,
|
||||
'ms' : 1,
|
||||
'nb' : 1,
|
||||
'nl' : 1,
|
||||
'no' : 1,
|
||||
'pl' : 1,
|
||||
'pt-br' : 1,
|
||||
'pt' : 1,
|
||||
'ro' : 1,
|
||||
'ru' : 1,
|
||||
'sk' : 1,
|
||||
'sl' : 1,
|
||||
'sr-latn' : 1,
|
||||
'sr' : 1,
|
||||
'sv' : 1,
|
||||
'th' : 1,
|
||||
'tr' : 1,
|
||||
'uk' : 1,
|
||||
'vi' : 1,
|
||||
'zh-cn' : 1,
|
||||
'zh' : 1
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads a specific language file, or auto detect it. A callback is
|
||||
* then called when the file gets loaded.
|
||||
* @param {String} languageCode The code of the language file to be
|
||||
* loaded. If null or empty, autodetection will be performed. The
|
||||
* same happens if the language is not supported.
|
||||
* @param {String} defaultLanguage The language to be used if
|
||||
* languageCode is not supported or if the autodetection fails.
|
||||
* @param {Function} callback A function to be called once the
|
||||
* language file is loaded. Two parameters are passed to this
|
||||
* function: the language code and the loaded language entries.
|
||||
* @example
|
||||
*/
|
||||
load : function( languageCode, defaultLanguage, callback )
|
||||
{
|
||||
// If no languageCode - fallback to browser or default.
|
||||
// If languageCode - fallback to no-localized version or default.
|
||||
if ( !languageCode || !CKEDITOR.lang.languages[ languageCode ] )
|
||||
languageCode = this.detect( defaultLanguage, languageCode );
|
||||
|
||||
if ( !this[ languageCode ] )
|
||||
{
|
||||
CKEDITOR.scriptLoader.load( CKEDITOR.getUrl(
|
||||
'_source/' + // @Packager.RemoveLine
|
||||
'lang/' + languageCode + '.js' ),
|
||||
function()
|
||||
{
|
||||
callback( languageCode, this[ languageCode ] );
|
||||
}
|
||||
, this );
|
||||
}
|
||||
else
|
||||
callback( languageCode, this[ languageCode ] );
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the language that best fit the user language. For example,
|
||||
* suppose that the user language is "pt-br". If this language is
|
||||
* supported by the editor, it is returned. Otherwise, if only "pt" is
|
||||
* supported, it is returned instead. If none of the previous are
|
||||
* supported, a default language is then returned.
|
||||
* @param {String} defaultLanguage The default language to be returned
|
||||
* if the user language is not supported.
|
||||
* @param {String} [probeLanguage] A language code to try to use,
|
||||
* instead of the browser based autodetection.
|
||||
* @returns {String} The detected language code.
|
||||
* @example
|
||||
* alert( CKEDITOR.lang.detect( 'en' ) ); // e.g., in a German browser: "de"
|
||||
*/
|
||||
detect : function( defaultLanguage, probeLanguage )
|
||||
{
|
||||
var languages = this.languages;
|
||||
probeLanguage = probeLanguage || navigator.userLanguage || navigator.language || defaultLanguage;
|
||||
|
||||
var parts = probeLanguage
|
||||
.toLowerCase()
|
||||
.match( /([a-z]+)(?:-([a-z]+))?/ ),
|
||||
lang = parts[1],
|
||||
locale = parts[2];
|
||||
|
||||
if ( languages[ lang + '-' + locale ] )
|
||||
lang = lang + '-' + locale;
|
||||
else if ( !languages[ lang ] )
|
||||
lang = null;
|
||||
|
||||
CKEDITOR.lang.detect = lang ?
|
||||
function() { return lang; } :
|
||||
function( defaultLanguage ) { return defaultLanguage; };
|
||||
|
||||
return lang || defaultLanguage;
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
var loadedLangs = {};
|
||||
|
||||
/**
|
||||
* @namespace Holds language related functions.
|
||||
*/
|
||||
CKEDITOR.lang =
|
||||
{
|
||||
/**
|
||||
* The list of languages available in the editor core.
|
||||
* @type Object
|
||||
* @example
|
||||
* alert( CKEDITOR.lang.en ); // "true"
|
||||
*/
|
||||
languages :
|
||||
{
|
||||
'af' : 1,
|
||||
'ar' : 1,
|
||||
'bg' : 1,
|
||||
'bn' : 1,
|
||||
'bs' : 1,
|
||||
'ca' : 1,
|
||||
'cs' : 1,
|
||||
'cy' : 1,
|
||||
'da' : 1,
|
||||
'de' : 1,
|
||||
'el' : 1,
|
||||
'en-au' : 1,
|
||||
'en-ca' : 1,
|
||||
'en-gb' : 1,
|
||||
'en' : 1,
|
||||
'eo' : 1,
|
||||
'es' : 1,
|
||||
'et' : 1,
|
||||
'eu' : 1,
|
||||
'fa' : 1,
|
||||
'fi' : 1,
|
||||
'fo' : 1,
|
||||
'fr-ca' : 1,
|
||||
'fr' : 1,
|
||||
'gl' : 1,
|
||||
'gu' : 1,
|
||||
'he' : 1,
|
||||
'hi' : 1,
|
||||
'hr' : 1,
|
||||
'hu' : 1,
|
||||
'is' : 1,
|
||||
'it' : 1,
|
||||
'ja' : 1,
|
||||
'ka' : 1,
|
||||
'km' : 1,
|
||||
'ko' : 1,
|
||||
'lt' : 1,
|
||||
'lv' : 1,
|
||||
'mn' : 1,
|
||||
'ms' : 1,
|
||||
'nb' : 1,
|
||||
'nl' : 1,
|
||||
'no' : 1,
|
||||
'pl' : 1,
|
||||
'pt-br' : 1,
|
||||
'pt' : 1,
|
||||
'ro' : 1,
|
||||
'ru' : 1,
|
||||
'sk' : 1,
|
||||
'sl' : 1,
|
||||
'sr-latn' : 1,
|
||||
'sr' : 1,
|
||||
'sv' : 1,
|
||||
'th' : 1,
|
||||
'tr' : 1,
|
||||
'uk' : 1,
|
||||
'vi' : 1,
|
||||
'zh-cn' : 1,
|
||||
'zh' : 1
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads a specific language file, or auto detect it. A callback is
|
||||
* then called when the file gets loaded.
|
||||
* @param {String} languageCode The code of the language file to be
|
||||
* loaded. If null or empty, autodetection will be performed. The
|
||||
* same happens if the language is not supported.
|
||||
* @param {String} defaultLanguage The language to be used if
|
||||
* languageCode is not supported or if the autodetection fails.
|
||||
* @param {Function} callback A function to be called once the
|
||||
* language file is loaded. Two parameters are passed to this
|
||||
* function: the language code and the loaded language entries.
|
||||
* @example
|
||||
*/
|
||||
load : function( languageCode, defaultLanguage, callback )
|
||||
{
|
||||
// If no languageCode - fallback to browser or default.
|
||||
// If languageCode - fallback to no-localized version or default.
|
||||
if ( !languageCode || !CKEDITOR.lang.languages[ languageCode ] )
|
||||
languageCode = this.detect( defaultLanguage, languageCode );
|
||||
|
||||
if ( !this[ languageCode ] )
|
||||
{
|
||||
CKEDITOR.scriptLoader.load( CKEDITOR.getUrl(
|
||||
'_source/' + // @Packager.RemoveLine
|
||||
'lang/' + languageCode + '.js' ),
|
||||
function()
|
||||
{
|
||||
callback( languageCode, this[ languageCode ] );
|
||||
}
|
||||
, this );
|
||||
}
|
||||
else
|
||||
callback( languageCode, this[ languageCode ] );
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the language that best fit the user language. For example,
|
||||
* suppose that the user language is "pt-br". If this language is
|
||||
* supported by the editor, it is returned. Otherwise, if only "pt" is
|
||||
* supported, it is returned instead. If none of the previous are
|
||||
* supported, a default language is then returned.
|
||||
* @param {String} defaultLanguage The default language to be returned
|
||||
* if the user language is not supported.
|
||||
* @param {String} [probeLanguage] A language code to try to use,
|
||||
* instead of the browser based autodetection.
|
||||
* @returns {String} The detected language code.
|
||||
* @example
|
||||
* alert( CKEDITOR.lang.detect( 'en' ) ); // e.g., in a German browser: "de"
|
||||
*/
|
||||
detect : function( defaultLanguage, probeLanguage )
|
||||
{
|
||||
var languages = this.languages;
|
||||
probeLanguage = probeLanguage || navigator.userLanguage || navigator.language || defaultLanguage;
|
||||
|
||||
var parts = probeLanguage
|
||||
.toLowerCase()
|
||||
.match( /([a-z]+)(?:-([a-z]+))?/ ),
|
||||
lang = parts[1],
|
||||
locale = parts[2];
|
||||
|
||||
if ( languages[ lang + '-' + locale ] )
|
||||
lang = lang + '-' + locale;
|
||||
else if ( !languages[ lang ] )
|
||||
lang = null;
|
||||
|
||||
CKEDITOR.lang.detect = lang ?
|
||||
function() { return lang; } :
|
||||
function( defaultLanguage ) { return defaultLanguage; };
|
||||
|
||||
return lang || defaultLanguage;
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
@ -1,240 +1,240 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.loader} objects, which is used to
|
||||
* load core scripts and their dependencies from _source.
|
||||
*/
|
||||
|
||||
if ( typeof CKEDITOR == 'undefined' )
|
||||
CKEDITOR = {};
|
||||
|
||||
if ( !CKEDITOR.loader )
|
||||
{
|
||||
/**
|
||||
* Load core scripts and their dependencies from _source.
|
||||
* @namespace
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.loader = (function()
|
||||
{
|
||||
// Table of script names and their dependencies.
|
||||
var scripts =
|
||||
{
|
||||
'core/_bootstrap' : [ 'core/config', 'core/ckeditor', 'core/plugins', 'core/scriptloader', 'core/tools', /* The following are entries that we want to force loading at the end to avoid dependence recursion */ 'core/dom/comment', 'core/dom/elementpath', 'core/dom/text', 'core/dom/rangelist' ],
|
||||
'core/ckeditor' : [ 'core/ckeditor_basic', 'core/dom', 'core/dtd', 'core/dom/document', 'core/dom/element', 'core/editor', 'core/event', 'core/htmlparser', 'core/htmlparser/element', 'core/htmlparser/fragment', 'core/htmlparser/filter', 'core/htmlparser/basicwriter', 'core/tools' ],
|
||||
'core/ckeditor_base' : [],
|
||||
'core/ckeditor_basic' : [ 'core/editor_basic', 'core/env', 'core/event' ],
|
||||
'core/command' : [],
|
||||
'core/config' : [ 'core/ckeditor_base' ],
|
||||
'core/dom' : [],
|
||||
'core/dom/comment' : [ 'core/dom/node' ],
|
||||
'core/dom/document' : [ 'core/dom', 'core/dom/domobject', 'core/dom/window' ],
|
||||
'core/dom/documentfragment' : [ 'core/dom/element' ],
|
||||
'core/dom/element' : [ 'core/dom', 'core/dom/document', 'core/dom/domobject', 'core/dom/node', 'core/dom/nodelist', 'core/tools' ],
|
||||
'core/dom/elementpath' : [ 'core/dom/element' ],
|
||||
'core/dom/event' : [],
|
||||
'core/dom/node' : [ 'core/dom/domobject', 'core/tools' ],
|
||||
'core/dom/nodelist' : [ 'core/dom/node' ],
|
||||
'core/dom/domobject' : [ 'core/dom/event' ],
|
||||
'core/dom/range' : [ 'core/dom/document', 'core/dom/documentfragment', 'core/dom/element', 'core/dom/walker' ],
|
||||
'core/dom/rangelist' : [ 'core/dom/range' ],
|
||||
'core/dom/text' : [ 'core/dom/node', 'core/dom/domobject' ],
|
||||
'core/dom/walker' : [ 'core/dom/node' ],
|
||||
'core/dom/window' : [ 'core/dom/domobject' ],
|
||||
'core/dtd' : [ 'core/tools' ],
|
||||
'core/editor' : [ 'core/command', 'core/config', 'core/editor_basic', 'core/focusmanager', 'core/lang', 'core/plugins', 'core/skins', 'core/themes', 'core/tools', 'core/ui' ],
|
||||
'core/editor_basic' : [ 'core/event' ],
|
||||
'core/env' : [],
|
||||
'core/event' : [],
|
||||
'core/focusmanager' : [],
|
||||
'core/htmlparser' : [],
|
||||
'core/htmlparser/comment' : [ 'core/htmlparser' ],
|
||||
'core/htmlparser/element' : [ 'core/htmlparser', 'core/htmlparser/fragment' ],
|
||||
'core/htmlparser/fragment' : [ 'core/htmlparser', 'core/htmlparser/comment', 'core/htmlparser/text', 'core/htmlparser/cdata' ],
|
||||
'core/htmlparser/text' : [ 'core/htmlparser' ],
|
||||
'core/htmlparser/cdata' : [ 'core/htmlparser' ],
|
||||
'core/htmlparser/filter' : [ 'core/htmlparser' ],
|
||||
'core/htmlparser/basicwriter': [ 'core/htmlparser' ],
|
||||
'core/lang' : [],
|
||||
'core/plugins' : [ 'core/resourcemanager' ],
|
||||
'core/resourcemanager' : [ 'core/scriptloader', 'core/tools' ],
|
||||
'core/scriptloader' : [ 'core/dom/element', 'core/env' ],
|
||||
'core/skins' : [ 'core/scriptloader' ],
|
||||
'core/themes' : [ 'core/resourcemanager' ],
|
||||
'core/tools' : [ 'core/env' ],
|
||||
'core/ui' : []
|
||||
};
|
||||
|
||||
var basePath = (function()
|
||||
{
|
||||
// This is a copy of CKEDITOR.basePath, but requires the script having
|
||||
// "_source/core/loader.js".
|
||||
if ( CKEDITOR && CKEDITOR.basePath )
|
||||
return CKEDITOR.basePath;
|
||||
|
||||
// Find out the editor directory path, based on its <script> tag.
|
||||
var path = '';
|
||||
var scripts = document.getElementsByTagName( 'script' );
|
||||
|
||||
for ( var i = 0 ; i < scripts.length ; i++ )
|
||||
{
|
||||
var match = scripts[i].src.match( /(^|.*?[\\\/])(?:_source\/)?core\/loader.js(?:\?.*)?$/i );
|
||||
|
||||
if ( match )
|
||||
{
|
||||
path = match[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// In IE (only) the script.src string is the raw valued entered in the
|
||||
// HTML. Other browsers return the full resolved URL instead.
|
||||
if ( path.indexOf('://') == -1 )
|
||||
{
|
||||
// Absolute path.
|
||||
if ( path.indexOf( '/' ) === 0 )
|
||||
path = location.href.match( /^.*?:\/\/[^\/]*/ )[0] + path;
|
||||
// Relative path.
|
||||
else
|
||||
path = location.href.match( /^[^\?]*\// )[0] + path;
|
||||
}
|
||||
|
||||
return path;
|
||||
})();
|
||||
|
||||
var timestamp = 'C6HH5UF';
|
||||
|
||||
var getUrl = function( resource )
|
||||
{
|
||||
if ( CKEDITOR && CKEDITOR.getUrl )
|
||||
return CKEDITOR.getUrl( resource );
|
||||
|
||||
return basePath + resource +
|
||||
( resource.indexOf( '?' ) >= 0 ? '&' : '?' ) +
|
||||
't=' + timestamp;
|
||||
};
|
||||
|
||||
var pendingLoad = [];
|
||||
|
||||
/** @lends CKEDITOR.loader */
|
||||
return {
|
||||
/**
|
||||
* The list of loaded scripts in their loading order.
|
||||
* @type Array
|
||||
* @example
|
||||
* // Alert the loaded script names.
|
||||
* alert( <b>CKEDITOR.loader.loadedScripts</b> );
|
||||
*/
|
||||
loadedScripts : [],
|
||||
|
||||
loadPending : function()
|
||||
{
|
||||
var scriptName = pendingLoad.shift();
|
||||
|
||||
if ( !scriptName )
|
||||
return;
|
||||
|
||||
var scriptSrc = getUrl( '_source/' + scriptName + '.js' );
|
||||
|
||||
var script = document.createElement( 'script' );
|
||||
script.type = 'text/javascript';
|
||||
script.src = scriptSrc;
|
||||
|
||||
function onScriptLoaded()
|
||||
{
|
||||
// Append this script to the list of loaded scripts.
|
||||
CKEDITOR.loader.loadedScripts.push( scriptName );
|
||||
|
||||
// Load the next.
|
||||
CKEDITOR.loader.loadPending();
|
||||
}
|
||||
|
||||
// We must guarantee the execution order of the scripts, so we
|
||||
// need to load them one by one. (#4145)
|
||||
// The following if/else block has been taken from the scriptloader core code.
|
||||
if ( typeof(script.onreadystatechange) !== "undefined" )
|
||||
{
|
||||
/** @ignore */
|
||||
script.onreadystatechange = function()
|
||||
{
|
||||
if ( script.readyState == 'loaded' || script.readyState == 'complete' )
|
||||
{
|
||||
script.onreadystatechange = null;
|
||||
onScriptLoaded();
|
||||
}
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
/** @ignore */
|
||||
script.onload = function()
|
||||
{
|
||||
// Some browsers, such as Safari, may call the onLoad function
|
||||
// immediately. Which will break the loading sequence. (#3661)
|
||||
setTimeout( function() { onScriptLoaded( scriptName ); }, 0 );
|
||||
};
|
||||
}
|
||||
|
||||
document.body.appendChild( script );
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads a specific script, including its dependencies. This is not a
|
||||
* synchronous loading, which means that the code to be loaded will
|
||||
* not necessarily be available after this call.
|
||||
* @example
|
||||
* CKEDITOR.loader.load( 'core/dom/element' );
|
||||
*/
|
||||
load : function( scriptName, defer )
|
||||
{
|
||||
// Check if the script has already been loaded.
|
||||
if ( scriptName in this.loadedScripts )
|
||||
return;
|
||||
|
||||
// Get the script dependencies list.
|
||||
var dependencies = scripts[ scriptName ];
|
||||
if ( !dependencies )
|
||||
throw 'The script name"' + scriptName + '" is not defined.';
|
||||
|
||||
// Mark the script as loaded, even before really loading it, to
|
||||
// avoid cross references recursion.
|
||||
this.loadedScripts[ scriptName ] = true;
|
||||
|
||||
// Load all dependencies first.
|
||||
for ( var i = 0 ; i < dependencies.length ; i++ )
|
||||
this.load( dependencies[ i ], true );
|
||||
|
||||
var scriptSrc = getUrl( '_source/' + scriptName + '.js' );
|
||||
|
||||
// Append the <script> element to the DOM.
|
||||
// If the page is fully loaded, we can't use document.write
|
||||
// but if the script is run while the body is loading then it's safe to use it
|
||||
// Unfortunately, Firefox <3.6 doesn't support document.readyState, so it won't get this improvement
|
||||
if ( document.body && (!document.readyState || document.readyState == 'complete') )
|
||||
{
|
||||
pendingLoad.push( scriptName );
|
||||
|
||||
if ( !defer )
|
||||
this.loadPending();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Append this script to the list of loaded scripts.
|
||||
this.loadedScripts.push( scriptName );
|
||||
|
||||
document.write( '<script src="' + scriptSrc + '" type="text/javascript"><\/script>' );
|
||||
}
|
||||
}
|
||||
};
|
||||
})();
|
||||
}
|
||||
|
||||
// Check if any script has been defined for autoload.
|
||||
if ( CKEDITOR._autoLoad )
|
||||
{
|
||||
CKEDITOR.loader.load( CKEDITOR._autoLoad );
|
||||
delete CKEDITOR._autoLoad;
|
||||
}
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.loader} objects, which is used to
|
||||
* load core scripts and their dependencies from _source.
|
||||
*/
|
||||
|
||||
if ( typeof CKEDITOR == 'undefined' )
|
||||
CKEDITOR = {};
|
||||
|
||||
if ( !CKEDITOR.loader )
|
||||
{
|
||||
/**
|
||||
* Load core scripts and their dependencies from _source.
|
||||
* @namespace
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.loader = (function()
|
||||
{
|
||||
// Table of script names and their dependencies.
|
||||
var scripts =
|
||||
{
|
||||
'core/_bootstrap' : [ 'core/config', 'core/ckeditor', 'core/plugins', 'core/scriptloader', 'core/tools', /* The following are entries that we want to force loading at the end to avoid dependence recursion */ 'core/dom/comment', 'core/dom/elementpath', 'core/dom/text', 'core/dom/rangelist' ],
|
||||
'core/ckeditor' : [ 'core/ckeditor_basic', 'core/dom', 'core/dtd', 'core/dom/document', 'core/dom/element', 'core/editor', 'core/event', 'core/htmlparser', 'core/htmlparser/element', 'core/htmlparser/fragment', 'core/htmlparser/filter', 'core/htmlparser/basicwriter', 'core/tools' ],
|
||||
'core/ckeditor_base' : [],
|
||||
'core/ckeditor_basic' : [ 'core/editor_basic', 'core/env', 'core/event' ],
|
||||
'core/command' : [],
|
||||
'core/config' : [ 'core/ckeditor_base' ],
|
||||
'core/dom' : [],
|
||||
'core/dom/comment' : [ 'core/dom/node' ],
|
||||
'core/dom/document' : [ 'core/dom', 'core/dom/domobject', 'core/dom/window' ],
|
||||
'core/dom/documentfragment' : [ 'core/dom/element' ],
|
||||
'core/dom/element' : [ 'core/dom', 'core/dom/document', 'core/dom/domobject', 'core/dom/node', 'core/dom/nodelist', 'core/tools' ],
|
||||
'core/dom/elementpath' : [ 'core/dom/element' ],
|
||||
'core/dom/event' : [],
|
||||
'core/dom/node' : [ 'core/dom/domobject', 'core/tools' ],
|
||||
'core/dom/nodelist' : [ 'core/dom/node' ],
|
||||
'core/dom/domobject' : [ 'core/dom/event' ],
|
||||
'core/dom/range' : [ 'core/dom/document', 'core/dom/documentfragment', 'core/dom/element', 'core/dom/walker' ],
|
||||
'core/dom/rangelist' : [ 'core/dom/range' ],
|
||||
'core/dom/text' : [ 'core/dom/node', 'core/dom/domobject' ],
|
||||
'core/dom/walker' : [ 'core/dom/node' ],
|
||||
'core/dom/window' : [ 'core/dom/domobject' ],
|
||||
'core/dtd' : [ 'core/tools' ],
|
||||
'core/editor' : [ 'core/command', 'core/config', 'core/editor_basic', 'core/focusmanager', 'core/lang', 'core/plugins', 'core/skins', 'core/themes', 'core/tools', 'core/ui' ],
|
||||
'core/editor_basic' : [ 'core/event' ],
|
||||
'core/env' : [],
|
||||
'core/event' : [],
|
||||
'core/focusmanager' : [],
|
||||
'core/htmlparser' : [],
|
||||
'core/htmlparser/comment' : [ 'core/htmlparser' ],
|
||||
'core/htmlparser/element' : [ 'core/htmlparser', 'core/htmlparser/fragment' ],
|
||||
'core/htmlparser/fragment' : [ 'core/htmlparser', 'core/htmlparser/comment', 'core/htmlparser/text', 'core/htmlparser/cdata' ],
|
||||
'core/htmlparser/text' : [ 'core/htmlparser' ],
|
||||
'core/htmlparser/cdata' : [ 'core/htmlparser' ],
|
||||
'core/htmlparser/filter' : [ 'core/htmlparser' ],
|
||||
'core/htmlparser/basicwriter': [ 'core/htmlparser' ],
|
||||
'core/lang' : [],
|
||||
'core/plugins' : [ 'core/resourcemanager' ],
|
||||
'core/resourcemanager' : [ 'core/scriptloader', 'core/tools' ],
|
||||
'core/scriptloader' : [ 'core/dom/element', 'core/env' ],
|
||||
'core/skins' : [ 'core/scriptloader' ],
|
||||
'core/themes' : [ 'core/resourcemanager' ],
|
||||
'core/tools' : [ 'core/env' ],
|
||||
'core/ui' : []
|
||||
};
|
||||
|
||||
var basePath = (function()
|
||||
{
|
||||
// This is a copy of CKEDITOR.basePath, but requires the script having
|
||||
// "_source/core/loader.js".
|
||||
if ( CKEDITOR && CKEDITOR.basePath )
|
||||
return CKEDITOR.basePath;
|
||||
|
||||
// Find out the editor directory path, based on its <script> tag.
|
||||
var path = '';
|
||||
var scripts = document.getElementsByTagName( 'script' );
|
||||
|
||||
for ( var i = 0 ; i < scripts.length ; i++ )
|
||||
{
|
||||
var match = scripts[i].src.match( /(^|.*?[\\\/])(?:_source\/)?core\/loader.js(?:\?.*)?$/i );
|
||||
|
||||
if ( match )
|
||||
{
|
||||
path = match[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// In IE (only) the script.src string is the raw valued entered in the
|
||||
// HTML. Other browsers return the full resolved URL instead.
|
||||
if ( path.indexOf('://') == -1 )
|
||||
{
|
||||
// Absolute path.
|
||||
if ( path.indexOf( '/' ) === 0 )
|
||||
path = location.href.match( /^.*?:\/\/[^\/]*/ )[0] + path;
|
||||
// Relative path.
|
||||
else
|
||||
path = location.href.match( /^[^\?]*\// )[0] + path;
|
||||
}
|
||||
|
||||
return path;
|
||||
})();
|
||||
|
||||
var timestamp = 'C6HH5UF';
|
||||
|
||||
var getUrl = function( resource )
|
||||
{
|
||||
if ( CKEDITOR && CKEDITOR.getUrl )
|
||||
return CKEDITOR.getUrl( resource );
|
||||
|
||||
return basePath + resource +
|
||||
( resource.indexOf( '?' ) >= 0 ? '&' : '?' ) +
|
||||
't=' + timestamp;
|
||||
};
|
||||
|
||||
var pendingLoad = [];
|
||||
|
||||
/** @lends CKEDITOR.loader */
|
||||
return {
|
||||
/**
|
||||
* The list of loaded scripts in their loading order.
|
||||
* @type Array
|
||||
* @example
|
||||
* // Alert the loaded script names.
|
||||
* alert( <b>CKEDITOR.loader.loadedScripts</b> );
|
||||
*/
|
||||
loadedScripts : [],
|
||||
|
||||
loadPending : function()
|
||||
{
|
||||
var scriptName = pendingLoad.shift();
|
||||
|
||||
if ( !scriptName )
|
||||
return;
|
||||
|
||||
var scriptSrc = getUrl( '_source/' + scriptName + '.js' );
|
||||
|
||||
var script = document.createElement( 'script' );
|
||||
script.type = 'text/javascript';
|
||||
script.src = scriptSrc;
|
||||
|
||||
function onScriptLoaded()
|
||||
{
|
||||
// Append this script to the list of loaded scripts.
|
||||
CKEDITOR.loader.loadedScripts.push( scriptName );
|
||||
|
||||
// Load the next.
|
||||
CKEDITOR.loader.loadPending();
|
||||
}
|
||||
|
||||
// We must guarantee the execution order of the scripts, so we
|
||||
// need to load them one by one. (#4145)
|
||||
// The following if/else block has been taken from the scriptloader core code.
|
||||
if ( typeof(script.onreadystatechange) !== "undefined" )
|
||||
{
|
||||
/** @ignore */
|
||||
script.onreadystatechange = function()
|
||||
{
|
||||
if ( script.readyState == 'loaded' || script.readyState == 'complete' )
|
||||
{
|
||||
script.onreadystatechange = null;
|
||||
onScriptLoaded();
|
||||
}
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
/** @ignore */
|
||||
script.onload = function()
|
||||
{
|
||||
// Some browsers, such as Safari, may call the onLoad function
|
||||
// immediately. Which will break the loading sequence. (#3661)
|
||||
setTimeout( function() { onScriptLoaded( scriptName ); }, 0 );
|
||||
};
|
||||
}
|
||||
|
||||
document.body.appendChild( script );
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads a specific script, including its dependencies. This is not a
|
||||
* synchronous loading, which means that the code to be loaded will
|
||||
* not necessarily be available after this call.
|
||||
* @example
|
||||
* CKEDITOR.loader.load( 'core/dom/element' );
|
||||
*/
|
||||
load : function( scriptName, defer )
|
||||
{
|
||||
// Check if the script has already been loaded.
|
||||
if ( scriptName in this.loadedScripts )
|
||||
return;
|
||||
|
||||
// Get the script dependencies list.
|
||||
var dependencies = scripts[ scriptName ];
|
||||
if ( !dependencies )
|
||||
throw 'The script name"' + scriptName + '" is not defined.';
|
||||
|
||||
// Mark the script as loaded, even before really loading it, to
|
||||
// avoid cross references recursion.
|
||||
this.loadedScripts[ scriptName ] = true;
|
||||
|
||||
// Load all dependencies first.
|
||||
for ( var i = 0 ; i < dependencies.length ; i++ )
|
||||
this.load( dependencies[ i ], true );
|
||||
|
||||
var scriptSrc = getUrl( '_source/' + scriptName + '.js' );
|
||||
|
||||
// Append the <script> element to the DOM.
|
||||
// If the page is fully loaded, we can't use document.write
|
||||
// but if the script is run while the body is loading then it's safe to use it
|
||||
// Unfortunately, Firefox <3.6 doesn't support document.readyState, so it won't get this improvement
|
||||
if ( document.body && (!document.readyState || document.readyState == 'complete') )
|
||||
{
|
||||
pendingLoad.push( scriptName );
|
||||
|
||||
if ( !defer )
|
||||
this.loadPending();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Append this script to the list of loaded scripts.
|
||||
this.loadedScripts.push( scriptName );
|
||||
|
||||
document.write( '<script src="' + scriptSrc + '" type="text/javascript"><\/script>' );
|
||||
}
|
||||
}
|
||||
};
|
||||
})();
|
||||
}
|
||||
|
||||
// Check if any script has been defined for autoload.
|
||||
if ( CKEDITOR._autoLoad )
|
||||
{
|
||||
CKEDITOR.loader.load( CKEDITOR._autoLoad );
|
||||
delete CKEDITOR._autoLoad;
|
||||
}
|
||||
|
||||
@ -1,83 +1,83 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the "virtual" {@link CKEDITOR.pluginDefinition} class, which
|
||||
* contains the defintion of a plugin. This file is for documentation
|
||||
* purposes only.
|
||||
*/
|
||||
|
||||
/**
|
||||
* (Virtual Class) Do not call this constructor. This class is not really part
|
||||
* of the API. It just illustrates the features of plugin objects to be
|
||||
* passed to the {@link CKEDITOR.plugins.add} function.
|
||||
* @name CKEDITOR.pluginDefinition
|
||||
* @constructor
|
||||
* @example
|
||||
*/
|
||||
|
||||
/**
|
||||
* A list of plugins that are required by this plugin. Note that this property
|
||||
* doesn't guarantee the loading order of the plugins.
|
||||
* @name CKEDITOR.pluginDefinition.prototype.requires
|
||||
* @type Array
|
||||
* @example
|
||||
* CKEDITOR.plugins.add( 'sample',
|
||||
* {
|
||||
* requires : [ 'button', 'selection' ]
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* A list of language files available for this plugin. These files are stored inside
|
||||
* the "lang" directory, which is inside the plugin directory, follow the name
|
||||
* pattern of "langCode.js", and contain a language definition created with {@link CKEDITOR.pluginDefinition#setLang}.
|
||||
* While the plugin is being loaded, the editor checks this list to see if
|
||||
* a language file of the current editor language ({@link CKEDITOR.editor#langCode})
|
||||
* is available, and if so, loads it. Otherwise, the file represented by the first list item
|
||||
* in the list is loaded.
|
||||
* @name CKEDITOR.pluginDefinition.prototype.lang
|
||||
* @type Array
|
||||
* @example
|
||||
* CKEDITOR.plugins.add( 'sample',
|
||||
* {
|
||||
* lang : [ 'en', 'fr' ]
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Function called on initialization of every editor instance created in the
|
||||
* page before the init() call task. The beforeInit function will be called for
|
||||
* all plugins, after that the init function is called for all of them. This
|
||||
* feature makes it possible to initialize things that could be used in the
|
||||
* init function of other plugins.
|
||||
* @name CKEDITOR.pluginDefinition.prototype.beforeInit
|
||||
* @function
|
||||
* @param {CKEDITOR.editor} editor The editor instance being initialized.
|
||||
* @example
|
||||
* CKEDITOR.plugins.add( 'sample',
|
||||
* {
|
||||
* beforeInit : function( editor )
|
||||
* {
|
||||
* alert( 'Editor "' + editor.name + '" is to be initialized!' );
|
||||
* }
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Function called on initialization of every editor instance created in the
|
||||
* page.
|
||||
* @name CKEDITOR.pluginDefinition.prototype.init
|
||||
* @function
|
||||
* @param {CKEDITOR.editor} editor The editor instance being initialized.
|
||||
* @example
|
||||
* CKEDITOR.plugins.add( 'sample',
|
||||
* {
|
||||
* init : function( editor )
|
||||
* {
|
||||
* alert( 'Editor "' + editor.name + '" is being initialized!' );
|
||||
* }
|
||||
* });
|
||||
*/
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the "virtual" {@link CKEDITOR.pluginDefinition} class, which
|
||||
* contains the defintion of a plugin. This file is for documentation
|
||||
* purposes only.
|
||||
*/
|
||||
|
||||
/**
|
||||
* (Virtual Class) Do not call this constructor. This class is not really part
|
||||
* of the API. It just illustrates the features of plugin objects to be
|
||||
* passed to the {@link CKEDITOR.plugins.add} function.
|
||||
* @name CKEDITOR.pluginDefinition
|
||||
* @constructor
|
||||
* @example
|
||||
*/
|
||||
|
||||
/**
|
||||
* A list of plugins that are required by this plugin. Note that this property
|
||||
* doesn't guarantee the loading order of the plugins.
|
||||
* @name CKEDITOR.pluginDefinition.prototype.requires
|
||||
* @type Array
|
||||
* @example
|
||||
* CKEDITOR.plugins.add( 'sample',
|
||||
* {
|
||||
* requires : [ 'button', 'selection' ]
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* A list of language files available for this plugin. These files are stored inside
|
||||
* the "lang" directory, which is inside the plugin directory, follow the name
|
||||
* pattern of "langCode.js", and contain a language definition created with {@link CKEDITOR.pluginDefinition#setLang}.
|
||||
* While the plugin is being loaded, the editor checks this list to see if
|
||||
* a language file of the current editor language ({@link CKEDITOR.editor#langCode})
|
||||
* is available, and if so, loads it. Otherwise, the file represented by the first list item
|
||||
* in the list is loaded.
|
||||
* @name CKEDITOR.pluginDefinition.prototype.lang
|
||||
* @type Array
|
||||
* @example
|
||||
* CKEDITOR.plugins.add( 'sample',
|
||||
* {
|
||||
* lang : [ 'en', 'fr' ]
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Function called on initialization of every editor instance created in the
|
||||
* page before the init() call task. The beforeInit function will be called for
|
||||
* all plugins, after that the init function is called for all of them. This
|
||||
* feature makes it possible to initialize things that could be used in the
|
||||
* init function of other plugins.
|
||||
* @name CKEDITOR.pluginDefinition.prototype.beforeInit
|
||||
* @function
|
||||
* @param {CKEDITOR.editor} editor The editor instance being initialized.
|
||||
* @example
|
||||
* CKEDITOR.plugins.add( 'sample',
|
||||
* {
|
||||
* beforeInit : function( editor )
|
||||
* {
|
||||
* alert( 'Editor "' + editor.name + '" is to be initialized!' );
|
||||
* }
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Function called on initialization of every editor instance created in the
|
||||
* page.
|
||||
* @name CKEDITOR.pluginDefinition.prototype.init
|
||||
* @function
|
||||
* @param {CKEDITOR.editor} editor The editor instance being initialized.
|
||||
* @example
|
||||
* CKEDITOR.plugins.add( 'sample',
|
||||
* {
|
||||
* init : function( editor )
|
||||
* {
|
||||
* alert( 'Editor "' + editor.name + '" is being initialized!' );
|
||||
* }
|
||||
* });
|
||||
*/
|
||||
|
||||
@ -1,103 +1,103 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.plugins} object, which is used to
|
||||
* manage plugins registration and loading.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Manages plugins registration and loading.
|
||||
* @namespace
|
||||
* @augments CKEDITOR.resourceManager
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.plugins = new CKEDITOR.resourceManager(
|
||||
'_source/' + // @Packager.RemoveLine
|
||||
'plugins/', 'plugin' );
|
||||
|
||||
// PACKAGER_RENAME( CKEDITOR.plugins )
|
||||
|
||||
CKEDITOR.plugins.load = CKEDITOR.tools.override( CKEDITOR.plugins.load, function( originalLoad )
|
||||
{
|
||||
return function( name, callback, scope )
|
||||
{
|
||||
var allPlugins = {};
|
||||
|
||||
var loadPlugins = function( names )
|
||||
{
|
||||
originalLoad.call( this, names, function( plugins )
|
||||
{
|
||||
CKEDITOR.tools.extend( allPlugins, plugins );
|
||||
|
||||
var requiredPlugins = [];
|
||||
for ( var pluginName in plugins )
|
||||
{
|
||||
var plugin = plugins[ pluginName ],
|
||||
requires = plugin && plugin.requires;
|
||||
|
||||
if ( requires )
|
||||
{
|
||||
for ( var i = 0 ; i < requires.length ; i++ )
|
||||
{
|
||||
if ( !allPlugins[ requires[ i ] ] )
|
||||
requiredPlugins.push( requires[ i ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( requiredPlugins.length )
|
||||
loadPlugins.call( this, requiredPlugins );
|
||||
else
|
||||
{
|
||||
// Call the "onLoad" function for all plugins.
|
||||
for ( pluginName in allPlugins )
|
||||
{
|
||||
plugin = allPlugins[ pluginName ];
|
||||
if ( plugin.onLoad && !plugin.onLoad._called )
|
||||
{
|
||||
plugin.onLoad();
|
||||
plugin.onLoad._called = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Call the callback.
|
||||
if ( callback )
|
||||
callback.call( scope || window, allPlugins );
|
||||
}
|
||||
}
|
||||
, this);
|
||||
|
||||
};
|
||||
|
||||
loadPlugins.call( this, name );
|
||||
};
|
||||
});
|
||||
|
||||
/**
|
||||
* Loads a specific language file, or auto detect it. A callback is
|
||||
* then called when the file gets loaded.
|
||||
* @param {String} pluginName The name of the plugin to which the provided translation
|
||||
* should be attached.
|
||||
* @param {String} languageCode The code of the language translation provided.
|
||||
* @param {Object} languageEntries An object that contains pairs of label and
|
||||
* the respective translation.
|
||||
* @example
|
||||
* CKEDITOR.plugins.setLang( 'myPlugin', 'en', {
|
||||
* title : 'My plugin',
|
||||
* selectOption : 'Please select an option'
|
||||
* } );
|
||||
*/
|
||||
CKEDITOR.plugins.setLang = function( pluginName, languageCode, languageEntries )
|
||||
{
|
||||
var plugin = this.get( pluginName ),
|
||||
pluginLangEntries = plugin.langEntries || ( plugin.langEntries = {} ),
|
||||
pluginLang = plugin.lang || ( plugin.lang = [] );
|
||||
|
||||
if ( CKEDITOR.tools.indexOf( pluginLang, languageCode ) == -1 )
|
||||
pluginLang.push( languageCode );
|
||||
|
||||
pluginLangEntries[ languageCode ] = languageEntries;
|
||||
};
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.plugins} object, which is used to
|
||||
* manage plugins registration and loading.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Manages plugins registration and loading.
|
||||
* @namespace
|
||||
* @augments CKEDITOR.resourceManager
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.plugins = new CKEDITOR.resourceManager(
|
||||
'_source/' + // @Packager.RemoveLine
|
||||
'plugins/', 'plugin' );
|
||||
|
||||
// PACKAGER_RENAME( CKEDITOR.plugins )
|
||||
|
||||
CKEDITOR.plugins.load = CKEDITOR.tools.override( CKEDITOR.plugins.load, function( originalLoad )
|
||||
{
|
||||
return function( name, callback, scope )
|
||||
{
|
||||
var allPlugins = {};
|
||||
|
||||
var loadPlugins = function( names )
|
||||
{
|
||||
originalLoad.call( this, names, function( plugins )
|
||||
{
|
||||
CKEDITOR.tools.extend( allPlugins, plugins );
|
||||
|
||||
var requiredPlugins = [];
|
||||
for ( var pluginName in plugins )
|
||||
{
|
||||
var plugin = plugins[ pluginName ],
|
||||
requires = plugin && plugin.requires;
|
||||
|
||||
if ( requires )
|
||||
{
|
||||
for ( var i = 0 ; i < requires.length ; i++ )
|
||||
{
|
||||
if ( !allPlugins[ requires[ i ] ] )
|
||||
requiredPlugins.push( requires[ i ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( requiredPlugins.length )
|
||||
loadPlugins.call( this, requiredPlugins );
|
||||
else
|
||||
{
|
||||
// Call the "onLoad" function for all plugins.
|
||||
for ( pluginName in allPlugins )
|
||||
{
|
||||
plugin = allPlugins[ pluginName ];
|
||||
if ( plugin.onLoad && !plugin.onLoad._called )
|
||||
{
|
||||
plugin.onLoad();
|
||||
plugin.onLoad._called = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Call the callback.
|
||||
if ( callback )
|
||||
callback.call( scope || window, allPlugins );
|
||||
}
|
||||
}
|
||||
, this);
|
||||
|
||||
};
|
||||
|
||||
loadPlugins.call( this, name );
|
||||
};
|
||||
});
|
||||
|
||||
/**
|
||||
* Loads a specific language file, or auto detect it. A callback is
|
||||
* then called when the file gets loaded.
|
||||
* @param {String} pluginName The name of the plugin to which the provided translation
|
||||
* should be attached.
|
||||
* @param {String} languageCode The code of the language translation provided.
|
||||
* @param {Object} languageEntries An object that contains pairs of label and
|
||||
* the respective translation.
|
||||
* @example
|
||||
* CKEDITOR.plugins.setLang( 'myPlugin', 'en', {
|
||||
* title : 'My plugin',
|
||||
* selectOption : 'Please select an option'
|
||||
* } );
|
||||
*/
|
||||
CKEDITOR.plugins.setLang = function( pluginName, languageCode, languageEntries )
|
||||
{
|
||||
var plugin = this.get( pluginName ),
|
||||
pluginLangEntries = plugin.langEntries || ( plugin.langEntries = {} ),
|
||||
pluginLang = plugin.lang || ( plugin.lang = [] );
|
||||
|
||||
if ( CKEDITOR.tools.indexOf( pluginLang, languageCode ) == -1 )
|
||||
pluginLang.push( languageCode );
|
||||
|
||||
pluginLangEntries[ languageCode ] = languageEntries;
|
||||
};
|
||||
|
||||
@ -1,238 +1,238 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.resourceManager} class, which is
|
||||
* the base for resource managers, like plugins and themes.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for resource managers, like plugins and themes. This class is not
|
||||
* intended to be used out of the CKEditor core code.
|
||||
* @param {String} basePath The path for the resources folder.
|
||||
* @param {String} fileName The name used for resource files.
|
||||
* @namespace
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.resourceManager = function( basePath, fileName )
|
||||
{
|
||||
/**
|
||||
* The base directory containing all resources.
|
||||
* @name CKEDITOR.resourceManager.prototype.basePath
|
||||
* @type String
|
||||
* @example
|
||||
*/
|
||||
this.basePath = basePath;
|
||||
|
||||
/**
|
||||
* The name used for resource files.
|
||||
* @name CKEDITOR.resourceManager.prototype.fileName
|
||||
* @type String
|
||||
* @example
|
||||
*/
|
||||
this.fileName = fileName;
|
||||
|
||||
/**
|
||||
* Contains references to all resources that have already been registered
|
||||
* with {@link #add}.
|
||||
* @name CKEDITOR.resourceManager.prototype.registered
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
this.registered = {};
|
||||
|
||||
/**
|
||||
* Contains references to all resources that have already been loaded
|
||||
* with {@link #load}.
|
||||
* @name CKEDITOR.resourceManager.prototype.loaded
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
this.loaded = {};
|
||||
|
||||
/**
|
||||
* Contains references to all resources that have already been registered
|
||||
* with {@link #addExternal}.
|
||||
* @name CKEDITOR.resourceManager.prototype.externals
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
this.externals = {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
this._ =
|
||||
{
|
||||
// List of callbacks waiting for plugins to be loaded.
|
||||
waitingList : {}
|
||||
};
|
||||
};
|
||||
|
||||
CKEDITOR.resourceManager.prototype =
|
||||
{
|
||||
/**
|
||||
* Registers a resource.
|
||||
* @param {String} name The resource name.
|
||||
* @param {Object} [definition] The resource definition.
|
||||
* @example
|
||||
* CKEDITOR.plugins.add( 'sample', { ... plugin definition ... } );
|
||||
* @see CKEDITOR.pluginDefinition
|
||||
*/
|
||||
add : function( name, definition )
|
||||
{
|
||||
if ( this.registered[ name ] )
|
||||
throw '[CKEDITOR.resourceManager.add] The resource name "' + name + '" is already registered.';
|
||||
|
||||
CKEDITOR.fire( name + CKEDITOR.tools.capitalize( this.fileName ) + 'Ready',
|
||||
this.registered[ name ] = definition || {} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the definition of a specific resource.
|
||||
* @param {String} name The resource name.
|
||||
* @type Object
|
||||
* @example
|
||||
* var definition = <b>CKEDITOR.plugins.get( 'sample' )</b>;
|
||||
*/
|
||||
get : function( name )
|
||||
{
|
||||
return this.registered[ name ] || null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the folder path for a specific loaded resource.
|
||||
* @param {String} name The resource name.
|
||||
* @type String
|
||||
* @example
|
||||
* alert( <b>CKEDITOR.plugins.getPath( 'sample' )</b> ); // "<editor path>/plugins/sample/"
|
||||
*/
|
||||
getPath : function( name )
|
||||
{
|
||||
var external = this.externals[ name ];
|
||||
return CKEDITOR.getUrl( ( external && external.dir ) || this.basePath + name + '/' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the file path for a specific loaded resource.
|
||||
* @param {String} name The resource name.
|
||||
* @type String
|
||||
* @example
|
||||
* alert( <b>CKEDITOR.plugins.getFilePath( 'sample' )</b> ); // "<editor path>/plugins/sample/plugin.js"
|
||||
*/
|
||||
getFilePath : function( name )
|
||||
{
|
||||
var external = this.externals[ name ];
|
||||
return CKEDITOR.getUrl(
|
||||
this.getPath( name ) +
|
||||
( ( external && ( typeof external.file == 'string' ) ) ? external.file : this.fileName + '.js' ) );
|
||||
},
|
||||
|
||||
/**
|
||||
* Registers one or more resources to be loaded from an external path
|
||||
* instead of the core base path.
|
||||
* @param {String} names The resource names, separated by commas.
|
||||
* @param {String} path The path of the folder containing the resource.
|
||||
* @param {String} [fileName] The resource file name. If not provided, the
|
||||
* default name is used; If provided with a empty string, will implicitly indicates that {@param path}
|
||||
* is already the full path.
|
||||
* @example
|
||||
* // Loads a plugin from '/myplugin/samples/plugin.js'.
|
||||
* CKEDITOR.plugins.addExternal( 'sample', '/myplugins/sample/' );
|
||||
* @example
|
||||
* // Loads a plugin from '/myplugin/samples/my_plugin.js'.
|
||||
* CKEDITOR.plugins.addExternal( 'sample', '/myplugins/sample/', 'my_plugin.js' );
|
||||
* @example
|
||||
* // Loads a plugin from '/myplugin/samples/my_plugin.js'.
|
||||
* CKEDITOR.plugins.addExternal( 'sample', '/myplugins/sample/my_plugin.js', '' );
|
||||
*/
|
||||
addExternal : function( names, path, fileName )
|
||||
{
|
||||
names = names.split( ',' );
|
||||
for ( var i = 0 ; i < names.length ; i++ )
|
||||
{
|
||||
var name = names[ i ];
|
||||
|
||||
this.externals[ name ] =
|
||||
{
|
||||
dir : path,
|
||||
file : fileName
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads one or more resources.
|
||||
* @param {String|Array} name The name of the resource to load. It may be a
|
||||
* string with a single resource name, or an array with several names.
|
||||
* @param {Function} callback A function to be called when all resources
|
||||
* are loaded. The callback will receive an array containing all
|
||||
* loaded names.
|
||||
* @param {Object} [scope] The scope object to be used for the callback
|
||||
* call.
|
||||
* @example
|
||||
* <b>CKEDITOR.plugins.load</b>( 'myplugin', function( plugins )
|
||||
* {
|
||||
* alert( plugins['myplugin'] ); // "object"
|
||||
* });
|
||||
*/
|
||||
load : function( names, callback, scope )
|
||||
{
|
||||
// Ensure that we have an array of names.
|
||||
if ( !CKEDITOR.tools.isArray( names ) )
|
||||
names = names ? [ names ] : [];
|
||||
|
||||
var loaded = this.loaded,
|
||||
registered = this.registered,
|
||||
urls = [],
|
||||
urlsNames = {},
|
||||
resources = {};
|
||||
|
||||
// Loop through all names.
|
||||
for ( var i = 0 ; i < names.length ; i++ )
|
||||
{
|
||||
var name = names[ i ];
|
||||
|
||||
if ( !name )
|
||||
continue;
|
||||
|
||||
// If not available yet.
|
||||
if ( !loaded[ name ] && !registered[ name ] )
|
||||
{
|
||||
var url = this.getFilePath( name );
|
||||
urls.push( url );
|
||||
if ( !( url in urlsNames ) )
|
||||
urlsNames[ url ] = [];
|
||||
urlsNames[ url ].push( name );
|
||||
}
|
||||
else
|
||||
resources[ name ] = this.get( name );
|
||||
}
|
||||
|
||||
CKEDITOR.scriptLoader.load( urls, function( completed, failed )
|
||||
{
|
||||
if ( failed.length )
|
||||
{
|
||||
throw '[CKEDITOR.resourceManager.load] Resource name "' + urlsNames[ failed[ 0 ] ].join( ',' )
|
||||
+ '" was not found at "' + failed[ 0 ] + '".';
|
||||
}
|
||||
|
||||
for ( var i = 0 ; i < completed.length ; i++ )
|
||||
{
|
||||
var nameList = urlsNames[ completed[ i ] ];
|
||||
for ( var j = 0 ; j < nameList.length ; j++ )
|
||||
{
|
||||
var name = nameList[ j ];
|
||||
resources[ name ] = this.get( name );
|
||||
|
||||
loaded[ name ] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
callback.call( scope, resources );
|
||||
}
|
||||
, this);
|
||||
}
|
||||
};
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.resourceManager} class, which is
|
||||
* the base for resource managers, like plugins and themes.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for resource managers, like plugins and themes. This class is not
|
||||
* intended to be used out of the CKEditor core code.
|
||||
* @param {String} basePath The path for the resources folder.
|
||||
* @param {String} fileName The name used for resource files.
|
||||
* @namespace
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.resourceManager = function( basePath, fileName )
|
||||
{
|
||||
/**
|
||||
* The base directory containing all resources.
|
||||
* @name CKEDITOR.resourceManager.prototype.basePath
|
||||
* @type String
|
||||
* @example
|
||||
*/
|
||||
this.basePath = basePath;
|
||||
|
||||
/**
|
||||
* The name used for resource files.
|
||||
* @name CKEDITOR.resourceManager.prototype.fileName
|
||||
* @type String
|
||||
* @example
|
||||
*/
|
||||
this.fileName = fileName;
|
||||
|
||||
/**
|
||||
* Contains references to all resources that have already been registered
|
||||
* with {@link #add}.
|
||||
* @name CKEDITOR.resourceManager.prototype.registered
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
this.registered = {};
|
||||
|
||||
/**
|
||||
* Contains references to all resources that have already been loaded
|
||||
* with {@link #load}.
|
||||
* @name CKEDITOR.resourceManager.prototype.loaded
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
this.loaded = {};
|
||||
|
||||
/**
|
||||
* Contains references to all resources that have already been registered
|
||||
* with {@link #addExternal}.
|
||||
* @name CKEDITOR.resourceManager.prototype.externals
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
this.externals = {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
this._ =
|
||||
{
|
||||
// List of callbacks waiting for plugins to be loaded.
|
||||
waitingList : {}
|
||||
};
|
||||
};
|
||||
|
||||
CKEDITOR.resourceManager.prototype =
|
||||
{
|
||||
/**
|
||||
* Registers a resource.
|
||||
* @param {String} name The resource name.
|
||||
* @param {Object} [definition] The resource definition.
|
||||
* @example
|
||||
* CKEDITOR.plugins.add( 'sample', { ... plugin definition ... } );
|
||||
* @see CKEDITOR.pluginDefinition
|
||||
*/
|
||||
add : function( name, definition )
|
||||
{
|
||||
if ( this.registered[ name ] )
|
||||
throw '[CKEDITOR.resourceManager.add] The resource name "' + name + '" is already registered.';
|
||||
|
||||
CKEDITOR.fire( name + CKEDITOR.tools.capitalize( this.fileName ) + 'Ready',
|
||||
this.registered[ name ] = definition || {} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the definition of a specific resource.
|
||||
* @param {String} name The resource name.
|
||||
* @type Object
|
||||
* @example
|
||||
* var definition = <b>CKEDITOR.plugins.get( 'sample' )</b>;
|
||||
*/
|
||||
get : function( name )
|
||||
{
|
||||
return this.registered[ name ] || null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the folder path for a specific loaded resource.
|
||||
* @param {String} name The resource name.
|
||||
* @type String
|
||||
* @example
|
||||
* alert( <b>CKEDITOR.plugins.getPath( 'sample' )</b> ); // "<editor path>/plugins/sample/"
|
||||
*/
|
||||
getPath : function( name )
|
||||
{
|
||||
var external = this.externals[ name ];
|
||||
return CKEDITOR.getUrl( ( external && external.dir ) || this.basePath + name + '/' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the file path for a specific loaded resource.
|
||||
* @param {String} name The resource name.
|
||||
* @type String
|
||||
* @example
|
||||
* alert( <b>CKEDITOR.plugins.getFilePath( 'sample' )</b> ); // "<editor path>/plugins/sample/plugin.js"
|
||||
*/
|
||||
getFilePath : function( name )
|
||||
{
|
||||
var external = this.externals[ name ];
|
||||
return CKEDITOR.getUrl(
|
||||
this.getPath( name ) +
|
||||
( ( external && ( typeof external.file == 'string' ) ) ? external.file : this.fileName + '.js' ) );
|
||||
},
|
||||
|
||||
/**
|
||||
* Registers one or more resources to be loaded from an external path
|
||||
* instead of the core base path.
|
||||
* @param {String} names The resource names, separated by commas.
|
||||
* @param {String} path The path of the folder containing the resource.
|
||||
* @param {String} [fileName] The resource file name. If not provided, the
|
||||
* default name is used; If provided with a empty string, will implicitly indicates that {@param path}
|
||||
* is already the full path.
|
||||
* @example
|
||||
* // Loads a plugin from '/myplugin/samples/plugin.js'.
|
||||
* CKEDITOR.plugins.addExternal( 'sample', '/myplugins/sample/' );
|
||||
* @example
|
||||
* // Loads a plugin from '/myplugin/samples/my_plugin.js'.
|
||||
* CKEDITOR.plugins.addExternal( 'sample', '/myplugins/sample/', 'my_plugin.js' );
|
||||
* @example
|
||||
* // Loads a plugin from '/myplugin/samples/my_plugin.js'.
|
||||
* CKEDITOR.plugins.addExternal( 'sample', '/myplugins/sample/my_plugin.js', '' );
|
||||
*/
|
||||
addExternal : function( names, path, fileName )
|
||||
{
|
||||
names = names.split( ',' );
|
||||
for ( var i = 0 ; i < names.length ; i++ )
|
||||
{
|
||||
var name = names[ i ];
|
||||
|
||||
this.externals[ name ] =
|
||||
{
|
||||
dir : path,
|
||||
file : fileName
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads one or more resources.
|
||||
* @param {String|Array} name The name of the resource to load. It may be a
|
||||
* string with a single resource name, or an array with several names.
|
||||
* @param {Function} callback A function to be called when all resources
|
||||
* are loaded. The callback will receive an array containing all
|
||||
* loaded names.
|
||||
* @param {Object} [scope] The scope object to be used for the callback
|
||||
* call.
|
||||
* @example
|
||||
* <b>CKEDITOR.plugins.load</b>( 'myplugin', function( plugins )
|
||||
* {
|
||||
* alert( plugins['myplugin'] ); // "object"
|
||||
* });
|
||||
*/
|
||||
load : function( names, callback, scope )
|
||||
{
|
||||
// Ensure that we have an array of names.
|
||||
if ( !CKEDITOR.tools.isArray( names ) )
|
||||
names = names ? [ names ] : [];
|
||||
|
||||
var loaded = this.loaded,
|
||||
registered = this.registered,
|
||||
urls = [],
|
||||
urlsNames = {},
|
||||
resources = {};
|
||||
|
||||
// Loop through all names.
|
||||
for ( var i = 0 ; i < names.length ; i++ )
|
||||
{
|
||||
var name = names[ i ];
|
||||
|
||||
if ( !name )
|
||||
continue;
|
||||
|
||||
// If not available yet.
|
||||
if ( !loaded[ name ] && !registered[ name ] )
|
||||
{
|
||||
var url = this.getFilePath( name );
|
||||
urls.push( url );
|
||||
if ( !( url in urlsNames ) )
|
||||
urlsNames[ url ] = [];
|
||||
urlsNames[ url ].push( name );
|
||||
}
|
||||
else
|
||||
resources[ name ] = this.get( name );
|
||||
}
|
||||
|
||||
CKEDITOR.scriptLoader.load( urls, function( completed, failed )
|
||||
{
|
||||
if ( failed.length )
|
||||
{
|
||||
throw '[CKEDITOR.resourceManager.load] Resource name "' + urlsNames[ failed[ 0 ] ].join( ',' )
|
||||
+ '" was not found at "' + failed[ 0 ] + '".';
|
||||
}
|
||||
|
||||
for ( var i = 0 ; i < completed.length ; i++ )
|
||||
{
|
||||
var nameList = urlsNames[ completed[ i ] ];
|
||||
for ( var j = 0 ; j < nameList.length ; j++ )
|
||||
{
|
||||
var name = nameList[ j ];
|
||||
resources[ name ] = this.get( name );
|
||||
|
||||
loaded[ name ] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
callback.call( scope, resources );
|
||||
}
|
||||
, this);
|
||||
}
|
||||
};
|
||||
|
||||
@ -1,180 +1,180 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.scriptLoader} object, used to load scripts
|
||||
* asynchronously.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Load scripts asynchronously.
|
||||
* @namespace
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.scriptLoader = (function()
|
||||
{
|
||||
var uniqueScripts = {},
|
||||
waitingList = {};
|
||||
|
||||
return /** @lends CKEDITOR.scriptLoader */ {
|
||||
/**
|
||||
* Loads one or more external script checking if not already loaded
|
||||
* previously by this function.
|
||||
* @param {String|Array} scriptUrl One or more URLs pointing to the
|
||||
* scripts to be loaded.
|
||||
* @param {Function} [callback] A function to be called when the script
|
||||
* is loaded and executed. If a string is passed to "scriptUrl", a
|
||||
* boolean parameter is passed to the callback, indicating the
|
||||
* success of the load. If an array is passed instead, two array
|
||||
* parameters are passed to the callback; the first contains the
|
||||
* URLs that have been properly loaded, and the second the failed
|
||||
* ones.
|
||||
* @param {Object} [scope] The scope ("this" reference) to be used for
|
||||
* the callback call. Default to {@link CKEDITOR}.
|
||||
* @param {Boolean} [showBusy] Changes the cursor of the document while
|
||||
+ * the script is loaded.
|
||||
* @example
|
||||
* CKEDITOR.scriptLoader.load( '/myscript.js' );
|
||||
* @example
|
||||
* CKEDITOR.scriptLoader.load( '/myscript.js', function( success )
|
||||
* {
|
||||
* // Alerts "true" if the script has been properly loaded.
|
||||
* // HTTP error 404 should return "false".
|
||||
* alert( success );
|
||||
* });
|
||||
* @example
|
||||
* CKEDITOR.scriptLoader.load( [ '/myscript1.js', '/myscript2.js' ], function( completed, failed )
|
||||
* {
|
||||
* alert( 'Number of scripts loaded: ' + completed.length );
|
||||
* alert( 'Number of failures: ' + failed.length );
|
||||
* });
|
||||
*/
|
||||
load : function( scriptUrl, callback, scope, showBusy )
|
||||
{
|
||||
var isString = ( typeof scriptUrl == 'string' );
|
||||
|
||||
if ( isString )
|
||||
scriptUrl = [ scriptUrl ];
|
||||
|
||||
if ( !scope )
|
||||
scope = CKEDITOR;
|
||||
|
||||
var scriptCount = scriptUrl.length,
|
||||
completed = [],
|
||||
failed = [];
|
||||
|
||||
var doCallback = function( success )
|
||||
{
|
||||
if ( callback )
|
||||
{
|
||||
if ( isString )
|
||||
callback.call( scope, success );
|
||||
else
|
||||
callback.call( scope, completed, failed );
|
||||
}
|
||||
};
|
||||
|
||||
if ( scriptCount === 0 )
|
||||
{
|
||||
doCallback( true );
|
||||
return;
|
||||
}
|
||||
|
||||
var checkLoaded = function( url, success )
|
||||
{
|
||||
( success ? completed : failed ).push( url );
|
||||
|
||||
if ( --scriptCount <= 0 )
|
||||
{
|
||||
showBusy && CKEDITOR.document.getDocumentElement().removeStyle( 'cursor' );
|
||||
doCallback( success );
|
||||
}
|
||||
};
|
||||
|
||||
var onLoad = function( url, success )
|
||||
{
|
||||
// Mark this script as loaded.
|
||||
uniqueScripts[ url ] = 1;
|
||||
|
||||
// Get the list of callback checks waiting for this file.
|
||||
var waitingInfo = waitingList[ url ];
|
||||
delete waitingList[ url ];
|
||||
|
||||
// Check all callbacks waiting for this file.
|
||||
for ( var i = 0 ; i < waitingInfo.length ; i++ )
|
||||
waitingInfo[ i ]( url, success );
|
||||
};
|
||||
|
||||
var loadScript = function( url )
|
||||
{
|
||||
if ( uniqueScripts[ url ] )
|
||||
{
|
||||
checkLoaded( url, true );
|
||||
return;
|
||||
}
|
||||
|
||||
var waitingInfo = waitingList[ url ] || ( waitingList[ url ] = [] );
|
||||
waitingInfo.push( checkLoaded );
|
||||
|
||||
// Load it only for the first request.
|
||||
if ( waitingInfo.length > 1 )
|
||||
return;
|
||||
|
||||
// Create the <script> element.
|
||||
var script = new CKEDITOR.dom.element( 'script' );
|
||||
script.setAttributes( {
|
||||
type : 'text/javascript',
|
||||
src : url } );
|
||||
|
||||
if ( callback )
|
||||
{
|
||||
if ( CKEDITOR.env.ie )
|
||||
{
|
||||
// FIXME: For IE, we are not able to return false on error (like 404).
|
||||
|
||||
/** @ignore */
|
||||
script.$.onreadystatechange = function ()
|
||||
{
|
||||
if ( script.$.readyState == 'loaded' || script.$.readyState == 'complete' )
|
||||
{
|
||||
script.$.onreadystatechange = null;
|
||||
onLoad( url, true );
|
||||
}
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
/** @ignore */
|
||||
script.$.onload = function()
|
||||
{
|
||||
// Some browsers, such as Safari, may call the onLoad function
|
||||
// immediately. Which will break the loading sequence. (#3661)
|
||||
setTimeout( function() { onLoad( url, true ); }, 0 );
|
||||
};
|
||||
|
||||
// FIXME: Opera and Safari will not fire onerror.
|
||||
|
||||
/** @ignore */
|
||||
script.$.onerror = function()
|
||||
{
|
||||
onLoad( url, false );
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Append it to <head>.
|
||||
script.appendTo( CKEDITOR.document.getHead() );
|
||||
|
||||
CKEDITOR.fire( 'download', url ); // @Packager.RemoveLine
|
||||
};
|
||||
|
||||
showBusy && CKEDITOR.document.getDocumentElement().setStyle( 'cursor', 'wait' );
|
||||
for ( var i = 0 ; i < scriptCount ; i++ )
|
||||
{
|
||||
loadScript( scriptUrl[ i ] );
|
||||
}
|
||||
}
|
||||
};
|
||||
})();
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.scriptLoader} object, used to load scripts
|
||||
* asynchronously.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Load scripts asynchronously.
|
||||
* @namespace
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.scriptLoader = (function()
|
||||
{
|
||||
var uniqueScripts = {},
|
||||
waitingList = {};
|
||||
|
||||
return /** @lends CKEDITOR.scriptLoader */ {
|
||||
/**
|
||||
* Loads one or more external script checking if not already loaded
|
||||
* previously by this function.
|
||||
* @param {String|Array} scriptUrl One or more URLs pointing to the
|
||||
* scripts to be loaded.
|
||||
* @param {Function} [callback] A function to be called when the script
|
||||
* is loaded and executed. If a string is passed to "scriptUrl", a
|
||||
* boolean parameter is passed to the callback, indicating the
|
||||
* success of the load. If an array is passed instead, two array
|
||||
* parameters are passed to the callback; the first contains the
|
||||
* URLs that have been properly loaded, and the second the failed
|
||||
* ones.
|
||||
* @param {Object} [scope] The scope ("this" reference) to be used for
|
||||
* the callback call. Default to {@link CKEDITOR}.
|
||||
* @param {Boolean} [showBusy] Changes the cursor of the document while
|
||||
+ * the script is loaded.
|
||||
* @example
|
||||
* CKEDITOR.scriptLoader.load( '/myscript.js' );
|
||||
* @example
|
||||
* CKEDITOR.scriptLoader.load( '/myscript.js', function( success )
|
||||
* {
|
||||
* // Alerts "true" if the script has been properly loaded.
|
||||
* // HTTP error 404 should return "false".
|
||||
* alert( success );
|
||||
* });
|
||||
* @example
|
||||
* CKEDITOR.scriptLoader.load( [ '/myscript1.js', '/myscript2.js' ], function( completed, failed )
|
||||
* {
|
||||
* alert( 'Number of scripts loaded: ' + completed.length );
|
||||
* alert( 'Number of failures: ' + failed.length );
|
||||
* });
|
||||
*/
|
||||
load : function( scriptUrl, callback, scope, showBusy )
|
||||
{
|
||||
var isString = ( typeof scriptUrl == 'string' );
|
||||
|
||||
if ( isString )
|
||||
scriptUrl = [ scriptUrl ];
|
||||
|
||||
if ( !scope )
|
||||
scope = CKEDITOR;
|
||||
|
||||
var scriptCount = scriptUrl.length,
|
||||
completed = [],
|
||||
failed = [];
|
||||
|
||||
var doCallback = function( success )
|
||||
{
|
||||
if ( callback )
|
||||
{
|
||||
if ( isString )
|
||||
callback.call( scope, success );
|
||||
else
|
||||
callback.call( scope, completed, failed );
|
||||
}
|
||||
};
|
||||
|
||||
if ( scriptCount === 0 )
|
||||
{
|
||||
doCallback( true );
|
||||
return;
|
||||
}
|
||||
|
||||
var checkLoaded = function( url, success )
|
||||
{
|
||||
( success ? completed : failed ).push( url );
|
||||
|
||||
if ( --scriptCount <= 0 )
|
||||
{
|
||||
showBusy && CKEDITOR.document.getDocumentElement().removeStyle( 'cursor' );
|
||||
doCallback( success );
|
||||
}
|
||||
};
|
||||
|
||||
var onLoad = function( url, success )
|
||||
{
|
||||
// Mark this script as loaded.
|
||||
uniqueScripts[ url ] = 1;
|
||||
|
||||
// Get the list of callback checks waiting for this file.
|
||||
var waitingInfo = waitingList[ url ];
|
||||
delete waitingList[ url ];
|
||||
|
||||
// Check all callbacks waiting for this file.
|
||||
for ( var i = 0 ; i < waitingInfo.length ; i++ )
|
||||
waitingInfo[ i ]( url, success );
|
||||
};
|
||||
|
||||
var loadScript = function( url )
|
||||
{
|
||||
if ( uniqueScripts[ url ] )
|
||||
{
|
||||
checkLoaded( url, true );
|
||||
return;
|
||||
}
|
||||
|
||||
var waitingInfo = waitingList[ url ] || ( waitingList[ url ] = [] );
|
||||
waitingInfo.push( checkLoaded );
|
||||
|
||||
// Load it only for the first request.
|
||||
if ( waitingInfo.length > 1 )
|
||||
return;
|
||||
|
||||
// Create the <script> element.
|
||||
var script = new CKEDITOR.dom.element( 'script' );
|
||||
script.setAttributes( {
|
||||
type : 'text/javascript',
|
||||
src : url } );
|
||||
|
||||
if ( callback )
|
||||
{
|
||||
if ( CKEDITOR.env.ie )
|
||||
{
|
||||
// FIXME: For IE, we are not able to return false on error (like 404).
|
||||
|
||||
/** @ignore */
|
||||
script.$.onreadystatechange = function ()
|
||||
{
|
||||
if ( script.$.readyState == 'loaded' || script.$.readyState == 'complete' )
|
||||
{
|
||||
script.$.onreadystatechange = null;
|
||||
onLoad( url, true );
|
||||
}
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
/** @ignore */
|
||||
script.$.onload = function()
|
||||
{
|
||||
// Some browsers, such as Safari, may call the onLoad function
|
||||
// immediately. Which will break the loading sequence. (#3661)
|
||||
setTimeout( function() { onLoad( url, true ); }, 0 );
|
||||
};
|
||||
|
||||
// FIXME: Opera and Safari will not fire onerror.
|
||||
|
||||
/** @ignore */
|
||||
script.$.onerror = function()
|
||||
{
|
||||
onLoad( url, false );
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Append it to <head>.
|
||||
script.appendTo( CKEDITOR.document.getHead() );
|
||||
|
||||
CKEDITOR.fire( 'download', url ); // @Packager.RemoveLine
|
||||
};
|
||||
|
||||
showBusy && CKEDITOR.document.getDocumentElement().setStyle( 'cursor', 'wait' );
|
||||
for ( var i = 0 ; i < scriptCount ; i++ )
|
||||
{
|
||||
loadScript( scriptUrl[ i ] );
|
||||
}
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
@ -1,184 +1,184 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.skins} object, which is used to
|
||||
* manage skins loading.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Manages skins loading.
|
||||
* @namespace
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.skins = (function()
|
||||
{
|
||||
// Holds the list of loaded skins.
|
||||
var loaded = {},
|
||||
paths = {};
|
||||
|
||||
var loadPart = function( editor, skinName, part, callback )
|
||||
{
|
||||
// Get the skin definition.
|
||||
var skinDefinition = loaded[ skinName ];
|
||||
|
||||
if ( !editor.skin )
|
||||
{
|
||||
editor.skin = skinDefinition;
|
||||
|
||||
// Trigger init function if any.
|
||||
if ( skinDefinition.init )
|
||||
skinDefinition.init( editor );
|
||||
}
|
||||
|
||||
var appendSkinPath = function( fileNames )
|
||||
{
|
||||
for ( var n = 0 ; n < fileNames.length ; n++ )
|
||||
{
|
||||
fileNames[ n ] = CKEDITOR.getUrl( paths[ skinName ] + fileNames[ n ] );
|
||||
}
|
||||
};
|
||||
|
||||
function fixCSSTextRelativePath( cssStyleText, baseUrl )
|
||||
{
|
||||
return cssStyleText.replace( /url\s*\(([\s'"]*)(.*?)([\s"']*)\)/g,
|
||||
function( match, opener, path, closer )
|
||||
{
|
||||
if ( /^\/|^\w?:/.test( path ) )
|
||||
return match;
|
||||
else
|
||||
return 'url(' + baseUrl + opener + path + closer + ')';
|
||||
} );
|
||||
}
|
||||
|
||||
// Get the part definition.
|
||||
part = skinDefinition[ part ];
|
||||
var partIsLoaded = !part || !!part._isLoaded;
|
||||
|
||||
// Call the callback immediately if already loaded.
|
||||
if ( partIsLoaded )
|
||||
callback && callback();
|
||||
else
|
||||
{
|
||||
// Put the callback in a queue.
|
||||
var pending = part._pending || ( part._pending = [] );
|
||||
pending.push( callback );
|
||||
|
||||
// We may have more than one skin part load request. Just the first
|
||||
// one must do the loading job.
|
||||
if ( pending.length > 1 )
|
||||
return;
|
||||
|
||||
// Check whether the "css" and "js" properties have been defined
|
||||
// for that part.
|
||||
var cssIsLoaded = !part.css || !part.css.length,
|
||||
jsIsLoaded = !part.js || !part.js.length;
|
||||
|
||||
// This is the function that will trigger the callback calls on
|
||||
// load.
|
||||
var checkIsLoaded = function()
|
||||
{
|
||||
if ( cssIsLoaded && jsIsLoaded )
|
||||
{
|
||||
// Mark the part as loaded.
|
||||
part._isLoaded = 1;
|
||||
|
||||
// Call all pending callbacks.
|
||||
for ( var i = 0 ; i < pending.length ; i++ )
|
||||
{
|
||||
if ( pending[ i ] )
|
||||
pending[ i ]();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Load the "css" pieces.
|
||||
if ( !cssIsLoaded )
|
||||
{
|
||||
var cssPart = part.css;
|
||||
|
||||
if ( CKEDITOR.tools.isArray( cssPart ) )
|
||||
{
|
||||
appendSkinPath( cssPart );
|
||||
for ( var c = 0 ; c < cssPart.length ; c++ )
|
||||
CKEDITOR.document.appendStyleSheet( cssPart[ c ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
cssPart = fixCSSTextRelativePath(
|
||||
cssPart, CKEDITOR.getUrl( paths[ skinName ] ) );
|
||||
// Processing Inline CSS part.
|
||||
CKEDITOR.document.appendStyleText( cssPart );
|
||||
}
|
||||
|
||||
part.css = cssPart;
|
||||
|
||||
cssIsLoaded = 1;
|
||||
}
|
||||
|
||||
// Load the "js" pieces.
|
||||
if ( !jsIsLoaded )
|
||||
{
|
||||
appendSkinPath( part.js );
|
||||
CKEDITOR.scriptLoader.load( part.js, function()
|
||||
{
|
||||
jsIsLoaded = 1;
|
||||
checkIsLoaded();
|
||||
});
|
||||
}
|
||||
|
||||
// We may have nothing to load, so check it immediately.
|
||||
checkIsLoaded();
|
||||
}
|
||||
};
|
||||
|
||||
return /** @lends CKEDITOR.skins */ {
|
||||
|
||||
/**
|
||||
* Registers a skin definition.
|
||||
* @param {String} skinName The skin name.
|
||||
* @param {Object} skinDefinition The skin definition.
|
||||
* @example
|
||||
*/
|
||||
add : function( skinName, skinDefinition )
|
||||
{
|
||||
loaded[ skinName ] = skinDefinition;
|
||||
|
||||
skinDefinition.skinPath = paths[ skinName ]
|
||||
|| ( paths[ skinName ] =
|
||||
CKEDITOR.getUrl(
|
||||
'_source/' + // @Packager.RemoveLine
|
||||
'skins/' + skinName + '/' ) );
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads a skin part. Skins are defined in parts, which are basically
|
||||
* separated CSS files. This function is mainly used by the core code and
|
||||
* should not have much use out of it.
|
||||
* @param {String} skinName The name of the skin to be loaded.
|
||||
* @param {String} skinPart The skin part to be loaded. Common skin parts
|
||||
* are "editor" and "dialog".
|
||||
* @param {Function} [callback] A function to be called once the skin
|
||||
* part files are loaded.
|
||||
* @example
|
||||
*/
|
||||
load : function( editor, skinPart, callback )
|
||||
{
|
||||
var skinName = editor.skinName,
|
||||
skinPath = editor.skinPath;
|
||||
|
||||
if ( loaded[ skinName ] )
|
||||
loadPart( editor, skinName, skinPart, callback );
|
||||
else
|
||||
{
|
||||
paths[ skinName ] = skinPath;
|
||||
CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( skinPath + 'skin.js' ), function()
|
||||
{
|
||||
loadPart( editor, skinName, skinPart, callback );
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
})();
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.skins} object, which is used to
|
||||
* manage skins loading.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Manages skins loading.
|
||||
* @namespace
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.skins = (function()
|
||||
{
|
||||
// Holds the list of loaded skins.
|
||||
var loaded = {},
|
||||
paths = {};
|
||||
|
||||
var loadPart = function( editor, skinName, part, callback )
|
||||
{
|
||||
// Get the skin definition.
|
||||
var skinDefinition = loaded[ skinName ];
|
||||
|
||||
if ( !editor.skin )
|
||||
{
|
||||
editor.skin = skinDefinition;
|
||||
|
||||
// Trigger init function if any.
|
||||
if ( skinDefinition.init )
|
||||
skinDefinition.init( editor );
|
||||
}
|
||||
|
||||
var appendSkinPath = function( fileNames )
|
||||
{
|
||||
for ( var n = 0 ; n < fileNames.length ; n++ )
|
||||
{
|
||||
fileNames[ n ] = CKEDITOR.getUrl( paths[ skinName ] + fileNames[ n ] );
|
||||
}
|
||||
};
|
||||
|
||||
function fixCSSTextRelativePath( cssStyleText, baseUrl )
|
||||
{
|
||||
return cssStyleText.replace( /url\s*\(([\s'"]*)(.*?)([\s"']*)\)/g,
|
||||
function( match, opener, path, closer )
|
||||
{
|
||||
if ( /^\/|^\w?:/.test( path ) )
|
||||
return match;
|
||||
else
|
||||
return 'url(' + baseUrl + opener + path + closer + ')';
|
||||
} );
|
||||
}
|
||||
|
||||
// Get the part definition.
|
||||
part = skinDefinition[ part ];
|
||||
var partIsLoaded = !part || !!part._isLoaded;
|
||||
|
||||
// Call the callback immediately if already loaded.
|
||||
if ( partIsLoaded )
|
||||
callback && callback();
|
||||
else
|
||||
{
|
||||
// Put the callback in a queue.
|
||||
var pending = part._pending || ( part._pending = [] );
|
||||
pending.push( callback );
|
||||
|
||||
// We may have more than one skin part load request. Just the first
|
||||
// one must do the loading job.
|
||||
if ( pending.length > 1 )
|
||||
return;
|
||||
|
||||
// Check whether the "css" and "js" properties have been defined
|
||||
// for that part.
|
||||
var cssIsLoaded = !part.css || !part.css.length,
|
||||
jsIsLoaded = !part.js || !part.js.length;
|
||||
|
||||
// This is the function that will trigger the callback calls on
|
||||
// load.
|
||||
var checkIsLoaded = function()
|
||||
{
|
||||
if ( cssIsLoaded && jsIsLoaded )
|
||||
{
|
||||
// Mark the part as loaded.
|
||||
part._isLoaded = 1;
|
||||
|
||||
// Call all pending callbacks.
|
||||
for ( var i = 0 ; i < pending.length ; i++ )
|
||||
{
|
||||
if ( pending[ i ] )
|
||||
pending[ i ]();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Load the "css" pieces.
|
||||
if ( !cssIsLoaded )
|
||||
{
|
||||
var cssPart = part.css;
|
||||
|
||||
if ( CKEDITOR.tools.isArray( cssPart ) )
|
||||
{
|
||||
appendSkinPath( cssPart );
|
||||
for ( var c = 0 ; c < cssPart.length ; c++ )
|
||||
CKEDITOR.document.appendStyleSheet( cssPart[ c ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
cssPart = fixCSSTextRelativePath(
|
||||
cssPart, CKEDITOR.getUrl( paths[ skinName ] ) );
|
||||
// Processing Inline CSS part.
|
||||
CKEDITOR.document.appendStyleText( cssPart );
|
||||
}
|
||||
|
||||
part.css = cssPart;
|
||||
|
||||
cssIsLoaded = 1;
|
||||
}
|
||||
|
||||
// Load the "js" pieces.
|
||||
if ( !jsIsLoaded )
|
||||
{
|
||||
appendSkinPath( part.js );
|
||||
CKEDITOR.scriptLoader.load( part.js, function()
|
||||
{
|
||||
jsIsLoaded = 1;
|
||||
checkIsLoaded();
|
||||
});
|
||||
}
|
||||
|
||||
// We may have nothing to load, so check it immediately.
|
||||
checkIsLoaded();
|
||||
}
|
||||
};
|
||||
|
||||
return /** @lends CKEDITOR.skins */ {
|
||||
|
||||
/**
|
||||
* Registers a skin definition.
|
||||
* @param {String} skinName The skin name.
|
||||
* @param {Object} skinDefinition The skin definition.
|
||||
* @example
|
||||
*/
|
||||
add : function( skinName, skinDefinition )
|
||||
{
|
||||
loaded[ skinName ] = skinDefinition;
|
||||
|
||||
skinDefinition.skinPath = paths[ skinName ]
|
||||
|| ( paths[ skinName ] =
|
||||
CKEDITOR.getUrl(
|
||||
'_source/' + // @Packager.RemoveLine
|
||||
'skins/' + skinName + '/' ) );
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads a skin part. Skins are defined in parts, which are basically
|
||||
* separated CSS files. This function is mainly used by the core code and
|
||||
* should not have much use out of it.
|
||||
* @param {String} skinName The name of the skin to be loaded.
|
||||
* @param {String} skinPart The skin part to be loaded. Common skin parts
|
||||
* are "editor" and "dialog".
|
||||
* @param {Function} [callback] A function to be called once the skin
|
||||
* part files are loaded.
|
||||
* @example
|
||||
*/
|
||||
load : function( editor, skinPart, callback )
|
||||
{
|
||||
var skinName = editor.skinName,
|
||||
skinPath = editor.skinPath;
|
||||
|
||||
if ( loaded[ skinName ] )
|
||||
loadPart( editor, skinName, skinPart, callback );
|
||||
else
|
||||
{
|
||||
paths[ skinName ] = skinPath;
|
||||
CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( skinPath + 'skin.js' ), function()
|
||||
{
|
||||
loadPart( editor, skinName, skinPart, callback );
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.themes} object, which is used to
|
||||
* manage themes registration and loading.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Manages themes registration and loading.
|
||||
* @namespace
|
||||
* @augments CKEDITOR.resourceManager
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.themes = new CKEDITOR.resourceManager(
|
||||
'_source/'+ // @Packager.RemoveLine
|
||||
'themes/', 'theme' );
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.themes} object, which is used to
|
||||
* manage themes registration and loading.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Manages themes registration and loading.
|
||||
* @namespace
|
||||
* @augments CKEDITOR.resourceManager
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.themes = new CKEDITOR.resourceManager(
|
||||
'_source/'+ // @Packager.RemoveLine
|
||||
'themes/', 'theme' );
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,128 +1,128 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* Contains UI features related to an editor instance.
|
||||
* @constructor
|
||||
* @param {CKEDITOR.editor} editor The editor instance.
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.ui = function( editor )
|
||||
{
|
||||
if ( editor.ui )
|
||||
return editor.ui;
|
||||
|
||||
/**
|
||||
* Object used to hold private stuff.
|
||||
* @private
|
||||
*/
|
||||
this._ =
|
||||
{
|
||||
handlers : {},
|
||||
items : {},
|
||||
editor : editor
|
||||
};
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
// PACKAGER_RENAME( CKEDITOR.ui )
|
||||
|
||||
CKEDITOR.ui.prototype =
|
||||
{
|
||||
/**
|
||||
* Adds a UI item to the items collection. These items can be later used in
|
||||
* the interface.
|
||||
* @param {String} name The UI item name.
|
||||
* @param {Object} type The item type.
|
||||
* @param {Object} definition The item definition. The properties of this
|
||||
* object depend on the item type.
|
||||
* @example
|
||||
* // Add a new button named "MyBold".
|
||||
* editorInstance.ui.add( 'MyBold', CKEDITOR.UI_BUTTON,
|
||||
* {
|
||||
* label : 'My Bold',
|
||||
* command : 'bold'
|
||||
* });
|
||||
*/
|
||||
add : function( name, type, definition )
|
||||
{
|
||||
this._.items[ name ] =
|
||||
{
|
||||
type : type,
|
||||
// The name of {@link CKEDITOR.command} which associate with this UI.
|
||||
command : definition.command || null,
|
||||
args : Array.prototype.slice.call( arguments, 2 )
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets a UI object.
|
||||
* @param {String} name The UI item hame.
|
||||
* @example
|
||||
*/
|
||||
create : function( name )
|
||||
{
|
||||
var item = this._.items[ name ],
|
||||
handler = item && this._.handlers[ item.type ],
|
||||
command = item && item.command && this._.editor.getCommand( item.command );
|
||||
|
||||
var result = handler && handler.create.apply( this, item.args );
|
||||
|
||||
// Allow overrides from skin ui definitions..
|
||||
item && ( result = CKEDITOR.tools.extend( result, this._.editor.skin[ item.type ], true ) );
|
||||
|
||||
// Add reference inside command object.
|
||||
if ( command )
|
||||
command.uiItems.push( result );
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds a handler for a UI item type. The handler is responsible for
|
||||
* transforming UI item definitions in UI objects.
|
||||
* @param {Object} type The item type.
|
||||
* @param {Object} handler The handler definition.
|
||||
* @example
|
||||
*/
|
||||
addHandler : function( type, handler )
|
||||
{
|
||||
this._.handlers[ type ] = handler;
|
||||
}
|
||||
};
|
||||
|
||||
CKEDITOR.event.implementOn( CKEDITOR.ui );
|
||||
|
||||
/**
|
||||
* (Virtual Class) Do not call this constructor. This class is not really part
|
||||
* of the API. It just illustrates the features of hanlder objects to be
|
||||
* passed to the {@link CKEDITOR.ui.prototype.addHandler} function.
|
||||
* @name CKEDITOR.ui.handlerDefinition
|
||||
* @constructor
|
||||
* @example
|
||||
*/
|
||||
|
||||
/**
|
||||
* Transforms an item definition into an UI item object.
|
||||
* @name CKEDITOR.handlerDefinition.prototype.create
|
||||
* @function
|
||||
* @param {Object} definition The item definition.
|
||||
* @example
|
||||
* editorInstance.ui.addHandler( CKEDITOR.UI_BUTTON,
|
||||
* {
|
||||
* create : function( definition )
|
||||
* {
|
||||
* return new CKEDITOR.ui.button( definition );
|
||||
* }
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Internal event fired when a new UI element is ready
|
||||
* @name CKEDITOR.ui#ready
|
||||
* @event
|
||||
* @param {Object} element The new element
|
||||
*/
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* Contains UI features related to an editor instance.
|
||||
* @constructor
|
||||
* @param {CKEDITOR.editor} editor The editor instance.
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.ui = function( editor )
|
||||
{
|
||||
if ( editor.ui )
|
||||
return editor.ui;
|
||||
|
||||
/**
|
||||
* Object used to hold private stuff.
|
||||
* @private
|
||||
*/
|
||||
this._ =
|
||||
{
|
||||
handlers : {},
|
||||
items : {},
|
||||
editor : editor
|
||||
};
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
// PACKAGER_RENAME( CKEDITOR.ui )
|
||||
|
||||
CKEDITOR.ui.prototype =
|
||||
{
|
||||
/**
|
||||
* Adds a UI item to the items collection. These items can be later used in
|
||||
* the interface.
|
||||
* @param {String} name The UI item name.
|
||||
* @param {Object} type The item type.
|
||||
* @param {Object} definition The item definition. The properties of this
|
||||
* object depend on the item type.
|
||||
* @example
|
||||
* // Add a new button named "MyBold".
|
||||
* editorInstance.ui.add( 'MyBold', CKEDITOR.UI_BUTTON,
|
||||
* {
|
||||
* label : 'My Bold',
|
||||
* command : 'bold'
|
||||
* });
|
||||
*/
|
||||
add : function( name, type, definition )
|
||||
{
|
||||
this._.items[ name ] =
|
||||
{
|
||||
type : type,
|
||||
// The name of {@link CKEDITOR.command} which associate with this UI.
|
||||
command : definition.command || null,
|
||||
args : Array.prototype.slice.call( arguments, 2 )
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets a UI object.
|
||||
* @param {String} name The UI item hame.
|
||||
* @example
|
||||
*/
|
||||
create : function( name )
|
||||
{
|
||||
var item = this._.items[ name ],
|
||||
handler = item && this._.handlers[ item.type ],
|
||||
command = item && item.command && this._.editor.getCommand( item.command );
|
||||
|
||||
var result = handler && handler.create.apply( this, item.args );
|
||||
|
||||
// Allow overrides from skin ui definitions..
|
||||
item && ( result = CKEDITOR.tools.extend( result, this._.editor.skin[ item.type ], true ) );
|
||||
|
||||
// Add reference inside command object.
|
||||
if ( command )
|
||||
command.uiItems.push( result );
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds a handler for a UI item type. The handler is responsible for
|
||||
* transforming UI item definitions in UI objects.
|
||||
* @param {Object} type The item type.
|
||||
* @param {Object} handler The handler definition.
|
||||
* @example
|
||||
*/
|
||||
addHandler : function( type, handler )
|
||||
{
|
||||
this._.handlers[ type ] = handler;
|
||||
}
|
||||
};
|
||||
|
||||
CKEDITOR.event.implementOn( CKEDITOR.ui );
|
||||
|
||||
/**
|
||||
* (Virtual Class) Do not call this constructor. This class is not really part
|
||||
* of the API. It just illustrates the features of hanlder objects to be
|
||||
* passed to the {@link CKEDITOR.ui.prototype.addHandler} function.
|
||||
* @name CKEDITOR.ui.handlerDefinition
|
||||
* @constructor
|
||||
* @example
|
||||
*/
|
||||
|
||||
/**
|
||||
* Transforms an item definition into an UI item object.
|
||||
* @name CKEDITOR.handlerDefinition.prototype.create
|
||||
* @function
|
||||
* @param {Object} definition The item definition.
|
||||
* @example
|
||||
* editorInstance.ui.addHandler( CKEDITOR.UI_BUTTON,
|
||||
* {
|
||||
* create : function( definition )
|
||||
* {
|
||||
* return new CKEDITOR.ui.button( definition );
|
||||
* }
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Internal event fired when a new UI element is ready
|
||||
* @name CKEDITOR.ui#ready
|
||||
* @event
|
||||
* @param {Object} element The new element
|
||||
*/
|
||||
|
||||
@ -1,84 +1,84 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
var CKEDITOR_LANGS = (function()
|
||||
{
|
||||
var langs =
|
||||
{
|
||||
af : 'Afrikaans',
|
||||
ar : 'Arabic',
|
||||
bg : 'Bulgarian',
|
||||
bn : 'Bengali/Bangla',
|
||||
bs : 'Bosnian',
|
||||
ca : 'Catalan',
|
||||
cs : 'Czech',
|
||||
cy : 'Welsh',
|
||||
da : 'Danish',
|
||||
de : 'German',
|
||||
el : 'Greek',
|
||||
en : 'English',
|
||||
'en-au' : 'English (Australia)',
|
||||
'en-ca' : 'English (Canadian)',
|
||||
'en-gb' : 'English (United Kingdom)',
|
||||
eo : 'Esperanto',
|
||||
es : 'Spanish',
|
||||
et : 'Estonian',
|
||||
eu : 'Basque',
|
||||
fa : 'Persian',
|
||||
fi : 'Finnish',
|
||||
fo : 'Faroese',
|
||||
fr : 'French',
|
||||
'fr-ca' : 'French (Canada)',
|
||||
gl : 'Galician',
|
||||
gu : 'Gujarati',
|
||||
he : 'Hebrew',
|
||||
hi : 'Hindi',
|
||||
hr : 'Croatian',
|
||||
hu : 'Hungarian',
|
||||
is : 'Icelandic',
|
||||
it : 'Italian',
|
||||
ja : 'Japanese',
|
||||
ka : 'Georgian',
|
||||
km : 'Khmer',
|
||||
ko : 'Korean',
|
||||
lt : 'Lithuanian',
|
||||
lv : 'Latvian',
|
||||
mn : 'Mongolian',
|
||||
ms : 'Malay',
|
||||
nb : 'Norwegian Bokmal',
|
||||
nl : 'Dutch',
|
||||
no : 'Norwegian',
|
||||
pl : 'Polish',
|
||||
pt : 'Portuguese (Portugal)',
|
||||
'pt-br' : 'Portuguese (Brazil)',
|
||||
ro : 'Romanian',
|
||||
ru : 'Russian',
|
||||
sk : 'Slovak',
|
||||
sl : 'Slovenian',
|
||||
sr : 'Serbian (Cyrillic)',
|
||||
'sr-latn' : 'Serbian (Latin)',
|
||||
sv : 'Swedish',
|
||||
th : 'Thai',
|
||||
tr : 'Turkish',
|
||||
uk : 'Ukrainian',
|
||||
vi : 'Vietnamese',
|
||||
zh : 'Chinese Traditional',
|
||||
'zh-cn' : 'Chinese Simplified'
|
||||
};
|
||||
|
||||
var langsArray = [];
|
||||
|
||||
for ( var code in langs )
|
||||
{
|
||||
langsArray.push( { code : code, name : langs[ code ] } );
|
||||
}
|
||||
|
||||
langsArray.sort( function( a, b )
|
||||
{
|
||||
return ( a.name < b.name ) ? -1 : 1;
|
||||
});
|
||||
|
||||
return langsArray;
|
||||
})();
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
var CKEDITOR_LANGS = (function()
|
||||
{
|
||||
var langs =
|
||||
{
|
||||
af : 'Afrikaans',
|
||||
ar : 'Arabic',
|
||||
bg : 'Bulgarian',
|
||||
bn : 'Bengali/Bangla',
|
||||
bs : 'Bosnian',
|
||||
ca : 'Catalan',
|
||||
cs : 'Czech',
|
||||
cy : 'Welsh',
|
||||
da : 'Danish',
|
||||
de : 'German',
|
||||
el : 'Greek',
|
||||
en : 'English',
|
||||
'en-au' : 'English (Australia)',
|
||||
'en-ca' : 'English (Canadian)',
|
||||
'en-gb' : 'English (United Kingdom)',
|
||||
eo : 'Esperanto',
|
||||
es : 'Spanish',
|
||||
et : 'Estonian',
|
||||
eu : 'Basque',
|
||||
fa : 'Persian',
|
||||
fi : 'Finnish',
|
||||
fo : 'Faroese',
|
||||
fr : 'French',
|
||||
'fr-ca' : 'French (Canada)',
|
||||
gl : 'Galician',
|
||||
gu : 'Gujarati',
|
||||
he : 'Hebrew',
|
||||
hi : 'Hindi',
|
||||
hr : 'Croatian',
|
||||
hu : 'Hungarian',
|
||||
is : 'Icelandic',
|
||||
it : 'Italian',
|
||||
ja : 'Japanese',
|
||||
ka : 'Georgian',
|
||||
km : 'Khmer',
|
||||
ko : 'Korean',
|
||||
lt : 'Lithuanian',
|
||||
lv : 'Latvian',
|
||||
mn : 'Mongolian',
|
||||
ms : 'Malay',
|
||||
nb : 'Norwegian Bokmal',
|
||||
nl : 'Dutch',
|
||||
no : 'Norwegian',
|
||||
pl : 'Polish',
|
||||
pt : 'Portuguese (Portugal)',
|
||||
'pt-br' : 'Portuguese (Brazil)',
|
||||
ro : 'Romanian',
|
||||
ru : 'Russian',
|
||||
sk : 'Slovak',
|
||||
sl : 'Slovenian',
|
||||
sr : 'Serbian (Cyrillic)',
|
||||
'sr-latn' : 'Serbian (Latin)',
|
||||
sv : 'Swedish',
|
||||
th : 'Thai',
|
||||
tr : 'Turkish',
|
||||
uk : 'Ukrainian',
|
||||
vi : 'Vietnamese',
|
||||
zh : 'Chinese Traditional',
|
||||
'zh-cn' : 'Chinese Simplified'
|
||||
};
|
||||
|
||||
var langsArray = [];
|
||||
|
||||
for ( var code in langs )
|
||||
{
|
||||
langsArray.push( { code : code, name : langs[ code ] } );
|
||||
}
|
||||
|
||||
langsArray.sort( function( a, b )
|
||||
{
|
||||
return ( a.name < b.name ) ? -1 : 1;
|
||||
});
|
||||
|
||||
return langsArray;
|
||||
})();
|
||||
|
||||
@ -1,64 +1,64 @@
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
|
||||
af.js Found: 548 Missing: 29
|
||||
ar.js Found: 470 Missing: 107
|
||||
bg.js Found: 394 Missing: 183
|
||||
bn.js Found: 292 Missing: 285
|
||||
bs.js Found: 175 Missing: 402
|
||||
ca.js Found: 549 Missing: 28
|
||||
cs.js Found: 577 Missing: 0
|
||||
cy.js Found: 575 Missing: 2
|
||||
da.js Found: 575 Missing: 2
|
||||
de.js Found: 575 Missing: 2
|
||||
el.js Found: 391 Missing: 186
|
||||
en-au.js Found: 347 Missing: 230
|
||||
en-ca.js Found: 345 Missing: 232
|
||||
en-gb.js Found: 517 Missing: 60
|
||||
eo.js Found: 577 Missing: 0
|
||||
es.js Found: 575 Missing: 2
|
||||
et.js Found: 577 Missing: 0
|
||||
eu.js Found: 417 Missing: 160
|
||||
fa.js Found: 575 Missing: 2
|
||||
fi.js Found: 575 Missing: 2
|
||||
fo.js Found: 575 Missing: 2
|
||||
fr-ca.js Found: 319 Missing: 258
|
||||
fr.js Found: 575 Missing: 2
|
||||
gl.js Found: 292 Missing: 285
|
||||
gu.js Found: 575 Missing: 2
|
||||
he.js Found: 575 Missing: 2
|
||||
hi.js Found: 327 Missing: 250
|
||||
hr.js Found: 575 Missing: 2
|
||||
hu.js Found: 572 Missing: 5
|
||||
id.js Found: 1 Missing: 576
|
||||
is.js Found: 326 Missing: 251
|
||||
it.js Found: 577 Missing: 0
|
||||
ja.js Found: 493 Missing: 84
|
||||
ka.js Found: 568 Missing: 9
|
||||
km.js Found: 286 Missing: 291
|
||||
ko.js Found: 304 Missing: 273
|
||||
lt.js Found: 575 Missing: 2
|
||||
lv.js Found: 294 Missing: 283
|
||||
mk.js Found: 0 Missing: 577
|
||||
mn.js Found: 320 Missing: 257
|
||||
ms.js Found: 276 Missing: 301
|
||||
nb.js Found: 577 Missing: 0
|
||||
nl.js Found: 575 Missing: 2
|
||||
no.js Found: 577 Missing: 0
|
||||
pl.js Found: 575 Missing: 2
|
||||
pt-br.js Found: 577 Missing: 0
|
||||
pt.js Found: 326 Missing: 251
|
||||
ro.js Found: 432 Missing: 145
|
||||
ru.js Found: 575 Missing: 2
|
||||
sk.js Found: 364 Missing: 213
|
||||
sl.js Found: 426 Missing: 151
|
||||
sr-latn.js Found: 287 Missing: 290
|
||||
sr.js Found: 286 Missing: 291
|
||||
sv.js Found: 550 Missing: 27
|
||||
th.js Found: 298 Missing: 279
|
||||
tr.js Found: 575 Missing: 2
|
||||
ug.js Found: 572 Missing: 5
|
||||
uk.js Found: 575 Missing: 2
|
||||
vi.js Found: 577 Missing: 0
|
||||
zh-cn.js Found: 577 Missing: 0
|
||||
zh.js Found: 433 Missing: 144
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
|
||||
af.js Found: 548 Missing: 29
|
||||
ar.js Found: 470 Missing: 107
|
||||
bg.js Found: 394 Missing: 183
|
||||
bn.js Found: 292 Missing: 285
|
||||
bs.js Found: 175 Missing: 402
|
||||
ca.js Found: 549 Missing: 28
|
||||
cs.js Found: 577 Missing: 0
|
||||
cy.js Found: 575 Missing: 2
|
||||
da.js Found: 575 Missing: 2
|
||||
de.js Found: 575 Missing: 2
|
||||
el.js Found: 391 Missing: 186
|
||||
en-au.js Found: 347 Missing: 230
|
||||
en-ca.js Found: 345 Missing: 232
|
||||
en-gb.js Found: 517 Missing: 60
|
||||
eo.js Found: 577 Missing: 0
|
||||
es.js Found: 575 Missing: 2
|
||||
et.js Found: 577 Missing: 0
|
||||
eu.js Found: 417 Missing: 160
|
||||
fa.js Found: 575 Missing: 2
|
||||
fi.js Found: 575 Missing: 2
|
||||
fo.js Found: 575 Missing: 2
|
||||
fr-ca.js Found: 319 Missing: 258
|
||||
fr.js Found: 575 Missing: 2
|
||||
gl.js Found: 292 Missing: 285
|
||||
gu.js Found: 575 Missing: 2
|
||||
he.js Found: 575 Missing: 2
|
||||
hi.js Found: 327 Missing: 250
|
||||
hr.js Found: 575 Missing: 2
|
||||
hu.js Found: 572 Missing: 5
|
||||
id.js Found: 1 Missing: 576
|
||||
is.js Found: 326 Missing: 251
|
||||
it.js Found: 577 Missing: 0
|
||||
ja.js Found: 493 Missing: 84
|
||||
ka.js Found: 568 Missing: 9
|
||||
km.js Found: 286 Missing: 291
|
||||
ko.js Found: 304 Missing: 273
|
||||
lt.js Found: 575 Missing: 2
|
||||
lv.js Found: 294 Missing: 283
|
||||
mk.js Found: 0 Missing: 577
|
||||
mn.js Found: 320 Missing: 257
|
||||
ms.js Found: 276 Missing: 301
|
||||
nb.js Found: 577 Missing: 0
|
||||
nl.js Found: 575 Missing: 2
|
||||
no.js Found: 577 Missing: 0
|
||||
pl.js Found: 575 Missing: 2
|
||||
pt-br.js Found: 577 Missing: 0
|
||||
pt.js Found: 326 Missing: 251
|
||||
ro.js Found: 432 Missing: 145
|
||||
ru.js Found: 575 Missing: 2
|
||||
sk.js Found: 364 Missing: 213
|
||||
sl.js Found: 426 Missing: 151
|
||||
sr-latn.js Found: 287 Missing: 290
|
||||
sr.js Found: 286 Missing: 291
|
||||
sv.js Found: 550 Missing: 27
|
||||
th.js Found: 298 Missing: 279
|
||||
tr.js Found: 575 Missing: 2
|
||||
ug.js Found: 572 Missing: 5
|
||||
uk.js Found: 575 Missing: 2
|
||||
vi.js Found: 577 Missing: 0
|
||||
zh-cn.js Found: 577 Missing: 0
|
||||
zh.js Found: 433 Missing: 144
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user