Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[#487] Upgrade CKeditor

* Replace included CKeditor files with ckeditor-rails gem which is Asset Pipeline ready
* Remove all vendored asset files for ckeditor
* Override default config.js provided by ckeditor.js gem.
* Move CKEditor 'boot' files from vendor into app directory.
* Add gem dependency on ckeditor_rails
* Bump to RC3
  • Loading branch information...
commit 255fb97aa1146614314dee7bef7cf00504ae6958 1 parent ce2d1fe
@peakpg peakpg authored
Showing with 42 additions and 33,501 deletions.
  1. +5 −1 Gemfile.lock
  2. +6 −3 vendor/assets/javascripts/bcms/ckeditor/editor.js → app/assets/javascripts/bcms/ckeditor.js
  3. +0 −9 app/assets/javascripts/browsercms/application.js
  4. +2 −0  {vendor/assets/javascripts/bcms → app/assets/javascripts}/ckeditor/config.js
  5. +1 −1  app/assets/javascripts/cms/application.js
  6. +10 −9 browsercms.gemspec
  7. +6 −1 lib/cms/engine.rb
  8. +1 −1  lib/cms/version.rb
  9. +10 −5 test/dummy/config/initializers/quiet_sprocket_assets.rb
  10. +1 −1  todo_list.markdown
  11. +0 −6 vendor/assets/javascripts/bcms/ckeditor.js
  12. +0 −108 vendor/assets/javascripts/bcms/ckeditor/ckeditor.js
  13. +0 −64 vendor/assets/javascripts/bcms/ckeditor/core/_bootstrap.js
  14. +0 −143 vendor/assets/javascripts/bcms/ckeditor/core/ajax.js
  15. +0 −96 vendor/assets/javascripts/bcms/ckeditor/core/ckeditor.js
  16. +0 −190 vendor/assets/javascripts/bcms/ckeditor/core/ckeditor_base.js
  17. +0 −241 vendor/assets/javascripts/bcms/ckeditor/core/ckeditor_basic.js
  18. +0 −70 vendor/assets/javascripts/bcms/ckeditor/core/command.js
  19. +0 −72 vendor/assets/javascripts/bcms/ckeditor/core/commanddefinition.js
  20. +0 −287 vendor/assets/javascripts/bcms/ckeditor/core/config.js
  21. +0 −21 vendor/assets/javascripts/bcms/ckeditor/core/dom.js
  22. +0 −210 vendor/assets/javascripts/bcms/ckeditor/core/dom/document.js
  23. +0 −49 vendor/assets/javascripts/bcms/ckeditor/core/dom/documentfragment.js
  24. +0 −204 vendor/assets/javascripts/bcms/ckeditor/core/dom/domobject.js
  25. +0 −1,384 vendor/assets/javascripts/bcms/ckeditor/core/dom/element.js
  26. +0 −104 vendor/assets/javascripts/bcms/ckeditor/core/dom/elementpath.js
  27. +0 −137 vendor/assets/javascripts/bcms/ckeditor/core/dom/event.js
  28. +0 −649 vendor/assets/javascripts/bcms/ckeditor/core/dom/node.js
  29. +0 −23 vendor/assets/javascripts/bcms/ckeditor/core/dom/nodelist.js
  30. +0 −1,668 vendor/assets/javascripts/bcms/ckeditor/core/dom/range.js
  31. +0 −123 vendor/assets/javascripts/bcms/ckeditor/core/dom/text.js
  32. +0 −411 vendor/assets/javascripts/bcms/ckeditor/core/dom/walker.js
  33. +0 −96 vendor/assets/javascripts/bcms/ckeditor/core/dom/window.js
  34. +0 −200 vendor/assets/javascripts/bcms/ckeditor/core/dtd.js
  35. +0 −650 vendor/assets/javascripts/bcms/ckeditor/core/editor.js
  36. +0 −178 vendor/assets/javascripts/bcms/ckeditor/core/editor_basic.js
  37. +0 −219 vendor/assets/javascripts/bcms/ckeditor/core/env.js
  38. +0 −335 vendor/assets/javascripts/bcms/ckeditor/core/event.js
  39. +0 −120 vendor/assets/javascripts/bcms/ckeditor/core/eventInfo.js
  40. +0 −123 vendor/assets/javascripts/bcms/ckeditor/core/focusmanager.js
  41. +0 −212 vendor/assets/javascripts/bcms/ckeditor/core/htmlparser.js
  42. +0 −140 vendor/assets/javascripts/bcms/ckeditor/core/htmlparser/basicwriter.js
  43. +0 −44 vendor/assets/javascripts/bcms/ckeditor/core/htmlparser/cdata.js
  44. +0 −59 vendor/assets/javascripts/bcms/ckeditor/core/htmlparser/comment.js
  45. +0 −196 vendor/assets/javascripts/bcms/ckeditor/core/htmlparser/element.js
  46. +0 −233 vendor/assets/javascripts/bcms/ckeditor/core/htmlparser/filter.js
  47. +0 −434 vendor/assets/javascripts/bcms/ckeditor/core/htmlparser/fragment.js
  48. +0 −55 vendor/assets/javascripts/bcms/ckeditor/core/htmlparser/text.js
  49. +0 −58 vendor/assets/javascripts/bcms/ckeditor/core/imagecacher.js
  50. +0 −147 vendor/assets/javascripts/bcms/ckeditor/core/lang.js
  51. +0 −238 vendor/assets/javascripts/bcms/ckeditor/core/loader.js
  52. +0 −66 vendor/assets/javascripts/bcms/ckeditor/core/plugindefinition.js
  53. +0 −82 vendor/assets/javascripts/bcms/ckeditor/core/plugins.js
  54. +0 −233 vendor/assets/javascripts/bcms/ckeditor/core/resourcemanager.js
  55. +0 −194 vendor/assets/javascripts/bcms/ckeditor/core/scriptloader.js
  56. +0 −185 vendor/assets/javascripts/bcms/ckeditor/core/skins.js
  57. +0 −184 vendor/assets/javascripts/bcms/ckeditor/core/test.js
  58. +0 −18 vendor/assets/javascripts/bcms/ckeditor/core/themes.js
  59. +0 −531 vendor/assets/javascripts/bcms/ckeditor/core/tools.js
  60. +0 −106 vendor/assets/javascripts/bcms/ckeditor/core/ui.js
  61. +0 −165 vendor/assets/javascripts/bcms/ckeditor/core/xml.js
  62. +0 −82 vendor/assets/javascripts/bcms/ckeditor/lang/_languages.js
  63. +0 −59 vendor/assets/javascripts/bcms/ckeditor/lang/_translationstatus.txt
  64. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/af.js
  65. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/ar.js
  66. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/bg.js
  67. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/bn.js
  68. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/bs.js
  69. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/ca.js
  70. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/cs.js
  71. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/da.js
  72. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/de.js
  73. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/el.js
  74. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/en-au.js
  75. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/en-ca.js
  76. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/en-uk.js
  77. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/en.js
  78. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/eo.js
  79. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/es.js
  80. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/et.js
  81. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/eu.js
  82. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/fa.js
  83. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/fi.js
  84. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/fo.js
  85. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/fr-ca.js
  86. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/fr.js
  87. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/gl.js
  88. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/gu.js
  89. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/he.js
  90. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/hi.js
  91. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/hr.js
  92. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/hu.js
  93. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/is.js
  94. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/it.js
  95. +0 −674 vendor/assets/javascripts/bcms/ckeditor/lang/ja.js
Sorry, we could not display the entire diff because too many files (369) changed.
View
6 Gemfile.lock
@@ -1,8 +1,9 @@
PATH
remote: .
specs:
- browsercms (3.4.0.rc2)
+ browsercms (3.4.0.rc3)
ancestry (~> 1.2.4)
+ ckeditor_rails (~> 3.6.2.2)
jquery-rails (~> 1.0.14)
rails (~> 3.1.0)
term-ansicolor
@@ -61,6 +62,9 @@ GEM
xpath (~> 0.1.4)
childprocess (0.2.2)
ffi (~> 1.0.6)
+ ckeditor_rails (3.6.2.2)
+ railties (~> 3.0)
+ thor (~> 0.14)
cucumber (1.1.0)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
View
9 vendor/assets/javascripts/bcms/ckeditor/editor.js → app/assets/javascripts/bcms/ckeditor.js
@@ -1,13 +1,16 @@
//
-// Generic functions for loading WYSIWYG editors for BrowserCMS
+// Manifest file for loading the CKeditor JS. Loads it from ckeditor-rails gem.
+// See /assets/ckeditor/config.js for default configuration.
//
+//= require ckeditor-jquery
+
jQuery(function($){
$('textarea.editor').each(function(e){
if(editorEnabled()) {
loadEditor(this.id)
}
});
-})
+});
function editorEnabled() {
return $.cookie('editorEnabled') ? $.cookie('editorEnabled') == "true" : true
@@ -51,4 +54,4 @@ function loadEditor(id) {
} else {
return false
}
-}
+}
View
9 app/assets/javascripts/browsercms/application.js
@@ -1,9 +0,0 @@
-// This is a manifest file that'll be compiled into including all the files listed below.
-// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
-// be included in the compiled file accessible from http://example.com/assets/application.js
-// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
-// the compiled file.
-//
-//= require jquery
-//= require jquery_ujs
-//= require_tree .
View
2  vendor/assets/javascripts/bcms/ckeditor/config.js → app/assets/javascripts/ckeditor/config.js
@@ -1,3 +1,5 @@
+// Default configuration for the CKeditor in BrowseCMS projects.
+
CKEDITOR.config.toolbar_CMS = [
['Source','-','Cut','Copy','Paste','PasteText','PasteFromWord','-','SpellChecker','Scayt','-','Undo','Redo','Find','Replace','RemoveFormat','-','NumberedList','BulletedList','Outdent','Indent','HorizontalRule'],
'/',
View
2  app/assets/javascripts/cms/application.js
@@ -1,5 +1,5 @@
//
-// Javascript librarys required for the Admin area of the CMS.
+// Javascript libraries required for the Admin area of the CMS.
//
//= require jquery
//= require jquery-ui
View
19 browsercms.gemspec
@@ -2,33 +2,34 @@ require File.dirname(__FILE__) + "/lib/cms/version.rb"
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
- s.name = %q{browsercms}
+ s.name = "browsercms"
s.version = Cms::VERSION
s.authors = ["BrowserMedia"]
s.summary = %q{BrowserCMS is a a general purpose, open source Web Content Management System (CMS), written using Ruby on Rails.}
s.description = %q{Web Content Management in Rails.}
s.email = %q{github@browsermedia.com}
- s.extra_rdoc_files = [
- "LICENSE.txt",
- "README.markdown"
- ]
+ s.extra_rdoc_files = %w{
+ LICENSE.txt
+ README.markdown
+ }
s.required_ruby_version = '>= 1.9.2'
s.files = `git ls-files`.split("\n")
- s.files -= Dir['test/dummy/*']
+ s.files -= Dir["test/dummy/*"]
s.files -= Dir["lib/tasks/cucumber.rake"]
s.files -= Dir["lib/tasks/cms.rake"]
s.files -= Dir["lib/tasks/core_tasks.rake"]
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
- s.add_dependency('rails', "~> 3.1.0 ")
+ s.add_dependency "rails", "~> 3.1.0 "
s.add_dependency "ancestry", "~> 1.2.4"
+ s.add_dependency "ckeditor_rails", "~> 3.6.2.2"
+ s.add_dependency "jquery-rails", "~> 1.0.14"
# Required only for bcms-upgrade
- s.add_dependency('term-ansicolor')
- s.add_dependency("jquery-rails", "~> 1.0.14")
+ s.add_dependency "term-ansicolor"
end
View
7 lib/cms/engine.rb
@@ -2,6 +2,12 @@
require 'cms/module'
require 'cms/init'
require 'browsercms'
+
+# Gem name is different than file name
+# Must be required FIRST, so that our assets paths appear before its do.
+# This allows app/assets/ckeditor/config.js to set CMS specific defaults.
+require 'ckeditor-rails'
+
module Cms
# Configuring BrowserCMS as an engine. This seems to work, but could probably be cleaned up.
@@ -35,7 +41,6 @@ class Engine < Rails::Engine
app.config.assets.precompile += ['cms/application.css']
end
-
def self.add_cms_load_paths
ActiveSupport::Dependencies.autoload_paths += %W( #{self.root}/vendor #{self.root}/app/mailers #{self.root}/app/helpers)
ActiveSupport::Dependencies.autoload_paths += %W( #{self.root}/app/controllers #{self.root}/app/models #{self.root}/app/portlets)
View
2  lib/cms/version.rb
@@ -2,5 +2,5 @@
# Allows the precise version of BrowserCMS to be determined programatically.
#
module Cms
- VERSION = "3.4.0.rc2"
+ VERSION = "3.4.0.rc3"
end
View
15 test/dummy/config/initializers/quiet_sprocket_assets.rb
@@ -1,8 +1,13 @@
# This removes all the Sprocket asset logging from development log, which makes them much saner.
-Rails.application.assets.logger = Logger.new('/dev/null')
-Rails::Rack::Logger.class_eval do
- def before_dispatch_with_quiet_assets(env)
- before_dispatch_without_quiet_assets(env) unless env['PATH_INFO'].index("/assets/") == 0
+silence_sprockets = true
+
+if silence_sprockets
+ Rails.application.assets.logger = Logger.new('/dev/null')
+ Rails::Rack::Logger.class_eval do
+ def before_dispatch_with_quiet_assets(env)
+ before_dispatch_without_quiet_assets(env) unless env['PATH_INFO'].index("/assets/") == 0
+ end
+
+ alias_method_chain :before_dispatch, :quiet_assets
end
- alias_method_chain :before_dispatch, :quiet_assets
end
View
2  todo_list.markdown
@@ -1,12 +1,12 @@
# Working on release of bcms 3.4
Current:
+ * Test this on a production environment prior to releasing (things like assets and/or config options might be wonky)
Tasks:
* [CMS] Upgrade a 3rd module (with a migration) to confirm the installation and upgrade instructions work correctly.
* Audit the buglist to see what else is getting closed as part of 3.1
-* Test this on a production environment prior to releasing (things like assets and/or config options might be wonky)
* Test upgrading a browsercms v3.1.x/3.3.x to 3.4.x
* Write upgrade instructions from 3.1.x/3.3.x to 3.4
* Update Roadmap (https://github.com/browsermedia/browsercms/wiki/Roadmap)
View
6 vendor/assets/javascripts/bcms/ckeditor.js
@@ -1,6 +0,0 @@
-//
-// Loads the bcms_ckeditor javascript
-// This is a pure manifest file for use with Rails 3.1
-//
-//= require bcms/ckeditor/ckeditor
-//= require bcms/ckeditor/editor
View
108 vendor/assets/javascripts/bcms/ckeditor/ckeditor.js
0 additions, 108 deletions not shown
View
64 vendor/assets/javascripts/bcms/ckeditor/core/_bootstrap.js
@@ -1,64 +0,0 @@
-/*
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-/**
- * @fileOverview API initialization code.
- */
-
-(function()
-{
- // Check is High Contrast is active by creating a temporary element with a
- // background image.
-
- var testImage = ( CKEDITOR.env.ie && CKEDITOR.env.version < 7 ) ? ( CKEDITOR.basePath + 'images/spacer.gif' ) : 'about:blank';
-
- var hcDetect = CKEDITOR.dom.element.createFromHtml(
- '<div style="width:0px;height:0px;' +
- 'position:absolute;left:-10000px;' +
- 'background-image:url(' + testImage + ')"></div>', CKEDITOR.document );
-
- hcDetect.appendTo( CKEDITOR.document.getHead() );
-
- // Update CKEDITOR.env.
- if ( ( CKEDITOR.env.hc = ( hcDetect.getComputedStyle( 'background-image' ) == 'none' ) ) )
- 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.
- }
-}
-*/
View
143 vendor/assets/javascripts/bcms/ckeditor/core/ajax.js
@@ -1,143 +0,0 @@
-/*
-Copyright (c) 2003-2009, 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 );
- }
- };
-})();
View
96 vendor/assets/javascripts/bcms/ckeditor/core/ckeditor.js
@@ -1,96 +0,0 @@
-/*
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-/**
- * @fileOverview Contains the third and last part of the {@link CKEDITOR} object
- * definition.
- */
-
-// Remove the CKEDITOR.loadFullCore reference defined on ckeditor_basic.
-delete CKEDITOR.loadFullCore;
-
-/**
- * Holds references to all editor instances created. The name of the properties
- * in this object correspond to instance names, and their values contains the
- * {@link CKEDITOR.editor} object representing them.
- * @type {Object}
- * @example
- * alert( <b>CKEDITOR.instances</b>.editor1.name ); // "editor1"
- */
-CKEDITOR.instances = {};
-
-/**
- * The document of the window holding the CKEDITOR object.
- * @type {CKEDITOR.dom.document}
- * @example
- * alert( <b>CKEDITOR.document</b>.getBody().getName() ); // "body"
- */
-CKEDITOR.document = new CKEDITOR.dom.document( document );
-
-/**
- * Adds an editor instance to the global {@link CKEDITOR} object. This function
- * is available for internal use mainly.
- * @param {CKEDITOR.editor} editor The editor instance to be added.
- * @example
- */
-CKEDITOR.add = function( editor )
-{
- CKEDITOR.instances[ editor.name ] = editor;
-
- editor.on( 'focus', function()
- {
- if ( CKEDITOR.currentInstance != editor )
- {
- CKEDITOR.currentInstance = editor;
- CKEDITOR.fire( 'currentInstance' );
- }
- });
-
- editor.on( 'blur', function()
- {
- if ( CKEDITOR.currentInstance == editor )
- {
- CKEDITOR.currentInstance = null;
- CKEDITOR.fire( 'currentInstance' );
- }
- });
-};
-
-/**
- * Removes 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 ];
-};
-
-// 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;
View
190 vendor/assets/javascripts/bcms/ckeditor/core/ckeditor_base.js
@@ -1,190 +0,0 @@
-/*
-Copyright (c) 2003-2009, 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.0',rev:'4148',_:{},status:'unloaded',basePath:(function(){var d=window.CKEDITOR_BASEPATH||'';if(!d){var e=document.getElementsByTagName('script');for(var f=0;f<e.length;f++){var g=e[f].src.match(/(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i);if(g){d=g[1];break;}}}if(d.indexOf('://')==-1)if(d.indexOf('/')===0)d=location.href.match(/^.*?:\/\/[^\/]*/)[0]+d;else d=location.href.match(/^[^\?]*\/(?:)/)[0]+d;return d;})(),getUrl:function(d){if(d.indexOf('://')==-1&&d.indexOf('/')!==0)d=this.basePath+d;if(this.timestamp&&d.charAt(d.length-1)!='/')d+=(d.indexOf('?')>=0?'&':'?')+('t=')+this.timestamp;return d;}},b=window.CKEDITOR_GETURL;if(b){var c=a.getUrl;a.getUrl=function(d){return b.call(a,d)||c.call(a,d);};}return a;})();
-
-// #### Raw code
-// ATTENTION: read the above "Compressed Code" notes when changing this code.
-
-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 : '97KD',
-
- /**
- * Contains the CKEditor version number.
- * @type String
- * @example
- * alert( CKEDITOR.version ); // e.g. 'CKEditor 3.0 Beta'
- */
- version : '3.0',
-
- /**
- * 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 : '4148',
-
- /**
- * 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:
- * <ul>
- * <li><b>unloaded</b>: the API is not yet loaded.</li>
- * <li><b>basic_loaded</b>: the basic API features are available.</li>
- * <li><b>basic_ready</b>: the basic API is ready to load the full core code.</li>
- * <li><b>loading</b>: the full API is being loaded.</li>
- * <li><b>ready</b>: the API can be fully used.</li>
- * </ul>
- * @type String
- * @example
- * if ( <b>CKEDITOR.status</b> == '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( <b>CKEDITOR.basePath</b> ); // "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 <script> tag.
- var path = window.CKEDITOR_BASEPATH || '';
-
- if ( !path )
- {
- var scripts = document.getElementsByTagName( 'script' );
-
- for ( var i = 0 ; i < scripts.length ; i++ )
- {
- var match = scripts[i].src.match( /(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i );
-
- if ( match )
- {
- path = match[1];
- break;
- }
- }
- }
-
- // In IE (only) the script.src string is the raw valued entered in the
- // HTML. Other browsers return the full resolved URL instead.
- if ( path.indexOf('://') == -1 )
- {
- // Absolute path.
- if ( path.indexOf( '/' ) === 0 )
- path = location.href.match( /^.*?:\/\/[^\/]*/ )[0] + path;
- // Relative path.
- else
- path = location.href.match( /^[^\?]*\/(?:)/ )[0] + path;
- }
-
- return path;
- })(),
-
- /**
- * Gets the full URL for CKEditor resources. By default, URLs
- * returned by this function contains a querystring parameter ("t")
- * set to the {@link CKEDITOR.timestamp} value.
- * It's possible to provide a custom implementation to this
- * function by setting a global variable named CKEDITOR_GETURL.
- * This global variable must be set "before" the editor script
- * loading. If the custom implementation returns nothing, the
- * default implementation is used.
- * @returns {String} The full URL.
- * @example
- * // e.g. http://www.example.com/ckeditor/skins/default/editor.css?t=87dm
- * alert( CKEDITOR.getUrl( 'skins/default/editor.css' ) );
- * @example
- * // e.g. http://www.example.com/skins/default/editor.css?t=87dm
- * alert( CKEDITOR.getUrl( '/skins/default/editor.css' ) );
- * @example
- * // e.g. http://www.somesite.com/skins/default/editor.css?t=87dm
- * alert( CKEDITOR.getUrl( 'http://www.somesite.com/skins/default/editor.css' ) );
- */
- getUrl : function( resource )
- {
- // If this is not a full or absolute path.
- if ( resource.indexOf('://') == -1 && resource.indexOf( '/' ) !== 0 )
- resource = this.basePath + resource;
-
- // Add the timestamp, except for directories.
- if ( this.timestamp && resource.charAt( resource.length - 1 ) != '/' )
- resource += ( resource.indexOf( '?' ) >= 0 ? '&' : '?' ) + 't=' + this.timestamp;
-
- return resource;
- }
- };
-
- // Make it possible to override the getUrl function with a custom
- // implementation pointing to a global named CKEDITOR_GETURL.
- var newGetUrl = window.CKEDITOR_GETURL;
- if ( newGetUrl )
- {
- var originalGetUrl = CKEDITOR.getUrl;
- CKEDITOR.getUrl = function ( resource )
- {
- return newGetUrl.call( CKEDITOR, resource ) ||
- originalGetUrl.call( CKEDITOR, resource );
- };
- }
-
- return CKEDITOR;
- })();
-}
-
-// PACKAGER_RENAME( CKEDITOR )
View
241 vendor/assets/javascripts/bcms/ckeditor/core/ckeditor_basic.js
@@ -1,241 +0,0 @@
-/*
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-/**
- * @fileOverview Contains the second part of the {@link CKEDITOR} object
- * definition, which defines the basic editor features to be available in
- * the root ckeditor_basic.js file.
- */
-
-if ( CKEDITOR.status == 'unloaded' )
-{
- (function()
- {
- CKEDITOR.event.implementOn( CKEDITOR );
-
- /**
- * Forces the full CKEditor core code, in the case only the basic code has been
- * loaded (ckeditor_basic.js). This method self-destroys (becomes undefined) in
- * the first call or as soon as the full code is available.
- * @example
- * // Check if the full core code has been loaded and load it.
- * if ( CKEDITOR.loadFullCore )
- * <b>CKEDITOR.loadFullCore()</b>;
- */
- CKEDITOR.loadFullCore = function()
- {
- // If not the basic code is not ready it, just mark it to be loaded.
- if ( CKEDITOR.status != 'basic_ready' )
- {
- CKEDITOR.loadFullCore._load = true;
- return;
- }
-
- // Destroy this function.
- delete CKEDITOR.loadFullCore;
-
- // Append the script to the head.
- var script = document.createElement( 'script' );
- script.type = 'text/javascript';
- script.src = CKEDITOR.basePath + 'ckeditor.js';
-
- document.getElementsByTagName( 'head' )[0].appendChild( script );
- };
-
- /**
- * The time to wait (in seconds) to load the full editor code after the
- * page load, if the "ckeditor_basic" file is used. If set to zero, the
- * editor is loaded on demand, as soon as an instance is created.
- *
- * This value must be set on the page before the page load completion.
- * @type Number
- * @default 0 (zero)
- * @example
- * // Loads the full source after five seconds.
- * CKEDITOR.loadFullCoreTimeout = 5;
- */
- CKEDITOR.loadFullCoreTimeout = 0;
-
- /**
- * The class name used to identify &lt;textarea&gt; elements to be replace
- * by CKEditor instances.
- * @type String
- * @default 'ckeditor'
- * @example
- * <b>CKEDITOR.replaceClass</b> = 'rich_editor';
- */
- CKEDITOR.replaceClass = 'ckeditor';
-
- /**
- * Enables the replacement of all textareas with class name matching
- * {@link CKEDITOR.replaceClass}.
- * @type Boolean
- * @default true
- * @example
- * // Disable the auto-replace feature.
- * <b>CKEDITOR.replaceByClassEnabled</b> = false;
- */
- CKEDITOR.replaceByClassEnabled = true;
-
- var createInstance = function( elementOrIdOrName, config, creationFunction )
- {
- if ( CKEDITOR.env.isCompatible )
- {
- // Load the full core.
- if ( CKEDITOR.loadFullCore )
- CKEDITOR.loadFullCore();
-
- var editor = creationFunction( elementOrIdOrName, config );
- CKEDITOR.add( editor );
- return editor;
- }
-
- return null;
- };
-
- /**
- * Replaces a &lt;textarea&gt; or a DOM element (DIV) with a CKEditor
- * instance. For textareas, the initial value in the editor will be the
- * textarea value. For DOM elements, their innerHTML will be used
- * instead. We recommend using TEXTAREA and DIV elements only.
- * @param {Object|String} elementOrIdOrName The DOM element (textarea), its
- * ID or name.
- * @param {Object} [config] The specific configurations to apply to this
- * editor instance. Configurations set here will override global CKEditor
- * settings.
- * @returns {CKEDITOR.editor} The editor instance created.
- * @example
- * &lt;textarea id="myfield" name="myfield"&gt;&lt:/textarea&gt;
- * ...
- * <b>CKEDITOR.replace( 'myfield' )</b>;
- * @example
- * var textarea = document.body.appendChild( document.createElement( 'textarea' ) );
- * <b>CKEDITOR.replace( textarea )</b>;
- */
- CKEDITOR.replace = function( elementOrIdOrName, config )
- {
- return createInstance( elementOrIdOrName, config, CKEDITOR.editor.replace );
- };
-
- /**
- * Creates a new editor instance inside a specific DOM element.
- * @param {Object|String} elementOrId The DOM element or its ID.
- * @param {Object} [config] The specific configurations to apply to this
- * editor instance. Configurations set here will override global CKEditor
- * settings.
- * @returns {CKEDITOR.editor} The editor instance created.
- * @example
- * &lt;div id="editorSpace"&gt;&lt:/div&gt;
- * ...
- * <b>CKEDITOR.appendTo( 'editorSpace' )</b>;
- */
- CKEDITOR.appendTo = function( elementOrId, config )
- {
- return createInstance( elementOrId, config, CKEDITOR.editor.appendTo );
- };
-
- /**
- * @ignore
- * Documented at ckeditor.js.
- */
- CKEDITOR.add = function( editor )
- {
- // For now, just put the editor in the pending list. It will be
- // processed as soon as the full code gets loaded.
- var pending = this._.pending || ( this._.pending = [] );
- pending.push( editor );
- };
-
- /**
- * Replace all &lt;textarea&gt; elements available in the document with
- * editor instances.
- * @example
- * // Replace all &lt;textarea&gt; elements in the page.
- * CKEDITOR.replaceAll();
- * @example
- * // Replace all &lt;textarea class="myClassName"&gt; elements in the page.
- * CKEDITOR.replaceAll( 'myClassName' );
- * @example
- * // Selectively replace &lt;textarea&gt; elements, based on custom assertions.
- * CKEDITOR.replaceAll( function( textarea, config )
- * {
- * // Custom code to evaluate the replace, returning false
- * // if it must not be done.
- * // It also passes the "config" parameter, so the
- * // developer can customize the instance.
- * } );
- */
- CKEDITOR.replaceAll = function()
- {
- var textareas = document.getElementsByTagName( 'textarea' );
-
- for ( var i = 0 ; i < textareas.length ; i++ )
- {
- var config = null;
- var textarea = textareas[i];
- var name = textarea.name;
-
- // The "name" and/or "id" attribute must exist.
- if ( !textarea.name && !textarea.id )
- continue;
-
- if ( typeof arguments[0] == 'string' )
- {
- // The textarea class name could be passed as the function
- // parameter.
-
- var classRegex = new RegExp( '(?:^| )' + arguments[0] + '(?:$| )' );
-
- if ( !classRegex.test( textarea.className ) )
- continue;
- }
- else if ( typeof arguments[0] == 'function' )
- {
- // An assertion function could be passed as the function parameter.
- // It must explicitly return "false" to ignore a specific <textarea>.
- config = {};
- if ( arguments[0]( textarea, config ) === false )
- continue;
- }
-
- this.replace( textarea, config );
- }
- };
-
- (function()
- {
- var onload = function()
- {
- var loadFullCore = CKEDITOR.loadFullCore,
- loadFullCoreTimeout = CKEDITOR.loadFullCoreTimeout;
-
- // Replace all textareas with the default class name.
- if ( CKEDITOR.replaceByClassEnabled )
- CKEDITOR.replaceAll( CKEDITOR.replaceClass );
-
- CKEDITOR.status = 'basic_ready';
-
- if ( loadFullCore && loadFullCore._load )
- loadFullCore();
- else if ( loadFullCoreTimeout )
- {
- setTimeout( function()
- {
- if ( CKEDITOR.loadFullCore )
- CKEDITOR.loadFullCore();
- }
- , loadFullCoreTimeout * 1000 );
- }
- };
-
- if ( window.addEventListener )
- window.addEventListener( 'load', onload, false );
- else if ( window.attachEvent )
- window.attachEvent( 'onload', onload );
- })();
-
- CKEDITOR.status = 'basic_loaded';
- })();
-}
View
70 vendor/assets/javascripts/bcms/ckeditor/core/command.js
@@ -1,70 +0,0 @@
-/*
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-CKEDITOR.command = function( editor, commandDefinition )
-{
- this.exec = function( data )
- {
- if ( this.state == CKEDITOR.TRISTATE_DISABLED )
- return false;
-
- // The editor will always have the focus when executing a command.
- editor.focus();
-
- return ( commandDefinition.exec.call( this, editor, data ) !== false );
- };
-
- CKEDITOR.tools.extend( this, commandDefinition,
- // Defaults
- {
- modes : { wysiwyg : 1 },
- state : CKEDITOR.TRISTATE_OFF
- });
-
- // Call the CKEDITOR.event constructor to initialize this instance.
- CKEDITOR.event.call( this );
-};
-
-CKEDITOR.command.prototype =
-{
- enable : function()
- {
- if ( this.state == CKEDITOR.TRISTATE_DISABLED )
- this.setState( ( !this.preserveState || ( typeof this.previousState == 'undefined' ) ) ? CKEDITOR.TRISTATE_OFF : this.previousState );
- },
-
- disable : function()
- {
- this.setState( CKEDITOR.TRISTATE_DISABLED );
- },
-
- setState : function( newState )
- {
- // Do nothing if there is no state change.
- if ( this.state == newState )
- return false;
-
- this.previousState = this.state;
-
- // Set the new state.
- this.state = newState;
-
- // Fire the "state" event, so other parts of the code can react to the
- // change.
- this.fire( 'state' );
-
- return true;
- },
-
- toggleState : function()
- {
- if ( this.state == CKEDITOR.TRISTATE_OFF )
- this.setState( CKEDITOR.TRISTATE_ON );
- else if ( this.state == CKEDITOR.TRISTATE_ON )
- this.setState( CKEDITOR.TRISTATE_OFF );
- }
-};
-
-CKEDITOR.event.implementOn( CKEDITOR.command.prototype, true );
View
72 vendor/assets/javascripts/bcms/ckeditor/core/commanddefinition.js
@@ -1,72 +0,0 @@
-/*
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-/**
- * @fileOverview Defines the "virtual" {@link CKEDITOR.commandDefinition} class,
- * which contains the defintion of a command. This file is for
- * documentation purposes only.
- */
-
-/**
- * (Virtual Class) Do not call this constructor. This class is not really part
- * of the API. It just illustrates the features of command objects to be
- * passed to the {@link CKEDITOR.editor.prototype.addCommand} function.
- * @name CKEDITOR.commandDefinition
- * @constructor
- * @example
- */
-
- /**
- * Executes the command.
- * @name CKEDITOR.commandDefinition.prototype.exec
- * @function
- * @param {CKEDITOR.editor} editor The editor within which run the command.
- * @param {Object} [data] Additional data to be used to execute the command.
- * @returns {Boolean} Whether the command has been successfully executed.
- * Defaults to "true", if nothing is returned.
- * @example
- * editorInstance.addCommand( 'sample',
- * {
- * exec : function( editor )
- * {
- * alert( 'Executing a command for the editor name "' + editor.name + '"!' );
- * }
- * });
- */
-
-/**
- * Whether the command need to be hooked into the redo/undo system.
- * @name CKEDITOR.commandDefinition.canUndo
- * @type {Boolean} If not defined or 'true' both hook into undo system, set it
- * to 'false' explicitly keep it out.
- * @field
- * @example
- * editorInstance.addCommand( 'alertName',
- * {
- * exec : function( editor )
- * {
- * alert( editor.name );
- * },
- * canUndo : false // No support for undo/redo
- * });
- */
-
-/**
- * Whether the command is asynchronous, which means the 'afterCommandExec' event
- * will be fired by the command itself manually, and the 'exec' function return value
- * of this command is not to be returned.
- * @name CKEDITOR.commandDefinition.async
- * @type {Boolean} If defined as 'true', the command is asynchronous.
- * @example
- * editorInstance.addCommand( 'alertName',
- * {
- * exec : function( editor )
- * {
- * // Asynchronous operation below.
- * CKEDITOR.ajax.loadXml( 'data.xml' );
- * },
- * async : true // The command need some time to complete after exec function returns.
- * });
- */
View
287 vendor/assets/javascripts/bcms/ckeditor/core/config.js
@@ -1,287 +0,0 @@
-/*
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-/**
- * @fileOverview Defines the {@link CKEDITOR.config} object, which holds the
- * default configuration settings.
- */
-
-CKEDITOR.ENTER_P = 1;
-CKEDITOR.ENTER_BR = 2;
-CKEDITOR.ENTER_DIV = 3;
-
-/**
- * Holds the default configuration settings. Changes to this object are
- * reflected in all editor instances, if not specificaly specified for those
- * instances.
- * @namespace
- * @example
- * // All editor created after the following setting will not load custom
- * // configuration files.
- * CKEDITOR.config.customConfig = '';
- */
-CKEDITOR.config =
-{
- /**
- * The URL path for the custom configuration file to be loaded. If not
- * overloaded with inline configurations, it defaults to the "config.js"
- * file present in the root of the CKEditor installation directory.<br /><br />
- *
- * CKEditor will recursively load custom configuration files defined inside
- * other custom configuration files.
- * @type String
- * @default '&lt;CKEditor folder&gt;/config.js'
- * @example
- * // Load a specific configuration file.
- * CKEDITOR.replace( 'myfiled', { customConfig : '/myconfig.js' } );
- * @example
- * // Do not load any custom configuration file.
- * CKEDITOR.replace( 'myfiled', { customConfig : '' } );
- */
- customConfig : CKEDITOR.getUrl( 'config.js' ),
-
- /**
- * Whether the replaced element (usually a textarea) is to be updated
- * automatically when posting the form containing the editor.
- * @type Boolean
- * @default true
- * @example
- * config.autoUpdateElement = true;
- */
- autoUpdateElement : true,
-
- /**
- * The base href URL used to resolve relative and absolute URLs in the
- * editor content.
- * @type String
- * @default '' (empty string)
- * @example
- * config.baseHref = 'http://www.example.com/path/';
- */
- baseHref : '',
-
- /**
- * The CSS file to be used to apply style to the contents. It should
- * reflect the CSS used in the final pages where the contents are to be
- * used.
- * @type String
- * @default '&lt;CKEditor folder&gt;/contents.css'
- * @example
- * config.contentsCss = '/css/mysitestyles.css';
- */
- contentsCss : CKEDITOR.basePath + 'contents.css',
-
- /**
- * The writting direction of the language used to write the editor
- * contents. Allowed values are 'ltr' for Left-To-Right language (like
- * English), or 'rtl' for Right-To-Left languages (like Arabic).
- * @default 'ltr'
- * @type String
- * @example
- * config.contentsLangDirection = 'rtl';
- */
- contentsLangDirection : 'ltr',
-
- /**
- * The user interface language localization to use. If empty, the editor
- * automatically localize the editor to the user language, if supported,
- * otherwise the {@link CKEDITOR.config.defaultLanguage} language is used.
- * @default true
- * @type Boolean
- * @example
- * // Load the German interface.
- * config.language = 'de';
- */
- language : '',
-
- /**
- * The language to be used if {@link CKEDITOR.config.language} is left empty and it's not
- * possible to localize the editor to the user language.
- * @default 'en'
- * @type String
- * @example
- * config.defaultLanguage = 'it';
- */
- defaultLanguage : 'en',
-
- /**
- * Sets the behavior for the ENTER key. It also dictates other behaviour
- * rules in the editor, like whether the &lt;br&gt; element is to be used
- * as a paragraph separator when indenting text.
- * The allowed values are the following constants, and their relative
- * behavior:
- * <ul>
- * <li>{@link CKEDITOR.ENTER_P} (1): new &lt;p&gt; paragraphs are created;</li>
- * <li>{@link CKEDITOR.ENTER_BR} (2): lines are broken with &lt;br&gt; elements;</li>
- * <li>{@link CKEDITOR.ENTER_DIV} (3): new &lt;div&gt; blocks are created.</li>
- * </ul>
- * <strong>Note</strong>: It's recommended to use the
- * {@link CKEDITOR.ENTER_P} value because of its semantic value and
- * correctness. The editor is optimized for this value.
- * @type Number
- * @default {@link CKEDITOR.ENTER_P}
- * @example
- * // Not recommended.
- * config.enterMode = CKEDITOR.ENTER_BR;
- */
- enterMode : CKEDITOR.ENTER_P,
-
- /**
- * Just like the {@link CKEDITOR.config.enterMode} setting, it defines the behavior for the SHIFT+ENTER key.
- * The allowed values are the following constants, and their relative
- * behavior:
- * <ul>
- * <li>{@link CKEDITOR.ENTER_P} (1): new &lt;p&gt; paragraphs are created;</li>
- * <li>{@link CKEDITOR.ENTER_BR} (2): lines are broken with &lt;br&gt; elements;</li>
- * <li>{@link CKEDITOR.ENTER_DIV} (3): new &lt;div&gt; blocks are created.</li>
- * </ul>
- * @type Number
- * @default {@link CKEDITOR.ENTER_BR}
- * @example
- * config.shiftEnterMode = CKEDITOR.ENTER_P;
- */
- shiftEnterMode : CKEDITOR.ENTER_BR,
-
- /**
- * A comma separated list of plugins that are not related to editor
- * instances. Reserved to plugins that extend the core code only.<br /><br />
- *
- * There are no ways to override this setting, except by editing the source
- * code of CKEditor (_source/core/config.js).
- * @type String
- * @example
- */
- corePlugins : '',
-
- /**
- * Sets the doctype to be used when loading the editor content as HTML.
- * @type String
- * @default '&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;'
- * @example
- * // Set the doctype to the HTML 4 (quirks) mode.
- * config.docType = '&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"&gt;';
- */
- docType : '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
-
- /**
- * Indicates whether the contents to be edited are being inputted as a full
- * HTML page. A full page includes the &lt;html&gt;, &lt;head&gt; and
- * &lt;body&gt; tags. The final output will also reflect this setting,
- * including the &lt;body&gt; contents only if this setting is disabled.
- * @type Boolean
- * @default false
- * @example
- * config.fullPage = true;
- */
- fullPage : false,
-
- /**
- * The editor height, in CSS size format or pixel integer.
- * @type Number|String
- * @default '200'
- * @example
- * config.height = 500;
- * @example
- * config.height = '25em';
- */
- height : 200,
-
- /**
- * Comma separated list of plugins to load and initialize for an editor
- * instance. This should be rarely changed, using instead the
- * {@link CKEDITOR.config.extraPlugins} and
- * {@link CKEDITOR.config.removePlugins} for customizations.
- * @type String
- * @example
- */
- plugins : 'about,basicstyles,blockquote,button,clipboard,colorbutton,contextmenu,elementspath,enterkey,entities,filebrowser,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,maximize,newpage,pagebreak,pastefromword,pastetext,popup,preview,print,removeformat,resize,save,scayt,smiley,showblocks,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',
-
- /**
- * List of additional plugins to be loaded. This is a tool setting which
- * makes it easier to add new plugins, whithout having to touch and
- * possibly breaking the {@link CKEDITOR.config.plugins} setting.
- * @type String
- * @example
- * config.extraPlugins = 'myplugin,anotherplugin';
- */
- extraPlugins : '',
-
- /**
- * List of plugins that must not be loaded. This is a tool setting which
- * makes it easier to avoid loading plugins definied in the
- * {@link CKEDITOR.config.plugins} setting, whithout having to touch it and
- * potentially breaking it.
- * @type String
- * @example
- * config.removePlugins = 'elementspath,save,font';
- */
- removePlugins : '',
-
- /**
- * List of regular expressions to be executed over the input HTML,
- * indicating code that must stay untouched.
- * @type Array
- * @default [] (empty array)
- * @example
- * config.protectedSource.push( /<\?[\s\S]*?\?>/g ); // PHP Code
- * config.protectedSource.push( /<%[\s\S]*?%>/g ); // ASP Code
- * config.protectedSource.push( /(<asp:[^\>]+>[\s|\S]*?<\/asp:[^\>]+>)|(<asp:[^\>]+\/>)/gi ); // ASP.Net Code
- */
- protectedSource : [],
-
- /**
- * The editor tabindex value.
- * @type Number
- * @default 0 (zero)
- * @example
- * config.tabIndex = 1;
- */
- tabIndex : 0,
-
- /**
- * The theme to be used to build the UI.
- * @type String
- * @default 'default'
- * @see CKEDITOR.config.skin
- * @example
- * config.theme = 'default';
- */
- theme : 'default',
-
- /**
- * The skin to load. It may be the name of the skin folder inside the
- * editor installation path, or the name and the path separated by a comma.
- * @type String
- * @default 'default'
- * @example
- * config.skin = 'v2';
- * @example
- * config.skin = 'myskin,/customstuff/myskin/';
- */
- skin : 'kama',
-
- /**
- * The editor width in CSS size format or pixel integer.
- * @type String|Number
- * @default '' (empty)
- * @example
- * config.width = 850;
- * @example
- * config.width = '75%';
- */
- width : '',
-
- /**
- * The base Z-index for floating dialogs and popups.
- * @type Number
- * @default 10000
- * @example
- * config.baseFloatZIndex = 2000
- */
- baseFloatZIndex : 10000
-
-};
-
-// PACKAGER_RENAME( CKEDITOR.config )
View
21 vendor/assets/javascripts/bcms/ckeditor/core/dom.js
@@ -1,21 +0,0 @@
-/*
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-/**
- * @fileOverview Defines the {@link CKEDITOR.dom} object, which contains DOM
- * manipulation objects and function.
- */
-
-/**
- * DOM manipulation objects and function.<br /><br />
- * @see CKEDITOR.dom.element
- * @see CKEDITOR.dom.node
- * @namespace
- * @example
- */
-CKEDITOR.dom =
-{};
-
-// PACKAGER_RENAME( CKEDITOR.dom )
View
210 vendor/assets/javascripts/bcms/ckeditor/core/dom/document.js
@@ -1,210 +0,0 @@
-/*
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-/**
- * @fileOverview Defines the {@link CKEDITOR.dom.document} class, which
- * represents a DOM document.
- */
-
-/**
- * Represents a DOM document.
- * @constructor
- * @augments CKEDITOR.dom.domObject
- * @param {Object} domDocument A native DOM document.
- * @example
- * var document = new CKEDITOR.dom.document( document );
- */
-CKEDITOR.dom.document = function( domDocument )
-{
- CKEDITOR.dom.domObject.call( this, domDocument );
-};
-
-// PACKAGER_RENAME( CKEDITOR.dom.document )
-
-CKEDITOR.dom.document.prototype = new CKEDITOR.dom.domObject();
-
-CKEDITOR.tools.extend( CKEDITOR.dom.document.prototype,
- /** @lends CKEDITOR.dom.document.prototype */
- {
- /**
- * Appends a CSS file to the document.
- * @param {String} cssFileUrl The CSS file URL.
- * @example
- * <b>CKEDITOR.document.appendStyleSheet( '/mystyles.css' )</b>;
- */
- appendStyleSheet : function( cssFileUrl )
- {
- if ( this.$.createStyleSheet )
- this.$.createStyleSheet( cssFileUrl );
- else
- {
- var link = new CKEDITOR.dom.element( 'link' );
- link.setAttributes(
- {
- rel :'stylesheet',
- type : 'text/css',
- href : cssFileUrl
- });
-
- this.getHead().append( link );
- }
- },
-
- createElement : function( name, attribsAndStyles )
- {
- var element = new CKEDITOR.dom.element( name, this );
-
- if ( attribsAndStyles )
- {
- if ( attribsAndStyles.attributes )
- element.setAttributes( attribsAndStyles.attributes );
-
- if ( attribsAndStyles.styles )
- element.setStyles( attribsAndStyles.styles );
- }
-
- return element;
- },
-
- createText : function( text )
- {
- return new CKEDITOR.dom.text( text, this );
- },
-
- focus : function()
- {
- this.getWindow().focus();
- },
-
- /**
- * Gets and element based on its id.
- * @param {String} elementId The element id.
- * @returns {CKEDITOR.dom.element} The element instance, or null if not found.
- * @example
- * var element = <b>CKEDITOR.document.getById( 'myElement' )</b>;
- * alert( element.getId() ); // "myElement"
- */
- getById : function( elementId )
- {
- var $ = this.$.getElementById( elementId );
- return $ ? new CKEDITOR.dom.element( $ ) : null;
- },
-
- getByAddress : function( address, normalized )
- {
- var $ = this.$.documentElement;
-
- for ( var i = 0 ; $ && i < address.length ; i++ )
- {
- var target = address[ i ];
-
- if ( !normalized )
- {
- $ = $.childNodes[ target ];
- continue;
- }
-
- var currentIndex = -1;
-
- for (var j = 0 ; j < $.childNodes.length ; j++ )
- {
- var candidate = $.childNodes[ j ];
-
- if ( normalized === true &&
- candidate.nodeType == 3 &&
- candidate.previousSibling &&
- candidate.previousSibling.nodeType == 3 )
- {
- continue;
- }
-
- currentIndex++;
-
- if ( currentIndex == target )
- {
- $ = candidate;
- break;
- }
- }
- }
-
- return $ ? new CKEDITOR.dom.node( $ ) : null;
- },
-
- getElementsByTag : function( tagName, namespace )
- {
- if ( !CKEDITOR.env.ie && namespace )
- tagName = namespace + ':' + tagName;
- return new CKEDITOR.dom.nodeList( this.$.getElementsByTagName( tagName ) );
- },
-
- /**
- * Gets the &lt;head&gt; element for this document.
- * @returns {CKEDITOR.dom.element} The &lt;head&gt; element.
- * @example
- * var element = <b>CKEDITOR.document.getHead()</b>;
- * alert( element.getName() ); // "head"
- */
- getHead : function()
- {
- var head = this.$.getElementsByTagName( 'head' )[0];
- head = new CKEDITOR.dom.element( head );
-
- return (
- /** @ignore */
- this.getHead = function()
- {
- return head;
- })();
- },
-
- /**
- * Gets the &lt;body&gt; element for this document.
- * @returns {CKEDITOR.dom.element} The &lt;body&gt; element.
- * @example
- * var element = <b>CKEDITOR.document.getBody()</b>;
- * alert( element.getName() ); // "body"
- */
- getBody : function()
- {
- var body = new CKEDITOR.dom.element( this.$.body );
-
- return (
- /** @ignore */
- this.getBody = function()
- {
- return body;
- })();
- },
-
- getDocumentElement : function()
- {
- var documentElement = new CKEDITOR.dom.element( this.$.documentElement );
-
- return (
- /** @ignore */
- this.getDocumentElement = function()
- {
- return documentElement;
- })();
- },
-
- /**
- * Gets the window object that holds this document.
- * @returns {CKEDITOR.dom.window} The window object.
- * @example
- */
- getWindow : function()
- {
- var win = new CKEDITOR.dom.window( this.$.parentWindow || this.$.defaultView );
-
- return (
- /** @ignore */
- this.getWindow = function()
- {
- return win;
- })();
- }
- });
View
49 vendor/assets/javascripts/bcms/ckeditor/core/dom/documentfragment.js
@@ -1,49 +0,0 @@
-/*
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-/**
- * DocumentFragment is a "lightweight" or "minimal" Document object. It is
- * commonly used to extract a portion of a document's tree or to create a new
- * fragment of a document. Various operations may take DocumentFragment objects
- * as arguments and results in all the child nodes of the DocumentFragment being
- * moved to the child list of this node.
- *
- * @param {Object} ownerDocument
- */
-CKEDITOR.dom.documentFragment = function( ownerDocument )
-{
- ownerDocument = ownerDocument || CKEDITOR.document;
- this.$ = ownerDocument.$.createDocumentFragment();
-};
-
-CKEDITOR.tools.extend( CKEDITOR.dom.documentFragment.prototype,
- CKEDITOR.dom.element.prototype,
- {
- type : CKEDITOR.NODE_DOCUMENT_FRAGMENT,
- insertAfterNode : function( node )
- {
- node = node.$;
- node.parentNode.insertBefore( this.$, node.nextSibling );
- }
- },
- true,
- {
- 'append' : 1,
- 'appendBogus' : 1,
- 'getFirst' : 1,
- 'getLast' : 1,
- 'appendTo' : 1,
- 'moveChildren' : 1,
- 'insertBefore' : 1,
- 'insertAfterNode' : 1,
- 'replace' : 1,
- 'trim' : 1,
- 'type' : 1,
- 'ltrim' : 1,
- 'rtrim' : 1,
- 'getDocument' : 1,
- 'getChildCount' : 1,
- 'getChild' : 1,
- 'getChildren' : 1
- } );
View
204 vendor/assets/javascripts/bcms/ckeditor/core/dom/domobject.js
@@ -1,204 +0,0 @@
-/*
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-/**
- * @fileOverview Defines the {@link CKEDITOR.editor} class, which is the base
- * for other classes representing DOM objects.
- */
-
-/**
- * Represents a DOM object. This class is not intended to be used directly. It
- * serves as the base class for other classes representing specific DOM
- * objects.
- * @constructor
- * @param {Object} nativeDomObject A native DOM object.
- * @augments CKEDITOR.event
- * @example
- */
-CKEDITOR.dom.domObject = function( nativeDomObject )
-{
- if ( nativeDomObject )
- {
- /**
- * The native DOM object represented by this class instance.
- * @type Object
- * @example
- * var element = new CKEDITOR.dom.element( 'span' );
- * alert( element.$.nodeType ); // "1"
- */
- this.$ = nativeDomObject;
- }
-};
-
-CKEDITOR.dom.domObject.prototype = (function()
-{
- // Do not define other local variables here. We want to keep the native
- // listener closures as clean as possible.
-
- var getNativeListener = function( domObject, eventName )
- {
- return function( domEvent )
- {
- // In FF, when reloading the page with the editor focused, it may
- // throw an error because the CKEDITOR global is not anymore
- // available. So, we check it here first. (#2923)
- if ( typeof CKEDITOR != 'undefined' )
- domObject.fire( eventName, new CKEDITOR.dom.event( domEvent ) );
- };
- };
-
- return /** @lends CKEDITOR.dom.domObject.prototype */ {
-
- getPrivate : function()
- {
- var priv;
-
- // Get the main private function from the custom data. Create it if not
- // defined.
- if ( !( priv = this.getCustomData( '_' ) ) )
- this.setCustomData( '_', ( priv = {} ) );
-
- return priv;
- },
-
- /** @ignore */
- on : function( eventName )
- {
- // We customize the "on" function here. The basic idea is that we'll have
- // only one listener for a native event, which will then call all listeners
- // set to the event.
-
- // Get the listeners holder object.
- var nativeListeners = this.getCustomData( '_cke_nativeListeners' );
-
- if ( !nativeListeners )
- {
- nativeListeners = {};
- this.setCustomData( '_cke_nativeListeners', nativeListeners );
- }
-
- // Check if we have a listener for that event.
- if ( !nativeListeners[ eventName ] )
- {
- var listener = nativeListeners[ eventName ] = getNativeListener( this, eventName );
-
- if ( this.$.addEventListener )
- this.$.addEventListener( eventName, listener, !!CKEDITOR.event.useCapture );
- else if ( this.$.attachEvent )
- this.$.attachEvent( 'on' + eventName, listener );
- }
-
- // Call the original implementation.
- return CKEDITOR.event.prototype.on.apply( this, arguments );
- },
-
- /** @ignore */
- removeListener : function( eventName )
- {
- // Call the original implementation.
- CKEDITOR.event.prototype.removeListener.apply( this, arguments );
-
- // If we don't have listeners for this event, clean the DOM up.
- if ( !this.hasListeners( eventName ) )
- {
- var nativeListeners = this.getCustomData( '_cke_nativeListeners' );
- var listener = nativeListeners && nativeListeners[ eventName ];
- if ( listener )
- {
- if ( this.$.removeEventListener )
- this.$.removeEventListener( eventName, listener, false );
- else if ( this.$.detachEvent )
- this.$.detachEvent( 'on' + eventName, listener );
-
- delete nativeListeners[ eventName ];
- }
- }
- }
- };
-})();
-
-(function( domObjectProto )
-{
- var customData = {};
-
- /**
- * Determines whether the specified object is equal to the current object.
- * @name CKEDITOR.dom.domObject.prototype.equals
- * @function
- * @param {Object} object The object to compare with the current object.
- * @returns {Boolean} "true" if the object is equal.
- * @example
- * var doc = new CKEDITOR.dom.document( document );
- * alert( doc.equals( CKEDITOR.document ) ); // "true"
- * alert( doc == CKEDITOR.document ); // "false"
- */
- domObjectProto.equals = function( object )
- {
- return ( object && object.$ === this.$ );
- };
-
- /**
- * Sets a data slot value for this object. These values are shared by all
- * instances pointing to that same DOM object.
- * @name CKEDITOR.dom.domObject.prototype.setCustomData
- * @function
- * @param {String} key A key used to identify the data slot.
- * @param {Object} value The value to set to the data slot.
- * @returns {CKEDITOR.dom.domObject} This DOM object instance.
- * @see CKEDITOR.dom.domObject.prototype.getCustomData
- * @example
- * var element = new CKEDITOR.dom.element( 'span' );
- * element.setCustomData( 'hasCustomData', true );
- */
- domObjectProto.setCustomData = function( key, value )
- {
- var expandoNumber = this.getUniqueId(),
- dataSlot = customData[ expandoNumber ] || ( customData[ expandoNumber ] = {} );
-
- dataSlot[ key ] = value;
-
- return this;
- };
-
- /**
- * Gets the value set to a data slot in this object.
- * @name CKEDITOR.dom.domObject.prototype.getCustomData
- * @function
- * @param {String} key The key used to identify the data slot.
- * @returns {Object} This value set to the data slot.
- * @see CKEDITOR.dom.domObject.prototype.setCustomData
- * @example
- * var element = new CKEDITOR.dom.element( 'span' );
- * alert( element.getCustomData( 'hasCustomData' ) ); // e.g. 'true'
- */
- domObjectProto.getCustomData = function( key )
- {
- var expandoNumber = this.$._cke_expando,
- dataSlot = expandoNumber && customData[ expandoNumber ];
-
- return dataSlot && dataSlot[ key ];
- };
-
- domObjectProto.removeCustomData = function( key )
- {
- var expandoNumber = this.$._cke_expando,
- dataSlot = expandoNumber && customData[ expandoNumber ],
- retval = dataSlot && dataSlot[ key ];
-
- if ( typeof retval != 'undefined' )
- delete dataSlot[ key ];
-
- return retval || null;
- };
-
- domObjectProto.getUniqueId = function()
- {
- return this.$._cke_expando || ( this.$._cke_expando = CKEDITOR.tools.getNextNumber() );
- };
-
- // Implement CKEDITOR.event.
- CKEDITOR.event.implementOn( domObjectProto );
-
-})( CKEDITOR.dom.domObject.prototype );
View
1,384 vendor/assets/javascripts/bcms/ckeditor/core/dom/element.js
@@ -1,1384 +0,0 @@
-/*
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
-
-/**
- * @fileOverview Defines the {@link CKEDITOR.dom.element} class, which
- * represents a DOM element.
- */
-
-/**
- * Represents a DOM element.
- * @constructor
- * @augments CKEDITOR.dom.node
- * @param {Object|String} element A native DOM element or the element name for
- * new elements.
- * @param {CKEDITOR.dom.document} [ownerDocument] The document that will contain
- * the element in case of element creation.
- * @example
- * // Create a new &lt;span&gt; element.
- * var element = new CKEDITOR.dom.element( 'span' );
- * @example
- * // Create an element based on a native DOM element.
- * var element = new CKEDITOR.dom.element( document.getElementById( 'myId' ) );
- */
-CKEDITOR.dom.element = function( element, ownerDocument )
-{
- if ( typeof element == 'string' )
- element = ( ownerDocument ? ownerDocument.$ : document ).createElement( element );
-
- // Call the base constructor (we must not call CKEDITOR.dom.node).
- CKEDITOR.dom.domObject.call( this, element );
-};
-
-// PACKAGER_RENAME( CKEDITOR.dom.element )
-
-/**
- * The the {@link CKEDITOR.dom.element} representing and element. If the
- * element is a native DOM element, it will be transformed into a valid
- * CKEDITOR.dom.element object.
- * @returns {CKEDITOR.dom.element} The transformed element.
- * @example
- * var element = new CKEDITOR.dom.element( 'span' );
- * alert( element == <b>CKEDITOR.dom.element.get( element )</b> ); "true"
- * @example
- * var element = document.getElementById( 'myElement' );
- * alert( <b>CKEDITOR.dom.element.get( element )</b>.getName() ); e.g. "p"
- */
-CKEDITOR.dom.element.get = function( element )
-{
- return element && ( element.$ ? element : new CKEDITOR.dom.element( element ) );
-};
-
-CKEDITOR.dom.element.prototype = new CKEDITOR.dom.node();
-
-/**
- * Creates an instance of the {@link CKEDITOR.dom.element} class based on the
- * HTML representation of an element.
- * @param {String} html The element HTML. It should define only one element in
- * the "root" level. The "root" element can have child nodes, but not
- * siblings.
- * @returns {CKEDITOR.dom.element} The element instance.
- * @example
- * var element = <b>CKEDITOR.dom.element.createFromHtml( '&lt;strong class="anyclass"&gt;My element&lt;/strong&gt;' )</b>;
- * alert( element.getName() ); // "strong"
- */
-CKEDITOR.dom.element.createFromHtml = function( html, ownerDocument )
-{
- var temp = new CKEDITOR.dom.element( 'div', ownerDocument );
- temp.setHtml( html );
-
- // When returning the node, remove it from its parent to detach it.
- return temp.getFirst().remove();
-};
-
-CKEDITOR.dom.element.setMarker = function( database, element, name, value )
-{
- var id = element.getCustomData( 'list_marker_id' ) ||
- ( element.setCustomData( 'list_marker_id', CKEDITOR.tools.getNextNumber() ).getCustomData( 'list_marker_id' ) ),
- markerNames = element.getCustomData( 'list_marker_names' ) ||
- ( element.setCustomData( 'list_marker_names', {} ).getCustomData( 'list_marker_names' ) );
- database[id] = element;
- markerNames[name] = 1;
-
- return element.setCustomData( name, value );
-};
-
-CKEDITOR.dom.element.clearAllMarkers = function( database )
-{
- for ( var i in database )
- CKEDITOR.dom.element.clearMarkers( database, database[i], true );
-};
-
-CKEDITOR.dom.element.clearMarkers = function( database, element, removeFromDatabase )
-{
- var names = element.getCustomData( 'list_marker_names' ),
- id = element.getCustomData( 'list_marker_id' );
- for ( var i in names )
- element.removeCustomData( i );
- element.removeCustomData( 'list_marker_names' );
- if ( removeFromDatabase )
- {
- element.removeCustomData( 'list_marker_id' );
- delete database[id];
- }
-};
-
-CKEDITOR.tools.extend( CKEDITOR.dom.element.prototype,
- /** @lends CKEDITOR.dom.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 CSS class to the element. It appends the class to the
- * already existing names.
- * @param {String} className The name of the class to be added.
- * @example
- * var element = new CKEDITOR.dom.element( 'div' );
- * element.addClass( 'classA' ); // &lt;div class="classA"&gt;
- * element.addClass( 'classB' ); // &lt;div class="classA classB"&gt;
- * element.addClass( 'classA' ); // &lt;div class="classA classB"&gt;
- */
- addClass : function( className )
- {
- var c = this.$.className;
- if ( c )
- {
- var regex = new RegExp( '(?:^|\\s)' + className + '(?:\\s|$)', '' );
- if ( !regex.test( c ) )
- c += ' ' + className;
- }
- this.$.className = c || className;
- },
-
- /**
- * Removes a CSS class name from the elements classes. Other classes
- * remain untouched.
- * @param {String} className The name of the class to remove.
- * @example
- * var element = new CKEDITOR.dom.element( 'div' );
- * element.addClass( 'classA' ); // &lt;div class="classA"&gt;
- * element.addClass( 'classB' ); // &lt;div class="classA classB"&gt;
- * element.removeClass( 'classA' ); // &lt;div class="classB"&gt;
- * element.removeClass( 'classB' ); // &lt;div&gt;
- */
- removeClass : function( className )
- {
- var c = this.getAttribute( 'class' );
- if ( c )
- {
- var regex = new RegExp( '(?:^|\\s+)' + className + '(?=\\s|$)', 'i' );
- if ( regex.test( c ) )
- {
- c = c.replace( regex, '' ).replace( /^\s+/, '' );
-
- if ( c )
- this.setAttribute( 'class', c );
- else
- this.removeAttribute( 'class' );
- }
- }
- },
-
- hasClass : function( className )
- {
- var regex = new RegExp( '(?:^|\\s+)' + className + '(?=\\s|$)', '' );
- return regex.test( this.getAttribute('class') );
- },
-
- /**
- * Append a node as a child of this element.
- * @param {CKEDITOR.dom.node|String} node The node or element name to be
- * appended.
- * @param {Boolean} [toStart] Indicates that the element is to be
- * appended at the start.
- * @returns {CKEDITOR.dom.node} The appended node.
- * @example
- * var p = new CKEDITOR.dom.element( 'p' );
- *
- * var strong = new CKEDITOR.dom.element( 'strong' );
- * <b>p.append( strong );</b>
- *
- * var em = <b>p.append( 'em' );</b>
- *
- * // result: "&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;em&gt;&lt;/em&gt;&lt;/p&gt;"
- */
- append : function( node, toStart )
- {
- if ( typeof node == 'string' )
- node = this.getDocument().createElement( node );
-
- if ( toStart )
- this.$.insertBefore( node.$, this.$.firstChild );
- else
- this.$.appendChild( node.$ );
-
- return node;
- },
-
- appendHtml : function( html )
- {
- if ( !this.$.childNodes.length )
- this.setHtml( html );
- else
- {
- var temp = new CKEDITOR.dom.element( 'div', this.getDocument() );
- temp.setHtml( html );
- temp.moveChildren( this );
- }
- },
-
- /**
- * Append text to this element.
- * @param {String} text The text to be appended.
- * @returns {CKEDITOR.dom.node} The appended node.
- * @example
- * var p = new CKEDITOR.dom.element( 'p' );
- * p.appendText( 'This is' );
- * p.appendText( ' some text' );
- *
- * // result: "&lt;p&gt;This is some text&lt;/p&gt;"
- */
- appendText : function( text )
- {
- if ( this.$.text != undefined )
- this.$.text += text;
- else
- this.append( new CKEDITOR.dom.text( text ) );
- },
-
- appendBogus : function()
- {
- var lastChild = this.getLast() ;
-
- // Ignore empty/spaces text.
- while ( lastChild && lastChild.type == CKEDITOR.NODE_TEXT && !CKEDITOR.tools.rtrim( lastChild.getText() ) )
- lastChild = lastChild.getPrevious();
- if ( !lastChild || !lastChild.is || !lastChild.is( 'br' ) )
- {
- this.append(
- CKEDITOR.env.opera ?
- this.getDocument().createText('') :
- this.getDocument().createElement( 'br' ) );
- }
- },
-
- /**
- * Breaks one of the ancestor element in the element position, moving
- * this element between the broken parts.
- * @param {CKEDITOR.dom.element} parent The anscestor element to get broken.
- * @example
- * // Before breaking:
- * // <b>This <i>is some<span /> sample</i> test text</b>
- * // If "element" is <span /> and "parent" is <i>:
- * // <b>This <i>is some</i><span /><i> sample</i> test text</b>
- * element.breakParent( parent );
- * @example
- * // Before breaking:
- * // <b>This <i>is some<span /> sample</i> test text</b>
- * // If "element" is <span /> and "parent" is <b>:
- * // <b>This <i>is some</i></b><span /><b><i> sample</i> test text</b>
- * element.breakParent( parent );
- */
- breakParent : function( parent )
- {
- var range = new CKEDITOR.dom.range( this.getDocument() );
-
- // We'll be extracting part of this element, so let's use our
- // range to get the correct piece.
- range.setStartAfter( this );
- range.setEndAfter( parent );
-
- // Extract it.
- var docFrag = range.extractContents();
-
- // Move the element outside the broken element.
- range.insertNode( this.remove() );
-
- // Re-insert the extracted piece after the element.
- docFrag.insertAfterNode( this );
- },
-
- contains :
- CKEDITOR.env.ie || CKEDITOR.env.webkit ?
- function( node )
- {
- var $ = this.$;
-
- return node.type != CKEDITOR.NODE_ELEMENT ?
- $.contains( node.getParent().$ ) :
- $ != node.$ && $.contains( node.$ );
- }
- :
- function( node )
- {
- return !!( this.$.compareDocumentPosition( node.$ ) & 16 );
- },
-
- /**
- * Moves the selection focus to this element.
- * @example
- * var element = CKEDITOR.document.getById( 'myTextarea' );
- * <b>element.focus()</b>;
- */
- focus : function()
- {
- // IE throws error if the element is not visible.
- try
- {
- this.$.focus();
- }
- catch (e)
- {}
- },
-
- /**
- * Gets the inner HTML of this element.
- * @returns {String} The inner HTML of this element.
- * @example
- * var element = CKEDITOR.dom.element.createFromHtml( '&lt;div&gt;&lt;b&gt;Example&lt;/b&gt;&lt;/div&gt;' );
- * alert( <b>p.getHtml()</b> ); // "&lt;b&gt;Example&lt;/b&gt;"
- */
- getHtml : function()
- {
- return this.$.innerHTML;
- },
-
- getOuterHtml : function()
- {
- if ( this.$.outerHTML )
- {
- // IE includes the <?xml:namespace> tag in the outerHTML of
- // namespaced element. So, we must strip it here. (#3341)
- return this.$.outerHTML.replace( /<\?[^>]*>/, '' );
- }
-
- var tmpDiv = this.$.ownerDocument.createElement( 'div' );
- tmpDiv.appendChild( this.$.cloneNode( true ) );
- return tmpDiv.innerHTML;
- },
-
- /**
- * Sets the inner HTML of this element.
- * @param {String} html The HTML to be set for this element.
- * @returns {String} The inserted HTML.
- * @example
- * var p = new CKEDITOR.dom.element( 'p' );
- * <b>p.setHtml( '&lt;b&gt;Inner&lt;/b&gt; HTML' );</b>
- *
- * // result: "&lt;p&gt;&lt;b&gt;Inner&lt;/b&gt; HTML&lt;/p&gt;"
- */
- setHtml : function( html )
- {
- return ( this.$.innerHTML = html );
- },
-
- /**
- * Sets the element contents as plain text.
- * @param {String} text The text to be set.
- * @returns {String} The inserted text.
- * @example
- * var element = new CKEDITOR.dom.element( 'div' );
- * element.setText( 'A > B & C < D' );
- * alert( element.innerHTML ); // "A &amp;gt; B &amp;amp; C &amp;lt; D"
- */
- setText : function( text )
- {
- CKEDITOR.dom.element.prototype.setText = ( this.$.innerText != undefined ) ?
- function ( text )
- {
- return this.$.innerText = text;
- } :
- function ( text )
- {
- return this.$.textContent = text;
- };
-
- return this.setText( text );
- },
-
- /**
- * Gets the value of an element attribute.
- * @function
- * @param {String} name The attribute name.
- * @returns {String} The attribute value or null if not defined.
- * @example
- * var element = CKEDITOR.dom.element.createFromHtml( '&lt;input type="text" /&gt;' );
- * alert( <b>element.getAttribute( 'type' )</b> ); // "text"
- */
- getAttribute : (function()
- {
- var standard = function( name )
- {
- return this.$.getAttribute( name, 2 );
- };
-
- if ( CKEDITOR.env.ie && ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) )
- {
- return function( name )
- {
- switch ( name )
- {
- case 'class':
- name = 'className';
- break;
-
- case 'tabindex':
- var tabIndex = standard.call( this, name );
-
- // IE returns tabIndex=0 by default for all
- // elements. For those elements,
- // getAtrribute( 'tabindex', 2 ) returns 32768
- // instead. So, we must make this check to give a
- // uniform result among all browsers.
- if ( tabIndex !== 0 && this.$.tabIndex === 0 )
- tabIndex = null;
-
- return tabIndex;
- break;
-
- case 'checked':
- return this.$.checked;
- break;
-
- case 'style':
- // IE does not return inline styles via getAttribute(). See #2947.
- return this.$.style.cssText;
- }
-
- return standard.call( this, name );
- };
- }
- else
- return standard;
- })(),
-
- getChildren : function()
- {
- return new CKEDITOR.dom.nodeList( this.$.childNodes );
- },
-
- /**
- * Gets the current computed value of one of the element CSS style
- * properties.
- * @function
- * @param {String} propertyName The style property name.
- * @returns {String} The property value.
- * @example
- * var element = new CKEDITOR.dom.element( 'span' );
- * alert( <b>element.getComputedStyle( 'display' )</b> ); // "inline"
- */
- getComputedStyle :
- CKEDITOR.env.ie ?
- function( propertyName )
- {
- return this.$.currentStyle[ CKEDITOR.tools.cssStyleToDomStyle( propertyName ) ];
- }
- :
- function( propertyName )
- {
- return this.getWindow().$.getComputedStyle( this.$, '' ).getPropertyValue( propertyName );
- },
-
- /**
- * Gets the DTD entries for this element.
- * @returns {Object} An object containing the list of elements accepted
- * by this element.
- */
- getDtd : function()
- {
- var dtd = CKEDITOR.dtd[ this.getName() ];
-
- this.getDtd = function()
- {
- return dtd;
- };
-
- return dtd;
- },
-
- getElementsByTag : CKEDITOR.dom.document.prototype.getElementsByTag,
-
- /**
- * Gets the computed tabindex for this element.
- * @function
- * @returns {Number} The tabindex value.
- * @example
- * var element = CKEDITOR.document.getById( 'myDiv' );
- * alert( <b>element.getTabIndex()</b> ); // e.g. "-1"
- */
- getTabIndex :
- CKEDITOR.env.ie ?
- function()
- {
- var tabIndex = this.$.tabIndex;
-
- // IE returns tabIndex=0 by default for all elements. In
- // those cases we must check that the element really has
- // the tabindex attribute set to zero, or it is one of
- // those element that should have zero by default.
- if ( tabIndex === 0 && !CKEDITOR.dtd.$tabIndex[ this.getName() ] && parseInt( this.getAttribute( 'tabindex' ), 10 ) !== 0 )
- tabIndex = -1;
-
- return tabIndex;
- }
- : CKEDITOR.env.webkit ?
- function()
- {
- var tabIndex = this.$.tabIndex;
-
- // Safari returns "undefined" for elements that should not
- // have tabindex (like a div). So, we must try to get it
- // from the attribute.
- // https://bugs.webkit.org/show_bug.cgi?id=20596
- if ( tabIndex == undefined )
- {
- tabIndex = parseInt( this.getAttribute( 'tabindex' ), 10 );
-
- // If the element don't have the tabindex attribute,
- // then we should return -1.
- if ( isNaN( tabIndex ) )
- tabIndex = -1;
- }
-
- return tabIndex;
- }
- :
- function()
- {
- return this.$.tabIndex;
- },
-
- /**
- * Gets the text value of this element.
- *
- * Only in IE (which uses innerText), &lt;br&gt; will cause linebreaks,
- * and sucessive whitespaces (including line breaks) will be reduced to
- * a single space. This behavior is ok for us, for now. It may change
- * in the future.
- * @returns {String} The text value.
- * @example
- * var element = CKEDITOR.dom.element.createFromHtml( '&lt;div&gt;Same &lt;i&gt;text&lt;/i&gt;.&lt;/div&gt;' );
- * alert( <b>element.getText()</b> ); // "Sample text."
- */
- getText : function()
- {
- return this.$.textContent || this.$.innerText || '';
- },
-
- /**
- * Gets the window object that contains this element.
- * @returns {CKEDITOR.dom.window} The window object.
- * @example
- */
- getWindow : function()
- {
- return this.getDocument().getWindow();
- },
-
- /**
- * Gets the value of the "id" attribute of this element.
- * @returns {String} The element id, or null if not available.
- * @example
- * var element = CKEDITOR.dom.element.createFromHtml( '&lt;p id="myId"&gt;&lt;/p&gt;' );
- * alert( <b>element.getId()</b> ); // "myId"
- */
- getId : function()
- {
- return this.$.id || null;
- },
-
- /**
- * Gets the value of the "name" attribute of this element.
- * @returns {String} The element name, or null if not available.