diff --git a/LICENCE.txt b/LICENCE.txt
old mode 100644
new mode 100755
diff --git a/README.markdown b/README.markdown
old mode 100644
new mode 100755
index 2d5cca4..94c9b43
--- a/README.markdown
+++ b/README.markdown
@@ -1,13 +1,67 @@
-# CKEditor for Symphony CMS (EXPERIMENTAL)
-
-- Version: 0.71 beta
-- Date: Tuesday, 26 June 2010
-- Author: Tony Arnold, tony@tonyarnold.com
-- Repository:
-- Requirements: Symphony CMS 2.0.8
+# CKEditor for Symphony CMS
## Introduction
-This extension provides [CKEditor](http://ckeditor.com/) as text-formatter for Symphony CMS. For further information about the editor please visit [www.ckeditor.com](http://ckeditor.com/).
+This extension provides [CKEditor](http://ckeditor.com/) as text-formatter for Symphony CMS. It also has an integrated file browser which uses Symphony sections to get it's files from.
+For further information about the editor please visit [www.ckeditor.com](http://ckeditor.com/).
+
+It is based upon code found in [Nils Hörrmann's WYMEditor](http://github.com/nilshoerrmann/wymeditor).
+
+## Contributors
+
+Significant work and bug fixes have been contributed by the following users:
+
+ * Twisted Interactive - contributed major clean-ups and a new Symphony file browser that is compatible with CKEditor;
+ * Rob Stanford - contributed bug fixes.
+
+For full details, please see the Github commit log - .
+
+## Special notes
+
+The version of CKEditor included with this Symphony extension is stripped down to the bare essentials. This means:
+
+ * Text formatting is limited to the following functions:
+ * Paragraph Format
+ * Bold
+ * Italic
+ * Strike-through
+ * Subscript / Superscript
+ * Ordered list / Unordered list
+ * Indent / Outdent
+ * Block quote
+ * Hyperlinks
+ * Horizontal rule
+ * View source
+ * Full screen
+ * *Most of CKEditor's plug-ins have been removed*: if you wish to add more plug-ins, please download the original [CKEditor](http://ckeditor.com) package and extract the plugins you'd like to include.
+ * *All languages other than US English are removed*: If you wish to make use of additional languages, please download the original version of [CKEditor](http://ckeditor.com) and extract the languages you'd like to include.
+
+## Built-in file browser
+
+This Symphony extension comes with a built-in file browser that is compatible with CKEditor. This file browser uses Symphony sections to store and retrieve uploaded files. It works as follows:
+
+ * Make sure you have created at least one section for your uploaded files with a 'File Upload' field attached;
+ * Go to Symphony's System Preferences and make the CKEditor file browser available to one or more of your sections;
+ * Once you've enabled the file browser for at least one of your sections, you make use of the 'Browse Server' button in CKEditor to select existing files from within your section and add them to the entry you are editing. You can also upload new files using the file browser on the fly!
+
+## Link templates
+
+As of version 1.3, it's possible to create link templates for CKEditor. This works as following:
+
+Say, you got a page called 'News', and a section called 'News articles' in which you store all your news articles. This means
+your news articles probably got URL's like:
+
+ * /news/detail/25/my-new-site/
+ * /news/detail/31/grand-opening/
+ * /news/detail/40/visit-of-the-queen/
+
+You might want to link to these pages from other pages, but you don't want to copy/paste those links. You just want them to
+be there in your dropdown of Symphony Pages when you select a link. This is where link templates come in: You can create
+a link template like: `/news/detail/{$id}/{$title}/`, choose a section the generate the list from, and select the page
+from where to show these links. You can set these in the preferences page of your Symphony installation.
+
+## Styles
-It is based upon code found in [Nils Hörrmann's WYMEditor](http://github.com/nilshoerrmann/wymeditor).
\ No newline at end of file
+As of version 1.3.3 you can add styles to your content. And not as in: you can add a color and stuff, but you can add
+style in the form of a class to your element, so you can maintain the styling of your frontend with a CSS file instead of
+inline CSS.
diff --git a/assets/filebrowser.css b/assets/filebrowser.css
new file mode 100755
index 0000000..4de2e20
--- /dev/null
+++ b/assets/filebrowser.css
@@ -0,0 +1,34 @@
+form { top: 0; left: 0; margin: 0; padding: 0; }
+
+div.left { width: 23%; float: left; background: #eee; padding: 1%; }
+div.right { width: 73%; float: right; padding: 1%; }
+
+ul { list-style-type: none; }
+li { border-bottom: 1px solid #ccc; }
+li a { display: block; padding: 5px; text-decoration: none; color: #333; outline: none; }
+li a.active { background: #aaa; color: #fff; }
+li a:hover { color: #fff; background: #333; }
+
+/*
+table { border-collapse: collapse; width: 100%; margin-bottom: 1em; margin-top: 15px; }
+td, th { border: 1px solid #eee; text-align: left; vertical-align: top; padding: 5px !important; }
+td a { color: #333; }
+*/
+
+tr.hover td { background: #eee; cursor: pointer; }
+
+a.button { font-size: 1em; }
+a.create { float: right; }
+
+#thumb { width: 80px; height: 60px; padding: 5px; background: #fff; position: absolute; display: none;
+ -moz-box-shadow: 0 0 20px rgba(0, 0, 0, .3);
+ -webkit-box-shadow: 0 0 20px rgba(0, 0, 0, .3);
+ box-shadow: 0 0 20px rgba(0, 0, 0, .3);
+}
+
+input[type=button], input[type=submit] { padding: 5px; }
+
+div.items { float: left; clear: both; border-top: 1px solid #ccc; width: 100%; margin-top: 10px; }
+div.items div { float: left; width: 100px; height: 120px; overflow: hidden; margin-top: 10px; border: 1px solid #ccc; padding: 10px; margin-right: 10px; font-size: 10px; text-align: center; }
+div.items img.icon { margin: 18px; }
+div.items div a { text-decoration: none; color: #333; }
\ No newline at end of file
diff --git a/assets/filebrowser.js b/assets/filebrowser.js
new file mode 100755
index 0000000..d0508f0
--- /dev/null
+++ b/assets/filebrowser.js
@@ -0,0 +1,98 @@
+var funcNum;
+var urlNew;
+
+if (typeof Symphony == "undefined") {
+ var Symphony = {};
+}
+if (typeof Symphony.WEBSITE == "undefined") {
+ Symphony.WEBSITE = window.location.toString().match(/^(.+?)\/symphony/)[1];
+}
+if (typeof Symphony.ADMIN == "undefined") {
+ Symphony.ADMIN = Symphony.WEBSITE + "/symphony";
+}
+
+$(function(){
+ var $ = jQuery;
+
+ funcNum = getUrlParam('CKEditorFuncNum');
+
+ $("div.left a").click(function(){
+ $("div.left a").removeClass("active");
+ $(this).addClass("active");
+ loadRightPanel(Symphony.ADMIN + "/extension/ckeditor/filebrowserajax/?id=" + $(this).attr("id"));
+ return false;
+ });
+
+ // Default: activate the first category:
+ $("div.left a:first").click();
+});
+
+function loadRightPanel(url)
+{
+ var $ = jQuery;
+
+ $("div.right").load(url/*+ " form>*"*/, function(){
+ // some magic mumbo jumbo:
+ // Hover on the table rows:
+ $("div.right tr").hover(function(){
+ $(this).addClass("hover");
+ }, function(){
+ $(this).removeClass("hover");
+ }).click(function(){
+ // If the row is clicked, the first anchor is selected. This is because an entry could also have multiple files
+ $("a:first", this).click();
+ });
+ // Click on an anchor
+ $("a", $("div.items")).click(function(){
+ // Send URL to CKEditor:
+ window.opener.CKEDITOR.tools.callFunction(funcNum, $(this).attr("href"));
+ window.close();
+ return false;
+ });
+ // Create new-functionality:
+ $("a.create").click(function(){
+ urlNew = $(this).attr("href");
+ $.get(urlNew, function(data){
+ buildForm(data);
+ });
+ return false;
+ });
+ });
+}
+
+function buildForm(data)
+{
+ var $ = jQuery;
+
+ $("div.right").html('');
+ $("div.field", data).each(function(){
+ $("div.right form").append('
' + $(this).html() + '
');
+ });
+ $("div.right form").append('');
+ $("div.right form").append('');
+ $("input[name='cancel']").click(function(){
+ loadRightPanel(Symphony.ADMIN + "/extension/ckeditor/filebrowserajax/?id=" + $("div.left a.active").attr("id"));
+ });
+ // Ajax form:
+ $("div.right form").ajaxForm({
+ success: function(responseText, statusText, xhr)
+ {
+ if($("p.error", responseText).length > 0)
+ {
+ // Reload the form:
+ buildForm(responseText);
+ } else {
+ // No error found! Content stored!
+ loadRightPanel(Symphony.ADMIN + "/extension/ckeditor/filebrowserajax/?id=" + $("div.left a.active").attr("id"));
+ }
+ }
+ });
+}
+
+// Helper function to get parameters from the query string.
+function getUrlParam(paramName)
+{
+ var reParam = new RegExp('(?:[\?&]|&)' + paramName + '=([^&]+)', 'i') ;
+ var match = window.location.search.match(reParam) ;
+ return (match && match.length > 1) ? match[1] : '' ;
+}
\ No newline at end of file
diff --git a/assets/images/doc.png b/assets/images/doc.png
new file mode 100755
index 0000000..2436b01
Binary files /dev/null and b/assets/images/doc.png differ
diff --git a/assets/images/font.png b/assets/images/font.png
new file mode 100755
index 0000000..35cde64
Binary files /dev/null and b/assets/images/font.png differ
diff --git a/assets/images/html.png b/assets/images/html.png
new file mode 100755
index 0000000..bfc4662
Binary files /dev/null and b/assets/images/html.png differ
diff --git a/assets/images/image.png b/assets/images/image.png
new file mode 100755
index 0000000..1c3657b
Binary files /dev/null and b/assets/images/image.png differ
diff --git a/assets/images/pdf.png b/assets/images/pdf.png
new file mode 100755
index 0000000..2a968ec
Binary files /dev/null and b/assets/images/pdf.png differ
diff --git a/assets/images/presentation.png b/assets/images/presentation.png
new file mode 100755
index 0000000..da5dbc7
Binary files /dev/null and b/assets/images/presentation.png differ
diff --git a/assets/images/sound.png b/assets/images/sound.png
new file mode 100755
index 0000000..accfcad
Binary files /dev/null and b/assets/images/sound.png differ
diff --git a/assets/images/spreadsheet.png b/assets/images/spreadsheet.png
new file mode 100755
index 0000000..a5c46b8
Binary files /dev/null and b/assets/images/spreadsheet.png differ
diff --git a/assets/images/swf.png b/assets/images/swf.png
new file mode 100755
index 0000000..f47037f
Binary files /dev/null and b/assets/images/swf.png differ
diff --git a/assets/images/txt.png b/assets/images/txt.png
new file mode 100755
index 0000000..a056da9
Binary files /dev/null and b/assets/images/txt.png differ
diff --git a/assets/images/unknown.png b/assets/images/unknown.png
new file mode 100755
index 0000000..35df7f4
Binary files /dev/null and b/assets/images/unknown.png differ
diff --git a/assets/images/video.png b/assets/images/video.png
new file mode 100755
index 0000000..c5b1339
Binary files /dev/null and b/assets/images/video.png differ
diff --git a/assets/images/zip.png b/assets/images/zip.png
new file mode 100755
index 0000000..ff81858
Binary files /dev/null and b/assets/images/zip.png differ
diff --git a/assets/jquery.ba-serializeobject.min.js b/assets/jquery.ba-serializeobject.min.js
new file mode 100755
index 0000000..0163077
--- /dev/null
+++ b/assets/jquery.ba-serializeobject.min.js
@@ -0,0 +1,9 @@
+/*
+ * jQuery serializeObject - v0.2 - 1/20/2010
+ * http://benalman.com/projects/jquery-misc-plugins/
+ *
+ * Copyright (c) 2010 "Cowboy" Ben Alman
+ * Dual licensed under the MIT and GPL licenses.
+ * http://benalman.com/about/license/
+ */
+(function($,a){$.fn.serializeObject=function(){var b={};$.each(this.serializeArray(),function(d,e){var f=e.name,c=e.value;b[f]=b[f]===a?c:$.isArray(b[f])?b[f].concat(c):[b[f],c]});return b}})(jQuery);
\ No newline at end of file
diff --git a/assets/jquery.form.js b/assets/jquery.form.js
new file mode 100755
index 0000000..9e13b5d
--- /dev/null
+++ b/assets/jquery.form.js
@@ -0,0 +1,1076 @@
+/*!
+ * jQuery Form Plugin
+ * version: 3.09 (16-APR-2012)
+ * @requires jQuery v1.3.2 or later
+ *
+ * Examples and documentation at: http://malsup.com/jquery/form/
+ * Project repository: https://github.com/malsup/form
+ * Dual licensed under the MIT and GPL licenses:
+ * http://malsup.github.com/mit-license.txt
+ * http://malsup.github.com/gpl-license-v2.txt
+ */
+/*global ActiveXObject alert */
+;(function($) {
+"use strict";
+
+/*
+ Usage Note:
+ -----------
+ Do not use both ajaxSubmit and ajaxForm on the same form. These
+ functions are mutually exclusive. Use ajaxSubmit if you want
+ to bind your own submit handler to the form. For example,
+
+ $(document).ready(function() {
+ $('#myForm').on('submit', function(e) {
+ e.preventDefault(); // <-- important
+ $(this).ajaxSubmit({
+ target: '#output'
+ });
+ });
+ });
+
+ Use ajaxForm when you want the plugin to manage all the event binding
+ for you. For example,
+
+ $(document).ready(function() {
+ $('#myForm').ajaxForm({
+ target: '#output'
+ });
+ });
+
+ You can also use ajaxForm with delegation (requires jQuery v1.7+), so the
+ form does not have to exist when you invoke ajaxForm:
+
+ $('#myForm').ajaxForm({
+ delegation: true,
+ target: '#output'
+ });
+
+ When using ajaxForm, the ajaxSubmit function will be invoked for you
+ at the appropriate time.
+*/
+
+/**
+ * Feature detection
+ */
+var feature = {};
+feature.fileapi = $("").get(0).files !== undefined;
+feature.formdata = window.FormData !== undefined;
+
+/**
+ * ajaxSubmit() provides a mechanism for immediately submitting
+ * an HTML form using AJAX.
+ */
+$.fn.ajaxSubmit = function(options) {
+ /*jshint scripturl:true */
+
+ // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
+ if (!this.length) {
+ log('ajaxSubmit: skipping submit process - no element selected');
+ return this;
+ }
+
+ var method, action, url, $form = this;
+
+ if (typeof options == 'function') {
+ options = { success: options };
+ }
+
+ method = this.attr('method');
+ action = this.attr('action');
+ url = (typeof action === 'string') ? $.trim(action) : '';
+ url = url || window.location.href || '';
+ if (url) {
+ // clean url (don't include hash vaue)
+ url = (url.match(/^([^#]+)/)||[])[1];
+ }
+
+ options = $.extend(true, {
+ url: url,
+ success: $.ajaxSettings.success,
+ type: method || 'GET',
+ iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
+ }, options);
+
+ // hook for manipulating the form data before it is extracted;
+ // convenient for use with rich editors like tinyMCE or FCKEditor
+ var veto = {};
+ this.trigger('form-pre-serialize', [this, options, veto]);
+ if (veto.veto) {
+ log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
+ return this;
+ }
+
+ // provide opportunity to alter form data before it is serialized
+ if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
+ log('ajaxSubmit: submit aborted via beforeSerialize callback');
+ return this;
+ }
+
+ var traditional = options.traditional;
+ if ( traditional === undefined ) {
+ traditional = $.ajaxSettings.traditional;
+ }
+
+ var elements = [];
+ var qx, a = this.formToArray(options.semantic, elements);
+ if (options.data) {
+ options.extraData = options.data;
+ qx = $.param(options.data, traditional);
+ }
+
+ // give pre-submit callback an opportunity to abort the submit
+ if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
+ log('ajaxSubmit: submit aborted via beforeSubmit callback');
+ return this;
+ }
+
+ // fire vetoable 'validate' event
+ this.trigger('form-submit-validate', [a, this, options, veto]);
+ if (veto.veto) {
+ log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
+ return this;
+ }
+
+ var q = $.param(a, traditional);
+ if (qx) {
+ q = ( q ? (q + '&' + qx) : qx );
+ }
+ if (options.type.toUpperCase() == 'GET') {
+ options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
+ options.data = null; // data is null for 'get'
+ }
+ else {
+ options.data = q; // data is the query string for 'post'
+ }
+
+ var callbacks = [];
+ if (options.resetForm) {
+ callbacks.push(function() { $form.resetForm(); });
+ }
+ if (options.clearForm) {
+ callbacks.push(function() { $form.clearForm(options.includeHidden); });
+ }
+
+ // perform a load on the target only if dataType is not provided
+ if (!options.dataType && options.target) {
+ var oldSuccess = options.success || function(){};
+ callbacks.push(function(data) {
+ var fn = options.replaceTarget ? 'replaceWith' : 'html';
+ $(options.target)[fn](data).each(oldSuccess, arguments);
+ });
+ }
+ else if (options.success) {
+ callbacks.push(options.success);
+ }
+
+ options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
+ var context = options.context || options; // jQuery 1.4+ supports scope context
+ for (var i=0, max=callbacks.length; i < max; i++) {
+ callbacks[i].apply(context, [data, status, xhr || $form, $form]);
+ }
+ };
+
+ // are there files to upload?
+ var fileInputs = $('input:file:enabled[value]', this); // [value] (issue #113)
+ var hasFileInputs = fileInputs.length > 0;
+ var mp = 'multipart/form-data';
+ var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
+
+ var fileAPI = feature.fileapi && feature.formdata;
+ log("fileAPI :" + fileAPI);
+ var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;
+
+ // options.iframe allows user to force iframe mode
+ // 06-NOV-09: now defaulting to iframe mode if file input is detected
+ if (options.iframe !== false && (options.iframe || shouldUseFrame)) {
+ // hack to fix Safari hang (thanks to Tim Molendijk for this)
+ // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
+ if (options.closeKeepAlive) {
+ $.get(options.closeKeepAlive, function() {
+ fileUploadIframe(a);
+ });
+ }
+ else {
+ fileUploadIframe(a);
+ }
+ }
+ else if ((hasFileInputs || multipart) && fileAPI) {
+ fileUploadXhr(a);
+ }
+ else {
+ $.ajax(options);
+ }
+
+ // clear element array
+ for (var k=0; k < elements.length; k++)
+ elements[k] = null;
+
+ // fire 'notify' event
+ this.trigger('form-submit-notify', [this, options]);
+ return this;
+
+ // XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)
+ function fileUploadXhr(a) {
+ var formdata = new FormData();
+
+ for (var i=0; i < a.length; i++) {
+ formdata.append(a[i].name, a[i].value);
+ }
+
+ if (options.extraData) {
+ for (var p in options.extraData)
+ if (options.extraData.hasOwnProperty(p))
+ formdata.append(p, options.extraData[p]);
+ }
+
+ options.data = null;
+
+ var s = $.extend(true, {}, $.ajaxSettings, options, {
+ contentType: false,
+ processData: false,
+ cache: false,
+ type: 'POST'
+ });
+
+ if (options.uploadProgress) {
+ // workaround because jqXHR does not expose upload property
+ s.xhr = function() {
+ var xhr = jQuery.ajaxSettings.xhr();
+ if (xhr.upload) {
+ xhr.upload.onprogress = function(event) {
+ var percent = 0;
+ var position = event.loaded || event.position; /*event.position is deprecated*/
+ var total = event.total;
+ if (event.lengthComputable) {
+ percent = Math.ceil(position / total * 100);
+ }
+ options.uploadProgress(event, position, total, percent);
+ };
+ }
+ return xhr;
+ };
+ }
+
+ s.data = null;
+ var beforeSend = s.beforeSend;
+ s.beforeSend = function(xhr, o) {
+ o.data = formdata;
+ if(beforeSend)
+ beforeSend.call(o, xhr, options);
+ };
+ $.ajax(s);
+ }
+
+ // private function for handling file uploads (hat tip to YAHOO!)
+ function fileUploadIframe(a) {
+ var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle;
+ var useProp = !!$.fn.prop;
+
+ if ($(':input[name=submit],:input[id=submit]', form).length) {
+ // if there is an input with a name or id of 'submit' then we won't be
+ // able to invoke the submit fn on the form (at least not x-browser)
+ alert('Error: Form elements must not have name or id of "submit".');
+ return;
+ }
+
+ if (a) {
+ // ensure that every serialized input is still enabled
+ for (i=0; i < elements.length; i++) {
+ el = $(elements[i]);
+ if ( useProp )
+ el.prop('disabled', false);
+ else
+ el.removeAttr('disabled');
+ }
+ }
+
+ s = $.extend(true, {}, $.ajaxSettings, options);
+ s.context = s.context || s;
+ id = 'jqFormIO' + (new Date().getTime());
+ if (s.iframeTarget) {
+ $io = $(s.iframeTarget);
+ n = $io.attr('name');
+ if (!n)
+ $io.attr('name', id);
+ else
+ id = n;
+ }
+ else {
+ $io = $('');
+ $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
+ }
+ io = $io[0];
+
+
+ xhr = { // mock object
+ aborted: 0,
+ responseText: null,
+ responseXML: null,
+ status: 0,
+ statusText: 'n/a',
+ getAllResponseHeaders: function() {},
+ getResponseHeader: function() {},
+ setRequestHeader: function() {},
+ abort: function(status) {
+ var e = (status === 'timeout' ? 'timeout' : 'aborted');
+ log('aborting upload... ' + e);
+ this.aborted = 1;
+ $io.attr('src', s.iframeSrc); // abort op in progress
+ xhr.error = e;
+ if (s.error)
+ s.error.call(s.context, xhr, e, status);
+ if (g)
+ $.event.trigger("ajaxError", [xhr, s, e]);
+ if (s.complete)
+ s.complete.call(s.context, xhr, e);
+ }
+ };
+
+ g = s.global;
+ // trigger ajax global events so that activity/block indicators work like normal
+ if (g && 0 === $.active++) {
+ $.event.trigger("ajaxStart");
+ }
+ if (g) {
+ $.event.trigger("ajaxSend", [xhr, s]);
+ }
+
+ if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
+ if (s.global) {
+ $.active--;
+ }
+ return;
+ }
+ if (xhr.aborted) {
+ return;
+ }
+
+ // add submitting element to data if we know it
+ sub = form.clk;
+ if (sub) {
+ n = sub.name;
+ if (n && !sub.disabled) {
+ s.extraData = s.extraData || {};
+ s.extraData[n] = sub.value;
+ if (sub.type == "image") {
+ s.extraData[n+'.x'] = form.clk_x;
+ s.extraData[n+'.y'] = form.clk_y;
+ }
+ }
+ }
+
+ var CLIENT_TIMEOUT_ABORT = 1;
+ var SERVER_ABORT = 2;
+
+ function getDoc(frame) {
+ var doc = frame.contentWindow ? frame.contentWindow.document : frame.contentDocument ? frame.contentDocument : frame.document;
+ return doc;
+ }
+
+ // Rails CSRF hack (thanks to Yvan Barthelemy)
+ var csrf_token = $('meta[name=csrf-token]').attr('content');
+ var csrf_param = $('meta[name=csrf-param]').attr('content');
+ if (csrf_param && csrf_token) {
+ s.extraData = s.extraData || {};
+ s.extraData[csrf_param] = csrf_token;
+ }
+
+ // take a breath so that pending repaints get some cpu time before the upload starts
+ function doSubmit() {
+ // make sure form attrs are set
+ var t = $form.attr('target'), a = $form.attr('action');
+
+ // update form attrs in IE friendly way
+ form.setAttribute('target',id);
+ if (!method) {
+ form.setAttribute('method', 'POST');
+ }
+ if (a != s.url) {
+ form.setAttribute('action', s.url);
+ }
+
+ // ie borks in some cases when setting encoding
+ if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {
+ $form.attr({
+ encoding: 'multipart/form-data',
+ enctype: 'multipart/form-data'
+ });
+ }
+
+ // support timout
+ if (s.timeout) {
+ timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);
+ }
+
+ // look for server aborts
+ function checkState() {
+ try {
+ var state = getDoc(io).readyState;
+ log('state = ' + state);
+ if (state && state.toLowerCase() == 'uninitialized')
+ setTimeout(checkState,50);
+ }
+ catch(e) {
+ log('Server abort: ' , e, ' (', e.name, ')');
+ cb(SERVER_ABORT);
+ if (timeoutHandle)
+ clearTimeout(timeoutHandle);
+ timeoutHandle = undefined;
+ }
+ }
+
+ // add "extra" data to form if provided in options
+ var extraInputs = [];
+ try {
+ if (s.extraData) {
+ for (var n in s.extraData) {
+ if (s.extraData.hasOwnProperty(n)) {
+ extraInputs.push(
+ $('').attr('value',s.extraData[n])
+ .appendTo(form)[0]);
+ }
+ }
+ }
+
+ if (!s.iframeTarget) {
+ // add iframe to doc and submit the form
+ $io.appendTo('body');
+ if (io.attachEvent)
+ io.attachEvent('onload', cb);
+ else
+ io.addEventListener('load', cb, false);
+ }
+ setTimeout(checkState,15);
+ form.submit();
+ }
+ finally {
+ // reset attrs and remove "extra" input elements
+ form.setAttribute('action',a);
+ if(t) {
+ form.setAttribute('target', t);
+ } else {
+ $form.removeAttr('target');
+ }
+ $(extraInputs).remove();
+ }
+ }
+
+ if (s.forceSync) {
+ doSubmit();
+ }
+ else {
+ setTimeout(doSubmit, 10); // this lets dom updates render
+ }
+
+ var data, doc, domCheckCount = 50, callbackProcessed;
+
+ function cb(e) {
+ if (xhr.aborted || callbackProcessed) {
+ return;
+ }
+ try {
+ doc = getDoc(io);
+ }
+ catch(ex) {
+ log('cannot access response document: ', ex);
+ e = SERVER_ABORT;
+ }
+ if (e === CLIENT_TIMEOUT_ABORT && xhr) {
+ xhr.abort('timeout');
+ return;
+ }
+ else if (e == SERVER_ABORT && xhr) {
+ xhr.abort('server abort');
+ return;
+ }
+
+ if (!doc || doc.location.href == s.iframeSrc) {
+ // response not received yet
+ if (!timedOut)
+ return;
+ }
+ if (io.detachEvent)
+ io.detachEvent('onload', cb);
+ else
+ io.removeEventListener('load', cb, false);
+
+ var status = 'success', errMsg;
+ try {
+ if (timedOut) {
+ throw 'timeout';
+ }
+
+ var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
+ log('isXml='+isXml);
+ if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {
+ if (--domCheckCount) {
+ // in some browsers (Opera) the iframe DOM is not always traversable when
+ // the onload callback fires, so we loop a bit to accommodate
+ log('requeing onLoad callback, DOM not available');
+ setTimeout(cb, 250);
+ return;
+ }
+ // let this fall through because server response could be an empty document
+ //log('Could not access iframe DOM after mutiple tries.');
+ //throw 'DOMException: not available';
+ }
+
+ //log('response detected');
+ var docRoot = doc.body ? doc.body : doc.documentElement;
+ xhr.responseText = docRoot ? docRoot.innerHTML : null;
+ xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
+ if (isXml)
+ s.dataType = 'xml';
+ xhr.getResponseHeader = function(header){
+ var headers = {'content-type': s.dataType};
+ return headers[header];
+ };
+ // support for XHR 'status' & 'statusText' emulation :
+ if (docRoot) {
+ xhr.status = Number( docRoot.getAttribute('status') ) || xhr.status;
+ xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText;
+ }
+
+ var dt = (s.dataType || '').toLowerCase();
+ var scr = /(json|script|text)/.test(dt);
+ if (scr || s.textarea) {
+ // see if user embedded response in textarea
+ var ta = doc.getElementsByTagName('textarea')[0];
+ if (ta) {
+ xhr.responseText = ta.value;
+ // support for XHR 'status' & 'statusText' emulation :
+ xhr.status = Number( ta.getAttribute('status') ) || xhr.status;
+ xhr.statusText = ta.getAttribute('statusText') || xhr.statusText;
+ }
+ else if (scr) {
+ // account for browsers injecting pre around json response
+ var pre = doc.getElementsByTagName('pre')[0];
+ var b = doc.getElementsByTagName('body')[0];
+ if (pre) {
+ xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;
+ }
+ else if (b) {
+ xhr.responseText = b.textContent ? b.textContent : b.innerText;
+ }
+ }
+ }
+ else if (dt == 'xml' && !xhr.responseXML && xhr.responseText) {
+ xhr.responseXML = toXml(xhr.responseText);
+ }
+
+ try {
+ data = httpData(xhr, dt, s);
+ }
+ catch (e) {
+ status = 'parsererror';
+ xhr.error = errMsg = (e || status);
+ }
+ }
+ catch (e) {
+ log('error caught: ',e);
+ status = 'error';
+ xhr.error = errMsg = (e || status);
+ }
+
+ if (xhr.aborted) {
+ log('upload aborted');
+ status = null;
+ }
+
+ if (xhr.status) { // we've set xhr.status
+ status = (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) ? 'success' : 'error';
+ }
+
+ // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
+ if (status === 'success') {
+ if (s.success)
+ s.success.call(s.context, data, 'success', xhr);
+ if (g)
+ $.event.trigger("ajaxSuccess", [xhr, s]);
+ }
+ else if (status) {
+ if (errMsg === undefined)
+ errMsg = xhr.statusText;
+ if (s.error)
+ s.error.call(s.context, xhr, status, errMsg);
+ if (g)
+ $.event.trigger("ajaxError", [xhr, s, errMsg]);
+ }
+
+ if (g)
+ $.event.trigger("ajaxComplete", [xhr, s]);
+
+ if (g && ! --$.active) {
+ $.event.trigger("ajaxStop");
+ }
+
+ if (s.complete)
+ s.complete.call(s.context, xhr, status);
+
+ callbackProcessed = true;
+ if (s.timeout)
+ clearTimeout(timeoutHandle);
+
+ // clean up
+ setTimeout(function() {
+ if (!s.iframeTarget)
+ $io.remove();
+ xhr.responseXML = null;
+ }, 100);
+ }
+
+ var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+)
+ if (window.ActiveXObject) {
+ doc = new ActiveXObject('Microsoft.XMLDOM');
+ doc.async = 'false';
+ doc.loadXML(s);
+ }
+ else {
+ doc = (new DOMParser()).parseFromString(s, 'text/xml');
+ }
+ return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
+ };
+ var parseJSON = $.parseJSON || function(s) {
+ /*jslint evil:true */
+ return window['eval']('(' + s + ')');
+ };
+
+ var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
+
+ var ct = xhr.getResponseHeader('content-type') || '',
+ xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
+ data = xml ? xhr.responseXML : xhr.responseText;
+
+ if (xml && data.documentElement.nodeName === 'parsererror') {
+ if ($.error)
+ $.error('parsererror');
+ }
+ if (s && s.dataFilter) {
+ data = s.dataFilter(data, type);
+ }
+ if (typeof data === 'string') {
+ if (type === 'json' || !type && ct.indexOf('json') >= 0) {
+ data = parseJSON(data);
+ } else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
+ $.globalEval(data);
+ }
+ }
+ return data;
+ };
+ }
+};
+
+/**
+ * ajaxForm() provides a mechanism for fully automating form submission.
+ *
+ * The advantages of using this method instead of ajaxSubmit() are:
+ *
+ * 1: This method will include coordinates for elements (if the element
+ * is used to submit the form).
+ * 2. This method will include the submit element's name/value data (for the element that was
+ * used to submit the form).
+ * 3. This method binds the submit() method to the form for you.
+ *
+ * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
+ * passes the options argument along after properly binding events for submit elements and
+ * the form itself.
+ */
+$.fn.ajaxForm = function(options) {
+ options = options || {};
+ options.delegation = options.delegation && $.isFunction($.fn.on);
+
+ // in jQuery 1.3+ we can fix mistakes with the ready state
+ if (!options.delegation && this.length === 0) {
+ var o = { s: this.selector, c: this.context };
+ if (!$.isReady && o.s) {
+ log('DOM not ready, queuing ajaxForm');
+ $(function() {
+ $(o.s,o.c).ajaxForm(options);
+ });
+ return this;
+ }
+ // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
+ log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
+ return this;
+ }
+
+ if ( options.delegation ) {
+ $(document)
+ .off('submit.form-plugin', this.selector, doAjaxSubmit)
+ .off('click.form-plugin', this.selector, captureSubmittingElement)
+ .on('submit.form-plugin', this.selector, options, doAjaxSubmit)
+ .on('click.form-plugin', this.selector, options, captureSubmittingElement);
+ return this;
+ }
+
+ return this.ajaxFormUnbind()
+ .bind('submit.form-plugin', options, doAjaxSubmit)
+ .bind('click.form-plugin', options, captureSubmittingElement);
+};
+
+// private event handlers
+function doAjaxSubmit(e) {
+ /*jshint validthis:true */
+ var options = e.data;
+ if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
+ e.preventDefault();
+ $(this).ajaxSubmit(options);
+ }
+}
+
+function captureSubmittingElement(e) {
+ /*jshint validthis:true */
+ var target = e.target;
+ var $el = $(target);
+ if (!($el.is(":submit,input:image"))) {
+ // is this a child element of the submit el? (ex: a span within a button)
+ var t = $el.closest(':submit');
+ if (t.length === 0) {
+ return;
+ }
+ target = t[0];
+ }
+ var form = this;
+ form.clk = target;
+ if (target.type == 'image') {
+ if (e.offsetX !== undefined) {
+ form.clk_x = e.offsetX;
+ form.clk_y = e.offsetY;
+ } else if (typeof $.fn.offset == 'function') {
+ var offset = $el.offset();
+ form.clk_x = e.pageX - offset.left;
+ form.clk_y = e.pageY - offset.top;
+ } else {
+ form.clk_x = e.pageX - target.offsetLeft;
+ form.clk_y = e.pageY - target.offsetTop;
+ }
+ }
+ // clear form vars
+ setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
+}
+
+
+// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
+$.fn.ajaxFormUnbind = function() {
+ return this.unbind('submit.form-plugin click.form-plugin');
+};
+
+/**
+ * formToArray() gathers form element data into an array of objects that can
+ * be passed to any of the following ajax functions: $.get, $.post, or load.
+ * Each object in the array has both a 'name' and 'value' property. An example of
+ * an array for a simple login form might be:
+ *
+ * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
+ *
+ * It is this array that is passed to pre-submit callback functions provided to the
+ * ajaxSubmit() and ajaxForm() methods.
+ */
+$.fn.formToArray = function(semantic, elements) {
+ var a = [];
+ if (this.length === 0) {
+ return a;
+ }
+
+ var form = this[0];
+ var els = semantic ? form.getElementsByTagName('*') : form.elements;
+ if (!els) {
+ return a;
+ }
+
+ var i,j,n,v,el,max,jmax;
+ for(i=0, max=els.length; i < max; i++) {
+ el = els[i];
+ n = el.name;
+ if (!n) {
+ continue;
+ }
+
+ if (semantic && form.clk && el.type == "image") {
+ // handle image inputs on the fly when semantic == true
+ if(!el.disabled && form.clk == el) {
+ a.push({name: n, value: $(el).val(), type: el.type });
+ a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
+ }
+ continue;
+ }
+
+ v = $.fieldValue(el, true);
+ if (v && v.constructor == Array) {
+ if (elements)
+ elements.push(el);
+ for(j=0, jmax=v.length; j < jmax; j++) {
+ a.push({name: n, value: v[j]});
+ }
+ }
+ else if (feature.fileapi && el.type == 'file' && !el.disabled) {
+ if (elements)
+ elements.push(el);
+ var files = el.files;
+ if (files.length) {
+ for (j=0; j < files.length; j++) {
+ a.push({name: n, value: files[j], type: el.type});
+ }
+ }
+ else {
+ // #180
+ a.push({ name: n, value: '', type: el.type });
+ }
+ }
+ else if (v !== null && typeof v != 'undefined') {
+ if (elements)
+ elements.push(el);
+ a.push({name: n, value: v, type: el.type, required: el.required});
+ }
+ }
+
+ if (!semantic && form.clk) {
+ // input type=='image' are not found in elements array! handle it here
+ var $input = $(form.clk), input = $input[0];
+ n = input.name;
+ if (n && !input.disabled && input.type == 'image') {
+ a.push({name: n, value: $input.val()});
+ a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
+ }
+ }
+ return a;
+};
+
+/**
+ * Serializes form data into a 'submittable' string. This method will return a string
+ * in the format: name1=value1&name2=value2
+ */
+$.fn.formSerialize = function(semantic) {
+ //hand off to jQuery.param for proper encoding
+ return $.param(this.formToArray(semantic));
+};
+
+/**
+ * Serializes all field elements in the jQuery object into a query string.
+ * This method will return a string in the format: name1=value1&name2=value2
+ */
+$.fn.fieldSerialize = function(successful) {
+ var a = [];
+ this.each(function() {
+ var n = this.name;
+ if (!n) {
+ return;
+ }
+ var v = $.fieldValue(this, successful);
+ if (v && v.constructor == Array) {
+ for (var i=0,max=v.length; i < max; i++) {
+ a.push({name: n, value: v[i]});
+ }
+ }
+ else if (v !== null && typeof v != 'undefined') {
+ a.push({name: this.name, value: v});
+ }
+ });
+ //hand off to jQuery.param for proper encoding
+ return $.param(a);
+};
+
+/**
+ * Returns the value(s) of the element in the matched set. For example, consider the following form:
+ *
+ *
+ *
+ * var v = $(':text').fieldValue();
+ * // if no values are entered into the text inputs
+ * v == ['','']
+ * // if values entered into the text inputs are 'foo' and 'bar'
+ * v == ['foo','bar']
+ *
+ * var v = $(':checkbox').fieldValue();
+ * // if neither checkbox is checked
+ * v === undefined
+ * // if both checkboxes are checked
+ * v == ['B1', 'B2']
+ *
+ * var v = $(':radio').fieldValue();
+ * // if neither radio is checked
+ * v === undefined
+ * // if first radio is checked
+ * v == ['C1']
+ *
+ * The successful argument controls whether or not the field element must be 'successful'
+ * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
+ * The default value of the successful argument is true. If this value is false the value(s)
+ * for each element is returned.
+ *
+ * Note: This method *always* returns an array. If no valid value can be determined the
+ * array will be empty, otherwise it will contain one or more values.
+ */
+$.fn.fieldValue = function(successful) {
+ for (var val=[], i=0, max=this.length; i < max; i++) {
+ var el = this[i];
+ var v = $.fieldValue(el, successful);
+ if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
+ continue;
+ }
+ if (v.constructor == Array)
+ $.merge(val, v);
+ else
+ val.push(v);
+ }
+ return val;
+};
+
+/**
+ * Returns the value of the field element.
+ */
+$.fieldValue = function(el, successful) {
+ var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
+ if (successful === undefined) {
+ successful = true;
+ }
+
+ if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
+ (t == 'checkbox' || t == 'radio') && !el.checked ||
+ (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
+ tag == 'select' && el.selectedIndex == -1)) {
+ return null;
+ }
+
+ if (tag == 'select') {
+ var index = el.selectedIndex;
+ if (index < 0) {
+ return null;
+ }
+ var a = [], ops = el.options;
+ var one = (t == 'select-one');
+ var max = (one ? index+1 : ops.length);
+ for(var i=(one ? index : 0); i < max; i++) {
+ var op = ops[i];
+ if (op.selected) {
+ var v = op.value;
+ if (!v) { // extra pain for IE...
+ v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
+ }
+ if (one) {
+ return v;
+ }
+ a.push(v);
+ }
+ }
+ return a;
+ }
+ return $(el).val();
+};
+
+/**
+ * Clears the form data. Takes the following actions on the form's input fields:
+ * - input text fields will have their 'value' property set to the empty string
+ * - select elements will have their 'selectedIndex' property set to -1
+ * - checkbox and radio inputs will have their 'checked' property set to false
+ * - inputs of type submit, button, reset, and hidden will *not* be effected
+ * - button elements will *not* be effected
+ */
+$.fn.clearForm = function(includeHidden) {
+ return this.each(function() {
+ $('input,select,textarea', this).clearFields(includeHidden);
+ });
+};
+
+/**
+ * Clears the selected form elements.
+ */
+$.fn.clearFields = $.fn.clearInputs = function(includeHidden) {
+ var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list
+ return this.each(function() {
+ var t = this.type, tag = this.tagName.toLowerCase();
+ if (re.test(t) || tag == 'textarea') {
+ this.value = '';
+ }
+ else if (t == 'checkbox' || t == 'radio') {
+ this.checked = false;
+ }
+ else if (tag == 'select') {
+ this.selectedIndex = -1;
+ }
+ else if (includeHidden) {
+ // includeHidden can be the valud true, or it can be a selector string
+ // indicating a special test; for example:
+ // $('#myForm').clearForm('.special:hidden')
+ // the above would clean hidden inputs that have the class of 'special'
+ if ( (includeHidden === true && /hidden/.test(t)) ||
+ (typeof includeHidden == 'string' && $(this).is(includeHidden)) )
+ this.value = '';
+ }
+ });
+};
+
+/**
+ * Resets the form data. Causes all form elements to be reset to their original value.
+ */
+$.fn.resetForm = function() {
+ return this.each(function() {
+ // guard against an input with the name of 'reset'
+ // note that IE reports the reset function as an 'object'
+ if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
+ this.reset();
+ }
+ });
+};
+
+/**
+ * Enables or disables any matching elements.
+ */
+$.fn.enable = function(b) {
+ if (b === undefined) {
+ b = true;
+ }
+ return this.each(function() {
+ this.disabled = !b;
+ });
+};
+
+/**
+ * Checks/unchecks any matching checkboxes or radio buttons and
+ * selects/deselects and matching option elements.
+ */
+$.fn.selected = function(select) {
+ if (select === undefined) {
+ select = true;
+ }
+ return this.each(function() {
+ var t = this.type;
+ if (t == 'checkbox' || t == 'radio') {
+ this.checked = select;
+ }
+ else if (this.tagName.toLowerCase() == 'option') {
+ var $sel = $(this).parent('select');
+ if (select && $sel[0] && $sel[0].type == 'select-one') {
+ // deselect all other options
+ $sel.find('option').selected(false);
+ }
+ this.selected = select;
+ }
+ });
+};
+
+// expose debug var
+$.fn.ajaxSubmit.debug = false;
+
+// helper fn for console logging
+function log() {
+ if (!$.fn.ajaxSubmit.debug)
+ return;
+ var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
+ if (window.console && window.console.log) {
+ window.console.log(msg);
+ }
+ else if (window.opera && window.opera.postError) {
+ window.opera.postError(msg);
+ }
+}
+
+})(jQuery);
\ No newline at end of file
diff --git a/assets/preferences.js b/assets/preferences.js
new file mode 100644
index 0000000..7747423
--- /dev/null
+++ b/assets/preferences.js
@@ -0,0 +1,22 @@
+jQuery(function ($) {
+ // Duplicator:
+ var duplicator = $('.ckeditor-duplicator').symphonyDuplicator({collapsible:true});
+
+ function bindFunctionality() {
+ $("select[name^=ckeditor_link_templates][name$=\'[section_id]\']").change(
+ function () {
+ var label = $(":selected", this).text();
+ $("optgroup, option", $(this).parent().next()).attr("disabled", "disabled");
+ $("optgroup[label=\'" + label + "\'], optgroup[label=\'" + label + "\'] option", $(this).parent().next()).removeAttr("disabled");
+ var currentSelected = $("option:selected", $(this).parent().next());
+ if (currentSelected.val() == "" || currentSelected.attr("disabled") == true) {
+ $("option:first", $(this).parent().next()).attr("selected", "selected");
+ }
+ }).change();
+ }
+
+ $("ol.ckeditor-templates .constructor").click(function () {
+ bindFunctionality();
+ });
+ bindFunctionality();
+});
\ No newline at end of file
diff --git a/assets/symphony.ckeditor.css b/assets/symphony.ckeditor.css
old mode 100644
new mode 100755
index 0214a78..f456e95
--- a/assets/symphony.ckeditor.css
+++ b/assets/symphony.ckeditor.css
@@ -2,4 +2,14 @@
label div.cke_toolbox span {
display:inline;
+}
+
+/* Fix for Symphony 2.2: */
+table.cke_editor td, table.cke_dialog td {
+ padding-left: 0;
+}
+
+/* Fixes for Symphony 2.3 & CKEditor 4 */
+table.cke_dialog .cke_dialog_contents .cke_dialog_contents_body > div > table > tbody > tr > td {
+ padding-left: 10px !important;
}
\ No newline at end of file
diff --git a/assets/symphony.ckeditor.js b/assets/symphony.ckeditor.js
old mode 100644
new mode 100755
index 728a806..cf022f2
--- a/assets/symphony.ckeditor.js
+++ b/assets/symphony.ckeditor.js
@@ -1,30 +1,78 @@
jQuery(document).ready(function () {
- var count = 0;
-
- jQuery('textarea.ckeditor').each(function(index) {
- var objectName = jQuery(this).attr('name');
- var configurationData = {
- height : this.offsetHeight,
- extraPlugins : 'uicolor,xmlentities',
- removePlugins : 'font,entities',
- uiColor : '#d6d6c7',
- startupOutlineBlocks : true,
- replaceByClassEnabled : false,
- xmlentities : true,
- toolbar :
- [
- ['Format'],
- ['Bold','Italic','Strike','-','Subscript','Superscript'],
- ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
- ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
- ['Link','Unlink','Anchor'],
- '/',
- ['Image','Table','HorizontalRule','SpecialChar'],
- ['PasteText','PasteFromWord','RemoveFormat'],
- ['Source','Maximize', 'ShowBlocks','-','About']
- ]
- };
-
- CKEDITOR.replace(objectName, configurationData);
+ // Add custom styles:
+ CKEDITOR.stylesSet.add('default', ckeditor_styles);
+
+ // See if there are any ckeditor textareas:
+ jQuery('textarea[class*="ckeditor"]').each(function(index) {
+ var $this = jQuery(this);
+
+ // Get the class name:
+ var classNames = this.className;
+ var myClassName = '';
+ var a = classNames.split(' ');
+ for(var i in a){
+ if(a[i].toString().indexOf('ckeditor') != -1)
+ {
+ myClassName = a[i];
+ }
+ }
+
+ // Set the configurationdata:
+ var ck_configurationData = {};
+ ck_configurationData.language = 'en';
+ ck_configurationData.skin = 'moono';
+ ck_configurationData.replaceByClassEnabled = false;
+ ck_configurationData.forcePasteAsPlainText = true;
+ ck_configurationData.format_tags = 'p;h1;h2;h3';
+ ck_configurationData.entities_processNumerical = 'force';
+ ck_configurationData.filebrowserBrowseUrl = Symphony.Context.get('root') + '/symphony/extension/ckeditor/filebrowser/';
+
+ // Set the correct height and width:
+ ck_configurationData.height = jQuery(this).height();
+ ck_configurationData.width = '100%'; // add some width to make up for the margins
+
+ var formatBlock = ckeditor_styles.length > 0 ? ['Format', 'Styles', 'RemoveFormat'] : ['Format'];
+
+ // Set the correct preset:
+ for(var i in ckeditor_presets)
+ {
+ if(ckeditor_presets[i].class == myClassName)
+ {
+ var info = ckeditor_presets[i];
+ info.toolbar.unshift(formatBlock);
+ ck_configurationData.toolbar = info.toolbar;
+ ck_configurationData.resize_enabled = info.resize;
+ ck_configurationData.startupOutlineBlocks = info.outline;
+ ck_configurationData.extraPlugins = info.plugins;
+ }
+ }
+
+ // Set the objectname:
+ var objectName = jQuery(this).attr('name');
+
+ // Do not add linebreaks and spaces after opening and before closing tags.
+ CKEDITOR.on('instanceReady', function(ev){
+ var tags = ['p', 'ol', 'ul', 'li']; // etc.
+ for (var key in tags) {
+ ev.editor.dataProcessor.writer.setRules(tags[key],
+ {
+ indent : false,
+ breakBeforeOpen : true,
+ breakAfterOpen : false,
+ breakBeforeClose : false,
+ breakAfterClose : true
+ });
+ }
+ // Add a border:
+ jQuery("label.ck_compact td.cke_contents").css({borderBottom: "1px solid #aaa"});
+ // fix width issue in SBL+
+ $this.siblings('span').css('width','');
+ });
+
+ //Stop CKEditor creating another instance
+ jQuery(this).removeClass(myClassName);
+
+ // Replace CKEditor instances:
+ CKEDITOR.replace(objectName, ck_configurationData);
});
});
\ No newline at end of file
diff --git a/content/content.css.php b/content/content.css.php
new file mode 100644
index 0000000..f4eb835
--- /dev/null
+++ b/content/content.css.php
@@ -0,0 +1,16 @@
+canAccessPage()){
+ $this->_Parent->customError(E_USER_ERROR, __('Access Denied'), __('You are not authorised to access this page.'));
+ exit();
+ }
+
+ header('Content-Type: text/css');
+ die(Symphony::Configuration()->get('styles', 'ckeditor'));
+ }
+ }
diff --git a/content/content.filebrowser.php b/content/content.filebrowser.php
new file mode 100755
index 0000000..678c36d
--- /dev/null
+++ b/content/content.filebrowser.php
@@ -0,0 +1,70 @@
+setTitle('Symphony - File Browser for CKEditor');
+ $this->addElementToHead(new XMLElement('meta', NULL, array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=UTF-8')), 0);
+ $this->addElementToHead(new XMLElement('meta', NULL, array('http-equiv' => 'X-UA-Compatible', 'content' => 'IE=edge,chrome=1')), 1);
+ $this->addStylesheetToHead(URL . '/symphony/assets/css/symphony.css', 'screen', 68);
+ $this->addStylesheetToHead(URL . '/symphony/assets/css/admin.css', 'screen', 69);
+ $this->addStylesheetToHead(URL . '/extensions/ckeditor/assets/filebrowser.css', 'screen', 70);
+ $this->addScriptToHead(URL . '/symphony/assets/js/jquery.js', 50);
+ $this->addScriptToHead(URL . '/extensions/ckeditor/assets/jquery.form.js', 51);
+ $this->addScriptToHead(URL . '/extensions/ckeditor/assets/filebrowser.js', 52);
+ $this->addHeaderToPage('Content-Type', 'text/html; charset=UTF-8');
+ $this->Html->setDTD('');
+
+ // Check for unauthorized access:
+ if(!Administration::instance()->isLoggedIn()){
+ $this->_Parent->customError(E_USER_ERROR, __('Access Denied'), __('You are not authorised to access this page.'));
+ exit();
+ }
+
+ $body = new XMLElement('div', '', array('id'=>'body'));
+
+ $left = new XMLElement('div', '', array('class'=>'left'));
+ $right = new XMLElement('div', '', array('class'=>'right'));
+ $left->appendChild(new XMLElement('h3', __('Section')));
+
+ // Get the sections:
+ $sectionManager = new SectionManager($this);
+ $sections = $sectionManager->fetch();
+
+ // Check which sections are allowed:
+ $data = Symphony::Configuration()->get('sections', 'ckeditor');
+ $checkedSections = $data != false ? explode(',', $data) : array();
+
+ if(count($checkedSections) > 0)
+ {
+ $list = new XMLElement('ul');
+ foreach($sections as $section)
+ {
+ if(in_array($section->get('id'), $checkedSections))
+ {
+ $item = new XMLElement('li');
+ $attributes = array('href'=>'#', 'id'=>$section->get('id'));
+ $link = new XMLElement('a', $section->get('name'), $attributes);
+ $item->appendChild($link);
+ $list->appendChild($item);
+ }
+ }
+ $left->appendChild($list);
+ } else {
+ $left->appendChild(new XMLElement('p', __('There are no sections available. Please select which sections are permitted to use the CKEditor file upload feature in the Symphony System Preferences.')));
+ }
+
+ $body->appendChild($left);
+ $body->appendChild($right);
+
+ $this->Body->appendChild($body);
+ }
+
+ }
+?>
\ No newline at end of file
diff --git a/content/content.filebrowserajax.php b/content/content.filebrowserajax.php
new file mode 100755
index 0000000..77e540d
--- /dev/null
+++ b/content/content.filebrowserajax.php
@@ -0,0 +1,212 @@
+setTitle('Symphony - File Browser for CKEditor');
+
+ if(!Administration::instance()->isLoggedIn()){
+ $this->_Parent->customError(E_USER_ERROR, __('Access Denied'), __('You are not authorised to access this page.'));
+ exit();
+ }
+
+ $this->addElementToHead(new XMLElement('meta', NULL, array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=UTF-8')), 0);
+ $this->addHeaderToPage('Content-Type', 'text/html; charset=UTF-8');
+
+ ## Build the form
+
+ $form = Widget::Form(Administration::instance()->getCurrentPageURL(), 'post');
+
+ // Check for the subdirectory:
+ $symphonyDomain = parse_url(URL, PHP_URL_SCHEME) . '://' . parse_url(URL, PHP_URL_HOST);
+ $symphonySubdir = str_replace($symphonyDomain, '', URL);
+
+ // Get the section:
+ if(isset($_GET['id'])) {
+ $sectionID = intval($_GET['id']);
+ $section = SectionManager::fetch($sectionID);
+
+ if($section != false)
+ {
+ $div = new XMLElement('div', null, array('class'=>'items'));
+ // Check if JIT is installed:
+ $status = ExtensionManager::fetchStatus(array('handle'=>'jit_image_manipulation'));
+ $jitEnabled = in_array(EXTENSION_ENABLED, $status);
+
+ // Get the field id's:
+ $fields = $section->fetchFields();
+ $fieldIDs = array();
+ foreach($fields as $field)
+ {
+ $fieldIDs[] = $field->get('id');
+ }
+
+ // Add rows:
+ $entries = EntryManager::fetch(null, $sectionID);
+ foreach($entries as $entry)
+ {
+ $data = $entry->getData();
+ $name = false;
+ foreach($fieldIDs as $id)
+ {
+ $info = $data[$id];
+ if(isset($info['value'])) {
+ if($name == false) {
+ $name = $info['value'];
+ }
+ } elseif(isset($info['handle'])) {
+ if($name == false) {
+ $name = $info['handle'];
+ }
+ } elseif(isset($info['file'])) {
+ if($name == false) {
+ $name = basename($info['file']);
+ }
+
+ $value = '';
+
+ $value = '';
+ $a = explode('.', $info['file']);
+ $ext = trim(strtolower($a[count($a)-1]));
+
+ // Check if JIT is enabled:
+ if($jitEnabled &&
+ ($ext == 'jpeg' || $ext == 'jpg' || $ext == 'png' || $ext == 'gif'))
+ {
+ $value .= '';
+ } else {
+ // Show an icon according to it's extension:
+ $a = explode('.', basename($info['file']));
+ $ext = strtolower($a[count($a)-1]);
+ $value .= '';
+ }
+ $value .= ' '.$name.'';
+ $item = new XMLElement('div', $value);
+ $div->appendChild($item);
+ }
+ }
+ }
+
+ $form->appendChild(new XMLElement('a', __('create new'), array('href'=>$symphonySubdir.'/symphony/publish/'.$section->get('handle').'/new/', 'class'=>'create button')));
+ $form->appendChild(new XMLElement('h3', $section->get('name')));
+ $form->appendChild($div);
+ $form->appendChild(new XMLElement('div', '', array('id'=>'thumb')));
+ }
+ }
+
+ $this->Body->appendChild($form);
+
+ }
+
+ private function getImage($extension)
+ {
+ switch($extension)
+ {
+ case 'jpeg' :
+ case 'jpg' :
+ case 'png' :
+ case 'gif' :
+ case 'bmp' :
+ {
+ $image = 'image.png';
+ break;
+ }
+ case 'pdf' :
+ {
+ $image = 'pdf.png';
+ break;
+ }
+ case 'doc' :
+ case 'docx' :
+ case 'rtf' :
+ case 'odt' :
+ {
+ $image = 'doc.png';
+ break;
+ }
+ case 'xls' :
+ case 'xlsx' :
+ case 'ods' :
+ {
+ $image = 'spreadsheet.png';
+ break;
+ }
+ case 'ppt' :
+ case 'pptx' :
+ case 'odp' :
+ {
+ $image = 'presentation.png';
+ break;
+ }
+ case 'ttf' :
+ case 'otf' :
+ {
+ $image = 'font.png';
+ break;
+ }
+ case 'html' :
+ case 'css' :
+ case 'php' :
+ case 'js' :
+ case 'xsl' :
+ {
+ $image = 'html.png';
+ break;
+ }
+ case 'mp3' :
+ case 'wav' :
+ case 'aif' :
+ case 'aiff' :
+ case 'wma' :
+ {
+ $image = 'sound.png';
+ break;
+ }
+ case 'fla' :
+ case 'swf' :
+ {
+ $image = 'swf.png';
+ break;
+ }
+ case 'txt' :
+ {
+ $image = 'txt.png';
+ break;
+ }
+ case 'wmv' :
+ case 'mov' :
+ case 'mpeg' :
+ case 'mpg' :
+ case 'avi' :
+ case 'mp4' :
+ case 'flv' :
+ {
+ $image = 'video.png';
+ break;
+ }
+ case 'zip' :
+ case 'rar' :
+ case '7z' :
+ {
+ $image = 'zip.png';
+ break;
+ }
+ default:
+ {
+ $image = 'unknown.png';
+ break;
+ }
+ }
+ return URL.'/extensions/ckeditor/assets/images/'.$image;
+ }
+ }
+?>
\ No newline at end of file
diff --git a/content/content.js.php b/content/content.js.php
new file mode 100644
index 0000000..2b744b2
--- /dev/null
+++ b/content/content.js.php
@@ -0,0 +1,39 @@
+canAccessPage()){
+ $this->_Parent->customError(E_USER_ERROR, __('Access Denied'), __('You are not authorised to access this page.'));
+ exit();
+ }
+
+ header('Content-Type: text/javascript');
+ $css = Symphony::Configuration()->get('styles', 'ckeditor');
+ $lines = explode("\n", $css);
+ // h3.groen-blok { color: #363636; background: #a3cf5e; }
+ // h3.zwart-blok { color: #fff; background: #363636; }
+ $js = 'var ckeditor_styles = [';
+ $rules = array();
+ foreach($lines as $line)
+ {
+ if(!empty($line))
+ {
+ $a = explode('{', $line);
+ $selector = trim($a[0]);
+ $b = explode('.', $selector);
+ $element = $b[0];
+ $className = $b[1];
+ // {name: 'Groen Blok', element: 'h3', attributes: {class: 'groen-blok'}}
+ $c = explode('-', $className);
+ $name = '';
+ foreach($c as $d) { $name .= ucfirst($d).' '; }
+ $rules[] = '{\'name\': \''.trim($name).'\', \'element\': \''.$element.'\', \'attributes\': {\'class\': \''.$className.'\'}}';
+ }
+ }
+ $js .= implode(',', $rules).']';
+ die($js);
+ }
+ }
diff --git a/content/content.pages.php b/content/content.pages.php
new file mode 100755
index 0000000..5e1cb10
--- /dev/null
+++ b/content/content.pages.php
@@ -0,0 +1,113 @@
+canAccessPage()){
+ $this->_Parent->customError(E_USER_ERROR, __('Access Denied'), __('You are not authorised to access this page.'));
+ exit();
+ }
+
+ // The pages:
+ $tree = array();
+ $tree[] = array('name'=>'', 'items'=>$this->buildTree());
+
+ echo json_encode($tree);
+ die();
+ }
+
+ private function buildTree($parent = null, $indent = 0)
+ {
+ if($parent == null)
+ {
+ $results = PageManager::fetch(true, array(), array('`parent` IS NULL'), '`sortorder` ASC');
+ } else {
+ $results = PageManager::fetch(true, array(), array('`parent` = '.$parent), '`sortorder` ASC');
+ }
+ $tree = array();
+ foreach($results as $result)
+ {
+ // Check if the page should be shown:
+ if(!in_array('ck_hide', $result['type']))
+ {
+ $prefix = '';
+ $info = array('handle'=>$result['handle'], 'path'=>$result['path']);
+ if($result['path'] == null)
+ {
+ $info['url'] = '/'.$result['handle'].'/';
+ $info['title'] = $result['title'];
+ } else {
+ $info['url'] = '/'.$result['path'].'/'.$result['handle'].'/';
+ for($i = 0; $i < $indent; $i++)
+ {
+ $prefix .= ' '; // Please note: this might look like an empty space (nbsp) but it's an em space (emsp).
+ // This was necessary because kept showing as plain text in the dropdown.
+ }
+
+ $info['title'] = $prefix.' › '.General::sanitize($result['title']);
+ }
+ $tree[] = $info;
+
+ // Check if there are templates for this page:
+ $tree = array_merge($tree, $this->checkTemplates($result['id'], $prefix.' ')); // also an emsp
+
+ // Get the children:
+ $children = $this->buildTree($result['id'], $indent + 1);
+
+ // Join arrays:
+ $tree = array_merge($tree, $children);
+ }
+ }
+
+ return $tree;
+ }
+
+ private function checkTemplates($pageId, $prefix = '')
+ {
+ // Link templates:
+ $templates = Symphony::Database()->fetch(
+ sprintf('SELECT * FROM `tbl_ckeditor_link_templates` WHERE `page_id` = %d;', $pageId)
+ );
+
+ $entryTree = array();
+
+ foreach($templates as $template)
+ {
+ $section = SectionManager::fetch($template['section_id']);
+ $entries = EntryManager::fetch(null, $template['section_id']);
+ $fields = $section->fetchFields();
+ foreach($entries as $entry)
+ {
+ $link = $template['link'];
+ // Replace the ID:
+ $link = str_replace('{$id}', $entry->get('id'), $link);
+ $data = $entry->getData();
+
+ foreach($fields as $field)
+ {
+ // Replace the placeholders with the value:
+ // Check if the field has a 'handle':
+ $testData = $field->processRawFieldData('test', $field->__OK__);
+ if(isset($testData['handle']))
+ {
+ $link = str_replace('{$'.$field->get('element_name').'}', $data[$field->get('id')]['handle'], $link);
+ }
+ }
+
+ $entryTree[] = array(
+ 'handle' => $data[$field->get('id')]['handle'],
+ 'path' => '',
+ 'url' => $link,
+ 'title' => $prefix.' › '.General::sanitize($data[$template['field_id']]['value'])
+ );
+
+ }
+ }
+
+ return $entryTree;
+ }
+ }
diff --git a/extension.driver.php b/extension.driver.php
index 9e4cf5d..540302a 100755
--- a/extension.driver.php
+++ b/extension.driver.php
@@ -1,59 +1,431 @@
'Text Formatter: CKEditor',
- 'version' => '0.71',
- 'release-date' => '2010-06-26',
- 'author' => array(
- 'name' => 'Tony Arnold',
- 'website' => 'http://thecocoabots.com',
- 'email' => 'tony@thecocoabots.com'
- ),
- 'description' => 'Includes CKEditor, a web-based XHTML editor developed by Frederico Knabben.'
- );
- }
-
- /**
- * Add callback functions to backend delegates
- */
-
- public function getSubscribedDelegates(){
- return array(
- array('page' => '/backend/',
- 'delegate' => 'ModifyTextareaFieldPublishWidget',
- 'callback' => 'applyCKEditor'),
-
- array('page' => '/backend/',
- 'delegate' => 'ModifyTextBoxFullFieldPublishWidget',
- 'callback' => 'applyCKEditor'),
- );
- }
-
- /**
- * Load and apply CKEditor
- */
-
- protected $addedCKEditorHeaders = false;
-
- public function applyCKEditor($context) {
- if($context['field']->get('formatter') != 'ckeditor') return;
-
- if(!$this->addedCKEditorHeaders){
- Administration::instance()->Page->addScriptToHead(URL . '/extensions/ckeditor/lib/ckeditor/ckeditor.js', 200, false);
- Administration::instance()->Page->addScriptToHead(URL . '/extensions/ckeditor/assets/symphony.ckeditor.js', 210, false);
- Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/ckeditor/assets/symphony.ckeditor.css', 'screen', 30);
-
- $this->addedCKEditorHeaders = true;
- }
- }
-
- }
-
-?>
\ No newline at end of file
+ Class extension_ckeditor extends Extension
+ {
+ protected $addedCKEditorHeaders = false;
+ protected $sections;
+
+ /**
+ * Add callback functions to backend delegates
+ * @return array
+ */
+ public function getSubscribedDelegates(){
+ return array(
+ array('page' => '/backend/',
+ 'delegate' => 'ModifyTextareaFieldPublishWidget',
+ 'callback' => 'applyCKEditor'),
+
+ array('page' => '/backend/',
+ 'delegate' => 'ModifyTextBoxFullFieldPublishWidget',
+ 'callback' => 'applyCKEditor'),
+
+ array('page' => '/system/preferences/',
+ 'delegate' => 'AddCustomPreferenceFieldsets',
+ 'callback' => 'appendPresets'),
+
+ array('page' => '/system/preferences/',
+ 'delegate' => 'Save',
+ 'callback' => 'savePresets')
+ );
+ }
+
+ /**
+ * Append presets
+ * @param $context
+ */
+ public function appendPresets($context)
+ {
+ Symphony::Engine()->Page->addScriptToHead(URL . '/extensions/ckeditor/assets/preferences.js', 4676);
+
+ $wrapper = $context['wrapper'];
+
+ $fieldset = new XMLElement('fieldset', '', array('class'=>'settings'));
+ $fieldset->appendChild(new XMLElement('legend', __('CKEditor File Browser')));
+
+ $sectionManager = new SectionManager($this);
+ $sections = $sectionManager->fetch();
+
+ // Check which sections are allowed:
+ $data = Symphony::Configuration()->get('sections', 'ckeditor');
+ $checkedSections = $data != false ? explode(',', $data) : array();
+
+ // If there are no sections found:
+ if($sections)
+ {
+ $options = array();
+ foreach($sections as $section)
+ {
+ $options[] = array($section->get('id'), in_array($section->get('id'), $checkedSections), $section->get('name'));
+ }
+ $label = Widget::Label(__('Permitted sections for the file browser:'));
+ $label->appendChild(Widget::Select('ckeditor_sections[]', $options, array('multiple'=>'multiple')));
+ $fieldset->appendChild($label);
+ }
+
+ // Link templates for CKEditor:
+ $sections = SectionManager::fetch();
+ $dbpages = PageManager::fetch();
+
+ $pages = array();
+
+ // Filter out the ck_hide:
+ foreach ($dbpages as $page) {
+ $types = PageManager::fetchPageTypes($page['id']);
+ if(!in_array('ck_hide', $types))
+ {
+ $pages[] = $page;
+ }
+ }
+
+ // Adjust page title:
+ foreach ($pages as &$_page) {
+ $p = $_page;
+ $title = $_page['title'];
+ while (!is_null($p['parent'])) {
+ $p = PageManager::fetch(false, array(), array('id' => $p['parent']));
+ $title = $p['title'] . ' : ' . $title;
+ }
+ $_page['title'] = $title;
+ }
+
+ // Sort the array:
+ $titles = array();
+ foreach ($pages as $key => $row) {
+ $titles[$key] = strtolower($row['title']);
+ }
+ array_multisort($titles, SORT_ASC, $pages);
+
+ $this->sections = array();
+ foreach($sections as $s)
+ {
+ $a = array('id'=>$s->get('id'), 'name'=>$s->get('name'), 'fields'=>array());
+ $fields = FieldManager::fetch(null, $s->get('id'));
+ foreach($fields as $field)
+ {
+ // For now, only allow fields of the type 'input' to be used as a handle:
+ if($field->get('type') == 'input')
+ {
+ $a['fields'][] = array('id'=>$field->get('id'), 'label'=>$field->get('label'), 'element_name'=>$field->get('element_name'));
+ }
+ }
+ $this->sections[] = $a;
+ }
+
+ $fieldset->appendChild(new XMLElement('p', __('Link templates:'), array('class' => 'label')));
+ $ol = new XMLElement('ol');
+ $ol->setAttribute('class', 'ckeditor-duplicator');
+
+ $templates = Symphony::Database()->fetch('SELECT * FROM `tbl_ckeditor_link_templates`;');
+ if(!is_array($pages)) $pages = array($pages);
+
+ foreach($pages as $page)
+ {
+ foreach($templates as $template) {
+ if($template['page_id'] != $page['id']) continue;
+ $duplicator = $this->__buildDuplicatorItem($page, $template);
+ $ol->appendChild($duplicator);
+ }
+
+ $duplicator = $this->__buildDuplicatorItem($page, NULL);
+ $ol->appendChild($duplicator);
+ }
+
+ $fieldset->appendChild($ol);
+
+ // Plugin presets:
+ $fieldset->appendChild(new XMLElement('p', __('Plugin presets:'), array('class' => 'label')));
+ $ol = new XMLElement('ol');
+ $ol->setAttribute('class', 'ckeditor-duplicator');
+
+ // Create template:
+ $template = new XMLElement('li', null, array('class' => 'template'));
+ $template->appendChild(new XMLElement('header', '
'));
+ $template->appendChild(Widget::Label(__('Name'), Widget::Input('ckeditor_presets['.$index.'][name]', $preset['name'])));
+ $template->appendChild(Widget::Label(__('Toolbar'),
+ Widget::Textarea('ckeditor_presets['.$index.'][toolbar]', 5, 50, $preset['toolbar'])));
+ $template->appendChild(Widget::Label(__('Plugins'),
+ Widget::Textarea('ckeditor_presets['.$index.'][plugins]', 5, 50, $preset['plugins'])));
+ $template->appendChild(Widget::Label(__('%s Enable resizing',
+ array(Widget::Input('ckeditor_presets['.$index.'][resize]', '1', 'checkbox',
+ ($preset['resize'] == 1 ? array('checked'=>'checked') : null)
+ )->generate()))));
+ $template->appendChild(Widget::Label(__('%s Show outline blocks',
+ array(Widget::Input('ckeditor_presets['.$index.'][outline]', '1', 'checkbox',
+ ($preset['outline'] == 1 ? array('checked'=>'checked') : null)
+ )->generate()))));
+ $ol->appendChild($template);
+ $index++;
+ }
+
+ $fieldset->appendChild($ol);
+
+ // Styles:
+ $fieldset->appendChild(new XMLElement('p', __('Styles: (one style per line: h3.example { color: #f00; background: #0f0; }) Class name is converted to name (h3.hello-world = Hello World).'), array('class'=>'label')));
+ $textarea = Widget::Textarea('ckeditor[styles]', 5, 50, Symphony::Configuration()->get('styles', 'ckeditor'));
+ $fieldset->appendChild($textarea);
+
+ $wrapper->appendChild($fieldset);
+ }
+
+ /**
+ * @param $page
+ * @param null $template
+ * @return XMLElement
+ */
+ private function __buildDuplicatorItem($page, $template=NULL) {
+ // value of -1 signifies a duplicator "template"
+ $index = ($template == NULL) ? '-1' : $template['id'];
+
+ $wrapper = new XMLElement('li');
+ $wrapper->setAttribute('class', ($template == NULL) ? 'template' : '');
+
+ $header = new XMLElement('header', null, array('data-name' => $page['title']));
+ $header->appendChild(new XMLElement('h4', $page['title']));
+ $wrapper->appendChild($header);
+
+ $divgroup = new XMLElement('div');
+
+ $label = Widget::Label(__('Link template') . '' . __('Use {$id} for the entry ID, and {$fieldname} for field-placeholders. If the field has a handle, this is automatically used.') . '');
+ $label->appendChild(Widget::Input(
+ "ckeditor_link_templates[" . $index . "][link]",
+ General::sanitize($template['link']
+ )));
+ $divgroup->appendChild($label);
+ $wrapper->appendChild($divgroup);
+
+ $divgroup = new XMLElement('div', null, array('class'=>'group'));
+
+ $label = Widget::Label(__('Section to get the entries from'));
+ $options = array();
+ foreach($this->sections as $section)
+ {
+ $options[] = array($section['id'], $template['section_id'] == $section['id'], $section['name']);
+ }
+/* $label->appendChild(Widget::Select('ckeditor_link_templates[' . $index . '][section]', $options, array('onchange'=>
+ "jQuery('optgroup[label!=' + jQuery(this).val() + '], optgroup[label!=' + jQuery(this).val() + '] option', jQuery(this).parent().parent()).hide()")));*/
+ $label->appendChild(Widget::Select('ckeditor_link_templates[' . $index . '][section_id]', $options));
+ $divgroup->appendChild($label);
+
+ $label = Widget::Label(__('Field to display as name'));
+ $options = array(array('', false, 0));
+ foreach($this->sections as $section)
+ {
+ $fields = array();
+ foreach($section['fields'] as $field)
+ {
+ $fields[] = array($field['id'], $template['field_id'] == $field['id'], $field['label']);
+ }
+ $options[] = array('label'=>$section['name'], 'options'=>$fields);
+ }
+ $label->appendChild(Widget::Select('ckeditor_link_templates[' . $index . '][field_id]', $options));
+ $divgroup->appendChild($label);
+
+ $wrapper->appendChild(new XMLElement('input', NULL, array(
+ 'type' => 'hidden',
+ 'name' => 'ckeditor_link_templates[' . $index . '][page_id]',
+ 'value' => $page['id']
+ )));
+
+ $wrapper->appendChild($divgroup);
+
+ return $wrapper;
+ }
+
+ /**
+ * Save the presets
+ * @param $context
+ */
+ public function savePresets($context)
+ {
+ if(isset($_POST['ckeditor_sections'])) {
+ // Save the sections to the config-file
+ $sectionStr = implode(',', $_POST['ckeditor_sections']);
+ Symphony::Configuration()->set('sections', $sectionStr, 'ckeditor');
+ if(version_compare(Administration::Configuration()->get('version', 'symphony'), '2.2.5', '>'))
+ {
+ // 2.3 and up:
+ Symphony::Configuration()->write();
+ } else {
+ // Earlier versions:
+ Symphony::Configuration()->write();
+ }
+
+ } else {
+ // If no sections are selected, delete the file:
+ Symphony::Configuration()->remove('sections', 'ckeditor');
+ Symphony::Configuration()->write();
+ }
+ if(isset($_POST['ckeditor_link_templates'])) {
+ // Save the link templates to the database:
+ Symphony::Database()->query("DELETE FROM `tbl_ckeditor_link_templates`");
+
+ $shortcuts = $_POST['ckeditor_link_templates'];
+ unset($_POST['ckeditor_link_templates']);
+
+ if(!empty($shortcuts))
+ {
+ foreach($shortcuts as $i => $shortcut) {
+ Symphony::Database()->insert($shortcut, "tbl_ckeditor_link_templates");
+ }
+ }
+ }
+ if(isset($_POST['ckeditor']['styles']))
+ {
+ Symphony::Configuration()->set('styles', General::sanitize($_POST['ckeditor']['styles']), 'ckeditor');
+ Symphony::Configuration()->write();
+ } else {
+ Symphony::Configuration()->remove('styles', 'ckeditor');
+ Symphony::Configuration()->write();
+ }
+ // Presets:
+ if(isset($_POST['ckeditor_presets']))
+ {
+ // Delete formatter references from DB:
+ Symphony::Database()->query("DELETE FROM `tbl_ckeditor_presets`");
+
+ // Delete formatter files:
+ $formatters = glob(EXTENSIONS.'/ckeditor/text-formatters/formatter.*.php');
+ foreach($formatters as $formatter) { unlink($formatter); }
+
+ // Create it all new:
+ foreach($_POST['ckeditor_presets'] as $preset)
+ {
+ Symphony::Database()->insert($preset, 'tbl_ckeditor_presets');
+ // Create text formatter file:
+ $str = file_get_contents(EXTENSIONS.'/ckeditor/text-formatters/template.ckeditor.php');
+ $handle = 'ckeditor_'.General::createHandle($preset['name'], 255, '_');
+ $str = str_replace(array('{{NAME}}', '{{HANDLE}}'), array($preset['name'], $handle), $str);
+ file_put_contents(EXTENSIONS.'/ckeditor/text-formatters/formatter.'.$handle.'.php', $str);
+ }
+ }
+ }
+
+ /**
+ * Install CKEditor
+ * @return void
+ */
+ public function install()
+ {
+ Symphony::Database()->query("
+ CREATE TABLE IF NOT EXISTS `tbl_ckeditor_link_templates` (
+ `id` int(11) NOT NULL auto_increment,
+ `link` varchar(255) NOT NULL,
+ `field_id` int(11) NOT NULL,
+ `section_id` int(11) NOT NULL,
+ `page_id` int(11) NOT NULL,
+ `sort_order` int(11) NOT NULL,
+ PRIMARY KEY (`id`)
+ )
+ ");
+
+ Symphony::Database()->query("
+ CREATE TABLE IF NOT EXISTS `tbl_ckeditor_presets` (
+ `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+ `name` VARCHAR( 255 ) NOT NULL ,
+ `toolbar` TEXT NULL ,
+ `plugins` TEXT NULL ,
+ `resize` INT( 1 ) NULL ,
+ `outline` INT( 1 ) NULL
+ ) ENGINE = MYISAM ;
+ ");
+
+ // Fill default presets:
+ Symphony::Database()->query("
+ INSERT INTO `tbl_ckeditor_presets` (`name`, `toolbar`, `plugins`, `resize`, `outline`) VALUES
+('Minimal', '[''Bold'', ''Italic'', ''Strike'', ''-'', ''Subscript'', ''Superscript''],\r\n[''Link'', ''Unlink''],\r\n[''Source'']', NULL, NULL, NULL),
+('Normal', '[''Bold'', ''Italic'', ''Strike'', ''-'', ''Subscript'', ''Superscript''],\r\n[''NumberedList'', ''BulletedList'', ''-'', ''Outdent'', ''Indent'', ''Blockquote''],\r\n[''Image'', ''oembed''],[''Link'', ''Unlink''],\r\n[''HorizontalRule''],\r\n[''Source'', ''Maximize'']', NULL, 1, 1),
+('Full', '{ name: ''document'', items : [ ''Source'',''-'',''Save'',''NewPage'',''DocProps'',''Preview'',''Print'',''-'',''Templates'' ] },\r\n { name: ''clipboard'', items : [ ''Cut'',''Copy'',''Paste'',''PasteText'',''PasteFromWord'',''-'',''Undo'',''Redo'' ] },\r\n { name: ''editing'', items : [ ''Find'',''Replace'',''-'',''SelectAll'',''-'',''SpellChecker'', ''Scayt'' ] },\r\n { name: ''forms'', items : [ ''Form'', ''Checkbox'', ''Radio'', ''TextField'', ''Textarea'', ''Select'', ''Button'', ''ImageButton'', ''HiddenField'' ] },\r\n ''/'',\r\n { name: ''basicstyles'', items : [ ''Bold'',''Italic'',''Underline'',''Strike'',''Subscript'',''Superscript'',''-'',''RemoveFormat'' ] },\r\n { name: ''paragraph'', items : [ ''NumberedList'',''BulletedList'',''-'',''Outdent'',''Indent'',''-'',''Blockquote'',''CreateDiv'',''-'',''JustifyLeft'',''JustifyCenter'',''JustifyRight'',''JustifyBlock'',''-'',''BidiLtr'',''BidiRtl'' ] },\r\n { name: ''links'', items : [ ''Link'',''Unlink'',''Anchor'' ] },\r\n { name: ''insert'', items : [ ''Image'',''Flash'',''Table'',''HorizontalRule'',''Smiley'',''SpecialChar'',''PageBreak'' ] },\r\n ''/'',\r\n { name: ''styles'', items : [ ''Styles'',''Format'',''Font'',''FontSize'' ] },\r\n { name: ''colors'', items : [ ''TextColor'',''BGColor'' ] },\r\n { name: ''tools'', items : [ ''Maximize'', ''ShowBlocks'',''-'',''About'' ] }', NULL, 1, 1);
+ ");
+
+ // Delete formatter files:
+ $formatters = glob(EXTENSIONS.'/ckeditor/text-formatters/formatter.*.php');
+ foreach($formatters as $formatter) { unlink($formatter); }
+
+ // Create it all new:
+ $presets = Symphony::Database()->fetch('SELECT * FROM `tbl_ckeditor_presets`;');
+ foreach($presets as $preset)
+ {
+ unset($preset['id']);
+ Symphony::Database()->insert($preset, 'tbl_ckeditor_presets');
+ // Create text formatter file:
+ $str = file_get_contents(EXTENSIONS.'/ckeditor/text-formatters/template.ckeditor.php');
+ $handle = 'ckeditor_'.General::createHandle($preset['name'], 255, '_');
+ $str = str_replace(array('{{NAME}}', '{{HANDLE}}'), array($preset['name'], $handle), $str);
+ file_put_contents(EXTENSIONS.'/ckeditor/text-formatters/formatter.'.$handle.'.php', $str);
+ }
+ }
+
+ /**
+ * Update CKEditor
+ * @param bool|string $prevVersion
+ */
+ public function update($prevVersion)
+ {
+ if(version_compare($prevVersion, '1.4', '<'))
+ {
+ $this->install();
+ }
+ }
+
+ /**
+ * On uninstall, delete the ckeditor_sections-file
+ */
+ public function uninstall()
+ {
+ Symphony::Configuration()->remove('sections', 'ckeditor');
+ Administration::instance()->saveConfig();
+ Symphony::Database()->query("DROP TABLE `tbl_ckeditor_link_templates`");
+ Symphony::Database()->query("DROP TABLE `tbl_ckeditor_presets`");
+ }
+
+ /**
+ * Load and apply CKEditor
+ * @param $context
+ * @return mixed
+ */
+ public function applyCKEditor($context) {
+
+/* $format = $context['field']->get('text_formatter') == TRUE ? 'text_formatter' : 'formatter';
+
+ if(($context['field']->get($format) != 'ckeditor' && $context['field']->get($format) != 'ckeditor_compact')) return;*/
+
+ if(!$this->addedCKEditorHeaders){
+ Administration::instance()->Page->addScriptToHead(URL . '/extensions/ckeditor/lib/ckeditor/ckeditor.js', 200, false);
+ Administration::instance()->Page->addScriptToHead(URL . '/symphony/extension/ckeditor/js/', 209, false);
+ Administration::instance()->Page->addScriptToHead(URL . '/extensions/ckeditor/assets/symphony.ckeditor.js', 210, false);
+ Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/ckeditor/assets/symphony.ckeditor.css', 'screen', 30);
+
+ $js = 'var ckeditor_presets = [];';
+ $presets = Symphony::Database()->fetch('SELECT * FROM `tbl_ckeditor_presets`;');
+ foreach($presets as $preset)
+ {
+ $js .= 'ckeditor_presets.push({name:"'.$preset['name'].'", class: "ckeditor_'.
+ General::createHandle($preset['name'], 255, '_').'", toolbar: ['.$preset['toolbar'].'], plugins: "'.
+ $preset['plugins'].'", resize: '.($preset['resize'] == 1 ? 'true' : 'false').', outline: '.
+ ($preset['outline'] == 1 ? 'true' : 'false').'});'."\n";
+ }
+ $script = new XMLElement('script', $js, array('type'=>'text/javascript'));
+ Administration::instance()->Page->addElementToHead($script);
+
+
+ $this->addedCKEditorHeaders = true;
+ }
+ }
+
+ }
diff --git a/extension.meta.xml b/extension.meta.xml
new file mode 100644
index 0000000..7ac5c57
--- /dev/null
+++ b/extension.meta.xml
@@ -0,0 +1,24 @@
+
+
+ CKEditor
+ Includes CKEditor, a web-based XHTML editor developed by Frederico Knabben. It also has an integrated file browser which uses Symphony sections to get it's files from.
+ https://github.com/TwistedInteractive/ckeditor
+
+ Text Formatter
+
+
+
+
+
+
+ - Updated to CKEditor 4.0.1.1
+ - Added templates for toolbars
+ - Fixed link templates + page links (got accidentally deleted in previous update)
+
+
+
+
+
+
+
+
diff --git a/lang/lang.it.php b/lang/lang.it.php
new file mode 100644
index 0000000..f72f0ca
--- /dev/null
+++ b/lang/lang.it.php
@@ -0,0 +1,51 @@
+ 'Italian',
+ 'author' => array(
+ 'name' => 'Davide Grobberio',
+ 'email' => 'davide@zaniniadv.it',
+ 'website' => 'http://www.zaniniadv.it'
+ ),
+ 'release-date' => '2013-01-27'
+ );
+
+ /**
+ * CKEditor
+ */
+ $dictionary = array(
+
+ 'CKEditor File Browser' =>
+ 'CKEditor File Browser',
+
+ 'Field to display as name' =>
+ 'Campi da visualizzare come nome',
+
+ 'Link template' =>
+ 'Modello',
+
+ 'Link templates:' =>
+ 'Modelli:',
+
+ 'Permitted sections for the file browser:' =>
+ 'Sezioni cui è possibile impostare CKEditor:',
+
+ 'Section' =>
+ 'Sezioni',
+
+ 'Section to get the entries from' =>
+ 'Sezioni cui ottenere le voci',
+
+ 'There are no sections available. Please select which sections are permitted to use the CKEditor file upload feature in the Symphony System Preferences.' =>
+ 'Non ci sono sezioni al momento. Seleziona le sezioni in cui è possibile utilizzare l\'upload file CKEditor.',
+
+ 'Use {$id} for the entry ID, and {$fieldname} for field-placeholders. If the field has a handle, this is automatically used.' =>
+ 'Usa {$id} per selezionare l\'ID delle voci, e {$fieldname} per il campo segna-posto. Se il campo ha un "handle", questa viene automaticamente utilizzato.',
+
+ 'create new' =>
+ 'Crea nuovo',
+
+ 'Styles: (one style per line: h3.example { color: #f00; background: #0f0; }) Class name is converted to name (h3.hello-world = Hello World).' =>
+ 'Stili: (uno stile per riga: h3.esempio { color: #f00; background: #0f0; }) Il nome della classe viene convertito nel nome scelto (h3.hello-world = Hello World).',
+
+ );
diff --git a/lang/lang.ru.php b/lang/lang.ru.php
new file mode 100644
index 0000000..f155010
--- /dev/null
+++ b/lang/lang.ru.php
@@ -0,0 +1,51 @@
+ 'Русский',
+ 'author' => array(
+ 'name' => 'Александр Бирюков',
+ 'email' => 'info@alexbirukov.ru',
+ 'website' => 'http://alexbirukov.ru'
+ ),
+ 'release-date' => '2012-12-11'
+ );
+
+ /**
+ * CKEditor
+ */
+ $dictionary = array(
+
+ 'CKEditor File Browser' =>
+ 'Браузер файлов CKEditor',
+
+ 'Field to display as name' =>
+ 'Поле для отображения в качестве имени',
+
+ 'Link template' =>
+ 'Шаблон ссылки',
+
+ 'Link templates:' =>
+ 'Шаблоны ссылок:',
+
+ 'Permitted sections for the file browser:' =>
+ 'Разделы доступные для браузера файлов:',
+
+ 'Section' =>
+ 'Раздел',
+
+ 'Section to get the entries from' =>
+ 'Раздел из которого производить выбор записей',
+
+ 'There are no sections available. Please select which sections are permitted to use the CKEditor file upload feature in the Symphony System Preferences.' =>
+ 'Не указаны доступные разделы. Пожалуйста, укажите в настройках системы разделы, которые доступны для загрузки файлов через CKEditor.',
+
+ 'Use {$id} for the entry ID, and {$fieldname} for field-placeholders. If the field has a handle, this is automatically used.' =>
+ 'Используйте переменную {$id} для вывода ID записи и {$fieldname} для подстановки значения поля.',
+
+ 'create new' =>
+ 'добавить',
+
+ 'Styles: (one style per line: h3.example { color: #f00; background: #0f0; }) Class name is converted to name (h3.hello-world = Hello World).' =>
+ 'Стили: (один стиль в строке: h3.example { color: #f00; background: #0f0; }) имя класса ковертируется в имя (h3.hello-world = Hello World).',
+
+ );
diff --git a/lib/ckeditor/.htaccess b/lib/ckeditor/.htaccess
deleted file mode 100644
index ed1d794..0000000
--- a/lib/ckeditor/.htaccess
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
-# For licensing, see LICENSE.html or http://ckeditor.com/license
-#
-
-#
-# On some specific Linux installations you could face problems with Firefox.
-# It could give you errors when loading the editor saying that some illegal
-# characters were found (three strange chars in the beginning of the file).
-# This could happen if you map the .js or .css files to PHP, for example.
-#
-# Those characters are the Byte Order Mask (BOM) of the Unicode encoded files.
-# All FCKeditor files are Unicode encoded.
-#
-
-AddType application/x-javascript .js
-AddType text/css .css
-
-#
-# If PHP is mapped to handle XML files, you could have some issues. The
-# following will disable it.
-#
-
-AddType text/xml .xml
diff --git a/lib/ckeditor/CHANGES.html b/lib/ckeditor/CHANGES.html
deleted file mode 100644
index 1c57653..0000000
--- a/lib/ckeditor/CHANGES.html
+++ /dev/null
@@ -1,752 +0,0 @@
-
-
-
-
- Changelog - CKEditor
-
-
-
-
-
- CKEditor Changelog
-
-
- CKEditor 3.3.1
-
- Fixed issues:
-
-
#5780 : Text selection lost when opening some of the dialogs.
-
#5787 : Liststyle plugin wasn't packaged into the core (CKEDITOR.resourceManager.load exception).
-
#5637 : Fix wrong nesting that generated "<head> must be a child of <html>" warning in Webkit.
-
#5790 : Internal only attributes output on fullpage <html> tag.
-
#5761 : [IE] Color dialog matrix buttons are barely clickable in quirks mode.
-
#5759 : [IE] Clicking on the scrollbar and then on the host page causes error.
-
#5772 : List style dialog is missing tab page ids.
-
#5782 : [FF] Wysiwyg mode is broken by 'display' style changes on editor's parent DOM tree.
-
#5801 : [IE] contentEditable="false" doesn't apply in effect on inline-elements.
-
#5794 : Empty find matching twice results in JavaScript error.
-
#5732 : If it isn't possible to connect to the SCAYT servers the dialogs might hang in Firefox. Fix for Firefox>=3.6.
-
#5807 : [FF2] New page command results in uneditable document.
-
#5807 : [FF2] SCAYT plugin is disabled in Firefox2 due to selection interference.
-
#5772 : [IE] Some numbered list style types are not supported by IE6/7 and causes JavaScript error.
-
-
- CKEditor 3.3
-
- New features:
-
-
#635 : The properties dialog will now open when double clicking on objects.
-
#3893 : It's now possible to indent/outdent lists when selecting the first list item.
-
#4968 : The contentsLangDirection setting now has a default value 'ui' which inherit language direction from the editor UI language.
-
#4649 : The color picker dialog is now accessible.
-
#3593 : The editing area is now enabled by contentEditable="true" instead of designMode="on" to allow creating uneditable content elements in all browsers.
-
#4056 : Hidden fields will now be displayed as fake element just like in FCKeditor 2.
-
-
- CKEditor 3.2.2
-
- New features:
-
-
The SCAYT spell checker is now enabled by default through the autoStartup setting.
#4478 : Enable the SelectAll command in source mode.
-
#5150 : Allow names in the CKEDITOR.config.colorButton_colors setting.
-
#4810 : Adding configuration option for image dialog preview area filling text.
-
#536 : Object style now could be applied on any parent element of current selection.
-
#5290 : Unified stylesSet loading removing dependencies from the styles combo.
- Now the configuration entry is named 'config.stylesSet' instead of config.stylesCombo_stylesSet and the default location
- is under the 'styles' plugin instead of 'stylescombo'.
-
#5352 : Allow to define the stylesSet array in the config object for the editor.
#4172 : [Safari] The trailing
- <br> was not been always added to blank lines ending with .
-
#4178 : It's now possible to
- copy and paste Flash content among different editor instances.
-
#4193 : Automatic font color produced empty span on Firefox 3.5.
-
#4186 : [FF] Fixed First open float panel cause host page scrollbar blinking.
-
#4227 : Fixed destroy editor instance created on textarea which is not within form cause error.
-
#4240 : Fixed editor name containing hyphen break editor completely.
-
#3828 : Malformed nested list is now corrected by the parser.
-
-
- CKEditor 3.0 RC
-
- Changelog starts at this release.
-
-
-
diff --git a/lib/ckeditor/CHANGES.md b/lib/ckeditor/CHANGES.md
new file mode 100644
index 0000000..72813ff
--- /dev/null
+++ b/lib/ckeditor/CHANGES.md
@@ -0,0 +1,60 @@
+CKEditor 4 Changelog
+====================
+
+## CKEditor 4.0.1.1
+
+* Security update: Added protection against XSS attack and possible path disclosure in PHP sample.
+
+## CKEditor 4.0.1
+
+Fixed issues:
+
+* [#9655](http://dev.ckeditor.com/ticket/9655): Support for IE Quirks Mode in new Moono skin.
+* Accessibility issues (mainly on inline editor): [#9364](http://dev.ckeditor.com/ticket/9364), [#9368](http://dev.ckeditor.com/ticket/9368), [#9369](http://dev.ckeditor.com/ticket/9369), [#9370](http://dev.ckeditor.com/ticket/9370), [#9541](http://dev.ckeditor.com/ticket/9541), [#9543](http://dev.ckeditor.com/ticket/9543), [#9841](http://dev.ckeditor.com/ticket/9841), [#9844](http://dev.ckeditor.com/ticket/9844).
+* Magic-line:
+ * [#9481](http://dev.ckeditor.com/ticket/9481): Added accessibility support for Magic-line.
+ * [#9509](http://dev.ckeditor.com/ticket/9509): Added Magic-line support for forms.
+ * [#9573](http://dev.ckeditor.com/ticket/9573): Magic-line doesn't disappear on `mouseout` in the specific case.
+* [#9754](http://dev.ckeditor.com/ticket/9754): [Webkit] Cut & paste simple unformatted text generates inline wrapper in Webkits.
+* [#9456](http://dev.ckeditor.com/ticket/9456): [Chrome] Properly paste bullet list style from MS-Word.
+* [#9699](http://dev.ckeditor.com/ticket/9699), [#9758](http://dev.ckeditor.com/ticket/9758): Improved selection locking when selecting by dragging.
+* Context menu:
+ * [#9712](http://dev.ckeditor.com/ticket/9712): Context menu open destroys editor focus.
+ * [#9366](http://dev.ckeditor.com/ticket/9366): Context menu should be displayed over floating toolbar.
+ * [#9706](http://dev.ckeditor.com/ticket/9706): Context menu generates JS error in inline mode when editor attached to header element.
+* [#9800](http://dev.ckeditor.com/ticket/9800): Hide float panel when resizing window.
+* [#9721](http://dev.ckeditor.com/ticket/9721): Padding in content of div based editor puts editing area under bottom UI space.
+* [#9528](http://dev.ckeditor.com/ticket/9528): Host page's `box-sizing` style shouldn't influence editor UI elements.
+* [#9503](http://dev.ckeditor.com/ticket/9503): Forms plugin adds context menu listeners only on supported input types. Added support for `tel, email, search` and `url` input types.
+* [#9769](http://dev.ckeditor.com/ticket/9769): Improved floating toolbar positioning in narrow window.
+* [#9875](http://dev.ckeditor.com/ticket/9875): Table dialog doesn't populate width correctly.
+* [#8675](http://dev.ckeditor.com/ticket/8675): Deleting cells in nested table removes outer table cell.
+* [#9815](http://dev.ckeditor.com/ticket/9815): Can't edit dialog fields on editor initialized in jQuery UI modal dialog.
+* [#8888](http://dev.ckeditor.com/ticket/8888): CKEditor dialogs do not show completely in small window.
+* [#9360](http://dev.ckeditor.com/ticket/9360): [Inline editor] Blocks shown for a div stay permanently even after user exists editing the div.
+* [#9531](http://dev.ckeditor.com/ticket/9531): [Firefox & Inline editor] Toolbar is lost when closing format combo by clicking on its button.
+* [#9553](http://dev.ckeditor.com/ticket/9553): Table width incorrectly set when `border-width` style is specified.
+* [#9594](http://dev.ckeditor.com/ticket/9594): Cannot tab past CKEditor when it is in read only mode.
+* [#9658](http://dev.ckeditor.com/ticket/9658): [IE9] Justify not working on selected image.
+* [#9686](http://dev.ckeditor.com/ticket/9686): Added missing contents styles for `
`.
+* [#9709](http://dev.ckeditor.com/ticket/9709): PasteFromWord should not depend on configuration from other styles.
+* [#9726](http://dev.ckeditor.com/ticket/9726): Removed color dialog dependency from table tools.
+* [#9765](http://dev.ckeditor.com/ticket/9765): Toolbar Collapse command documented incorrectly on Accessibility Instructions dialog.
+* [#9771](http://dev.ckeditor.com/ticket/9771): [Webkit & Opera] Fixed scrolling issues when pasting.
+* [#9787](http://dev.ckeditor.com/ticket/9787): [IE9] onChange isn't fired for checkboxes in dialogs.
+* [#9842](http://dev.ckeditor.com/ticket/9842): [Firefox 17] When we open toolbar menu for the first time & press down arrow key, focus goes to next toolbar button instead of menu options.
+* [#9847](http://dev.ckeditor.com/ticket/9847): Elements path shouldn't be initialized on inline editor.
+* [#9853](http://dev.ckeditor.com/ticket/9853): `Editor#addRemoveFormatFilter` is exposed before it really works.
+* [#8893](http://dev.ckeditor.com/ticket/8893): Value of `pasteFromWordCleanupFile` config is now taken from instance configuration.
+* [#9693](http://dev.ckeditor.com/ticket/9693): Removed "live preview" checkbox from UI color picker.
+
+
+## CKEditor 4.0
+
+The first stable release of the new CKEditor 4 code line.
+
+The CKEditor JavaScript API has been kept compatible with CKEditor 4, whenever
+possible. The list of relevant changes can be found in the [API Changes page of
+the CKEditor 4 documentation][1].
+
+[1]: http://docs.ckeditor.com/#!/guide/dev_api_changes "API Changes""
\ No newline at end of file
diff --git a/lib/ckeditor/INSTALL.html b/lib/ckeditor/INSTALL.html
deleted file mode 100644
index 8cf37f9..0000000
--- a/lib/ckeditor/INSTALL.html
+++ /dev/null
@@ -1,92 +0,0 @@
-
-
-
-
- Installation Guide - CKEditor
-
-
-
-
-
- CKEditor Installation Guide
-
- What's CKEditor?
-
- CKEditor is a text editor to be used inside web pages. It's not a replacement
- for desktop text editors like Word or OpenOffice, but a component to be used as
- part of web applications and web sites.
-
- Installation
-
- Installing CKEditor is an easy task. Just follow these simple steps:
-
-
Download the latest version of the editor from our web site: http://ckeditor.com. You should have already completed
- this step, but be sure you have the very latest version.
-
Extract (decompress) the downloaded file into the root of your
- web site.
-
-
- Note: CKEditor is by default installed in the "ckeditor"
- folder. You can place the files in whichever you want though.
-
- Checking Your Installation
-
-
- The editor comes with a few sample pages that can be used to verify that installation
- proceeded properly. Take a look at the _samples directory.
-
- To test your installation, just call the following page at your web site:
- You are not required to, but if you want to explicitly declare the license you have
- chosen to be bound to when using, reproducing, modifying and distributing this software,
- just include a text file titled "LEGAL" in your version of this software, indicating
- your license choice. In any case, your choice will not restrict any recipient of
- your version of this software to use, reproduce, modify and distribute this software
- under any of the above licenses.
-
-
- Sources of Intellectual Property Included in CKEditor
-
-
- Where not otherwise indicated, all CKEditor content is authored by CKSource engineers
- and consists of CKSource-owned intellectual property. In some specific instances,
- CKEditor will incorporate work done by developers outside of CKSource with their
- express permission.
-
- CKEditor is a trademark of CKSource - Frederico Knabben. All other brand and product
- names are trademarks, registered trademarks or service marks of their respective
- holders.
-
-
-
+Software License Agreement
+==========================
+
+CKEditor - The text editor for Internet - http://ckeditor.com
+Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
+
+Licensed under the terms of any of the following licenses at your
+choice:
+
+ - GNU General Public License Version 2 or later (the "GPL")
+ http://www.gnu.org/licenses/gpl.html
+ (See Appendix A)
+
+ - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
+ http://www.gnu.org/licenses/lgpl.html
+ (See Appendix B)
+
+ - Mozilla Public License Version 1.1 or later (the "MPL")
+ http://www.mozilla.org/MPL/MPL-1.1.html
+ (See Appendix C)
+
+You are not required to, but if you want to explicitly declare the
+license you have chosen to be bound to when using, reproducing,
+modifying and distributing this software, just include a text file
+titled "legal.txt" in your version of this software, indicating your
+license choice. In any case, your choice will not restrict any
+recipient of your version of this software to use, reproduce, modify
+and distribute this software under any of the above licenses.
+
+Sources of Intellectual Property Included in CKEditor
+-----------------------------------------------------
+
+Where not otherwise indicated, all CKEditor content is authored by
+CKSource engineers and consists of CKSource-owned intellectual
+property. In some specific instances, CKEditor will incorporate work
+done by developers outside of CKSource with their express permission.
+
+Trademarks
+----------
+
+CKEditor is a trademark of CKSource - Frederico Knabben. All other brand
+and product names are trademarks, registered trademarks or service
+marks of their respective holders.
+
+---
+
+Appendix A: The GPL License
+---------------------------
+
+GNU GENERAL PUBLIC LICENSE
+Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software-to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+GNU GENERAL PUBLIC LICENSE
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+
+Appendix B: The LGPL License
+----------------------------
+
+GNU LESSER GENERAL PUBLIC LICENSE
+Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software-to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages-typically libraries-of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+GNU LESSER GENERAL PUBLIC LICENSE
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+
+Appendix C: The MPL License
+---------------------------
+
+MOZILLA PUBLIC LICENSE
+Version 1.1
+
+1. Definitions.
+
+ 1.0.1. "Commercial Use" means distribution or otherwise making the
+ Covered Code available to a third party.
+
+ 1.1. "Contributor" means each entity that creates or contributes to
+ the creation of Modifications.
+
+ 1.2. "Contributor Version" means the combination of the Original
+ Code, prior Modifications used by a Contributor, and the Modifications
+ made by that particular Contributor.
+
+ 1.3. "Covered Code" means the Original Code or Modifications or the
+ combination of the Original Code and Modifications, in each case
+ including portions thereof.
+
+ 1.4. "Electronic Distribution Mechanism" means a mechanism generally
+ accepted in the software development community for the electronic
+ transfer of data.
+
+ 1.5. "Executable" means Covered Code in any form other than Source
+ Code.
+
+ 1.6. "Initial Developer" means the individual or entity identified
+ as the Initial Developer in the Source Code notice required by Exhibit
+ A.
+
+ 1.7. "Larger Work" means a work which combines Covered Code or
+ portions thereof with code not governed by the terms of this License.
+
+ 1.8. "License" means this document.
+
+ 1.8.1. "Licensable" means having the right to grant, to the maximum
+ extent possible, whether at the time of the initial grant or
+ subsequently acquired, any and all of the rights conveyed herein.
+
+ 1.9. "Modifications" means any addition to or deletion from the
+ substance or structure of either the Original Code or any previous
+ Modifications. When Covered Code is released as a series of files, a
+ Modification is:
+ A. Any addition to or deletion from the contents of a file
+ containing Original Code or previous Modifications.
+
+ B. Any new file that contains any part of the Original Code or
+ previous Modifications.
+
+ 1.10. "Original Code" means Source Code of computer software code
+ which is described in the Source Code notice required by Exhibit A as
+ Original Code, and which, at the time of its release under this
+ License is not already Covered Code governed by this License.
+
+ 1.10.1. "Patent Claims" means any patent claim(s), now owned or
+ hereafter acquired, including without limitation, method, process,
+ and apparatus claims, in any patent Licensable by grantor.
+
+ 1.11. "Source Code" means the preferred form of the Covered Code for
+ making modifications to it, including all modules it contains, plus
+ any associated interface definition files, scripts used to control
+ compilation and installation of an Executable, or source code
+ differential comparisons against either the Original Code or another
+ well known, available Covered Code of the Contributor's choice. The
+ Source Code can be in a compressed or archival form, provided the
+ appropriate decompression or de-archiving software is widely available
+ for no charge.
+
+ 1.12. "You" (or "Your") means an individual or a legal entity
+ exercising rights under, and complying with all of the terms of, this
+ License or a future version of this License issued under Section 6.1.
+ For legal entities, "You" includes any entity which controls, is
+ controlled by, or is under common control with You. For purposes of
+ this definition, "control" means (a) the power, direct or indirect,
+ to cause the direction or management of such entity, whether by
+ contract or otherwise, or (b) ownership of more than fifty percent
+ (50%) of the outstanding shares or beneficial ownership of such
+ entity.
+
+2. Source Code License.
+
+ 2.1. The Initial Developer Grant.
+ The Initial Developer hereby grants You a world-wide, royalty-free,
+ non-exclusive license, subject to third party intellectual property
+ claims:
+ (a) under intellectual property rights (other than patent or
+ trademark) Licensable by Initial Developer to use, reproduce,
+ modify, display, perform, sublicense and distribute the Original
+ Code (or portions thereof) with or without Modifications, and/or
+ as part of a Larger Work; and
+
+ (b) under Patents Claims infringed by the making, using or
+ selling of Original Code, to make, have made, use, practice,
+ sell, and offer for sale, and/or otherwise dispose of the
+ Original Code (or portions thereof).
+
+ (c) the licenses granted in this Section 2.1(a) and (b) are
+ effective on the date Initial Developer first distributes
+ Original Code under the terms of this License.
+
+ (d) Notwithstanding Section 2.1(b) above, no patent license is
+ granted: 1) for code that You delete from the Original Code; 2)
+ separate from the Original Code; or 3) for infringements caused
+ by: i) the modification of the Original Code or ii) the
+ combination of the Original Code with other software or devices.
+
+ 2.2. Contributor Grant.
+ Subject to third party intellectual property claims, each Contributor
+ hereby grants You a world-wide, royalty-free, non-exclusive license
+
+ (a) under intellectual property rights (other than patent or
+ trademark) Licensable by Contributor, to use, reproduce, modify,
+ display, perform, sublicense and distribute the Modifications
+ created by such Contributor (or portions thereof) either on an
+ unmodified basis, with other Modifications, as Covered Code
+ and/or as part of a Larger Work; and
+
+ (b) under Patent Claims infringed by the making, using, or
+ selling of Modifications made by that Contributor either alone
+ and/or in combination with its Contributor Version (or portions
+ of such combination), to make, use, sell, offer for sale, have
+ made, and/or otherwise dispose of: 1) Modifications made by that
+ Contributor (or portions thereof); and 2) the combination of
+ Modifications made by that Contributor with its Contributor
+ Version (or portions of such combination).
+
+ (c) the licenses granted in Sections 2.2(a) and 2.2(b) are
+ effective on the date Contributor first makes Commercial Use of
+ the Covered Code.
+
+ (d) Notwithstanding Section 2.2(b) above, no patent license is
+ granted: 1) for any code that Contributor has deleted from the
+ Contributor Version; 2) separate from the Contributor Version;
+ 3) for infringements caused by: i) third party modifications of
+ Contributor Version or ii) the combination of Modifications made
+ by that Contributor with other software (except as part of the
+ Contributor Version) or other devices; or 4) under Patent Claims
+ infringed by Covered Code in the absence of Modifications made by
+ that Contributor.
+
+3. Distribution Obligations.
+
+ 3.1. Application of License.
+ The Modifications which You create or to which You contribute are
+ governed by the terms of this License, including without limitation
+ Section 2.2. The Source Code version of Covered Code may be
+ distributed only under the terms of this License or a future version
+ of this License released under Section 6.1, and You must include a
+ copy of this License with every copy of the Source Code You
+ distribute. You may not offer or impose any terms on any Source Code
+ version that alters or restricts the applicable version of this
+ License or the recipients' rights hereunder. However, You may include
+ an additional document offering the additional rights described in
+ Section 3.5.
+
+ 3.2. Availability of Source Code.
+ Any Modification which You create or to which You contribute must be
+ made available in Source Code form under the terms of this License
+ either on the same media as an Executable version or via an accepted
+ Electronic Distribution Mechanism to anyone to whom you made an
+ Executable version available; and if made available via Electronic
+ Distribution Mechanism, must remain available for at least twelve (12)
+ months after the date it initially became available, or at least six
+ (6) months after a subsequent version of that particular Modification
+ has been made available to such recipients. You are responsible for
+ ensuring that the Source Code version remains available even if the
+ Electronic Distribution Mechanism is maintained by a third party.
+
+ 3.3. Description of Modifications.
+ You must cause all Covered Code to which You contribute to contain a
+ file documenting the changes You made to create that Covered Code and
+ the date of any change. You must include a prominent statement that
+ the Modification is derived, directly or indirectly, from Original
+ Code provided by the Initial Developer and including the name of the
+ Initial Developer in (a) the Source Code, and (b) in any notice in an
+ Executable version or related documentation in which You describe the
+ origin or ownership of the Covered Code.
+
+ 3.4. Intellectual Property Matters
+ (a) Third Party Claims.
+ If Contributor has knowledge that a license under a third party's
+ intellectual property rights is required to exercise the rights
+ granted by such Contributor under Sections 2.1 or 2.2,
+ Contributor must include a text file with the Source Code
+ distribution titled "LEGAL" which describes the claim and the
+ party making the claim in sufficient detail that a recipient will
+ know whom to contact. If Contributor obtains such knowledge after
+ the Modification is made available as described in Section 3.2,
+ Contributor shall promptly modify the LEGAL file in all copies
+ Contributor makes available thereafter and shall take other steps
+ (such as notifying appropriate mailing lists or newsgroups)
+ reasonably calculated to inform those who received the Covered
+ Code that new knowledge has been obtained.
+
+ (b) Contributor APIs.
+ If Contributor's Modifications include an application programming
+ interface and Contributor has knowledge of patent licenses which
+ are reasonably necessary to implement that API, Contributor must
+ also include this information in the LEGAL file.
+
+ (c) Representations.
+ Contributor represents that, except as disclosed pursuant to
+ Section 3.4(a) above, Contributor believes that Contributor's
+ Modifications are Contributor's original creation(s) and/or
+ Contributor has sufficient rights to grant the rights conveyed by
+ this License.
+
+ 3.5. Required Notices.
+ You must duplicate the notice in Exhibit A in each file of the Source
+ Code. If it is not possible to put such notice in a particular Source
+ Code file due to its structure, then You must include such notice in a
+ location (such as a relevant directory) where a user would be likely
+ to look for such a notice. If You created one or more Modification(s)
+ You may add your name as a Contributor to the notice described in
+ Exhibit A. You must also duplicate this License in any documentation
+ for the Source Code where You describe recipients' rights or ownership
+ rights relating to Covered Code. You may choose to offer, and to
+ charge a fee for, warranty, support, indemnity or liability
+ obligations to one or more recipients of Covered Code. However, You
+ may do so only on Your own behalf, and not on behalf of the Initial
+ Developer or any Contributor. You must make it absolutely clear than
+ any such warranty, support, indemnity or liability obligation is
+ offered by You alone, and You hereby agree to indemnify the Initial
+ Developer and every Contributor for any liability incurred by the
+ Initial Developer or such Contributor as a result of warranty,
+ support, indemnity or liability terms You offer.
+
+ 3.6. Distribution of Executable Versions.
+ You may distribute Covered Code in Executable form only if the
+ requirements of Section 3.1-3.5 have been met for that Covered Code,
+ and if You include a notice stating that the Source Code version of
+ the Covered Code is available under the terms of this License,
+ including a description of how and where You have fulfilled the
+ obligations of Section 3.2. The notice must be conspicuously included
+ in any notice in an Executable version, related documentation or
+ collateral in which You describe recipients' rights relating to the
+ Covered Code. You may distribute the Executable version of Covered
+ Code or ownership rights under a license of Your choice, which may
+ contain terms different from this License, provided that You are in
+ compliance with the terms of this License and that the license for the
+ Executable version does not attempt to limit or alter the recipient's
+ rights in the Source Code version from the rights set forth in this
+ License. If You distribute the Executable version under a different
+ license You must make it absolutely clear that any terms which differ
+ from this License are offered by You alone, not by the Initial
+ Developer or any Contributor. You hereby agree to indemnify the
+ Initial Developer and every Contributor for any liability incurred by
+ the Initial Developer or such Contributor as a result of any such
+ terms You offer.
+
+ 3.7. Larger Works.
+ You may create a Larger Work by combining Covered Code with other code
+ not governed by the terms of this License and distribute the Larger
+ Work as a single product. In such a case, You must make sure the
+ requirements of this License are fulfilled for the Covered Code.
+
+4. Inability to Comply Due to Statute or Regulation.
+
+ If it is impossible for You to comply with any of the terms of this
+ License with respect to some or all of the Covered Code due to
+ statute, judicial order, or regulation then You must: (a) comply with
+ the terms of this License to the maximum extent possible; and (b)
+ describe the limitations and the code they affect. Such description
+ must be included in the LEGAL file described in Section 3.4 and must
+ be included with all distributions of the Source Code. Except to the
+ extent prohibited by statute or regulation, such description must be
+ sufficiently detailed for a recipient of ordinary skill to be able to
+ understand it.
+
+5. Application of this License.
+
+ This License applies to code to which the Initial Developer has
+ attached the notice in Exhibit A and to related Covered Code.
+
+6. Versions of the License.
+
+ 6.1. New Versions.
+ Netscape Communications Corporation ("Netscape") may publish revised
+ and/or new versions of the License from time to time. Each version
+ will be given a distinguishing version number.
+
+ 6.2. Effect of New Versions.
+ Once Covered Code has been published under a particular version of the
+ License, You may always continue to use it under the terms of that
+ version. You may also choose to use such Covered Code under the terms
+ of any subsequent version of the License published by Netscape. No one
+ other than Netscape has the right to modify the terms applicable to
+ Covered Code created under this License.
+
+ 6.3. Derivative Works.
+ If You create or use a modified version of this License (which you may
+ only do in order to apply it to code which is not already Covered Code
+ governed by this License), You must (a) rename Your license so that
+ the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
+ "MPL", "NPL" or any confusingly similar phrase do not appear in your
+ license (except to note that your license differs from this License)
+ and (b) otherwise make it clear that Your version of the license
+ contains terms which differ from the Mozilla Public License and
+ Netscape Public License. (Filling in the name of the Initial
+ Developer, Original Code or Contributor in the notice described in
+ Exhibit A shall not of themselves be deemed to be modifications of
+ this License.)
+
+7. DISCLAIMER OF WARRANTY.
+
+ COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
+ DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
+ THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
+ IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
+ YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
+ COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
+ OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+8. TERMINATION.
+
+ 8.1. This License and the rights granted hereunder will terminate
+ automatically if You fail to comply with terms herein and fail to cure
+ such breach within 30 days of becoming aware of the breach. All
+ sublicenses to the Covered Code which are properly granted shall
+ survive any termination of this License. Provisions which, by their
+ nature, must remain in effect beyond the termination of this License
+ shall survive.
+
+ 8.2. If You initiate litigation by asserting a patent infringement
+ claim (excluding declatory judgment actions) against Initial Developer
+ or a Contributor (the Initial Developer or Contributor against whom
+ You file such action is referred to as "Participant") alleging that:
+
+ (a) such Participant's Contributor Version directly or indirectly
+ infringes any patent, then any and all rights granted by such
+ Participant to You under Sections 2.1 and/or 2.2 of this License
+ shall, upon 60 days notice from Participant terminate prospectively,
+ unless if within 60 days after receipt of notice You either: (i)
+ agree in writing to pay Participant a mutually agreeable reasonable
+ royalty for Your past and future use of Modifications made by such
+ Participant, or (ii) withdraw Your litigation claim with respect to
+ the Contributor Version against such Participant. If within 60 days
+ of notice, a reasonable royalty and payment arrangement are not
+ mutually agreed upon in writing by the parties or the litigation claim
+ is not withdrawn, the rights granted by Participant to You under
+ Sections 2.1 and/or 2.2 automatically terminate at the expiration of
+ the 60 day notice period specified above.
+
+ (b) any software, hardware, or device, other than such Participant's
+ Contributor Version, directly or indirectly infringes any patent, then
+ any rights granted to You by such Participant under Sections 2.1(b)
+ and 2.2(b) are revoked effective as of the date You first made, used,
+ sold, distributed, or had made, Modifications made by that
+ Participant.
+
+ 8.3. If You assert a patent infringement claim against Participant
+ alleging that such Participant's Contributor Version directly or
+ indirectly infringes any patent where such claim is resolved (such as
+ by license or settlement) prior to the initiation of patent
+ infringement litigation, then the reasonable value of the licenses
+ granted by such Participant under Sections 2.1 or 2.2 shall be taken
+ into account in determining the amount or value of any payment or
+ license.
+
+ 8.4. In the event of termination under Sections 8.1 or 8.2 above,
+ all end user license agreements (excluding distributors and resellers)
+ which have been validly granted by You or any distributor hereunder
+ prior to termination shall survive termination.
+
+9. LIMITATION OF LIABILITY.
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+ (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
+ DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
+ OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
+ ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
+ CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
+ WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+ COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+ INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+ LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
+ RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
+ PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
+ EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
+ THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
+
+10. U.S. GOVERNMENT END USERS.
+
+ The Covered Code is a "commercial item," as that term is defined in
+ 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
+ software" and "commercial computer software documentation," as such
+ terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
+ C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
+ all U.S. Government End Users acquire Covered Code with only those
+ rights set forth herein.
+
+11. MISCELLANEOUS.
+
+ This License represents the complete agreement concerning subject
+ matter hereof. If any provision of this License is held to be
+ unenforceable, such provision shall be reformed only to the extent
+ necessary to make it enforceable. This License shall be governed by
+ California law provisions (except to the extent applicable law, if
+ any, provides otherwise), excluding its conflict-of-law provisions.
+ With respect to disputes in which at least one party is a citizen of,
+ or an entity chartered or registered to do business in the United
+ States of America, any litigation relating to this License shall be
+ subject to the jurisdiction of the Federal Courts of the Northern
+ District of California, with venue lying in Santa Clara County,
+ California, with the losing party responsible for costs, including
+ without limitation, court costs and reasonable attorneys' fees and
+ expenses. The application of the United Nations Convention on
+ Contracts for the International Sale of Goods is expressly excluded.
+ Any law or regulation which provides that the language of a contract
+ shall be construed against the drafter shall not apply to this
+ License.
+
+12. RESPONSIBILITY FOR CLAIMS.
+
+ As between Initial Developer and the Contributors, each party is
+ responsible for claims and damages arising, directly or indirectly,
+ out of its utilization of rights under this License and You agree to
+ work with Initial Developer and Contributors to distribute such
+ responsibility on an equitable basis. Nothing herein is intended or
+ shall be deemed to constitute any admission of liability.
+
+13. MULTIPLE-LICENSED CODE.
+
+ Initial Developer may designate portions of the Covered Code as
+ "Multiple-Licensed". "Multiple-Licensed" means that the Initial
+ Developer permits you to utilize portions of the Covered Code under
+ Your choice of the NPL or the alternative licenses, if any, specified
+ by the Initial Developer in the file described in Exhibit A.
+
+EXHIBIT A -Mozilla Public License.
+
+ ``The contents of this file are subject to the Mozilla Public License
+ Version 1.1 (the "License"); you may not use this file except in
+ compliance with the License. You may obtain a copy of the License at
+ http://www.mozilla.org/MPL/
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ License for the specific language governing rights and limitations
+ under the License.
+
+ The Original Code is ______________________________________.
+
+ The Initial Developer of the Original Code is ________________________.
+ Portions created by ______________________ are Copyright (C) ______
+ _______________________. All Rights Reserved.
+
+ Contributor(s): ______________________________________.
+
+ Alternatively, the contents of this file may be used under the terms
+ of the _____ license (the "[___] License"), in which case the
+ provisions of [______] License are applicable instead of those
+ above. If you wish to allow use of your version of this file only
+ under the terms of the [____] License and not to allow others to use
+ your version of this file under the MPL, indicate your decision by
+ deleting the provisions above and replace them with the notice and
+ other provisions required by the [___] License. If you do not delete
+ the provisions above, a recipient may use your version of this file
+ under either the MPL or the [___] License."
+
+ [NOTE: The text of this Exhibit A may differ slightly from the text of
+ the notices in the Source Code files of the Original Code. You should
+ use the text of this Exhibit A rather than the text found in the
+ Original Code Source Code for Your Modifications.]
diff --git a/lib/ckeditor/README.md b/lib/ckeditor/README.md
new file mode 100644
index 0000000..378c267
--- /dev/null
+++ b/lib/ckeditor/README.md
@@ -0,0 +1,39 @@
+CKEditor 4
+==========
+
+Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
+http://ckeditor.com - See LICENSE.md for license information.
+
+CKEditor is a text editor to be used inside web pages. It's not a replacement
+for desktop text editors like Word or OpenOffice, but a component to be used as
+part of web applications and websites.
+
+## Documentation
+
+The full editor documentation is available online at the following address:
+http://docs.ckeditor.com
+
+## Installation
+
+Installing CKEditor is an easy task. Just follow these simple steps:
+
+ 1. **Download** the latest version from the CKEditor website:
+ http://ckeditor.com. You should have already completed this step, but be
+ sure you have the very latest version.
+ 2. **Extract** (decompress) the downloaded file into the root of your website.
+
+**Note:** CKEditor is by default installed in the `ckeditor` folder. You can
+place the files in whichever you want though.
+
+## Checking Your Installation
+
+The editor comes with a few sample pages that can be used to verify that
+installation proceeded properly. Take a look at the `samples` directory.
+
+To test your installation, just call the following page at your website:
+
+ http:////samples/index.html
+
+For example:
+
+ http://www.example.com/ckeditor/samples/index.html
diff --git a/lib/ckeditor/_samples/ajax.html b/lib/ckeditor/_samples/ajax.html
deleted file mode 100644
index 153e546..0000000
--- a/lib/ckeditor/_samples/ajax.html
+++ /dev/null
@@ -1,87 +0,0 @@
-
-
-
-
- Ajax - CKEditor Sample
-
-
-
-
-
-
-
-
- This sample shows how to use the dialog API to customize dialogs whithout changing
- the original editor code. The following customizations are being done::
-
-
Add dialog pages ("My Tab" in the Link dialog).
-
Remove a dialog tab ("Target" tab from the Link dialog).
-
Add dialog fields ("My Custom Field" into the Link dialog).
-
Remove dialog fields ("Link Type" and "Browser Server" the Link
- dialog).
-
Set default values for dialog fields (for the "URL" field in the
- Link dialog).
-
Create a custom dialog ("My Dialog" button).
-
-
-
-
-
-
diff --git a/lib/ckeditor/_samples/api_dialog/my_dialog.js b/lib/ckeditor/_samples/api_dialog/my_dialog.js
deleted file mode 100644
index 02f412f..0000000
--- a/lib/ckeditor/_samples/api_dialog/my_dialog.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-CKEDITOR.dialog.add( 'myDialog', function( editor )
-{
- return {
- title : 'My Dialog',
- minWidth : 400,
- minHeight : 200,
- contents : [
- {
- id : 'tab1',
- label : 'First Tab',
- title : 'First Tab',
- elements :
- [
- {
- id : 'input1',
- type : 'text',
- label : 'Input 1'
- }
- ]
- }
- ]
- };
-} );
diff --git a/lib/ckeditor/_samples/asp/advanced.asp b/lib/ckeditor/_samples/asp/advanced.asp
deleted file mode 100644
index dfb94d5..0000000
--- a/lib/ckeditor/_samples/asp/advanced.asp
+++ /dev/null
@@ -1,105 +0,0 @@
-<%@ codepage="65001" language="VBScript" %>
-<% Option Explicit %>
-
-<%
-
- ' You must set "Enable Parent Paths" on your web site
- ' in order for the above relative include to work.
- ' Or you can use #INCLUDE VIRTUAL="/full path/ckeditor.asp"
-
-%>
-
-
-
-
- Sample - CKEditor
-
-
-
-
-
- CKEditor Sample
-
-
-
-
-
-
-
-
-
-
diff --git a/lib/ckeditor/_samples/asp/events.asp b/lib/ckeditor/_samples/asp/events.asp
deleted file mode 100644
index 5391cef..0000000
--- a/lib/ckeditor/_samples/asp/events.asp
+++ /dev/null
@@ -1,136 +0,0 @@
-<%@ codepage="65001" language="VBScript" %>
-<% Option Explicit %>
-
-<%
-
- ' You must set "Enable Parent Paths" on your web site
- ' in order for the above relative include to work.
- ' Or you can use #INCLUDE VIRTUAL="/full path/ckeditor.asp"
-
-%>
-
-
-
-
- Sample - CKEditor
-
-
-
-
-
The ckeditor.asp file provides a wrapper to ease the work of creating CKEditor instances from classic Asp.
-
To use it, you must first include it into your page:
-
- <!-- #INCLUDE file="../../ckeditor.asp" -->
-
- Of course, you should adjust the path to make it point to the correct location, and maybe use a full path (with virtual="" instead of file="")
-
-
After that script is included, you can use it in different ways, based on the following pattern:
-
-
-
- Create an instance of the CKEditor class:
-
dim editor
-set editor = New CKEditor
-
-
- Set the path to the folder where CKEditor has been installed, by default it will use /ckeditor/
-
editor.basePath = "../../"
-
-
- Now use one of the three main methods to create the CKEditor instances:
-
-
- Replace textarea with id (or name) "editor1".
-
editor.replaceInstance "editor1"
-
-
- Replace all textareas with CKEditor.
-
editor.replaceAll empty
-
-
- Create a textarea element and attach CKEditor to it.
-
editor.editor "editor1", initialValue
-
-
-
-
-
Before step 3 you can use a number of methods and properties to adjust the behavior of this class and the CKEditor instances
-that will be created:
-
-
returnOutput : if set to true, the functions won't dump the code with response.write, but instead they will return it so
- you can do anything you want
-
basePath: location of the CKEditor scripts
-
initialized: if you set it to true, it means that you have already included the CKEditor.js file into the page and it
- doesn't have to be generated again.
-
textareaAttributes: You can set here a Dictionary object with the attributes that you want to output in the call to the "editor" method.
-
-
config: Allows to set config values for all the instances from now on.
-
instanceConfig: Allows to set config values just for the next instance.
-
-
addEventHandler: Adds an event handler for all the instances from now on.
-
addInstanceEventHandler: Adds an event handler just for the next instance.
-
addGlobalEventHandler: Adds an event handler for the global CKEDITOR object.
-
-
clearEventHandlers: Removes one or all the event handlers from all the instances from now on.
-
clearInstanceEventHandlers: Removes one or all the event handlers from the next instance.
-
clearGlobalEventHandlers: Removes one or all the event handlers from the global CKEDITOR object.
-
-
-
diff --git a/lib/ckeditor/_samples/asp/replace.asp b/lib/ckeditor/_samples/asp/replace.asp
deleted file mode 100644
index d89e0bf..0000000
--- a/lib/ckeditor/_samples/asp/replace.asp
+++ /dev/null
@@ -1,72 +0,0 @@
-<%@ codepage="65001" language="VBScript" %>
-<% Option Explicit %>
-
-<%
-
- ' You must set "Enable Parent Paths" on your web site
- ' in order for the above relative include to work.
- ' Or you can use #INCLUDE VIRTUAL="/full path/ckeditor.asp"
-
-%>
-
-
-
-
- Sample - CKEditor
-
-
-
-
-
- CKEditor Sample
-
-
-
-
-
-
-
-
- <%
- ' Create class instance.
- dim editor
- set editor = New CKEditor
- ' Path to CKEditor directory, ideally instead of relative dir, use an absolute path:
- ' editor.basePath = "/ckeditor/"
- ' If not set, CKEditor will default to /ckeditor/
- editor.basePath = "../../"
- ' Replace textarea with id (or name) "editor1".
- editor.replaceInstance "editor1"
- %>
-
-
diff --git a/lib/ckeditor/_samples/asp/replaceall.asp b/lib/ckeditor/_samples/asp/replaceall.asp
deleted file mode 100644
index d1187ed..0000000
--- a/lib/ckeditor/_samples/asp/replaceall.asp
+++ /dev/null
@@ -1,77 +0,0 @@
-<%@ codepage="65001" language="VBScript" %>
-<% Option Explicit %>
-
-<%
-
- ' You must set "Enable Parent Paths" on your web site
- ' in order for the above relative include to work.
- ' Or you can use #INCLUDE VIRTUAL="/full path/ckeditor.asp"
-
-%>
-
-
-
-
- Sample - CKEditor
-
-
-
-
-
- CKEditor Sample
-
-
-
-
-
-
-
-
- <%
- ' Create class instance.
- dim editor
- set editor = New CKEditor
- ' Path to CKEditor directory, ideally instead of relative dir, use an absolute path:
- ' editor.basePath = "/ckeditor/"
- ' If not set, CKEditor will default to /ckeditor/
- editor.basePath = "../../"
- ' Replace all textareas with CKEditor.
- editor.replaceAll empty
- %>
-
-
diff --git a/lib/ckeditor/_samples/asp/sample_posteddata.asp b/lib/ckeditor/_samples/asp/sample_posteddata.asp
deleted file mode 100644
index 3b45181..0000000
--- a/lib/ckeditor/_samples/asp/sample_posteddata.asp
+++ /dev/null
@@ -1,46 +0,0 @@
-<%@ codepage="65001" language="VBScript" %>
-<% Option Explicit %>
-
-
-
-
- Sample - CKEditor
-
-
-
-
-
- CKEditor - Posted Data
-
-
-
-
-
-
Field Name
-
Value
-
-
- <%
- Dim sForm
- For Each sForm in Request.Form
- %>
-
-
<%=Server.HTMLEncode( sForm )%>
-
<%=Server.HTMLEncode( Request.Form(sForm) )%>
-
- <% Next %>
-
-
-
-
diff --git a/lib/ckeditor/_samples/asp/standalone.asp b/lib/ckeditor/_samples/asp/standalone.asp
deleted file mode 100644
index 02cda38..0000000
--- a/lib/ckeditor/_samples/asp/standalone.asp
+++ /dev/null
@@ -1,72 +0,0 @@
-<%@ codepage="65001" language="VBScript" %>
-<% Option Explicit %>
-
-<%
-
- ' You must set "Enable Parent Paths" on your web site
- ' in order for the above relative include to work.
- ' Or you can use #INCLUDE VIRTUAL="/full path/ckeditor.asp"
-
-%>
-
-
-
-
- Sample - CKEditor
-
-
-
-
-
- Double-click on any of the following DIVs to transform them into editor instances.
-
-
- Part 1
-
- Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras et ipsum quis mi
- semper accumsan. Integer pretium dui id massa. Suspendisse in nisl sit amet urna
- rutrum imperdiet. Nulla eu tellus. Donec ante nisi, ullamcorper quis, fringilla
- nec, sagittis eleifend, pede. Nulla commodo interdum massa. Donec id metus. Fusce
- eu ipsum. Suspendisse auctor. Phasellus fermentum porttitor risus.
-
-
-
-
- Part 2
-
- Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras et ipsum quis mi
- semper accumsan. Integer pretium dui id massa. Suspendisse in nisl sit amet urna
- rutrum imperdiet. Nulla eu tellus. Donec ante nisi, ullamcorper quis, fringilla
- nec, sagittis eleifend, pede. Nulla commodo interdum massa. Donec id metus. Fusce
- eu ipsum. Suspendisse auctor. Phasellus fermentum porttitor risus.
-
-
- Donec velit. Mauris massa. Vestibulum non nulla. Nam suscipit arcu nec elit. Phasellus
- sollicitudin iaculis ante. Ut non mauris et sapien tincidunt adipiscing. Vestibulum
- vitae leo. Suspendisse nec mi tristique nulla laoreet vulputate.
-
-
-
-
- Part 3
-
- Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras et ipsum quis mi
- semper accumsan. Integer pretium dui id massa. Suspendisse in nisl sit amet urna
- rutrum imperdiet. Nulla eu tellus. Donec ante nisi, ullamcorper quis, fringilla
- nec, sagittis eleifend, pede. Nulla commodo interdum massa. Donec id metus. Fusce
- eu ipsum. Suspendisse auctor. Phasellus fermentum porttitor risus.
-
-
-
-
-
diff --git a/lib/ckeditor/_source/adapters/jquery.js b/lib/ckeditor/_source/adapters/jquery.js
deleted file mode 100644
index e633758..0000000
--- a/lib/ckeditor/_source/adapters/jquery.js
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
-Copyright (c) 2003-2010, 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
- *
- *
- *
- */
-
-(function()
-{
- /**
- * Allow CKEditor to override jQuery.fn.val(). This results in ability to use val()
- * function on textareas as usual and having those calls synchronized with CKEditor
- * Rich Text Editor component.
- *
- * This config option is global and executed during plugin load.
- * Can't be customized across editor instances.
- *
- * @type Boolean
- * @example
- * $( '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 ( !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;
- };
- });
- }
-})();
diff --git a/lib/ckeditor/_source/core/_bootstrap.js b/lib/ckeditor/_source/core/_bootstrap.js
deleted file mode 100644
index f351ce6..0000000
--- a/lib/ckeditor/_source/core/_bootstrap.js
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
-Copyright (c) 2003-2010, 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 is High Contrast is active by creating a temporary element with a
- // background image.
-
- var useSpacer = CKEDITOR.env.ie && CKEDITOR.env.version < 7,
- useBlank = CKEDITOR.env.ie && CKEDITOR.env.version == 7;
-
- var backgroundImageUrl = useSpacer ? ( CKEDITOR.basePath + 'images/spacer.gif' ) :
- useBlank ? 'about:blank' : 'data:image/png;base64,';
-
- var hcDetect = CKEDITOR.dom.element.createFromHtml(
- '', CKEDITOR.document );
-
- hcDetect.appendTo( CKEDITOR.document.getHead() );
-
- // Update CKEDITOR.env.
- // Catch exception needed sometimes for FF. (#4230)
- try
- {
- CKEDITOR.env.hc = ( hcDetect.getComputedStyle( 'background-image' ) == 'none' );
- }
- 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 ] );
- }
- });
-
-/*
-TODO: Enable the following and check if effective.
-
-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.
- }
-}
-*/
-
-/**
- * Fired when a CKEDITOR core object is fully loaded and ready for interaction.
- * @name CKEDITOR#loaded
- * @event
- */
diff --git a/lib/ckeditor/_source/core/ajax.js b/lib/ckeditor/_source/core/ajax.js
deleted file mode 100644
index 078c15a..0000000
--- a/lib/ckeditor/_source/core/ajax.js
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-/**
- * @fileOverview Defines the {@link CKEDITOR.ajax} object, which holds ajax methods for
- * data loading.
- */
-
-/**
- * Ajax methods for data loading.
- * @namespace
- * @example
- */
-CKEDITOR.ajax = (function()
-{
- var createXMLHttpRequest = function()
- {
- // In IE, using the native XMLHttpRequest for local files may throw
- // "Access is Denied" errors.
- if ( !CKEDITOR.env.ie || location.protocol != 'file:' )
- try { return new XMLHttpRequest(); } catch(e) {}
-
- try { return new ActiveXObject( 'Msxml2.XMLHTTP' ); } catch (e) {}
- try { return new ActiveXObject( 'Microsoft.XMLHTTP' ); } catch (e) {}
-
- return null;
- };
-
- var checkStatus = function( xhr )
- {
- // HTTP Status Codes:
- // 2xx : Success
- // 304 : Not Modified
- // 0 : Returned when running locally (file://)
- // 1223 : IE may change 204 to 1223 (see http://dev.jquery.com/ticket/1450)
-
- return ( xhr.readyState == 4 &&
- ( ( xhr.status >= 200 && xhr.status < 300 ) ||
- xhr.status == 304 ||
- xhr.status === 0 ||
- xhr.status == 1223 ) );
- };
-
- var getResponseText = function( xhr )
- {
- if ( checkStatus( xhr ) )
- return xhr.responseText;
- return null;
- };
-
- var getResponseXml = function( xhr )
- {
- if ( checkStatus( xhr ) )
- {
- var xml = xhr.responseXML;
- return new CKEDITOR.xml( xml && xml.firstChild ? xml : xhr.responseText );
- }
- return null;
- };
-
- var load = function( url, callback, getResponseFn )
- {
- var async = !!callback;
-
- var xhr = createXMLHttpRequest();
-
- if ( !xhr )
- return null;
-
- xhr.open( 'GET', url, async );
-
- if ( async )
- {
- // TODO: perform leak checks on this closure.
- /** @ignore */
- xhr.onreadystatechange = function()
- {
- if ( xhr.readyState == 4 )
- {
- callback( getResponseFn( xhr ) );
- xhr = null;
- }
- };
- }
-
- xhr.send(null);
-
- return async ? '' : getResponseFn( xhr );
- };
-
- return /** @lends CKEDITOR.ajax */ {
-
- /**
- * Loads data from an URL as plain text.
- * @param {String} url The URL from which load data.
- * @param {Function} [callback] A callback function to be called on
- * data load. If not provided, the data will be loaded
- * asynchronously, passing the data value the function on load.
- * @returns {String} The loaded data. For asynchronous requests, an
- * empty string. For invalid requests, null.
- * @example
- * // Load data synchronously.
- * var data = CKEDITOR.ajax.load( 'somedata.txt' );
- * alert( data );
- * @example
- * // Load data asynchronously.
- * var data = CKEDITOR.ajax.load( 'somedata.txt', function( data )
- * {
- * alert( data );
- * } );
- */
- load : function( url, callback )
- {
- return load( url, callback, getResponseText );
- },
-
- /**
- * Loads data from an URL as XML.
- * @param {String} url The URL from which load data.
- * @param {Function} [callback] A callback function to be called on
- * data load. If not provided, the data will be loaded
- * asynchronously, passing the data value the function on load.
- * @returns {CKEDITOR.xml} An XML object holding the loaded data. For asynchronous requests, an
- * empty string. For invalid requests, null.
- * @example
- * // Load XML synchronously.
- * var xml = CKEDITOR.ajax.loadXml( 'somedata.xml' );
- * alert( xml.getInnerXml( '//' ) );
- * @example
- * // Load XML asynchronously.
- * var data = CKEDITOR.ajax.loadXml( 'somedata.xml', function( xml )
- * {
- * alert( xml.getInnerXml( '//' ) );
- * } );
- */
- loadXml : function( url, callback )
- {
- return load( url, callback, getResponseXml );
- }
- };
-})();
diff --git a/lib/ckeditor/_source/core/ckeditor.js b/lib/ckeditor/_source/core/ckeditor.js
deleted file mode 100644
index 068da31..0000000
--- a/lib/ckeditor/_source/core/ckeditor.js
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
-Copyright (c) 2003-2010, 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( CKEDITOR.instances.editor1.name ); // "editor1"
- */
-CKEDITOR.instances = {};
-
-/**
- * The document of the window holding the CKEDITOR object.
- * @type {CKEDITOR.dom.document}
- * @example
- * alert( CKEDITOR.document.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 and editor instance from the global {@link CKEDITOR} object. his function
- * is available for internal use mainly.
- * @param {CKEDITOR.editor} editor The editor instance to be added.
- * @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;
-
-/**
- * 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
- */
diff --git a/lib/ckeditor/_source/core/ckeditor_base.js b/lib/ckeditor/_source/core/ckeditor_base.js
deleted file mode 100644
index 22c226e..0000000
--- a/lib/ckeditor/_source/core/ckeditor_base.js
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
-Copyright (c) 2003-2010, 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.3.1',rev:'5586',_:{},status:'unloaded',basePath:(function(){var d=window.CKEDITOR_BASEPATH||'';if(!d){var e=document.getElementsByTagName('script');for(var f=0;f=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.
-
-if ( !window.CKEDITOR )
-{
- /**
- * This is the API entry point. The entire CKEditor code runs under this object.
- * @name CKEDITOR
- * @namespace
- * @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, guaranteing 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, generated by the releaser.
- // (Base 36 value of each component of YYMMDDHH - 4 chars total - e.g. 87bm == 08071122)
- timestamp : 'A5AB4B6',
-
- /**
- * Contains the CKEditor version number.
- * @type String
- * @example
- * alert( CKEDITOR.version ); // e.g. 'CKEditor 3.0 Beta'
- */
- version : '3.3.1',
-
- /**
- * Contains the CKEditor revision number.
- * Revision number is incremented automatically after each modification of CKEditor source code.
- * @type String
- * @example
- * alert( CKEDITOR.revision ); // e.g. '3975'
- */
- revision : '5586',
-
- /**
- * Private object used to hold core stuff. It should not be used out of
- * the API code as properties defined here may change at any time
- * without notice.
- * @private
- */
- _ : {},
-
- /**
- * Indicates the API loading status. The following status are available:
- *
- *
unloaded: the API is not yet loaded.
- *
basic_loaded: the basic API features are available.
- *
basic_ready: the basic API is ready to load the full core code.
- *
loading: the full API is being loaded.
- *
ready: the API can be fully used.
- *
- * @type String
- * @example
- * if ( CKEDITOR.status == 'ready' )
- * {
- * // The API can now be fully used.
- * }
- */
- status : 'unloaded',
-
- /**
- * Contains the full URL for the CKEditor installation directory.
- * It's possible to manually provide the base path by setting a
- * global variable named CKEDITOR_BASEPATH. This global variable
- * must be set "before" the editor script loading.
- * @type String
- * @example
- * alert( CKEDITOR.basePath ); // "http://www.example.com/ckeditor/" (e.g.)
- */
- basePath : (function()
- {
- // ATTENTION: fixes on this code must be ported to
- // var basePath in "core/loader.js".
-
- // Find out the editor directory path, based on its ")' );
- }
- }
-
- return $ && new CKEDITOR.dom.document( $.contentWindow.document );
- },
-
- /**
- * Copy all the attributes from one node to the other, kinda like a clone
- * skipAttributes is an object with the attributes that must NOT be copied.
- * @param {CKEDITOR.dom.element} dest The destination element.
- * @param {Object} skipAttributes A dictionary of attributes to skip.
- * @example
- */
- copyAttributes : function( dest, skipAttributes )
- {
- var attributes = this.$.attributes;
- skipAttributes = skipAttributes || {};
-
- for ( var n = 0 ; n < attributes.length ; n++ )
- {
- var attribute = attributes[n];
-
- // Lowercase attribute name hard rule is broken for
- // some attribute on IE, e.g. CHECKED.
- var attrName = attribute.nodeName.toLowerCase(),
- attrValue;
-
- // We can set the type only once, so do it with the proper value, not copying it.
- if ( attrName in skipAttributes )
- continue;
-
- if ( attrName == 'checked' && ( attrValue = this.getAttribute( attrName ) ) )
- dest.setAttribute( attrName, attrValue );
- // IE BUG: value attribute is never specified even if it exists.
- else if ( attribute.specified ||
- ( CKEDITOR.env.ie && attribute.nodeValue && attrName == 'value' ) )
- {
- attrValue = this.getAttribute( attrName );
- if ( attrValue === null )
- attrValue = attribute.nodeValue;
-
- dest.setAttribute( attrName, attrValue );
- }
- }
-
- // The style:
- if ( this.$.style.cssText !== '' )
- dest.$.style.cssText = this.$.style.cssText;
- },
-
- /**
- * Changes the tag name of the current element.
- * @param {String} newTag The new tag for the element.
- */
- renameNode : function( newTag )
- {
- // If it's already correct exit here.
- if ( this.getName() == newTag )
- return;
-
- var doc = this.getDocument();
-
- // Create the new node.
- var newNode = new CKEDITOR.dom.element( newTag, doc );
-
- // Copy all attributes.
- this.copyAttributes( newNode );
-
- // Move children to the new node.
- this.moveChildren( newNode );
-
- // Replace the node.
- this.getParent() && this.$.parentNode.replaceChild( newNode.$, this.$ );
- newNode.$._cke_expando = this.$._cke_expando;
- this.$ = newNode.$;
- },
-
- /**
- * Gets a DOM tree descendant under the current node.
- * @param {Array|Number} indices The child index or array of child indices under the node.
- * @returns {CKEDITOR.dom.node} The specified DOM child under the current node. Null if child does not exist.
- * @example
- * var strong = p.getChild(0);
- */
- getChild : function( indices )
- {
- var rawNode = this.$;
-
- if ( !indices.slice )
- rawNode = rawNode.childNodes[ indices ];
- else
- {
- while ( indices.length > 0 && rawNode )
- rawNode = rawNode.childNodes[ indices.shift() ];
- }
-
- return rawNode ? new CKEDITOR.dom.node( rawNode ) : null;
- },
-
- getChildCount : function()
- {
- return this.$.childNodes.length;
- },
-
- disableContextMenu : function()
- {
- this.on( 'contextmenu', function( event )
- {
- // Cancel the browser context menu.
- if ( !event.data.getTarget().hasClass( 'cke_enable_context_menu' ) )
- event.data.preventDefault();
- } );
- }
- });
diff --git a/lib/ckeditor/_source/core/dom/elementpath.js b/lib/ckeditor/_source/core/dom/elementpath.js
deleted file mode 100644
index 3c74a92..0000000
--- a/lib/ckeditor/_source/core/dom/elementpath.js
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
-Copyright (c) 2003-2010, 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 };
-
- // 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,caption:1,form: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;
- };
-
- 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 ( CKEDITOR.env.ie && e.$.scopeName != 'HTML' )
- elementName = e.$.scopeName.toLowerCase() + ':' + elementName;
-
- 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;
- }
-};
diff --git a/lib/ckeditor/_source/core/dom/event.js b/lib/ckeditor/_source/core/dom/event.js
deleted file mode 100644
index cf7d66c..0000000
--- a/lib/ckeditor/_source/core/dom/event.js
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
-Copyright (c) 2003-2010, 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;
- }
-};
-
-/**
- * CTRL key (1000).
- * @constant
- * @example
- */
-CKEDITOR.CTRL = 1000;
-
-/**
- * SHIFT key (2000).
- * @constant
- * @example
- */
-CKEDITOR.SHIFT = 2000;
-
-/**
- * ALT key (4000).
- * @constant
- * @example
- */
-CKEDITOR.ALT = 4000;
diff --git a/lib/ckeditor/_source/core/dom/node.js b/lib/ckeditor/_source/core/dom/node.js
deleted file mode 100644
index 2ae3a13..0000000
--- a/lib/ckeditor/_source/core/dom/node.js
+++ /dev/null
@@ -1,662 +0,0 @@
-/*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-/**
- * @fileOverview Defines the {@link CKEDITOR.dom.node} class, which is the base
- * class for classes that represent DOM nodes.
- */
-
-/**
- * Base class for classes representing DOM nodes. This constructor may return
- * and instance of classes that inherits this class, like
- * {@link CKEDITOR.dom.element} or {@link CKEDITOR.dom.text}.
- * @augments CKEDITOR.dom.domObject
- * @param {Object} domNode A native DOM node.
- * @constructor
- * @see CKEDITOR.dom.element
- * @see CKEDITOR.dom.text
- * @example
- */
-CKEDITOR.dom.node = function( domNode )
-{
- if ( domNode )
- {
- switch ( domNode.nodeType )
- {
- // Safari don't consider document as element node type. (#3389)
- case CKEDITOR.NODE_DOCUMENT :
- return new CKEDITOR.dom.document( domNode );
-
- case CKEDITOR.NODE_ELEMENT :
- return new CKEDITOR.dom.element( domNode );
-
- case CKEDITOR.NODE_TEXT :
- return new CKEDITOR.dom.text( domNode );
- }
-
- // Call the base constructor.
- CKEDITOR.dom.domObject.call( this, domNode );
- }
-
- return this;
-};
-
-CKEDITOR.dom.node.prototype = new CKEDITOR.dom.domObject();
-
-/**
- * Element node type.
- * @constant
- * @example
- */
-CKEDITOR.NODE_ELEMENT = 1;
-
-/**
- * Document node type.
- * @constant
- * @example
- */
-CKEDITOR.NODE_DOCUMENT = 9;
-
-/**
- * Text node type.
- * @constant
- * @example
- */
-CKEDITOR.NODE_TEXT = 3;
-
-/**
- * Comment node type.
- * @constant
- * @example
- */
-CKEDITOR.NODE_COMMENT = 8;
-
-CKEDITOR.NODE_DOCUMENT_FRAGMENT = 11;
-
-CKEDITOR.POSITION_IDENTICAL = 0;
-CKEDITOR.POSITION_DISCONNECTED = 1;
-CKEDITOR.POSITION_FOLLOWING = 2;
-CKEDITOR.POSITION_PRECEDING = 4;
-CKEDITOR.POSITION_IS_CONTAINED = 8;
-CKEDITOR.POSITION_CONTAINS = 16;
-
-CKEDITOR.tools.extend( CKEDITOR.dom.node.prototype,
- /** @lends CKEDITOR.dom.node.prototype */
- {
- /**
- * Makes this node child of another element.
- * @param {CKEDITOR.dom.element} element The target element to which append
- * this node.
- * @returns {CKEDITOR.dom.element} The target element.
- * @example
- * var p = new CKEDITOR.dom.element( 'p' );
- * var strong = new CKEDITOR.dom.element( 'strong' );
- * strong.appendTo( p );
- *
- * // result: "<p><strong></strong></p>"
- */
- appendTo : function( element, toStart )
- {
- element.append( this, toStart );
- return element;
- },
-
- clone : function( includeChildren, cloneId )
- {
- var $clone = this.$.cloneNode( includeChildren );
-
- if ( !cloneId )
- {
- var removeIds = function( node )
- {
- if ( node.nodeType != CKEDITOR.NODE_ELEMENT )
- return;
-
- node.removeAttribute( 'id', false ) ;
- node.removeAttribute( '_cke_expando', false ) ;
-
- var childs = node.childNodes;
- for ( var i=0 ; i < childs.length ; i++ )
- removeIds( childs[ i ] );
- };
-
- // The "id" attribute should never be cloned to avoid duplication.
- removeIds( $clone );
- }
-
- return new CKEDITOR.dom.node( $clone );
- },
-
- hasPrevious : function()
- {
- return !!this.$.previousSibling;
- },
-
- hasNext : function()
- {
- return !!this.$.nextSibling;
- },
-
- /**
- * Inserts this element after a node.
- * @param {CKEDITOR.dom.node} node The that will preceed this element.
- * @returns {CKEDITOR.dom.node} The node preceeding this one after
- * insertion.
- * @example
- * var em = new CKEDITOR.dom.element( 'em' );
- * var strong = new CKEDITOR.dom.element( 'strong' );
- * strong.insertAfter( em );
- *
- * // result: "<em></em><strong></strong>"
- */
- insertAfter : function( node )
- {
- node.$.parentNode.insertBefore( this.$, node.$.nextSibling );
- return node;
- },
-
- /**
- * Inserts this element before a node.
- * @param {CKEDITOR.dom.node} node The that will be after this element.
- * @returns {CKEDITOR.dom.node} The node being inserted.
- * @example
- * var em = new CKEDITOR.dom.element( 'em' );
- * var strong = new CKEDITOR.dom.element( 'strong' );
- * strong.insertBefore( em );
- *
- * // result: "<strong></strong><em></em>"
- */
- insertBefore : function( node )
- {
- node.$.parentNode.insertBefore( this.$, node.$ );
- return node;
- },
-
- insertBeforeMe : function( node )
- {
- this.$.parentNode.insertBefore( node.$, this.$ );
- return node;
- },
-
- /**
- * Retrieves a uniquely identifiable tree address for this node.
- * The tree address returns is an array of integers, with each integer
- * indicating a child index of a DOM node, starting from
- * document.documentElement.
- *
- * For example, assuming is the second child from (
- * being the first), and we'd like to address the third child under the
- * fourth child of body, the tree address returned would be:
- * [1, 3, 2]
- *
- * The tree address cannot be used for finding back the DOM tree node once
- * the DOM tree structure has been modified.
- */
- getAddress : function( normalized )
- {
- var address = [];
- var $documentElement = this.getDocument().$.documentElement;
- var node = this.$;
-
- while ( node && node != $documentElement )
- {
- var parentNode = node.parentNode;
- var currentIndex = -1;
-
- if ( parentNode )
- {
- for ( var i = 0 ; i < parentNode.childNodes.length ; i++ )
- {
- var candidate = parentNode.childNodes[i];
-
- if ( normalized &&
- candidate.nodeType == 3 &&
- candidate.previousSibling &&
- candidate.previousSibling.nodeType == 3 )
- {
- continue;
- }
-
- currentIndex++;
-
- if ( candidate == node )
- break;
- }
-
- address.unshift( currentIndex );
- }
-
- node = parentNode;
- }
-
- return address;
- },
-
- /**
- * Gets the document containing this element.
- * @returns {CKEDITOR.dom.document} The document.
- * @example
- * var element = CKEDITOR.document.getById( 'example' );
- * alert( element.getDocument().equals( CKEDITOR.document ) ); // "true"
- */
- getDocument : function()
- {
- var document = new CKEDITOR.dom.document( this.$.ownerDocument || this.$.parentNode.ownerDocument );
-
- return (
- this.getDocument = function()
- {
- return document;
- })();
- },
-
- getIndex : function()
- {
- var $ = this.$;
-
- var currentNode = $.parentNode && $.parentNode.firstChild;
- var currentIndex = -1;
-
- while ( currentNode )
- {
- currentIndex++;
-
- if ( currentNode == $ )
- return currentIndex;
-
- currentNode = currentNode.nextSibling;
- }
-
- return -1;
- },
-
- getNextSourceNode : function( startFromSibling, nodeType, guard )
- {
- // If "guard" is a node, transform it in a function.
- if ( guard && !guard.call )
- {
- var guardNode = guard;
- guard = function( node )
- {
- return !node.equals( guardNode );
- };
- }
-
- var node = ( !startFromSibling && this.getFirst && this.getFirst() ),
- parent;
-
- // Guarding when we're skipping the current element( no children or 'startFromSibling' ).
- // send the 'moving out' signal even we don't actually dive into.
- if ( !node )
- {
- if ( this.type == CKEDITOR.NODE_ELEMENT && guard && guard( this, true ) === false )
- return null;
- node = this.getNext();
- }
-
- while ( !node && ( parent = ( parent || this ).getParent() ) )
- {
- // The guard check sends the "true" paramenter to indicate that
- // we are moving "out" of the element.
- if ( guard && guard( parent, true ) === false )
- return null;
-
- node = parent.getNext();
- }
-
- if ( !node )
- return null;
-
- if ( guard && guard( node ) === false )
- return null;
-
- if ( nodeType && nodeType != node.type )
- return node.getNextSourceNode( false, nodeType, guard );
-
- return node;
- },
-
- getPreviousSourceNode : function( startFromSibling, nodeType, guard )
- {
- if ( guard && !guard.call )
- {
- var guardNode = guard;
- guard = function( node )
- {
- return !node.equals( guardNode );
- };
- }
-
- var node = ( !startFromSibling && this.getLast && this.getLast() ),
- parent;
-
- // Guarding when we're skipping the current element( no children or 'startFromSibling' ).
- // send the 'moving out' signal even we don't actually dive into.
- if ( !node )
- {
- if ( this.type == CKEDITOR.NODE_ELEMENT && guard && guard( this, true ) === false )
- return null;
- node = this.getPrevious();
- }
-
- while ( !node && ( parent = ( parent || this ).getParent() ) )
- {
- // The guard check sends the "true" paramenter to indicate that
- // we are moving "out" of the element.
- if ( guard && guard( parent, true ) === false )
- return null;
-
- node = parent.getPrevious();
- }
-
- if ( !node )
- return null;
-
- if ( guard && guard( node ) === false )
- return null;
-
- if ( nodeType && node.type != nodeType )
- return node.getPreviousSourceNode( false, nodeType, guard );
-
- return node;
- },
-
- getPrevious : function( evaluator )
- {
- var previous = this.$, retval;
- do
- {
- previous = previous.previousSibling;
- retval = previous && new CKEDITOR.dom.node( previous );
- }
- while ( retval && evaluator && !evaluator( retval ) )
- return retval;
- },
-
- /**
- * Gets the node that follows this element in its parent's child list.
- * @param {Function} evaluator Filtering the result node.
- * @returns {CKEDITOR.dom.node} The next node or null if not available.
- * @example
- * var element = CKEDITOR.dom.element.createFromHtml( '<div><b>Example</b> <i>next</i></div>' );
- * var first = element.getFirst().getNext();
- * alert( first.getName() ); // "i"
- */
- getNext : function( evaluator )
- {
- var next = this.$, retval;
- do
- {
- next = next.nextSibling;
- retval = next && new CKEDITOR.dom.node( next );
- }
- while ( retval && evaluator && !evaluator( retval ) )
- return retval;
- },
-
- /**
- * Gets the parent element for this node.
- * @returns {CKEDITOR.dom.element} The parent element.
- * @example
- * var node = editor.document.getBody().getFirst();
- * var parent = node.getParent();
- * alert( node.getName() ); // "body"
- */
- getParent : function()
- {
- var parent = this.$.parentNode;
- return ( parent && parent.nodeType == 1 ) ? new CKEDITOR.dom.node( parent ) : null;
- },
-
- getParents : function( closerFirst )
- {
- var node = this;
- var parents = [];
-
- do
- {
- parents[ closerFirst ? 'push' : 'unshift' ]( node );
- }
- while ( ( node = node.getParent() ) )
-
- return parents;
- },
-
- getCommonAncestor : function( node )
- {
- if ( node.equals( this ) )
- return this;
-
- if ( node.contains && node.contains( this ) )
- return node;
-
- var start = this.contains ? this : this.getParent();
-
- do
- {
- if ( start.contains( node ) )
- return start;
- }
- while ( ( start = start.getParent() ) );
-
- return null;
- },
-
- getPosition : function( otherNode )
- {
- var $ = this.$;
- var $other = otherNode.$;
-
- if ( $.compareDocumentPosition )
- return $.compareDocumentPosition( $other );
-
- // IE and Safari have no support for compareDocumentPosition.
-
- if ( $ == $other )
- return CKEDITOR.POSITION_IDENTICAL;
-
- // Only element nodes support contains and sourceIndex.
- if ( this.type == CKEDITOR.NODE_ELEMENT && otherNode.type == CKEDITOR.NODE_ELEMENT )
- {
- if ( $.contains )
- {
- if ( $.contains( $other ) )
- return CKEDITOR.POSITION_CONTAINS + CKEDITOR.POSITION_PRECEDING;
-
- if ( $other.contains( $ ) )
- return CKEDITOR.POSITION_IS_CONTAINED + CKEDITOR.POSITION_FOLLOWING;
- }
-
- if ( 'sourceIndex' in $ )
- {
- return ( $.sourceIndex < 0 || $other.sourceIndex < 0 ) ? CKEDITOR.POSITION_DISCONNECTED :
- ( $.sourceIndex < $other.sourceIndex ) ? CKEDITOR.POSITION_PRECEDING :
- CKEDITOR.POSITION_FOLLOWING;
- }
- }
-
- // For nodes that don't support compareDocumentPosition, contains
- // or sourceIndex, their "address" is compared.
-
- var addressOfThis = this.getAddress(),
- addressOfOther = otherNode.getAddress(),
- minLevel = Math.min( addressOfThis.length, addressOfOther.length );
-
- // Determinate preceed/follow relationship.
- for ( var i = 0 ; i <= minLevel - 1 ; i++ )
- {
- if ( addressOfThis[ i ] != addressOfOther[ i ] )
- {
- if ( i < minLevel )
- {
- return addressOfThis[ i ] < addressOfOther[ i ] ?
- CKEDITOR.POSITION_PRECEDING : CKEDITOR.POSITION_FOLLOWING;
- }
- break;
- }
- }
-
- // Determinate contains/contained relationship.
- return ( addressOfThis.length < addressOfOther.length ) ?
- CKEDITOR.POSITION_CONTAINS + CKEDITOR.POSITION_PRECEDING :
- CKEDITOR.POSITION_IS_CONTAINED + CKEDITOR.POSITION_FOLLOWING;
- },
-
- /**
- * Gets the closes ancestor node of a specified node name.
- * @param {String} name Node name of ancestor node.
- * @param {Boolean} includeSelf (Optional) Whether to include the current
- * node in the calculation or not.
- * @returns {CKEDITOR.dom.node} Ancestor node.
- */
- getAscendant : function( name, includeSelf )
- {
- var $ = this.$;
-
- if ( !includeSelf )
- $ = $.parentNode;
-
- while ( $ )
- {
- if ( $.nodeName && $.nodeName.toLowerCase() == name )
- return new CKEDITOR.dom.node( $ );
-
- $ = $.parentNode;
- }
- return null;
- },
-
- hasAscendant : function( name, includeSelf )
- {
- var $ = this.$;
-
- if ( !includeSelf )
- $ = $.parentNode;
-
- while ( $ )
- {
- if ( $.nodeName && $.nodeName.toLowerCase() == name )
- return true;
-
- $ = $.parentNode;
- }
- return false;
- },
-
- move : function( target, toStart )
- {
- target.append( this.remove(), toStart );
- },
-
- /**
- * Removes this node from the document DOM.
- * @param {Boolean} [preserveChildren] Indicates that the children
- * elements must remain in the document, removing only the outer
- * tags.
- * @example
- * var element = CKEDITOR.dom.element.getById( 'MyElement' );
- * element.remove();
- */
- remove : function( preserveChildren )
- {
- var $ = this.$;
- var parent = $.parentNode;
-
- if ( parent )
- {
- if ( preserveChildren )
- {
- // Move all children before the node.
- for ( var child ; ( child = $.firstChild ) ; )
- {
- parent.insertBefore( $.removeChild( child ), $ );
- }
- }
-
- parent.removeChild( $ );
- }
-
- return this;
- },
-
- replace : function( nodeToReplace )
- {
- this.insertBefore( nodeToReplace );
- nodeToReplace.remove();
- },
-
- trim : function()
- {
- this.ltrim();
- this.rtrim();
- },
-
- ltrim : function()
- {
- var child;
- while ( this.getFirst && ( child = this.getFirst() ) )
- {
- if ( child.type == CKEDITOR.NODE_TEXT )
- {
- var trimmed = CKEDITOR.tools.ltrim( child.getText() ),
- originalLength = child.getLength();
-
- if ( !trimmed )
- {
- child.remove();
- continue;
- }
- else if ( trimmed.length < originalLength )
- {
- child.split( originalLength - trimmed.length );
-
- // IE BUG: child.remove() may raise JavaScript errors here. (#81)
- this.$.removeChild( this.$.firstChild );
- }
- }
- break;
- }
- },
-
- rtrim : function()
- {
- var child;
- while ( this.getLast && ( child = this.getLast() ) )
- {
- if ( child.type == CKEDITOR.NODE_TEXT )
- {
- var trimmed = CKEDITOR.tools.rtrim( child.getText() ),
- originalLength = child.getLength();
-
- if ( !trimmed )
- {
- child.remove();
- continue;
- }
- else if ( trimmed.length < originalLength )
- {
- child.split( trimmed.length );
-
- // IE BUG: child.getNext().remove() may raise JavaScript errors here.
- // (#81)
- this.$.lastChild.parentNode.removeChild( this.$.lastChild );
- }
- }
- break;
- }
-
- if ( !CKEDITOR.env.ie && !CKEDITOR.env.opera )
- {
- child = this.$.lastChild;
-
- if ( child && child.type == 1 && child.nodeName.toLowerCase() == 'br' )
- {
- // Use "eChildNode.parentNode" instead of "node" to avoid IE bug (#324).
- child.parentNode.removeChild( child ) ;
- }
- }
- }
- }
-);
diff --git a/lib/ckeditor/_source/core/dom/nodelist.js b/lib/ckeditor/_source/core/dom/nodelist.js
deleted file mode 100644
index 7e82ba1..0000000
--- a/lib/ckeditor/_source/core/dom/nodelist.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-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;
- }
-};
diff --git a/lib/ckeditor/_source/core/dom/range.js b/lib/ckeditor/_source/core/dom/range.js
deleted file mode 100644
index c187400..0000000
--- a/lib/ckeditor/_source/core/dom/range.js
+++ /dev/null
@@ -1,1853 +0,0 @@
-/*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-CKEDITOR.dom.range = function( document )
-{
- this.startContainer = null;
- this.startOffset = null;
- this.endContainer = null;
- this.endOffset = null;
- this.collapsed = true;
-
- this.document = document;
-};
-
-(function()
-{
- // Updates the "collapsed" property for the given range object.
- var updateCollapsed = function( range )
- {
- range.collapsed = (
- range.startContainer &&
- range.endContainer &&
- range.startContainer.equals( range.endContainer ) &&
- range.startOffset == range.endOffset );
- };
-
- // This is a shared function used to delete, extract and clone the range
- // contents.
- // V2
- var execContentsAction = function( range, action, docFrag )
- {
- range.optimizeBookmark();
-
- var startNode = range.startContainer;
- var endNode = range.endContainer;
-
- var startOffset = range.startOffset;
- var endOffset = range.endOffset;
-
- var removeStartNode;
- var removeEndNode;
-
- // For text containers, we must simply split the node and point to the
- // second part. The removal will be handled by the rest of the code .
- if ( endNode.type == CKEDITOR.NODE_TEXT )
- endNode = endNode.split( endOffset );
- else
- {
- // If the end container has children and the offset is pointing
- // to a child, then we should start from it.
- if ( endNode.getChildCount() > 0 )
- {
- // If the offset points after the last node.
- if ( endOffset >= endNode.getChildCount() )
- {
- // Let's create a temporary node and mark it for removal.
- endNode = endNode.append( range.document.createText( '' ) );
- removeEndNode = true;
- }
- else
- endNode = endNode.getChild( endOffset );
- }
- }
-
- // For text containers, we must simply split the node. The removal will
- // be handled by the rest of the code .
- if ( startNode.type == CKEDITOR.NODE_TEXT )
- {
- startNode.split( startOffset );
-
- // In cases the end node is the same as the start node, the above
- // splitting will also split the end, so me must move the end to
- // the second part of the split.
- if ( startNode.equals( endNode ) )
- endNode = startNode.getNext();
- }
- else
- {
- // If the start container has children and the offset is pointing
- // to a child, then we should start from its previous sibling.
-
- // If the offset points to the first node, we don't have a
- // sibling, so let's use the first one, but mark it for removal.
- if ( !startOffset )
- {
- // Let's create a temporary node and mark it for removal.
- startNode = startNode.getFirst().insertBeforeMe( range.document.createText( '' ) );
- removeStartNode = true;
- }
- else if ( startOffset >= startNode.getChildCount() )
- {
- // Let's create a temporary node and mark it for removal.
- startNode = startNode.append( range.document.createText( '' ) );
- removeStartNode = true;
- }
- else
- startNode = startNode.getChild( startOffset ).getPrevious();
- }
-
- // Get the parent nodes tree for the start and end boundaries.
- var startParents = startNode.getParents();
- var endParents = endNode.getParents();
-
- // Compare them, to find the top most siblings.
- var i, topStart, topEnd;
-
- for ( i = 0 ; i < startParents.length ; i++ )
- {
- topStart = startParents[ i ];
- topEnd = endParents[ i ];
-
- // The compared nodes will match until we find the top most
- // siblings (different nodes that have the same parent).
- // "i" will hold the index in the parents array for the top
- // most element.
- if ( !topStart.equals( topEnd ) )
- break;
- }
-
- var clone = docFrag, levelStartNode, levelClone, currentNode, currentSibling;
-
- // Remove all successive sibling nodes for every node in the
- // startParents tree.
- for ( var j = i ; j < startParents.length ; j++ )
- {
- levelStartNode = startParents[j];
-
- // For Extract and Clone, we must clone this level.
- if ( clone && !levelStartNode.equals( startNode ) ) // action = 0 = Delete
- levelClone = clone.append( levelStartNode.clone() );
-
- currentNode = levelStartNode.getNext();
-
- while ( currentNode )
- {
- // Stop processing when the current node matches a node in the
- // endParents tree or if it is the endNode.
- if ( currentNode.equals( endParents[ j ] ) || currentNode.equals( endNode ) )
- break;
-
- // Cache the next sibling.
- currentSibling = currentNode.getNext();
-
- // If cloning, just clone it.
- if ( action == 2 ) // 2 = Clone
- clone.append( currentNode.clone( true ) );
- else
- {
- // Both Delete and Extract will remove the node.
- currentNode.remove();
-
- // When Extracting, move the removed node to the docFrag.
- if ( action == 1 ) // 1 = Extract
- clone.append( currentNode );
- }
-
- currentNode = currentSibling;
- }
-
- if ( clone )
- clone = levelClone;
- }
-
- clone = docFrag;
-
- // Remove all previous sibling nodes for every node in the
- // endParents tree.
- for ( var k = i ; k < endParents.length ; k++ )
- {
- levelStartNode = endParents[ k ];
-
- // For Extract and Clone, we must clone this level.
- if ( action > 0 && !levelStartNode.equals( endNode ) ) // action = 0 = Delete
- levelClone = clone.append( levelStartNode.clone() );
-
- // The processing of siblings may have already been done by the parent.
- if ( !startParents[ k ] || levelStartNode.$.parentNode != startParents[ k ].$.parentNode )
- {
- currentNode = levelStartNode.getPrevious();
-
- while ( currentNode )
- {
- // Stop processing when the current node matches a node in the
- // startParents tree or if it is the startNode.
- if ( currentNode.equals( startParents[ k ] ) || currentNode.equals( startNode ) )
- break;
-
- // Cache the next sibling.
- currentSibling = currentNode.getPrevious();
-
- // If cloning, just clone it.
- if ( action == 2 ) // 2 = Clone
- clone.$.insertBefore( currentNode.$.cloneNode( true ), clone.$.firstChild ) ;
- else
- {
- // Both Delete and Extract will remove the node.
- currentNode.remove();
-
- // When Extracting, mode the removed node to the docFrag.
- if ( action == 1 ) // 1 = Extract
- clone.$.insertBefore( currentNode.$, clone.$.firstChild );
- }
-
- currentNode = currentSibling;
- }
- }
-
- if ( clone )
- clone = levelClone;
- }
-
- if ( action == 2 ) // 2 = Clone.
- {
- // No changes in the DOM should be done, so fix the split text (if any).
-
- var startTextNode = range.startContainer;
- if ( startTextNode.type == CKEDITOR.NODE_TEXT )
- {
- startTextNode.$.data += startTextNode.$.nextSibling.data;
- startTextNode.$.parentNode.removeChild( startTextNode.$.nextSibling );
- }
-
- var endTextNode = range.endContainer;
- if ( endTextNode.type == CKEDITOR.NODE_TEXT && endTextNode.$.nextSibling )
- {
- endTextNode.$.data += endTextNode.$.nextSibling.data;
- endTextNode.$.parentNode.removeChild( endTextNode.$.nextSibling );
- }
- }
- else
- {
- // Collapse the range.
-
- // If a node has been partially selected, collapse the range between
- // topStart and topEnd. Otherwise, simply collapse it to the start. (W3C specs).
- if ( topStart && topEnd && ( startNode.$.parentNode != topStart.$.parentNode || endNode.$.parentNode != topEnd.$.parentNode ) )
- {
- var endIndex = topEnd.getIndex();
-
- // If the start node is to be removed, we must correct the
- // index to reflect the removal.
- if ( removeStartNode && topEnd.$.parentNode == startNode.$.parentNode )
- endIndex--;
-
- range.setStart( topEnd.getParent(), endIndex );
- }
-
- // Collapse it to the start.
- range.collapse( true );
- }
-
- // Cleanup any marked node.
- if ( removeStartNode )
- startNode.remove();
-
- if ( removeEndNode && endNode.$.parentNode )
- endNode.remove();
- };
-
- var inlineChildReqElements = { abbr:1,acronym: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,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1 };
-
- // Creates the appropriate node evaluator for the dom walker used inside
- // check(Start|End)OfBlock.
- function getCheckStartEndBlockEvalFunction( isStart )
- {
- var hadBr = false, bookmarkEvaluator = CKEDITOR.dom.walker.bookmark( true );
- return function( node )
- {
- // First ignore bookmark nodes.
- if ( bookmarkEvaluator( node ) )
- return true;
-
- if ( node.type == CKEDITOR.NODE_TEXT )
- {
- // If there's any visible text, then we're not at the start.
- if ( CKEDITOR.tools.trim( node.getText() ).length )
- return false;
- }
- else if ( node.type == CKEDITOR.NODE_ELEMENT )
- {
- // If there are non-empty inline elements (e.g. ), then we're not
- // at the start.
- if ( !inlineChildReqElements[ node.getName() ] )
- {
- // If we're working at the end-of-block, forgive the first in non-IE
- // browsers.
- if ( !isStart && !CKEDITOR.env.ie && node.getName() == 'br' && !hadBr )
- hadBr = true;
- else
- return false;
- }
- }
- return true;
- };
- }
-
- // Evaluator for CKEDITOR.dom.element::checkBoundaryOfElement, reject any
- // text node and non-empty elements unless it's being bookmark text.
- function elementBoundaryEval( node )
- {
- // Reject any text node unless it's being bookmark
- // OR it's spaces. (#3883)
- return node.type != CKEDITOR.NODE_TEXT
- && node.getName() in CKEDITOR.dtd.$removeEmpty
- || !CKEDITOR.tools.trim( node.getText() )
- || node.getParent().hasAttribute( '_fck_bookmark' );
- }
-
- var whitespaceEval = new CKEDITOR.dom.walker.whitespaces(),
- bookmarkEval = new CKEDITOR.dom.walker.bookmark();
-
- function nonWhitespaceOrBookmarkEval( node )
- {
- // Whitespaces and bookmark nodes are to be ignored.
- return !whitespaceEval( node ) && !bookmarkEval( node );
- }
-
- CKEDITOR.dom.range.prototype =
- {
- clone : function()
- {
- var clone = new CKEDITOR.dom.range( this.document );
-
- clone.startContainer = this.startContainer;
- clone.startOffset = this.startOffset;
- clone.endContainer = this.endContainer;
- clone.endOffset = this.endOffset;
- clone.collapsed = this.collapsed;
-
- return clone;
- },
-
- collapse : function( toStart )
- {
- if ( toStart )
- {
- this.endContainer = this.startContainer;
- this.endOffset = this.startOffset;
- }
- else
- {
- this.startContainer = this.endContainer;
- this.startOffset = this.endOffset;
- }
-
- this.collapsed = true;
- },
-
- // The selection may be lost when cloning (due to the splitText() call).
- cloneContents : function()
- {
- var docFrag = new CKEDITOR.dom.documentFragment( this.document );
-
- if ( !this.collapsed )
- execContentsAction( this, 2, docFrag );
-
- return docFrag;
- },
-
- deleteContents : function()
- {
- if ( this.collapsed )
- return;
-
- execContentsAction( this, 0 );
- },
-
- extractContents : function()
- {
- var docFrag = new CKEDITOR.dom.documentFragment( this.document );
-
- if ( !this.collapsed )
- execContentsAction( this, 1, docFrag );
-
- return docFrag;
- },
-
- /**
- * Creates a bookmark object, which can be later used to restore the
- * range by using the moveToBookmark function.
- * This is an "intrusive" way to create a bookmark. It includes tags
- * in the range boundaries. The advantage of it is that it is possible to
- * handle DOM mutations when moving back to the bookmark.
- * Attention: the inclusion of nodes in the DOM is a design choice and
- * should not be changed as there are other points in the code that may be
- * using those nodes to perform operations. See GetBookmarkNode.
- * @param {Boolean} [serializable] Indicates that the bookmark nodes
- * must contain ids, which can be used to restore the range even
- * when these nodes suffer mutations (like a clonation or innerHTML
- * change).
- * @returns {Object} And object representing a bookmark.
- */
- createBookmark : function( serializable )
- {
- var startNode, endNode;
- var baseId;
- var clone;
-
- startNode = this.document.createElement( 'span' );
- startNode.setAttribute( '_fck_bookmark', 1 );
- startNode.setStyle( 'display', 'none' );
-
- // For IE, it must have something inside, otherwise it may be
- // removed during DOM operations.
- startNode.setHtml( ' ' );
-
- if ( serializable )
- {
- baseId = 'cke_bm_' + CKEDITOR.tools.getNextNumber();
- startNode.setAttribute( 'id', baseId + 'S' );
- }
-
- // If collapsed, the endNode will not be created.
- if ( !this.collapsed )
- {
- endNode = startNode.clone();
- endNode.setHtml( ' ' );
-
- if ( serializable )
- endNode.setAttribute( 'id', baseId + 'E' );
-
- clone = this.clone();
- clone.collapse();
- clone.insertNode( endNode );
- }
-
- clone = this.clone();
- clone.collapse( true );
- clone.insertNode( startNode );
-
- // Update the range position.
- if ( endNode )
- {
- this.setStartAfter( startNode );
- this.setEndBefore( endNode );
- }
- else
- this.moveToPosition( startNode, CKEDITOR.POSITION_AFTER_END );
-
- return {
- startNode : serializable ? baseId + 'S' : startNode,
- endNode : serializable ? baseId + 'E' : endNode,
- serializable : serializable
- };
- },
-
- /**
- * Creates a "non intrusive" and "mutation sensible" bookmark. This
- * kind of bookmark should be used only when the DOM is supposed to
- * remain stable after its creation.
- * @param {Boolean} [normalized] Indicates that the bookmark must
- * normalized. When normalized, the successive text nodes are
- * considered a single node. To sucessful load a normalized
- * bookmark, the DOM tree must be also normalized before calling
- * moveToBookmark.
- * @returns {Object} An object representing the bookmark.
- */
- createBookmark2 : function( normalized )
- {
- var startContainer = this.startContainer,
- endContainer = this.endContainer;
-
- var startOffset = this.startOffset,
- endOffset = this.endOffset;
-
- var child, previous;
-
- // If there is no range then get out of here.
- // It happens on initial load in Safari #962 and if the editor it's
- // hidden also in Firefox
- if ( !startContainer || !endContainer )
- return { start : 0, end : 0 };
-
- if ( normalized )
- {
- // Find out if the start is pointing to a text node that will
- // be normalized.
- if ( startContainer.type == CKEDITOR.NODE_ELEMENT )
- {
- child = startContainer.getChild( startOffset );
-
- // In this case, move the start information to that text
- // node.
- if ( child && child.type == CKEDITOR.NODE_TEXT
- && startOffset > 0 && child.getPrevious().type == CKEDITOR.NODE_TEXT )
- {
- startContainer = child;
- startOffset = 0;
- }
- }
-
- // Normalize the start.
- while ( startContainer.type == CKEDITOR.NODE_TEXT
- && ( previous = startContainer.getPrevious() )
- && previous.type == CKEDITOR.NODE_TEXT )
- {
- startContainer = previous;
- startOffset += previous.getLength();
- }
-
- // Process the end only if not normalized.
- if ( !this.isCollapsed )
- {
- // Find out if the start is pointing to a text node that
- // will be normalized.
- if ( endContainer.type == CKEDITOR.NODE_ELEMENT )
- {
- child = endContainer.getChild( endOffset );
-
- // In this case, move the start information to that
- // text node.
- if ( child && child.type == CKEDITOR.NODE_TEXT
- && endOffset > 0 && child.getPrevious().type == CKEDITOR.NODE_TEXT )
- {
- endContainer = child;
- endOffset = 0;
- }
- }
-
- // Normalize the end.
- while ( endContainer.type == CKEDITOR.NODE_TEXT
- && ( previous = endContainer.getPrevious() )
- && previous.type == CKEDITOR.NODE_TEXT )
- {
- endContainer = previous;
- endOffset += previous.getLength();
- }
- }
- }
-
- return {
- start : startContainer.getAddress( normalized ),
- end : this.isCollapsed ? null : endContainer.getAddress( normalized ),
- startOffset : startOffset,
- endOffset : endOffset,
- normalized : normalized,
- is2 : true // It's a createBookmark2 bookmark.
- };
- },
-
- moveToBookmark : function( bookmark )
- {
- if ( bookmark.is2 ) // Created with createBookmark2().
- {
- // Get the start information.
- var startContainer = this.document.getByAddress( bookmark.start, bookmark.normalized ),
- startOffset = bookmark.startOffset;
-
- // Get the end information.
- var endContainer = bookmark.end && this.document.getByAddress( bookmark.end, bookmark.normalized ),
- endOffset = bookmark.endOffset;
-
- // Set the start boundary.
- this.setStart( startContainer, startOffset );
-
- // Set the end boundary. If not available, collapse it.
- if ( endContainer )
- this.setEnd( endContainer, endOffset );
- else
- this.collapse( true );
- }
- else // Created with createBookmark().
- {
- var serializable = bookmark.serializable,
- startNode = serializable ? this.document.getById( bookmark.startNode ) : bookmark.startNode,
- endNode = serializable ? this.document.getById( bookmark.endNode ) : bookmark.endNode;
-
- // Set the range start at the bookmark start node position.
- this.setStartBefore( startNode );
-
- // Remove it, because it may interfere in the setEndBefore call.
- startNode.remove();
-
- // Set the range end at the bookmark end node position, or simply
- // collapse it if it is not available.
- if ( endNode )
- {
- this.setEndBefore( endNode );
- endNode.remove();
- }
- else
- this.collapse( true );
- }
- },
-
- getBoundaryNodes : function()
- {
- var startNode = this.startContainer,
- endNode = this.endContainer,
- startOffset = this.startOffset,
- endOffset = this.endOffset,
- childCount;
-
- if ( startNode.type == CKEDITOR.NODE_ELEMENT )
- {
- childCount = startNode.getChildCount();
- if ( childCount > startOffset )
- startNode = startNode.getChild( startOffset );
- else if ( childCount < 1 )
- startNode = startNode.getPreviousSourceNode();
- else // startOffset > childCount but childCount is not 0
- {
- // Try to take the node just after the current position.
- startNode = startNode.$;
- while ( startNode.lastChild )
- startNode = startNode.lastChild;
- startNode = new CKEDITOR.dom.node( startNode );
-
- // Normally we should take the next node in DFS order. But it
- // is also possible that we've already reached the end of
- // document.
- startNode = startNode.getNextSourceNode() || startNode;
- }
- }
- if ( endNode.type == CKEDITOR.NODE_ELEMENT )
- {
- childCount = endNode.getChildCount();
- if ( childCount > endOffset )
- endNode = endNode.getChild( endOffset ).getPreviousSourceNode( true );
- else if ( childCount < 1 )
- endNode = endNode.getPreviousSourceNode();
- else // endOffset > childCount but childCount is not 0
- {
- // Try to take the node just before the current position.
- endNode = endNode.$;
- while ( endNode.lastChild )
- endNode = endNode.lastChild;
- endNode = new CKEDITOR.dom.node( endNode );
- }
- }
-
- // Sometimes the endNode will come right before startNode for collapsed
- // ranges. Fix it. (#3780)
- if ( startNode.getPosition( endNode ) & CKEDITOR.POSITION_FOLLOWING )
- startNode = endNode;
-
- return { startNode : startNode, endNode : endNode };
- },
-
- /**
- * Find the node which fully contains the range.
- * @param includeSelf
- * @param {Boolean} ignoreTextNode Whether ignore CKEDITOR.NODE_TEXT type.
- */
- getCommonAncestor : function( includeSelf , ignoreTextNode )
- {
- var start = this.startContainer,
- end = this.endContainer,
- ancestor;
-
- if ( start.equals( end ) )
- {
- if ( includeSelf
- && start.type == CKEDITOR.NODE_ELEMENT
- && this.startOffset == this.endOffset - 1 )
- ancestor = start.getChild( this.startOffset );
- else
- ancestor = start;
- }
- else
- ancestor = start.getCommonAncestor( end );
-
- return ignoreTextNode && !ancestor.is ? ancestor.getParent() : ancestor;
- },
-
- /**
- * Transforms the startContainer and endContainer properties from text
- * nodes to element nodes, whenever possible. This is actually possible
- * if either of the boundary containers point to a text node, and its
- * offset is set to zero, or after the last char in the node.
- */
- optimize : function()
- {
- var container = this.startContainer;
- var offset = this.startOffset;
-
- if ( container.type != CKEDITOR.NODE_ELEMENT )
- {
- if ( !offset )
- this.setStartBefore( container );
- else if ( offset >= container.getLength() )
- this.setStartAfter( container );
- }
-
- container = this.endContainer;
- offset = this.endOffset;
-
- if ( container.type != CKEDITOR.NODE_ELEMENT )
- {
- if ( !offset )
- this.setEndBefore( container );
- else if ( offset >= container.getLength() )
- this.setEndAfter( container );
- }
- },
-
- /**
- * Move the range out of bookmark nodes if they're been the container.
- */
- optimizeBookmark: function()
- {
- var startNode = this.startContainer,
- endNode = this.endContainer;
-
- if ( startNode.is && startNode.is( 'span' )
- && startNode.hasAttribute( '_fck_bookmark' ) )
- this.setStartAt( startNode, CKEDITOR.POSITION_BEFORE_START );
- if ( endNode && endNode.is && endNode.is( 'span' )
- && endNode.hasAttribute( '_fck_bookmark' ) )
- this.setEndAt( endNode, CKEDITOR.POSITION_AFTER_END );
- },
-
- trim : function( ignoreStart, ignoreEnd )
- {
- var startContainer = this.startContainer,
- startOffset = this.startOffset,
- collapsed = this.collapsed;
- if ( ( !ignoreStart || collapsed )
- && startContainer && startContainer.type == CKEDITOR.NODE_TEXT )
- {
- // If the offset is zero, we just insert the new node before
- // the start.
- if ( !startOffset )
- {
- startOffset = startContainer.getIndex();
- startContainer = startContainer.getParent();
- }
- // If the offset is at the end, we'll insert it after the text
- // node.
- else if ( startOffset >= startContainer.getLength() )
- {
- startOffset = startContainer.getIndex() + 1;
- startContainer = startContainer.getParent();
- }
- // In other case, we split the text node and insert the new
- // node at the split point.
- else
- {
- var nextText = startContainer.split( startOffset );
-
- startOffset = startContainer.getIndex() + 1;
- startContainer = startContainer.getParent();
-
- // Check all necessity of updating the end boundary.
- if ( this.startContainer.equals( this.endContainer ) )
- this.setEnd( nextText, this.endOffset - this.startOffset );
- else if ( startContainer.equals( this.endContainer ) )
- this.endOffset += 1;
- }
-
- this.setStart( startContainer, startOffset );
-
- if ( collapsed )
- {
- this.collapse( true );
- return;
- }
- }
-
- var endContainer = this.endContainer;
- var endOffset = this.endOffset;
-
- if ( !( ignoreEnd || collapsed )
- && endContainer && endContainer.type == CKEDITOR.NODE_TEXT )
- {
- // If the offset is zero, we just insert the new node before
- // the start.
- if ( !endOffset )
- {
- endOffset = endContainer.getIndex();
- endContainer = endContainer.getParent();
- }
- // If the offset is at the end, we'll insert it after the text
- // node.
- else if ( endOffset >= endContainer.getLength() )
- {
- endOffset = endContainer.getIndex() + 1;
- endContainer = endContainer.getParent();
- }
- // In other case, we split the text node and insert the new
- // node at the split point.
- else
- {
- endContainer.split( endOffset );
-
- endOffset = endContainer.getIndex() + 1;
- endContainer = endContainer.getParent();
- }
-
- this.setEnd( endContainer, endOffset );
- }
- },
-
- enlarge : function( unit )
- {
- switch ( unit )
- {
- case CKEDITOR.ENLARGE_ELEMENT :
-
- if ( this.collapsed )
- return;
-
- // Get the common ancestor.
- var commonAncestor = this.getCommonAncestor();
-
- var body = this.document.getBody();
-
- // For each boundary
- // a. Depending on its position, find out the first node to be checked (a sibling) or, if not available, to be enlarge.
- // b. Go ahead checking siblings and enlarging the boundary as much as possible until the common ancestor is not reached. After reaching the common ancestor, just save the enlargeable node to be used later.
-
- var startTop, endTop;
-
- var enlargeable, sibling, commonReached;
-
- // Indicates that the node can be added only if whitespace
- // is available before it.
- var needsWhiteSpace = false;
- var isWhiteSpace;
- var siblingText;
-
- // Process the start boundary.
-
- var container = this.startContainer;
- var offset = this.startOffset;
-
- if ( container.type == CKEDITOR.NODE_TEXT )
- {
- if ( offset )
- {
- // Check if there is any non-space text before the
- // offset. Otherwise, container is null.
- container = !CKEDITOR.tools.trim( container.substring( 0, offset ) ).length && container;
-
- // If we found only whitespace in the node, it
- // means that we'll need more whitespace to be able
- // to expand. For example, can be expanded in
- // "A [B]", but not in "A [B]".
- needsWhiteSpace = !!container;
- }
-
- if ( container )
- {
- if ( !( sibling = container.getPrevious() ) )
- enlargeable = container.getParent();
- }
- }
- else
- {
- // If we have offset, get the node preceeding it as the
- // first sibling to be checked.
- if ( offset )
- sibling = container.getChild( offset - 1 ) || container.getLast();
-
- // If there is no sibling, mark the container to be
- // enlarged.
- if ( !sibling )
- enlargeable = container;
- }
-
- while ( enlargeable || sibling )
- {
- if ( enlargeable && !sibling )
- {
- // If we reached the common ancestor, mark the flag
- // for it.
- if ( !commonReached && enlargeable.equals( commonAncestor ) )
- commonReached = true;
-
- if ( !body.contains( enlargeable ) )
- break;
-
- // If we don't need space or this element breaks
- // the line, then enlarge it.
- if ( !needsWhiteSpace || enlargeable.getComputedStyle( 'display' ) != 'inline' )
- {
- needsWhiteSpace = false;
-
- // If the common ancestor has been reached,
- // we'll not enlarge it immediately, but just
- // mark it to be enlarged later if the end
- // boundary also enlarges it.
- if ( commonReached )
- startTop = enlargeable;
- else
- this.setStartBefore( enlargeable );
- }
-
- sibling = enlargeable.getPrevious();
- }
-
- // Check all sibling nodes preceeding the enlargeable
- // node. The node wil lbe enlarged only if none of them
- // blocks it.
- while ( sibling )
- {
- // This flag indicates that this node has
- // whitespaces at the end.
- isWhiteSpace = false;
-
- if ( sibling.type == CKEDITOR.NODE_TEXT )
- {
- siblingText = sibling.getText();
-
- if ( /[^\s\ufeff]/.test( siblingText ) )
- sibling = null;
-
- isWhiteSpace = /[\s\ufeff]$/.test( siblingText );
- }
- else
- {
- // If this is a visible element.
- // We need to check for the bookmark attribute because IE insists on
- // rendering the display:none nodes we use for bookmarks. (#3363)
- if ( sibling.$.offsetWidth > 0 && !sibling.getAttribute( '_fck_bookmark' ) )
- {
- // We'll accept it only if we need
- // whitespace, and this is an inline
- // element with whitespace only.
- if ( needsWhiteSpace && CKEDITOR.dtd.$removeEmpty[ sibling.getName() ] )
- {
- // It must contains spaces and inline elements only.
-
- siblingText = sibling.getText();
-
- if ( (/[^\s\ufeff]/).test( siblingText ) ) // Spaces + Zero Width No-Break Space (U+FEFF)
- sibling = null;
- else
- {
- var allChildren = sibling.$.all || sibling.$.getElementsByTagName( '*' );
- for ( var i = 0, child ; child = allChildren[ i++ ] ; )
- {
- if ( !CKEDITOR.dtd.$removeEmpty[ child.nodeName.toLowerCase() ] )
- {
- sibling = null;
- break;
- }
- }
- }
-
- if ( sibling )
- isWhiteSpace = !!siblingText.length;
- }
- else
- sibling = null;
- }
- }
-
- // A node with whitespaces has been found.
- if ( isWhiteSpace )
- {
- // Enlarge the last enlargeable node, if we
- // were waiting for spaces.
- if ( needsWhiteSpace )
- {
- if ( commonReached )
- startTop = enlargeable;
- else if ( enlargeable )
- this.setStartBefore( enlargeable );
- }
- else
- needsWhiteSpace = true;
- }
-
- if ( sibling )
- {
- var next = sibling.getPrevious();
-
- if ( !enlargeable && !next )
- {
- // Set the sibling as enlargeable, so it's
- // parent will be get later outside this while.
- enlargeable = sibling;
- sibling = null;
- break;
- }
-
- sibling = next;
- }
- else
- {
- // If sibling has been set to null, then we
- // need to stop enlarging.
- enlargeable = null;
- }
- }
-
- if ( enlargeable )
- enlargeable = enlargeable.getParent();
- }
-
- // Process the end boundary. This is basically the same
- // code used for the start boundary, with small changes to
- // make it work in the oposite side (to the right). This
- // makes it difficult to reuse the code here. So, fixes to
- // the above code are likely to be replicated here.
-
- container = this.endContainer;
- offset = this.endOffset;
-
- // Reset the common variables.
- enlargeable = sibling = null;
- commonReached = needsWhiteSpace = false;
-
- if ( container.type == CKEDITOR.NODE_TEXT )
- {
- // Check if there is any non-space text after the
- // offset. Otherwise, container is null.
- container = !CKEDITOR.tools.trim( container.substring( offset ) ).length && container;
-
- // If we found only whitespace in the node, it
- // means that we'll need more whitespace to be able
- // to expand. For example, can be expanded in
- // "A [B]", but not in "A [B]".
- needsWhiteSpace = !( container && container.getLength() );
-
- if ( container )
- {
- if ( !( sibling = container.getNext() ) )
- enlargeable = container.getParent();
- }
- }
- else
- {
- // Get the node right after the boudary to be checked
- // first.
- sibling = container.getChild( offset );
-
- if ( !sibling )
- enlargeable = container;
- }
-
- while ( enlargeable || sibling )
- {
- if ( enlargeable && !sibling )
- {
- if ( !commonReached && enlargeable.equals( commonAncestor ) )
- commonReached = true;
-
- if ( !body.contains( enlargeable ) )
- break;
-
- if ( !needsWhiteSpace || enlargeable.getComputedStyle( 'display' ) != 'inline' )
- {
- needsWhiteSpace = false;
-
- if ( commonReached )
- endTop = enlargeable;
- else if ( enlargeable )
- this.setEndAfter( enlargeable );
- }
-
- sibling = enlargeable.getNext();
- }
-
- while ( sibling )
- {
- isWhiteSpace = false;
-
- if ( sibling.type == CKEDITOR.NODE_TEXT )
- {
- siblingText = sibling.getText();
-
- if ( /[^\s\ufeff]/.test( siblingText ) )
- sibling = null;
-
- isWhiteSpace = /^[\s\ufeff]/.test( siblingText );
- }
- else
- {
- // If this is a visible element.
- // We need to check for the bookmark attribute because IE insists on
- // rendering the display:none nodes we use for bookmarks. (#3363)
- if ( sibling.$.offsetWidth > 0 && !sibling.getAttribute( '_fck_bookmark' ) )
- {
- // We'll accept it only if we need
- // whitespace, and this is an inline
- // element with whitespace only.
- if ( needsWhiteSpace && CKEDITOR.dtd.$removeEmpty[ sibling.getName() ] )
- {
- // It must contains spaces and inline elements only.
-
- siblingText = sibling.getText();
-
- if ( (/[^\s\ufeff]/).test( siblingText ) )
- sibling = null;
- else
- {
- allChildren = sibling.$.all || sibling.$.getElementsByTagName( '*' );
- for ( i = 0 ; child = allChildren[ i++ ] ; )
- {
- if ( !CKEDITOR.dtd.$removeEmpty[ child.nodeName.toLowerCase() ] )
- {
- sibling = null;
- break;
- }
- }
- }
-
- if ( sibling )
- isWhiteSpace = !!siblingText.length;
- }
- else
- sibling = null;
- }
- }
-
- if ( isWhiteSpace )
- {
- if ( needsWhiteSpace )
- {
- if ( commonReached )
- endTop = enlargeable;
- else
- this.setEndAfter( enlargeable );
- }
- }
-
- if ( sibling )
- {
- next = sibling.getNext();
-
- if ( !enlargeable && !next )
- {
- enlargeable = sibling;
- sibling = null;
- break;
- }
-
- sibling = next;
- }
- else
- {
- // If sibling has been set to null, then we
- // need to stop enlarging.
- enlargeable = null;
- }
- }
-
- if ( enlargeable )
- enlargeable = enlargeable.getParent();
- }
-
- // If the common ancestor can be enlarged by both boundaries, then include it also.
- if ( startTop && endTop )
- {
- commonAncestor = startTop.contains( endTop ) ? endTop : startTop;
-
- this.setStartBefore( commonAncestor );
- this.setEndAfter( commonAncestor );
- }
- break;
-
- case CKEDITOR.ENLARGE_BLOCK_CONTENTS:
- case CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS:
-
- // Enlarging the start boundary.
- var walkerRange = new CKEDITOR.dom.range( this.document );
-
- body = this.document.getBody();
-
- walkerRange.setStartAt( body, CKEDITOR.POSITION_AFTER_START );
- walkerRange.setEnd( this.startContainer, this.startOffset );
-
- var walker = new CKEDITOR.dom.walker( walkerRange ),
- blockBoundary, // The node on which the enlarging should stop.
- tailBr, //
- defaultGuard = CKEDITOR.dom.walker.blockBoundary(
- ( unit == CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS ) ? { br : 1 } : null ),
- // Record the encountered 'blockBoundary' for later use.
- boundaryGuard = function( node )
- {
- var retval = defaultGuard( node );
- if ( !retval )
- blockBoundary = node;
- return retval;
- },
- // Record the encounted 'tailBr' for later use.
- tailBrGuard = function( node )
- {
- var retval = boundaryGuard( node );
- if ( !retval && node.is && node.is( 'br' ) )
- tailBr = node;
- return retval;
- };
-
- walker.guard = boundaryGuard;
-
- enlargeable = walker.lastBackward();
-
- // It's the body which stop the enlarging if no block boundary found.
- blockBoundary = blockBoundary || body;
-
- // Start the range at different position by comparing
- // the document position of it with 'enlargeable' node.
- this.setStartAt(
- blockBoundary,
- !blockBoundary.is( 'br' ) &&
- ( !enlargeable && this.checkStartOfBlock()
- || enlargeable && blockBoundary.contains( enlargeable ) ) ?
- CKEDITOR.POSITION_AFTER_START :
- CKEDITOR.POSITION_AFTER_END );
-
- // Enlarging the end boundary.
- walkerRange = this.clone();
- walkerRange.collapse();
- walkerRange.setEndAt( body, CKEDITOR.POSITION_BEFORE_END );
- walker = new CKEDITOR.dom.walker( walkerRange );
-
- // tailBrGuard only used for on range end.
- walker.guard = ( unit == CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS ) ?
- tailBrGuard : boundaryGuard;
- blockBoundary = null;
- // End the range right before the block boundary node.
-
- enlargeable = walker.lastForward();
-
- // It's the body which stop the enlarging if no block boundary found.
- blockBoundary = blockBoundary || body;
-
- // Start the range at different position by comparing
- // the document position of it with 'enlargeable' node.
- this.setEndAt(
- blockBoundary,
- ( !enlargeable && this.checkEndOfBlock()
- || enlargeable && blockBoundary.contains( enlargeable ) ) ?
- CKEDITOR.POSITION_BEFORE_END :
- CKEDITOR.POSITION_BEFORE_START );
- // We must include the at the end of range if there's
- // one and we're expanding list item contents
- if ( tailBr )
- this.setEndAfter( tailBr );
- }
- },
-
- /**
- * Descrease the range to make sure that boundaries
- * always anchor beside text nodes or innermost element.
- * @param {Number} mode ( CKEDITOR.SHRINK_ELEMENT | CKEDITOR.SHRINK_TEXT ) The shrinking mode.
- */
- shrink : function( mode, selectContents )
- {
- // Unable to shrink a collapsed range.
- if ( !this.collapsed )
- {
- mode = mode || CKEDITOR.SHRINK_TEXT;
-
- var walkerRange = this.clone();
-
- var startContainer = this.startContainer,
- endContainer = this.endContainer,
- startOffset = this.startOffset,
- endOffset = this.endOffset,
- collapsed = this.collapsed;
-
- // Whether the start/end boundary is moveable.
- var moveStart = 1,
- moveEnd = 1;
-
- if ( startContainer && startContainer.type == CKEDITOR.NODE_TEXT )
- {
- if ( !startOffset )
- walkerRange.setStartBefore( startContainer );
- else if ( startOffset >= startContainer.getLength( ) )
- walkerRange.setStartAfter( startContainer );
- else
- {
- // Enlarge the range properly to avoid walker making
- // DOM changes caused by triming the text nodes later.
- walkerRange.setStartBefore( startContainer );
- moveStart = 0;
- }
- }
-
- if ( endContainer && endContainer.type == CKEDITOR.NODE_TEXT )
- {
- if ( !endOffset )
- walkerRange.setEndBefore( endContainer );
- else if ( endOffset >= endContainer.getLength( ) )
- walkerRange.setEndAfter( endContainer );
- else
- {
- walkerRange.setEndAfter( endContainer );
- moveEnd = 0;
- }
- }
-
- var walker = new CKEDITOR.dom.walker( walkerRange );
-
- walker.evaluator = function( node )
- {
- return node.type == ( mode == CKEDITOR.SHRINK_ELEMENT ?
- CKEDITOR.NODE_ELEMENT : CKEDITOR.NODE_TEXT );
- };
-
- var currentElement;
- walker.guard = function( node, movingOut )
- {
- // Stop when we're shrink in element mode while encountering a text node.
- if ( mode == CKEDITOR.SHRINK_ELEMENT && node.type == CKEDITOR.NODE_TEXT )
- return false;
-
- // Stop when we've already walked "through" an element.
- if ( movingOut && node.equals( currentElement ) )
- return false;
-
- if ( !movingOut && node.type == CKEDITOR.NODE_ELEMENT )
- currentElement = node;
-
- return true;
- };
-
- if ( moveStart )
- {
- var textStart = walker[ mode == CKEDITOR.SHRINK_ELEMENT ? 'lastForward' : 'next']();
- textStart && this.setStartAt( textStart, selectContents ? CKEDITOR.POSITION_AFTER_START : CKEDITOR.POSITION_BEFORE_START );
- }
-
- if ( moveEnd )
- {
- walker.reset();
- var textEnd = walker[ mode == CKEDITOR.SHRINK_ELEMENT ? 'lastBackward' : 'previous']();
- textEnd && this.setEndAt( textEnd, selectContents ? CKEDITOR.POSITION_BEFORE_END : CKEDITOR.POSITION_AFTER_END );
- }
-
- return !!( moveStart || moveEnd );
- }
- },
-
- /**
- * Inserts a node at the start of the range. The range will be expanded
- * the contain the node.
- */
- insertNode : function( node )
- {
- this.optimizeBookmark();
- this.trim( false, true );
-
- var startContainer = this.startContainer;
- var startOffset = this.startOffset;
-
- var nextNode = startContainer.getChild( startOffset );
-
- if ( nextNode )
- node.insertBefore( nextNode );
- else
- startContainer.append( node );
-
- // Check if we need to update the end boundary.
- if ( node.getParent().equals( this.endContainer ) )
- this.endOffset++;
-
- // Expand the range to embrace the new node.
- this.setStartBefore( node );
- },
-
- moveToPosition : function( node, position )
- {
- this.setStartAt( node, position );
- this.collapse( true );
- },
-
- selectNodeContents : function( node )
- {
- this.setStart( node, 0 );
- this.setEnd( node, node.type == CKEDITOR.NODE_TEXT ? node.getLength() : node.getChildCount() );
- },
-
- /**
- * Sets the start position of a Range.
- * @param {CKEDITOR.dom.node} startNode The node to start the range.
- * @param {Number} startOffset An integer greater than or equal to zero
- * representing the offset for the start of the range from the start
- * of startNode.
- */
- setStart : function( startNode, startOffset )
- {
- // W3C requires a check for the new position. If it is after the end
- // boundary, the range should be collapsed to the new start. It seams
- // we will not need this check for our use of this class so we can
- // ignore it for now.
-
- // Fixing invalid range start inside dtd empty elements.
- if( startNode.type == CKEDITOR.NODE_ELEMENT
- && CKEDITOR.dtd.$empty[ startNode.getName() ] )
- startNode = startNode.getParent(), startOffset = startNode.getIndex();
-
- this.startContainer = startNode;
- this.startOffset = startOffset;
-
- if ( !this.endContainer )
- {
- this.endContainer = startNode;
- this.endOffset = startOffset;
- }
-
- updateCollapsed( this );
- },
-
- /**
- * Sets the end position of a Range.
- * @param {CKEDITOR.dom.node} endNode The node to end the range.
- * @param {Number} endOffset An integer greater than or equal to zero
- * representing the offset for the end of the range from the start
- * of endNode.
- */
- setEnd : function( endNode, endOffset )
- {
- // W3C requires a check for the new position. If it is before the start
- // boundary, the range should be collapsed to the new end. It seams we
- // will not need this check for our use of this class so we can ignore
- // it for now.
-
- // Fixing invalid range end inside dtd empty elements.
- if( endNode.type == CKEDITOR.NODE_ELEMENT
- && CKEDITOR.dtd.$empty[ endNode.getName() ] )
- endNode = endNode.getParent(), endOffset = endNode.getIndex() + 1;
-
- this.endContainer = endNode;
- this.endOffset = endOffset;
-
- if ( !this.startContainer )
- {
- this.startContainer = endNode;
- this.startOffset = endOffset;
- }
-
- updateCollapsed( this );
- },
-
- setStartAfter : function( node )
- {
- this.setStart( node.getParent(), node.getIndex() + 1 );
- },
-
- setStartBefore : function( node )
- {
- this.setStart( node.getParent(), node.getIndex() );
- },
-
- setEndAfter : function( node )
- {
- this.setEnd( node.getParent(), node.getIndex() + 1 );
- },
-
- setEndBefore : function( node )
- {
- this.setEnd( node.getParent(), node.getIndex() );
- },
-
- setStartAt : function( node, position )
- {
- switch( position )
- {
- case CKEDITOR.POSITION_AFTER_START :
- this.setStart( node, 0 );
- break;
-
- case CKEDITOR.POSITION_BEFORE_END :
- if ( node.type == CKEDITOR.NODE_TEXT )
- this.setStart( node, node.getLength() );
- else
- this.setStart( node, node.getChildCount() );
- break;
-
- case CKEDITOR.POSITION_BEFORE_START :
- this.setStartBefore( node );
- break;
-
- case CKEDITOR.POSITION_AFTER_END :
- this.setStartAfter( node );
- }
-
- updateCollapsed( this );
- },
-
- setEndAt : function( node, position )
- {
- switch( position )
- {
- case CKEDITOR.POSITION_AFTER_START :
- this.setEnd( node, 0 );
- break;
-
- case CKEDITOR.POSITION_BEFORE_END :
- if ( node.type == CKEDITOR.NODE_TEXT )
- this.setEnd( node, node.getLength() );
- else
- this.setEnd( node, node.getChildCount() );
- break;
-
- case CKEDITOR.POSITION_BEFORE_START :
- this.setEndBefore( node );
- break;
-
- case CKEDITOR.POSITION_AFTER_END :
- this.setEndAfter( node );
- }
-
- updateCollapsed( this );
- },
-
- fixBlock : function( isStart, blockTag )
- {
- var bookmark = this.createBookmark(),
- fixedBlock = this.document.createElement( blockTag );
-
- this.collapse( isStart );
-
- this.enlarge( CKEDITOR.ENLARGE_BLOCK_CONTENTS );
-
- this.extractContents().appendTo( fixedBlock );
- fixedBlock.trim();
-
- if ( !CKEDITOR.env.ie )
- fixedBlock.appendBogus();
-
- this.insertNode( fixedBlock );
-
- this.moveToBookmark( bookmark );
-
- return fixedBlock;
- },
-
- splitBlock : function( blockTag )
- {
- var startPath = new CKEDITOR.dom.elementPath( this.startContainer ),
- endPath = new CKEDITOR.dom.elementPath( this.endContainer );
-
- var startBlockLimit = startPath.blockLimit,
- endBlockLimit = endPath.blockLimit;
-
- var startBlock = startPath.block,
- endBlock = endPath.block;
-
- var elementPath = null;
- // Do nothing if the boundaries are in different block limits.
- if ( !startBlockLimit.equals( endBlockLimit ) )
- return null;
-
- // Get or fix current blocks.
- if ( blockTag != 'br' )
- {
- if ( !startBlock )
- {
- startBlock = this.fixBlock( true, blockTag );
- endBlock = new CKEDITOR.dom.elementPath( this.endContainer ).block;
- }
-
- if ( !endBlock )
- endBlock = this.fixBlock( false, blockTag );
- }
-
- // Get the range position.
- var isStartOfBlock = startBlock && this.checkStartOfBlock(),
- isEndOfBlock = endBlock && this.checkEndOfBlock();
-
- // Delete the current contents.
- // TODO: Why is 2.x doing CheckIsEmpty()?
- this.deleteContents();
-
- if ( startBlock && startBlock.equals( endBlock ) )
- {
- if ( isEndOfBlock )
- {
- elementPath = new CKEDITOR.dom.elementPath( this.startContainer );
- this.moveToPosition( endBlock, CKEDITOR.POSITION_AFTER_END );
- endBlock = null;
- }
- else if ( isStartOfBlock )
- {
- elementPath = new CKEDITOR.dom.elementPath( this.startContainer );
- this.moveToPosition( startBlock, CKEDITOR.POSITION_BEFORE_START );
- startBlock = null;
- }
- else
- {
- endBlock = this.splitElement( startBlock );
-
- // In Gecko, the last child node must be a bogus .
- // Note: bogus added under
or would cause
- // lists to be incorrectly rendered.
- if ( !CKEDITOR.env.ie && !startBlock.is( 'ul', 'ol') )
- startBlock.appendBogus() ;
- }
- }
-
- return {
- previousBlock : startBlock,
- nextBlock : endBlock,
- wasStartOfBlock : isStartOfBlock,
- wasEndOfBlock : isEndOfBlock,
- elementPath : elementPath
- };
- },
-
- /**
- * Branch the specified element from the collapsed range position and
- * place the caret between the two result branches.
- * Note: The range must be collapsed and been enclosed by this element.
- * @param {CKEDITOR.dom.element} element
- * @return {CKEDITOR.dom.element} Root element of the new branch after the split.
- */
- splitElement : function( toSplit )
- {
- if ( !this.collapsed )
- return null;
-
- // Extract the contents of the block from the selection point to the end
- // of its contents.
- this.setEndAt( toSplit, CKEDITOR.POSITION_BEFORE_END );
- var documentFragment = this.extractContents();
-
- // Duplicate the element after it.
- var clone = toSplit.clone( false );
-
- // Place the extracted contents into the duplicated element.
- documentFragment.appendTo( clone );
- clone.insertAfter( toSplit );
- this.moveToPosition( toSplit, CKEDITOR.POSITION_AFTER_END );
- return clone;
- },
-
- /**
- * Check whether current range is on the inner edge of the specified element.
- * @param {Number} checkType ( CKEDITOR.START | CKEDITOR.END ) The checking side.
- * @param {CKEDITOR.dom.element} element The target element to check.
- */
- checkBoundaryOfElement : function( element, checkType )
- {
- var walkerRange = this.clone();
- // Expand the range to element boundary.
- walkerRange[ checkType == CKEDITOR.START ?
- 'setStartAt' : 'setEndAt' ]
- ( element, checkType == CKEDITOR.START ?
- CKEDITOR.POSITION_AFTER_START
- : CKEDITOR.POSITION_BEFORE_END );
-
- var walker = new CKEDITOR.dom.walker( walkerRange ),
- retval = false;
- walker.evaluator = elementBoundaryEval;
- return walker[ checkType == CKEDITOR.START ?
- 'checkBackward' : 'checkForward' ]();
- },
- // Calls to this function may produce changes to the DOM. The range may
- // be updated to reflect such changes.
- checkStartOfBlock : function()
- {
- var startContainer = this.startContainer,
- startOffset = this.startOffset;
-
- // If the starting node is a text node, and non-empty before the offset,
- // then we're surely not at the start of block.
- if ( startOffset && startContainer.type == CKEDITOR.NODE_TEXT )
- {
- var textBefore = CKEDITOR.tools.ltrim( startContainer.substring( 0, startOffset ) );
- if ( textBefore.length )
- return false;
- }
-
- // Antecipate the trim() call here, so the walker will not make
- // changes to the DOM, which would not get reflected into this
- // range otherwise.
- this.trim();
-
- // We need to grab the block element holding the start boundary, so
- // let's use an element path for it.
- var path = new CKEDITOR.dom.elementPath( this.startContainer );
-
- // Creates a range starting at the block start until the range start.
- var walkerRange = this.clone();
- walkerRange.collapse( true );
- walkerRange.setStartAt( path.block || path.blockLimit, CKEDITOR.POSITION_AFTER_START );
-
- var walker = new CKEDITOR.dom.walker( walkerRange );
- walker.evaluator = getCheckStartEndBlockEvalFunction( true );
-
- return walker.checkBackward();
- },
-
- checkEndOfBlock : function()
- {
- var endContainer = this.endContainer,
- endOffset = this.endOffset;
-
- // If the ending node is a text node, and non-empty after the offset,
- // then we're surely not at the end of block.
- if ( endContainer.type == CKEDITOR.NODE_TEXT )
- {
- var textAfter = CKEDITOR.tools.rtrim( endContainer.substring( endOffset ) );
- if ( textAfter.length )
- return false;
- }
-
- // Antecipate the trim() call here, so the walker will not make
- // changes to the DOM, which would not get reflected into this
- // range otherwise.
- this.trim();
-
- // We need to grab the block element holding the start boundary, so
- // let's use an element path for it.
- var path = new CKEDITOR.dom.elementPath( this.endContainer );
-
- // Creates a range starting at the block start until the range start.
- var walkerRange = this.clone();
- walkerRange.collapse( false );
- walkerRange.setEndAt( path.block || path.blockLimit, CKEDITOR.POSITION_BEFORE_END );
-
- var walker = new CKEDITOR.dom.walker( walkerRange );
- walker.evaluator = getCheckStartEndBlockEvalFunction( false );
-
- return walker.checkForward();
- },
-
- /**
- * Moves the range boundaries to the first/end editing point inside an
- * element. For example, in an element tree like
- * "<p><b><i></i></b> Text</p>", the start editing point is
- * "<p><b><i>^</i></b> Text</p>" (inside <i>).
- * @param {CKEDITOR.dom.element} el The element into which look for the
- * editing spot.
- * @param {Boolean} isMoveToEnd Whether move to the end editable position.
- */
- moveToElementEditablePosition : function( el, isMoveToEnd )
- {
- var isEditable;
-
- // Empty elements are rejected.
- if ( CKEDITOR.dtd.$empty[ el.getName() ] )
- return false;
-
- while ( el && el.type == CKEDITOR.NODE_ELEMENT )
- {
- isEditable = el.isEditable();
-
- // If an editable element is found, move inside it.
- if ( isEditable )
- this.moveToPosition( el, isMoveToEnd ?
- CKEDITOR.POSITION_BEFORE_END :
- CKEDITOR.POSITION_AFTER_START );
- // Stop immediately if we've found a non editable inline element (e.g ).
- else if ( CKEDITOR.dtd.$inline[ el.getName() ] )
- {
- this.moveToPosition( el, isMoveToEnd ?
- CKEDITOR.POSITION_AFTER_END :
- CKEDITOR.POSITION_BEFORE_START );
- return true;
- }
-
- // Non-editable non-inline elements are to be bypassed, getting the next one.
- if ( CKEDITOR.dtd.$empty[ el.getName() ] )
- el = el[ isMoveToEnd ? 'getPrevious' : 'getNext' ]( nonWhitespaceOrBookmarkEval );
- else
- el = el[ isMoveToEnd ? 'getLast' : 'getFirst' ]( nonWhitespaceOrBookmarkEval );
-
- // Stop immediately if we've found a text node.
- if ( el && el.type == CKEDITOR.NODE_TEXT )
- {
- this.moveToPosition( el, isMoveToEnd ?
- CKEDITOR.POSITION_AFTER_END :
- CKEDITOR.POSITION_BEFORE_START );
- return true;
- }
- }
-
- return isEditable;
- },
-
- /**
- *@see {CKEDITOR.dom.range.moveToElementEditablePosition}
- */
- moveToElementEditStart : function( target )
- {
- return this.moveToElementEditablePosition( target );
- },
-
- /**
- *@see {CKEDITOR.dom.range.moveToElementEditablePosition}
- */
- moveToElementEditEnd : function( target )
- {
- return this.moveToElementEditablePosition( target, true );
- },
-
- /**
- * Get the single node enclosed within the range if there's one.
- */
- getEnclosedNode : function()
- {
- var walkerRange = this.clone();
-
- // Optimize and analyze the range to avoid DOM destructive nature of walker. (#
- walkerRange.optimize();
- if ( walkerRange.startContainer.type != CKEDITOR.NODE_ELEMENT
- || walkerRange.endContainer.type != CKEDITOR.NODE_ELEMENT )
- return null;
-
- var walker = new CKEDITOR.dom.walker( walkerRange ),
- isNotBookmarks = CKEDITOR.dom.walker.bookmark( true ),
- isNotWhitespaces = CKEDITOR.dom.walker.whitespaces( true ),
- evaluator = function( node )
- {
- return isNotWhitespaces( node ) && isNotBookmarks( node );
- };
- walkerRange.evaluator = evaluator;
- var node = walker.next();
- walker.reset();
- return node && node.equals( walker.previous() ) ? node : null;
- },
-
- getTouchedStartNode : function()
- {
- var container = this.startContainer ;
-
- if ( this.collapsed || container.type != CKEDITOR.NODE_ELEMENT )
- return container ;
-
- return container.getChild( this.startOffset ) || container ;
- },
-
- getTouchedEndNode : function()
- {
- var container = this.endContainer ;
-
- if ( this.collapsed || container.type != CKEDITOR.NODE_ELEMENT )
- return container ;
-
- return container.getChild( this.endOffset - 1 ) || container ;
- }
- };
-})();
-
-CKEDITOR.POSITION_AFTER_START = 1; // ^contents "^text"
-CKEDITOR.POSITION_BEFORE_END = 2; // contents^ "text^"
-CKEDITOR.POSITION_BEFORE_START = 3; // ^contents ^"text"
-CKEDITOR.POSITION_AFTER_END = 4; // contents^ "text"
-
-CKEDITOR.ENLARGE_ELEMENT = 1;
-CKEDITOR.ENLARGE_BLOCK_CONTENTS = 2;
-CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS = 3;
-
-/**
- * Check boundary types.
- * @see CKEDITOR.dom.range::checkBoundaryOfElement
- */
-CKEDITOR.START = 1;
-CKEDITOR.END = 2;
-CKEDITOR.STARTEND = 3;
-
-CKEDITOR.SHRINK_ELEMENT = 1;
-CKEDITOR.SHRINK_TEXT = 2;
diff --git a/lib/ckeditor/_source/core/dom/text.js b/lib/ckeditor/_source/core/dom/text.js
deleted file mode 100644
index a1eb690..0000000
--- a/lib/ckeditor/_source/core/dom/text.js
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
-Copyright (c) 2003-2010, 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;
- },
-
- /**
- * 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 );
- }
- });
diff --git a/lib/ckeditor/_source/core/dom/walker.js b/lib/ckeditor/_source/core/dom/walker.js
deleted file mode 100644
index 1ef87f5..0000000
--- a/lib/ckeditor/_source/core/dom/walker.js
+++ /dev/null
@@ -1,451 +0,0 @@
-/*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-(function()
-{
- // This function is to be called under a "walker" instance scope.
- function iterate( rtl, breakOnFalse )
- {
- // Return null if we have reached the end.
- if ( this._.end )
- return null;
-
- var node,
- range = this.range,
- guard,
- userGuard = this.guard,
- type = this.type,
- getSourceNodeFn = ( rtl ? 'getPreviousSourceNode' : 'getNextSourceNode' );
-
- // This is the first call. Initialize it.
- if ( !this._.start )
- {
- this._.start = 1;
-
- // Trim text nodes and optmize the range boundaries. DOM changes
- // may happen at this point.
- range.trim();
-
- // A collapsed range must return null at first call.
- if ( range.collapsed )
- {
- this.end();
- return null;
- }
- }
-
- // Create the LTR guard function, if necessary.
- if ( !rtl && !this._.guardLTR )
- {
- // Gets the node that stops the walker when going LTR.
- var limitLTR = range.endContainer,
- blockerLTR = limitLTR.getChild( range.endOffset );
-
- this._.guardLTR = function( node, movingOut )
- {
- return ( ( !movingOut || !limitLTR.equals( node ) )
- && ( !blockerLTR || !node.equals( blockerLTR ) )
- && ( node.type != CKEDITOR.NODE_ELEMENT || !movingOut || node.getName() != 'body' ) );
- };
- }
-
- // Create the RTL guard function, if necessary.
- if ( rtl && !this._.guardRTL )
- {
- // Gets the node that stops the walker when going LTR.
- var limitRTL = range.startContainer,
- blockerRTL = ( range.startOffset > 0 ) && limitRTL.getChild( range.startOffset - 1 );
-
- this._.guardRTL = function( node, movingOut )
- {
- return ( ( !movingOut || !limitRTL.equals( node ) )
- && ( !blockerRTL || !node.equals( blockerRTL ) )
- && ( node.type != CKEDITOR.NODE_ELEMENT || !movingOut || node.getName() != 'body' ) );
- };
- }
-
- // Define which guard function to use.
- var stopGuard = rtl ? this._.guardRTL : this._.guardLTR;
-
- // Make the user defined guard function participate in the process,
- // otherwise simply use the boundary guard.
- if ( userGuard )
- {
- guard = function( node, movingOut )
- {
- if ( stopGuard( node, movingOut ) === false )
- return false;
-
- return userGuard( node, movingOut );
- };
- }
- else
- guard = stopGuard;
-
- if ( this.current )
- node = this.current[ getSourceNodeFn ]( false, type, guard );
- else
- {
- // Get the first node to be returned.
-
- if ( rtl )
- {
- node = range.endContainer;
-
- if ( range.endOffset > 0 )
- {
- node = node.getChild( range.endOffset - 1 );
- if ( guard( node ) === false )
- node = null;
- }
- else
- node = ( guard ( node, true ) === false ) ?
- null : node.getPreviousSourceNode( true, type, guard );
- }
- else
- {
- node = range.startContainer;
- node = node.getChild( range.startOffset );
-
- if ( node )
- {
- if ( guard( node ) === false )
- node = null;
- }
- else
- node = ( guard ( range.startContainer, true ) === false ) ?
- null : range.startContainer.getNextSourceNode( true, type, guard ) ;
- }
- }
-
- while ( node && !this._.end )
- {
- this.current = node;
-
- if ( !this.evaluator || this.evaluator( node ) !== false )
- {
- if ( !breakOnFalse )
- return node;
- }
- else if ( breakOnFalse && this.evaluator )
- return false;
-
- node = node[ getSourceNodeFn ]( false, type, guard );
- }
-
- this.end();
- return this.current = null;
- }
-
- function iterateToLast( rtl )
- {
- var node, last = null;
-
- while ( ( node = iterate.call( this, rtl ) ) )
- last = node;
-
- return last;
- }
-
- CKEDITOR.dom.walker = CKEDITOR.tools.createClass(
- {
- /**
- * Utility class to "walk" the DOM inside a range boundaries. If
- * necessary, partially included nodes (text nodes) are broken to
- * reflect the boundaries limits, so DOM and range changes may happen.
- * Outside changes to the range may break the walker.
- *
- * The walker may return nodes that are not totaly included into the
- * range boundaires. Let's take the following range representation,
- * where the square brackets indicate the boundaries:
- *
- * [<p>Some <b>sample] text</b>
- *
- * While walking forward into the above range, the following nodes are
- * returned: <p>, "Some ", <b> and "sample". Going
- * backwards instead we have: "sample" and "Some ". So note that the
- * walker always returns nodes when "entering" them, but not when
- * "leaving" them. The guard function is instead called both when
- * entering and leaving nodes.
- *
- * @constructor
- * @param {CKEDITOR.dom.range} range The range within which walk.
- */
- $ : function( range )
- {
- this.range = range;
-
- /**
- * A function executed for every matched node, to check whether
- * it's to be considered into the walk or not. If not provided, all
- * matched nodes are considered good.
- * If the function returns "false" the node is ignored.
- * @name CKEDITOR.dom.walker.prototype.evaluator
- * @property
- * @type Function
- */
- // this.evaluator = null;
-
- /**
- * A function executed for every node the walk pass by to check
- * whether the walk is to be finished. It's called when both
- * entering and exiting nodes, as well as for the matched nodes.
- * If this function returns "false", the walking ends and no more
- * nodes are evaluated.
- * @name CKEDITOR.dom.walker.prototype.guard
- * @property
- * @type Function
- */
- // this.guard = null;
-
- /** @private */
- this._ = {};
- },
-
-// statics :
-// {
-// /* Creates a CKEDITOR.dom.walker instance to walk inside DOM boundaries set by nodes.
-// * @param {CKEDITOR.dom.node} startNode The node from wich the walk
-// * will start.
-// * @param {CKEDITOR.dom.node} [endNode] The last node to be considered
-// * in the walk. No more nodes are retrieved after touching or
-// * passing it. If not provided, the walker stops at the
-// * <body> closing boundary.
-// * @returns {CKEDITOR.dom.walker} A DOM walker for the nodes between the
-// * provided nodes.
-// */
-// createOnNodes : function( startNode, endNode, startInclusive, endInclusive )
-// {
-// var range = new CKEDITOR.dom.range();
-// if ( startNode )
-// range.setStartAt( startNode, startInclusive ? CKEDITOR.POSITION_BEFORE_START : CKEDITOR.POSITION_AFTER_END ) ;
-// else
-// range.setStartAt( startNode.getDocument().getBody(), CKEDITOR.POSITION_AFTER_START ) ;
-//
-// if ( endNode )
-// range.setEndAt( endNode, endInclusive ? CKEDITOR.POSITION_AFTER_END : CKEDITOR.POSITION_BEFORE_START ) ;
-// else
-// range.setEndAt( startNode.getDocument().getBody(), CKEDITOR.POSITION_BEFORE_END ) ;
-//
-// return new CKEDITOR.dom.walker( range );
-// }
-// },
-//
- proto :
- {
- /**
- * Stop walking. No more nodes are retrieved if this function gets
- * called.
- */
- end : function()
- {
- this._.end = 1;
- },
-
- /**
- * Retrieves the next node (at right).
- * @returns {CKEDITOR.dom.node} The next node or null if no more
- * nodes are available.
- */
- next : function()
- {
- return iterate.call( this );
- },
-
- /**
- * Retrieves the previous node (at left).
- * @returns {CKEDITOR.dom.node} The previous node or null if no more
- * nodes are available.
- */
- previous : function()
- {
- return iterate.call( this, true );
- },
-
- /**
- * Check all nodes at right, executing the evaluation fuction.
- * @returns {Boolean} "false" if the evaluator function returned
- * "false" for any of the matched nodes. Otherwise "true".
- */
- checkForward : function()
- {
- return iterate.call( this, false, true ) !== false;
- },
-
- /**
- * Check all nodes at left, executing the evaluation fuction.
- * @returns {Boolean} "false" if the evaluator function returned
- * "false" for any of the matched nodes. Otherwise "true".
- */
- checkBackward : function()
- {
- return iterate.call( this, true, true ) !== false;
- },
-
- /**
- * Executes a full walk forward (to the right), until no more nodes
- * are available, returning the last valid node.
- * @returns {CKEDITOR.dom.node} The last node at the right or null
- * if no valid nodes are available.
- */
- lastForward : function()
- {
- return iterateToLast.call( this );
- },
-
- /**
- * Executes a full walk backwards (to the left), until no more nodes
- * are available, returning the last valid node.
- * @returns {CKEDITOR.dom.node} The last node at the left or null
- * if no valid nodes are available.
- */
- lastBackward : function()
- {
- return iterateToLast.call( this, true );
- },
-
- reset : function()
- {
- delete this.current;
- this._ = {};
- }
-
- }
- });
-
- /*
- * Anything whose display computed style is block, list-item, table,
- * table-row-group, table-header-group, table-footer-group, table-row,
- * table-column-group, table-column, table-cell, table-caption, or whose node
- * name is hr, br (when enterMode is br only) is a block boundary.
- */
- var blockBoundaryDisplayMatch =
- {
- block : 1,
- 'list-item' : 1,
- table : 1,
- 'table-row-group' : 1,
- 'table-header-group' : 1,
- 'table-footer-group' : 1,
- 'table-row' : 1,
- 'table-column-group' : 1,
- 'table-column' : 1,
- 'table-cell' : 1,
- 'table-caption' : 1
- },
- blockBoundaryNodeNameMatch = { hr : 1 };
-
- CKEDITOR.dom.element.prototype.isBlockBoundary = function( customNodeNames )
- {
- var nodeNameMatches = CKEDITOR.tools.extend( {},
- blockBoundaryNodeNameMatch, customNodeNames || {} );
-
- return blockBoundaryDisplayMatch[ this.getComputedStyle( 'display' ) ] ||
- nodeNameMatches[ this.getName() ];
- };
-
- CKEDITOR.dom.walker.blockBoundary = function( customNodeNames )
- {
- return function( node , type )
- {
- return ! ( node.type == CKEDITOR.NODE_ELEMENT
- && node.isBlockBoundary( customNodeNames ) );
- };
- };
-
- CKEDITOR.dom.walker.listItemBoundary = function()
- {
- return this.blockBoundary( { br : 1 } );
- };
- /**
- * Whether the node is a bookmark node's inner text node.
- */
- CKEDITOR.dom.walker.bookmarkContents = function( node )
- {
- },
-
- /**
- * Whether the to-be-evaluated node is a bookmark node OR bookmark node
- * inner contents.
- * @param {Boolean} contentOnly Whether only test againt the text content of
- * bookmark node instead of the element itself(default).
- * @param {Boolean} isReject Whether should return 'false' for the bookmark
- * node instead of 'true'(default).
- */
- CKEDITOR.dom.walker.bookmark = function( contentOnly, isReject )
- {
- function isBookmarkNode( node )
- {
- return ( node && node.getName
- && node.getName() == 'span'
- && node.hasAttribute('_fck_bookmark') );
- }
-
- return function( node )
- {
- var isBookmark, parent;
- // Is bookmark inner text node?
- isBookmark = ( node && !node.getName && ( parent = node.getParent() )
- && isBookmarkNode( parent ) );
- // Is bookmark node?
- isBookmark = contentOnly ? isBookmark : isBookmark || isBookmarkNode( node );
- return isReject ^ isBookmark;
- };
- };
-
- /**
- * Whether the node is a text node containing only whitespaces characters.
- * @param isReject
- */
- CKEDITOR.dom.walker.whitespaces = function( isReject )
- {
- return function( node )
- {
- var isWhitespace = node && ( node.type == CKEDITOR.NODE_TEXT )
- && !CKEDITOR.tools.trim( node.getText() );
- return isReject ^ isWhitespace;
- };
- };
-
- /**
- * Whether the node is invisible in wysiwyg mode.
- * @param isReject
- */
- CKEDITOR.dom.walker.invisible = function( isReject )
- {
- var whitespace = CKEDITOR.dom.walker.whitespaces();
- return function( node )
- {
- // Nodes that take no spaces in wysiwyg:
- // 1. White-spaces but not including NBSP;
- // 2. Empty inline elements, e.g. we're checking here
- // 'offsetHeight' instead of 'offsetWidth' for properly excluding
- // all sorts of empty paragraph, e.g. .
- var isInvisible = whitespace( node ) || node.is && !node.$.offsetHeight;
- return isReject ^ isInvisible;
- };
- };
-
- var tailNbspRegex = /^[\t\r\n ]*(?: |\xa0)$/,
- isNotWhitespaces = CKEDITOR.dom.walker.whitespaces( true ),
- isNotBookmark = CKEDITOR.dom.walker.bookmark( false, true ),
- fillerEvaluator = function( element )
- {
- return isNotBookmark( element ) && isNotWhitespaces( element );
- };
-
- // Check if there's a filler node at the end of an element, and return it.
- CKEDITOR.dom.element.prototype.getBogus = function ()
- {
- var tail = this.getLast( fillerEvaluator );
- if ( tail && ( !CKEDITOR.env.ie ? tail.is && tail.is( 'br' )
- : tail.getText && tailNbspRegex.test( tail.getText() ) ) )
- {
- return tail;
- }
- return false;
- };
-
-})();
diff --git a/lib/ckeditor/_source/core/dom/window.js b/lib/ckeditor/_source/core/dom/window.js
deleted file mode 100644
index 01e2d58..0000000
--- a/lib/ckeditor/_source/core/dom/window.js
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-Copyright (c) 2003-2010, 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 );
- * win.focus();
- */
- 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 = win.getViewPaneSize();
- * 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 = win.getScrollPosition();
- * 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
- };
- }
- }
- });
diff --git a/lib/ckeditor/_source/core/dtd.js b/lib/ckeditor/_source/core/dtd.js
deleted file mode 100644
index d5af5bf..0000000
--- a/lib/ckeditor/_source/core/dtd.js
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
-Copyright (c) 2003-2010, 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.
- */
-
-/**
- * Holds and object representation of the HTML DTD to be used by the editor in
- * its internal operations.
- *
- * 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.
- *
- * Several special grouping properties are also available. Their names start
- * with the "$" character.
- * @namespace
- * @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,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},F),
- H = X({sub:1,img:1,object:1,sup:1,basefont:1,map:1,applet:1,font:1,big:1,small: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,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,dl:1,fieldset:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,isindex:1,menu: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,td:1,th:1,caption:1,form:1 },
-
- $inline : L, // Just like span.
-
- $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},
-
- /**
- * 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},
-
- /**
- * 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},
-
- /**
- * 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 : {},
- 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,
- script : N,
- 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
- };
-})();
-
-// PACKAGER_RENAME( CKEDITOR.dtd )
diff --git a/lib/ckeditor/_source/core/editor.js b/lib/ckeditor/_source/core/editor.js
deleted file mode 100644
index 0b373f7..0000000
--- a/lib/ckeditor/_source/core/editor.js
+++ /dev/null
@@ -1,759 +0,0 @@
-/*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-/**
- * @fileOverview Defines the {@link CKEDITOR.editor} class, which represents an
- * editor instance.
- */
-
-(function()
-{
- // The counter for automatic instance names.
- var nameCounter = 0;
-
- var getNewName = function()
- {
- var name = 'editor' + ( ++nameCounter );
- return ( CKEDITOR.instances && CKEDITOR.instances[ name ] ) ? getNewName() : name;
- };
-
- // ##### START: Config Privates
-
- // These function loads custom configuration files and cache the
- // CKEDITOR.editorConfig functions defined on them, so there is no need to
- // download them more than once for several instances.
- var loadConfigLoaded = {};
- var loadConfig = function( editor )
- {
- var customConfig = editor.config.customConfig;
-
- // Check if there is a custom config to load.
- if ( !customConfig )
- return false;
-
- customConfig = CKEDITOR.getUrl( customConfig );
-
- var loadedConfig = loadConfigLoaded[ customConfig ] || ( loadConfigLoaded[ customConfig ] = {} );
-
- // If the custom config has already been downloaded, reuse it.
- if ( loadedConfig.fn )
- {
- // Call the cached CKEDITOR.editorConfig defined in the custom
- // config file for the editor instance depending on it.
- loadedConfig.fn.call( editor, editor.config );
-
- // If there is no other customConfig in the chain, fire the
- // "configLoaded" event.
- if ( CKEDITOR.getUrl( editor.config.customConfig ) == customConfig || !loadConfig( editor ) )
- editor.fireOnce( 'customConfigLoaded' );
- }
- else
- {
- // Load the custom configuration file.
- CKEDITOR.scriptLoader.load( customConfig, function()
- {
- // If the CKEDITOR.editorConfig function has been properly
- // defined in the custom configuration file, cache it.
- if ( CKEDITOR.editorConfig )
- loadedConfig.fn = CKEDITOR.editorConfig;
- else
- loadedConfig.fn = function(){};
-
- // Call the load config again. This time the custom
- // config is already cached and so it will get loaded.
- loadConfig( editor );
- });
- }
-
- return true;
- };
-
- var initConfig = function( editor, instanceConfig )
- {
- // Setup the lister for the "customConfigLoaded" event.
- editor.on( 'customConfigLoaded', function()
- {
- if ( instanceConfig )
- {
- // Register the events that may have been set at the instance
- // configuration object.
- if ( instanceConfig.on )
- {
- for ( var eventName in instanceConfig.on )
- {
- editor.on( eventName, instanceConfig.on[ eventName ] );
- }
- }
-
- // Overwrite the settings from the in-page config.
- CKEDITOR.tools.extend( editor.config, instanceConfig, true );
-
- delete editor.config.on;
- }
-
- onConfigLoaded( editor );
- });
-
- // The instance config may override the customConfig setting to avoid
- // loading the default ~/config.js file.
- if ( instanceConfig && instanceConfig.customConfig != undefined )
- editor.config.customConfig = instanceConfig.customConfig;
-
- // Load configs from the custom configuration files.
- if ( !loadConfig( editor ) )
- editor.fireOnce( 'customConfigLoaded' );
- };
-
- // ##### END: Config Privates
-
- var onConfigLoaded = function( editor )
- {
- // Set config related properties.
-
- var skin = editor.config.skin.split( ',' ),
- skinName = skin[ 0 ],
- skinPath = CKEDITOR.getUrl( skin[ 1 ] || (
- '_source/' + // @Packager.RemoveLine
- 'skins/' + skinName + '/' ) );
-
- editor.skinName = skinName;
- editor.skinPath = skinPath;
- editor.skinClass = 'cke_skin_' + skinName;
-
- editor.tabIndex = editor.config.tabIndex || editor.element.getAttribute( 'tabindex' ) || 0;
-
- // Fire the "configLoaded" event.
- editor.fireOnce( 'configLoaded' );
-
- // Load language file.
- loadSkin( editor );
- };
-
- var loadLang = function( editor )
- {
- CKEDITOR.lang.load( editor.config.language, editor.config.defaultLanguage, function( languageCode, lang )
- {
- editor.langCode = languageCode;
-
- // As we'll be adding plugin specific entries that could come
- // from different language code files, we need a copy of lang,
- // not a direct reference to it.
- editor.lang = CKEDITOR.tools.prototypedCopy( lang );
-
- // We're not able to support RTL in Firefox 2 at this time.
- if ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 && editor.lang.dir == 'rtl' )
- editor.lang.dir = 'ltr';
-
- var config = editor.config;
- config.contentsLangDirection == 'ui' && ( config.contentsLangDirection = editor.lang.dir );
-
- loadPlugins( editor );
- });
- };
-
- var loadPlugins = function( editor )
- {
- var config = editor.config,
- plugins = config.plugins,
- extraPlugins = config.extraPlugins,
- removePlugins = config.removePlugins;
-
- if ( extraPlugins )
- {
- // Remove them first to avoid duplications.
- var removeRegex = new RegExp( '(?:^|,)(?:' + extraPlugins.replace( /\s*,\s*/g, '|' ) + ')(?=,|$)' , 'g' );
- plugins = plugins.replace( removeRegex, '' );
-
- plugins += ',' + extraPlugins;
- }
-
- if ( removePlugins )
- {
- removeRegex = new RegExp( '(?:^|,)(?:' + removePlugins.replace( /\s*,\s*/g, '|' ) + ')(?=,|$)' , 'g' );
- plugins = plugins.replace( removeRegex, '' );
- }
-
- // Load all plugins defined in the "plugins" setting.
- CKEDITOR.plugins.load( plugins.split( ',' ), function( plugins )
- {
- // The list of plugins.
- var pluginsArray = [];
-
- // The language code to get loaded for each plugin. Null
- // entries will be appended for plugins with no language files.
- var languageCodes = [];
-
- // The list of URLs to language files.
- var languageFiles = [];
-
- // Cache the loaded plugin names.
- editor.plugins = plugins;
-
- // Loop through all plugins, to build the list of language
- // files to get loaded.
- for ( var pluginName in plugins )
- {
- var plugin = plugins[ pluginName ],
- pluginLangs = plugin.lang,
- pluginPath = CKEDITOR.plugins.getPath( pluginName ),
- lang = null;
-
- // Set the plugin path in the plugin.
- plugin.path = pluginPath;
-
- // If the plugin has "lang".
- if ( pluginLangs )
- {
- // Resolve the plugin language. If the current language
- // is not available, get the first one (default one).
- lang = ( CKEDITOR.tools.indexOf( pluginLangs, editor.langCode ) >= 0 ? editor.langCode : pluginLangs[ 0 ] );
-
- if ( !plugin.lang[ lang ] )
- {
- // Put the language file URL into the list of files to
- // get downloaded.
- languageFiles.push( CKEDITOR.getUrl( pluginPath + 'lang/' + lang + '.js' ) );
- }
- else
- {
- CKEDITOR.tools.extend( editor.lang, plugin.lang[ lang ] );
- lang = null;
- }
- }
-
- // Save the language code, so we know later which
- // language has been resolved to this plugin.
- languageCodes.push( lang );
-
- pluginsArray.push( plugin );
- }
-
- // Load all plugin specific language files in a row.
- CKEDITOR.scriptLoader.load( languageFiles, function()
- {
- // Initialize all plugins that have the "beforeInit" and "init" methods defined.
- var methods = [ 'beforeInit', 'init', 'afterInit' ];
- for ( var m = 0 ; m < methods.length ; m++ )
- {
- for ( var i = 0 ; i < pluginsArray.length ; i++ )
- {
- var plugin = pluginsArray[ i ];
-
- // Uses the first loop to update the language entries also.
- if ( m === 0 && languageCodes[ i ] && plugin.lang )
- CKEDITOR.tools.extend( editor.lang, plugin.lang[ languageCodes[ i ] ] );
-
- // Call the plugin method (beforeInit and init).
- if ( plugin[ methods[ m ] ] )
- plugin[ methods[ m ] ]( editor );
- }
- }
-
- // Load the editor skin.
- editor.fire( 'pluginsLoaded' );
- loadTheme( editor );
- });
- });
- };
-
- var loadSkin = function( editor )
- {
- CKEDITOR.skins.load( editor, 'editor', function()
- {
- loadLang( editor );
- });
- };
-
- var loadTheme = function( editor )
- {
- var theme = editor.config.theme;
- CKEDITOR.themes.load( theme, function()
- {
- var editorTheme = editor.theme = CKEDITOR.themes.get( theme );
- editorTheme.path = CKEDITOR.themes.getPath( theme );
- editorTheme.build( editor );
-
- if ( editor.config.autoUpdateElement )
- attachToForm( editor );
- });
- };
-
- var attachToForm = function( editor )
- {
- var element = editor.element;
-
- // If are replacing a textarea, we must
- if ( editor.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE && element.is( 'textarea' ) )
- {
- var form = element.$.form && new CKEDITOR.dom.element( element.$.form );
- if ( form )
- {
- function onSubmit()
- {
- editor.updateElement();
- }
- form.on( 'submit',onSubmit );
-
- // Setup the submit function because it doesn't fire the
- // "submit" event.
- if ( !form.$.submit.nodeName )
- {
- form.$.submit = CKEDITOR.tools.override( form.$.submit, function( originalSubmit )
- {
- return function()
- {
- editor.updateElement();
-
- // For IE, the DOM submit function is not a
- // function, so we need thid check.
- if ( originalSubmit.apply )
- originalSubmit.apply( this, arguments );
- else
- originalSubmit();
- };
- });
- }
-
- // Remove 'submit' events registered on form element before destroying.(#3988)
- editor.on( 'destroy', function()
- {
- form.removeListener( 'submit', onSubmit );
- } );
- }
- }
- };
-
- function updateCommandsMode()
- {
- var command,
- commands = this._.commands,
- mode = this.mode;
-
- for ( var name in commands )
- {
- command = commands[ name ];
- command[ command.startDisabled ? 'disable' : command.modes[ mode ] ? 'enable' : 'disable' ]();
- }
- }
-
- /**
- * Initializes the editor instance. This function is called by the editor
- * contructor (editor_basic.js).
- * @private
- */
- CKEDITOR.editor.prototype._init = function()
- {
- // Get the properties that have been saved in the editor_base
- // implementation.
- var element = CKEDITOR.dom.element.get( this._.element ),
- instanceConfig = this._.instanceConfig;
- delete this._.element;
- delete this._.instanceConfig;
-
- this._.commands = {};
- this._.styles = [];
-
- /**
- * The DOM element that has been replaced by this editor instance. This
- * element holds the editor data on load and post.
- * @name CKEDITOR.editor.prototype.element
- * @type CKEDITOR.dom.element
- * @example
- * var editor = CKEDITOR.instances.editor1;
- * alert( editor.element.getName() ); "textarea"
- */
- this.element = element;
-
- /**
- * The editor instance name. It hay be the replaced element id, name or
- * a default name using a progressive counter (editor1, editor2, ...).
- * @name CKEDITOR.editor.prototype.name
- * @type String
- * @example
- * var editor = CKEDITOR.instances.editor1;
- * alert( editor.name ); "editor1"
- */
- this.name = ( element && ( this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE )
- && ( element.getId() || element.getNameAtt() ) )
- || getNewName();
-
- if ( this.name in CKEDITOR.instances )
- throw '[CKEDITOR.editor] The instance "' + this.name + '" already exists.';
-
- /**
- * The configurations for this editor instance. It inherits all
- * settings defined in (@link CKEDITOR.config}, combined with settings
- * loaded from custom configuration files and those defined inline in
- * the page when creating the editor.
- * @name CKEDITOR.editor.prototype.config
- * @type Object
- * @example
- * var editor = CKEDITOR.instances.editor1;
- * alert( editor.config.theme ); "default" e.g.
- */
- this.config = CKEDITOR.tools.prototypedCopy( CKEDITOR.config );
-
- /**
- * Namespace containing UI features related to this editor instance.
- * @name CKEDITOR.editor.prototype.ui
- * @type CKEDITOR.ui
- * @example
- */
- this.ui = new CKEDITOR.ui( this );
-
- /**
- * Controls the focus state of this editor instance. This property
- * is rarely used for normal API operations. It is mainly
- * destinated to developer adding UI elements to the editor interface.
- * @name CKEDITOR.editor.prototype.focusManager
- * @type CKEDITOR.focusManager
- * @example
- */
- this.focusManager = new CKEDITOR.focusManager( this );
-
- CKEDITOR.fire( 'instanceCreated', null, this );
-
- this.on( 'mode', updateCommandsMode, null, null, 1 );
-
- initConfig( this, instanceConfig );
- };
-})();
-
-CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
- /** @lends CKEDITOR.editor.prototype */
- {
- /**
- * Adds a command definition to the editor instance. Commands added with
- * this function can be later executed with {@link #execCommand}.
- * @param {String} commandName The indentifier name of the command.
- * @param {CKEDITOR.commandDefinition} commandDefinition The command definition.
- * @example
- * editorInstance.addCommand( 'sample',
- * {
- * exec : function( editor )
- * {
- * alert( 'Executing a command for the editor name "' + editor.name + '"!' );
- * }
- * });
- */
- addCommand : function( commandName, commandDefinition )
- {
- return this._.commands[ commandName ] = new CKEDITOR.command( this, commandDefinition );
- },
-
- /**
- * Add a trunk of css text to the editor which will be applied to the wysiwyg editing document.
- * Note: This function should be called before editor is loaded to take effect.
- * @param css {String} CSS text.
- * @example
- * editorInstance.addCss( 'body { background-color: grey; }' );
- */
- addCss : function( css )
- {
- this._.styles.push( css );
- },
-
- /**
- * Destroys the editor instance, releasing all resources used by it.
- * If the editor replaced an element, the element will be recovered.
- * @param {Boolean} [noUpdate] If the instance is replacing a DOM
- * element, this parameter indicates whether or not to update the
- * element with the instance contents.
- * @example
- * alert( CKEDITOR.instances.editor1 ); e.g "object"
- * CKEDITOR.instances.editor1.destroy();
- * alert( CKEDITOR.instances.editor1 ); "undefined"
- */
- destroy : function( noUpdate )
- {
- if ( !noUpdate )
- this.updateElement();
-
- if ( this.mode )
- {
- // -> currentMode.unload( holderElement );
- this._.modes[ this.mode ].unload( this.getThemeSpace( 'contents' ) );
- }
-
- this.theme.destroy( this );
-
- var toolbars,
- index = 0,
- j,
- items,
- instance;
-
- if ( this.toolbox )
- {
- toolbars = this.toolbox.toolbars;
- for ( ; index < toolbars.length ; index++ )
- {
- items = toolbars[ index ].items;
- for ( j = 0 ; j < items.length ; j++ )
- {
- instance = items[ j ];
- if ( instance.clickFn ) CKEDITOR.tools.removeFunction( instance.clickFn );
- if ( instance.keyDownFn ) CKEDITOR.tools.removeFunction( instance.keyDownFn );
-
- if ( instance.index ) CKEDITOR.ui.button._.instances[ instance.index ] = null;
- }
- }
- }
-
- if ( this.contextMenu )
- CKEDITOR.tools.removeFunction( this.contextMenu._.functionId );
-
- if ( this._.filebrowserFn )
- CKEDITOR.tools.removeFunction( this._.filebrowserFn );
-
- this.fire( 'destroy' );
- CKEDITOR.remove( this );
- CKEDITOR.fire( 'instanceDestroyed', null, this );
- },
-
- /**
- * Executes a command.
- * @param {String} commandName The indentifier name of the command.
- * @param {Object} [data] Data to be passed to the command
- * @returns {Boolean} "true" if the command has been successfuly
- * executed, otherwise "false".
- * @example
- * editorInstance.execCommand( 'Bold' );
- */
- execCommand : function( commandName, data )
- {
- var command = this.getCommand( commandName );
-
- var eventData =
- {
- name: commandName,
- commandData: data,
- command: command
- };
-
- if ( command && command.state != CKEDITOR.TRISTATE_DISABLED )
- {
- if ( this.fire( 'beforeCommandExec', eventData ) !== true )
- {
- eventData.returnValue = command.exec( eventData.commandData );
-
- // Fire the 'afterCommandExec' immediately if command is synchronous.
- if ( !command.async && this.fire( 'afterCommandExec', eventData ) !== true )
- return eventData.returnValue;
- }
- }
-
- // throw 'Unknown command name "' + commandName + '"';
- return false;
- },
-
- /**
- * Gets one of the registered commands. Note that, after registering a
- * command definition with addCommand, it is transformed internally
- * into an instance of {@link CKEDITOR.command}, which will be then
- * returned by this function.
- * @param {String} commandName The name of the command to be returned.
- * This is the same used to register the command with addCommand.
- * @returns {CKEDITOR.command} The command object identified by the
- * provided name.
- */
- getCommand : function( commandName )
- {
- return this._.commands[ commandName ];
- },
-
- /**
- * Gets the editor data. The data will be in raw format. It is the same
- * data that is posted by the editor.
- * @type String
- * @returns (String) The editor data.
- * @example
- * if ( CKEDITOR.instances.editor1.getData() == '' )
- * alert( 'There is no data available' );
- */
- getData : function()
- {
- this.fire( 'beforeGetData' );
-
- var eventData = this._.data;
-
- if ( typeof eventData != 'string' )
- {
- var element = this.element;
- if ( element && this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE )
- eventData = element.is( 'textarea' ) ? element.getValue() : element.getHtml();
- else
- eventData = '';
- }
-
- eventData = { dataValue : eventData };
-
- // Fire "getData" so data manipulation may happen.
- this.fire( 'getData', eventData );
-
- return eventData.dataValue;
- },
-
- getSnapshot : function()
- {
- var data = this.fire( 'getSnapshot' );
-
- if ( typeof data != 'string' )
- {
- var element = this.element;
- if ( element && this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE )
- data = element.is( 'textarea' ) ? element.getValue() : element.getHtml();
- }
-
- return data;
- },
-
- loadSnapshot : function( snapshot )
- {
- this.fire( 'loadSnapshot', snapshot );
- },
-
- /**
- * Sets the editor data. The data must be provided in raw format (HTML).
- *
- * Note that this menthod is asynchronous. The "callback" parameter must
- * be used if interaction with the editor is needed after setting the data.
- * @param {String} data HTML code to replace the curent content in the
- * editor.
- * @param {Function} callback Function to be called after the setData
- * is completed.
- * @example
- * CKEDITOR.instances.editor1.setData( '<p>This is the editor data.</p>' );
- * @example
- * CKEDITOR.instances.editor1.setData( '<p>Some other editor data.</p>', function()
- * {
- * this.checkDirty(); // true
- * });
- */
- setData : function( data , callback )
- {
- if( callback )
- {
- this.on( 'dataReady', function( evt )
- {
- evt.removeListener();
- callback.call( evt.editor );
- } );
- }
-
- // Fire "setData" so data manipulation may happen.
- var eventData = { dataValue : data };
- this.fire( 'setData', eventData );
-
- this._.data = eventData.dataValue;
-
- this.fire( 'afterSetData', eventData );
- },
-
- /**
- * Inserts HTML into the currently selected position in the editor.
- * @param {String} data HTML code to be inserted into the editor.
- * @example
- * CKEDITOR.instances.editor1.insertHtml( '<p>This is a new paragraph.</p>' );
- */
- insertHtml : function( data )
- {
- this.fire( 'insertHtml', data );
- },
-
- /**
- * Inserts an element into the currently selected position in the
- * editor.
- * @param {CKEDITOR.dom.element} element The element to be inserted
- * into the editor.
- * @example
- * var element = CKEDITOR.dom.element.createFromHtml( '<img src="hello.png" border="0" title="Hello" />' );
- * CKEDITOR.instances.editor1.insertElement( element );
- */
- insertElement : function( element )
- {
- this.fire( 'insertElement', element );
- },
-
- checkDirty : function()
- {
- return ( this.mayBeDirty && this._.previousValue !== this.getSnapshot() );
- },
-
- resetDirty : function()
- {
- if ( this.mayBeDirty )
- this._.previousValue = this.getSnapshot();
- },
-
- /**
- * Updates the <textarea> element that has been replaced by the editor with
- * the current data available in the editor.
- * @example
- * CKEDITOR.instances.editor1.updateElement();
- * alert( document.getElementById( 'editor1' ).value ); // The current editor data.
- */
- updateElement : function()
- {
- var element = this.element;
- if ( element && this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE )
- {
- var data = this.getData();
-
- if ( this.config.htmlEncodeOutput )
- data = CKEDITOR.tools.htmlEncode( data );
-
- if ( element.is( 'textarea' ) )
- element.setValue( data );
- else
- element.setHtml( data );
- }
- }
- });
-
-CKEDITOR.on( 'loaded', function()
- {
- // Run the full initialization for pending editors.
- var pending = CKEDITOR.editor._pending;
- if ( pending )
- {
- delete CKEDITOR.editor._pending;
-
- for ( var i = 0 ; i < pending.length ; i++ )
- pending[ i ]._init();
- }
- });
-
-/**
- * Whether escape HTML when editor update original input element.
- * @name CKEDITOR.config.htmlEncodeOutput
- * @since 3.1
- * @type Boolean
- * @default false
- * @example
- * config.htmlEncodeOutput = true;
- */
-
-/**
- * Fired when a CKEDITOR instance is created, but still before initializing it.
- * To interact with a fully initialized instance, use the
- * {@link CKEDITOR#instanceReady} event instead.
- * @name CKEDITOR#instanceCreated
- * @event
- * @param {CKEDITOR.editor} editor The editor instance that has been created.
- */
-
-/**
- * Fired when a CKEDITOR instance is destroyed.
- * @name CKEDITOR#instanceDestroyed
- * @event
- * @param {CKEDITOR.editor} editor The editor instance that has been destroyed.
- */
-
-/**
- * Fired when all plugins are loaded and initialized into the editor instance.
- * @name CKEDITOR#pluginsLoaded
- * @event
- */
diff --git a/lib/ckeditor/_source/core/editor_basic.js b/lib/ckeditor/_source/core/editor_basic.js
deleted file mode 100644
index ec90bf7..0000000
--- a/lib/ckeditor/_source/core/editor_basic.js
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
-Copyright (c) 2003-2010, 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;
-
- /**
- * Represents an editor instance. This constructor should be rarely used,
- * being the {@link CKEDITOR} methods preferible.
- * @constructor
- * @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.
- * @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:
- *
- *
CKEDITOR.ELEMENT_MODE_NONE: No element is linked to the
- * editor instance.
- *
CKEDITOR.ELEMENT_MODE_REPLACE: The element is to be
- * replaced by the editor instance.
- *
CKEDITOR.ELEMENT_MODE_APPENDTO: The editor is to be
- * created inside the element.
- *
- * @name CKEDITOR.editor.prototype.elementMode
- * @type Number
- * @example
- * var editor = CKEDITOR.replace( 'editor1' );
- * alert( editor.elementMode ); "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 );
-
- // 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 );
-}
diff --git a/lib/ckeditor/_source/core/env.js b/lib/ckeditor/_source/core/env.js
deleted file mode 100644
index 5b39c53..0000000
--- a/lib/ckeditor/_source/core/env.js
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
-Copyright (c) 2003-2010, 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 )
-{
- /**
- * Environment and browser information.
- * @namespace
- * @example
- */
- 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 ),
-
- quirks : ( document.compatMode == 'BackCompat' ),
-
- mobile : ( agent.indexOf( 'mobile' ) > -1 ),
-
- isCustomDomain : function()
- {
- var domain = document.domain,
- hostname = window.location.hostname;
-
- return this.ie &&
- domain != hostname &&
- domain != ( '[' + hostname + ']' ); // IPv6 IP support (#5434)
- }
- };
-
- /**
- * 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] );
-
- /**
- * Indicate IE8 browser.
- */
- env.ie8 = !!document.documentMode;
-
- /**
- * Indicte IE8 document mode.
- */
- env.ie8Compat = document.documentMode == 8;
-
- /**
- * Indicates that CKEditor is running on an IE7-like environment, which
- * includes IE7 itself and IE8's IE7 document mode.
- * @type Boolean
- */
- 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.
- * @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.
- *
- * 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).
- *
- * 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 && CKEDITOR.env.version <= 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 =
- !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.
- env.cssClass =
- 'cke_browser_' + (
- env.ie ? 'ie' :
- env.gecko ? 'gecko' :
- env.opera ? 'opera' :
- env.air ? 'air' :
- 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 ? '8' :
- '7' );
-
- if ( env.quirks )
- env.cssClass += ' cke_browser_iequirks';
- }
-
- if ( env.gecko && version < 10900 )
- env.cssClass += ' cke_browser_gecko18';
-
- return env;
- })();
-}
-
-// PACKAGER_RENAME( CKEDITOR.env )
-// PACKAGER_RENAME( CKEDITOR.env.ie )
diff --git a/lib/ckeditor/_source/core/event.js b/lib/ckeditor/_source/core/event.js
deleted file mode 100644
index 8668a3d..0000000
--- a/lib/ckeditor/_source/core/event.js
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
-Copyright (c) 2003-2010, 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 )
-{
- /**
- * This is a base class for classes and objects that require event handling
- * features.
- * @constructor
- * @example
- */
- CKEDITOR.event = function()
- {};
-
- /**
- * Implements the {@link CKEDITOR.event} features in an object.
- * @param {Object} targetObject The object in which implement the features.
- * @example
- * var myObject = { message : 'Example' };
- * CKEDITOR.event.implementOn( myObject };
- * myObject.on( 'testEvent', function()
- * {
- * alert( this.message ); // "Example"
- * });
- * myObject.fire( 'testEvent' );
- */
- CKEDITOR.event.implementOn = function( targetObject, isTargetPrototype )
- {
- 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() { ... } );
- * someObject.fire( 'someEvent' ); // both listeners are called
- * @example
- * someObject.on( 'someEvent', function( event )
- * {
- * alert( event.data ); // "Example"
- * });
- * someObject.fire( 'someEvent', 'Example' );
- */
- 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
- * someObject.fireOnce( 'someEvent' ); // 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
- * someObject.removeListener( 'someEvent', myListener );
- * 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.hasListeners( 'someEvent' ) ); // "true"
- * alert( someObject.hasListeners( 'noEvent' ) ); // "false"
- */
- hasListeners : function( eventName )
- {
- var event = getPrivate( this )[ eventName ];
- return ( event && event.listeners.length > 0 ) ;
- }
- };
- })();
-}
diff --git a/lib/ckeditor/_source/core/eventInfo.js b/lib/ckeditor/_source/core/eventInfo.js
deleted file mode 100644
index dbeca5c..0000000
--- a/lib/ckeditor/_source/core/eventInfo.js
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
-Copyright (c) 2003-2010, 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.
- */
-
-/**
- * This class is not really part of the API. It just illustrates the features
- * of the event object passed to event listeners by a {@link CKEDITOR.event}
- * based object.
- * @name CKEDITOR.eventInfo
- * @constructor
- * @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( event.name ); // "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( event.sender == 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( event.editor == myEditor ); // "true"
- * });
- * myButton.fire( 'someEvent', null, myEditor );
- */
-
-/**
- * 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( event.data ); // "Example"
- * });
- * someObject.fire( 'someEvent', 'Example' );
- */
-
-/**
- * Any extra data appended during the listener registration.
- * @name CKEDITOR.eventInfo.prototype.listenerData
- * @field
- * @type Object
- * @example
- * someObject.on( 'someEvent', function( event )
- * {
- * alert( event.listenerData ); // "Example"
- * }
- * , null, 'Example' );
- */
-
-/**
- * Indicates that no further listeners are to be called.
- * @name CKEDITOR.eventInfo.prototype.stop
- * @function
- * @example
- * someObject.on( 'someEvent', function( event )
- * {
- * event.stop();
- * });
- * 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 )
- * {
- * event.cancel();
- * });
- * someObject.on( 'someEvent', function( event )
- * {
- * // This one will not be called.
- * });
- * alert( someObject.fire( 'someEvent' ) ); // "true"
- */
diff --git a/lib/ckeditor/_source/core/focusmanager.js b/lib/ckeditor/_source/core/focusmanager.js
deleted file mode 100644
index 933c3cf..0000000
--- a/lib/ckeditor/_source/core/focusmanager.js
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
-Copyright (c) 2003-2010, 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..
- */
-
-/**
- * Manages the focus activity in an editor instance. This class is to be used
- * mainly by UI elements coders when adding interface elements to CKEditor.
- * @constructor
- * @param {CKEDITOR.editor} editor The editor instance.
- * @example
- */
-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 =
-{
- /**
- * Indicates that the editor instance has the focus.
- *
- * This function is not used to set the focus in the editor. Use
- * {@link CKEDITOR.editor#focus} for it instead.
- * @example
- * var editor = CKEDITOR.instances.editor1;
- * editor.focusManager.focus();
- */
- 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' );
- }
- },
-
- /**
- * Indicates that the editor instance has lost the focus. 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;
- * editor.focusManager.blur();
- */
- blur : function()
- {
- var focusManager = this;
-
- if ( focusManager._.timer )
- clearTimeout( focusManager._.timer );
-
- focusManager._.timer = setTimeout(
- function()
- {
- delete focusManager._.timer;
- focusManager.forceBlur();
- }
- , 100 );
- },
-
- /**
- * Indicates 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;
- * editor.focusManager.forceBlur();
- */
- 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.
- */
-
-/**
- * Fired when the editor instance loses the input focus.
- * @name CKEDITOR.editor#blur
- * @event
- * @param {CKEDITOR.editor} editor The editor instance.
- */
diff --git a/lib/ckeditor/_source/core/htmlparser.js b/lib/ckeditor/_source/core/htmlparser.js
deleted file mode 100644
index ac1420d..0000000
--- a/lib/ckeditor/_source/core/htmlparser.js
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-/**
- * HTML text parser.
- * @constructor
- * @example
- */
-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.onText = 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();
- 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 ) );
- }
- };
-})();
diff --git a/lib/ckeditor/_source/core/htmlparser/basicwriter.js b/lib/ckeditor/_source/core/htmlparser/basicwriter.js
deleted file mode 100644
index 3a0231c..0000000
--- a/lib/ckeditor/_source/core/htmlparser/basicwriter.js
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
-Copyright (c) 2003-2010, 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( '' );
- },
-
- /**
- * 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;
- }
- }
-});
diff --git a/lib/ckeditor/_source/core/htmlparser/cdata.js b/lib/ckeditor/_source/core/htmlparser/cdata.js
deleted file mode 100644
index ff2f227..0000000
--- a/lib/ckeditor/_source/core/htmlparser/cdata.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-Copyright (c) 2003-2010, 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 );
- }
- };
-})();
diff --git a/lib/ckeditor/_source/core/htmlparser/comment.js b/lib/ckeditor/_source/core/htmlparser/comment.js
deleted file mode 100644
index 67830d9..0000000
--- a/lib/ckeditor/_source/core/htmlparser/comment.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-Copyright (c) 2003-2010, 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 );
- }
-};
diff --git a/lib/ckeditor/_source/core/htmlparser/element.js b/lib/ckeditor/_source/core/htmlparser/element.js
deleted file mode 100644
index 69bacda..0000000
--- a/lib/ckeditor/_source/core/htmlparser/element.js
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
-Copyright (c) 2003-2010, 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 || ( attributes = {} );
-
- /**
- * The nodes that are direct children of this element.
- * @type Array
- * @example
- */
- this.children = [];
-
- var tagName = attributes._cke_real_element_type || name;
-
- var dtd = CKEDITOR.dtd,
- isBlockLike = !!( dtd.$nonBodyContent[ tagName ] || dtd.$block[ tagName ] || dtd.$listItem[ tagName ] || dtd.$tableContent[ tagName ] || dtd.$nonEditable[ tagName ] || tagName == 'br' ),
- isEmpty = !!dtd.$empty[ name ];
-
- this.isEmpty = isEmpty;
- this.isUnknown = !dtd[ name ];
-
- /** @private */
- this._ =
- {
- isBlockLike : isBlockLike,
- hasInlineStarted : isEmpty || !isBlockLike
- };
-};
-
-(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() ).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 )
- {
- 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 );
-
- }
- };
-})();
diff --git a/lib/ckeditor/_source/core/htmlparser/filter.js b/lib/ckeditor/_source/core/htmlparser/filter.js
deleted file mode 100644
index 5d16292..0000000
--- a/lib/ckeditor/_source/core/htmlparser/filter.js
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
-Copyright (c) 2003-2010, 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();
- }
-};
-*/
diff --git a/lib/ckeditor/_source/core/htmlparser/fragment.js b/lib/ckeditor/_source/core/htmlparser/fragment.js
deleted file mode 100644
index 244e298..0000000
--- a/lib/ckeditor/_source/core/htmlparser/fragment.js
+++ /dev/null
@@ -1,496 +0,0 @@
-/*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-/**
- * A lightweight representation of an HTML DOM structure.
- * @constructor
- * @example
- */
-CKEDITOR.htmlParser.fragment = function()
-{
- /**
- * The nodes contained in the root of this fragment.
- * @type Array
- * @example
- * var fragment = CKEDITOR.htmlParser.fragment.fromHtml( 'Sample Text' );
- * alert( fragment.children.length ); "2"
- */
- this.children = [];
-
- /**
- * Get the fragment parent. Should always be null.
- * @type Object
- * @default null
- * @example
- */
- this.parent = null;
-
- /** @private */
- this._ =
- {
- isBlockLike : true,
- hasInlineStarted : false
- };
-};
-
-(function()
-{
- // Elements which the end tag is marked as optional in the HTML 4.01 DTD
- // (expect empty elements).
- var optionalClose = {colgroup:1,dd:1,dt:1,li:1,option:1,p:1,td:1,tfoot:1,th:1,thead:1,tr:1};
-
- // Block-level elements whose internal structure should be respected during
- // parser fixing.
- var nonBreakingBlocks = CKEDITOR.tools.extend(
- {table:1,ul:1,ol:1,dl:1},
- CKEDITOR.dtd.table, CKEDITOR.dtd.ul, CKEDITOR.dtd.ol, CKEDITOR.dtd.dl ),
- listBlocks = CKEDITOR.dtd.$list, listItems = CKEDITOR.dtd.$listItem;
-
- /**
- * Creates a {@link CKEDITOR.htmlParser.fragment} from an HTML string.
- * @param {String} fragmentHtml The HTML to be parsed, filling the fragment.
- * @param {Number} [fixForBody=false] Wrap body with specified element if needed.
- * @returns CKEDITOR.htmlParser.fragment The fragment created.
- * @example
- * var fragment = CKEDITOR.htmlParser.fragment.fromHtml( 'Sample Text' );
- * alert( fragment.children[0].name ); "b"
- * alert( fragment.children[1].value ); " Text"
- */
- CKEDITOR.htmlParser.fragment.fromHtml = function( fragmentHtml, fixForBody )
- {
- var parser = new CKEDITOR.htmlParser(),
- html = [],
- fragment = new CKEDITOR.htmlParser.fragment(),
- pendingInline = [],
- pendingBRs = [],
- currentNode = fragment,
- // Indicate we're inside a
element, spaces should be touched differently.
- inPre = false,
- returnPoint;
-
- function checkPending( newTagName )
- {
- var pendingBRsSent;
-
- if ( pendingInline.length > 0 )
- {
- for ( var i = 0 ; i < pendingInline.length ; i++ )
- {
- var pendingElement = pendingInline[ i ],
- pendingName = pendingElement.name,
- pendingDtd = CKEDITOR.dtd[ pendingName ],
- currentDtd = currentNode.name && CKEDITOR.dtd[ currentNode.name ];
-
- if ( ( !currentDtd || currentDtd[ pendingName ] ) && ( !newTagName || !pendingDtd || pendingDtd[ newTagName ] || !CKEDITOR.dtd[ newTagName ] ) )
- {
- if ( !pendingBRsSent )
- {
- sendPendingBRs();
- pendingBRsSent = 1;
- }
-
- // Get a clone for the pending element.
- pendingElement = pendingElement.clone();
-
- // Add it to the current node and make it the current,
- // so the new element will be added inside of it.
- pendingElement.parent = currentNode;
- currentNode = pendingElement;
-
- // Remove the pending element (back the index by one
- // to properly process the next entry).
- pendingInline.splice( i, 1 );
- i--;
- }
- }
- }
- }
-
- function sendPendingBRs()
- {
- while ( pendingBRs.length )
- currentNode.add( pendingBRs.shift() );
- }
-
- function addElement( element, target, enforceCurrent )
- {
- target = target || currentNode || fragment;
-
- // If the target is the fragment and this element can't go inside
- // body (if fixForBody).
- if ( fixForBody && !target.type )
- {
- var elementName, realElementName;
- if ( element.attributes
- && ( realElementName =
- element.attributes[ '_cke_real_element_type' ] ) )
- elementName = realElementName;
- else
- elementName = element.name;
- if ( elementName
- && !( elementName in CKEDITOR.dtd.$body )
- && !( elementName in CKEDITOR.dtd.$nonBodyContent ) )
- {
- var savedCurrent = currentNode;
-
- // Create a
in the fragment.
- currentNode = target;
- parser.onTagOpen( fixForBody, {} );
-
- // The new target now is the
.
- target = currentNode;
-
- if ( enforceCurrent )
- currentNode = savedCurrent;
- }
- }
-
- // Rtrim empty spaces on block end boundary. (#3585)
- if ( element._.isBlockLike
- && element.name != 'pre' )
- {
-
- var length = element.children.length,
- lastChild = element.children[ length - 1 ],
- text;
- if ( lastChild && lastChild.type == CKEDITOR.NODE_TEXT )
- {
- if ( !( text = CKEDITOR.tools.rtrim( lastChild.value ) ) )
- element.children.length = length -1;
- else
- lastChild.value = text;
- }
- }
-
- target.add( element );
-
- if ( element.returnPoint )
- {
- currentNode = element.returnPoint;
- delete element.returnPoint;
- }
- }
-
- parser.onTagOpen = function( tagName, attributes, selfClosing )
- {
- var element = new CKEDITOR.htmlParser.element( tagName, attributes );
-
- // "isEmpty" will be always "false" for unknown elements, so we
- // must force it if the parser has identified it as a selfClosing tag.
- if ( element.isUnknown && selfClosing )
- element.isEmpty = true;
-
- // This is a tag to be removed if empty, so do not add it immediately.
- if ( CKEDITOR.dtd.$removeEmpty[ tagName ] )
- {
- pendingInline.push( element );
- return;
- }
- else if ( tagName == 'pre' )
- inPre = true;
- else if ( tagName == 'br' && inPre )
- {
- currentNode.add( new CKEDITOR.htmlParser.text( '\n' ) );
- return;
- }
-
- if ( tagName == 'br' )
- {
- pendingBRs.push( element );
- return;
- }
-
- var currentName = currentNode.name;
-
- var currentDtd = currentName
- && ( CKEDITOR.dtd[ currentName ]
- || ( currentNode._.isBlockLike ? CKEDITOR.dtd.div : CKEDITOR.dtd.span ) );
-
- // If the element cannot be child of the current element.
- if ( currentDtd // Fragment could receive any elements.
- && !element.isUnknown && !currentNode.isUnknown && !currentDtd[ tagName ] )
- {
-
- var reApply = false,
- addPoint; // New position to start adding nodes.
-
- // Fixing malformed nested lists by moving it into a previous list item. (#3828)
- if ( tagName in listBlocks
- && currentName in listBlocks )
- {
- var children = currentNode.children,
- lastChild = children[ children.length - 1 ];
-
- // Establish the list item if it's not existed.
- if ( !( lastChild && lastChild.name in listItems ) )
- addElement( ( lastChild = new CKEDITOR.htmlParser.element( 'li' ) ), currentNode );
-
- returnPoint = currentNode, addPoint = lastChild;
- }
- // If the element name is the same as the current element name,
- // then just close the current one and append the new one to the
- // parent. This situation usually happens with
,
,
and
- //
, specially in IE. Do not enter in this if block in this case.
- else if ( tagName == currentName )
- {
- addElement( currentNode, currentNode.parent );
- }
- else
- {
- if ( nonBreakingBlocks[ currentName ] )
- {
- if ( !returnPoint )
- returnPoint = currentNode;
- }
- else
- {
- addElement( currentNode, currentNode.parent, true );
-
- if ( !optionalClose[ currentName ] )
- {
- // The current element is an inline element, which
- // cannot hold the new one. Put it in the pending list,
- // and try adding the new one after it.
- pendingInline.unshift( currentNode );
- }
- }
-
- reApply = true;
- }
-
- if ( addPoint )
- currentNode = addPoint;
- // Try adding it to the return point, or the parent element.
- else
- currentNode = currentNode.returnPoint || currentNode.parent;
-
- if ( reApply )
- {
- parser.onTagOpen.apply( this, arguments );
- return;
- }
- }
-
- checkPending( tagName );
- sendPendingBRs();
-
- element.parent = currentNode;
- element.returnPoint = returnPoint;
- returnPoint = 0;
-
- if ( element.isEmpty )
- addElement( element );
- else
- currentNode = element;
- };
-
- parser.onTagClose = function( tagName )
- {
- // Check if there is any pending tag to be closed.
- for ( var i = pendingInline.length - 1 ; i >= 0 ; i-- )
- {
- // If found, just remove it from the list.
- if ( tagName == pendingInline[ i ].name )
- {
- pendingInline.splice( i, 1 );
- return;
- }
- }
-
- var pendingAdd = [],
- newPendingInline = [],
- candidate = currentNode;
-
- while ( candidate.type && candidate.name != tagName )
- {
- // If this is an inline element, add it to the pending list, if we're
- // really closing one of the parents element later, they will continue
- // after it.
- if ( !candidate._.isBlockLike )
- newPendingInline.unshift( candidate );
-
- // This node should be added to it's parent at this point. But,
- // it should happen only if the closing tag is really closing
- // one of the nodes. So, for now, we just cache it.
- pendingAdd.push( candidate );
-
- candidate = candidate.parent;
- }
-
- if ( candidate.type )
- {
- // Add all elements that have been found in the above loop.
- for ( i = 0 ; i < pendingAdd.length ; i++ )
- {
- var node = pendingAdd[ i ];
- addElement( node, node.parent );
- }
-
- currentNode = candidate;
-
- if ( currentNode.name == 'pre' )
- inPre = false;
-
- if ( candidate._.isBlockLike )
- sendPendingBRs();
-
- addElement( candidate, candidate.parent );
-
- // The parent should start receiving new nodes now, except if
- // addElement changed the currentNode.
- if ( candidate == currentNode )
- currentNode = currentNode.parent;
-
- pendingInline = pendingInline.concat( newPendingInline );
- }
-
- if ( tagName == 'body' )
- fixForBody = false;
- };
-
- parser.onText = function( text )
- {
- // Trim empty spaces at beginning of element contents except
.
- if ( !currentNode._.hasInlineStarted && !inPre )
- {
- text = CKEDITOR.tools.ltrim( text );
-
- if ( text.length === 0 )
- return;
- }
-
- sendPendingBRs();
- checkPending();
-
- if ( fixForBody
- && ( !currentNode.type || currentNode.name == 'body' )
- && CKEDITOR.tools.trim( text ) )
- {
- this.onTagOpen( fixForBody, {} );
- }
-
- // Shrinking consequential spaces into one single for all elements
- // text contents.
- if ( !inPre )
- text = text.replace( /[\t\r\n ]{2,}|[\t\r\n]/g, ' ' );
-
- currentNode.add( new CKEDITOR.htmlParser.text( text ) );
- };
-
- parser.onCDATA = function( cdata )
- {
- currentNode.add( new CKEDITOR.htmlParser.cdata( cdata ) );
- };
-
- parser.onComment = function( comment )
- {
- currentNode.add( new CKEDITOR.htmlParser.comment( comment ) );
- };
-
- // Parse it.
- parser.parse( fragmentHtml );
-
- sendPendingBRs();
-
- // Close all pending nodes.
- while ( currentNode.type )
- {
- var parent = currentNode.parent,
- node = currentNode;
-
- if ( fixForBody
- && ( !parent.type || parent.name == 'body' )
- && !CKEDITOR.dtd.$body[ node.name ] )
- {
- currentNode = parent;
- parser.onTagOpen( fixForBody, {} );
- parent = currentNode;
- }
-
- parent.add( node );
- currentNode = parent;
- }
-
- return fragment;
- };
-
- CKEDITOR.htmlParser.fragment.prototype =
- {
- /**
- * Adds a node to this fragment.
- * @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}.
- * @example
- */
- add : function( node )
- {
- var len = this.children.length,
- previous = len > 0 && this.children[ len - 1 ] || null;
-
- if ( previous )
- {
- // If the block to be appended is following text, trim spaces at
- // the right of it.
- if ( node._.isBlockLike && previous.type == CKEDITOR.NODE_TEXT )
- {
- previous.value = CKEDITOR.tools.rtrim( previous.value );
-
- // If we have completely cleared the previous node.
- if ( previous.value.length === 0 )
- {
- // Remove it from the list and add the node again.
- this.children.pop();
- this.add( node );
- return;
- }
- }
-
- previous.next = node;
- }
-
- node.previous = previous;
- node.parent = this;
-
- this.children.push( node );
-
- this._.hasInlineStarted = node.type == CKEDITOR.NODE_TEXT || ( node.type == CKEDITOR.NODE_ELEMENT && !node._.isBlockLike );
- },
-
- /**
- * Writes the fragment HTML to a CKEDITOR.htmlWriter.
- * @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
- * @example
- * var writer = new CKEDITOR.htmlWriter();
- * var fragment = CKEDITOR.htmlParser.fragment.fromHtml( '<P><B>Example' );
- * fragment.writeHtml( writer )
- * alert( writer.getHtml() ); "<p><b>Example</b></p>"
- */
- writeHtml : function( writer, filter )
- {
- var isChildrenFiltered;
- this.filterChildren = function()
- {
- var writer = new CKEDITOR.htmlParser.basicWriter();
- this.writeChildrenHtml.call( this, writer, filter, true );
- var html = writer.getHtml();
- this.children = new CKEDITOR.htmlParser.fragment.fromHtml( html ).children;
- isChildrenFiltered = 1;
- };
-
- // Filtering the root fragment before anything else.
- !this.name && filter && filter.onFragment( this );
-
- this.writeChildrenHtml( writer, isChildrenFiltered ? null : filter );
- },
-
- writeChildrenHtml : function( writer, filter )
- {
- for ( var i = 0 ; i < this.children.length ; i++ )
- this.children[i].writeHtml( writer, filter );
- }
- };
-})();
diff --git a/lib/ckeditor/_source/core/htmlparser/text.js b/lib/ckeditor/_source/core/htmlparser/text.js
deleted file mode 100644
index 0d63ac9..0000000
--- a/lib/ckeditor/_source/core/htmlparser/text.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-(function()
-{
- var spacesRegex = /[\t\r\n ]{2,}|[\t\r\n]/g;
-
- /**
- * 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 );
- }
- };
-})();
diff --git a/lib/ckeditor/_source/core/imagecacher.js b/lib/ckeditor/_source/core/imagecacher.js
deleted file mode 100644
index 0704556..0000000
--- a/lib/ckeditor/_source/core/imagecacher.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-(function()
-{
- var loaded = {};
-
- var loadImage = function( image, callback )
- {
- var doCallback = function()
- {
- img.removeAllListeners();
- loaded[ image ] = 1;
- callback();
- };
-
- var img = new CKEDITOR.dom.element( 'img' );
- img.on( 'load', doCallback );
- img.on( 'error', doCallback );
- img.setAttribute( 'src', image );
- };
-
- /**
- * Load images into the browser cache.
- * @namespace
- * @example
- */
- CKEDITOR.imageCacher =
- {
- /**
- * Loads one or more images.
- * @param {Array} images The URLs for the images to be loaded.
- * @param {Function} callback The function to be called once all images
- * are loaded.
- */
- load : function( images, callback )
- {
- var pendingCount = images.length;
-
- var checkPending = function()
- {
- if ( --pendingCount === 0 )
- callback();
- };
-
- for ( var i = 0 ; i < images.length ; i++ )
- {
- var image = images[ i ];
-
- if ( loaded[ image ] )
- checkPending();
- else
- loadImage( image, checkPending );
- }
- }
- };
-})();
diff --git a/lib/ckeditor/_source/core/lang.js b/lib/ckeditor/_source/core/lang.js
deleted file mode 100644
index add9982..0000000
--- a/lib/ckeditor/_source/core/lang.js
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-(function()
-{
- var loadedLangs = {};
-
- 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,
- '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 "autoDetect" is set to true, this language will be
- * used as the default one, if the detect language is not
- * available in the core.
- * @param {Boolean} autoDetect Indicates that the function must try to
- * detect the user language and load it instead.
- * @param {Function} callback The 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.
- * @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;
-
- 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;
- }
- };
-
-})();
diff --git a/lib/ckeditor/_source/core/loader.js b/lib/ckeditor/_source/core/loader.js
deleted file mode 100644
index 4b3a1aa..0000000
--- a/lib/ckeditor/_source/core/loader.js
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
-Copyright (c) 2003-2010, 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/range' ],
- 'core/ajax' : [ 'core/xml' ],
- '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/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/imagecacher' : [ 'core/dom/element' ],
- 'core/lang' : [],
- 'core/plugins' : [ 'core/resourcemanager' ],
- 'core/resourcemanager' : [ 'core/scriptloader', 'core/tools' ],
- 'core/scriptloader' : [ 'core/dom/element', 'core/env' ],
- 'core/skins' : [ 'core/imagecacher', 'core/scriptloader' ],
- 'core/themes' : [ 'core/resourcemanager' ],
- 'core/tools' : [ 'core/env' ],
- 'core/ui' : [],
- 'core/xml' : [ 'core/env' ]
- };
-
- 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 ' +
- '';
-
- var iframe = CKEDITOR.dom.element.createFromHtml(
- '' );
-
- iframe.on( 'load', function( e )
- {
- e.removeListener();
- var doc = iframe.getFrameDocument().$;
- // Custom domain handling is needed after each document.open().
- doc.open();
- if ( isCustomDomain )
- doc.domain = document.domain;
- doc.write( htmlToLoad );
- doc.close();
- }, this );
-
- iframe.setStyles(
- {
- width : '346px',
- height : '130px',
- 'background-color' : 'white',
- border : '1px solid black'
- } );
- iframe.setCustomData( 'dialog', this );
-
- var field = this.getContentElement( 'general', 'editing_area' ),
- container = field.getElement();
- container.setHtml( '' );
- container.append( iframe );
-
- // IE need a redirect on focus to make
- // the cursor blinking inside iframe. (#5461)
- if ( CKEDITOR.env.ie )
- {
- var focusGrabber = CKEDITOR.dom.element.createFromHtml( '' );
- focusGrabber.on( 'focus', function()
- {
- iframe.$.contentWindow.focus();
- });
- container.append( focusGrabber );
-
- // Override focus handler on field.
- field.focus = function()
- {
- focusGrabber.focus();
- this.fire( 'focus' );
- };
- }
-
- field.getInputElement = function(){ return iframe; };
-
- // Force container to scale in IE.
- if ( CKEDITOR.env.ie )
- {
- container.setStyle( 'display', 'block' );
- container.setStyle( 'height', ( iframe.$.offsetHeight + 2 ) + 'px' );
- }
- },
-
- onHide : function()
- {
- if ( CKEDITOR.env.ie )
- this.getParentEditor().document.getBody().$.contentEditable = 'true';
- },
-
- onLoad : function()
- {
- if ( ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) && editor.lang.dir == 'rtl' )
- this.parts.contents.setStyle( 'overflow', 'hidden' );
- },
-
- onOk : function()
- {
- var container = this.getContentElement( 'general', 'editing_area' ).getElement(),
- iframe = container.getElementsByTag( 'iframe' ).getItem( 0 ),
- editor = this.getParentEditor(),
- html = iframe.$.contentWindow.document.body.innerHTML;
-
- setTimeout( function(){
- editor.fire( 'paste', { 'html' : html } );
- }, 0 );
-
- },
-
- contents : [
- {
- id : 'general',
- label : editor.lang.common.generalTab,
- elements : [
- {
- type : 'html',
- id : 'securityMsg',
- html : '
' + lang.securityMsg + '
'
- },
- {
- type : 'html',
- id : 'pasteMsg',
- html : '
'+lang.pasteMsg +'
'
- },
- {
- type : 'html',
- id : 'editing_area',
- style : 'width: 100%; height: 100%;',
- html : '',
- focus : function()
- {
- var win = this.getInputElement().$.contentWindow;
-
- // #3291 : JAWS needs the 500ms delay to detect that the editor iframe
- // iframe is no longer editable. So that it will put the focus into the
- // Paste from Word dialog's editable area instead.
- setTimeout( function()
- {
- win.focus();
- }, 500 );
- }
- }
- ]
- }
- ]
- };
-});
diff --git a/lib/ckeditor/_source/plugins/clipboard/plugin.js b/lib/ckeditor/_source/plugins/clipboard/plugin.js
deleted file mode 100644
index f3cb0c0..0000000
--- a/lib/ckeditor/_source/plugins/clipboard/plugin.js
+++ /dev/null
@@ -1,413 +0,0 @@
-/*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-/**
- * @file Clipboard support
- */
-
-(function()
-{
- // Tries to execute any of the paste, cut or copy commands in IE. Returns a
- // boolean indicating that the operation succeeded.
- var execIECommand = function( editor, command )
- {
- var doc = editor.document,
- body = doc.getBody();
-
- var enabled = false;
- var onExec = function()
- {
- enabled = true;
- };
-
- // The following seems to be the only reliable way to detect that
- // clipboard commands are enabled in IE. It will fire the
- // onpaste/oncut/oncopy events only if the security settings allowed
- // the command to execute.
- body.on( command, onExec );
-
- // IE6/7: document.execCommand has problem to paste into positioned element.
- ( CKEDITOR.env.version > 7 ? doc.$ : doc.$.selection.createRange() ) [ 'execCommand' ]( command );
-
- body.removeListener( command, onExec );
-
- return enabled;
- };
-
- // Attempts to execute the Cut and Copy operations.
- var tryToCutCopy =
- CKEDITOR.env.ie ?
- function( editor, type )
- {
- return execIECommand( editor, type );
- }
- : // !IE.
- function( editor, type )
- {
- try
- {
- // Other browsers throw an error if the command is disabled.
- return editor.document.$.execCommand( type );
- }
- catch( e )
- {
- return false;
- }
- };
-
- // A class that represents one of the cut or copy commands.
- var cutCopyCmd = function( type )
- {
- this.type = type;
- this.canUndo = ( this.type == 'cut' ); // We can't undo copy to clipboard.
- };
-
- cutCopyCmd.prototype =
- {
- exec : function( editor, data )
- {
- this.type == 'cut' && fixCut( editor );
-
- var success = tryToCutCopy( editor, this.type );
-
- if ( !success )
- alert( editor.lang.clipboard[ this.type + 'Error' ] ); // Show cutError or copyError.
-
- return success;
- }
- };
-
- // Paste command.
- var pasteCmd =
- {
- canUndo : false,
-
- exec :
- CKEDITOR.env.ie ?
- function( editor )
- {
- // Prevent IE from pasting at the begining of the document.
- editor.focus();
-
- if ( !editor.document.getBody().fire( 'beforepaste' )
- && !execIECommand( editor, 'paste' ) )
- {
- editor.fire( 'pasteDialog' );
- return false;
- }
- }
- :
- function( editor )
- {
- try
- {
- if ( !editor.document.getBody().fire( 'beforepaste' )
- && !editor.document.$.execCommand( 'Paste', false, null ) )
- {
- throw 0;
- }
- }
- catch ( e )
- {
- setTimeout( function()
- {
- editor.fire( 'pasteDialog' );
- }, 0 );
- return false;
- }
- }
- };
-
- // Listens for some clipboard related keystrokes, so they get customized.
- var onKey = function( event )
- {
- if ( this.mode != 'wysiwyg' )
- return;
-
- switch ( event.data.keyCode )
- {
- // Paste
- case CKEDITOR.CTRL + 86 : // CTRL+V
- case CKEDITOR.SHIFT + 45 : // SHIFT+INS
-
- var body = this.document.getBody();
-
- // Simulate 'beforepaste' event for all none-IEs.
- if ( !CKEDITOR.env.ie && body.fire( 'beforepaste' ) )
- event.cancel();
- // Simulate 'paste' event for Opera/Firefox2.
- else if ( CKEDITOR.env.opera
- || CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 )
- body.fire( 'paste' );
- return;
-
- // Cut
- case CKEDITOR.CTRL + 88 : // CTRL+X
- case CKEDITOR.SHIFT + 46 : // SHIFT+DEL
-
- // Save Undo snapshot.
- var editor = this;
- this.fire( 'saveSnapshot' ); // Save before paste
- setTimeout( function()
- {
- editor.fire( 'saveSnapshot' ); // Save after paste
- }, 0 );
- }
- };
-
- // Allow to peek clipboard content by redirecting the
- // pasting content into a temporary bin and grab the content of it.
- function getClipboardData( evt, mode, callback )
- {
- var doc = this.document;
-
- // Avoid recursions on 'paste' event for IE.
- if ( CKEDITOR.env.ie && doc.getById( 'cke_pastebin' ) )
- return;
-
- // If the browser supports it, get the data directly
- if (mode == 'text' && evt.data && evt.data.$.clipboardData)
- {
- // evt.data.$.clipboardData.types contains all the flavours in Mac's Safari, but not on windows.
- var plain = evt.data.$.clipboardData.getData( 'text/plain' );
- if (plain)
- {
- evt.data.preventDefault();
- callback( plain );
- return;
- }
- }
-
- var sel = this.getSelection(),
- range = new CKEDITOR.dom.range( doc );
-
- // Create container to paste into
- var pastebin = new CKEDITOR.dom.element( mode == 'text' ? 'textarea' : CKEDITOR.env.webkit ? 'body' : 'div', doc );
- pastebin.setAttribute( 'id', 'cke_pastebin' );
- // Safari requires a filler node inside the div to have the content pasted into it. (#4882)
- CKEDITOR.env.webkit && pastebin.append( doc.createText( '\xa0' ) );
- doc.getBody().append( pastebin );
-
- pastebin.setStyles(
- {
- position : 'absolute',
- // Position the bin exactly at the position of the selected element
- // to avoid any subsequent document scroll.
- top : sel.getStartElement().getDocumentPosition().y + 'px',
- width : '1px',
- height : '1px',
- overflow : 'hidden'
- });
-
- // It's definitely a better user experience if we make the paste-bin pretty unnoticed
- // by pulling it off the screen.
- pastebin.setStyle( this.config.contentsLangDirection == 'ltr' ? 'left' : 'right', '-1000px' );
-
- var bms = sel.createBookmarks();
-
- // Turn off design mode temporarily before give focus to the paste bin.
- if ( mode == 'text' )
- {
- if ( CKEDITOR.env.ie )
- {
- var ieRange = doc.getBody().$.createTextRange();
- ieRange.moveToElementText( pastebin.$ );
- ieRange.execCommand( 'Paste' );
- evt.data.preventDefault();
- }
- else
- {
- doc.$.designMode = 'off';
- pastebin.$.focus();
- }
- }
- else
- {
- range.setStartAt( pastebin, CKEDITOR.POSITION_AFTER_START );
- range.setEndAt( pastebin, CKEDITOR.POSITION_BEFORE_END );
- range.select( true );
- }
-
- // Wait a while and grab the pasted contents
- window.setTimeout( function()
- {
- mode == 'text' && !CKEDITOR.env.ie && ( doc.$.designMode = 'on' );
- pastebin.remove();
-
- // Grab the HTML contents.
- // We need to look for a apple style wrapper on webkit it also adds
- // a div wrapper if you copy/paste the body of the editor.
- // Remove hidden div and restore selection.
- var bogusSpan;
- pastebin = ( CKEDITOR.env.webkit
- && ( bogusSpan = pastebin.getFirst() )
- && ( bogusSpan.is && bogusSpan.hasClass( 'Apple-style-span' ) ) ?
- bogusSpan : pastebin );
-
- sel.selectBookmarks( bms );
- callback( pastebin[ 'get' + ( mode == 'text' ? 'Value' : 'Html' ) ]() );
- }, 0 );
- }
-
- // Cutting off control type element in IE standards breaks the selection entirely. (#4881)
- function fixCut( editor )
- {
- if ( !CKEDITOR.env.ie || editor.document.$.compatMode == 'BackCompat' )
- return;
-
- var sel = editor.getSelection();
- var control;
- if( ( sel.getType() == CKEDITOR.SELECTION_ELEMENT ) && ( control = sel.getSelectedElement() ) )
- {
- var range = sel.getRanges()[ 0 ];
- var dummy = editor.document.createText( '' );
- dummy.insertBefore( control );
- range.setStartBefore( dummy );
- range.setEndAfter( control );
- sel.selectRanges( [ range ] );
-
- // Clear up the fix if the paste wasn't succeeded.
- setTimeout( function()
- {
- // Element still online?
- if ( control.getParent() )
- {
- dummy.remove();
- sel.selectElement( control );
- }
- }, 0 );
- }
- }
-
- // Register the plugin.
- CKEDITOR.plugins.add( 'clipboard',
- {
- requires : [ 'dialog', 'htmldataprocessor' ],
- init : function( editor )
- {
- // Inserts processed data into the editor at the end of the
- // events chain.
- editor.on( 'paste', function( evt )
- {
- var data = evt.data;
- if ( data[ 'html' ] )
- editor.insertHtml( data[ 'html' ] );
- else if ( data[ 'text' ] )
- editor.insertText( data[ 'text' ] );
-
- }, null, null, 1000 );
-
- editor.on( 'pasteDialog', function( evt )
- {
- setTimeout( function()
- {
- // Open default paste dialog.
- editor.openDialog( 'paste' );
- }, 0 );
- });
-
- function addButtonCommand( buttonName, commandName, command, ctxMenuOrder )
- {
- var lang = editor.lang[ commandName ];
-
- editor.addCommand( commandName, command );
- editor.ui.addButton( buttonName,
- {
- label : lang,
- command : commandName
- });
-
- // If the "menu" plugin is loaded, register the menu item.
- if ( editor.addMenuItems )
- {
- editor.addMenuItem( commandName,
- {
- label : lang,
- command : commandName,
- group : 'clipboard',
- order : ctxMenuOrder
- });
- }
- }
-
- addButtonCommand( 'Cut', 'cut', new cutCopyCmd( 'cut' ), 1 );
- addButtonCommand( 'Copy', 'copy', new cutCopyCmd( 'copy' ), 4 );
- addButtonCommand( 'Paste', 'paste', pasteCmd, 8 );
-
- CKEDITOR.dialog.add( 'paste', CKEDITOR.getUrl( this.path + 'dialogs/paste.js' ) );
-
- editor.on( 'key', onKey, editor );
-
- var mode = editor.config.forcePasteAsPlainText ? 'text' : 'html';
-
- // We'll be catching all pasted content in one line, regardless of whether the
- // it's introduced by a document command execution (e.g. toolbar buttons) or
- // user paste behaviors. (e.g. Ctrl-V)
- editor.on( 'contentDom', function()
- {
- var body = editor.document.getBody();
- body.on( ( (mode == 'text' && CKEDITOR.env.ie) || CKEDITOR.env.webkit ) ? 'paste' : 'beforepaste',
- function( evt )
- {
- if ( depressBeforeEvent )
- return;
-
- getClipboardData.call( editor, evt, mode, function ( data )
- {
- // The very last guard to make sure the
- // paste has successfully happened.
- if ( !data )
- return;
-
- var dataTransfer = {};
- dataTransfer[ mode ] = data;
- editor.fire( 'paste', dataTransfer );
- } );
- });
-
- body.on( 'beforecut', function() { !depressBeforeEvent && fixCut( editor ); } );
- });
-
- // If the "contextmenu" plugin is loaded, register the listeners.
- if ( editor.contextMenu )
- {
- var depressBeforeEvent;
- function stateFromNamedCommand( command )
- {
- // IE Bug: queryCommandEnabled('paste') fires also 'beforepaste(copy/cut)',
- // guard to distinguish from the ordinary sources( either
- // keyboard paste or execCommand ) (#4874).
- CKEDITOR.env.ie && ( depressBeforeEvent = 1 );
-
- var retval = editor.document.$.queryCommandEnabled( command ) ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED;
- depressBeforeEvent = 0;
- return retval;
- }
-
- editor.contextMenu.addListener( function()
- {
- return {
- cut : stateFromNamedCommand( 'Cut' ),
-
- // Browser bug: 'Cut' has the correct states for both Copy and Cut.
- copy : stateFromNamedCommand( 'Cut' ),
- paste : CKEDITOR.env.webkit ? CKEDITOR.TRISTATE_OFF : stateFromNamedCommand( 'Paste' )
- };
- });
- }
- }
- });
-})();
-
-/**
- * Fired when a clipboard operation is about to be taken into the editor.
- * Listeners can manipulate the data to be pasted before having it effectively
- * inserted into the document.
- * @name CKEDITOR.editor#paste
- * @since 3.1
- * @event
- * @param {String} [data.html] The HTML data to be pasted. If not available, e.data.text will be defined.
- * @param {String} [data.text] The plain text data to be pasted, available when plain text operations are to used. If not available, e.data.html will be defined.
- */
diff --git a/lib/ckeditor/_source/plugins/colorbutton/plugin.js b/lib/ckeditor/_source/plugins/colorbutton/plugin.js
deleted file mode 100644
index f2a8f2b..0000000
--- a/lib/ckeditor/_source/plugins/colorbutton/plugin.js
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-CKEDITOR.plugins.add( 'colorbutton',
-{
- requires : [ 'panelbutton', 'floatpanel', 'styles' ],
-
- init : function( editor )
- {
- var config = editor.config,
- lang = editor.lang.colorButton;
-
- var clickFn;
-
- if ( !CKEDITOR.env.hc )
- {
- addButton( 'TextColor', 'fore', lang.textColorTitle );
- addButton( 'BGColor', 'back', lang.bgColorTitle );
- }
-
- function addButton( name, type, title )
- {
- editor.ui.add( name, CKEDITOR.UI_PANELBUTTON,
- {
- label : title,
- title : title,
- className : 'cke_button_' + name.toLowerCase(),
- modes : { wysiwyg : 1 },
-
- panel :
- {
- css : editor.skin.editor.css,
- attributes : { role : 'listbox', 'aria-label' : lang.panelTitle }
- },
-
- onBlock : function( panel, block )
- {
- block.autoSize = true;
- block.element.addClass( 'cke_colorblock' );
- block.element.setHtml( renderColors( panel, type ) );
-
- var keys = block.keys;
- keys[ 39 ] = 'next'; // ARROW-RIGHT
- keys[ 40 ] = 'next'; // ARROW-DOWN
- keys[ 9 ] = 'next'; // TAB
- keys[ 37 ] = 'prev'; // ARROW-LEFT
- keys[ 38 ] = 'prev'; // ARROW-UP
- keys[ CKEDITOR.SHIFT + 9 ] = 'prev'; // SHIFT + TAB
- keys[ 32 ] = 'click'; // SPACE
- }
- });
- }
-
-
- function renderColors( panel, type )
- {
- var output = [],
- colors = config.colorButton_colors.split( ',' ),
- total = colors.length + ( config.colorButton_enableMore ? 2 : 1 );
-
- var clickFn = CKEDITOR.tools.addFunction( function( color, type )
- {
- if ( color == '?' )
- {
- var applyColorStyle = arguments.callee;
- function onColorDialogClose( evt )
- {
- this.removeListener( 'ok', onColorDialogClose );
- this.removeListener( 'cancel', onColorDialogClose );
-
- evt.name == 'ok' && applyColorStyle( this.getContentElement( 'picker', 'selectedColor' ).getValue(), type );
- }
-
- editor.openDialog( 'colordialog', function()
- {
- this.on( 'ok', onColorDialogClose );
- this.on( 'cancel', onColorDialogClose );
- } );
-
- return;
- }
-
- editor.focus();
-
- panel.hide();
-
-
- editor.fire( 'saveSnapshot' );
-
- // Clean up any conflicting style within the range.
- new CKEDITOR.style( config['colorButton_' + type + 'Style'], { color : 'inherit' } ).remove( editor.document );
-
- if ( color )
- {
- var colorStyle = config['colorButton_' + type + 'Style'];
-
- colorStyle.childRule = type == 'back' ?
- // It's better to apply background color as the innermost style. (#3599)
- function(){ return false; } :
- // Fore color style must be applied inside links instead of around it.
- function( element ){ return element.getName() != 'a'; };
-
- new CKEDITOR.style( colorStyle, { color : color } ).apply( editor.document );
- }
-
- editor.fire( 'saveSnapshot' );
- });
-
- // Render the "Automatic" button.
- output.push(
- '' +
- '
' +
- '
' +
- '
' +
- '' +
- '
' +
- '
',
- lang.auto,
- '
' +
- '
' +
- '
' +
- '' +
- '
' );
-
- // Render the color boxes.
- for ( var i = 0 ; i < colors.length ; i++ )
- {
- if ( ( i % 8 ) === 0 )
- output.push( '
' );
-
- var parts = colors[ i ].split( '/' ),
- colorName = parts[ 0 ],
- colorCode = parts[ 1 ] || colorName;
-
- // The data can be only a color code (without #) or colorName + color code
- // If only a color code is provided, then the colorName is the color with the hash
- // Convert the color from RGB to RRGGBB for better compatibility with IE and . See #5676
- if (!parts[1])
- colorName = '#' + colorName.replace( /^(.)(.)(.)$/, '$1$1$2$2$3$3' );
-
- var colorLabel = editor.lang.colors[ colorCode ] || colorCode;
- output.push(
- '
id (Required) The id of the UI element. See {@link
- * CKEDITOR.dialog#getContentElement}
- *
type (Required) The type of the UI element. The
- * value to this field specifies which UI element class will be used to
- * generate the final widget.
- *
title (Optional) The popup tooltip for the UI
- * element.
- *
hidden (Optional) A flag that tells if the element
- * should be initially visible.
- *
className (Optional) Additional CSS class names
- * to add to the UI element. Separated by space.
- *
style (Optional) Additional CSS inline styles
- * to add to the UI element. A semicolon (;) is required after the last
- * style declaration.
- *
accessKey (Optional) The alphanumeric access key
- * for this element. Access keys are automatically prefixed by CTRL.
- *
on* (Optional) Any UI element definition field that
- * starts with on followed immediately by a capital letter and
- * probably more letters is an event handler. Event handlers may be further
- * divided into registered event handlers and DOM event handlers. Please
- * refer to {@link CKEDITOR.ui.dialog.uiElement#registerEvents} and
- * {@link CKEDITOR.ui.dialog.uiElement#eventProcessors} for more
- * information.
- *
- * @param {Array} htmlList
- * List of HTML code to be added to the dialog's content area.
- * @param {Function|String} nodeNameArg
- * A function returning a string, or a simple string for the node name for
- * the root DOM node. Default is 'div'.
- * @param {Function|Object} stylesArg
- * A function returning an object, or a simple object for CSS styles applied
- * to the DOM node. Default is empty object.
- * @param {Function|Object} attributesArg
- * A fucntion returning an object, or a simple object for attributes applied
- * to the DOM node. Default is empty object.
- * @param {Function|String} contentsArg
- * A function returning a string, or a simple string for the HTML code inside
- * the root DOM node. Default is empty string.
- * @example
- */
- uiElement : function( dialog, elementDefinition, htmlList, nodeNameArg, stylesArg, attributesArg, contentsArg )
- {
- if ( arguments.length < 4 )
- return;
-
- var nodeName = ( nodeNameArg.call ? nodeNameArg( elementDefinition ) : nodeNameArg ) || 'div',
- html = [ '<', nodeName, ' ' ],
- styles = ( stylesArg && stylesArg.call ? stylesArg( elementDefinition ) : stylesArg ) || {},
- attributes = ( attributesArg && attributesArg.call ? attributesArg( elementDefinition ) : attributesArg ) || {},
- innerHTML = ( contentsArg && contentsArg.call ? contentsArg.call( this, dialog, elementDefinition ) : contentsArg ) || '',
- domId = this.domId = attributes.id || CKEDITOR.tools.getNextNumber() + '_uiElement',
- id = this.id = elementDefinition.id,
- i;
-
- // Set the id, a unique id is required for getElement() to work.
- attributes.id = domId;
-
- // Set the type and definition CSS class names.
- var classes = {};
- if ( elementDefinition.type )
- classes[ 'cke_dialog_ui_' + elementDefinition.type ] = 1;
- if ( elementDefinition.className )
- classes[ elementDefinition.className ] = 1;
- var attributeClasses = ( attributes['class'] && attributes['class'].split ) ? attributes['class'].split( ' ' ) : [];
- for ( i = 0 ; i < attributeClasses.length ; i++ )
- {
- if ( attributeClasses[i] )
- classes[ attributeClasses[i] ] = 1;
- }
- var finalClasses = [];
- for ( i in classes )
- finalClasses.push( i );
- attributes['class'] = finalClasses.join( ' ' );
-
- // Set the popup tooltop.
- if ( elementDefinition.title )
- attributes.title = elementDefinition.title;
-
- // Write the inline CSS styles.
- var styleStr = ( elementDefinition.style || '' ).split( ';' );
- for ( i in styles )
- styleStr.push( i + ':' + styles[i] );
- if ( elementDefinition.hidden )
- styleStr.push( 'display:none' );
- for ( i = styleStr.length - 1 ; i >= 0 ; i-- )
- {
- if ( styleStr[i] === '' )
- styleStr.splice( i, 1 );
- }
- if ( styleStr.length > 0 )
- attributes.style = ( attributes.style ? ( attributes.style + '; ' ) : '' ) + styleStr.join( '; ' );
-
- // Write the attributes.
- for ( i in attributes )
- html.push( i + '="' + CKEDITOR.tools.htmlEncode( attributes[i] ) + '" ');
-
- // Write the content HTML.
- html.push( '>', innerHTML, '', nodeName, '>' );
-
- // Add contents to the parent HTML array.
- htmlList.push( html.join( '' ) );
-
- ( this._ || ( this._ = {} ) ).dialog = dialog;
-
- // Override isChanged if it is defined in element definition.
- if ( typeof( elementDefinition.isChanged ) == 'boolean' )
- this.isChanged = function(){ return elementDefinition.isChanged; };
- if ( typeof( elementDefinition.isChanged ) == 'function' )
- this.isChanged = elementDefinition.isChanged;
-
- // Add events.
- CKEDITOR.event.implementOn( this );
-
- this.registerEvents( elementDefinition );
- if ( this.accessKeyUp && this.accessKeyDown && elementDefinition.accessKey )
- registerAccessKey( this, dialog, 'CTRL+' + elementDefinition.accessKey );
-
- var me = this;
- dialog.on( 'load', function()
- {
- if ( me.getInputElement() )
- {
- me.getInputElement().on( 'focus', function()
- {
- dialog._.tabBarMode = false;
- dialog._.hasFocus = true;
- me.fire( 'focus' );
- }, me );
- }
- } );
-
- // Register the object as a tab focus if it can be included.
- if ( this.keyboardFocusable )
- {
- this.tabIndex = elementDefinition.tabIndex || 0;
-
- this.focusIndex = dialog._.focusList.push( this ) - 1;
- this.on( 'focus', function()
- {
- dialog._.currentFocusIndex = me.focusIndex;
- } );
- }
-
- // Completes this object with everything we have in the
- // definition.
- CKEDITOR.tools.extend( this, elementDefinition );
- },
-
- /**
- * Horizontal layout box for dialog UI elements, auto-expends to available width of container.
- * @constructor
- * @extends CKEDITOR.ui.dialog.uiElement
- * @param {CKEDITOR.dialog} dialog
- * Parent dialog object.
- * @param {Array} childObjList
- * Array of {@link CKEDITOR.ui.dialog.uiElement} objects inside this
- * container.
- * @param {Array} childHtmlList
- * Array of HTML code that correspond to the HTML output of all the
- * objects in childObjList.
- * @param {Array} htmlList
- * Array of HTML code that this element will output to.
- * @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition
- * The element definition. Accepted fields:
- *
- *
widths (Optional) The widths of child cells.
- *
height (Optional) The height of the layout.
- *
padding (Optional) The padding width inside child
- * cells.
- *
align (Optional) The alignment of the whole layout
- *
' );
- return html.join( '' );
- };
- CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition || { type : 'vbox' }, htmlList, 'div', null, { role : 'presentation' }, innerHTML );
- }
- };
- })();
-
- CKEDITOR.ui.dialog.uiElement.prototype =
- {
- /**
- * Gets the root DOM element of this dialog UI object.
- * @returns {CKEDITOR.dom.element} Root DOM element of UI object.
- * @example
- * uiElement.getElement().hide();
- */
- getElement : function()
- {
- return CKEDITOR.document.getById( this.domId );
- },
-
- /**
- * Gets the DOM element that the user inputs values.
- * This function is used by setValue(), getValue() and focus(). It should
- * be overrided in child classes where the input element isn't the root
- * element.
- * @returns {CKEDITOR.dom.element} The element where the user input values.
- * @example
- * var rawValue = textInput.getInputElement().$.value;
- */
- getInputElement : function()
- {
- return this.getElement();
- },
-
- /**
- * Gets the parent dialog object containing this UI element.
- * @returns {CKEDITOR.dialog} Parent dialog object.
- * @example
- * var dialog = uiElement.getDialog();
- */
- getDialog : function()
- {
- return this._.dialog;
- },
-
- /**
- * Sets the value of this dialog UI object.
- * @param {Object} value The new value.
- * @returns {CKEDITOR.dialog.uiElement} The current UI element.
- * @example
- * uiElement.setValue( 'Dingo' );
- */
- setValue : function( value )
- {
- this.getInputElement().setValue( value );
- this.fire( 'change', { value : value } );
- return this;
- },
-
- /**
- * Gets the current value of this dialog UI object.
- * @returns {Object} The current value.
- * @example
- * var myValue = uiElement.getValue();
- */
- getValue : function()
- {
- return this.getInputElement().getValue();
- },
-
- /**
- * Tells whether the UI object's value has changed.
- * @returns {Boolean} true if changed, false if not changed.
- * @example
- * if ( uiElement.isChanged() )
- * confirm( 'Value changed! Continue?' );
- */
- isChanged : function()
- {
- // Override in input classes.
- return false;
- },
-
- /**
- * Selects the parent tab of this element. Usually called by focus() or overridden focus() methods.
- * @returns {CKEDITOR.dialog.uiElement} The current UI element.
- * @example
- * focus : function()
- * {
- * this.selectParentTab();
- * // do something else.
- * }
- */
- selectParentTab : function()
- {
- var element = this.getInputElement(),
- cursor = element,
- tabId;
- while ( ( cursor = cursor.getParent() ) && cursor.$.className.search( 'cke_dialog_page_contents' ) == -1 )
- { /*jsl:pass*/ }
-
- // Some widgets don't have parent tabs (e.g. OK and Cancel buttons).
- if ( !cursor )
- return this;
-
- tabId = cursor.getAttribute( 'name' );
- // Avoid duplicate select.
- if ( this._.dialog._.currentTabId != tabId )
- this._.dialog.selectPage( tabId );
- return this;
- },
-
- /**
- * Puts the focus to the UI object. Switches tabs if the UI object isn't in the active tab page.
- * @returns {CKEDITOR.dialog.uiElement} The current UI element.
- * @example
- * uiElement.focus();
- */
- focus : function()
- {
- this.selectParentTab().getInputElement().focus();
- return this;
- },
-
- /**
- * Registers the on* event handlers defined in the element definition.
- * The default behavior of this function is:
- *
- *
- * If the on* event is defined in the class's eventProcesors list,
- * then the registration is delegated to the corresponding function
- * in the eventProcessors list.
- *
- *
- * If the on* event is not defined in the eventProcessors list, then
- * register the event handler under the corresponding DOM event of
- * the UI element's input DOM element (as defined by the return value
- * of {@link CKEDITOR.ui.dialog.uiElement#getInputElement}).
- *
- *
- * This function is only called at UI element instantiation, but can
- * be overridded in child classes if they require more flexibility.
- * @param {CKEDITOR.dialog.uiElementDefinition} definition The UI element
- * definition.
- * @returns {CKEDITOR.dialog.uiElement} The current UI element.
- * @example
- */
- registerEvents : function( definition )
- {
- var regex = /^on([A-Z]\w+)/,
- match;
-
- var registerDomEvent = function( uiElement, dialog, eventName, func )
- {
- dialog.on( 'load', function()
- {
- uiElement.getInputElement().on( eventName, func, uiElement );
- });
- };
-
- for ( var i in definition )
- {
- if ( !( match = i.match( regex ) ) )
- continue;
- if ( this.eventProcessors[i] )
- this.eventProcessors[i].call( this, this._.dialog, definition[i] );
- else
- registerDomEvent( this, this._.dialog, match[1].toLowerCase(), definition[i] );
- }
-
- return this;
- },
-
- /**
- * The event processor list used by
- * {@link CKEDITOR.ui.dialog.uiElement#getInputElement} at UI element
- * instantiation. The default list defines three on* events:
- *
- *
onLoad - Called when the element's parent dialog opens for the
- * first time
- *
onShow - Called whenever the element's parent dialog opens.
- *
onHide - Called whenever the element's parent dialog closes.
- *
- * @field
- * @type Object
- * @example
- * // This connects the 'click' event in CKEDITOR.ui.dialog.button to onClick
- * // handlers in the UI element's definitions.
- * CKEDITOR.ui.dialog.button.eventProcessors = CKEDITOR.tools.extend( {},
- * CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors,
- * { onClick : function( dialog, func ) { this.on( 'click', func ); } },
- * true );
- */
- eventProcessors :
- {
- onLoad : function( dialog, func )
- {
- dialog.on( 'load', func, this );
- },
-
- onShow : function( dialog, func )
- {
- dialog.on( 'show', func, this );
- },
-
- onHide : function( dialog, func )
- {
- dialog.on( 'hide', func, this );
- }
- },
-
- /**
- * The default handler for a UI element's access key down event, which
- * tries to put focus to the UI element.
- * Can be overridded in child classes for more sophisticaed behavior.
- * @param {CKEDITOR.dialog} dialog The parent dialog object.
- * @param {String} key The key combination pressed. Since access keys
- * are defined to always include the CTRL key, its value should always
- * include a 'CTRL+' prefix.
- * @example
- */
- accessKeyDown : function( dialog, key )
- {
- this.focus();
- },
-
- /**
- * The default handler for a UI element's access key up event, which
- * does nothing.
- * Can be overridded in child classes for more sophisticated behavior.
- * @param {CKEDITOR.dialog} dialog The parent dialog object.
- * @param {String} key The key combination pressed. Since access keys
- * are defined to always include the CTRL key, its value should always
- * include a 'CTRL+' prefix.
- * @example
- */
- accessKeyUp : function( dialog, key )
- {
- },
-
- /**
- * Disables a UI element.
- * @example
- */
- disable : function()
- {
- var element = this.getInputElement();
- element.setAttribute( 'disabled', 'true' );
- element.addClass( 'cke_disabled' );
- },
-
- /**
- * Enables a UI element.
- * @example
- */
- enable : function()
- {
- var element = this.getInputElement();
- element.removeAttribute( 'disabled' );
- element.removeClass( 'cke_disabled' );
- },
-
- /**
- * Determines whether an UI element is enabled or not.
- * @returns {Boolean} Whether the UI element is enabled.
- * @example
- */
- isEnabled : function()
- {
- return !this.getInputElement().getAttribute( 'disabled' );
- },
-
- /**
- * Determines whether an UI element is visible or not.
- * @returns {Boolean} Whether the UI element is visible.
- * @example
- */
- isVisible : function()
- {
- return this.getInputElement().isVisible();
- },
-
- /**
- * Determines whether an UI element is focus-able or not.
- * Focus-able is defined as being both visible and enabled.
- * @returns {Boolean} Whether the UI element can be focused.
- * @example
- */
- isFocusable : function()
- {
- if ( !this.isEnabled() || !this.isVisible() )
- return false;
- return true;
- }
- };
-
- CKEDITOR.ui.dialog.hbox.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement,
- /**
- * @lends CKEDITOR.ui.dialog.hbox.prototype
- */
- {
- /**
- * Gets a child UI element inside this container.
- * @param {Array|Number} indices An array or a single number to indicate the child's
- * position in the container's descendant tree. Omit to get all the children in an array.
- * @returns {Array|CKEDITOR.ui.dialog.uiElement} Array of all UI elements in the container
- * if no argument given, or the specified UI element if indices is given.
- * @example
- * var checkbox = hbox.getChild( [0,1] );
- * checkbox.setValue( true );
- */
- getChild : function( indices )
- {
- // If no arguments, return a clone of the children array.
- if ( arguments.length < 1 )
- return this._.children.concat();
-
- // If indices isn't array, make it one.
- if ( !indices.splice )
- indices = [ indices ];
-
- // Retrieve the child element according to tree position.
- if ( indices.length < 2 )
- return this._.children[ indices[0] ];
- else
- return ( this._.children[ indices[0] ] && this._.children[ indices[0] ].getChild ) ?
- this._.children[ indices[0] ].getChild( indices.slice( 1, indices.length ) ) :
- null;
- }
- }, true );
-
- CKEDITOR.ui.dialog.vbox.prototype = new CKEDITOR.ui.dialog.hbox();
-
-
-
- (function()
- {
- var commonBuilder = {
- build : function( dialog, elementDefinition, output )
- {
- var children = elementDefinition.children,
- child,
- childHtmlList = [],
- childObjList = [];
- for ( var i = 0 ; ( i < children.length && ( child = children[i] ) ) ; i++ )
- {
- var childHtml = [];
- childHtmlList.push( childHtml );
- childObjList.push( CKEDITOR.dialog._.uiElementBuilders[ child.type ].build( dialog, child, childHtml ) );
- }
- return new CKEDITOR.ui.dialog[elementDefinition.type]( dialog, childObjList, childHtmlList, output, elementDefinition );
- }
- };
-
- CKEDITOR.dialog.addUIElement( 'hbox', commonBuilder );
- CKEDITOR.dialog.addUIElement( 'vbox', commonBuilder );
- })();
-
- /**
- * Generic dialog command. It opens a specific dialog when executed.
- * @constructor
- * @augments CKEDITOR.commandDefinition
- * @param {string} dialogName The name of the dialog to open when executing
- * this command.
- * @example
- * // Register the "link" command, which opens the "link" dialog.
- * editor.addCommand( 'link', new CKEDITOR.dialogCommand( 'link' ) );
- */
- CKEDITOR.dialogCommand = function( dialogName )
- {
- this.dialogName = dialogName;
- };
-
- CKEDITOR.dialogCommand.prototype =
- {
- /** @ignore */
- exec : function( editor )
- {
- editor.openDialog( this.dialogName );
- },
-
- // Dialog commands just open a dialog ui, thus require no undo logic,
- // undo support should dedicate to specific dialog implementation.
- canUndo: false,
-
- editorFocus : CKEDITOR.env.ie || CKEDITOR.env.webkit
- };
-
- (function()
- {
- var notEmptyRegex = /^([a]|[^a])+$/,
- integerRegex = /^\d*$/,
- numberRegex = /^\d*(?:\.\d+)?$/;
-
- CKEDITOR.VALIDATE_OR = 1;
- CKEDITOR.VALIDATE_AND = 2;
-
- CKEDITOR.dialog.validate =
- {
- functions : function()
- {
- return function()
- {
- /**
- * It's important for validate functions to be able to accept the value
- * as argument in addition to this.getValue(), so that it is possible to
- * combine validate functions together to make more sophisticated
- * validators.
- */
- var value = this && this.getValue ? this.getValue() : arguments[0];
-
- var msg = undefined,
- relation = CKEDITOR.VALIDATE_AND,
- functions = [], i;
-
- for ( i = 0 ; i < arguments.length ; i++ )
- {
- if ( typeof( arguments[i] ) == 'function' )
- functions.push( arguments[i] );
- else
- break;
- }
-
- if ( i < arguments.length && typeof( arguments[i] ) == 'string' )
- {
- msg = arguments[i];
- i++;
- }
-
- if ( i < arguments.length && typeof( arguments[i]) == 'number' )
- relation = arguments[i];
-
- var passed = ( relation == CKEDITOR.VALIDATE_AND ? true : false );
- for ( i = 0 ; i < functions.length ; i++ )
- {
- if ( relation == CKEDITOR.VALIDATE_AND )
- passed = passed && functions[i]( value );
- else
- passed = passed || functions[i]( value );
- }
-
- if ( !passed )
- {
- if ( msg !== undefined )
- alert( msg );
- if ( this && ( this.select || this.focus ) )
- ( this.select || this.focus )();
- return false;
- }
-
- return true;
- };
- },
-
- regex : function( regex, msg )
- {
- /*
- * Can be greatly shortened by deriving from functions validator if code size
- * turns out to be more important than performance.
- */
- return function()
- {
- var value = this && this.getValue ? this.getValue() : arguments[0];
- if ( !regex.test( value ) )
- {
- if ( msg !== undefined )
- alert( msg );
- if ( this && ( this.select || this.focus ) )
- {
- if ( this.select )
- this.select();
- else
- this.focus();
- }
- return false;
- }
- return true;
- };
- },
-
- notEmpty : function( msg )
- {
- return this.regex( notEmptyRegex, msg );
- },
-
- integer : function( msg )
- {
- return this.regex( integerRegex, msg );
- },
-
- 'number' : function( msg )
- {
- return this.regex( numberRegex, msg );
- },
-
- equals : function( value, msg )
- {
- return this.functions( function( val ){ return val == value; }, msg );
- },
-
- notEqual : function( value, msg )
- {
- return this.functions( function( val ){ return val != value; }, msg );
- }
- };
-
- CKEDITOR.on( 'instanceDestroyed', function( evt )
- {
- // Remove dialog cover on last instance destroy.
- if ( CKEDITOR.tools.isEmpty( CKEDITOR.instances ) )
- {
- var currentTopDialog;
- while ( ( currentTopDialog = CKEDITOR.dialog._.currentTop ) )
- currentTopDialog.hide();
- removeCovers();
- }
-
- var dialogs = evt.editor._.storedDialogs;
- for ( var name in dialogs )
- dialogs[ name ].destroy();
-
- });
-
- })();
-})();
-
-// Extend the CKEDITOR.editor class with dialog specific functions.
-CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
- /** @lends CKEDITOR.editor.prototype */
- {
- /**
- * Loads and opens a registered dialog.
- * @param {String} dialogName The registered name of the dialog.
- * @param {Function} callback The function to be invoked after dialog instance created.
- * @see CKEDITOR.dialog.add
- * @example
- * CKEDITOR.instances.editor1.openDialog( 'smiley' );
- * @returns {CKEDITOR.dialog} The dialog object corresponding to the dialog displayed. null if the dialog name is not registered.
- */
- openDialog : function( dialogName, callback )
- {
- var dialogDefinitions = CKEDITOR.dialog._.dialogDefinitions[ dialogName ],
- dialogSkin = this.skin.dialog;
-
- // If the dialogDefinition is already loaded, open it immediately.
- if ( typeof dialogDefinitions == 'function' && dialogSkin._isLoaded )
- {
- var storedDialogs = this._.storedDialogs ||
- ( this._.storedDialogs = {} );
-
- var dialog = storedDialogs[ dialogName ] ||
- ( storedDialogs[ dialogName ] = new CKEDITOR.dialog( this, dialogName ) );
-
- callback && callback.call( dialog, dialog );
- dialog.show();
-
- return dialog;
- }
- else if ( dialogDefinitions == 'failed' )
- throw new Error( '[CKEDITOR.dialog.openDialog] Dialog "' + dialogName + '" failed when loading definition.' );
-
- // Not loaded? Load the .js file first.
- var body = CKEDITOR.document.getBody(),
- cursor = body.$.style.cursor,
- me = this;
-
- body.setStyle( 'cursor', 'wait' );
-
- function onDialogFileLoaded( success )
- {
- var dialogDefinition = CKEDITOR.dialog._.dialogDefinitions[ dialogName ],
- skin = me.skin.dialog;
-
- // Check if both skin part and definition is loaded.
- if ( !skin._isLoaded || loadDefinition && typeof success == 'undefined' )
- return;
-
- // In case of plugin error, mark it as loading failed.
- if ( typeof dialogDefinition != 'function' )
- CKEDITOR.dialog._.dialogDefinitions[ dialogName ] = 'failed';
-
- me.openDialog( dialogName, callback );
- body.setStyle( 'cursor', cursor );
- }
-
- if ( typeof dialogDefinitions == 'string' )
- {
- var loadDefinition = 1;
- CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( dialogDefinitions ), onDialogFileLoaded );
- }
-
- CKEDITOR.skins.load( this, 'dialog', onDialogFileLoaded );
-
- return null;
- }
- });
-
-CKEDITOR.plugins.add( 'dialog',
- {
- requires : [ 'dialogui' ]
- });
-
-// Dialog related configurations.
-
-/**
- * The color of the dialog background cover. It should be a valid CSS color
- * string.
- * @name CKEDITOR.config.dialog_backgroundCoverColor
- * @type String
- * @default 'white'
- * @example
- * config.dialog_backgroundCoverColor = 'rgb(255, 254, 253)';
- */
-
-/**
- * The opacity of the dialog background cover. It should be a number within the
- * range [0.0, 1.0].
- * @name CKEDITOR.config.dialog_backgroundCoverOpacity
- * @type Number
- * @default 0.5
- * @example
- * config.dialog_backgroundCoverOpacity = 0.7;
- */
-
-/**
- * If the dialog has more than one tab, put focus into the first tab as soon as dialog is opened.
- * @name CKEDITOR.config.dialog_startupFocusTab
- * @type Boolean
- * @default false
- * @example
- * config.dialog_startupFocusTab = true;
- */
-
-/**
- * The distance of magnetic borders used in moving and resizing dialogs,
- * measured in pixels.
- * @name CKEDITOR.config.dialog_magnetDistance
- * @type Number
- * @default 20
- * @example
- * config.dialog_magnetDistance = 30;
- */
-
-/**
- * Fired when a dialog definition is about to be used to create a dialog into
- * an editor instance. This event makes it possible to customize the definition
- * before creating it.
- *
Note that this event is called only the first time a specific dialog is
- * opened. Successive openings will use the cached dialog, and this event will
- * not get fired.
- * @name CKEDITOR#dialogDefinition
- * @event
- * @param {CKEDITOR.dialog.dialogDefinition} data The dialog defination that
- * is being loaded.
- * @param {CKEDITOR.editor} editor The editor instance that will use the
- * dialog.
- */
diff --git a/lib/ckeditor/_source/plugins/dialogui/plugin.js b/lib/ckeditor/_source/plugins/dialogui/plugin.js
deleted file mode 100644
index fc3a7f4..0000000
--- a/lib/ckeditor/_source/plugins/dialogui/plugin.js
+++ /dev/null
@@ -1,1415 +0,0 @@
-/*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-/** @fileoverview The "dialogui" plugin. */
-
-CKEDITOR.plugins.add( 'dialogui' );
-
-(function()
-{
- var initPrivateObject = function( elementDefinition )
- {
- this._ || ( this._ = {} );
- this._['default'] = this._.initValue = elementDefinition['default'] || '';
- this._.required = elementDefinition[ 'required' ] || false;
- var args = [ this._ ];
- for ( var i = 1 ; i < arguments.length ; i++ )
- args.push( arguments[i] );
- args.push( true );
- CKEDITOR.tools.extend.apply( CKEDITOR.tools, args );
- return this._;
- },
- textBuilder =
- {
- build : function( dialog, elementDefinition, output )
- {
- return new CKEDITOR.ui.dialog.textInput( dialog, elementDefinition, output );
- }
- },
- commonBuilder =
- {
- build : function( dialog, elementDefinition, output )
- {
- return new CKEDITOR.ui.dialog[elementDefinition.type]( dialog, elementDefinition, output );
- }
- },
- containerBuilder =
- {
- build : function( dialog, elementDefinition, output )
- {
- var children = elementDefinition.children,
- child,
- childHtmlList = [],
- childObjList = [];
- for ( var i = 0 ; ( i < children.length && ( child = children[i] ) ) ; i++ )
- {
- var childHtml = [];
- childHtmlList.push( childHtml );
- childObjList.push( CKEDITOR.dialog._.uiElementBuilders[ child.type ].build( dialog, child, childHtml ) );
- }
- return new CKEDITOR.ui.dialog[ elementDefinition.type ]( dialog, childObjList, childHtmlList, output, elementDefinition );
- }
- },
- commonPrototype =
- {
- isChanged : function()
- {
- return this.getValue() != this.getInitValue();
- },
-
- reset : function()
- {
- this.setValue( this.getInitValue() );
- },
-
- setInitValue : function()
- {
- this._.initValue = this.getValue();
- },
-
- resetInitValue : function()
- {
- this._.initValue = this._['default'];
- },
-
- getInitValue : function()
- {
- return this._.initValue;
- }
- },
- commonEventProcessors = CKEDITOR.tools.extend( {}, CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors,
- {
- onChange : function( dialog, func )
- {
- if ( !this._.domOnChangeRegistered )
- {
- dialog.on( 'load', function()
- {
- this.getInputElement().on( 'change', function()
- {
- // Make sure 'onchange' doesn't get fired after dialog closed. (#5719)
- if ( !dialog.parts.dialog.isVisible() )
- return;
-
- this.fire( 'change', { value : this.getValue() } );
- }, this );
- }, this );
- this._.domOnChangeRegistered = true;
- }
-
- this.on( 'change', func );
- }
- }, true ),
- eventRegex = /^on([A-Z]\w+)/,
- cleanInnerDefinition = function( def )
- {
- // An inner UI element should not have the parent's type, title or events.
- for ( var i in def )
- {
- if ( eventRegex.test( i ) || i == 'title' || i == 'type' )
- delete def[i];
- }
- return def;
- };
-
- CKEDITOR.tools.extend( CKEDITOR.ui.dialog,
- /** @lends CKEDITOR.ui.dialog */
- {
- /**
- * Base class for all dialog elements with a textual label on the left.
- * @constructor
- * @example
- * @extends CKEDITOR.ui.dialog.uiElement
- * @param {CKEDITOR.dialog} dialog
- * Parent dialog object.
- * @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition
- * The element definition. Accepted fields:
- *
- *
label (Required) The label string.
- *
labelLayout (Optional) Put 'horizontal' here if the
- * label element is to be layed out horizontally. Otherwise a vertical
- * layout will be used.
- *
widths (Optional) This applies only for horizontal
- * layouts - an 2-element array of lengths to specify the widths of the
- * label and the content element.
- *
- * @param {Array} htmlList
- * List of HTML code to output to.
- * @param {Function} contentHtml
- * A function returning the HTML code string to be added inside the content
- * cell.
- */
- labeledElement : function( dialog, elementDefinition, htmlList, contentHtml )
- {
- if ( arguments.length < 4 )
- return;
-
- var _ = initPrivateObject.call( this, elementDefinition );
- _.labelId = CKEDITOR.tools.getNextNumber() + '_label';
- var children = this._.children = [];
- /** @ignore */
- var innerHTML = function()
- {
- var html = [];
- if ( elementDefinition.labelLayout != 'horizontal' )
- html.push( '',
- '