rails 3.1 and designs (with bug)
This commit is contained in:
parent
7215b56f7e
commit
f387139ae1
9
Gemfile
9
Gemfile
|
@ -1,6 +1,6 @@
|
|||
source 'http://rubygems.org'
|
||||
|
||||
gem 'rails', '3.0.6'
|
||||
gem 'rails', '>=3.1.0.rc4'
|
||||
gem 'yajl-ruby', :require => 'yajl'
|
||||
|
||||
gem 'bson_ext'
|
||||
|
@ -9,13 +9,14 @@ gem 'ckeditor'
|
|||
gem 'devise'
|
||||
gem 'mini_magick'
|
||||
|
||||
gem 'mongoid', '2.0.0'
|
||||
gem 'mongoid'
|
||||
|
||||
gem 'rake', '0.8.7'
|
||||
gem 'rake', '>=0.9.2'
|
||||
gem 'jquery-rails', '>= 1.0.3'
|
||||
|
||||
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
|
||||
# gem 'ruby-debug'
|
||||
# gem 'ruby-debug19'
|
||||
gem 'ruby-debug19'
|
||||
|
||||
group :test, :development do
|
||||
gem "rspec", "~> 2.0"
|
||||
|
|
162
Gemfile.lock
162
Gemfile.lock
|
@ -1,99 +1,116 @@
|
|||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
abstract (1.0.0)
|
||||
actionmailer (3.0.6)
|
||||
actionpack (= 3.0.6)
|
||||
mail (~> 2.2.15)
|
||||
actionpack (3.0.6)
|
||||
activemodel (= 3.0.6)
|
||||
activesupport (= 3.0.6)
|
||||
builder (~> 2.1.2)
|
||||
erubis (~> 2.6.6)
|
||||
i18n (~> 0.5.0)
|
||||
rack (~> 1.2.1)
|
||||
rack-mount (~> 0.6.14)
|
||||
rack-test (~> 0.5.7)
|
||||
tzinfo (~> 0.3.23)
|
||||
activemodel (3.0.6)
|
||||
activesupport (= 3.0.6)
|
||||
builder (~> 2.1.2)
|
||||
i18n (~> 0.5.0)
|
||||
activerecord (3.0.6)
|
||||
activemodel (= 3.0.6)
|
||||
activesupport (= 3.0.6)
|
||||
arel (~> 2.0.2)
|
||||
tzinfo (~> 0.3.23)
|
||||
activeresource (3.0.6)
|
||||
activemodel (= 3.0.6)
|
||||
activesupport (= 3.0.6)
|
||||
activesupport (3.0.6)
|
||||
arel (2.0.10)
|
||||
actionmailer (3.1.0.rc4)
|
||||
actionpack (= 3.1.0.rc4)
|
||||
mail (~> 2.3.0)
|
||||
actionpack (3.1.0.rc4)
|
||||
activemodel (= 3.1.0.rc4)
|
||||
activesupport (= 3.1.0.rc4)
|
||||
builder (~> 3.0.0)
|
||||
erubis (~> 2.7.0)
|
||||
i18n (~> 0.6)
|
||||
rack (~> 1.3.0)
|
||||
rack-cache (~> 1.0.1)
|
||||
rack-mount (~> 0.8.1)
|
||||
rack-test (~> 0.6.0)
|
||||
sprockets (~> 2.0.0.beta.10)
|
||||
tzinfo (~> 0.3.27)
|
||||
activemodel (3.1.0.rc4)
|
||||
activesupport (= 3.1.0.rc4)
|
||||
bcrypt-ruby (~> 2.1.4)
|
||||
builder (~> 3.0.0)
|
||||
i18n (~> 0.6)
|
||||
activerecord (3.1.0.rc4)
|
||||
activemodel (= 3.1.0.rc4)
|
||||
activesupport (= 3.1.0.rc4)
|
||||
arel (~> 2.1.1)
|
||||
tzinfo (~> 0.3.27)
|
||||
activeresource (3.1.0.rc4)
|
||||
activemodel (= 3.1.0.rc4)
|
||||
activesupport (= 3.1.0.rc4)
|
||||
activesupport (3.1.0.rc4)
|
||||
multi_json (~> 1.0)
|
||||
archive-tar-minitar (0.5.2)
|
||||
arel (2.1.3)
|
||||
bcrypt-ruby (2.1.4)
|
||||
bcrypt-ruby (2.1.4-x86-mingw32)
|
||||
bson (1.3.1)
|
||||
bson_ext (1.3.1)
|
||||
builder (2.1.2)
|
||||
builder (3.0.0)
|
||||
carrierwave (0.5.4)
|
||||
activesupport (~> 3.0)
|
||||
chronic (0.3.0)
|
||||
chronic (0.5.0)
|
||||
ckeditor (3.5.4)
|
||||
mime-types (>= 1.16)
|
||||
delorean (1.0.0)
|
||||
columnize (0.3.2)
|
||||
delorean (1.1.0)
|
||||
chronic
|
||||
devise (1.3.4)
|
||||
devise (1.4.2)
|
||||
bcrypt-ruby (~> 2.1.2)
|
||||
orm_adapter (~> 0.0.3)
|
||||
warden (~> 1.0.3)
|
||||
diff-lcs (1.1.2)
|
||||
erubis (2.6.6)
|
||||
abstract (>= 1.0.0)
|
||||
erubis (2.7.0)
|
||||
factory_girl (1.3.3)
|
||||
factory_girl_rails (1.0.1)
|
||||
factory_girl (~> 1.3)
|
||||
railties (>= 3.0.0)
|
||||
i18n (0.5.0)
|
||||
mail (2.2.19)
|
||||
activesupport (>= 2.3.6)
|
||||
hike (1.1.0)
|
||||
i18n (0.6.0)
|
||||
jquery-rails (1.0.12)
|
||||
railties (~> 3.0)
|
||||
thor (~> 0.14)
|
||||
linecache19 (0.5.12)
|
||||
ruby_core_source (>= 0.1.4)
|
||||
mail (2.3.0)
|
||||
i18n (>= 0.4.0)
|
||||
mime-types (~> 1.16)
|
||||
treetop (~> 1.4.8)
|
||||
mime-types (1.16)
|
||||
mini_magick (3.2.1)
|
||||
subexec (~> 0.0.4)
|
||||
mini_magick (3.3)
|
||||
subexec (~> 0.1.0)
|
||||
mongo (1.3.1)
|
||||
bson (>= 1.3.1)
|
||||
mongoid (2.0.0)
|
||||
mongoid (2.0.2)
|
||||
activemodel (~> 3.0)
|
||||
mongo (~> 1.2)
|
||||
mongo (~> 1.3)
|
||||
tzinfo (~> 0.3.22)
|
||||
will_paginate (~> 3.0.pre)
|
||||
multi_json (1.0.3)
|
||||
orm_adapter (0.0.5)
|
||||
polyglot (0.3.1)
|
||||
rack (1.2.3)
|
||||
rack-mount (0.6.14)
|
||||
rack (1.3.0)
|
||||
rack-cache (1.0.2)
|
||||
rack (>= 0.4)
|
||||
rack-mount (0.8.1)
|
||||
rack (>= 1.0.0)
|
||||
rack-test (0.5.7)
|
||||
rack-ssl (1.3.2)
|
||||
rack
|
||||
rack-test (0.6.0)
|
||||
rack (>= 1.0)
|
||||
rails (3.0.6)
|
||||
actionmailer (= 3.0.6)
|
||||
actionpack (= 3.0.6)
|
||||
activerecord (= 3.0.6)
|
||||
activeresource (= 3.0.6)
|
||||
activesupport (= 3.0.6)
|
||||
rails (3.1.0.rc4)
|
||||
actionmailer (= 3.1.0.rc4)
|
||||
actionpack (= 3.1.0.rc4)
|
||||
activerecord (= 3.1.0.rc4)
|
||||
activeresource (= 3.1.0.rc4)
|
||||
activesupport (= 3.1.0.rc4)
|
||||
bundler (~> 1.0)
|
||||
railties (= 3.0.6)
|
||||
railties (3.0.6)
|
||||
actionpack (= 3.0.6)
|
||||
activesupport (= 3.0.6)
|
||||
railties (= 3.1.0.rc4)
|
||||
railties (3.1.0.rc4)
|
||||
actionpack (= 3.1.0.rc4)
|
||||
activesupport (= 3.1.0.rc4)
|
||||
rack-ssl (~> 1.3.2)
|
||||
rake (>= 0.8.7)
|
||||
thor (~> 0.14.4)
|
||||
rake (0.8.7)
|
||||
rdoc (~> 3.4)
|
||||
thor (~> 0.14.6)
|
||||
rake (0.9.2)
|
||||
rcov (0.9.9)
|
||||
rdoc (3.8)
|
||||
rspec (2.6.0)
|
||||
rspec-core (~> 2.6.0)
|
||||
rspec-expectations (~> 2.6.0)
|
||||
rspec-mocks (~> 2.6.0)
|
||||
rspec-core (2.6.3)
|
||||
rspec-core (2.6.4)
|
||||
rspec-expectations (2.6.0)
|
||||
diff-lcs (~> 1.1.2)
|
||||
rspec-mocks (2.6.0)
|
||||
|
@ -102,19 +119,34 @@ GEM
|
|||
activesupport (~> 3.0)
|
||||
railties (~> 3.0)
|
||||
rspec (~> 2.6.0)
|
||||
ruby-debug-base19 (0.11.25)
|
||||
columnize (>= 0.3.1)
|
||||
linecache19 (>= 0.5.11)
|
||||
ruby_core_source (>= 0.1.4)
|
||||
ruby-debug19 (0.11.6)
|
||||
columnize (>= 0.3.1)
|
||||
linecache19 (>= 0.5.11)
|
||||
ruby-debug-base19 (>= 0.11.19)
|
||||
ruby_core_source (0.1.5)
|
||||
archive-tar-minitar (>= 0.5.2)
|
||||
shoulda-matchers (1.0.0.beta2)
|
||||
subexec (0.0.4)
|
||||
sprockets (2.0.0.beta.10)
|
||||
hike (~> 1.0)
|
||||
rack (~> 1.0)
|
||||
tilt (!= 1.3.0, ~> 1.1)
|
||||
subexec (0.1.0)
|
||||
thor (0.14.6)
|
||||
tilt (1.3.2)
|
||||
treetop (1.4.9)
|
||||
polyglot (>= 0.3.1)
|
||||
tzinfo (0.3.27)
|
||||
tzinfo (0.3.29)
|
||||
warden (1.0.4)
|
||||
rack (>= 1.0)
|
||||
watchr (0.7)
|
||||
will_paginate (3.0.pre2)
|
||||
yajl-ruby (0.8.2)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
x86-mingw32
|
||||
|
||||
DEPENDENCIES
|
||||
|
@ -124,13 +156,15 @@ DEPENDENCIES
|
|||
delorean
|
||||
devise
|
||||
factory_girl_rails
|
||||
jquery-rails (>= 1.0.3)
|
||||
mini_magick
|
||||
mongoid (= 2.0.0)
|
||||
rails (= 3.0.6)
|
||||
rake (= 0.8.7)
|
||||
mongoid
|
||||
rails (>= 3.1.0.rc4)
|
||||
rake (>= 0.9.2)
|
||||
rcov
|
||||
rspec (~> 2.0)
|
||||
rspec-rails (~> 2.0)
|
||||
ruby-debug19
|
||||
shoulda-matchers
|
||||
watchr
|
||||
yajl-ruby
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
<% content_for :sidebar do %>
|
||||
<%= render 'admin/items/site_map_left_bar' %>
|
||||
<% end -%>
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
<title>R4</title>
|
||||
<link rel="shortcut icon" href="/favicon.ico">
|
||||
<%= yield :page_specific_link %>
|
||||
<%= stylesheet_link_tag "easy", "main", "devise", :media => "screen, projection" %>
|
||||
<%= stylesheet_link_tag "easyprint", :media => "print" %>
|
||||
<%= stylesheet_link_tag "rulingcom/easy", :media => "screen, projection" %>
|
||||
<%= stylesheet_link_tag "rulingcom/easyprint", :media => "print" %>
|
||||
<%= javascript_include_tag :defaults %>
|
||||
<!--[if IE]>
|
||||
<%= stylesheet_link_tag "ie", :media => "screen, projection" %>
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
<title>R4</title>
|
||||
<link rel="shortcut icon" href="/favicon.ico">
|
||||
<%= yield :page_specific_link %>
|
||||
<%= stylesheet_link_tag "easy", "main", "devise", :media => "screen, projection" %>
|
||||
<%= stylesheet_link_tag "easyprint", :media => "print" %>
|
||||
<%= javascript_include_tag :defaults %>
|
||||
<%= stylesheet_link_tag "rulingcom/easy", :media => "screen, projection" %>
|
||||
<%= stylesheet_link_tag "rulingcom/easyprint", :media => "print" %>
|
||||
<%= stylesheet_link_tag "application", :media => "screen, projection" %>
|
||||
<!--[if IE]>
|
||||
<%= stylesheet_link_tag "ie", :media => "screen, projection" %>
|
||||
<![endif]-->
|
||||
|
|
|
@ -14,9 +14,9 @@ Bundler.require(:default, Rails.env) if defined?(Bundler)
|
|||
module PrototypeR4
|
||||
class Application < Rails::Application
|
||||
|
||||
config.paths.vendor.plugins.instance_variable_set("@paths", config.paths.vendor.plugins.instance_variable_get("@paths") + ["#{config.root}/vendor/built_in_modules"])
|
||||
config.paths.vendor.plugins.instance_variable_set("@paths", config.paths.vendor.plugins.instance_variable_get("@paths") + ["#{config.root}/vendor/downloaded_modules"])
|
||||
config.paths.vendor.plugins.instance_variable_set("@paths", config.paths.vendor.plugins.instance_variable_get("@paths") + ["#{config.root}/vendor/radius"])
|
||||
# config.paths.vendor.plugins.instance_variable_set("@paths", config.paths.vendor.plugins.instance_variable_get("@paths") + ["#{config.root}/vendor/built_in_modules"])
|
||||
# config.paths.vendor.plugins.instance_variable_set("@paths", config.paths.vendor.plugins.instance_variable_get("@paths") + ["#{config.root}/vendor/downloaded_modules"])
|
||||
# config.paths.vendor.plugins.instance_variable_set("@paths", config.paths.vendor.plugins.instance_variable_get("@paths") + ["#{config.root}/vendor/radius"])
|
||||
|
||||
# Settings in config/environments/* take precedence over those specified here.
|
||||
# Application configuration should go into files in config/initializers
|
||||
|
@ -51,6 +51,9 @@ module PrototypeR4
|
|||
|
||||
# Configure sensitive parameters which will be filtered from the log file.
|
||||
config.filter_parameters += [:password]
|
||||
|
||||
# Enable the asset pipeline
|
||||
config.assets.enabled = true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
require 'rubygems'
|
||||
|
||||
# Set up gems listed in the Gemfile.
|
||||
gemfile = File.expand_path('../../Gemfile', __FILE__)
|
||||
begin
|
||||
#gemfile = File.expand_path('../../Gemfile', __FILE__)
|
||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',__FILE__)
|
||||
|
||||
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
|
||||
|
||||
=begin
|
||||
ENV['BUNDLE_GEMFILE'] = gemfile
|
||||
require 'bundler'
|
||||
Bundler.setup
|
||||
|
@ -10,4 +14,4 @@ rescue Bundler::GemNotFound => e
|
|||
STDERR.puts e.message
|
||||
STDERR.puts "Try running `bundle install`."
|
||||
exit!
|
||||
end if File.exist?(gemfile)
|
||||
=end if File.exist?(gemfile)
|
||||
|
|
|
@ -11,7 +11,7 @@ PrototypeR4::Application.configure do
|
|||
|
||||
# Show full error reports and disable caching
|
||||
config.consider_all_requests_local = true
|
||||
config.action_view.debug_rjs = true
|
||||
#config.action_view.debug_rjs = true
|
||||
config.action_controller.perform_caching = false
|
||||
|
||||
# Don't care if the mailer can't send
|
||||
|
@ -22,5 +22,6 @@ PrototypeR4::Application.configure do
|
|||
|
||||
# Only use best-standards-support built into browsers
|
||||
config.action_dispatch.best_standards_support = :builtin
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -46,4 +46,9 @@ PrototypeR4::Application.configure do
|
|||
|
||||
# Send deprecation notices to registered listeners
|
||||
config.active_support.deprecation = :notify
|
||||
|
||||
|
||||
#compress both stylesheets and Javascripts
|
||||
config.assets.js_compressor = :uglifier
|
||||
config.assets.css_compressor = :scss
|
||||
end
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
# If you change this key, all old signed cookies will become invalid!
|
||||
# Make sure the secret is at least 30 characters and all random,
|
||||
# no regular words or you'll be exposed to dictionary attacks.
|
||||
ActionController::Base.cookie_verifier_secret = 'cbf6409102b30cb9f4da455ee08c3a7e9d8b2a3d32a0e5b59a354dad03f469d363a8127ef4b7bc3b1afa632d7cf947a1e59e09022d2d4cd8df1f4fa521d7ec07'
|
||||
PrototypeR4::Application.config.secret_token = 'cbf6409102b30cb9f4da455ee08c3a7e9d8b2a3d32a0e5b59a354dad03f469d363a8127ef4b7bc3b1afa632d7cf947a1e59e09022d2d4cd8df1f4fa521d7ec07'
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
data = File.open(File.join(RAILS_ROOT, 'config', 'list.yml')).read
|
||||
#data = File.open(File.join(RAILS_ROOT, 'config', 'list.yml')).read
|
||||
data = File.open(File.join(Rails.root, 'config', 'list.yml')).read
|
||||
LIST = YAML::load(ERB.new(data).result(binding)).symbolize_keys
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
PrototypeR4::Application.routes.draw do
|
||||
|
||||
devise_for :users
|
||||
|
||||
# The priority is based upon order of creation:
|
||||
|
@ -43,6 +44,7 @@ PrototypeR4::Application.routes.draw do
|
|||
|
||||
end
|
||||
resources :layouts
|
||||
resources :designs
|
||||
resources :links do
|
||||
member do
|
||||
get 'delete'
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 157 B |
Binary file not shown.
Before Width: | Height: | Size: 857 B |
Binary file not shown.
Before Width: | Height: | Size: 6.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 181 B |
Binary file not shown.
Before Width: | Height: | Size: 184 B |
Binary file not shown.
|
@ -1,29 +0,0 @@
|
|||
// Place your application-specific JavaScript functions and classes here
|
||||
// This file is automatically included by javascript_include_tag :defaults
|
||||
|
||||
$(function () {
|
||||
$('#panel_sidebar a, #panel_main a.nav').live('click',
|
||||
function () {
|
||||
$.getScript(this.href);
|
||||
history.pushState(null, document.title, this.href);
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
$('#panel_main a.reload').live('click',
|
||||
function () {
|
||||
$.getScript(this.href);
|
||||
history.replaceState(null, document.title, this.href);
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
$('.form').live('submit', function () {
|
||||
$.post(this.action, $(this).serialize(), null, 'script');
|
||||
return false;
|
||||
});
|
||||
|
||||
$(window).bind("popstate", function () {
|
||||
$.getScript(location.href);
|
||||
});
|
||||
});
|
|
@ -1,24 +0,0 @@
|
|||
#
|
||||
# Copyright (c) 2003-2011, 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
|
File diff suppressed because it is too large
Load Diff
|
@ -1,92 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Installation Guide - CKEditor</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<style type="text/css">
|
||||
h3
|
||||
{
|
||||
border-bottom: 1px solid #AAAAAA;
|
||||
}
|
||||
pre
|
||||
{
|
||||
background-color: #F9F9F9;
|
||||
border: 1px dashed #2F6FAB;
|
||||
padding: 1em;
|
||||
line-height: 1.1em;
|
||||
}
|
||||
#footer hr
|
||||
{
|
||||
margin: 10px 0 15px 0;
|
||||
height: 1px;
|
||||
border: solid 1px gray;
|
||||
border-bottom: none;
|
||||
}
|
||||
#footer p
|
||||
{
|
||||
margin: 0 10px 10px 10px;
|
||||
float: left;
|
||||
}
|
||||
#footer #copy
|
||||
{
|
||||
float: right;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>
|
||||
CKEditor Installation Guide</h1>
|
||||
<h3>
|
||||
What's CKEditor?</h3>
|
||||
<p>
|
||||
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.</p>
|
||||
<h3>
|
||||
Installation</h3>
|
||||
<p>
|
||||
Installing CKEditor is an easy task. Just follow these simple steps:</p>
|
||||
<ol>
|
||||
<li><strong>Download</strong> the latest version of the editor from our web site: <a
|
||||
href="http://ckeditor.com">http://ckeditor.com</a>. You should have already completed
|
||||
this step, but be sure you have the very latest version.</li>
|
||||
<li><strong>Extract</strong> (decompress) the downloaded file into the root of your
|
||||
web site.</li>
|
||||
</ol>
|
||||
<p>
|
||||
<strong>Note:</strong> CKEditor is by default installed in the "ckeditor"
|
||||
folder. You can place the files in whichever you want though.</p>
|
||||
<h3>
|
||||
Checking Your Installation
|
||||
</h3>
|
||||
<p>
|
||||
The editor comes with a few sample pages that can be used to verify that installation
|
||||
proceeded properly. Take a look at the <a href="_samples">_samples</a> directory.</p>
|
||||
<p>
|
||||
To test your installation, just call the following page at your web site:</p>
|
||||
<pre>
|
||||
http://<your site>/<CKEditor installation path>/_samples/index.html
|
||||
|
||||
For example:
|
||||
http://www.example.com/ckeditor/_samples/index.html</pre>
|
||||
<h3>
|
||||
Documentation</h3>
|
||||
<p>
|
||||
The full editor documentation is available online at the following address:<br />
|
||||
<a href="http://docs.cksource.com/ckeditor">http://docs.cksource.com/ckeditor</a></p>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a href="http://cksource.com/">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
File diff suppressed because it is too large
Load Diff
|
@ -1,32 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<application xmlns="http://ns.adobe.com/air/application/1.0">
|
||||
<id>com.ckeditor.air.sample</id>
|
||||
<name>CKEditor - Adobe AIR Sample Application</name>
|
||||
<version>1.0</version>
|
||||
<filename>CKEditor AIR Samples</filename>
|
||||
<description>This is a sample AIR application of CKEditor.</description>
|
||||
<copyright>Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.</copyright>
|
||||
<initialWindow>
|
||||
<content>_samples/adobeair/sample.html</content>
|
||||
<title>CKEditor - Adobe AIR Sample</title>
|
||||
<systemChrome>standard</systemChrome>
|
||||
<transparent>false</transparent>
|
||||
<visible>true</visible>
|
||||
<minimizable>true</minimizable>
|
||||
<maximizable>true</maximizable>
|
||||
<resizable>true</resizable>
|
||||
<x>100</x>
|
||||
<y>80</y>
|
||||
<width>950</width>
|
||||
<height>700</height>
|
||||
<minSize>900 600</minSize>
|
||||
</initialWindow>
|
||||
<installFolder>CKEditor/Sample AIR Application</installFolder>
|
||||
<programMenuFolder>CKEditor/Sample AIR Application</programMenuFolder>
|
||||
<customUpdateUI>false</customUpdateUI>
|
||||
<allowBrowserInvocation>false</allowBrowserInvocation>
|
||||
</application>
|
|
@ -1,9 +0,0 @@
|
|||
@ECHO OFF
|
||||
::
|
||||
:: Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
:: For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
::
|
||||
:: Use this file to quickly run the sample in a Windows environment.
|
||||
::
|
||||
|
||||
adl application.xml ../../
|
|
@ -1,8 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
# For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
|
||||
# Use this file to quickly run the sample under Linux.
|
||||
|
||||
adl application.xml ../../
|
|
@ -1,45 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Replace Textarea by Code - CKEditor Sample</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<script type="text/javascript" src="../../ckeditor.js"></script>
|
||||
<link href="../sample.css" rel="stylesheet" type="text/css" />
|
||||
<style type="text/css">
|
||||
body { margin: 10px ; }
|
||||
</style></head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor - Adobe AIR Sample
|
||||
</h1>
|
||||
<p>
|
||||
This is a sample HTML/JavaScript Adobe AIR application with CKEditor with default features.
|
||||
</p>
|
||||
<p>
|
||||
<textarea cols="80" id="editor1" name="editor1" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
// Replace the <textarea id="editor"> with an CKEditor
|
||||
// instance, using default configurations.
|
||||
CKEDITOR.replace( 'editor1' );
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
</p>
|
||||
<div id="footer" style="position:absolute;bottom:0;left:0;right:0;width:100%;padding-bottom:10px;">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for Internet - <a class="samples" href="#" onclick="window.runtime.flash.net.navigateToURL(new window.runtime.flash.net.URLRequest('http://ckeditor.com/'));return false;">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="#" onclick="window.runtime.flash.net.navigateToURL(new window.runtime.flash.net.URLRequest('http://cksource.com/'));return false;">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,98 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Ajax — CKEditor Sample</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<script type="text/javascript" src="../ckeditor.js"></script>
|
||||
<script src="sample.js" type="text/javascript"></script>
|
||||
<link href="sample.css" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
var editor, html = '';
|
||||
|
||||
function createEditor()
|
||||
{
|
||||
if ( editor )
|
||||
return;
|
||||
|
||||
|
||||
// Create a new editor inside the <div id="editor">, setting its value to html
|
||||
var config = {};
|
||||
editor = CKEDITOR.appendTo( 'editor', config, html );
|
||||
}
|
||||
|
||||
function removeEditor()
|
||||
{
|
||||
if ( !editor )
|
||||
return;
|
||||
|
||||
// Retrieve the editor contents. In an Ajax application, this data would be
|
||||
// sent to the server or used in any other way.
|
||||
document.getElementById( 'editorcontents' ).innerHTML = html = editor.getData();
|
||||
document.getElementById( 'contents' ).style.display = '';
|
||||
|
||||
// Destroy the editor.
|
||||
editor.destroy();
|
||||
editor = null;
|
||||
}
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Sample — Create and Destroy Editor Instances for Ajax Applications
|
||||
</h1>
|
||||
<div class="description">
|
||||
<p>
|
||||
This sample shows how to create and destroy CKEditor instances on the fly. After the removal of CKEditor the content created inside the editing
|
||||
area will be displayed in a <code><div></code> element.
|
||||
</p>
|
||||
<p>
|
||||
For details of how to create this setup check the source code of this sample page
|
||||
for JavaScript code responsible for the creation and destruction of a CKEditor instance.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- This <div> holds alert messages to be display in the sample page. -->
|
||||
<div id="alerts">
|
||||
<noscript>
|
||||
<p>
|
||||
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
||||
support, like yours, you should still see the contents (HTML data) and you should
|
||||
be able to edit it normally, without a rich editor interface.
|
||||
</p>
|
||||
</noscript>
|
||||
</div>
|
||||
<p>Click the buttons to create and remove a CKEditor instance.</p>
|
||||
<p>
|
||||
<input onclick="createEditor();" type="button" value="Create Editor" />
|
||||
<input onclick="removeEditor();" type="button" value="Remove Editor" />
|
||||
</p>
|
||||
<!-- This div will hold the editor. -->
|
||||
<div id="editor">
|
||||
</div>
|
||||
<div id="contents" style="display: none">
|
||||
<p>
|
||||
Edited Contents:</p>
|
||||
<!-- This div will be used to display the editor contents. -->
|
||||
<div id="editorcontents">
|
||||
</div>
|
||||
</div>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,192 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>API Usage — CKEditor Sample</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<script type="text/javascript" src="../ckeditor.js"></script>
|
||||
<script src="sample.js" type="text/javascript"></script>
|
||||
<link href="sample.css" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
// The instanceReady event is fired, when an instance of CKEditor has finished
|
||||
// its initialization.
|
||||
CKEDITOR.on( 'instanceReady', function( ev )
|
||||
{
|
||||
// Show the editor name and description in the browser status bar.
|
||||
document.getElementById( 'eMessage' ).innerHTML = '<p>Instance <code>' + ev.editor.name + '<\/code> loaded.<\/p>';
|
||||
|
||||
// Show this sample buttons.
|
||||
document.getElementById( 'eButtons' ).style.display = 'block';
|
||||
});
|
||||
|
||||
function InsertHTML()
|
||||
{
|
||||
// Get the editor instance that we want to interact with.
|
||||
var oEditor = CKEDITOR.instances.editor1;
|
||||
var value = document.getElementById( 'htmlArea' ).value;
|
||||
|
||||
// Check the active editing mode.
|
||||
if ( oEditor.mode == 'wysiwyg' )
|
||||
{
|
||||
// Insert HTML code.
|
||||
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#insertHtml
|
||||
oEditor.insertHtml( value );
|
||||
}
|
||||
else
|
||||
alert( 'You must be in WYSIWYG mode!' );
|
||||
}
|
||||
|
||||
function InsertText()
|
||||
{
|
||||
// Get the editor instance that we want to interact with.
|
||||
var oEditor = CKEDITOR.instances.editor1;
|
||||
var value = document.getElementById( 'txtArea' ).value;
|
||||
|
||||
// Check the active editing mode.
|
||||
if ( oEditor.mode == 'wysiwyg' )
|
||||
{
|
||||
// Insert as plain text.
|
||||
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#insertText
|
||||
oEditor.insertText( value );
|
||||
}
|
||||
else
|
||||
alert( 'You must be in WYSIWYG mode!' );
|
||||
}
|
||||
|
||||
function SetContents()
|
||||
{
|
||||
// Get the editor instance that we want to interact with.
|
||||
var oEditor = CKEDITOR.instances.editor1;
|
||||
var value = document.getElementById( 'htmlArea' ).value;
|
||||
|
||||
// Set editor contents (replace current contents).
|
||||
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#setData
|
||||
oEditor.setData( value );
|
||||
}
|
||||
|
||||
function GetContents()
|
||||
{
|
||||
// Get the editor instance that you want to interact with.
|
||||
var oEditor = CKEDITOR.instances.editor1;
|
||||
|
||||
// Get editor contents
|
||||
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#getData
|
||||
alert( oEditor.getData() );
|
||||
}
|
||||
|
||||
function ExecuteCommand( commandName )
|
||||
{
|
||||
// Get the editor instance that we want to interact with.
|
||||
var oEditor = CKEDITOR.instances.editor1;
|
||||
|
||||
// Check the active editing mode.
|
||||
if ( oEditor.mode == 'wysiwyg' )
|
||||
{
|
||||
// Execute the command.
|
||||
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#execCommand
|
||||
oEditor.execCommand( commandName );
|
||||
}
|
||||
else
|
||||
alert( 'You must be in WYSIWYG mode!' );
|
||||
}
|
||||
|
||||
function CheckDirty()
|
||||
{
|
||||
// Get the editor instance that we want to interact with.
|
||||
var oEditor = CKEDITOR.instances.editor1;
|
||||
// Checks whether the current editor contents present changes when compared
|
||||
// to the contents loaded into the editor at startup
|
||||
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#checkDirty
|
||||
alert( oEditor.checkDirty() );
|
||||
}
|
||||
|
||||
function ResetDirty()
|
||||
{
|
||||
// Get the editor instance that we want to interact with.
|
||||
var oEditor = CKEDITOR.instances.editor1;
|
||||
// Resets the "dirty state" of the editor (see CheckDirty())
|
||||
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#resetDirty
|
||||
oEditor.resetDirty();
|
||||
alert( 'The "IsDirty" status has been reset' );
|
||||
}
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Sample — Using CKEditor JavaScript API
|
||||
</h1>
|
||||
<div class="description">
|
||||
<p>
|
||||
This sample shows how to use the
|
||||
<a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html">CKEditor JavaScript API</a>
|
||||
to interact with the editor at runtime.
|
||||
</p>
|
||||
<p>
|
||||
For details on how to create this setup check the source code of this sample page.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- This <div> holds alert messages to be display in the sample page. -->
|
||||
<div id="alerts">
|
||||
<noscript>
|
||||
<p>
|
||||
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
||||
support, like yours, you should still see the contents (HTML data) and you should
|
||||
be able to edit it normally, without a rich editor interface.
|
||||
</p>
|
||||
</noscript>
|
||||
</div>
|
||||
<form action="sample_posteddata.php" method="post">
|
||||
<textarea cols="100" id="editor1" name="editor1" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
||||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
// Replace the <textarea id="editor1"> with an CKEditor instance.
|
||||
var editor = CKEDITOR.replace( 'editor1' );
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
<div id="eMessage">
|
||||
</div>
|
||||
<div id="eButtons" style="display: none">
|
||||
<input onclick="InsertHTML();" type="button" value="Insert HTML" />
|
||||
<input onclick="SetContents();" type="button" value="Set Editor Contents" />
|
||||
<input onclick="GetContents();" type="button" value="Get Editor Contents (XHTML)" />
|
||||
<br />
|
||||
<textarea cols="100" id="htmlArea" rows="3"><h2>Test</h2><p>This is some <a href="/Test1.html">sample</a> HTML code.</p></textarea>
|
||||
<br />
|
||||
<br />
|
||||
<input onclick="InsertText();" type="button" value="Insert Text" />
|
||||
<br />
|
||||
<textarea cols="100" id="txtArea" rows="3"> First line with some leading whitespaces.
|
||||
|
||||
Second line of text preceded by two line breaks.</textarea>
|
||||
<br />
|
||||
<input onclick="ExecuteCommand('bold');" type="button" value="Execute "bold" Command" />
|
||||
<input onclick="ExecuteCommand('link');" type="button" value="Execute "link" Command" />
|
||||
<br />
|
||||
<br />
|
||||
<input onclick="CheckDirty();" type="button" value="checkDirty()" />
|
||||
<input onclick="ResetDirty();" type="button" value="resetDirty()" />
|
||||
</div>
|
||||
</form>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,198 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Using API to Customize Dialog Windows — CKEditor Sample</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<script type="text/javascript" src="../ckeditor.js"></script>
|
||||
<script src="sample.js" type="text/javascript"></script>
|
||||
<link href="sample.css" rel="stylesheet" type="text/css" />
|
||||
<style id="styles" type="text/css">
|
||||
|
||||
.cke_button_myDialogCmd .cke_icon
|
||||
{
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.cke_button_myDialogCmd .cke_label
|
||||
{
|
||||
display: inline !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
// When opening a dialog, its "definition" is created for it, for
|
||||
// each editor instance. The "dialogDefinition" event is then
|
||||
// fired. We should use this event to make customizations to the
|
||||
// definition of existing dialogs.
|
||||
CKEDITOR.on( 'dialogDefinition', function( ev )
|
||||
{
|
||||
// Take the dialog name and its definition from the event
|
||||
// data.
|
||||
var dialogName = ev.data.name;
|
||||
var dialogDefinition = ev.data.definition;
|
||||
|
||||
// Check if the definition is from the dialog we're
|
||||
// interested on (the "Link" dialog).
|
||||
if ( dialogName == 'link' )
|
||||
{
|
||||
// Get a reference to the "Link Info" tab.
|
||||
var infoTab = dialogDefinition.getContents( 'info' );
|
||||
|
||||
// Add a text field to the "info" tab.
|
||||
infoTab.add( {
|
||||
type : 'text',
|
||||
label : 'My Custom Field',
|
||||
id : 'customField',
|
||||
'default' : 'Sample!',
|
||||
validate : function()
|
||||
{
|
||||
if ( /\d/.test( this.getValue() ) )
|
||||
return 'My Custom Field must not contain digits';
|
||||
}
|
||||
});
|
||||
|
||||
// Remove the "Link Type" combo and the "Browser
|
||||
// Server" button from the "info" tab.
|
||||
infoTab.remove( 'linkType' );
|
||||
infoTab.remove( 'browse' );
|
||||
|
||||
// Set the default value for the URL field.
|
||||
var urlField = infoTab.get( 'url' );
|
||||
urlField['default'] = 'www.example.com';
|
||||
|
||||
// Remove the "Target" tab from the "Link" dialog.
|
||||
dialogDefinition.removeContents( 'target' );
|
||||
|
||||
// Add a new tab to the "Link" dialog.
|
||||
dialogDefinition.addContents({
|
||||
id : 'customTab',
|
||||
label : 'My Tab',
|
||||
accessKey : 'M',
|
||||
elements : [
|
||||
{
|
||||
id : 'myField1',
|
||||
type : 'text',
|
||||
label : 'My Text Field'
|
||||
},
|
||||
{
|
||||
id : 'myField2',
|
||||
type : 'text',
|
||||
label : 'Another Text Field'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
// Rewrite the 'onFocus' handler to always focus 'url' field.
|
||||
dialogDefinition.onFocus = function()
|
||||
{
|
||||
var urlField = this.getContentElement( 'info', 'url' );
|
||||
urlField.select();
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Sample — Using CKEditor Dialog API
|
||||
</h1>
|
||||
<div class="description">
|
||||
<p>
|
||||
This sample shows how to use the
|
||||
<a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dialog.html">CKEditor Dialog API</a>
|
||||
to customize CKEditor dialog windows without changing the original editor code.
|
||||
The following customizations are being done in the example below:
|
||||
</p>
|
||||
<ol>
|
||||
<li><strong>Adding dialog window tabs</strong> – "My Tab" in the "Link" dialog window.</li>
|
||||
<li><strong>Removing a dialog window tab</strong> – "Target" tab from the "Link" dialog window.</li>
|
||||
<li><strong>Adding dialog window fields</strong> – "My Custom Field" in the "Link" dialog window.</li>
|
||||
<li><strong>Removing dialog window fields</strong> – "Link Type" and "Browse Server" in the "Link"
|
||||
dialog window.</li>
|
||||
<li><strong>Setting default values for dialog window fields</strong> – "URL" field in the
|
||||
"Link" dialog window. </li>
|
||||
<li><strong>Creating a custom dialog window</strong> – "My Dialog" dialog window opened with the "My Dialog" toolbar button.</li>
|
||||
</ol>
|
||||
<p>
|
||||
For details on how to create this setup check the source code of this sample page.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- This <div> holds alert messages to be display in the sample page. -->
|
||||
<div id="alerts">
|
||||
<noscript>
|
||||
<p>
|
||||
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
||||
support, like yours, you should still see the contents (HTML data) and you should
|
||||
be able to edit it normally, without a rich editor interface.
|
||||
</p>
|
||||
</noscript>
|
||||
</div>
|
||||
<!-- This <fieldset> holds the HTML that you will usually find in your
|
||||
pages. -->
|
||||
<textarea cols="80" id="editor1" name="editor1" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
// Replace the <textarea id="editor1"> with an CKEditor instance.
|
||||
var editor = CKEDITOR.replace( 'editor1',
|
||||
{
|
||||
// Defines a simpler toolbar to be used in this sample.
|
||||
// Note that we have added out "MyButton" button here.
|
||||
toolbar : [ [ 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike','-','Link', '-', 'MyButton' ] ]
|
||||
});
|
||||
|
||||
// Listen for the "pluginsLoaded" event, so we are sure that the
|
||||
// "dialog" plugin has been loaded and we are able to do our
|
||||
// customizations.
|
||||
editor.on( 'pluginsLoaded', function( ev )
|
||||
{
|
||||
// If our custom dialog has not been registered, do that now.
|
||||
if ( !CKEDITOR.dialog.exists( 'myDialog' ) )
|
||||
{
|
||||
// We need to do the following trick to find out the dialog
|
||||
// definition file URL path. In the real world, you would simply
|
||||
// point to an absolute path directly, like "/mydir/mydialog.js".
|
||||
var href = document.location.href.split( '/' );
|
||||
href.pop();
|
||||
href.push( 'api_dialog', 'my_dialog.js' );
|
||||
href = href.join( '/' );
|
||||
|
||||
// Finally, register the dialog.
|
||||
CKEDITOR.dialog.add( 'myDialog', href );
|
||||
}
|
||||
|
||||
// Register the command used to open the dialog.
|
||||
editor.addCommand( 'myDialogCmd', new CKEDITOR.dialogCommand( 'myDialog' ) );
|
||||
|
||||
// Add the a custom toolbar buttons, which fires the above
|
||||
// command..
|
||||
editor.ui.addButton( 'MyButton',
|
||||
{
|
||||
label : 'My Dialog',
|
||||
command : 'myDialogCmd'
|
||||
} );
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,28 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, 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'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
} );
|
|
@ -1,103 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>ASP integration Samples List — CKEditor</title>
|
||||
<link type="text/css" rel="stylesheet" href="../sample.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Samples List for ASP — CKEditor Sample
|
||||
</h1>
|
||||
<h2 class="samples">
|
||||
Overview
|
||||
</h2>
|
||||
<p>The ckeditor.asp file provides a wrapper to ease the work of creating CKEditor instances from classic Asp.</p>
|
||||
<p>To use it, you must first include it into your page:
|
||||
<code>
|
||||
<!-- #INCLUDE file="../../ckeditor.asp" -->
|
||||
</code>
|
||||
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="")
|
||||
</p>
|
||||
<p>After that script is included, you can use it in different ways, based on the following pattern:</p>
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
Create an instance of the CKEditor class:
|
||||
<pre class="samples">dim editor
|
||||
set editor = New CKEditor</pre>
|
||||
</li>
|
||||
<li>
|
||||
Set the path to the folder where CKEditor has been installed, by default it will use /ckeditor/
|
||||
<pre class="samples">editor.basePath = "../../"</pre>
|
||||
</li>
|
||||
<li>
|
||||
Now use one of the three main methods to create the CKEditor instances:
|
||||
<ul class="samples">
|
||||
<li>
|
||||
Replace textarea with id (or name) "editor1".
|
||||
<pre class="samples">editor.replaceInstance "editor1"</pre>
|
||||
</li>
|
||||
<li>
|
||||
Replace all textareas with CKEditor.
|
||||
<pre class="samples">editor.replaceAll empty</pre>
|
||||
</li>
|
||||
<li>
|
||||
Create a textarea element and attach CKEditor to it.
|
||||
<pre class="samples">editor.editor "editor1", initialValue</pre>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
<p>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:</p>
|
||||
<ul class="samples">
|
||||
<li>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</li>
|
||||
<li>basePath: location of the CKEditor scripts</li>
|
||||
<li>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.</li>
|
||||
<li>textareaAttributes: You can set here a Dictionary object with the attributes that you want to output in the call to the "editor" method.</li>
|
||||
|
||||
<li>config: Allows to set config values for all the instances from now on.</li>
|
||||
<li>instanceConfig: Allows to set config values just for the next instance.</li>
|
||||
|
||||
<li>addEventHandler: Adds an event handler for all the instances from now on.</li>
|
||||
<li>addInstanceEventHandler: Adds an event handler just for the next instance.</li>
|
||||
<li>addGlobalEventHandler: Adds an event handler for the global CKEDITOR object.</li>
|
||||
|
||||
<li>clearEventHandlers: Removes one or all the event handlers from all the instances from now on.</li>
|
||||
<li>clearInstanceEventHandlers: Removes one or all the event handlers from the next instance.</li>
|
||||
<li>clearGlobalEventHandlers: Removes one or all the event handlers from the global CKEDITOR object.</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<h2 class="samples">
|
||||
Basic Samples
|
||||
</h2>
|
||||
<ul class="samples">
|
||||
<li><a class="samples" href="replace.asp">Replace existing textareas by code</a></li>
|
||||
<li><a class="samples" href="replaceAll.asp">Replace all textareas by code</a></li>
|
||||
<li><a class="samples" href="standalone.asp">Create instances in asp</a></li>
|
||||
</ul>
|
||||
<h2 class="samples">
|
||||
Advanced Samples
|
||||
</h2>
|
||||
<ul class="samples">
|
||||
<li><a class="samples" href="advanced.asp">Advanced example</a></li>
|
||||
<li><a class="samples" href="events.asp">Listening to events</a></li>
|
||||
</ul>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Binary file not shown.
Binary file not shown.
|
@ -1,204 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*
|
||||
* Styles used by the XHTML 1.1 sample page (xhtml.html).
|
||||
*/
|
||||
|
||||
/**
|
||||
* Basic definitions for the editing area.
|
||||
*/
|
||||
body
|
||||
{
|
||||
font-family: Arial, Verdana, sans-serif;
|
||||
font-size: 80%;
|
||||
color: #000000;
|
||||
background-color: #ffffff;
|
||||
padding: 5px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
/**
|
||||
* Core styles.
|
||||
*/
|
||||
|
||||
.Bold
|
||||
{
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.Italic
|
||||
{
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.Underline
|
||||
{
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.StrikeThrough
|
||||
{
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.Subscript
|
||||
{
|
||||
vertical-align: sub;
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
.Superscript
|
||||
{
|
||||
vertical-align: super;
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
/**
|
||||
* Font faces.
|
||||
*/
|
||||
|
||||
.FontComic
|
||||
{
|
||||
font-family: 'Comic Sans MS';
|
||||
}
|
||||
|
||||
.FontCourier
|
||||
{
|
||||
font-family: 'Courier New';
|
||||
}
|
||||
|
||||
.FontTimes
|
||||
{
|
||||
font-family: 'Times New Roman';
|
||||
}
|
||||
|
||||
/**
|
||||
* Font sizes.
|
||||
*/
|
||||
|
||||
.FontSmaller
|
||||
{
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
.FontLarger
|
||||
{
|
||||
font-size: larger;
|
||||
}
|
||||
|
||||
.FontSmall
|
||||
{
|
||||
font-size: 8pt;
|
||||
}
|
||||
|
||||
.FontBig
|
||||
{
|
||||
font-size: 14pt;
|
||||
}
|
||||
|
||||
.FontDouble
|
||||
{
|
||||
font-size: 200%;
|
||||
}
|
||||
|
||||
/**
|
||||
* Font colors.
|
||||
*/
|
||||
.FontColor1
|
||||
{
|
||||
color: #ff9900;
|
||||
}
|
||||
|
||||
.FontColor2
|
||||
{
|
||||
color: #0066cc;
|
||||
}
|
||||
|
||||
.FontColor3
|
||||
{
|
||||
color: #ff0000;
|
||||
}
|
||||
|
||||
.FontColor1BG
|
||||
{
|
||||
background-color: #ff9900;
|
||||
}
|
||||
|
||||
.FontColor2BG
|
||||
{
|
||||
background-color: #0066cc;
|
||||
}
|
||||
|
||||
.FontColor3BG
|
||||
{
|
||||
background-color: #ff0000;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indentation.
|
||||
*/
|
||||
|
||||
.Indent1
|
||||
{
|
||||
margin-left: 40px;
|
||||
}
|
||||
|
||||
.Indent2
|
||||
{
|
||||
margin-left: 80px;
|
||||
}
|
||||
|
||||
.Indent3
|
||||
{
|
||||
margin-left: 120px;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alignment.
|
||||
*/
|
||||
|
||||
.JustifyLeft
|
||||
{
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.JustifyRight
|
||||
{
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.JustifyCenter
|
||||
{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.JustifyFull
|
||||
{
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
/**
|
||||
* Other.
|
||||
*/
|
||||
|
||||
code
|
||||
{
|
||||
font-family: courier, monospace;
|
||||
background-color: #eeeeee;
|
||||
padding-left: 1px;
|
||||
padding-right: 1px;
|
||||
border: #c0c0c0 1px solid;
|
||||
}
|
||||
|
||||
kbd
|
||||
{
|
||||
padding: 0px 1px 0px 1px;
|
||||
border-width: 1px 2px 2px 1px;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
blockquote
|
||||
{
|
||||
color: #808080;
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -1,103 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>AutoGrow Plugin — CKEditor Sample</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<script type="text/javascript" src="../ckeditor.js"></script>
|
||||
<script src="sample.js" type="text/javascript"></script>
|
||||
<link href="sample.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Sample — Using AutoGrow Plugin
|
||||
</h1>
|
||||
<div class="description">
|
||||
<p>
|
||||
This sample shows how to configure CKEditor instances to use the
|
||||
<strong>autogrow</strong> plugin that lets the editor window expand and shrink
|
||||
depending on the amount and size of content entered in the editing area.
|
||||
</p>
|
||||
<p>
|
||||
In its default implementation the <strong>AutoGrow feature</strong> can expand the
|
||||
CKEditor window infinitely in order to avoid introducing scrollbars to the editing area.
|
||||
</p>
|
||||
<p>
|
||||
It is also possible to set a maximum height for the editor window. Once CKEditor
|
||||
editing area reaches the value in pixels specified in the <code>autoGrow_maxHeight</code>
|
||||
attribute, scrollbars will be added and the editor window will no longer expand.
|
||||
</p>
|
||||
<p>
|
||||
To add a CKEditor instance using the <strong>autogrow</strong> plugin and its
|
||||
<code>autoGrow_maxHeight</code> attribute, insert the following JavaScript call to your code:
|
||||
</p>
|
||||
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
|
||||
{
|
||||
<strong>extraPlugins : 'autogrow',</strong>
|
||||
autoGrow_maxHeight : 800
|
||||
});</pre>
|
||||
<p>
|
||||
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
|
||||
the <code><textarea></code> element to be replaced with CKEditor. The maximum height should
|
||||
be given in pixels.
|
||||
</p>
|
||||
</div>
|
||||
<!-- This <div> holds alert messages to be display in the sample page. -->
|
||||
<div id="alerts">
|
||||
<noscript>
|
||||
<p>
|
||||
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
||||
support, like yours, you should still see the contents (HTML data) and you should
|
||||
be able to edit it normally, without a rich editor interface.
|
||||
</p>
|
||||
</noscript>
|
||||
</div>
|
||||
<form action="sample_posteddata.php" method="post">
|
||||
<p>
|
||||
<label for="editor1">
|
||||
CKEditor using the <strong>autogrow</strong> plugin with its default configuration:</label>
|
||||
<textarea cols="80" id="editor1" name="editor1" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
CKEDITOR.replace( 'editor1', {
|
||||
extraPlugins : 'autogrow'
|
||||
});
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
</p>
|
||||
<p>
|
||||
<label for="editor2">
|
||||
CKEditor using the <strong>autogrow</strong> plugin with maximum height set to 400:</label>
|
||||
<textarea cols="80" id="editor2" name="editor2" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
CKEDITOR.replace( 'editor2', {
|
||||
extraPlugins : 'autogrow',
|
||||
autoGrow_maxHeight : 400
|
||||
});
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" value="Submit" />
|
||||
</p>
|
||||
</form>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,154 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Replace DIV — CKEditor Sample</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<script type="text/javascript" src="../ckeditor.js"></script>
|
||||
<script src="sample.js" type="text/javascript"></script>
|
||||
<link href="sample.css" rel="stylesheet" type="text/css" />
|
||||
<style id="styles" type="text/css">
|
||||
|
||||
div.editable
|
||||
{
|
||||
border: solid 2px Transparent;
|
||||
padding-left: 15px;
|
||||
padding-right: 15px;
|
||||
}
|
||||
|
||||
div.editable:hover
|
||||
{
|
||||
border-color: black;
|
||||
}
|
||||
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
// Uncomment the following code to test the "Timeout Loading Method".
|
||||
// CKEDITOR.loadFullCoreTimeout = 5;
|
||||
|
||||
window.onload = function()
|
||||
{
|
||||
// Listen to the double click event.
|
||||
if ( window.addEventListener )
|
||||
document.body.addEventListener( 'dblclick', onDoubleClick, false );
|
||||
else if ( window.attachEvent )
|
||||
document.body.attachEvent( 'ondblclick', onDoubleClick );
|
||||
|
||||
};
|
||||
|
||||
function onDoubleClick( ev )
|
||||
{
|
||||
// Get the element which fired the event. This is not necessarily the
|
||||
// element to which the event has been attached.
|
||||
var element = ev.target || ev.srcElement;
|
||||
|
||||
// Find out the div that holds this element.
|
||||
var name;
|
||||
do
|
||||
{
|
||||
element = element.parentNode;
|
||||
}
|
||||
while ( element && ( name = element.nodeName.toLowerCase() ) && ( name != 'div' || element.className.indexOf( 'editable' ) == -1 ) && name != 'body' )
|
||||
|
||||
|
||||
if ( name == 'div' && element.className.indexOf( 'editable' ) != -1 )
|
||||
replaceDiv( element );
|
||||
}
|
||||
|
||||
var editor;
|
||||
|
||||
function replaceDiv( div )
|
||||
{
|
||||
if ( editor )
|
||||
editor.destroy();
|
||||
|
||||
editor = CKEDITOR.replace( div );
|
||||
}
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Sample — Replace DIV with CKEditor on the Fly
|
||||
</h1>
|
||||
<div class="description">
|
||||
<p>
|
||||
This sample shows how to automatically replace <code><div></code> elements
|
||||
with a CKEditor instance on the fly, following user's doubleclick. The content
|
||||
that was previously placed inside the <code><div></code> element will now
|
||||
be moved into CKEditor editing area.
|
||||
</p>
|
||||
<p>
|
||||
For details on how to create this setup check the source code of this sample page.
|
||||
</p>
|
||||
</div>
|
||||
<!-- This <div> holds alert messages to be display in the sample page. -->
|
||||
<div id="alerts">
|
||||
<noscript>
|
||||
<p>
|
||||
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
||||
support, like yours, you should still see the contents (HTML data) and you should
|
||||
be able to edit it normally, without a rich editor interface.
|
||||
</p>
|
||||
</noscript>
|
||||
</div>
|
||||
<p>
|
||||
Double-click any of the following <code><div></code> elements to transform them into
|
||||
editor instances.</p>
|
||||
<div class="editable">
|
||||
<h3>
|
||||
Part 1</h3>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
</div>
|
||||
<div class="editable">
|
||||
<h3>
|
||||
Part 2</h3>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
</div>
|
||||
<div class="editable">
|
||||
<h3>
|
||||
Part 3</h3>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
</div>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,115 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>ENTER Key Configuration — CKEditor Sample</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<script type="text/javascript" src="../ckeditor.js"></script>
|
||||
<script src="sample.js" type="text/javascript"></script>
|
||||
<link href="sample.css" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
var editor;
|
||||
|
||||
function changeEnter()
|
||||
{
|
||||
// If we already have an editor, let's destroy it first.
|
||||
if ( editor )
|
||||
editor.destroy( true );
|
||||
|
||||
// Create the editor again, with the appropriate settings.
|
||||
editor = CKEDITOR.replace( 'editor1',
|
||||
{
|
||||
enterMode : Number( document.getElementById( 'xEnter' ).value ),
|
||||
shiftEnterMode : Number( document.getElementById( 'xShiftEnter' ).value )
|
||||
});
|
||||
}
|
||||
|
||||
window.onload = changeEnter;
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Sample — ENTER Key Configuration
|
||||
</h1>
|
||||
<div class="description">
|
||||
<p>
|
||||
This sample shows how to configure the <em>Enter</em> and <em>Shift+Enter</em> keys
|
||||
to perform actions specified in the
|
||||
<a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.enterMode"><code>enterMode</code></a>
|
||||
and <a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.shiftEnterMode"><code>shiftEnterMode</code></a>
|
||||
parameters, respectively.
|
||||
You can choose from the following options:
|
||||
</p>
|
||||
<ul class="samples">
|
||||
<li><strong><code>ENTER_P</code></strong> – new <code><p></code> paragraphs are created;</li>
|
||||
<li><strong><code>ENTER_BR</code></strong> – lines are broken with <code><br></code> elements;</li>
|
||||
<li><strong><code>ENTER_DIV</code></strong> – new <code><div></code> blocks are created.</li>
|
||||
</ul>
|
||||
<p>
|
||||
The sample code below shows how to configure CKEditor to create a <code><div></code> block when <em>Enter</em> key is pressed.
|
||||
</p>
|
||||
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
|
||||
{
|
||||
<strong>enterMode : CKEDITOR.ENTER_DIV</strong>
|
||||
});</pre>
|
||||
<p>
|
||||
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
|
||||
the <code><textarea></code> element to be replaced.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- This <div> holds alert messages to be display in the sample page. -->
|
||||
<div id="alerts">
|
||||
<noscript>
|
||||
<p>
|
||||
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
||||
support, like yours, you should still see the contents (HTML data) and you should
|
||||
be able to edit it normally, without a rich editor interface.
|
||||
</p>
|
||||
</noscript>
|
||||
</div>
|
||||
<div style="float: left; margin-right: 20px">
|
||||
When <em>Enter</em> is pressed:<br />
|
||||
<select id="xEnter" onchange="changeEnter();">
|
||||
<option selected="selected" value="1">Create a new <P> (recommended)</option>
|
||||
<option value="3">Create a new <DIV></option>
|
||||
<option value="2">Break the line with a <BR></option>
|
||||
</select>
|
||||
</div>
|
||||
<div style="float: left">
|
||||
When <em>Shift+Enter</em> is pressed:<br />
|
||||
<select id="xShiftEnter" onchange="changeEnter();">
|
||||
<option value="1">Create a new <P></option>
|
||||
<option value="3">Create a new <DIV></option>
|
||||
<option selected="selected" value="2">Break the line with a <BR> (recommended)</option>
|
||||
</select>
|
||||
</div>
|
||||
<br style="clear: both" />
|
||||
<form action="sample_posteddata.php" method="post">
|
||||
<p>
|
||||
<br />
|
||||
<textarea cols="80" id="editor1" name="editor1" rows="10">This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</textarea>
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" value="Submit" />
|
||||
</p>
|
||||
</form>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,75 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Full Page Editing — CKEditor Sample</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<script type="text/javascript" src="../ckeditor.js"></script>
|
||||
<script src="sample.js" type="text/javascript"></script>
|
||||
<link href="sample.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Sample — Full Page Editing
|
||||
</h1>
|
||||
<div class="description">
|
||||
<p>
|
||||
This sample shows how to configure CKEditor to edit entire HTML pages, from the
|
||||
<code><html></code> tag to the <code></html></code> tag.
|
||||
</p>
|
||||
<p>
|
||||
CKEditor is inserted with a JavaScript call using the following code:
|
||||
</p>
|
||||
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
|
||||
{
|
||||
<strong>fullPage : true</strong>
|
||||
});</pre>
|
||||
<p>
|
||||
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
|
||||
the <code><textarea></code> element to be replaced.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- This <div> holds alert messages to be display in the sample page. -->
|
||||
<div id="alerts">
|
||||
<noscript>
|
||||
<p>
|
||||
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
||||
support, like yours, you should still see the contents (HTML data) and you should
|
||||
be able to edit it normally, without a rich editor interface.
|
||||
</p>
|
||||
</noscript>
|
||||
</div>
|
||||
<form action="sample_posteddata.php" method="post">
|
||||
<label for="editor1">
|
||||
Editor 1:</label>
|
||||
<textarea cols="80" id="editor1" name="editor1" rows="10"><html><head><title>CKEditor Sample</title></head><body><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></body></html></textarea>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
CKEDITOR.replace( 'editor1',
|
||||
{
|
||||
fullPage : true
|
||||
});
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
<p>
|
||||
<input type="submit" value="Submit" />
|
||||
</p>
|
||||
</form>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,96 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>CKEditor Samples</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<link type="text/css" rel="stylesheet" href="sample.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Samples Site
|
||||
</h1>
|
||||
<h2 class="samples">
|
||||
Basic Samples
|
||||
</h2>
|
||||
<ul class="samples">
|
||||
<li>
|
||||
<a class="samples" href="replacebyclass.html">Replace textarea elements by class name</a><br />
|
||||
Automatic replacement of all textarea elements of a given class with a CKEditor instance.
|
||||
</li>
|
||||
<li><a class="samples" href="replacebycode.html">Replace textarea elements by code</a><br />
|
||||
Replacement of textarea elements with CKEditor instances by using a JavaScript call.
|
||||
</li>
|
||||
<li><a class="samples" href="fullpage.html">Full page support</a><br />
|
||||
CKEditor inserted with a JavaScript call and used to edit the whole page from <code><html></code> to <code></html></code>.
|
||||
</li>
|
||||
</ul>
|
||||
<h2 class="samples">
|
||||
Basic Customization
|
||||
</h2>
|
||||
<ul class="samples">
|
||||
<li><a class="samples" href="skins.html">Skins</a><br />
|
||||
Changing the CKEditor skin by adjusting a single configuration option.
|
||||
</li>
|
||||
<li><a class="samples" href="ui_color.html">User Interface color</a><br />
|
||||
Changing CKEditor User Interface color and adding a toolbar button that lets the user set the UI color.
|
||||
</li>
|
||||
<li><a class="samples" href="ui_languages.html">User Interface languages</a><br />
|
||||
Changing CKEditor User Interface language and adding a drop-down list that lets the user choose the UI language.
|
||||
</li>
|
||||
<li><a class="samples" href="autogrow.html">AutoGrow plugin</a><br />
|
||||
Using the AutoGrow plugin in order to make the editor grow to fit the size of its content.
|
||||
</li>
|
||||
</ul>
|
||||
<h2 class="samples">
|
||||
Advanced Samples
|
||||
</h2>
|
||||
<ul class="samples">
|
||||
<li><a class="samples" href="divreplace.html">Replace DIV elements on the fly</a><br />
|
||||
Transforming a <code>div</code> element into an instance of CKEditor with a mouse click.
|
||||
</li>
|
||||
<li><a class="samples" href="ajax.html">Create and destroy editor instances for Ajax applications</a><br />
|
||||
Creating and destroying CKEditor instances on the fly and saving the contents entered into the editor window.
|
||||
</li>
|
||||
<li><a class="samples" href="api.html">Basic usage of the API</a><br />
|
||||
Using the CKEditor JavaScript API to interact with the editor at runtime.
|
||||
</li>
|
||||
<li><a class="samples" href="api_dialog.html">Using the JavaScript API to customize dialog windows</a><br />
|
||||
Using the dialog windows API to customize dialog windows without changing the original editor code.
|
||||
</li>
|
||||
<li><a class="samples" href="enterkey.html">Using the "Enter" key in CKEditor</a><br />
|
||||
Configuring the behavior of <em>Enter</em> and <em>Shift+Enter</em> keys.
|
||||
</li>
|
||||
<li><a class="samples" href="sharedspaces.html">Shared toolbars</a><br />
|
||||
Displaying multiple editor instances that share the toolbar and/or the elements path.
|
||||
</li>
|
||||
<li><a class="samples" href="jqueryadapter.html">jQuery adapter example</a><br />
|
||||
Using the jQuery adapter to configure CKEditor.
|
||||
</li>
|
||||
<li><a class="samples" href="output_xhtml.html">Output XHTML</a><br />
|
||||
Configuring CKEditor to produce XHTML 1.1 compliant code.
|
||||
</li>
|
||||
<li><a class="samples" href="output_html.html">Output HTML</a><br />
|
||||
Configuring CKEditor to produce legacy HTML 4 code.
|
||||
</li>
|
||||
<li><a class="samples" href="output_for_flash.html">Output for Flash</a><br />
|
||||
Configuring CKEditor to produce HTML code that can be used with Adobe Flash.
|
||||
</li>
|
||||
<li><a class="samples" href="placeholder.html">Placeholder plugin</a><br />
|
||||
Using the Placeholder plugin to create uneditable sections that can only be created and modified with a proper dialog window.
|
||||
</li>
|
||||
</ul>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,99 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>jQuery Adapter — CKEditor Sample</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
|
||||
<script type="text/javascript" src="../ckeditor.js"></script>
|
||||
<script type="text/javascript" src="../adapters/jquery.js"></script>
|
||||
<script src="sample.js" type="text/javascript"></script>
|
||||
<link href="sample.css" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
$(function()
|
||||
{
|
||||
var config = {
|
||||
toolbar:
|
||||
[
|
||||
['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink'],
|
||||
['UIColor']
|
||||
]
|
||||
};
|
||||
|
||||
// Initialize the editor.
|
||||
// Callback function can be passed and executed after full instance creation.
|
||||
$('.jquery_ckeditor').ckeditor(config);
|
||||
});
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Sample — Using jQuery Adapter
|
||||
</h1>
|
||||
<div class="description">
|
||||
<p>
|
||||
This sample shows how to load CKEditor and configure it using the
|
||||
<a class="samples" href="http://docs.cksource.com/CKEditor_3.x/Developers_Guide/jQuery_Adapter">jQuery adapter</a>.
|
||||
In this case the jQuery adapter is responsible for transforming a <code><textarea></code>
|
||||
element into a CKEditor instance and setting the configuration of the toolbar.
|
||||
</p>
|
||||
<p>
|
||||
CKEditor instance with custom configuration set in jQuery can be inserted with the
|
||||
following JavaScript code:
|
||||
</p>
|
||||
<pre class="samples">$(function()
|
||||
{
|
||||
var config = {
|
||||
skin:'v2'
|
||||
};
|
||||
|
||||
$('.<em>textarea_class</em>').ckeditor(config);
|
||||
});</pre>
|
||||
<p>
|
||||
Note that <code><em>textarea_class</em></code> in the code above is the
|
||||
<code>class</code> attribute of the <code><textarea></code> element to be replaced with
|
||||
CKEditor. Any other jQuery selector can be used to match the target element.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- This <div> holds alert messages to be display in the sample page. -->
|
||||
<div id="alerts">
|
||||
<noscript>
|
||||
<p>
|
||||
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
||||
support, like yours, you should still see the contents (HTML data) and you should
|
||||
be able to edit it normally, without a rich editor interface.
|
||||
</p>
|
||||
</noscript>
|
||||
</div>
|
||||
<!-- This <fieldset> holds the HTML that you will usually find in your
|
||||
pages. -->
|
||||
<form action="sample_posteddata.php" method="post">
|
||||
<p>
|
||||
<label for="editor1">
|
||||
Editor 1:</label>
|
||||
<textarea class="jquery_ckeditor" cols="80" id="editor1" name="editor1" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" value="Submit" />
|
||||
</p>
|
||||
</form>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,274 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Output for Flash — CKEditor Sample</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<script type="text/javascript" src="../ckeditor.js"></script>
|
||||
<script src="sample.js" type="text/javascript"></script>
|
||||
<link href="sample.css" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript" src="assets/swfobject.js"></script>
|
||||
<script type="text/javascript">
|
||||
function sendToFlash()
|
||||
{
|
||||
var html = CKEDITOR.instances.editor1.getData() ;
|
||||
var flash = document.getElementById( 'ckFlash' ) ;
|
||||
flash.setData( html ) ;
|
||||
}
|
||||
|
||||
function init()
|
||||
{
|
||||
var so = new SWFObject("assets/output_for_flash.swf", "ckFlash", "550", "400", "8", "#ffffff") ;
|
||||
so.addParam("wmode", "transparent");
|
||||
so.write("ckFlashContainer") ;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1 class="samples">
|
||||
CKEditor Sample — Producing Flash Compliant HTML Output
|
||||
</h1>
|
||||
<div class="description">
|
||||
<p>
|
||||
This sample shows how to configure CKEditor to output
|
||||
HTML code that can be used with
|
||||
<a class="samples" href="http://www.adobe.com/livedocs/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000922.html">
|
||||
Adobe Flash</a>.
|
||||
The code will contain a subset of standard HTML elements like <code><b></code>,
|
||||
<code><i></code>, and <code><p></code> as well as HTML attributes.
|
||||
</p>
|
||||
<p>
|
||||
To add a CKEditor instance outputting Flash compliant HTML code, load the editor using a standard
|
||||
JavaScript call, and define CKEditor features to use HTML elements and attributes.
|
||||
</p>
|
||||
<p>
|
||||
For details on how to create this setup check the source code of this sample page.
|
||||
</p>
|
||||
</div>
|
||||
<p>
|
||||
To see how it works, create some content in the editing area of CKEditor on the left
|
||||
and send it to the Flash object on the right side of the page by using the
|
||||
<strong>Send to Flash</strong> button.
|
||||
</p>
|
||||
|
||||
<!-- This <div> holds alert messages to be display in the sample page. -->
|
||||
<div id="alerts">
|
||||
<noscript>
|
||||
<p>
|
||||
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
||||
support, like yours, you should still see the contents (HTML data) and you should
|
||||
be able to edit it normally, without a rich editor interface.
|
||||
</p>
|
||||
</noscript>
|
||||
</div>
|
||||
<hr />
|
||||
<table width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td style="width: 100%">
|
||||
<textarea cols="80" id="editor1" name="editor1" rows="10"><p>This is some <b>sample text</b>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
if ( document.location.protocol == 'file:' )
|
||||
alert( 'Warning: This samples does not work when loaded from local filesystem due to security restrictions implemented in Flash.' +
|
||||
'\n\nPlease load the sample from a web server instead.') ;
|
||||
|
||||
CKEDITOR.replace( 'editor1',
|
||||
{
|
||||
height : 300,
|
||||
width : '100%',
|
||||
toolbar : [
|
||||
['Source','-','Bold','Italic','Underline','-','BulletedList','-','Link','Unlink'],
|
||||
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
|
||||
'/',
|
||||
['Font','FontSize','-','TextColor','-','About']
|
||||
],
|
||||
|
||||
/*
|
||||
* Style sheet for the contents
|
||||
*/
|
||||
contentsCss : 'body {color:#000; background-color#FFF; font-family: Arial; font-size:80%;} p, ol, ul {margin-top: 0px; margin-bottom: 0px;}',
|
||||
|
||||
/*
|
||||
* Quirks doctype
|
||||
*/
|
||||
docType : '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',
|
||||
|
||||
/*
|
||||
* Core styles.
|
||||
*/
|
||||
coreStyles_bold : { element : 'b' },
|
||||
coreStyles_italic : { element : 'i' },
|
||||
coreStyles_underline : { element : 'u'},
|
||||
|
||||
/*
|
||||
* Font face
|
||||
*/
|
||||
// Define the way font elements will be applied to the document. The "font"
|
||||
// element will be used.
|
||||
font_style :
|
||||
{
|
||||
element : 'font',
|
||||
attributes : { 'face' : '#(family)' }
|
||||
},
|
||||
|
||||
/*
|
||||
* Font sizes.
|
||||
* The CSS part of the font sizes isn't used by Flash, it is there to get the
|
||||
* font rendered correctly in CKEditor.
|
||||
*/
|
||||
fontSize_sizes : '8px/8;9px/9;10px/10;11px/11;12px/12;14px/14;16px/16;18px/18;20px/20;22px/22;24px/24;26px/26;28px/28;36px/36;48px/48;72px/72',
|
||||
fontSize_style :
|
||||
{
|
||||
element : 'font',
|
||||
attributes : { 'size' : '#(size)' },
|
||||
styles : { 'font-size' : '#(size)px' }
|
||||
} ,
|
||||
|
||||
/*
|
||||
* Font colors.
|
||||
*/
|
||||
colorButton_enableMore : true,
|
||||
|
||||
colorButton_foreStyle :
|
||||
{
|
||||
element : 'font',
|
||||
attributes : { 'color' : '#(color)' }
|
||||
},
|
||||
|
||||
colorButton_backStyle :
|
||||
{
|
||||
element : 'font',
|
||||
styles : { 'background-color' : '#(color)' }
|
||||
},
|
||||
|
||||
|
||||
on : { 'instanceReady' : configureFlashOutput }
|
||||
});
|
||||
|
||||
/*
|
||||
* Adjust the behavior of the dataProcessor to match the
|
||||
* requirements of Flash
|
||||
*/
|
||||
function configureFlashOutput( ev )
|
||||
{
|
||||
var editor = ev.editor,
|
||||
dataProcessor = editor.dataProcessor,
|
||||
htmlFilter = dataProcessor && dataProcessor.htmlFilter;
|
||||
|
||||
// Out self closing tags the HTML4 way, like <br>.
|
||||
dataProcessor.writer.selfClosingEnd = '>';
|
||||
|
||||
// Make output formatting match Flash expectations
|
||||
var dtd = CKEDITOR.dtd;
|
||||
for ( var e in CKEDITOR.tools.extend( {}, dtd.$nonBodyContent, dtd.$block, dtd.$listItem, dtd.$tableContent ) )
|
||||
{
|
||||
dataProcessor.writer.setRules( e,
|
||||
{
|
||||
indent : false,
|
||||
breakBeforeOpen : false,
|
||||
breakAfterOpen : false,
|
||||
breakBeforeClose : false,
|
||||
breakAfterClose : false
|
||||
});
|
||||
}
|
||||
dataProcessor.writer.setRules( 'br',
|
||||
{
|
||||
indent : false,
|
||||
breakBeforeOpen : false,
|
||||
breakAfterOpen : false,
|
||||
breakBeforeClose : false,
|
||||
breakAfterClose : false
|
||||
});
|
||||
|
||||
// Output properties as attributes, not styles.
|
||||
htmlFilter.addRules(
|
||||
{
|
||||
elements :
|
||||
{
|
||||
$ : function( element )
|
||||
{
|
||||
var style, match, width, height, align;
|
||||
|
||||
// Output dimensions of images as width and height
|
||||
if ( element.name == 'img' )
|
||||
{
|
||||
style = element.attributes.style;
|
||||
|
||||
if ( style )
|
||||
{
|
||||
// Get the width from the style.
|
||||
match = /(?:^|\s)width\s*:\s*(\d+)px/i.exec( style );
|
||||
width = match && match[1];
|
||||
|
||||
// Get the height from the style.
|
||||
match = /(?:^|\s)height\s*:\s*(\d+)px/i.exec( style );
|
||||
height = match && match[1];
|
||||
|
||||
if ( width )
|
||||
{
|
||||
element.attributes.style = element.attributes.style.replace( /(?:^|\s)width\s*:\s*(\d+)px;?/i , '' );
|
||||
element.attributes.width = width;
|
||||
}
|
||||
|
||||
if ( height )
|
||||
{
|
||||
element.attributes.style = element.attributes.style.replace( /(?:^|\s)height\s*:\s*(\d+)px;?/i , '' );
|
||||
element.attributes.height = height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Output alignment of paragraphs using align
|
||||
if ( element.name == 'p' )
|
||||
{
|
||||
style = element.attributes.style;
|
||||
|
||||
if ( style )
|
||||
{
|
||||
// Get the align from the style.
|
||||
match = /(?:^|\s)text-align\s*:\s*(\w*);?/i.exec( style );
|
||||
align = match && match[1];
|
||||
|
||||
if ( align )
|
||||
{
|
||||
element.attributes.style = element.attributes.style.replace( /(?:^|\s)text-align\s*:\s*(\w*);?/i , '' );
|
||||
element.attributes.align = align;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( element.attributes.style === '' )
|
||||
delete element.attributes.style;
|
||||
|
||||
return element;
|
||||
}
|
||||
}
|
||||
|
||||
} );
|
||||
}
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
<input type="button" value="Send to Flash" onclick="sendToFlash();" />
|
||||
</td>
|
||||
<td valign="top" style="padding-left: 15px" id="ckFlashContainer">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,285 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>HTML Compliant Output — CKEditor Sample</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<script type="text/javascript" src="../ckeditor.js"></script>
|
||||
<script src="sample.js" type="text/javascript"></script>
|
||||
<link href="sample.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Sample — Producing HTML Compliant Output
|
||||
</h1>
|
||||
<div class="description">
|
||||
<p>
|
||||
This sample shows how to configure CKEditor to output valid
|
||||
<a class="samples" href="http://www.w3.org/TR/html401/">HTML 4.01</a> code.
|
||||
Traditional HTML elements like <code><b></code>,
|
||||
<code><i></code>, and <code><font></code> are used in place of
|
||||
<code><strong></code>, <code><em></code>, and CSS styles.
|
||||
</p>
|
||||
<p>
|
||||
To add a CKEditor instance outputting legacy HTML 4.01 code, load the editor using a standard
|
||||
JavaScript call, and define CKEditor features to use the HTML compliant elements and attributes.
|
||||
</p>
|
||||
<p>
|
||||
A snippet of the configuration code can be seen below; check the source of this page for
|
||||
full definition:
|
||||
</p>
|
||||
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
|
||||
{
|
||||
coreStyles_bold : { element : 'b' },
|
||||
coreStyles_italic : { element : 'i' },
|
||||
|
||||
fontSize_style :
|
||||
{
|
||||
element : 'font',
|
||||
attributes : { 'size' : '#(size)' }
|
||||
}
|
||||
|
||||
// More definitions follow.
|
||||
});</pre>
|
||||
</div>
|
||||
|
||||
<!-- This <div> holds alert messages to be display in the sample page. -->
|
||||
<div id="alerts">
|
||||
<noscript>
|
||||
<p>
|
||||
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
||||
support, like yours, you should still see the contents (HTML data) and you should
|
||||
be able to edit it normally, without a rich editor interface.
|
||||
</p>
|
||||
</noscript>
|
||||
</div>
|
||||
<form action="sample_posteddata.php" method="post">
|
||||
<p>
|
||||
<label for="editor1">
|
||||
Editor 1:</label>
|
||||
<textarea cols="80" id="editor1" name="editor1" rows="10"><p>This is some <b>sample text</b>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
CKEDITOR.replace( 'editor1',
|
||||
{
|
||||
/*
|
||||
* Style sheet for the contents
|
||||
*/
|
||||
contentsCss : 'body {color:#000; background-color#:FFF;}',
|
||||
|
||||
/*
|
||||
* Simple HTML5 doctype
|
||||
*/
|
||||
docType : '<!DOCTYPE HTML>',
|
||||
|
||||
/*
|
||||
* Core styles.
|
||||
*/
|
||||
coreStyles_bold : { element : 'b' },
|
||||
coreStyles_italic : { element : 'i' },
|
||||
coreStyles_underline : { element : 'u'},
|
||||
coreStyles_strike : { element : 'strike' },
|
||||
|
||||
/*
|
||||
* Font face
|
||||
*/
|
||||
// Define the way font elements will be applied to the document. The "font"
|
||||
// element will be used.
|
||||
font_style :
|
||||
{
|
||||
element : 'font',
|
||||
attributes : { 'face' : '#(family)' }
|
||||
},
|
||||
|
||||
/*
|
||||
* Font sizes.
|
||||
*/
|
||||
fontSize_sizes : 'xx-small/1;x-small/2;small/3;medium/4;large/5;x-large/6;xx-large/7',
|
||||
fontSize_style :
|
||||
{
|
||||
element : 'font',
|
||||
attributes : { 'size' : '#(size)' }
|
||||
} ,
|
||||
|
||||
/*
|
||||
* Font colors.
|
||||
*/
|
||||
colorButton_enableMore : true,
|
||||
|
||||
colorButton_foreStyle :
|
||||
{
|
||||
element : 'font',
|
||||
attributes : { 'color' : '#(color)' }
|
||||
},
|
||||
|
||||
colorButton_backStyle :
|
||||
{
|
||||
element : 'font',
|
||||
styles : { 'background-color' : '#(color)' }
|
||||
},
|
||||
|
||||
/*
|
||||
* Styles combo.
|
||||
*/
|
||||
stylesSet :
|
||||
[
|
||||
{ name : 'Computer Code', element : 'code' },
|
||||
{ name : 'Keyboard Phrase', element : 'kbd' },
|
||||
{ name : 'Sample Text', element : 'samp' },
|
||||
{ name : 'Variable', element : 'var' },
|
||||
|
||||
{ name : 'Deleted Text', element : 'del' },
|
||||
{ name : 'Inserted Text', element : 'ins' },
|
||||
|
||||
{ name : 'Cited Work', element : 'cite' },
|
||||
{ name : 'Inline Quotation', element : 'q' }
|
||||
],
|
||||
|
||||
on : { 'instanceReady' : configureHtmlOutput }
|
||||
});
|
||||
|
||||
/*
|
||||
* Adjust the behavior of the dataProcessor to avoid styles
|
||||
* and make it look like FCKeditor HTML output.
|
||||
*/
|
||||
function configureHtmlOutput( ev )
|
||||
{
|
||||
var editor = ev.editor,
|
||||
dataProcessor = editor.dataProcessor,
|
||||
htmlFilter = dataProcessor && dataProcessor.htmlFilter;
|
||||
|
||||
// Out self closing tags the HTML4 way, like <br>.
|
||||
dataProcessor.writer.selfClosingEnd = '>';
|
||||
|
||||
// Make output formatting behave similar to FCKeditor
|
||||
var dtd = CKEDITOR.dtd;
|
||||
for ( var e in CKEDITOR.tools.extend( {}, dtd.$nonBodyContent, dtd.$block, dtd.$listItem, dtd.$tableContent ) )
|
||||
{
|
||||
dataProcessor.writer.setRules( e,
|
||||
{
|
||||
indent : true,
|
||||
breakBeforeOpen : true,
|
||||
breakAfterOpen : false,
|
||||
breakBeforeClose : !dtd[ e ][ '#' ],
|
||||
breakAfterClose : true
|
||||
});
|
||||
}
|
||||
|
||||
// Output properties as attributes, not styles.
|
||||
htmlFilter.addRules(
|
||||
{
|
||||
elements :
|
||||
{
|
||||
$ : function( element )
|
||||
{
|
||||
// Output dimensions of images as width and height
|
||||
if ( element.name == 'img' )
|
||||
{
|
||||
var style = element.attributes.style;
|
||||
|
||||
if ( style )
|
||||
{
|
||||
// Get the width from the style.
|
||||
var match = /(?:^|\s)width\s*:\s*(\d+)px/i.exec( style ),
|
||||
width = match && match[1];
|
||||
|
||||
// Get the height from the style.
|
||||
match = /(?:^|\s)height\s*:\s*(\d+)px/i.exec( style );
|
||||
var height = match && match[1];
|
||||
|
||||
if ( width )
|
||||
{
|
||||
element.attributes.style = element.attributes.style.replace( /(?:^|\s)width\s*:\s*(\d+)px;?/i , '' );
|
||||
element.attributes.width = width;
|
||||
}
|
||||
|
||||
if ( height )
|
||||
{
|
||||
element.attributes.style = element.attributes.style.replace( /(?:^|\s)height\s*:\s*(\d+)px;?/i , '' );
|
||||
element.attributes.height = height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Output alignment of paragraphs using align
|
||||
if ( element.name == 'p' )
|
||||
{
|
||||
style = element.attributes.style;
|
||||
|
||||
if ( style )
|
||||
{
|
||||
// Get the align from the style.
|
||||
match = /(?:^|\s)text-align\s*:\s*(\w*);/i.exec( style );
|
||||
var align = match && match[1];
|
||||
|
||||
if ( align )
|
||||
{
|
||||
element.attributes.style = element.attributes.style.replace( /(?:^|\s)text-align\s*:\s*(\w*);?/i , '' );
|
||||
element.attributes.align = align;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !element.attributes.style )
|
||||
delete element.attributes.style;
|
||||
|
||||
return element;
|
||||
}
|
||||
},
|
||||
|
||||
attributes :
|
||||
{
|
||||
style : function( value, element )
|
||||
{
|
||||
// Return #RGB for background and border colors
|
||||
return convertRGBToHex( value );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert a CSS rgb(R, G, B) color back to #RRGGBB format.
|
||||
* @param Css style string (can include more than one color
|
||||
* @return Converted css style.
|
||||
*/
|
||||
function convertRGBToHex( cssStyle )
|
||||
{
|
||||
return cssStyle.replace( /(?:rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\))/gi, function( match, red, green, blue )
|
||||
{
|
||||
red = parseInt( red, 10 ).toString( 16 );
|
||||
green = parseInt( green, 10 ).toString( 16 );
|
||||
blue = parseInt( blue, 10 ).toString( 16 );
|
||||
var color = [red, green, blue] ;
|
||||
|
||||
// Add padding zeros if the hex value is less than 0x10.
|
||||
for ( var i = 0 ; i < color.length ; i++ )
|
||||
color[i] = String( '0' + color[i] ).slice( -2 ) ;
|
||||
|
||||
return '#' + color.join( '' ) ;
|
||||
});
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" value="Submit" />
|
||||
</p>
|
||||
</form>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,181 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>XHTML Compliant Output — CKEditor Sample</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<script type="text/javascript" src="../ckeditor.js"></script>
|
||||
<script src="sample.js" type="text/javascript"></script>
|
||||
<link href="sample.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Sample — Producing XHTML Compliant Output
|
||||
</h1>
|
||||
<div class="description">
|
||||
<p>
|
||||
This sample shows how to configure CKEditor to output valid
|
||||
<a class="samples" href="http://www.w3.org/TR/xhtml11/">XHTML 1.1</a> code.
|
||||
Deprecated elements (<code><font></code>, <code><u></code>) or attributes
|
||||
(<code>size</code>, <code>face</code>) will be replaced with XHTML compliant code.
|
||||
</p>
|
||||
<p>
|
||||
To add a CKEditor instance outputting valid XHTML code, load the editor using a standard
|
||||
JavaScript call and define CKEditor features to use the XHTML compliant elements and styles.
|
||||
</p>
|
||||
<p>
|
||||
A snippet of the configuration code can be seen below; check the source of this page for
|
||||
full definition:
|
||||
</p>
|
||||
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
|
||||
{
|
||||
contentsCss : 'assets/output_xhtml.css',
|
||||
|
||||
coreStyles_bold : { element : 'span', attributes : {'class': 'Bold'} },
|
||||
coreStyles_italic : { element : 'span', attributes : {'class': 'Italic'} },
|
||||
|
||||
// More definitions follow.
|
||||
});</pre>
|
||||
</div>
|
||||
|
||||
<!-- This <div> holds alert messages to be display in the sample page. -->
|
||||
<div id="alerts">
|
||||
<noscript>
|
||||
<p>
|
||||
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
||||
support, like yours, you should still see the contents (HTML data) and you should
|
||||
be able to edit it normally, without a rich editor interface.
|
||||
</p>
|
||||
</noscript>
|
||||
</div>
|
||||
<form action="sample_posteddata.php" method="post">
|
||||
<p>
|
||||
<label for="editor1">
|
||||
Editor 1:</label>
|
||||
<textarea cols="80" id="editor1" name="editor1" rows="10"><p>This is some <span class="Bold">sample text</span>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
CKEDITOR.replace( 'editor1',
|
||||
{
|
||||
/*
|
||||
* Style sheet for the contents
|
||||
*/
|
||||
contentsCss : 'assets/output_xhtml.css',
|
||||
|
||||
/*
|
||||
* Core styles.
|
||||
*/
|
||||
coreStyles_bold : { element : 'span', attributes : {'class': 'Bold'} },
|
||||
coreStyles_italic : { element : 'span', attributes : {'class': 'Italic'}},
|
||||
coreStyles_underline : { element : 'span', attributes : {'class': 'Underline'}},
|
||||
coreStyles_strike : { element : 'span', attributes : {'class': 'StrikeThrough'}, overrides : 'strike' },
|
||||
|
||||
coreStyles_subscript : { element : 'span', attributes : {'class': 'Subscript'}, overrides : 'sub' },
|
||||
coreStyles_superscript : { element : 'span', attributes : {'class': 'Superscript'}, overrides : 'sup' },
|
||||
|
||||
/*
|
||||
* Font face
|
||||
*/
|
||||
// List of fonts available in the toolbar combo. Each font definition is
|
||||
// separated by a semi-colon (;). We are using class names here, so each font
|
||||
// is defined by {Combo Label}/{Class Name}.
|
||||
font_names : 'Comic Sans MS/FontComic;Courier New/FontCourier;Times New Roman/FontTimes',
|
||||
|
||||
// Define the way font elements will be applied to the document. The "span"
|
||||
// element will be used. When a font is selected, the font name defined in the
|
||||
// above list is passed to this definition with the name "Font", being it
|
||||
// injected in the "class" attribute.
|
||||
// We must also instruct the editor to replace span elements that are used to
|
||||
// set the font (Overrides).
|
||||
font_style :
|
||||
{
|
||||
element : 'span',
|
||||
attributes : { 'class' : '#(family)' },
|
||||
overrides : [ { element : 'span', attributes : { 'class' : /^Font(?:Comic|Courier|Times)$/ } } ]
|
||||
},
|
||||
|
||||
/*
|
||||
* Font sizes.
|
||||
*/
|
||||
fontSize_sizes : 'Smaller/FontSmaller;Larger/FontLarger;8pt/FontSmall;14pt/FontBig;Double Size/FontDouble',
|
||||
fontSize_style :
|
||||
{
|
||||
element : 'span',
|
||||
attributes : { 'class' : '#(size)' },
|
||||
overrides : [ { element : 'span', attributes : { 'class' : /^Font(?:Smaller|Larger|Small|Big|Double)$/ } } ]
|
||||
} ,
|
||||
|
||||
/*
|
||||
* Font colors.
|
||||
*/
|
||||
colorButton_enableMore : false,
|
||||
|
||||
colorButton_colors : 'FontColor1/FF9900,FontColor2/0066CC,FontColor3/F00',
|
||||
colorButton_foreStyle :
|
||||
{
|
||||
element : 'span',
|
||||
attributes : { 'class' : '#(color)' },
|
||||
overrides : [ { element : 'span', attributes : { 'class' : /^FontColor(?:1|2|3)$/ } } ]
|
||||
},
|
||||
|
||||
colorButton_backStyle :
|
||||
{
|
||||
element : 'span',
|
||||
attributes : { 'class' : '#(color)BG' },
|
||||
overrides : [ { element : 'span', attributes : { 'class' : /^FontColor(?:1|2|3)BG$/ } } ]
|
||||
},
|
||||
|
||||
/*
|
||||
* Indentation.
|
||||
*/
|
||||
indentClasses : ['Indent1', 'Indent2', 'Indent3'],
|
||||
|
||||
/*
|
||||
* Paragraph justification.
|
||||
*/
|
||||
justifyClasses : [ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyFull' ],
|
||||
|
||||
/*
|
||||
* Styles combo.
|
||||
*/
|
||||
stylesSet :
|
||||
[
|
||||
{ name : 'Strong Emphasis', element : 'strong' },
|
||||
{ name : 'Emphasis', element : 'em' },
|
||||
|
||||
{ name : 'Computer Code', element : 'code' },
|
||||
{ name : 'Keyboard Phrase', element : 'kbd' },
|
||||
{ name : 'Sample Text', element : 'samp' },
|
||||
{ name : 'Variable', element : 'var' },
|
||||
|
||||
{ name : 'Deleted Text', element : 'del' },
|
||||
{ name : 'Inserted Text', element : 'ins' },
|
||||
|
||||
{ name : 'Cited Work', element : 'cite' },
|
||||
{ name : 'Inline Quotation', element : 'q' }
|
||||
]
|
||||
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" value="Submit" />
|
||||
</p>
|
||||
</form>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,47 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<title>CKEditor Samples — PHP Integration</title>
|
||||
<link type="text/css" rel="stylesheet" href="../sample.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Samples List for PHP
|
||||
</h1>
|
||||
<h2 class="samples">
|
||||
Basic Samples
|
||||
</h2>
|
||||
<ul class="samples">
|
||||
<li><a class="samples" href="replace.php">Replace existing textarea elements by code</a><br />
|
||||
Replacement of selected textarea elements with CKEditor instances by using a JavaScript call.</li>
|
||||
<li><a class="samples" href="replaceAll.php">Replace all textarea elements by code</a><br />
|
||||
Replacement of all textarea elements with CKEditor instances by using a JavaScript call.</li>
|
||||
<li><a class="samples" href="standalone.php">Create CKEditor instances in PHP</a><br />
|
||||
Creating a CKEditor instance (no initial textarea element is required).</li>
|
||||
</ul>
|
||||
<h2 class="samples">
|
||||
Advanced Samples
|
||||
</h2>
|
||||
<ul class="samples">
|
||||
<li><a class="samples" href="advanced.php">Setting configuration options</a><br />
|
||||
Creating a CKEditor instance with custom configuration options.</li>
|
||||
<li><a class="samples" href="events.php">Listening to events</a><br />
|
||||
Creating event handlers.
|
||||
</li>
|
||||
</ul>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,81 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Placeholder Plugin — CKEditor Sample</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<script type="text/javascript" src="../ckeditor.js"></script>
|
||||
<script src="sample.js" type="text/javascript"></script>
|
||||
<link href="sample.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Sample — Using the Placeholder Plugin
|
||||
</h1>
|
||||
<div class="description">
|
||||
<p>
|
||||
This sample shows how to configure CKEditor instances to use the
|
||||
<strong>placeholder</strong> plugin that lets you insert read-only elements
|
||||
into your content. To enter and modify read-only text, use the
|
||||
<strong>Create Placeholder</strong> button and its matching dialog window.
|
||||
</p>
|
||||
<p>
|
||||
To add a CKEditor instance that uses the <strong>placeholder</strong> plugin and a related
|
||||
<strong>Create Placeholder</strong> toolbar button, insert the following JavaScript
|
||||
call to your code:
|
||||
</p>
|
||||
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
|
||||
{
|
||||
<strong>extraPlugins : 'placeholder',</strong>
|
||||
toolbar : [ [ 'Source', 'Bold' ], [<strong>'CreatePlaceholder'</strong>] ]
|
||||
});</pre>
|
||||
<p>
|
||||
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
|
||||
the <code><textarea></code> element to be replaced with CKEditor.
|
||||
</p>
|
||||
</div>
|
||||
<!-- This <div> holds alert messages to be display in the sample page. -->
|
||||
<div id="alerts">
|
||||
<noscript>
|
||||
<p>
|
||||
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
||||
support, like yours, you should still see the contents (HTML data) and you should
|
||||
be able to edit it normally, without a rich editor interface.
|
||||
</p>
|
||||
</noscript>
|
||||
</div>
|
||||
<form action="sample_posteddata.php" method="post">
|
||||
<p>
|
||||
<label for="editor1">
|
||||
CKEditor using the <strong>placeholder</strong> plugin with its default configuration:</label>
|
||||
<textarea cols="80" id="editor1" name="editor1" rows="10"><p>This is a [[sample placeholder]]. You are using <a href="http://ckeditor.com/">CKEditor</a>. </p></textarea>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
CKEDITOR.replace( 'editor1', {
|
||||
extraPlugins : 'placeholder',
|
||||
toolbar : [ [ 'Source', 'CreatePlaceholder' ] ]
|
||||
});
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" value="Submit" />
|
||||
</p>
|
||||
</form>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,64 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Replace Textareas by Class Name — CKEditor Sample</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<script type="text/javascript" src="../ckeditor.js"></script>
|
||||
<script src="sample.js" type="text/javascript"></script>
|
||||
<link href="sample.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Sample — Replace Textarea Elements by Class Name
|
||||
</h1>
|
||||
<div class="description">
|
||||
<p>
|
||||
This sample shows how to automatically replace all <code><textarea></code> elements
|
||||
of a given class with a CKEditor instance.
|
||||
</p>
|
||||
<p>
|
||||
To replace a <code><textarea></code> element, simply assign it the <code>ckeditor</code>
|
||||
class, as in the code below:
|
||||
</p>
|
||||
<pre class="samples"><textarea <strong>class="ckeditor</strong>" name="editor1"></textarea></pre>
|
||||
<p>
|
||||
Note that other <code><textarea></code> attributes (like <code>id</code> or <code>name</code>) need to be adjusted to your document.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- This <div> holds alert messages to be display in the sample page. -->
|
||||
<div id="alerts">
|
||||
<noscript>
|
||||
<p>
|
||||
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
||||
support, like yours, you should still see the contents (HTML data) and you should
|
||||
be able to edit it normally, without a rich editor interface.
|
||||
</p>
|
||||
</noscript>
|
||||
</div>
|
||||
<form action="sample_posteddata.php" method="post">
|
||||
<p>
|
||||
<label for="editor1">
|
||||
Editor 1:</label>
|
||||
<textarea class="ckeditor" cols="80" id="editor1" name="editor1" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" value="Submit" />
|
||||
</p>
|
||||
</form>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,97 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Replace Textarea by Code — CKEditor Sample</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<script type="text/javascript" src="../ckeditor.js"></script>
|
||||
<script src="sample.js" type="text/javascript"></script>
|
||||
<link href="sample.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Sample — Replace Textarea Elements Using JavaScript Code
|
||||
</h1>
|
||||
<div class="description">
|
||||
<p>
|
||||
This sample shows how to automatically replace all <code><textarea></code> elements
|
||||
with a CKEditor instance by using a JavaScript call.
|
||||
</p>
|
||||
<p>
|
||||
To replace a <code><textarea></code> element, place the following call at any point
|
||||
after the <code><textarea></code> element or inside a <code><script></code> element located
|
||||
in the <code><head></code> section of the page, in a <code>window.onload</code> event handler:
|
||||
</p>
|
||||
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>' );</pre>
|
||||
<p>
|
||||
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
|
||||
the <code><textarea></code> element to be replaced.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- This <div> holds alert messages to be display in the sample page. -->
|
||||
<div id="alerts">
|
||||
<noscript>
|
||||
<p>
|
||||
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
||||
support, like yours, you should still see the contents (HTML data) and you should
|
||||
be able to edit it normally, without a rich editor interface.
|
||||
</p>
|
||||
</noscript>
|
||||
</div>
|
||||
<form action="sample_posteddata.php" method="post">
|
||||
<p>
|
||||
<label for="editor1">
|
||||
Editor 1:</label>
|
||||
<textarea cols="80" id="editor1" name="editor1" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
// This call can be placed at any point after the
|
||||
// <textarea>, or inside a <head><script> in a
|
||||
// window.onload event handler.
|
||||
|
||||
// Replace the <textarea id="editor"> with an CKEditor
|
||||
// instance, using default configurations.
|
||||
CKEDITOR.replace( 'editor1' );
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
</p>
|
||||
<p>
|
||||
<label for="editor2">
|
||||
Editor 2:</label>
|
||||
<textarea cols="80" id="editor2" name="editor2" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
// This call can be placed at any point after the
|
||||
// <textarea>, or inside a <head><script> in a
|
||||
// window.onload event handler.
|
||||
|
||||
// Replace the <textarea id="editor"> with an CKEditor
|
||||
// instance, using default configurations.
|
||||
CKEDITOR.replace( 'editor2' );
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" value="Submit" />
|
||||
</p>
|
||||
</form>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,163 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
html, body, h1, h2, h3, h4, h5, h6, div, span, blockquote, p, address, form, fieldset, img, ul, ol, dl, dt, dd, li, hr, table, td, th, strong, em, sup, sub, dfn, ins, del, q, cite, var, samp, code, kbd, tt, pre {
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
body {
|
||||
padding:10px 30px;
|
||||
}
|
||||
|
||||
input, textarea, select, option, optgroup, button, td, th {
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
pre,
|
||||
code,
|
||||
kbd,
|
||||
samp,
|
||||
tt{
|
||||
font-family: monospace,monospace;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
h1.samples {
|
||||
color:#0782C1;
|
||||
font-size:200%;
|
||||
font-weight:normal;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
h2.samples {
|
||||
color:#000000;
|
||||
font-size:130%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
p, blockquote, address, form, pre, dl, h1.samples, h2.samples {
|
||||
margin-bottom:15px;
|
||||
}
|
||||
|
||||
ul.samples {
|
||||
margin-bottom:15px;
|
||||
}
|
||||
|
||||
.clear {
|
||||
clear:both;
|
||||
}
|
||||
|
||||
fieldset
|
||||
{
|
||||
margin: 0;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
body, input, textarea {
|
||||
color: #333333;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
font-size: 75%;
|
||||
}
|
||||
|
||||
a.samples {
|
||||
color:#189DE1;
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
a.samples:hover {
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
form
|
||||
{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
pre.samples
|
||||
{
|
||||
background-color: #F7F7F7;
|
||||
border: 1px solid #D7D7D7;
|
||||
overflow: auto;
|
||||
padding: 0.25em;
|
||||
}
|
||||
|
||||
#alerts
|
||||
{
|
||||
color: Red;
|
||||
}
|
||||
|
||||
#footer hr
|
||||
{
|
||||
margin: 10px 0 15px 0;
|
||||
height: 1px;
|
||||
border: solid 1px gray;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
#footer p
|
||||
{
|
||||
margin: 0 10px 10px 10px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
#footer #copy
|
||||
{
|
||||
float: right;
|
||||
}
|
||||
|
||||
#outputSample
|
||||
{
|
||||
width: 100%;
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
#outputSample thead th
|
||||
{
|
||||
color: #dddddd;
|
||||
background-color: #999999;
|
||||
padding: 4px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#outputSample tbody th
|
||||
{
|
||||
vertical-align: top;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#outputSample pre
|
||||
{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
white-space: pre; /* CSS2 */
|
||||
white-space: -moz-pre-wrap; /* Mozilla*/
|
||||
white-space: -o-pre-wrap; /* Opera 7 */
|
||||
white-space: pre-wrap; /* CSS 2.1 */
|
||||
white-space: pre-line; /* CSS 3 (and 2.1 as well, actually) */
|
||||
word-wrap: break-word; /* IE */
|
||||
}
|
||||
|
||||
.description {
|
||||
border: 1px dotted #B7B7B7;
|
||||
margin-bottom: 10px;
|
||||
padding: 10px 10px 0;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
margin-bottom:6px;
|
||||
}
|
||||
|
||||
.cke_dialog label
|
||||
{
|
||||
display: inline;
|
||||
margin-bottom: auto;
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
// This file is not required by CKEditor and may be safely ignored.
|
||||
// It is just a helper file that displays a red message about browser compatibility
|
||||
// at the top of the samples (if incompatible browser is detected).
|
||||
|
||||
if ( window.CKEDITOR )
|
||||
{
|
||||
(function()
|
||||
{
|
||||
var showCompatibilityMsg = function()
|
||||
{
|
||||
var env = CKEDITOR.env;
|
||||
|
||||
var html = '<p><strong>Your browser is not compatible with CKEditor.</strong>';
|
||||
|
||||
var browsers =
|
||||
{
|
||||
gecko : 'Firefox 2.0',
|
||||
ie : 'Internet Explorer 6.0',
|
||||
opera : 'Opera 9.5',
|
||||
webkit : 'Safari 3.0'
|
||||
};
|
||||
|
||||
var alsoBrowsers = '';
|
||||
|
||||
for ( var key in env )
|
||||
{
|
||||
if ( browsers[ key ] )
|
||||
{
|
||||
if ( env[key] )
|
||||
html += ' CKEditor is compatible with ' + browsers[ key ] + ' or higher.';
|
||||
else
|
||||
alsoBrowsers += browsers[ key ] + '+, ';
|
||||
}
|
||||
}
|
||||
|
||||
alsoBrowsers = alsoBrowsers.replace( /\+,([^,]+), $/, '+ and $1' );
|
||||
|
||||
html += ' It is also compatible with ' + alsoBrowsers + '.';
|
||||
|
||||
html += '</p><p>With non compatible browsers, you should still be able to see and edit the contents (HTML) in a plain text field.</p>';
|
||||
|
||||
var alertsEl = document.getElementById( 'alerts' );
|
||||
alertsEl && ( alertsEl.innerHTML = html );
|
||||
};
|
||||
|
||||
var onload = function()
|
||||
{
|
||||
// Show a friendly compatibility message as soon as the page is loaded,
|
||||
// for those browsers that are not compatible with CKEditor.
|
||||
if ( !CKEDITOR.env.isCompatible )
|
||||
showCompatibilityMsg();
|
||||
};
|
||||
|
||||
// Register the onload listener.
|
||||
if ( window.addEventListener )
|
||||
window.addEventListener( 'load', onload, false );
|
||||
else if ( window.attachEvent )
|
||||
window.attachEvent( 'onload', onload );
|
||||
})();
|
||||
}
|
|
@ -1,153 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Shared Toolbars — CKEditor Sample</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<script type="text/javascript" src="../ckeditor.js"></script>
|
||||
<script src="sample.js" type="text/javascript"></script>
|
||||
<link href="sample.css" rel="stylesheet" type="text/css" />
|
||||
<style id="styles" type="text/css">
|
||||
|
||||
#editorsForm
|
||||
{
|
||||
height: 400px;
|
||||
overflow: auto;
|
||||
border: solid 1px #555;
|
||||
margin: 10px 0;
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Sample — Shared Toolbars
|
||||
</h1>
|
||||
<div class="description">
|
||||
<p>
|
||||
This sample shows how to configure multiple CKEditor instances to share some parts of the interface.
|
||||
You can choose to share the toolbar (<code>topSpace</code>), the elements path
|
||||
(<code>bottomSpace</code>), or both.
|
||||
</p>
|
||||
<p>
|
||||
CKEditor instances with shared spaces can be inserted with a JavaScript call using the following code:
|
||||
</p>
|
||||
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
|
||||
{
|
||||
<strong>sharedSpaces :
|
||||
{
|
||||
top : 'topSpace',
|
||||
bottom : 'bottomSpace'
|
||||
}</strong>
|
||||
});</pre>
|
||||
<p>
|
||||
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
|
||||
the <code><textarea></code> element to be replaced with CKEditor.
|
||||
</p>
|
||||
</div>
|
||||
<!-- This <div> holds alert messages to be display in the sample page. -->
|
||||
<div id="alerts">
|
||||
<noscript>
|
||||
<p>
|
||||
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
||||
support, like yours, you should still see the contents (HTML data) and you should
|
||||
be able to edit it normally, without a rich editor interface.
|
||||
</p>
|
||||
</noscript>
|
||||
</div>
|
||||
<div id="topSpace">
|
||||
</div>
|
||||
<form action="sample_posteddata.php" id="editorsForm" method="post">
|
||||
<p>
|
||||
<label for="editor1">
|
||||
Editor 1 (uses the shared toolbar and elements path):</label>
|
||||
<textarea cols="80" id="editor1" name="editor1" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="editor2">
|
||||
Editor 2 (uses the shared toolbar and elements path):</label>
|
||||
<textarea cols="80" id="editor2" name="editor2" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="editor3">
|
||||
Editor 3 (uses the shared toolbar only):</label>
|
||||
<textarea cols="80" id="editor3" name="editor3" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="editor4">
|
||||
Editor 4 (no shared spaces):</label>
|
||||
<textarea cols="80" id="editor4" name="editor4" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" value="Submit" />
|
||||
</p>
|
||||
</form>
|
||||
<div id="bottomSpace">
|
||||
</div>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
// Create all editor instances at the end of the page, so we are sure
|
||||
// that the "bottomSpace" div is available in the DOM (IE issue).
|
||||
|
||||
CKEDITOR.replace( 'editor1',
|
||||
{
|
||||
sharedSpaces :
|
||||
{
|
||||
top : 'topSpace',
|
||||
bottom : 'bottomSpace'
|
||||
},
|
||||
|
||||
// Removes the maximize plugin as it's not usable
|
||||
// in a shared toolbar.
|
||||
// Removes the resizer as it's not usable in a
|
||||
// shared elements path.
|
||||
removePlugins : 'maximize,resize'
|
||||
} );
|
||||
|
||||
CKEDITOR.replace( 'editor2',
|
||||
{
|
||||
sharedSpaces :
|
||||
{
|
||||
top : 'topSpace',
|
||||
bottom : 'bottomSpace'
|
||||
},
|
||||
|
||||
// Removes the maximize plugin as it's not usable
|
||||
// in a shared toolbar.
|
||||
// Removes the resizer as it's not usable in a
|
||||
// shared elements path.
|
||||
removePlugins : 'maximize,resize'
|
||||
} );
|
||||
|
||||
CKEDITOR.replace( 'editor3',
|
||||
{
|
||||
sharedSpaces :
|
||||
{
|
||||
top : 'topSpace'
|
||||
},
|
||||
|
||||
// Removes the maximize plugin as it's not usable
|
||||
// in a shared toolbar.
|
||||
removePlugins : 'maximize'
|
||||
} );
|
||||
|
||||
CKEDITOR.replace( 'editor4' );
|
||||
//]]>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,110 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Skins — CKEditor Sample</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<script type="text/javascript" src="../ckeditor.js"></script>
|
||||
<script src="sample.js" type="text/javascript"></script>
|
||||
<link href="sample.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Sample — Skins
|
||||
</h1>
|
||||
<div class="description">
|
||||
<p>
|
||||
This sample shows how to automatically replace <code><textarea></code> elements
|
||||
with a CKEditor instance using a specific <a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.skin">skin</a>.
|
||||
</p>
|
||||
<p>
|
||||
CKEditor with a specified skin (in this case, the "Office 2003" skin) is inserted with a JavaScript call using the following code:
|
||||
</p>
|
||||
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
|
||||
{
|
||||
<strong>skin : 'office2003'</strong>
|
||||
});</pre>
|
||||
<p>
|
||||
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
|
||||
the <code><textarea></code> element to be replaced.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- This <div> holds alert messages to be display in the sample page. -->
|
||||
<div id="alerts">
|
||||
<noscript>
|
||||
<p>
|
||||
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
||||
support, like yours, you should still see the contents (HTML data) and you should
|
||||
be able to edit it normally, without a rich editor interface.
|
||||
</p>
|
||||
</noscript>
|
||||
</div>
|
||||
<form action="sample_posteddata.php" method="post">
|
||||
<h2 class="samples">"Kama" skin</h2>
|
||||
<p>The default skin used in CKEditor. No additional configuration is required.</p>
|
||||
<p>
|
||||
<textarea cols="80" id="editor_kama" name="editor_kama" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
CKEDITOR.replace( 'editor_kama',
|
||||
{
|
||||
skin : 'kama'
|
||||
});
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
</p>
|
||||
<h2 class="samples">"Office 2003" skin</h2>
|
||||
<p>Use the following code to configure a CKEditor instance to use the "Office 2003" skin.</p>
|
||||
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
|
||||
{
|
||||
<strong>skin : 'office2003'</strong>
|
||||
});</pre>
|
||||
<p>
|
||||
<textarea cols="80" id="editor_office2003" name="editor_office2003" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
CKEDITOR.replace( 'editor_office2003',
|
||||
{
|
||||
skin : 'office2003'
|
||||
});
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
</p>
|
||||
<h2 class="samples">"V2" skin</h2>
|
||||
<p>Use the following code to configure a CKEditor instance to use the "V2" skin.</p>
|
||||
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
|
||||
{
|
||||
<strong>skin : 'v2'</strong>
|
||||
});</pre>
|
||||
<textarea cols="80" id="editor_v2" name="editor_v2" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
CKEDITOR.replace( 'editor_v2',
|
||||
{
|
||||
skin : 'v2'
|
||||
});
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
</form>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,129 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>UI Color Picker — CKEditor Sample</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<script type="text/javascript" src="../ckeditor.js"></script>
|
||||
<script src="sample.js" type="text/javascript"></script>
|
||||
<link href="sample.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Sample — UI Color Picker
|
||||
</h1>
|
||||
<div class="description">
|
||||
<p>
|
||||
This sample shows how to automatically replace <code><textarea></code> elements
|
||||
with a CKEditor instance with an option to change the color of its user interface.
|
||||
</p>
|
||||
<h2 class="samples">Setting the User Interface Color</h2>
|
||||
<p>
|
||||
To specify the color of the user interface, set the <code>uiColor</code> property:
|
||||
</p>
|
||||
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
|
||||
{
|
||||
<strong>uiColor: '#EE0000'</strong>
|
||||
});</pre>
|
||||
<p>
|
||||
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
|
||||
the <code><textarea></code> element to be replaced.
|
||||
</p>
|
||||
<h2 class="samples">Enabling the Color Picker</h2>
|
||||
<p>
|
||||
If the <strong>uicolor</strong> plugin along with the dedicated <strong>UIColor</strong>
|
||||
toolbar button is added to CKEditor, the user will also be able to pick the color of the
|
||||
UI from the color palette available in the <strong>UI Color Picker</strong> dialog window.
|
||||
</p>
|
||||
<p>
|
||||
To insert a CKEditor instance with the <strong>uicolor</strong> plugin enabled,
|
||||
use the following JavaScript call:
|
||||
</p>
|
||||
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
|
||||
{
|
||||
<strong>extraPlugins : 'uicolor',</strong>
|
||||
toolbar : [ [ 'Bold', 'Italic' ], [ <strong>'UIColor'</strong> ] ]
|
||||
});</pre>
|
||||
</div>
|
||||
<!-- This <div> holds alert messages to be display in the sample page. -->
|
||||
<div id="alerts">
|
||||
<noscript>
|
||||
<p>
|
||||
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
||||
support, like yours, you should still see the contents (HTML data) and you should
|
||||
be able to edit it normally, without a rich editor interface.
|
||||
</p>
|
||||
</noscript>
|
||||
</div>
|
||||
<p>
|
||||
Click the <strong>UI Color Picker</strong> button to test your color preferences at runtime.
|
||||
</p>
|
||||
<p>
|
||||
The first editor instance includes the <strong>UI Color Picker</strong> toolbar button,
|
||||
but the default UI color is not defined, so the editor uses the skin color.
|
||||
</p>
|
||||
<form action="sample_posteddata.php" method="post">
|
||||
<p>
|
||||
<textarea cols="80" id="editor1" name="editor1" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
// Replace the <textarea id="editor"> with an CKEditor
|
||||
// instance, using default configurations.
|
||||
CKEDITOR.replace( 'editor1',
|
||||
{
|
||||
extraPlugins : 'uicolor',
|
||||
toolbar :
|
||||
[
|
||||
[ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],
|
||||
[ 'UIColor' ]
|
||||
]
|
||||
});
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
</p>
|
||||
<p>
|
||||
The second editor instance includes the <strong>UI Color Picker</strong> toolbar button. The
|
||||
default UI color was defined, so the skin color is not used.
|
||||
</p>
|
||||
<p>
|
||||
<textarea cols="80" id="editor2" name="editor2" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
// Replace the <textarea id="editor"> with an CKEditor
|
||||
// instance, using default configurations.
|
||||
CKEDITOR.replace( 'editor2',
|
||||
{
|
||||
extraPlugins : 'uicolor',
|
||||
uiColor: '#14B8C4',
|
||||
toolbar :
|
||||
[
|
||||
[ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],
|
||||
[ 'UIColor' ]
|
||||
]
|
||||
} );
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" value="Submit" />
|
||||
</p>
|
||||
</form>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,134 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>User Interface Globalization — CKEditor Sample</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<script type="text/javascript" src="../ckeditor.js"></script>
|
||||
<script type="text/javascript" src="../lang/_languages.js"></script>
|
||||
<script src="sample.js" type="text/javascript"></script>
|
||||
<link href="sample.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Sample — User Interface Languages
|
||||
</h1>
|
||||
<div class="description">
|
||||
<p>
|
||||
This sample shows how to automatically replace <code><textarea></code> elements
|
||||
with a CKEditor instance with an option to change the language of its user interface.
|
||||
</p>
|
||||
<p>
|
||||
It pulls the language list from CKEditor <code>_languages.js</code> file that contains the list of supported languages and creates
|
||||
a drop-down list that lets the user change the UI language.
|
||||
</p>
|
||||
<p>
|
||||
By default, CKEditor automatically localizes the editor to the language of the user.
|
||||
The UI language can be controlled with two configuration options:
|
||||
<a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.language">
|
||||
<code>language</code></a> and <a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.defaultLanguage">
|
||||
<code>defaultLanguage</code></a>. The <code>defaultLanguage</code> setting specifies the
|
||||
default CKEditor language to be used when a localization suitable for user's settings is not available.
|
||||
</p>
|
||||
<p>
|
||||
To specify the user interface language that will be used no matter what language is
|
||||
specified in user's browser or operating system, set the <code>language</code> property:
|
||||
</p>
|
||||
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
|
||||
{
|
||||
// Load the German interface.
|
||||
<strong>language: 'de'</strong>
|
||||
});</pre>
|
||||
<p>
|
||||
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
|
||||
the <code><textarea></code> element to be replaced.
|
||||
</p>
|
||||
</div>
|
||||
<!-- This <div> holds alert messages to be display in the sample page. -->
|
||||
<div id="alerts">
|
||||
<noscript>
|
||||
<p>
|
||||
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
||||
support, like yours, you should still see the contents (HTML data) and you should
|
||||
be able to edit it normally, without a rich editor interface.
|
||||
</p>
|
||||
</noscript>
|
||||
</div>
|
||||
<form action="sample_posteddata.php" method="post">
|
||||
<p>
|
||||
Available languages (<span id="count"> </span> languages!):<br />
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
document.write( '<select disabled="disabled" id="languages" onchange="createEditor( this.value );">' );
|
||||
// Get the language list from the _languages.js file.
|
||||
for ( var i = 0 ; i < window.CKEDITOR_LANGS.length ; i++ )
|
||||
{
|
||||
document.write(
|
||||
'<option value="' + window.CKEDITOR_LANGS[i].code + '">' +
|
||||
window.CKEDITOR_LANGS[i].name +
|
||||
'</option>' );
|
||||
}
|
||||
document.write( '</select>' );
|
||||
//]]>
|
||||
</script>
|
||||
<br />
|
||||
<span style="color: #888888">(You may see strange characters if your system does not
|
||||
support the selected language)</span>
|
||||
</p>
|
||||
<p>
|
||||
<textarea cols="80" id="editor1" name="editor1" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
// Set the number of languages.
|
||||
document.getElementById( 'count' ).innerHTML = window.CKEDITOR_LANGS.length;
|
||||
|
||||
var editor;
|
||||
|
||||
function createEditor( languageCode )
|
||||
{
|
||||
if ( editor )
|
||||
editor.destroy();
|
||||
|
||||
// Replace the <textarea id="editor"> with an CKEditor
|
||||
// instance, using default configurations.
|
||||
editor = CKEDITOR.replace( 'editor1',
|
||||
{
|
||||
language : languageCode,
|
||||
|
||||
on :
|
||||
{
|
||||
instanceReady : function()
|
||||
{
|
||||
// Wait for the editor to be ready to set
|
||||
// the language combo.
|
||||
var languages = document.getElementById( 'languages' );
|
||||
languages.value = this.langCode;
|
||||
languages.disabled = false;
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
// At page startup, load the default language:
|
||||
createEditor( '' );
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
</p>
|
||||
</form>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,306 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview jQuery adapter provides easy use of basic CKEditor functions
|
||||
* and access to internal API. It also integrates some aspects of CKEditor with
|
||||
* jQuery framework.
|
||||
*
|
||||
* Every TEXTAREA, DIV and P elements can be converted to working editor.
|
||||
*
|
||||
* Plugin exposes some of editor's event to jQuery event system. All of those are namespaces inside
|
||||
* ".ckeditor" namespace and can be binded/listened on supported textarea, div and p nodes.
|
||||
*
|
||||
* Available jQuery events:
|
||||
* - instanceReady.ckeditor( editor, rootNode )
|
||||
* Triggered when new instance is ready.
|
||||
* - destroy.ckeditor( editor )
|
||||
* Triggered when instance is destroyed.
|
||||
* - getData.ckeditor( editor, eventData )
|
||||
* Triggered when getData event is fired inside editor. It can change returned data using eventData reference.
|
||||
* - setData.ckeditor( editor )
|
||||
* Triggered when getData event is fired inside editor.
|
||||
*
|
||||
* @example
|
||||
* <script src="jquery.js"></script>
|
||||
* <script src="ckeditor.js"></script>
|
||||
* <script src="adapters/jquery/adapter.js"></script>
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
/**
|
||||
* Allows CKEditor to override jQuery.fn.val(), making it possible to use the val()
|
||||
* function on textareas, as usual, having it synchronized with CKEditor.<br>
|
||||
* <br>
|
||||
* This configuration option is global and executed during the jQuery Adapter loading.
|
||||
* It can't be customized across editor instances.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* <script>
|
||||
* CKEDITOR.config.jqueryOverrideVal = true;
|
||||
* </script>
|
||||
* <!-- Important: The JQuery adapter is loaded *after* setting jqueryOverrideVal -->
|
||||
* <script src="/ckeditor/adapters/jquery.js"></script>
|
||||
* @example
|
||||
* // ... then later in the code ...
|
||||
*
|
||||
* $( 'textarea' ).ckeditor();
|
||||
* // ...
|
||||
* $( 'textarea' ).val( 'New content' );
|
||||
*/
|
||||
CKEDITOR.config.jqueryOverrideVal = typeof CKEDITOR.config.jqueryOverrideVal == 'undefined'
|
||||
? true : CKEDITOR.config.jqueryOverrideVal;
|
||||
|
||||
var jQuery = window.jQuery;
|
||||
|
||||
if ( typeof jQuery == 'undefined' )
|
||||
return;
|
||||
|
||||
// jQuery object methods.
|
||||
jQuery.extend( jQuery.fn,
|
||||
/** @lends jQuery.fn */
|
||||
{
|
||||
/**
|
||||
* Return existing CKEditor instance for first matched element.
|
||||
* Allows to easily use internal API. Doesn't return jQuery object.
|
||||
*
|
||||
* Raised exception if editor doesn't exist or isn't ready yet.
|
||||
*
|
||||
* @name jQuery.ckeditorGet
|
||||
* @return CKEDITOR.editor
|
||||
* @see CKEDITOR.editor
|
||||
*/
|
||||
ckeditorGet: function()
|
||||
{
|
||||
var instance = this.eq( 0 ).data( 'ckeditorInstance' );
|
||||
if ( !instance )
|
||||
throw "CKEditor not yet initialized, use ckeditor() with callback.";
|
||||
return instance;
|
||||
},
|
||||
/**
|
||||
* Triggers creation of CKEditor in all matched elements (reduced to DIV, P and TEXTAREAs).
|
||||
* Binds callback to instanceReady event of all instances. If editor is already created, than
|
||||
* callback is fired right away.
|
||||
*
|
||||
* Mixed parameter order allowed.
|
||||
*
|
||||
* @param callback Function to be run on editor instance. Passed parameters: [ textarea ].
|
||||
* Callback is fiered in "this" scope being ckeditor instance and having source textarea as first param.
|
||||
*
|
||||
* @param config Configuration options for new instance(s) if not already created.
|
||||
* See URL
|
||||
*
|
||||
* @example
|
||||
* $( 'textarea' ).ckeditor( function( textarea ) {
|
||||
* $( textarea ).val( this.getData() )
|
||||
* } );
|
||||
*
|
||||
* @name jQuery.fn.ckeditor
|
||||
* @return jQuery.fn
|
||||
*/
|
||||
ckeditor: function( callback, config )
|
||||
{
|
||||
if ( !CKEDITOR.env.isCompatible )
|
||||
return this;
|
||||
|
||||
if ( !jQuery.isFunction( callback ))
|
||||
{
|
||||
var tmp = config;
|
||||
config = callback;
|
||||
callback = tmp;
|
||||
}
|
||||
config = config || {};
|
||||
|
||||
this.filter( 'textarea, div, p' ).each( function()
|
||||
{
|
||||
var $element = jQuery( this ),
|
||||
editor = $element.data( 'ckeditorInstance' ),
|
||||
instanceLock = $element.data( '_ckeditorInstanceLock' ),
|
||||
element = this;
|
||||
|
||||
if ( editor && !instanceLock )
|
||||
{
|
||||
if ( callback )
|
||||
callback.apply( editor, [ this ] );
|
||||
}
|
||||
else if ( !instanceLock )
|
||||
{
|
||||
// CREATE NEW INSTANCE
|
||||
|
||||
// Handle config.autoUpdateElement inside this plugin if desired.
|
||||
if ( config.autoUpdateElement
|
||||
|| ( typeof config.autoUpdateElement == 'undefined' && CKEDITOR.config.autoUpdateElement ) )
|
||||
{
|
||||
config.autoUpdateElementJquery = true;
|
||||
}
|
||||
|
||||
// Always disable config.autoUpdateElement.
|
||||
config.autoUpdateElement = false;
|
||||
$element.data( '_ckeditorInstanceLock', true );
|
||||
|
||||
// Set instance reference in element's data.
|
||||
editor = CKEDITOR.replace( element, config );
|
||||
$element.data( 'ckeditorInstance', editor );
|
||||
|
||||
// Register callback.
|
||||
editor.on( 'instanceReady', function( event )
|
||||
{
|
||||
var editor = event.editor;
|
||||
setTimeout( function()
|
||||
{
|
||||
// Delay bit more if editor is still not ready.
|
||||
if ( !editor.element )
|
||||
{
|
||||
setTimeout( arguments.callee, 100 );
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove this listener.
|
||||
event.removeListener( 'instanceReady', this.callee );
|
||||
|
||||
// Forward setData on dataReady.
|
||||
editor.on( 'dataReady', function()
|
||||
{
|
||||
$element.trigger( 'setData' + '.ckeditor', [ editor ] );
|
||||
});
|
||||
|
||||
// Forward getData.
|
||||
editor.on( 'getData', function( event ) {
|
||||
$element.trigger( 'getData' + '.ckeditor', [ editor, event.data ] );
|
||||
}, 999 );
|
||||
|
||||
// Forward destroy event.
|
||||
editor.on( 'destroy', function()
|
||||
{
|
||||
$element.trigger( 'destroy.ckeditor', [ editor ] );
|
||||
});
|
||||
|
||||
// Integrate with form submit.
|
||||
if ( editor.config.autoUpdateElementJquery && $element.is( 'textarea' ) && $element.parents( 'form' ).length )
|
||||
{
|
||||
var onSubmit = function()
|
||||
{
|
||||
$element.ckeditor( function()
|
||||
{
|
||||
editor.updateElement();
|
||||
});
|
||||
};
|
||||
|
||||
// Bind to submit event.
|
||||
$element.parents( 'form' ).submit( onSubmit );
|
||||
|
||||
// Bind to form-pre-serialize from jQuery Forms plugin.
|
||||
$element.parents( 'form' ).bind( 'form-pre-serialize', onSubmit );
|
||||
|
||||
// Unbind when editor destroyed.
|
||||
$element.bind( 'destroy.ckeditor', function()
|
||||
{
|
||||
$element.parents( 'form' ).unbind( 'submit', onSubmit );
|
||||
$element.parents( 'form' ).unbind( 'form-pre-serialize', onSubmit );
|
||||
});
|
||||
}
|
||||
|
||||
// Garbage collect on destroy.
|
||||
editor.on( 'destroy', function()
|
||||
{
|
||||
$element.data( 'ckeditorInstance', null );
|
||||
});
|
||||
|
||||
// Remove lock.
|
||||
$element.data( '_ckeditorInstanceLock', null );
|
||||
|
||||
// Fire instanceReady event.
|
||||
$element.trigger( 'instanceReady.ckeditor', [ editor ] );
|
||||
|
||||
// Run given (first) code.
|
||||
if ( callback )
|
||||
callback.apply( editor, [ element ] );
|
||||
}, 0 );
|
||||
}, null, null, 9999);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Editor is already during creation process, bind our code to the event.
|
||||
CKEDITOR.on( 'instanceReady', function( event )
|
||||
{
|
||||
var editor = event.editor;
|
||||
setTimeout( function()
|
||||
{
|
||||
// Delay bit more if editor is still not ready.
|
||||
if ( !editor.element )
|
||||
{
|
||||
setTimeout( arguments.callee, 100 );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( editor.element.$ == element )
|
||||
{
|
||||
// Run given code.
|
||||
if ( callback )
|
||||
callback.apply( editor, [ element ] );
|
||||
}
|
||||
}, 0 );
|
||||
}, null, null, 9999);
|
||||
}
|
||||
});
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
// New val() method for objects.
|
||||
if ( CKEDITOR.config.jqueryOverrideVal )
|
||||
{
|
||||
jQuery.fn.val = CKEDITOR.tools.override( jQuery.fn.val, function( oldValMethod )
|
||||
{
|
||||
/**
|
||||
* CKEditor-aware val() method.
|
||||
*
|
||||
* Acts same as original jQuery val(), but for textareas which have CKEditor instances binded to them, method
|
||||
* returns editor's content. It also works for settings values.
|
||||
*
|
||||
* @param oldValMethod
|
||||
* @name jQuery.fn.val
|
||||
*/
|
||||
return function( newValue, forceNative )
|
||||
{
|
||||
var isSetter = typeof newValue != 'undefined',
|
||||
result;
|
||||
|
||||
this.each( function()
|
||||
{
|
||||
var $this = jQuery( this ),
|
||||
editor = $this.data( 'ckeditorInstance' );
|
||||
|
||||
if ( !forceNative && $this.is( 'textarea' ) && editor )
|
||||
{
|
||||
if ( isSetter )
|
||||
editor.setData( newValue );
|
||||
else
|
||||
{
|
||||
result = editor.getData();
|
||||
// break;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( isSetter )
|
||||
oldValMethod.call( $this, newValue );
|
||||
else
|
||||
{
|
||||
result = oldValMethod.call( $this );
|
||||
// break;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
return isSetter ? this : result;
|
||||
};
|
||||
});
|
||||
}
|
||||
})();
|
|
@ -1,87 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview API initialization code.
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
// Disable HC detaction in WebKit. (#5429)
|
||||
if ( CKEDITOR.env.webkit )
|
||||
{
|
||||
CKEDITOR.env.hc = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Check whether high contrast is active by creating a colored border.
|
||||
var hcDetect = CKEDITOR.dom.element.createFromHtml(
|
||||
'<div style="width:0px;height:0px;position:absolute;left:-10000px;' +
|
||||
'border: 1px solid;border-color: red blue;"></div>', CKEDITOR.document );
|
||||
|
||||
hcDetect.appendTo( CKEDITOR.document.getHead() );
|
||||
|
||||
// Update CKEDITOR.env.
|
||||
// Catch exception needed sometimes for FF. (#4230)
|
||||
try
|
||||
{
|
||||
CKEDITOR.env.hc = hcDetect.getComputedStyle( 'border-top-color' ) == hcDetect.getComputedStyle( 'border-right-color' );
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
CKEDITOR.env.hc = false;
|
||||
}
|
||||
|
||||
if ( CKEDITOR.env.hc )
|
||||
CKEDITOR.env.cssClass += ' cke_hc';
|
||||
|
||||
hcDetect.remove();
|
||||
})();
|
||||
|
||||
// Load core plugins.
|
||||
CKEDITOR.plugins.load( CKEDITOR.config.corePlugins.split( ',' ), function()
|
||||
{
|
||||
CKEDITOR.status = 'loaded';
|
||||
CKEDITOR.fire( 'loaded' );
|
||||
|
||||
// Process all instances created by the "basic" implementation.
|
||||
var pending = CKEDITOR._.pending;
|
||||
if ( pending )
|
||||
{
|
||||
delete CKEDITOR._.pending;
|
||||
|
||||
for ( var i = 0 ; i < pending.length ; i++ )
|
||||
CKEDITOR.add( pending[ i ] );
|
||||
}
|
||||
});
|
||||
|
||||
// Needed for IE6 to not request image (HTTP 200 or 304) for every CSS background. (#6187)
|
||||
if ( CKEDITOR.env.ie )
|
||||
{
|
||||
// Remove IE mouse flickering on IE6 because of background images.
|
||||
try
|
||||
{
|
||||
document.execCommand( 'BackgroundImageCache', false, true );
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
// We have been reported about loading problems caused by the above
|
||||
// line. For safety, let's just ignore errors.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on a High Contrast environment.
|
||||
* @name CKEDITOR.env.hc
|
||||
* @example
|
||||
* if ( CKEDITOR.env.hc )
|
||||
* alert( 'You're running on High Contrast mode. The editor interface will get adapted to provide you a better experience.' );
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired when a CKEDITOR core object is fully loaded and ready for interaction.
|
||||
* @name CKEDITOR#loaded
|
||||
* @event
|
||||
*/
|
|
@ -1,141 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Contains the third and last part of the {@link CKEDITOR} object
|
||||
* definition.
|
||||
*/
|
||||
|
||||
// Remove the CKEDITOR.loadFullCore reference defined on ckeditor_basic.
|
||||
delete CKEDITOR.loadFullCore;
|
||||
|
||||
/**
|
||||
* Holds references to all editor instances created. The name of the properties
|
||||
* in this object correspond to instance names, and their values contains the
|
||||
* {@link CKEDITOR.editor} object representing them.
|
||||
* @type {Object}
|
||||
* @example
|
||||
* alert( <b>CKEDITOR.instances</b>.editor1.name ); // "editor1"
|
||||
*/
|
||||
CKEDITOR.instances = {};
|
||||
|
||||
/**
|
||||
* The document of the window holding the CKEDITOR object.
|
||||
* @type {CKEDITOR.dom.document}
|
||||
* @example
|
||||
* alert( <b>CKEDITOR.document</b>.getBody().getName() ); // "body"
|
||||
*/
|
||||
CKEDITOR.document = new CKEDITOR.dom.document( document );
|
||||
|
||||
/**
|
||||
* Adds an editor instance to the global {@link CKEDITOR} object. This function
|
||||
* is available for internal use mainly.
|
||||
* @param {CKEDITOR.editor} editor The editor instance to be added.
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.add = function( editor )
|
||||
{
|
||||
CKEDITOR.instances[ editor.name ] = editor;
|
||||
|
||||
editor.on( 'focus', function()
|
||||
{
|
||||
if ( CKEDITOR.currentInstance != editor )
|
||||
{
|
||||
CKEDITOR.currentInstance = editor;
|
||||
CKEDITOR.fire( 'currentInstance' );
|
||||
}
|
||||
});
|
||||
|
||||
editor.on( 'blur', function()
|
||||
{
|
||||
if ( CKEDITOR.currentInstance == editor )
|
||||
{
|
||||
CKEDITOR.currentInstance = null;
|
||||
CKEDITOR.fire( 'currentInstance' );
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes an editor instance from the global {@link CKEDITOR} object. This function
|
||||
* is available for internal use only. External code must use {@link CKEDITOR.editor.prototype.destroy}
|
||||
* to avoid memory leaks.
|
||||
* @param {CKEDITOR.editor} editor The editor instance to be removed.
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.remove = function( editor )
|
||||
{
|
||||
delete CKEDITOR.instances[ editor.name ];
|
||||
};
|
||||
|
||||
/**
|
||||
* Perform global clean up to free as much memory as possible
|
||||
* when there are no instances left
|
||||
*/
|
||||
CKEDITOR.on( 'instanceDestroyed', function ()
|
||||
{
|
||||
if ( CKEDITOR.tools.isEmpty( this.instances ) )
|
||||
CKEDITOR.fire( 'reset' );
|
||||
});
|
||||
|
||||
// Load the bootstrap script.
|
||||
CKEDITOR.loader.load( 'core/_bootstrap' ); // @Packager.RemoveLine
|
||||
|
||||
// Tri-state constants.
|
||||
|
||||
/**
|
||||
* Used to indicate the ON or ACTIVE state.
|
||||
* @constant
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.TRISTATE_ON = 1;
|
||||
|
||||
/**
|
||||
* Used to indicate the OFF or NON ACTIVE state.
|
||||
* @constant
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.TRISTATE_OFF = 2;
|
||||
|
||||
/**
|
||||
* Used to indicate DISABLED state.
|
||||
* @constant
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.TRISTATE_DISABLED = 0;
|
||||
|
||||
/**
|
||||
* The editor which is currently active (have user focus).
|
||||
* @name CKEDITOR.currentInstance
|
||||
* @type CKEDITOR.editor
|
||||
* @see CKEDITOR#currentInstance
|
||||
* @example
|
||||
* function showCurrentEditorName()
|
||||
* {
|
||||
* if ( CKEDITOR.currentInstance )
|
||||
* alert( CKEDITOR.currentInstance.name );
|
||||
* else
|
||||
* alert( 'Please focus an editor first.' );
|
||||
* }
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired when the CKEDITOR.currentInstance object reference changes. This may
|
||||
* happen when setting the focus on different editor instances in the page.
|
||||
* @name CKEDITOR#currentInstance
|
||||
* @event
|
||||
* var editor; // Variable to hold a reference to the current editor.
|
||||
* CKEDITOR.on( 'currentInstance' , function( e )
|
||||
* {
|
||||
* editor = CKEDITOR.currentInstance;
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired when the last instance has been destroyed. This event is used to perform
|
||||
* global memory clean up.
|
||||
* @name CKEDITOR#reset
|
||||
* @event
|
||||
*/
|
|
@ -1,218 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, 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.5.3',rev:'6655',_:{},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 )
|
||||
{
|
||||
/**
|
||||
* @name CKEDITOR
|
||||
* @namespace This is the API entry point. The entire CKEditor code runs under this object.
|
||||
* @example
|
||||
*/
|
||||
window.CKEDITOR = (function()
|
||||
{
|
||||
var CKEDITOR =
|
||||
/** @lends CKEDITOR */
|
||||
{
|
||||
|
||||
/**
|
||||
* A constant string unique for each release of CKEditor. Its value
|
||||
* is used, by default, to build the URL for all resources loaded
|
||||
* by the editor code, guaranteeing clean cache results when
|
||||
* upgrading.
|
||||
* @type String
|
||||
* @example
|
||||
* alert( CKEDITOR.timestamp ); // e.g. '87dm'
|
||||
*/
|
||||
// The production implementation contains a fixed timestamp, unique
|
||||
// for each release and generated by the releaser.
|
||||
// (Base 36 value of each component of YYMMDDHH - 4 chars total - e.g. 87bm == 08071122)
|
||||
timestamp : 'B37D54V',
|
||||
|
||||
/**
|
||||
* Contains the CKEditor version number.
|
||||
* @type String
|
||||
* @example
|
||||
* alert( CKEDITOR.version ); // e.g. 'CKEditor 3.4.1'
|
||||
*/
|
||||
version : '3.5.3',
|
||||
|
||||
/**
|
||||
* Contains the CKEditor revision number.
|
||||
* The revision number is incremented automatically, following each
|
||||
* modification to the CKEditor source code.
|
||||
* @type String
|
||||
* @example
|
||||
* alert( CKEDITOR.revision ); // e.g. '3975'
|
||||
*/
|
||||
revision : '6655',
|
||||
|
||||
/**
|
||||
* Private object used to hold core stuff. It should not be used outside of
|
||||
* the API code as properties defined here may change at any time
|
||||
* without notice.
|
||||
* @private
|
||||
*/
|
||||
_ : {},
|
||||
|
||||
/**
|
||||
* Indicates the API loading status. The following statuses are available:
|
||||
* <ul>
|
||||
* <li><b>unloaded</b>: the API is not yet loaded.</li>
|
||||
* <li><b>basic_loaded</b>: the basic API features are available.</li>
|
||||
* <li><b>basic_ready</b>: the basic API is ready to load the full core code.</li>
|
||||
* <li><b>loading</b>: the full API is being loaded.</li>
|
||||
* <li><b>loaded</b>: the API can be fully used.</li>
|
||||
* </ul>
|
||||
* @type String
|
||||
* @example
|
||||
* if ( <b>CKEDITOR.status</b> == 'loaded' )
|
||||
* {
|
||||
* // The API can now be fully used.
|
||||
* }
|
||||
*/
|
||||
status : 'unloaded',
|
||||
|
||||
/**
|
||||
* Contains the full URL for the CKEditor installation directory.
|
||||
* It is possible to manually provide the base path by setting a
|
||||
* global variable named CKEDITOR_BASEPATH. This global variable
|
||||
* must be set <strong>before</strong> the editor script loading.
|
||||
* @type String
|
||||
* @example
|
||||
* alert( <b>CKEDITOR.basePath</b> ); // "http://www.example.com/ckeditor/" (e.g.)
|
||||
*/
|
||||
basePath : (function()
|
||||
{
|
||||
// ATTENTION: fixes to this code must be ported to
|
||||
// var basePath in "core/loader.js".
|
||||
|
||||
// Find out the editor directory path, based on its <script> tag.
|
||||
var path = window.CKEDITOR_BASEPATH || '';
|
||||
|
||||
if ( !path )
|
||||
{
|
||||
var scripts = document.getElementsByTagName( 'script' );
|
||||
|
||||
for ( var i = 0 ; i < scripts.length ; i++ )
|
||||
{
|
||||
var match = scripts[i].src.match( /(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i );
|
||||
|
||||
if ( match )
|
||||
{
|
||||
path = match[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// In IE (only) the script.src string is the raw value entered in the
|
||||
// HTML source. Other browsers return the full resolved URL instead.
|
||||
if ( path.indexOf(':/') == -1 )
|
||||
{
|
||||
// Absolute path.
|
||||
if ( path.indexOf( '/' ) === 0 )
|
||||
path = location.href.match( /^.*?:\/\/[^\/]*/ )[0] + path;
|
||||
// Relative path.
|
||||
else
|
||||
path = location.href.match( /^[^\?]*\/(?:)/ )[0] + path;
|
||||
}
|
||||
|
||||
if ( !path )
|
||||
throw 'The CKEditor installation path could not be automatically detected. Please set the global variable "CKEDITOR_BASEPATH" before creating editor instances.';
|
||||
|
||||
return path;
|
||||
})(),
|
||||
|
||||
/**
|
||||
* Gets the full URL for CKEditor resources. By default, URLs
|
||||
* returned by this function contain a querystring parameter ("t")
|
||||
* set to the {@link CKEDITOR.timestamp} value.<br />
|
||||
* <br />
|
||||
* It is possible to provide a custom implementation of this
|
||||
* function by setting a global variable named CKEDITOR_GETURL.
|
||||
* This global variable must be set <strong>before</strong> the editor script
|
||||
* loading. If the custom implementation returns nothing (==null), the
|
||||
* default implementation is used.
|
||||
* @param {String} resource The resource whose full URL we want to get.
|
||||
* It may be a full, absolute, or relative URL.
|
||||
* @returns {String} The full URL.
|
||||
* @example
|
||||
* // e.g. http://www.example.com/ckeditor/skins/default/editor.css?t=87dm
|
||||
* alert( CKEDITOR.getUrl( 'skins/default/editor.css' ) );
|
||||
* @example
|
||||
* // e.g. http://www.example.com/skins/default/editor.css?t=87dm
|
||||
* alert( CKEDITOR.getUrl( '/skins/default/editor.css' ) );
|
||||
* @example
|
||||
* // e.g. http://www.somesite.com/skins/default/editor.css?t=87dm
|
||||
* alert( CKEDITOR.getUrl( 'http://www.somesite.com/skins/default/editor.css' ) );
|
||||
*/
|
||||
getUrl : function( resource )
|
||||
{
|
||||
// If this is not a full or absolute path.
|
||||
if ( resource.indexOf(':/') == -1 && resource.indexOf( '/' ) !== 0 )
|
||||
resource = this.basePath + resource;
|
||||
|
||||
// Add the timestamp, except for directories.
|
||||
if ( this.timestamp && resource.charAt( resource.length - 1 ) != '/' && !(/[&?]t=/).test( resource ) )
|
||||
resource += ( resource.indexOf( '?' ) >= 0 ? '&' : '?' ) + 't=' + this.timestamp;
|
||||
|
||||
return resource;
|
||||
}
|
||||
};
|
||||
|
||||
// Make it possible to override the getUrl function with a custom
|
||||
// implementation pointing to a global named CKEDITOR_GETURL.
|
||||
var newGetUrl = window.CKEDITOR_GETURL;
|
||||
if ( newGetUrl )
|
||||
{
|
||||
var originalGetUrl = CKEDITOR.getUrl;
|
||||
CKEDITOR.getUrl = function ( resource )
|
||||
{
|
||||
return newGetUrl.call( CKEDITOR, resource ) ||
|
||||
originalGetUrl.call( CKEDITOR, resource );
|
||||
};
|
||||
}
|
||||
|
||||
return CKEDITOR;
|
||||
})();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called upon loading a custom configuration file that can
|
||||
* modify the editor instance configuration ({@link CKEDITOR.editor#config }).
|
||||
* It is usually defined inside the custom configuration files that can
|
||||
* include developer defined settings.
|
||||
* @name CKEDITOR.editorConfig
|
||||
* @function
|
||||
* @param {CKEDITOR.config} config A configuration object containing the
|
||||
* settings defined for a {@link CKEDITOR.editor} instance up to this
|
||||
* function call. Note that not all settings may still be available. See
|
||||
* <a href="http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Setting_Configurations#Configuration_Loading_Order">Configuration Loading Order</a>
|
||||
* for details.
|
||||
* @example
|
||||
* // This is supposed to be placed in the config.js file.
|
||||
* CKEDITOR.editorConfig = function( config )
|
||||
* {
|
||||
* // Define changes to default configuration here. For example:
|
||||
* config.language = 'fr';
|
||||
* config.uiColor = '#AADC6E';
|
||||
* };
|
||||
*/
|
||||
|
||||
// PACKAGER_RENAME( CKEDITOR )
|
|
@ -1,238 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Contains the second part of the {@link CKEDITOR} object
|
||||
* definition, which defines the basic editor features to be available in
|
||||
* the root ckeditor_basic.js file.
|
||||
*/
|
||||
|
||||
if ( CKEDITOR.status == 'unloaded' )
|
||||
{
|
||||
(function()
|
||||
{
|
||||
CKEDITOR.event.implementOn( CKEDITOR );
|
||||
|
||||
/**
|
||||
* Forces the full CKEditor core code, in the case only the basic code has been
|
||||
* loaded (ckeditor_basic.js). This method self-destroys (becomes undefined) in
|
||||
* the first call or as soon as the full code is available.
|
||||
* @example
|
||||
* // Check if the full core code has been loaded and load it.
|
||||
* if ( CKEDITOR.loadFullCore )
|
||||
* <b>CKEDITOR.loadFullCore()</b>;
|
||||
*/
|
||||
CKEDITOR.loadFullCore = function()
|
||||
{
|
||||
// If not the basic code is not ready it, just mark it to be loaded.
|
||||
if ( CKEDITOR.status != 'basic_ready' )
|
||||
{
|
||||
CKEDITOR.loadFullCore._load = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
// Destroy this function.
|
||||
delete CKEDITOR.loadFullCore;
|
||||
|
||||
// Append the script to the head.
|
||||
var script = document.createElement( 'script' );
|
||||
script.type = 'text/javascript';
|
||||
script.src = CKEDITOR.basePath + 'ckeditor.js';
|
||||
|
||||
document.getElementsByTagName( 'head' )[0].appendChild( script );
|
||||
};
|
||||
|
||||
/**
|
||||
* The time to wait (in seconds) to load the full editor code after the
|
||||
* page load, if the "ckeditor_basic" file is used. If set to zero, the
|
||||
* editor is loaded on demand, as soon as an instance is created.
|
||||
*
|
||||
* This value must be set on the page before the page load completion.
|
||||
* @type Number
|
||||
* @default 0 (zero)
|
||||
* @example
|
||||
* // Loads the full source after five seconds.
|
||||
* CKEDITOR.loadFullCoreTimeout = 5;
|
||||
*/
|
||||
CKEDITOR.loadFullCoreTimeout = 0;
|
||||
|
||||
/**
|
||||
* The class name used to identify <textarea> elements to be replace
|
||||
* by CKEditor instances.
|
||||
* @type String
|
||||
* @default 'ckeditor'
|
||||
* @example
|
||||
* <b>CKEDITOR.replaceClass</b> = 'rich_editor';
|
||||
*/
|
||||
CKEDITOR.replaceClass = 'ckeditor';
|
||||
|
||||
/**
|
||||
* Enables the replacement of all textareas with class name matching
|
||||
* {@link CKEDITOR.replaceClass}.
|
||||
* @type Boolean
|
||||
* @default true
|
||||
* @example
|
||||
* // Disable the auto-replace feature.
|
||||
* <b>CKEDITOR.replaceByClassEnabled</b> = false;
|
||||
*/
|
||||
CKEDITOR.replaceByClassEnabled = 1;
|
||||
|
||||
var createInstance = function( elementOrIdOrName, config, creationFunction, data )
|
||||
{
|
||||
if ( CKEDITOR.env.isCompatible )
|
||||
{
|
||||
// Load the full core.
|
||||
if ( CKEDITOR.loadFullCore )
|
||||
CKEDITOR.loadFullCore();
|
||||
|
||||
var editor = creationFunction( elementOrIdOrName, config, data );
|
||||
CKEDITOR.add( editor );
|
||||
return editor;
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Replaces a <textarea> or a DOM element (DIV) with a CKEditor
|
||||
* instance. For textareas, the initial value in the editor will be the
|
||||
* textarea value. For DOM elements, their innerHTML will be used
|
||||
* instead. We recommend using TEXTAREA and DIV elements only.
|
||||
* @param {Object|String} elementOrIdOrName The DOM element (textarea), its
|
||||
* ID or name.
|
||||
* @param {Object} [config] The specific configurations to apply to this
|
||||
* editor instance. Configurations set here will override global CKEditor
|
||||
* settings.
|
||||
* @returns {CKEDITOR.editor} The editor instance created.
|
||||
* @example
|
||||
* <textarea id="myfield" name="myfield"><:/textarea>
|
||||
* ...
|
||||
* <b>CKEDITOR.replace( 'myfield' )</b>;
|
||||
* @example
|
||||
* var textarea = document.body.appendChild( document.createElement( 'textarea' ) );
|
||||
* <b>CKEDITOR.replace( textarea )</b>;
|
||||
*/
|
||||
CKEDITOR.replace = function( elementOrIdOrName, config )
|
||||
{
|
||||
return createInstance( elementOrIdOrName, config, CKEDITOR.editor.replace );
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a new editor instance inside a specific DOM element.
|
||||
* @param {Object|String} elementOrId The DOM element or its ID.
|
||||
* @param {Object} [config] The specific configurations to apply to this
|
||||
* editor instance. Configurations set here will override global CKEditor
|
||||
* settings.
|
||||
* @param {String} [data] Since 3.3. Initial value for the instance.
|
||||
* @returns {CKEDITOR.editor} The editor instance created.
|
||||
* @example
|
||||
* <div id="editorSpace"><:/div>
|
||||
* ...
|
||||
* <b>CKEDITOR.appendTo( 'editorSpace' )</b>;
|
||||
*/
|
||||
CKEDITOR.appendTo = function( elementOrId, config, data )
|
||||
{
|
||||
return createInstance( elementOrId, config, CKEDITOR.editor.appendTo, data );
|
||||
};
|
||||
|
||||
// Documented at ckeditor.js.
|
||||
CKEDITOR.add = function( editor )
|
||||
{
|
||||
// For now, just put the editor in the pending list. It will be
|
||||
// processed as soon as the full code gets loaded.
|
||||
var pending = this._.pending || ( this._.pending = [] );
|
||||
pending.push( editor );
|
||||
};
|
||||
|
||||
/**
|
||||
* Replace all <textarea> elements available in the document with
|
||||
* editor instances.
|
||||
* @example
|
||||
* // Replace all <textarea> elements in the page.
|
||||
* CKEDITOR.replaceAll();
|
||||
* @example
|
||||
* // Replace all <textarea class="myClassName"> elements in the page.
|
||||
* CKEDITOR.replaceAll( 'myClassName' );
|
||||
* @example
|
||||
* // Selectively replace <textarea> elements, based on custom assertions.
|
||||
* CKEDITOR.replaceAll( function( textarea, config )
|
||||
* {
|
||||
* // Custom code to evaluate the replace, returning false
|
||||
* // if it must not be done.
|
||||
* // It also passes the "config" parameter, so the
|
||||
* // developer can customize the instance.
|
||||
* } );
|
||||
*/
|
||||
CKEDITOR.replaceAll = function()
|
||||
{
|
||||
var textareas = document.getElementsByTagName( 'textarea' );
|
||||
|
||||
for ( var i = 0 ; i < textareas.length ; i++ )
|
||||
{
|
||||
var config = null,
|
||||
textarea = textareas[i];
|
||||
|
||||
// The "name" and/or "id" attribute must exist.
|
||||
if ( !textarea.name && !textarea.id )
|
||||
continue;
|
||||
|
||||
if ( typeof arguments[0] == 'string' )
|
||||
{
|
||||
// The textarea class name could be passed as the function
|
||||
// parameter.
|
||||
|
||||
var classRegex = new RegExp( '(?:^|\\s)' + arguments[0] + '(?:$|\\s)' );
|
||||
|
||||
if ( !classRegex.test( textarea.className ) )
|
||||
continue;
|
||||
}
|
||||
else if ( typeof arguments[0] == 'function' )
|
||||
{
|
||||
// An assertion function could be passed as the function parameter.
|
||||
// It must explicitly return "false" to ignore a specific <textarea>.
|
||||
config = {};
|
||||
if ( arguments[0]( textarea, config ) === false )
|
||||
continue;
|
||||
}
|
||||
|
||||
this.replace( textarea, config );
|
||||
}
|
||||
};
|
||||
|
||||
(function()
|
||||
{
|
||||
var onload = function()
|
||||
{
|
||||
var loadFullCore = CKEDITOR.loadFullCore,
|
||||
loadFullCoreTimeout = CKEDITOR.loadFullCoreTimeout;
|
||||
|
||||
// Replace all textareas with the default class name.
|
||||
if ( CKEDITOR.replaceByClassEnabled )
|
||||
CKEDITOR.replaceAll( CKEDITOR.replaceClass );
|
||||
|
||||
CKEDITOR.status = 'basic_ready';
|
||||
|
||||
if ( loadFullCore && loadFullCore._load )
|
||||
loadFullCore();
|
||||
else if ( loadFullCoreTimeout )
|
||||
{
|
||||
setTimeout( function()
|
||||
{
|
||||
if ( CKEDITOR.loadFullCore )
|
||||
CKEDITOR.loadFullCore();
|
||||
}
|
||||
, loadFullCoreTimeout * 1000 );
|
||||
}
|
||||
};
|
||||
|
||||
if ( window.addEventListener )
|
||||
window.addEventListener( 'load', onload, false );
|
||||
else if ( window.attachEvent )
|
||||
window.attachEvent( 'onload', onload );
|
||||
})();
|
||||
|
||||
CKEDITOR.status = 'basic_loaded';
|
||||
})();
|
||||
}
|
|
@ -1,209 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates a command class instance.
|
||||
* @class Represents a command that can be executed on an editor instance.
|
||||
* @param {CKEDITOR.editor} editor The editor instance this command will be
|
||||
* related to.
|
||||
* @param {CKEDITOR.commandDefinition} commandDefinition The command
|
||||
* definition.
|
||||
* @augments CKEDITOR.event
|
||||
* @example
|
||||
* var command = new CKEDITOR.command( editor,
|
||||
* {
|
||||
* exec : function( editor )
|
||||
* {
|
||||
* alert( editor.document.getBody().getHtml() );
|
||||
* }
|
||||
* });
|
||||
*/
|
||||
CKEDITOR.command = function( editor, commandDefinition )
|
||||
{
|
||||
/**
|
||||
* Lists UI items that are associated to this command. This list can be
|
||||
* used to interact with the UI on command execution (by the execution code
|
||||
* itself, for example).
|
||||
* @type Array
|
||||
* @example
|
||||
* alert( 'Number of UI items associated to this command: ' + command.<b>uiItems</b>.length );
|
||||
*/
|
||||
this.uiItems = [];
|
||||
|
||||
/**
|
||||
* Executes the command.
|
||||
* @param {Object} [data] Any data to pass to the command. Depends on the
|
||||
* command implementation and requirements.
|
||||
* @returns {Boolean} A boolean indicating that the command has been
|
||||
* successfully executed.
|
||||
* @example
|
||||
* command.<b>exec()</b>; // The command gets executed.
|
||||
*/
|
||||
this.exec = function( data )
|
||||
{
|
||||
if ( this.state == CKEDITOR.TRISTATE_DISABLED )
|
||||
return false;
|
||||
|
||||
if ( this.editorFocus ) // Give editor focus if necessary (#4355).
|
||||
editor.focus();
|
||||
|
||||
return ( commandDefinition.exec.call( this, editor, data ) !== false );
|
||||
};
|
||||
|
||||
CKEDITOR.tools.extend( this, commandDefinition,
|
||||
// Defaults
|
||||
/** @lends CKEDITOR.command.prototype */
|
||||
{
|
||||
/**
|
||||
* The editor modes within which the command can be executed. The
|
||||
* execution will have no action if the current mode is not listed
|
||||
* in this property.
|
||||
* @type Object
|
||||
* @default { wysiwyg : 1 }
|
||||
* @see CKEDITOR.editor.prototype.mode
|
||||
* @example
|
||||
* // Enable the command in both WYSIWYG and Source modes.
|
||||
* command.<b>modes</b> = { wysiwyg : 1, source : 1 };
|
||||
* @example
|
||||
* // Enable the command in Source mode only.
|
||||
* command.<b>modes</b> = { source : 1 };
|
||||
*/
|
||||
modes : { wysiwyg : 1 },
|
||||
|
||||
/**
|
||||
* Indicates that the editor will get the focus before executing
|
||||
* the command.
|
||||
* @type Boolean
|
||||
* @default true
|
||||
* @example
|
||||
* // Do not force the editor to have focus when executing the command.
|
||||
* command.<b>editorFocus</b> = false;
|
||||
*/
|
||||
editorFocus : 1,
|
||||
|
||||
/**
|
||||
* Indicates the editor state. Possible values are:
|
||||
* <ul>
|
||||
* <li>{@link CKEDITOR.TRISTATE_DISABLED}: the command is
|
||||
* disabled. It's execution will have no effect. Same as
|
||||
* {@link disable}.</li>
|
||||
* <li>{@link CKEDITOR.TRISTATE_ON}: the command is enabled
|
||||
* and currently active in the editor (for context sensitive commands,
|
||||
* for example).</li>
|
||||
* <li>{@link CKEDITOR.TRISTATE_OFF}: the command is enabled
|
||||
* and currently inactive in the editor (for context sensitive
|
||||
* commands, for example).</li>
|
||||
* </ul>
|
||||
* Do not set this property directly, using the {@link #setState}
|
||||
* method instead.
|
||||
* @type Number
|
||||
* @default {@link CKEDITOR.TRISTATE_OFF}
|
||||
* @example
|
||||
* if ( command.<b>state</b> == CKEDITOR.TRISTATE_DISABLED )
|
||||
* alert( 'This command is disabled' );
|
||||
*/
|
||||
state : CKEDITOR.TRISTATE_OFF
|
||||
});
|
||||
|
||||
// Call the CKEDITOR.event constructor to initialize this instance.
|
||||
CKEDITOR.event.call( this );
|
||||
};
|
||||
|
||||
CKEDITOR.command.prototype =
|
||||
{
|
||||
/**
|
||||
* Enables the command for execution. The command state (see
|
||||
* {@link CKEDITOR.command.prototype.state}) available before disabling it
|
||||
* is restored.
|
||||
* @example
|
||||
* command.<b>enable()</b>;
|
||||
* command.exec(); // Execute the command.
|
||||
*/
|
||||
enable : function()
|
||||
{
|
||||
if ( this.state == CKEDITOR.TRISTATE_DISABLED )
|
||||
this.setState( ( !this.preserveState || ( typeof this.previousState == 'undefined' ) ) ? CKEDITOR.TRISTATE_OFF : this.previousState );
|
||||
},
|
||||
|
||||
/**
|
||||
* Disables the command for execution. The command state (see
|
||||
* {@link CKEDITOR.command.prototype.state}) will be set to
|
||||
* {@link CKEDITOR.TRISTATE_DISABLED}.
|
||||
* @example
|
||||
* command.<b>disable()</b>;
|
||||
* command.exec(); // "false" - Nothing happens.
|
||||
*/
|
||||
disable : function()
|
||||
{
|
||||
this.setState( CKEDITOR.TRISTATE_DISABLED );
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the command state.
|
||||
* @param {Number} newState The new state. See {@link #state}.
|
||||
* @returns {Boolean} Returns "true" if the command state changed.
|
||||
* @example
|
||||
* command.<b>setState( CKEDITOR.TRISTATE_ON )</b>;
|
||||
* command.exec(); // Execute the command.
|
||||
* command.<b>setState( CKEDITOR.TRISTATE_DISABLED )</b>;
|
||||
* command.exec(); // "false" - Nothing happens.
|
||||
* command.<b>setState( CKEDITOR.TRISTATE_OFF )</b>;
|
||||
* command.exec(); // Execute the command.
|
||||
*/
|
||||
setState : function( newState )
|
||||
{
|
||||
// Do nothing if there is no state change.
|
||||
if ( this.state == newState )
|
||||
return false;
|
||||
|
||||
this.previousState = this.state;
|
||||
|
||||
// Set the new state.
|
||||
this.state = newState;
|
||||
|
||||
// Fire the "state" event, so other parts of the code can react to the
|
||||
// change.
|
||||
this.fire( 'state' );
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Toggles the on/off (active/inactive) state of the command. This is
|
||||
* mainly used internally by context sensitive commands.
|
||||
* @example
|
||||
* command.<b>toggleState()</b>;
|
||||
*/
|
||||
toggleState : function()
|
||||
{
|
||||
if ( this.state == CKEDITOR.TRISTATE_OFF )
|
||||
this.setState( CKEDITOR.TRISTATE_ON );
|
||||
else if ( this.state == CKEDITOR.TRISTATE_ON )
|
||||
this.setState( CKEDITOR.TRISTATE_OFF );
|
||||
}
|
||||
};
|
||||
|
||||
CKEDITOR.event.implementOn( CKEDITOR.command.prototype, true );
|
||||
|
||||
/**
|
||||
* Indicates the previous command state.
|
||||
* @name CKEDITOR.command.prototype.previousState
|
||||
* @type Number
|
||||
* @see #state
|
||||
* @example
|
||||
* alert( command.<b>previousState</b> );
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired when the command state changes.
|
||||
* @name CKEDITOR.command#state
|
||||
* @event
|
||||
* @example
|
||||
* command.on( <b>'state'</b> , function( e )
|
||||
* {
|
||||
* // Alerts the new state.
|
||||
* alert( this.state );
|
||||
* });
|
||||
*/
|
|
@ -1,129 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the "virtual" {@link CKEDITOR.commandDefinition} class,
|
||||
* which contains the defintion of a command. This file is for
|
||||
* documentation purposes only.
|
||||
*/
|
||||
|
||||
/**
|
||||
* (Virtual Class) Do not call this constructor. This class is not really part
|
||||
* of the API.
|
||||
* @name CKEDITOR.commandDefinition
|
||||
* @class Virtual class that illustrates the features of command objects to be
|
||||
* passed to the {@link CKEDITOR.editor.prototype.addCommand} function.
|
||||
* @example
|
||||
*/
|
||||
|
||||
/**
|
||||
* The function to be fired when the commend is executed.
|
||||
* @name CKEDITOR.commandDefinition.prototype.exec
|
||||
* @function
|
||||
* @param {CKEDITOR.editor} editor The editor within which run the command.
|
||||
* @param {Object} [data] Additional data to be used to execute the command.
|
||||
* @returns {Boolean} Whether the command has been successfully executed.
|
||||
* Defaults to "true", if nothing is returned.
|
||||
* @example
|
||||
* editorInstance.addCommand( 'sample',
|
||||
* {
|
||||
* exec : function( editor )
|
||||
* {
|
||||
* alert( 'Executing a command for the editor name "' + editor.name + '"!' );
|
||||
* }
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Whether the command need to be hooked into the redo/undo system.
|
||||
* @name CKEDITOR.commandDefinition.prototype.canUndo
|
||||
* @type {Boolean}
|
||||
* @default true
|
||||
* @field
|
||||
* @example
|
||||
* editorInstance.addCommand( 'alertName',
|
||||
* {
|
||||
* exec : function( editor )
|
||||
* {
|
||||
* alert( editor.name );
|
||||
* },
|
||||
* canUndo : false // No support for undo/redo
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Whether the command is asynchronous, which means that the
|
||||
* {@link CKEDITOR.editor#event:afterCommandExec} event will be fired by the
|
||||
* command itself manually, and that the return value of this command is not to
|
||||
* be returned by the {@link CKEDITOR.command#exec} function.
|
||||
* @name CKEDITOR.commandDefinition.prototype.async
|
||||
* @default false
|
||||
* @type {Boolean}
|
||||
* @example
|
||||
* editorInstance.addCommand( 'loadOptions',
|
||||
* {
|
||||
* exec : function( editor )
|
||||
* {
|
||||
* // Asynchronous operation below.
|
||||
* CKEDITOR.ajax.loadXml( 'data.xml', function()
|
||||
* {
|
||||
* editor.fire( 'afterCommandExec' );
|
||||
* ));
|
||||
* },
|
||||
* async : true // The command need some time to complete after exec function returns.
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Whether the command should give focus to the editor before execution.
|
||||
* @name CKEDITOR.commandDefinition.prototype.editorFocus
|
||||
* @type {Boolean}
|
||||
* @default true
|
||||
* @see CKEDITOR.command#editorFocus
|
||||
* @example
|
||||
* editorInstance.addCommand( 'maximize',
|
||||
* {
|
||||
* exec : function( editor )
|
||||
* {
|
||||
* // ...
|
||||
* },
|
||||
* editorFocus : false // The command doesn't require focusing the editing document.
|
||||
* });
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Whether the command state should be set to {@link CKEDITOR.TRISTATE_DISABLED} on startup.
|
||||
* @name CKEDITOR.commandDefinition.prototype.startDisabled
|
||||
* @type {Boolean}
|
||||
* @default false
|
||||
* @example
|
||||
* editorInstance.addCommand( 'unlink',
|
||||
* {
|
||||
* exec : function( editor )
|
||||
* {
|
||||
* // ...
|
||||
* },
|
||||
* startDisabled : true // Command is unavailable until selection is inside a link.
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* The editor modes within which the command can be executed. The execution
|
||||
* will have no action if the current mode is not listed in this property.
|
||||
* @name CKEDITOR.commandDefinition.prototype.modes
|
||||
* @type Object
|
||||
* @default { wysiwyg : 1 }
|
||||
* @see CKEDITOR.command#modes
|
||||
* @example
|
||||
* editorInstance.addCommand( 'link',
|
||||
* {
|
||||
* exec : function( editor )
|
||||
* {
|
||||
* // ...
|
||||
* },
|
||||
* modes : { wysiwyg : 1 } // Command is available in wysiwyg mode only.
|
||||
* });
|
||||
*/
|
|
@ -1,431 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Used in conjuction with {@link CKEDITOR.config.enterMode} and
|
||||
* {@link CKEDITOR.config.shiftEnterMode} to make the editor produce <p>
|
||||
* tags when using the ENTER key.
|
||||
* @constant
|
||||
*/
|
||||
CKEDITOR.ENTER_P = 1;
|
||||
|
||||
/**
|
||||
* Used in conjuction with {@link CKEDITOR.config.enterMode} and
|
||||
* {@link CKEDITOR.config.shiftEnterMode} to make the editor produce <br>
|
||||
* tags when using the ENTER key.
|
||||
* @constant
|
||||
*/
|
||||
CKEDITOR.ENTER_BR = 2;
|
||||
|
||||
/**
|
||||
* Used in conjuction with {@link CKEDITOR.config.enterMode} and
|
||||
* {@link CKEDITOR.config.shiftEnterMode} to make the editor produce <div>
|
||||
* tags when using the ENTER key.
|
||||
* @constant
|
||||
*/
|
||||
CKEDITOR.ENTER_DIV = 3;
|
||||
|
||||
/**
|
||||
* @namespace Holds the default configuration settings. Changes to this object are
|
||||
* reflected in all editor instances, if not specificaly specified for those
|
||||
* instances.
|
||||
*/
|
||||
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 '<CKEditor folder>/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 : '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)
|
||||
* @example
|
||||
* config.baseHref = 'http://www.example.com/path/';
|
||||
*/
|
||||
baseHref : '',
|
||||
|
||||
/**
|
||||
* The CSS file(s) 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|Array
|
||||
* @default '<CKEditor folder>/contents.css'
|
||||
* @example
|
||||
* config.contentsCss = '/css/mysitestyles.css';
|
||||
* config.contentsCss = ['/css/mysitestyles.css', '/css/anotherfile.css'];
|
||||
*/
|
||||
contentsCss : CKEDITOR.basePath + 'contents.css',
|
||||
|
||||
/**
|
||||
* The writting direction of the language used to write the editor
|
||||
* contents. Allowed values are:
|
||||
* <ul>
|
||||
* <li>'ui' - which indicate content direction will be the same with the user interface language direction;</li>
|
||||
* <li>'ltr' - for Left-To-Right language (like English);</li>
|
||||
* <li>'rtl' - for Right-To-Left languages (like Arabic).</li>
|
||||
* </ul>
|
||||
* @default 'ui'
|
||||
* @type String
|
||||
* @example
|
||||
* config.contentsLangDirection = 'rtl';
|
||||
*/
|
||||
contentsLangDirection : 'ui',
|
||||
|
||||
/**
|
||||
* Language code of the writting language which is used to author the editor
|
||||
* contents.
|
||||
* @default Same value with editor's UI language.
|
||||
* @type String
|
||||
* @example
|
||||
* config.contentsLanguage = 'fr';
|
||||
*/
|
||||
contentsLanguage : '',
|
||||
|
||||
/**
|
||||
* 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 '' (empty)
|
||||
* @type String
|
||||
* @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 <br> 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 <p> paragraphs are created;</li>
|
||||
* <li>{@link CKEDITOR.ENTER_BR} (2): lines are broken with <br> elements;</li>
|
||||
* <li>{@link CKEDITOR.ENTER_DIV} (3): new <div> 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,
|
||||
|
||||
/**
|
||||
* Force the respect of {@link CKEDITOR.config.enterMode} as line break regardless of the context,
|
||||
* E.g. If {@link CKEDITOR.config.enterMode} is set to {@link CKEDITOR.ENTER_P},
|
||||
* press enter key inside a 'div' will create a new paragraph with 'p' instead of 'div'.
|
||||
* @since 3.2.1
|
||||
* @default false
|
||||
* @example
|
||||
* // Not recommended.
|
||||
* config.forceEnterMode = true;
|
||||
*/
|
||||
forceEnterMode : false,
|
||||
|
||||
/**
|
||||
* 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 <p> paragraphs are created;</li>
|
||||
* <li>{@link CKEDITOR.ENTER_BR} (2): lines are broken with <br> elements;</li>
|
||||
* <li>{@link CKEDITOR.ENTER_DIV} (3): new <div> 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 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
|
||||
* @example
|
||||
* // Set the doctype to the HTML 4 (quirks) mode.
|
||||
* config.docType = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
|
||||
*/
|
||||
docType : '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
|
||||
|
||||
/**
|
||||
* Sets the "id" attribute to be used on the body element of the editing
|
||||
* area. This can be useful when reusing the original CSS file you're using
|
||||
* on your live website and you want to assing to the editor the same id
|
||||
* you're using for the region that'll hold the contents. In this way,
|
||||
* id specific CSS rules will be enabled.
|
||||
* @since 3.1
|
||||
* @type String
|
||||
* @default '' (empty)
|
||||
* @example
|
||||
* config.bodyId = 'contents_id';
|
||||
*/
|
||||
bodyId : '',
|
||||
|
||||
/**
|
||||
* Sets the "class" attribute to be used on the body element of the editing
|
||||
* area. This can be useful when reusing the original CSS file you're using
|
||||
* on your live website and you want to assing to the editor the same class
|
||||
* name you're using for the region that'll hold the contents. In this way,
|
||||
* class specific CSS rules will be enabled.
|
||||
* @since 3.1
|
||||
* @type String
|
||||
* @default '' (empty)
|
||||
* @example
|
||||
* config.bodyClass = 'contents';
|
||||
*/
|
||||
bodyClass : '',
|
||||
|
||||
/**
|
||||
* Indicates whether the contents to be edited are being inputted as a full
|
||||
* HTML page. A full page includes the <html>, <head> and
|
||||
* <body> tags. The final output will also reflect this setting,
|
||||
* including the <body> contents only if this setting is disabled.
|
||||
* @since 3.1
|
||||
* @type Boolean
|
||||
* @default false
|
||||
* @example
|
||||
* config.fullPage = true;
|
||||
*/
|
||||
fullPage : false,
|
||||
|
||||
/**
|
||||
* The height of editing area( content ), in relative or absolute, e.g. 30px, 5em.
|
||||
* Note: Percentage unit is not supported yet. e.g. 30%.
|
||||
* @type Number|String
|
||||
* @default '200'
|
||||
* @example
|
||||
* config.height = 500;
|
||||
* config.height = '25em';
|
||||
* config.height = '300px';
|
||||
*/
|
||||
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,' +
|
||||
'a11yhelp,' +
|
||||
'basicstyles,' +
|
||||
'bidi,' +
|
||||
'blockquote,' +
|
||||
'button,' +
|
||||
'clipboard,' +
|
||||
'colorbutton,' +
|
||||
'colordialog,' +
|
||||
'contextmenu,' +
|
||||
'dialogadvtab,' +
|
||||
'div,' +
|
||||
'elementspath,' +
|
||||
'enterkey,' +
|
||||
'entities,' +
|
||||
'filebrowser,' +
|
||||
'find,' +
|
||||
'flash,' +
|
||||
'font,' +
|
||||
'format,' +
|
||||
'forms,' +
|
||||
'horizontalrule,' +
|
||||
'htmldataprocessor,' +
|
||||
'iframe,' +
|
||||
'image,' +
|
||||
'indent,' +
|
||||
'justify,' +
|
||||
'keystrokes,' +
|
||||
'link,' +
|
||||
'list,' +
|
||||
'liststyle,' +
|
||||
'maximize,' +
|
||||
'newpage,' +
|
||||
'pagebreak,' +
|
||||
'pastefromword,' +
|
||||
'pastetext,' +
|
||||
'popup,' +
|
||||
'preview,' +
|
||||
'print,' +
|
||||
'removeformat,' +
|
||||
'resize,' +
|
||||
'save,' +
|
||||
'scayt,' +
|
||||
'smiley,' +
|
||||
'showblocks,' +
|
||||
'showborders,' +
|
||||
'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 HTML source code that matched must <strong>not</strong> present in WYSIWYG mode for editing.
|
||||
* @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
|
||||
};
|
||||
|
||||
/**
|
||||
* Indicates that some of the editor features, like alignment and text
|
||||
* direction, should used the "computed value" of the feature to indicate it's
|
||||
* on/off state, instead of using the "real value".<br />
|
||||
* <br />
|
||||
* If enabled, in a left to right written document, the "Left Justify"
|
||||
* alignment button will show as active, even if the aligment style is not
|
||||
* explicitly applied to the current paragraph in the editor.
|
||||
* @name CKEDITOR.config.useComputedState
|
||||
* @type Boolean
|
||||
* @default true
|
||||
* @since 3.4
|
||||
* @example
|
||||
* config.useComputedState = false;
|
||||
*/
|
||||
|
||||
// PACKAGER_RENAME( CKEDITOR.config )
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the "virtual" {@link CKEDITOR.dataProcessor} class, which
|
||||
* defines the basic structure of data processor objects to be
|
||||
* set to {@link CKEDITOR.editor.dataProcessor}.
|
||||
*/
|
||||
|
||||
/**
|
||||
* If defined, points to the data processor which is responsible to translate
|
||||
* and transform the editor data on input and output.
|
||||
* Generaly it will point to an instance of {@link CKEDITOR.htmlDataProcessor},
|
||||
* which handles HTML data. The editor may also handle other data formats by
|
||||
* using different data processors provided by specific plugins.
|
||||
* @name CKEDITOR.editor.prototype.dataProcessor
|
||||
* @type CKEDITOR.dataProcessor
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class is here for documentation purposes only and is not really part of
|
||||
* the API. It serves as the base ("interface") for data processors
|
||||
* implementation.
|
||||
* @name CKEDITOR.dataProcessor
|
||||
* @class Represents a data processor, which is responsible to translate and
|
||||
* transform the editor data on input and output.
|
||||
* @example
|
||||
*/
|
||||
|
||||
/**
|
||||
* Transforms input data into HTML to be loaded in the editor.
|
||||
* While the editor is able to handle non HTML data (like BBCode), at runtime
|
||||
* it can handle HTML data only. The role of the data processor is transforming
|
||||
* the input data into HTML through this function.
|
||||
* @name CKEDITOR.dataProcessor.prototype.toHtml
|
||||
* @function
|
||||
* @param {String} data The input data to be transformed.
|
||||
* @param {String} [fixForBody] The tag name to be used if the data must be
|
||||
* fixed because it is supposed to be loaded direcly into the <body>
|
||||
* tag. This is generally not used by non-HTML data processors.
|
||||
* @example
|
||||
* // Tranforming BBCode data, having a custom BBCode data processor.
|
||||
* var data = 'This is [b]an example[/b].';
|
||||
* var html = editor.dataProcessor.toHtml( data ); // '<p>This is <b>an example</b>.</p>'
|
||||
*/
|
||||
|
||||
/**
|
||||
* Transforms HTML into data to be outputted by the editor, in the format
|
||||
* expected by the data processor.
|
||||
* While the editor is able to handle non HTML data (like BBCode), at runtime
|
||||
* it can handle HTML data only. The role of the data processor is transforming
|
||||
* the HTML data containined by the editor into a specific data format through
|
||||
* this function.
|
||||
* @name CKEDITOR.dataProcessor.prototype.toDataFormat
|
||||
* @function
|
||||
* @param {String} html The HTML to be transformed.
|
||||
* @param {String} fixForBody The tag name to be used if the output data is
|
||||
* coming from <body> and may be eventually fixed for it. This is
|
||||
* generally not used by non-HTML data processors.
|
||||
* // Tranforming into BBCode data, having a custom BBCode data processor.
|
||||
* var html = '<p>This is <b>an example</b>.</p>';
|
||||
* var data = editor.dataProcessor.toDataFormat( html ); // 'This is [b]an example[/b].'
|
||||
*/
|
|
@ -1,20 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.dom} object, which contains DOM
|
||||
* manipulation objects and function.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @namespace DOM manipulation objects, classes and functions.
|
||||
* @see CKEDITOR.dom.element
|
||||
* @see CKEDITOR.dom.node
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.dom =
|
||||
{};
|
||||
|
||||
// PACKAGER_RENAME( CKEDITOR.dom )
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.dom.comment} class, which represents
|
||||
* a DOM comment node.
|
||||
*/
|
||||
|
||||
CKEDITOR.dom.comment = CKEDITOR.tools.createClass(
|
||||
{
|
||||
base : CKEDITOR.dom.node,
|
||||
|
||||
$ : function( text, ownerDocument )
|
||||
{
|
||||
if ( typeof text == 'string' )
|
||||
text = ( ownerDocument ? ownerDocument.$ : document ).createComment( text );
|
||||
|
||||
this.base( text );
|
||||
},
|
||||
|
||||
proto :
|
||||
{
|
||||
type : CKEDITOR.NODE_COMMENT,
|
||||
|
||||
getOuterHtml : function()
|
||||
{
|
||||
return '<!--' + this.$.nodeValue + '-->';
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,251 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.dom.document} class, which
|
||||
* represents a DOM document.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a DOM document.
|
||||
* @constructor
|
||||
* @augments CKEDITOR.dom.domObject
|
||||
* @param {Object} domDocument A native DOM document.
|
||||
* @example
|
||||
* var document = new CKEDITOR.dom.document( document );
|
||||
*/
|
||||
CKEDITOR.dom.document = function( domDocument )
|
||||
{
|
||||
CKEDITOR.dom.domObject.call( this, domDocument );
|
||||
};
|
||||
|
||||
// PACKAGER_RENAME( CKEDITOR.dom.document )
|
||||
|
||||
CKEDITOR.dom.document.prototype = new CKEDITOR.dom.domObject();
|
||||
|
||||
CKEDITOR.tools.extend( CKEDITOR.dom.document.prototype,
|
||||
/** @lends CKEDITOR.dom.document.prototype */
|
||||
{
|
||||
/**
|
||||
* Appends a CSS file to the document.
|
||||
* @param {String} cssFileUrl The CSS file URL.
|
||||
* @example
|
||||
* <b>CKEDITOR.document.appendStyleSheet( '/mystyles.css' )</b>;
|
||||
*/
|
||||
appendStyleSheet : function( cssFileUrl )
|
||||
{
|
||||
if ( this.$.createStyleSheet )
|
||||
this.$.createStyleSheet( cssFileUrl );
|
||||
else
|
||||
{
|
||||
var link = new CKEDITOR.dom.element( 'link' );
|
||||
link.setAttributes(
|
||||
{
|
||||
rel :'stylesheet',
|
||||
type : 'text/css',
|
||||
href : cssFileUrl
|
||||
});
|
||||
|
||||
this.getHead().append( link );
|
||||
}
|
||||
},
|
||||
|
||||
appendStyleText : function( cssStyleText )
|
||||
{
|
||||
if ( this.$.createStyleSheet )
|
||||
{
|
||||
var styleSheet = this.$.createStyleSheet( "" );
|
||||
styleSheet.cssText = cssStyleText ;
|
||||
}
|
||||
else
|
||||
{
|
||||
var style = new CKEDITOR.dom.element( 'style', this );
|
||||
style.append( new CKEDITOR.dom.text( cssStyleText, this ) );
|
||||
this.getHead().append( style );
|
||||
}
|
||||
},
|
||||
|
||||
createElement : function( name, attribsAndStyles )
|
||||
{
|
||||
var element = new CKEDITOR.dom.element( name, this );
|
||||
|
||||
if ( attribsAndStyles )
|
||||
{
|
||||
if ( attribsAndStyles.attributes )
|
||||
element.setAttributes( attribsAndStyles.attributes );
|
||||
|
||||
if ( attribsAndStyles.styles )
|
||||
element.setStyles( attribsAndStyles.styles );
|
||||
}
|
||||
|
||||
return element;
|
||||
},
|
||||
|
||||
createText : function( text )
|
||||
{
|
||||
return new CKEDITOR.dom.text( text, this );
|
||||
},
|
||||
|
||||
focus : function()
|
||||
{
|
||||
this.getWindow().focus();
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets and element based on its id.
|
||||
* @param {String} elementId The element id.
|
||||
* @returns {CKEDITOR.dom.element} The element instance, or null if not found.
|
||||
* @example
|
||||
* var element = <b>CKEDITOR.document.getById( 'myElement' )</b>;
|
||||
* alert( element.getId() ); // "myElement"
|
||||
*/
|
||||
getById : function( elementId )
|
||||
{
|
||||
var $ = this.$.getElementById( elementId );
|
||||
return $ ? new CKEDITOR.dom.element( $ ) : null;
|
||||
},
|
||||
|
||||
getByAddress : function( address, normalized )
|
||||
{
|
||||
var $ = this.$.documentElement;
|
||||
|
||||
for ( var i = 0 ; $ && i < address.length ; i++ )
|
||||
{
|
||||
var target = address[ i ];
|
||||
|
||||
if ( !normalized )
|
||||
{
|
||||
$ = $.childNodes[ target ];
|
||||
continue;
|
||||
}
|
||||
|
||||
var currentIndex = -1;
|
||||
|
||||
for (var j = 0 ; j < $.childNodes.length ; j++ )
|
||||
{
|
||||
var candidate = $.childNodes[ j ];
|
||||
|
||||
if ( normalized === true &&
|
||||
candidate.nodeType == 3 &&
|
||||
candidate.previousSibling &&
|
||||
candidate.previousSibling.nodeType == 3 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
currentIndex++;
|
||||
|
||||
if ( currentIndex == target )
|
||||
{
|
||||
$ = candidate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $ ? new CKEDITOR.dom.node( $ ) : null;
|
||||
},
|
||||
|
||||
getElementsByTag : function( tagName, namespace )
|
||||
{
|
||||
if ( !( CKEDITOR.env.ie && ! ( document.documentMode > 8 ) ) && namespace )
|
||||
tagName = namespace + ':' + tagName;
|
||||
return new CKEDITOR.dom.nodeList( this.$.getElementsByTagName( tagName ) );
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the <head> element for this document.
|
||||
* @returns {CKEDITOR.dom.element} The <head> element.
|
||||
* @example
|
||||
* var element = <b>CKEDITOR.document.getHead()</b>;
|
||||
* alert( element.getName() ); // "head"
|
||||
*/
|
||||
getHead : function()
|
||||
{
|
||||
var head = this.$.getElementsByTagName( 'head' )[0];
|
||||
if ( !head )
|
||||
head = this.getDocumentElement().append( new CKEDITOR.dom.element( 'head' ), true );
|
||||
else
|
||||
head = new CKEDITOR.dom.element( head );
|
||||
|
||||
return (
|
||||
this.getHead = function()
|
||||
{
|
||||
return head;
|
||||
})();
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the <body> element for this document.
|
||||
* @returns {CKEDITOR.dom.element} The <body> element.
|
||||
* @example
|
||||
* var element = <b>CKEDITOR.document.getBody()</b>;
|
||||
* alert( element.getName() ); // "body"
|
||||
*/
|
||||
getBody : function()
|
||||
{
|
||||
var body = new CKEDITOR.dom.element( this.$.body );
|
||||
|
||||
return (
|
||||
this.getBody = function()
|
||||
{
|
||||
return body;
|
||||
})();
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the DOM document element for this document.
|
||||
* @returns {CKEDITOR.dom.element} The DOM document element.
|
||||
*/
|
||||
getDocumentElement : function()
|
||||
{
|
||||
var documentElement = new CKEDITOR.dom.element( this.$.documentElement );
|
||||
|
||||
return (
|
||||
this.getDocumentElement = function()
|
||||
{
|
||||
return documentElement;
|
||||
})();
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the window object that holds this document.
|
||||
* @returns {CKEDITOR.dom.window} The window object.
|
||||
*/
|
||||
getWindow : function()
|
||||
{
|
||||
var win = new CKEDITOR.dom.window( this.$.parentWindow || this.$.defaultView );
|
||||
|
||||
return (
|
||||
this.getWindow = function()
|
||||
{
|
||||
return win;
|
||||
})();
|
||||
},
|
||||
|
||||
/**
|
||||
* Defines the document contents through document.write. Note that the
|
||||
* previous document contents will be lost (cleaned).
|
||||
* @since 3.5
|
||||
* @param {String} html The HTML defining the document contents.
|
||||
* @example
|
||||
* document.write(
|
||||
* '<html>' +
|
||||
* '<head><title>Sample Doc</title></head>' +
|
||||
* '<body>Document contents created by code</body>' +
|
||||
* '</html>' );
|
||||
*/
|
||||
write : function( html )
|
||||
{
|
||||
// Don't leave any history log in IE. (#5657)
|
||||
this.$.open( 'text/html', 'replace' );
|
||||
|
||||
// Support for custom document.domain in IE.
|
||||
CKEDITOR.env.isCustomDomain() && ( this.$.domain = document.domain );
|
||||
|
||||
this.$.write( html );
|
||||
this.$.close();
|
||||
}
|
||||
});
|
|
@ -1,49 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @class DocumentFragment is a "lightweight" or "minimal" Document object. It is
|
||||
* commonly used to extract a portion of a document's tree or to create a new
|
||||
* fragment of a document. Various operations may take DocumentFragment objects
|
||||
* as arguments and results in all the child nodes of the DocumentFragment being
|
||||
* moved to the child list of this node.
|
||||
* @param {Object} ownerDocument
|
||||
*/
|
||||
CKEDITOR.dom.documentFragment = function( ownerDocument )
|
||||
{
|
||||
ownerDocument = ownerDocument || CKEDITOR.document;
|
||||
this.$ = ownerDocument.$.createDocumentFragment();
|
||||
};
|
||||
|
||||
CKEDITOR.tools.extend( CKEDITOR.dom.documentFragment.prototype,
|
||||
CKEDITOR.dom.element.prototype,
|
||||
{
|
||||
type : CKEDITOR.NODE_DOCUMENT_FRAGMENT,
|
||||
insertAfterNode : function( node )
|
||||
{
|
||||
node = node.$;
|
||||
node.parentNode.insertBefore( this.$, node.nextSibling );
|
||||
}
|
||||
},
|
||||
true,
|
||||
{
|
||||
'append' : 1,
|
||||
'appendBogus' : 1,
|
||||
'getFirst' : 1,
|
||||
'getLast' : 1,
|
||||
'appendTo' : 1,
|
||||
'moveChildren' : 1,
|
||||
'insertBefore' : 1,
|
||||
'insertAfterNode' : 1,
|
||||
'replace' : 1,
|
||||
'trim' : 1,
|
||||
'type' : 1,
|
||||
'ltrim' : 1,
|
||||
'rtrim' : 1,
|
||||
'getDocument' : 1,
|
||||
'getChildCount' : 1,
|
||||
'getChild' : 1,
|
||||
'getChildren' : 1
|
||||
} );
|
|
@ -1,258 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, 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.$.attachEvent )
|
||||
this.$.attachEvent( 'on' + eventName, listener );
|
||||
else if ( this.$.addEventListener )
|
||||
this.$.addEventListener( eventName, listener, !!CKEDITOR.event.useCapture );
|
||||
}
|
||||
|
||||
// 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.$.detachEvent )
|
||||
this.$.detachEvent( 'on' + eventName, listener );
|
||||
else if ( this.$.removeEventListener )
|
||||
this.$.removeEventListener( eventName, listener, false );
|
||||
|
||||
delete nativeListeners[ eventName ];
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes any listener set on this object.
|
||||
* To avoid memory leaks we must assure that there are no
|
||||
* references left after the object is no longer needed.
|
||||
*/
|
||||
removeAllListeners : function()
|
||||
{
|
||||
var nativeListeners = this.getCustomData( '_cke_nativeListeners' );
|
||||
for ( var eventName in nativeListeners )
|
||||
{
|
||||
var listener = nativeListeners[ eventName ];
|
||||
if ( this.$.detachEvent )
|
||||
this.$.detachEvent( 'on' + eventName, listener );
|
||||
else if ( this.$.removeEventListener )
|
||||
this.$.removeEventListener( eventName, listener, false );
|
||||
|
||||
delete nativeListeners[ eventName ];
|
||||
}
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(function( domObjectProto )
|
||||
{
|
||||
var customData = {};
|
||||
|
||||
CKEDITOR.on( 'reset', function()
|
||||
{
|
||||
customData = {};
|
||||
});
|
||||
|
||||
/**
|
||||
* Determines whether the specified object is equal to the current object.
|
||||
* @name CKEDITOR.dom.domObject.prototype.equals
|
||||
* @function
|
||||
* @param {Object} object The object to compare with the current object.
|
||||
* @returns {Boolean} "true" if the object is equal.
|
||||
* @example
|
||||
* var doc = new CKEDITOR.dom.document( document );
|
||||
* alert( doc.equals( CKEDITOR.document ) ); // "true"
|
||||
* alert( doc == CKEDITOR.document ); // "false"
|
||||
*/
|
||||
domObjectProto.equals = function( object )
|
||||
{
|
||||
return ( object && object.$ === this.$ );
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets a data slot value for this object. These values are shared by all
|
||||
* instances pointing to that same DOM object.
|
||||
* <strong>Note:</strong> The created data slot is only guarantied to be available on this unique dom node,
|
||||
* thus any wish to continue access it from other element clones (either created by clone node or from innerHtml)
|
||||
* will fail, for such usage, please use {@link CKEDITOR.dom.element::setAttribute} instead.
|
||||
* @name CKEDITOR.dom.domObject.prototype.setCustomData
|
||||
* @function
|
||||
* @param {String} key A key used to identify the data slot.
|
||||
* @param {Object} value The value to set to the data slot.
|
||||
* @returns {CKEDITOR.dom.domObject} This DOM object instance.
|
||||
* @see CKEDITOR.dom.domObject.prototype.getCustomData
|
||||
* @example
|
||||
* var element = new CKEDITOR.dom.element( 'span' );
|
||||
* element.setCustomData( 'hasCustomData', true );
|
||||
*/
|
||||
domObjectProto.setCustomData = function( key, value )
|
||||
{
|
||||
var expandoNumber = this.getUniqueId(),
|
||||
dataSlot = customData[ expandoNumber ] || ( customData[ expandoNumber ] = {} );
|
||||
|
||||
dataSlot[ key ] = value;
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the value set to a data slot in this object.
|
||||
* @name CKEDITOR.dom.domObject.prototype.getCustomData
|
||||
* @function
|
||||
* @param {String} key The key used to identify the data slot.
|
||||
* @returns {Object} This value set to the data slot.
|
||||
* @see CKEDITOR.dom.domObject.prototype.setCustomData
|
||||
* @example
|
||||
* var element = new CKEDITOR.dom.element( 'span' );
|
||||
* alert( element.getCustomData( 'hasCustomData' ) ); // e.g. 'true'
|
||||
*/
|
||||
domObjectProto.getCustomData = function( key )
|
||||
{
|
||||
var expandoNumber = this.$[ 'data-cke-expando' ],
|
||||
dataSlot = expandoNumber && customData[ expandoNumber ];
|
||||
|
||||
return dataSlot && dataSlot[ key ];
|
||||
};
|
||||
|
||||
/**
|
||||
* @name CKEDITOR.dom.domObject.prototype.removeCustomData
|
||||
*/
|
||||
domObjectProto.removeCustomData = function( key )
|
||||
{
|
||||
var expandoNumber = this.$[ 'data-cke-expando' ],
|
||||
dataSlot = expandoNumber && customData[ expandoNumber ],
|
||||
retval = dataSlot && dataSlot[ key ];
|
||||
|
||||
if ( typeof retval != 'undefined' )
|
||||
delete dataSlot[ key ];
|
||||
|
||||
return retval || null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes any data stored on this object.
|
||||
* To avoid memory leaks we must assure that there are no
|
||||
* references left after the object is no longer needed.
|
||||
* @name CKEDITOR.dom.domObject.prototype.clearCustomData
|
||||
* @function
|
||||
*/
|
||||
domObjectProto.clearCustomData = function()
|
||||
{
|
||||
// Clear all event listeners
|
||||
this.removeAllListeners();
|
||||
|
||||
var expandoNumber = this.$[ 'data-cke-expando' ];
|
||||
expandoNumber && delete customData[ expandoNumber ];
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets an ID that can be used to identiquely identify this DOM object in
|
||||
* the running session.
|
||||
* @name CKEDITOR.dom.domObject.prototype.getUniqueId
|
||||
* @function
|
||||
* @returns {Number} A unique ID.
|
||||
*/
|
||||
domObjectProto.getUniqueId = function()
|
||||
{
|
||||
return this.$[ 'data-cke-expando' ] || ( this.$[ 'data-cke-expando' ] = CKEDITOR.tools.getNextNumber() );
|
||||
};
|
||||
|
||||
// Implement CKEDITOR.event.
|
||||
CKEDITOR.event.implementOn( domObjectProto );
|
||||
|
||||
})( CKEDITOR.dom.domObject.prototype );
|
File diff suppressed because it is too large
Load Diff
|
@ -1,119 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
// Elements that may be considered the "Block boundary" in an element path.
|
||||
var pathBlockElements = { address:1,blockquote:1,dl:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1,li:1,dt:1,dd:1, legend:1 };
|
||||
|
||||
// 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,fieldset:1 };
|
||||
|
||||
// Check if an element contains any block element.
|
||||
var checkHasBlock = function( element )
|
||||
{
|
||||
var childNodes = element.getChildren();
|
||||
|
||||
for ( var i = 0, count = childNodes.count() ; i < count ; i++ )
|
||||
{
|
||||
var child = childNodes.getItem( i );
|
||||
|
||||
if ( child.type == CKEDITOR.NODE_ELEMENT && CKEDITOR.dtd.$block[ child.getName() ] )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* @class
|
||||
*/
|
||||
CKEDITOR.dom.elementPath = function( lastNode )
|
||||
{
|
||||
var block = null;
|
||||
var blockLimit = null;
|
||||
var elements = [];
|
||||
|
||||
var e = lastNode;
|
||||
|
||||
while ( e )
|
||||
{
|
||||
if ( e.type == CKEDITOR.NODE_ELEMENT )
|
||||
{
|
||||
if ( !this.lastElement )
|
||||
this.lastElement = e;
|
||||
|
||||
var elementName = e.getName();
|
||||
if ( 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;
|
||||
}
|
||||
};
|
|
@ -1,142 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, 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;
|
|
@ -1,690 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, 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 );
|
||||
|
||||
var removeIds = function( node )
|
||||
{
|
||||
if ( node.nodeType != CKEDITOR.NODE_ELEMENT )
|
||||
return;
|
||||
|
||||
if ( !cloneId )
|
||||
node.removeAttribute( 'id', false );
|
||||
node.removeAttribute( 'data-cke-expando', false );
|
||||
|
||||
if ( includeChildren )
|
||||
{
|
||||
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 <body> is the second child from <html> (<head>
|
||||
* 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;
|
||||
|
||||
if ( parentNode )
|
||||
{
|
||||
// Get the node index. For performance, call getIndex
|
||||
// directly, instead of creating a new node object.
|
||||
address.unshift( this.getIndex.call( { $ : node }, normalized ) );
|
||||
}
|
||||
|
||||
node = parentNode;
|
||||
}
|
||||
|
||||
return address;
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the document containing this element.
|
||||
* @returns {CKEDITOR.dom.document} The document.
|
||||
* @example
|
||||
* var element = CKEDITOR.document.getById( 'example' );
|
||||
* alert( <b>element.getDocument().equals( CKEDITOR.document )</b> ); // "true"
|
||||
*/
|
||||
getDocument : function()
|
||||
{
|
||||
return new CKEDITOR.dom.document( this.$.ownerDocument || this.$.parentNode.ownerDocument );
|
||||
},
|
||||
|
||||
getIndex : function( normalized )
|
||||
{
|
||||
// Attention: getAddress depends on this.$
|
||||
|
||||
var current = this.$,
|
||||
index = 0;
|
||||
|
||||
while ( ( current = current.previousSibling ) )
|
||||
{
|
||||
// When normalizing, do not count it if this is an
|
||||
// empty text node or if it's a text node following another one.
|
||||
if ( normalized && current.nodeType == 3 &&
|
||||
( !current.nodeValue.length ||
|
||||
( current.previousSibling && current.previousSibling.nodeType == 3 ) ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
return index;
|
||||
},
|
||||
|
||||
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 = <b>element.getFirst().getNext()</b>;
|
||||
* 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.<b>getParent()</b>;
|
||||
* 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 closest ancestor node of this node, specified by its node name.
|
||||
* @param {String} name The node name of the ancestor node to search.
|
||||
* @param {Boolean} [includeSelf] Whether to include the current
|
||||
* node in the search.
|
||||
* @returns {CKEDITOR.dom.node} The located ancestor node or null if not found.
|
||||
* @example
|
||||
* // Suppose we have the following HTML:
|
||||
* // <div id="outer"><div id="inner"><p><b>Some text</b></p></div></div>
|
||||
* // If node == <b>
|
||||
* ascendant = node.getAscendant( 'div' ); // ascendant == <div id="inner">
|
||||
* ascendant = node.getAscendant( 'b' ); // ascendant == null
|
||||
* ascendant = node.getAscendant( 'b', true ); // ascendant == <b>
|
||||
*/
|
||||
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' );
|
||||
* <b>element.remove()</b>;
|
||||
*/
|
||||
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 ) ;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks is this node is read-only (should not be changed). It
|
||||
* additionaly returns the element, if any, which defines the read-only
|
||||
* state of this node. It may be the node itself or any of its parent
|
||||
* nodes.
|
||||
* @returns {CKEDITOR.dom.element|Boolean} An element containing
|
||||
* read-only attributes or "false" if none is found.
|
||||
* @since 3.5
|
||||
* @example
|
||||
* // For the following HTML:
|
||||
* // <div contenteditable="false">Some <b>text</b></div>
|
||||
*
|
||||
* // If "ele" is the above <div>
|
||||
* ele.isReadOnly(); // the <div> element
|
||||
*
|
||||
* // If "ele" is the above <b>
|
||||
* ele.isReadOnly(); // the <div> element
|
||||
*/
|
||||
isReadOnly : function()
|
||||
{
|
||||
var current = this;
|
||||
while( current )
|
||||
{
|
||||
if ( current.type == CKEDITOR.NODE_ELEMENT )
|
||||
{
|
||||
if ( current.is( 'body' ) || !!current.data( 'cke-editable' ) )
|
||||
break;
|
||||
|
||||
if ( current.getAttribute( 'contentEditable' ) == 'false' )
|
||||
return current;
|
||||
else if ( current.getAttribute( 'contentEditable' ) == 'true' )
|
||||
break;
|
||||
}
|
||||
current = current.getParent();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
);
|
|
@ -1,26 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @class
|
||||
*/
|
||||
CKEDITOR.dom.nodeList = function( nativeList )
|
||||
{
|
||||
this.$ = nativeList;
|
||||
};
|
||||
|
||||
CKEDITOR.dom.nodeList.prototype =
|
||||
{
|
||||
count : function()
|
||||
{
|
||||
return this.$.length;
|
||||
},
|
||||
|
||||
getItem : function( index )
|
||||
{
|
||||
var $node = this.$[ index ];
|
||||
return $node ? new CKEDITOR.dom.node( $node ) : null;
|
||||
}
|
||||
};
|
File diff suppressed because it is too large
Load Diff
|
@ -1,213 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
/**
|
||||
* Represents a list os CKEDITOR.dom.range objects, which can be easily
|
||||
* iterated sequentially.
|
||||
* @constructor
|
||||
* @param {CKEDITOR.dom.range|Array} [ranges] The ranges contained on this list.
|
||||
* Note that, if an array of ranges is specified, the range sequence
|
||||
* should match its DOM order. This class will not help to sort them.
|
||||
*/
|
||||
CKEDITOR.dom.rangeList = function( ranges )
|
||||
{
|
||||
if ( ranges instanceof CKEDITOR.dom.rangeList )
|
||||
return ranges;
|
||||
|
||||
if ( !ranges )
|
||||
ranges = [];
|
||||
else if ( ranges instanceof CKEDITOR.dom.range )
|
||||
ranges = [ ranges ];
|
||||
|
||||
return CKEDITOR.tools.extend( ranges, mixins );
|
||||
};
|
||||
|
||||
var mixins =
|
||||
/** @lends CKEDITOR.dom.rangeList.prototype */
|
||||
{
|
||||
/**
|
||||
* Creates an instance of the rangeList iterator, it should be used
|
||||
* only when the ranges processing could be DOM intrusive, which
|
||||
* means it may pollute and break other ranges in this list.
|
||||
* Otherwise, it's enough to just iterate over this array in a for loop.
|
||||
* @returns {CKEDITOR.dom.rangeListIterator}
|
||||
*/
|
||||
createIterator : function()
|
||||
{
|
||||
var rangeList = this,
|
||||
bookmark = CKEDITOR.dom.walker.bookmark(),
|
||||
guard = function( node ) { return ! ( node.is && node.is( 'tr' ) ); },
|
||||
bookmarks = [],
|
||||
current;
|
||||
|
||||
/**
|
||||
* @lends CKEDITOR.dom.rangeListIterator.prototype
|
||||
*/
|
||||
return {
|
||||
|
||||
/**
|
||||
* Retrieves the next range in the list.
|
||||
* @param {Boolean} mergeConsequent Whether join two adjacent ranges into single, e.g. consequent table cells.
|
||||
*/
|
||||
getNextRange : function( mergeConsequent )
|
||||
{
|
||||
current = current == undefined ? 0 : current + 1;
|
||||
|
||||
var range = rangeList[ current ];
|
||||
|
||||
// Multiple ranges might be mangled by each other.
|
||||
if ( range && rangeList.length > 1 )
|
||||
{
|
||||
// Bookmarking all other ranges on the first iteration,
|
||||
// the range correctness after it doesn't matter since we'll
|
||||
// restore them before the next iteration.
|
||||
if ( !current )
|
||||
{
|
||||
// Make sure bookmark correctness by reverse processing.
|
||||
for ( var i = rangeList.length - 1; i >= 0; i-- )
|
||||
bookmarks.unshift( rangeList[ i ].createBookmark( true ) );
|
||||
}
|
||||
|
||||
if ( mergeConsequent )
|
||||
{
|
||||
// Figure out how many ranges should be merged.
|
||||
var mergeCount = 0;
|
||||
while ( rangeList[ current + mergeCount + 1 ] )
|
||||
{
|
||||
var doc = range.document,
|
||||
found = 0,
|
||||
left = doc.getById( bookmarks[ mergeCount ].endNode ),
|
||||
right = doc.getById( bookmarks[ mergeCount + 1 ].startNode ),
|
||||
next;
|
||||
|
||||
// Check subsequent range.
|
||||
while ( 1 )
|
||||
{
|
||||
next = left.getNextSourceNode( false );
|
||||
if ( !right.equals( next ) )
|
||||
{
|
||||
// This could be yet another bookmark or
|
||||
// walking across block boundaries.
|
||||
if ( bookmark( next ) || ( next.type == CKEDITOR.NODE_ELEMENT && next.isBlockBoundary() ) )
|
||||
{
|
||||
left = next;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
found = 1;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !found )
|
||||
break;
|
||||
|
||||
mergeCount++;
|
||||
}
|
||||
}
|
||||
|
||||
range.moveToBookmark( bookmarks.shift() );
|
||||
|
||||
// Merge ranges finally after moving to bookmarks.
|
||||
while( mergeCount-- )
|
||||
{
|
||||
next = rangeList[ ++current ];
|
||||
next.moveToBookmark( bookmarks.shift() );
|
||||
range.setEnd( next.endContainer, next.endOffset );
|
||||
}
|
||||
}
|
||||
|
||||
return range;
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
createBookmarks : function( serializable )
|
||||
{
|
||||
var retval = [], bookmark;
|
||||
for ( var i = 0; i < this.length ; i++ )
|
||||
{
|
||||
retval.push( bookmark = this[ i ].createBookmark( serializable, true) );
|
||||
|
||||
// Updating the container & offset values for ranges
|
||||
// that have been touched.
|
||||
for ( var j = i + 1; j < this.length; j++ )
|
||||
{
|
||||
this[ j ] = updateDirtyRange( bookmark, this[ j ] );
|
||||
this[ j ] = updateDirtyRange( bookmark, this[ j ], true );
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
},
|
||||
|
||||
createBookmarks2 : function( normalized )
|
||||
{
|
||||
var bookmarks = [];
|
||||
|
||||
for ( var i = 0 ; i < this.length ; i++ )
|
||||
bookmarks.push( this[ i ].createBookmark2( normalized ) );
|
||||
|
||||
return bookmarks;
|
||||
},
|
||||
|
||||
/**
|
||||
* Move each range in the list to the position specified by a list of bookmarks.
|
||||
* @param {Array} bookmarks The list of bookmarks, each one matching a range in the list.
|
||||
*/
|
||||
moveToBookmarks : function( bookmarks )
|
||||
{
|
||||
for ( var i = 0 ; i < this.length ; i++ )
|
||||
this[ i ].moveToBookmark( bookmarks[ i ] );
|
||||
}
|
||||
};
|
||||
|
||||
// Update the specified range which has been mangled by previous insertion of
|
||||
// range bookmark nodes.(#3256)
|
||||
function updateDirtyRange( bookmark, dirtyRange, checkEnd )
|
||||
{
|
||||
var serializable = bookmark.serializable,
|
||||
container = dirtyRange[ checkEnd ? 'endContainer' : 'startContainer' ],
|
||||
offset = checkEnd ? 'endOffset' : 'startOffset';
|
||||
|
||||
var bookmarkStart = serializable ?
|
||||
dirtyRange.document.getById( bookmark.startNode )
|
||||
: bookmark.startNode;
|
||||
|
||||
var bookmarkEnd = serializable ?
|
||||
dirtyRange.document.getById( bookmark.endNode )
|
||||
: bookmark.endNode;
|
||||
|
||||
if ( container.equals( bookmarkStart.getPrevious() ) )
|
||||
{
|
||||
dirtyRange.startOffset = dirtyRange.startOffset
|
||||
- container.getLength()
|
||||
- bookmarkEnd.getPrevious().getLength();
|
||||
container = bookmarkEnd.getNext();
|
||||
}
|
||||
else if ( container.equals( bookmarkEnd.getPrevious() ) )
|
||||
{
|
||||
dirtyRange.startOffset = dirtyRange.startOffset - container.getLength();
|
||||
container = bookmarkEnd.getNext();
|
||||
}
|
||||
|
||||
container.equals( bookmarkStart.getParent() ) && dirtyRange[ offset ]++;
|
||||
container.equals( bookmarkEnd.getParent() ) && dirtyRange[ offset ]++;
|
||||
|
||||
// Update and return this range.
|
||||
dirtyRange[ checkEnd ? 'endContainer' : 'startContainer' ] = container;
|
||||
return dirtyRange;
|
||||
}
|
||||
})();
|
||||
|
||||
/**
|
||||
* (Virtual Class) Do not call this constructor. This class is not really part
|
||||
* of the API. It just describes the return type of {@link CKEDITOR.dom.rangeList#createIterator}.
|
||||
* @name CKEDITOR.dom.rangeListIterator
|
||||
* @constructor
|
||||
* @example
|
||||
*/
|
|
@ -1,128 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.dom.text} class, which represents
|
||||
* a DOM text node.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a DOM text node.
|
||||
* @constructor
|
||||
* @augments CKEDITOR.dom.node
|
||||
* @param {Object|String} text A native DOM text node or a string containing
|
||||
* the text to use to create a new text node.
|
||||
* @param {CKEDITOR.dom.document} [ownerDocument] The document that will contain
|
||||
* the node in case of new node creation. Defaults to the current document.
|
||||
* @example
|
||||
* var nativeNode = document.createTextNode( 'Example' );
|
||||
* var text = CKEDITOR.dom.text( nativeNode );
|
||||
* @example
|
||||
* var text = CKEDITOR.dom.text( 'Example' );
|
||||
*/
|
||||
CKEDITOR.dom.text = function( text, ownerDocument )
|
||||
{
|
||||
if ( typeof text == 'string' )
|
||||
text = ( ownerDocument ? ownerDocument.$ : document ).createTextNode( text );
|
||||
|
||||
// Theoretically, we should call the base constructor here
|
||||
// (not CKEDITOR.dom.node though). But, IE doesn't support expando
|
||||
// properties on text node, so the features provided by domObject will not
|
||||
// work for text nodes (which is not a big issue for us).
|
||||
//
|
||||
// CKEDITOR.dom.domObject.call( this, element );
|
||||
|
||||
/**
|
||||
* The native DOM text node represented by this class instance.
|
||||
* @type Object
|
||||
* @example
|
||||
* var element = new CKEDITOR.dom.text( 'Example' );
|
||||
* alert( element.$.nodeType ); // "3"
|
||||
*/
|
||||
this.$ = text;
|
||||
};
|
||||
|
||||
CKEDITOR.dom.text.prototype = new CKEDITOR.dom.node();
|
||||
|
||||
CKEDITOR.tools.extend( CKEDITOR.dom.text.prototype,
|
||||
/** @lends CKEDITOR.dom.text.prototype */
|
||||
{
|
||||
/**
|
||||
* The node type. This is a constant value set to
|
||||
* {@link CKEDITOR.NODE_TEXT}.
|
||||
* @type Number
|
||||
* @example
|
||||
*/
|
||||
type : CKEDITOR.NODE_TEXT,
|
||||
|
||||
getLength : function()
|
||||
{
|
||||
return this.$.nodeValue.length;
|
||||
},
|
||||
|
||||
getText : function()
|
||||
{
|
||||
return this.$.nodeValue;
|
||||
},
|
||||
|
||||
setText : function( text )
|
||||
{
|
||||
this.$.nodeValue = text;
|
||||
},
|
||||
|
||||
/**
|
||||
* Breaks this text node into two nodes at the specified offset,
|
||||
* keeping both in the tree as siblings. This node then only contains
|
||||
* all the content up to the offset point. A new text node, which is
|
||||
* inserted as the next sibling of this node, contains all the content
|
||||
* at and after the offset point. When the offset is equal to the
|
||||
* length of this node, the new node has no data.
|
||||
* @param {Number} The position at which to split, starting from zero.
|
||||
* @returns {CKEDITOR.dom.text} The new text node.
|
||||
*/
|
||||
split : function( offset )
|
||||
{
|
||||
// If the offset is after the last char, IE creates the text node
|
||||
// on split, but don't include it into the DOM. So, we have to do
|
||||
// that manually here.
|
||||
if ( CKEDITOR.env.ie && offset == this.getLength() )
|
||||
{
|
||||
var next = this.getDocument().createText( '' );
|
||||
next.insertAfter( this );
|
||||
return next;
|
||||
}
|
||||
|
||||
var doc = this.getDocument();
|
||||
var retval = new CKEDITOR.dom.text( this.$.splitText( offset ), doc );
|
||||
|
||||
// IE BUG: IE8 does not update the childNodes array in DOM after splitText(),
|
||||
// we need to make some DOM changes to make it update. (#3436)
|
||||
if ( CKEDITOR.env.ie8 )
|
||||
{
|
||||
var workaround = new CKEDITOR.dom.text( '', doc );
|
||||
workaround.insertAfter( retval );
|
||||
workaround.remove();
|
||||
}
|
||||
|
||||
return retval;
|
||||
},
|
||||
|
||||
/**
|
||||
* Extracts characters from indexA up to but not including indexB.
|
||||
* @param {Number} indexA An integer between 0 and one less than the
|
||||
* length of the text.
|
||||
* @param {Number} [indexB] An integer between 0 and the length of the
|
||||
* string. If omitted, extracts characters to the end of the text.
|
||||
*/
|
||||
substring : function( indexA, indexB )
|
||||
{
|
||||
// We need the following check due to a Firefox bug
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=458886
|
||||
if ( typeof indexB != 'number' )
|
||||
return this.$.nodeValue.substr( indexA );
|
||||
else
|
||||
return this.$.nodeValue.substring( indexA, indexB );
|
||||
}
|
||||
});
|
|
@ -1,460 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, 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, 1 );
|
||||
},
|
||||
|
||||
/**
|
||||
* 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, 0, 1 ) !== 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, 1, 1 ) !== 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, 1 );
|
||||
},
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
CKEDITOR.dom.element.prototype.isBlockBoundary = function( customNodeNames )
|
||||
{
|
||||
var nodeNameMatches = CKEDITOR.tools.extend( {}, CKEDITOR.dtd.$block, customNodeNames || {} );
|
||||
|
||||
// Don't consider floated formatting as block boundary, fall back to dtd check in that case. (#6297)
|
||||
return this.getComputedStyle( 'float' ) == 'none' && 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 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.data( 'cke-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. <b></b> we're checking here
|
||||
// 'offsetHeight' instead of 'offsetWidth' for properly excluding
|
||||
// all sorts of empty paragraph, e.g. <br />.
|
||||
var isInvisible = whitespace( node ) || node.is && !node.$.offsetHeight;
|
||||
return !! ( isReject ^ isInvisible );
|
||||
};
|
||||
};
|
||||
|
||||
CKEDITOR.dom.walker.nodeType = function( type, isReject )
|
||||
{
|
||||
return function( node )
|
||||
{
|
||||
return !! ( isReject ^ ( node.type == type ) );
|
||||
};
|
||||
};
|
||||
|
||||
var tailNbspRegex = /^[\t\r\n ]*(?: |\xa0)$/,
|
||||
isWhitespaces = CKEDITOR.dom.walker.whitespaces(),
|
||||
isBookmark = CKEDITOR.dom.walker.bookmark(),
|
||||
toSkip = function( node )
|
||||
{
|
||||
return isBookmark( node )
|
||||
|| isWhitespaces( node )
|
||||
|| node.type == CKEDITOR.NODE_ELEMENT
|
||||
&& node.getName() in CKEDITOR.dtd.$inline
|
||||
&& !( node.getName() in CKEDITOR.dtd.$empty );
|
||||
};
|
||||
|
||||
// Check if there's a filler node at the end of an element, and return it.
|
||||
CKEDITOR.dom.element.prototype.getBogus = function()
|
||||
{
|
||||
// Bogus are not always at the end, e.g. <p><a>text<br /></a></p> (#7070).
|
||||
var tail = this;
|
||||
do { tail = tail.getPreviousSourceNode(); }
|
||||
while ( toSkip( tail ) )
|
||||
|
||||
if ( tail && ( !CKEDITOR.env.ie ? tail.is && tail.is( 'br' )
|
||||
: tail.getText && tailNbspRegex.test( tail.getText() ) ) )
|
||||
{
|
||||
return tail;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
})();
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.dom.document} class, which
|
||||
* represents a DOM document.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a DOM window.
|
||||
* @constructor
|
||||
* @augments CKEDITOR.dom.domObject
|
||||
* @param {Object} domWindow A native DOM window.
|
||||
* @example
|
||||
* var document = new CKEDITOR.dom.window( window );
|
||||
*/
|
||||
CKEDITOR.dom.window = function( domWindow )
|
||||
{
|
||||
CKEDITOR.dom.domObject.call( this, domWindow );
|
||||
};
|
||||
|
||||
CKEDITOR.dom.window.prototype = new CKEDITOR.dom.domObject();
|
||||
|
||||
CKEDITOR.tools.extend( CKEDITOR.dom.window.prototype,
|
||||
/** @lends CKEDITOR.dom.window.prototype */
|
||||
{
|
||||
/**
|
||||
* Moves the selection focus to this window.
|
||||
* @function
|
||||
* @example
|
||||
* var win = new CKEDITOR.dom.window( window );
|
||||
* <b>win.focus()</b>;
|
||||
*/
|
||||
focus : function()
|
||||
{
|
||||
// Webkit is sometimes failed to focus iframe, blur it first(#3835).
|
||||
if ( CKEDITOR.env.webkit && this.$.parent )
|
||||
this.$.parent.focus();
|
||||
this.$.focus();
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the width and height of this window's viewable area.
|
||||
* @function
|
||||
* @returns {Object} An object with the "width" and "height"
|
||||
* properties containing the size.
|
||||
* @example
|
||||
* var win = new CKEDITOR.dom.window( window );
|
||||
* var size = <b>win.getViewPaneSize()</b>;
|
||||
* alert( size.width );
|
||||
* alert( size.height );
|
||||
*/
|
||||
getViewPaneSize : function()
|
||||
{
|
||||
var doc = this.$.document,
|
||||
stdMode = doc.compatMode == 'CSS1Compat';
|
||||
return {
|
||||
width : ( stdMode ? doc.documentElement.clientWidth : doc.body.clientWidth ) || 0,
|
||||
height : ( stdMode ? doc.documentElement.clientHeight : doc.body.clientHeight ) || 0
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the current position of the window's scroll.
|
||||
* @function
|
||||
* @returns {Object} An object with the "x" and "y" properties
|
||||
* containing the scroll position.
|
||||
* @example
|
||||
* var win = new CKEDITOR.dom.window( window );
|
||||
* var pos = <b>win.getScrollPosition()</b>;
|
||||
* alert( pos.x );
|
||||
* alert( pos.y );
|
||||
*/
|
||||
getScrollPosition : function()
|
||||
{
|
||||
var $ = this.$;
|
||||
|
||||
if ( 'pageXOffset' in $ )
|
||||
{
|
||||
return {
|
||||
x : $.pageXOffset || 0,
|
||||
y : $.pageYOffset || 0
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
var doc = $.document;
|
||||
return {
|
||||
x : doc.documentElement.scrollLeft || doc.body.scrollLeft || 0,
|
||||
y : doc.documentElement.scrollTop || doc.body.scrollTop || 0
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,238 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.dtd} object, which holds the DTD
|
||||
* mapping for XHTML 1.0 Transitional. This file was automatically
|
||||
* generated from the file: xhtml1-transitional.dtd.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @namespace Holds and object representation of the HTML DTD to be used by the
|
||||
* editor in its internal operations.<br />
|
||||
* <br />
|
||||
* Each element in the DTD is represented by a property in this object. Each
|
||||
* property contains the list of elements that can be contained by the element.
|
||||
* Text is represented by the "#" property.<br />
|
||||
* <br />
|
||||
* Several special grouping properties are also available. Their names start
|
||||
* with the "$" character.
|
||||
* @example
|
||||
* // Check if "div" can be contained in a "p" element.
|
||||
* alert( !!CKEDITOR.dtd[ 'p' ][ 'div' ] ); "false"
|
||||
* @example
|
||||
* // Check if "p" can be contained in a "div" element.
|
||||
* alert( !!CKEDITOR.dtd[ 'div' ][ 'p' ] ); "true"
|
||||
* @example
|
||||
* // Check if "p" is a block element.
|
||||
* alert( !!CKEDITOR.dtd.$block[ 'p' ] ); "true"
|
||||
*/
|
||||
CKEDITOR.dtd = (function()
|
||||
{
|
||||
var X = CKEDITOR.tools.extend,
|
||||
|
||||
A = {isindex:1,fieldset:1},
|
||||
B = {input:1,button:1,select:1,textarea:1,label:1},
|
||||
C = X({a:1},B),
|
||||
D = X({iframe:1},C),
|
||||
E = {hr:1,ul:1,menu:1,div:1,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 },
|
||||
|
||||
/**
|
||||
* List of inline (<span> like) elements.
|
||||
*/
|
||||
$inline : L, // Just like span.
|
||||
|
||||
/**
|
||||
* list of elements that can be children at <body>.
|
||||
*/
|
||||
$body : X({script:1,style:1}, block),
|
||||
|
||||
$cdata : {script:1,style:1},
|
||||
|
||||
/**
|
||||
* List of empty (self-closing) elements, like "br" or "img".
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
$empty : {area:1,base:1,br:1,col:1,hr:1,img:1,input:1,link:1,meta:1,param:1},
|
||||
|
||||
/**
|
||||
* 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 )
|
|
@ -1,985 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, 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 + '/' ) );
|
||||
|
||||
/**
|
||||
* The name of the skin used by this editor instance. The skin name can
|
||||
* be set though the {@link CKEDITOR.config.skin} setting.
|
||||
* @name CKEDITOR.editor.prototype.skinName
|
||||
* @type String
|
||||
* @example
|
||||
* alert( editor.skinName ); // "kama" (e.g.)
|
||||
*/
|
||||
editor.skinName = skinName;
|
||||
|
||||
/**
|
||||
* The full URL of the skin directory.
|
||||
* @name CKEDITOR.editor.prototype.skinPath
|
||||
* @type String
|
||||
* @example
|
||||
* alert( editor.skinPath ); // "http://example.com/ckeditor/skins/kama/" (e.g.)
|
||||
*/
|
||||
editor.skinPath = skinPath;
|
||||
|
||||
/**
|
||||
* The CSS class name used for skin identification purposes.
|
||||
* @name CKEDITOR.editor.prototype.skinClass
|
||||
* @type String
|
||||
* @example
|
||||
* alert( editor.skinClass ); // "cke_skin_kama" (e.g.)
|
||||
*/
|
||||
editor.skinClass = 'cke_skin_' + skinName;
|
||||
|
||||
/**
|
||||
* The <a href="http://en.wikipedia.org/wiki/Tabbing_navigation">tabbing
|
||||
* navigation</a> order that has been calculated for this editor
|
||||
* instance. This can be set by the {@link CKEDITOR.config.tabIndex}
|
||||
* setting or taken from the "tabindex" attribute of the
|
||||
* {@link #element} associated to the editor.
|
||||
* @name CKEDITOR.editor.prototype.tabIndex
|
||||
* @type Number
|
||||
* @default 0 (zero)
|
||||
* @example
|
||||
* alert( editor.tabIndex ); // "0" (e.g.)
|
||||
*/
|
||||
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 )
|
||||
{
|
||||
/**
|
||||
* The code for the language resources that have been loaded
|
||||
* for the user internface elements of this editor instance.
|
||||
* @name CKEDITOR.editor.prototype.langCode
|
||||
* @type String
|
||||
* @example
|
||||
* alert( editor.langCode ); // "en" (e.g.)
|
||||
*/
|
||||
editor.langCode = languageCode;
|
||||
|
||||
/**
|
||||
* An object holding all language strings used by the editor
|
||||
* interface.
|
||||
* @name CKEDITOR.editor.prototype.lang
|
||||
* @type CKEDITOR.lang
|
||||
* @example
|
||||
* alert( editor.lang.bold ); // "Negrito" (e.g. if language is Portuguese)
|
||||
*/
|
||||
// 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 the Adobe AIR plugin conditionally.
|
||||
CKEDITOR.env.air && ( plugins += ',adobeair' );
|
||||
|
||||
// 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 = [];
|
||||
|
||||
/**
|
||||
* And object holding references to all plugins used by this
|
||||
* editor istance.
|
||||
* @name CKEDITOR.editor.prototype.plugins
|
||||
* @type Object
|
||||
* @example
|
||||
* alert( editor.plugins.dialog.path ); // "http://example.com/ckeditor/plugins/dialog/" (e.g.)
|
||||
*/
|
||||
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.langEntries || !plugin.langEntries[ 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.langEntries[ 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.langEntries[ 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()
|
||||
{
|
||||
/**
|
||||
* The theme used by this editor instance.
|
||||
* @name CKEDITOR.editor.prototype.theme
|
||||
* @type CKEDITOR.theme
|
||||
* @example
|
||||
* alert( editor.theme ); "http://example.com/ckeditor/themes/default/" (e.g.)
|
||||
*/
|
||||
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.length )
|
||||
{
|
||||
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( <b>editor.element</b>.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( <b>editor.name</b> ); "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.';
|
||||
|
||||
/**
|
||||
* A unique random string assigned to each editor instance in the page.
|
||||
* @name CKEDITOR.editor.prototype.id
|
||||
* @type String
|
||||
*/
|
||||
this.id = CKEDITOR.tools.getNextId();
|
||||
|
||||
/**
|
||||
* 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( <b>editor.config.theme</b> ); "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"
|
||||
* <b>CKEDITOR.instances.editor1.destroy()</b>;
|
||||
* alert( CKEDITOR.instances.editor1 ); "undefined"
|
||||
*/
|
||||
destroy : function( noUpdate )
|
||||
{
|
||||
if ( !noUpdate )
|
||||
this.updateElement();
|
||||
|
||||
this.fire( 'destroy' );
|
||||
this.theme && this.theme.destroy( this );
|
||||
|
||||
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.<b>getData()</b> == '' )
|
||||
* 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;
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the "raw data" currently available in the editor. This is a
|
||||
* fast method which return the data as is, without processing, so it's
|
||||
* not recommended to use it on resulting pages. It can be used instead
|
||||
* combined with the {@link #loadSnapshot} so one can automatic save
|
||||
* the editor data from time to time while the user is using the
|
||||
* editor, to avoid data loss, without risking performance issues.
|
||||
* @example
|
||||
* alert( editor.getSnapshot() );
|
||||
*/
|
||||
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;
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads "raw data" in the editor. This data is loaded with processing
|
||||
* straight to the editing area. It should not be used as a way to load
|
||||
* any kind of data, but instead in combination with
|
||||
* {@link #getSnapshot} produced data.
|
||||
* @example
|
||||
* var data = editor.getSnapshot();
|
||||
* editor.<b>loadSnapshot( data )</b>;
|
||||
*/
|
||||
loadSnapshot : function( snapshot )
|
||||
{
|
||||
this.fire( 'loadSnapshot', snapshot );
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the editor data. The data must be provided in raw format (HTML).<br />
|
||||
* <br />
|
||||
* 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.
|
||||
*@param {Boolean} internal Whether suppress any event firing when copying data internally inside editor.
|
||||
* @example
|
||||
* CKEDITOR.instances.editor1.<b>setData</b>( '<p>This is the editor data.</p>' );
|
||||
* @example
|
||||
* CKEDITOR.instances.editor1.<b>setData</b>( '<p>Some other editor data.</p>', function()
|
||||
* {
|
||||
* this.checkDirty(); // true
|
||||
* });
|
||||
*/
|
||||
setData : function( data , callback, internal )
|
||||
{
|
||||
if( callback )
|
||||
{
|
||||
this.on( 'dataReady', function( evt )
|
||||
{
|
||||
evt.removeListener();
|
||||
callback.call( evt.editor );
|
||||
} );
|
||||
}
|
||||
|
||||
// Fire "setData" so data manipulation may happen.
|
||||
var eventData = { dataValue : data };
|
||||
!internal && this.fire( 'setData', eventData );
|
||||
|
||||
this._.data = eventData.dataValue;
|
||||
|
||||
!internal && 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.<b>insertHtml( '<p>This is a new paragraph.</p>' )</b>;
|
||||
*/
|
||||
insertHtml : function( data )
|
||||
{
|
||||
this.fire( 'insertHtml', data );
|
||||
},
|
||||
|
||||
/**
|
||||
* Insert text content into the currently selected position in the
|
||||
* editor, in WYSIWYG mode, styles of the selected element will be applied to the inserted text,
|
||||
* spaces around the text will be leaving untouched.
|
||||
* <strong>Note:</strong> two subsequent line-breaks will introduce one paragraph, which element depends on {@link CKEDITOR.config.enterMode};
|
||||
* A single line-break will be instead translated into one <br />.
|
||||
* @since 3.5
|
||||
* @param {String} text Text to be inserted into the editor.
|
||||
* @example
|
||||
* CKEDITOR.instances.editor1.<b>insertText( ' line1 \n\n line2' )</b>;
|
||||
*/
|
||||
insertText : function( text )
|
||||
{
|
||||
this.fire( 'insertText', text );
|
||||
},
|
||||
|
||||
/**
|
||||
* 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.<b>insertElement( element )</b>;
|
||||
*/
|
||||
insertElement : function( element )
|
||||
{
|
||||
this.fire( 'insertElement', element );
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks whether the current editor contents present changes when
|
||||
* compared to the contents loaded into the editor at startup, or to
|
||||
* the contents available in the editor when {@link #resetDirty} has
|
||||
* been called.
|
||||
* @returns {Boolean} "true" is the contents present changes.
|
||||
* @example
|
||||
* function beforeUnload( e )
|
||||
* {
|
||||
* if ( CKEDITOR.instances.editor1.<b>checkDirty()</b> )
|
||||
* return e.returnValue = "You'll loose the changes made in the editor.";
|
||||
* }
|
||||
*
|
||||
* if ( window.addEventListener )
|
||||
* window.addEventListener( 'beforeunload', beforeUnload, false );
|
||||
* else
|
||||
* window.attachEvent( 'onbeforeunload', beforeUnload );
|
||||
*/
|
||||
checkDirty : function()
|
||||
{
|
||||
return ( this.mayBeDirty && this._.previousValue !== this.getSnapshot() );
|
||||
},
|
||||
|
||||
/**
|
||||
* Resets the "dirty state" of the editor so subsequent calls to
|
||||
* {@link #checkDirty} will return "false" if the user will not make
|
||||
* further changes to the contents.
|
||||
* @example
|
||||
* alert( editor.checkDirty() ); // "true" (e.g.)
|
||||
* editor.<b>resetDirty()</b>;
|
||||
* alert( editor.checkDirty() ); // "false"
|
||||
*/
|
||||
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.editor#pluginsLoaded
|
||||
* @event
|
||||
* @param {CKEDITOR.editor} editor This editor instance.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired before the command execution when {@link #execCommand} is called.
|
||||
* @name CKEDITOR.editor#beforeCommandExec
|
||||
* @event
|
||||
* @param {CKEDITOR.editor} editor This editor instance.
|
||||
* @param {String} data.name The command name.
|
||||
* @param {Object} data.commandData The data to be sent to the command. This
|
||||
* can be manipulated by the event listener.
|
||||
* @param {CKEDITOR.command} data.command The command itself.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired after the command execution when {@link #execCommand} is called.
|
||||
* @name CKEDITOR.editor#afterCommandExec
|
||||
* @event
|
||||
* @param {CKEDITOR.editor} editor This editor instance.
|
||||
* @param {String} data.name The command name.
|
||||
* @param {Object} data.commandData The data sent to the command.
|
||||
* @param {CKEDITOR.command} data.command The command itself.
|
||||
* @param {Object} data.returnValue The value returned by the command execution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired every custom configuration file is loaded, before the final
|
||||
* configurations initialization.<br />
|
||||
* <br />
|
||||
* Custom configuration files can be loaded thorugh the
|
||||
* {@link CKEDITOR.config.customConfig} setting. Several files can be loading
|
||||
* by chaning this setting.
|
||||
* @name CKEDITOR.editor#customConfigLoaded
|
||||
* @event
|
||||
* @param {CKEDITOR.editor} editor This editor instance.
|
||||
* @example
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired once the editor configuration is ready (loaded and processed).
|
||||
* @name CKEDITOR.editor#configLoaded
|
||||
* @event
|
||||
* @param {CKEDITOR.editor} editor This editor instance.
|
||||
* @example
|
||||
* if( editor.config.fullPage )
|
||||
* alert( 'This is a full page editor' );
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired when this editor instance is destroyed. The editor at this
|
||||
* point isn't usable and this event should be used to perform clean up
|
||||
* in any plugin.
|
||||
* @name CKEDITOR.editor#destroy
|
||||
* @event
|
||||
*/
|
||||
|
||||
/**
|
||||
* Internal event to get the current data.
|
||||
* @name CKEDITOR.editor#beforeGetData
|
||||
* @event
|
||||
*/
|
||||
|
||||
/**
|
||||
* Internal event to perform the #getSnapshot call.
|
||||
* @name CKEDITOR.editor#getSnapshot
|
||||
* @event
|
||||
*/
|
||||
|
||||
/**
|
||||
* Internal event to perform the #loadSnapshot call.
|
||||
* @name CKEDITOR.editor#loadSnapshot
|
||||
* @event
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Event fired before the #getData call returns allowing additional manipulation.
|
||||
* @name CKEDITOR.editor#getData
|
||||
* @event
|
||||
* @param {CKEDITOR.editor} editor This editor instance.
|
||||
* @param {String} data.dataValue The data that will be returned.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Event fired before the #setData call is executed allowing additional manipulation.
|
||||
* @name CKEDITOR.editor#setData
|
||||
* @event
|
||||
* @param {CKEDITOR.editor} editor This editor instance.
|
||||
* @param {String} data.dataValue The data that will be used.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Event fired at the end of the #setData call is executed. Usually it's better to use the
|
||||
* {@link CKEDITOR.editor.prototype.dataReady} event.
|
||||
* @name CKEDITOR.editor#afterSetData
|
||||
* @event
|
||||
* @param {CKEDITOR.editor} editor This editor instance.
|
||||
* @param {String} data.dataValue The data that has been set.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Internal event to perform the #insertHtml call
|
||||
* @name CKEDITOR.editor#insertHtml
|
||||
* @event
|
||||
* @param {CKEDITOR.editor} editor This editor instance.
|
||||
* @param {String} data The HTML to insert.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Internal event to perform the #insertText call
|
||||
* @name CKEDITOR.editor#insertText
|
||||
* @event
|
||||
* @param {CKEDITOR.editor} editor This editor instance.
|
||||
* @param {String} text The text to insert.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Internal event to perform the #insertElement call
|
||||
* @name CKEDITOR.editor#insertElement
|
||||
* @event
|
||||
* @param {CKEDITOR.editor} editor This editor instance.
|
||||
* @param {Object} element The element to insert.
|
||||
*/
|
|
@ -1,186 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
if ( !CKEDITOR.editor )
|
||||
{
|
||||
/**
|
||||
* No element is linked to the editor instance.
|
||||
* @constant
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.ELEMENT_MODE_NONE = 0;
|
||||
|
||||
/**
|
||||
* The element is to be replaced by the editor instance.
|
||||
* @constant
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.ELEMENT_MODE_REPLACE = 1;
|
||||
|
||||
/**
|
||||
* The editor is to be created inside the element.
|
||||
* @constant
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.ELEMENT_MODE_APPENDTO = 2;
|
||||
|
||||
/**
|
||||
* Creates an editor class instance. This constructor should be rarely
|
||||
* used, in favor of the {@link CKEDITOR} editor creation functions.
|
||||
* @ class Represents an editor instance.
|
||||
* @param {Object} instanceConfig Configuration values for this specific
|
||||
* instance.
|
||||
* @param {CKEDITOR.dom.element} [element] The element linked to this
|
||||
* instance.
|
||||
* @param {Number} [mode] The mode in which the element is linked to this
|
||||
* instance. See {@link #elementMode}.
|
||||
* @param {String} [data] Since 3.3. Initial value for the instance.
|
||||
* @augments CKEDITOR.event
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.editor = function( instanceConfig, element, mode, data )
|
||||
{
|
||||
this._ =
|
||||
{
|
||||
// Save the config to be processed later by the full core code.
|
||||
instanceConfig : instanceConfig,
|
||||
element : element,
|
||||
data : data
|
||||
};
|
||||
|
||||
/**
|
||||
* The mode in which the {@link #element} is linked to this editor
|
||||
* instance. It can be any of the following values:
|
||||
* <ul>
|
||||
* <li>{@link CKEDITOR.ELEMENT_MODE_NONE}: No element is linked to the
|
||||
* editor instance.</li>
|
||||
* <li>{@link CKEDITOR.ELEMENT_MODE_REPLACE}: The element is to be
|
||||
* replaced by the editor instance.</li>
|
||||
* <li>{@link CKEDITOR.ELEMENT_MODE_APPENDTO}: The editor is to be
|
||||
* created inside the element.</li>
|
||||
* </ul>
|
||||
* @name CKEDITOR.editor.prototype.elementMode
|
||||
* @type Number
|
||||
* @example
|
||||
* var editor = CKEDITOR.replace( 'editor1' );
|
||||
* alert( <b>editor.elementMode</b> ); "1"
|
||||
*/
|
||||
this.elementMode = mode || CKEDITOR.ELEMENT_MODE_NONE;
|
||||
|
||||
// Call the CKEDITOR.event constructor to initialize this instance.
|
||||
CKEDITOR.event.call( this );
|
||||
|
||||
this._init();
|
||||
};
|
||||
|
||||
/**
|
||||
* Replaces a <textarea> or a DOM element (DIV) with a CKEditor
|
||||
* instance. For textareas, the initial value in the editor will be the
|
||||
* textarea value. For DOM elements, their innerHTML will be used
|
||||
* instead. We recommend using TEXTAREA and DIV elements only. Do not use
|
||||
* this function directly. Use {@link CKEDITOR.replace} instead.
|
||||
* @param {Object|String} elementOrIdOrName The DOM element (textarea), its
|
||||
* ID or name.
|
||||
* @param {Object} [config] The specific configurations to apply to this
|
||||
* editor instance. Configurations set here will override global CKEditor
|
||||
* settings.
|
||||
* @returns {CKEDITOR.editor} The editor instance created.
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.editor.replace = function( elementOrIdOrName, config )
|
||||
{
|
||||
var element = elementOrIdOrName;
|
||||
|
||||
if ( typeof element != 'object' )
|
||||
{
|
||||
// Look for the element by id. We accept any kind of element here.
|
||||
element = document.getElementById( elementOrIdOrName );
|
||||
|
||||
// Elements that should go into head are unacceptable (#6791).
|
||||
if ( element && element.tagName.toLowerCase() in {style:1,script:1,base:1,link:1,meta:1,title:1} )
|
||||
element = null;
|
||||
|
||||
// If not found, look for elements by name. In this case we accept only
|
||||
// textareas.
|
||||
if ( !element )
|
||||
{
|
||||
var i = 0,
|
||||
textareasByName = document.getElementsByName( elementOrIdOrName );
|
||||
|
||||
while ( ( element = textareasByName[ i++ ] ) && element.tagName.toLowerCase() != 'textarea' )
|
||||
{ /*jsl:pass*/ }
|
||||
}
|
||||
|
||||
if ( !element )
|
||||
throw '[CKEDITOR.editor.replace] The element with id or name "' + elementOrIdOrName + '" was not found.';
|
||||
}
|
||||
|
||||
// Do not replace the textarea right now, just hide it. The effective
|
||||
// replacement will be done by the _init function.
|
||||
element.style.visibility = 'hidden';
|
||||
|
||||
// Create the editor instance.
|
||||
return new CKEDITOR.editor( config, element, CKEDITOR.ELEMENT_MODE_REPLACE );
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a new editor instance inside a specific DOM element. Do not use
|
||||
* this function directly. Use {@link CKEDITOR.appendTo} instead.
|
||||
* @param {Object|String} elementOrId The DOM element or its ID.
|
||||
* @param {Object} [config] The specific configurations to apply to this
|
||||
* editor instance. Configurations set here will override global CKEditor
|
||||
* settings.
|
||||
* @param {String} [data] Since 3.3. Initial value for the instance.
|
||||
* @returns {CKEDITOR.editor} The editor instance created.
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.editor.appendTo = function( elementOrId, config, data )
|
||||
{
|
||||
var element = elementOrId;
|
||||
if ( typeof element != 'object' )
|
||||
{
|
||||
element = document.getElementById( elementOrId );
|
||||
|
||||
if ( !element )
|
||||
throw '[CKEDITOR.editor.appendTo] The element with id "' + elementOrId + '" was not found.';
|
||||
}
|
||||
|
||||
// Create the editor instance.
|
||||
return new CKEDITOR.editor( config, element, CKEDITOR.ELEMENT_MODE_APPENDTO, data );
|
||||
};
|
||||
|
||||
CKEDITOR.editor.prototype =
|
||||
{
|
||||
/**
|
||||
* Initializes the editor instance. This function will be overriden by the
|
||||
* full CKEDITOR.editor implementation (editor.js).
|
||||
* @private
|
||||
*/
|
||||
_init : function()
|
||||
{
|
||||
var pending = CKEDITOR.editor._pending || ( CKEDITOR.editor._pending = [] );
|
||||
pending.push( this );
|
||||
},
|
||||
|
||||
// Both fire and fireOnce will always pass this editor instance as the
|
||||
// "editor" param in CKEDITOR.event.fire. So, we override it to do that
|
||||
// automaticaly.
|
||||
|
||||
/** @ignore */
|
||||
fire : function( eventName, data )
|
||||
{
|
||||
return CKEDITOR.event.prototype.fire.call( this, eventName, data, this );
|
||||
},
|
||||
|
||||
/** @ignore */
|
||||
fireOnce : function( eventName, data )
|
||||
{
|
||||
return CKEDITOR.event.prototype.fireOnce.call( this, eventName, data, this );
|
||||
}
|
||||
};
|
||||
|
||||
// "Inherit" (copy actually) from CKEDITOR.event.
|
||||
CKEDITOR.event.implementOn( CKEDITOR.editor.prototype, true );
|
||||
}
|
|
@ -1,282 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.env} object, which constains
|
||||
* environment and browser information.
|
||||
*/
|
||||
|
||||
if ( !CKEDITOR.env )
|
||||
{
|
||||
/**
|
||||
* @namespace Environment and browser information.
|
||||
*/
|
||||
CKEDITOR.env = (function()
|
||||
{
|
||||
var agent = navigator.userAgent.toLowerCase();
|
||||
var opera = window.opera;
|
||||
|
||||
var env =
|
||||
/** @lends CKEDITOR.env */
|
||||
{
|
||||
/**
|
||||
* Indicates that CKEditor is running on Internet Explorer.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.ie )
|
||||
* alert( "I'm on IE!" );
|
||||
*/
|
||||
ie : /*@cc_on!@*/false,
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on Opera.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.opera )
|
||||
* alert( "I'm on Opera!" );
|
||||
*/
|
||||
opera : ( !!opera && opera.version ),
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on a WebKit based browser, like
|
||||
* Safari.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.webkit )
|
||||
* alert( "I'm on WebKit!" );
|
||||
*/
|
||||
webkit : ( agent.indexOf( ' applewebkit/' ) > -1 ),
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on Adobe AIR.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.air )
|
||||
* alert( "I'm on AIR!" );
|
||||
*/
|
||||
air : ( agent.indexOf( ' adobeair/' ) > -1 ),
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on Macintosh.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.mac )
|
||||
* alert( "I love apples!" );
|
||||
*/
|
||||
mac : ( agent.indexOf( 'macintosh' ) > -1 ),
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on a quirks mode environemnt.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.quirks )
|
||||
* alert( "Nooooo!" );
|
||||
*/
|
||||
quirks : ( document.compatMode == 'BackCompat' ),
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on a mobile like environemnt.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.mobile )
|
||||
* alert( "I'm running with CKEditor today!" );
|
||||
*/
|
||||
mobile : ( agent.indexOf( 'mobile' ) > -1 ),
|
||||
|
||||
/**
|
||||
* Indicates that the browser has a custom domain enabled. This has
|
||||
* been set with "document.domain".
|
||||
* @returns {Boolean} "true" if a custom domain is enabled.
|
||||
* @example
|
||||
* if ( CKEDITOR.env.isCustomDomain() )
|
||||
* alert( "I'm in a custom domain!" );
|
||||
*/
|
||||
isCustomDomain : function()
|
||||
{
|
||||
if ( !this.ie )
|
||||
return false;
|
||||
|
||||
var domain = document.domain,
|
||||
hostname = window.location.hostname;
|
||||
|
||||
return domain != hostname &&
|
||||
domain != ( '[' + hostname + ']' ); // IPv6 IP support (#5434)
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on a Gecko based browser, like
|
||||
* Firefox.
|
||||
* @name CKEDITOR.env.gecko
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.gecko )
|
||||
* alert( "I'm riding a gecko!" );
|
||||
*/
|
||||
env.gecko = ( navigator.product == 'Gecko' && !env.webkit && !env.opera );
|
||||
|
||||
var version = 0;
|
||||
|
||||
// Internet Explorer 6.0+
|
||||
if ( env.ie )
|
||||
{
|
||||
version = parseFloat( agent.match( /msie (\d+)/ )[1] );
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on Internet Explorer 8.
|
||||
* @name CKEDITOR.env.ie8
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.ie8 )
|
||||
* alert( "I'm on IE8!" );
|
||||
*/
|
||||
env.ie8 = !!document.documentMode;
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on Internet Explorer 8 on
|
||||
* standards mode.
|
||||
* @name CKEDITOR.env.ie8Compat
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.ie8Compat )
|
||||
* alert( "Now I'm on IE8, for real!" );
|
||||
*/
|
||||
env.ie8Compat = document.documentMode == 8;
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on Internet Explorer 9's standards mode.
|
||||
* @name CKEDITOR.env.ie9Compat
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.ie9Compat )
|
||||
* alert( "IE9, the beauty of the web!" );
|
||||
*/
|
||||
env.ie9Compat = document.documentMode == 9;
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on an IE7-like environment, which
|
||||
* includes IE7 itself and IE8's IE7 document mode.
|
||||
* @name CKEDITOR.env.ie7Compat
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.ie8Compat )
|
||||
* alert( "I'm on IE7 or on an IE7 like IE8!" );
|
||||
*/
|
||||
env.ie7Compat = ( ( version == 7 && !document.documentMode )
|
||||
|| document.documentMode == 7 );
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on an IE6-like environment, which
|
||||
* includes IE6 itself and IE7 and IE8 quirks mode.
|
||||
* @name CKEDITOR.env.ie6Compat
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.ie6Compat )
|
||||
* alert( "I'm on IE6 or quirks mode!" );
|
||||
*/
|
||||
env.ie6Compat = ( version < 7 || env.quirks );
|
||||
}
|
||||
|
||||
// Gecko.
|
||||
if ( env.gecko )
|
||||
{
|
||||
var geckoRelease = agent.match( /rv:([\d\.]+)/ );
|
||||
if ( geckoRelease )
|
||||
{
|
||||
geckoRelease = geckoRelease[1].split( '.' );
|
||||
version = geckoRelease[0] * 10000 + ( geckoRelease[1] || 0 ) * 100 + ( geckoRelease[2] || 0 ) * 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Opera 9.50+
|
||||
if ( env.opera )
|
||||
version = parseFloat( opera.version() );
|
||||
|
||||
// Adobe AIR 1.0+
|
||||
// Checked before Safari because AIR have the WebKit rich text editor
|
||||
// features from Safari 3.0.4, but the version reported is 420.
|
||||
if ( env.air )
|
||||
version = parseFloat( agent.match( / adobeair\/(\d+)/ )[1] );
|
||||
|
||||
// WebKit 522+ (Safari 3+)
|
||||
if ( env.webkit )
|
||||
version = parseFloat( agent.match( / applewebkit\/(\d+)/ )[1] );
|
||||
|
||||
/**
|
||||
* Contains the browser version.<br />
|
||||
* <br />
|
||||
* For gecko based browsers (like Firefox) it contains the revision
|
||||
* number with first three parts concatenated with a padding zero
|
||||
* (e.g. for revision 1.9.0.2 we have 10900).<br />
|
||||
* <br />
|
||||
* For webkit based browser (like Safari and Chrome) it contains the
|
||||
* WebKit build version (e.g. 522).
|
||||
* @name CKEDITOR.env.version
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.ie && <b>CKEDITOR.env.version</b> <= 6 )
|
||||
* alert( "Ouch!" );
|
||||
*/
|
||||
env.version = version;
|
||||
|
||||
/**
|
||||
* Indicates that CKEditor is running on a compatible browser.
|
||||
* @name CKEDITOR.env.isCompatible
|
||||
* @type Boolean
|
||||
* @example
|
||||
* if ( CKEDITOR.env.isCompatible )
|
||||
* alert( "Your browser is pretty cool!" );
|
||||
*/
|
||||
env.isCompatible =
|
||||
!env.mobile && (
|
||||
( env.ie && version >= 6 ) ||
|
||||
( env.gecko && version >= 10801 ) ||
|
||||
( env.opera && version >= 9.5 ) ||
|
||||
( env.air && version >= 1 ) ||
|
||||
( env.webkit && version >= 522 ) ||
|
||||
false );
|
||||
|
||||
/**
|
||||
* The CSS class to be appended on the main UI containers, making it
|
||||
* easy to apply browser specific styles to it.
|
||||
* @name CKEDITOR.env.cssClass
|
||||
* @type String
|
||||
* @example
|
||||
* myDiv.className = CKEDITOR.env.cssClass;
|
||||
*/
|
||||
env.cssClass =
|
||||
'cke_browser_' + (
|
||||
env.ie ? 'ie' :
|
||||
env.gecko ? 'gecko' :
|
||||
env.opera ? 'opera' :
|
||||
env.webkit ? 'webkit' :
|
||||
'unknown' );
|
||||
|
||||
if ( env.quirks )
|
||||
env.cssClass += ' cke_browser_quirks';
|
||||
|
||||
if ( env.ie )
|
||||
{
|
||||
env.cssClass += ' cke_browser_ie' + (
|
||||
env.version < 7 ? '6' :
|
||||
env.version >= 8 ? document.documentMode:
|
||||
'7' );
|
||||
|
||||
if ( env.quirks )
|
||||
env.cssClass += ' cke_browser_iequirks';
|
||||
}
|
||||
|
||||
if ( env.gecko && version < 10900 )
|
||||
env.cssClass += ' cke_browser_gecko18';
|
||||
|
||||
if ( env.air )
|
||||
env.cssClass += ' cke_browser_air';
|
||||
|
||||
return env;
|
||||
})();
|
||||
}
|
||||
|
||||
// PACKAGER_RENAME( CKEDITOR.env )
|
||||
// PACKAGER_RENAME( CKEDITOR.env.ie )
|
|
@ -1,342 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.event} class, which serves as the
|
||||
* base for classes and objects that require event handling features.
|
||||
*/
|
||||
|
||||
if ( !CKEDITOR.event )
|
||||
{
|
||||
/**
|
||||
* Creates an event class instance. This constructor is rearely used, being
|
||||
* the {@link #.implementOn} function used in class prototypes directly
|
||||
* instead.
|
||||
* @class This is a base class for classes and objects that require event
|
||||
* handling features.<br />
|
||||
* <br />
|
||||
* Do not confuse this class with {@link CKEDITOR.dom.event} which is
|
||||
* instead used for DOM events. The CKEDITOR.event class implements the
|
||||
* internal event system used by the CKEditor to fire API related events.
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.event = function()
|
||||
{};
|
||||
|
||||
/**
|
||||
* Implements the {@link CKEDITOR.event} features in an object.
|
||||
* @param {Object} targetObject The object into which implement the features.
|
||||
* @example
|
||||
* var myObject = { message : 'Example' };
|
||||
* <b>CKEDITOR.event.implementOn( myObject }</b>;
|
||||
* myObject.on( 'testEvent', function()
|
||||
* {
|
||||
* alert( this.message ); // "Example"
|
||||
* });
|
||||
* myObject.fire( 'testEvent' );
|
||||
*/
|
||||
CKEDITOR.event.implementOn = function( targetObject )
|
||||
{
|
||||
var eventProto = CKEDITOR.event.prototype;
|
||||
|
||||
for ( var prop in eventProto )
|
||||
{
|
||||
if ( targetObject[ prop ] == undefined )
|
||||
targetObject[ prop ] = eventProto[ prop ];
|
||||
}
|
||||
};
|
||||
|
||||
CKEDITOR.event.prototype = (function()
|
||||
{
|
||||
// Returns the private events object for a given object.
|
||||
var getPrivate = function( obj )
|
||||
{
|
||||
var _ = ( obj.getPrivate && obj.getPrivate() ) || obj._ || ( obj._ = {} );
|
||||
return _.events || ( _.events = {} );
|
||||
};
|
||||
|
||||
var eventEntry = function( eventName )
|
||||
{
|
||||
this.name = eventName;
|
||||
this.listeners = [];
|
||||
};
|
||||
|
||||
eventEntry.prototype =
|
||||
{
|
||||
// Get the listener index for a specified function.
|
||||
// Returns -1 if not found.
|
||||
getListenerIndex : function( listenerFunction )
|
||||
{
|
||||
for ( var i = 0, listeners = this.listeners ; i < listeners.length ; i++ )
|
||||
{
|
||||
if ( listeners[i].fn == listenerFunction )
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
return /** @lends CKEDITOR.event.prototype */ {
|
||||
/**
|
||||
* Registers a listener to a specific event in the current object.
|
||||
* @param {String} eventName The event name to which listen.
|
||||
* @param {Function} listenerFunction The function listening to the
|
||||
* event. A single {@link CKEDITOR.eventInfo} object instanced
|
||||
* is passed to this function containing all the event data.
|
||||
* @param {Object} [scopeObj] The object used to scope the listener
|
||||
* call (the this object. If omitted, the current object is used.
|
||||
* @param {Object} [listenerData] Data to be sent as the
|
||||
* {@link CKEDITOR.eventInfo#listenerData} when calling the
|
||||
* listener.
|
||||
* @param {Number} [priority] The listener priority. Lower priority
|
||||
* listeners are called first. Listeners with the same priority
|
||||
* value are called in registration order. Defaults to 10.
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function()
|
||||
* {
|
||||
* alert( this == someObject ); // "true"
|
||||
* });
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function()
|
||||
* {
|
||||
* alert( this == anotherObject ); // "true"
|
||||
* }
|
||||
* , anotherObject );
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* alert( event.listenerData ); // "Example"
|
||||
* }
|
||||
* , null, 'Example' );
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function() { ... } ); // 2nd called
|
||||
* someObject.on( 'someEvent', function() { ... }, null, null, 100 ); // 3rd called
|
||||
* someObject.on( 'someEvent', function() { ... }, null, null, 1 ); // 1st called
|
||||
*/
|
||||
on : function( eventName, listenerFunction, scopeObj, listenerData, priority )
|
||||
{
|
||||
// Get the event entry (create it if needed).
|
||||
var events = getPrivate( this ),
|
||||
event = events[ eventName ] || ( events[ eventName ] = new eventEntry( eventName ) );
|
||||
|
||||
if ( event.getListenerIndex( listenerFunction ) < 0 )
|
||||
{
|
||||
// Get the listeners.
|
||||
var listeners = event.listeners;
|
||||
|
||||
// Fill the scope.
|
||||
if ( !scopeObj )
|
||||
scopeObj = this;
|
||||
|
||||
// Default the priority, if needed.
|
||||
if ( isNaN( priority ) )
|
||||
priority = 10;
|
||||
|
||||
var me = this;
|
||||
|
||||
// Create the function to be fired for this listener.
|
||||
var listenerFirer = function( editor, publisherData, stopFn, cancelFn )
|
||||
{
|
||||
var ev =
|
||||
{
|
||||
name : eventName,
|
||||
sender : this,
|
||||
editor : editor,
|
||||
data : publisherData,
|
||||
listenerData : listenerData,
|
||||
stop : stopFn,
|
||||
cancel : cancelFn,
|
||||
removeListener : function()
|
||||
{
|
||||
me.removeListener( eventName, listenerFunction );
|
||||
}
|
||||
};
|
||||
|
||||
listenerFunction.call( scopeObj, ev );
|
||||
|
||||
return ev.data;
|
||||
};
|
||||
listenerFirer.fn = listenerFunction;
|
||||
listenerFirer.priority = priority;
|
||||
|
||||
// Search for the right position for this new listener, based on its
|
||||
// priority.
|
||||
for ( var i = listeners.length - 1 ; i >= 0 ; i-- )
|
||||
{
|
||||
// Find the item which should be before the new one.
|
||||
if ( listeners[ i ].priority <= priority )
|
||||
{
|
||||
// Insert the listener in the array.
|
||||
listeners.splice( i + 1, 0, listenerFirer );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// If no position has been found (or zero length), put it in
|
||||
// the front of list.
|
||||
listeners.unshift( listenerFirer );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Fires an specific event in the object. All registered listeners are
|
||||
* called at this point.
|
||||
* @function
|
||||
* @param {String} eventName The event name to fire.
|
||||
* @param {Object} [data] Data to be sent as the
|
||||
* {@link CKEDITOR.eventInfo#data} when calling the
|
||||
* listeners.
|
||||
* @param {CKEDITOR.editor} [editor] The editor instance to send as the
|
||||
* {@link CKEDITOR.eventInfo#editor} when calling the
|
||||
* listener.
|
||||
* @returns {Boolean|Object} A booloan indicating that the event is to be
|
||||
* canceled, or data returned by one of the listeners.
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function() { ... } );
|
||||
* someObject.on( 'someEvent', function() { ... } );
|
||||
* <b>someObject.fire( 'someEvent' )</b>; // both listeners are called
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* alert( event.data ); // "Example"
|
||||
* });
|
||||
* <b>someObject.fire( 'someEvent', 'Example' )</b>;
|
||||
*/
|
||||
fire : (function()
|
||||
{
|
||||
// Create the function that marks the event as stopped.
|
||||
var stopped = false;
|
||||
var stopEvent = function()
|
||||
{
|
||||
stopped = true;
|
||||
};
|
||||
|
||||
// Create the function that marks the event as canceled.
|
||||
var canceled = false;
|
||||
var cancelEvent = function()
|
||||
{
|
||||
canceled = true;
|
||||
};
|
||||
|
||||
return function( eventName, data, editor )
|
||||
{
|
||||
// Get the event entry.
|
||||
var event = getPrivate( this )[ eventName ];
|
||||
|
||||
// Save the previous stopped and cancelled states. We may
|
||||
// be nesting fire() calls.
|
||||
var previousStopped = stopped,
|
||||
previousCancelled = canceled;
|
||||
|
||||
// Reset the stopped and canceled flags.
|
||||
stopped = canceled = false;
|
||||
|
||||
if ( event )
|
||||
{
|
||||
var listeners = event.listeners;
|
||||
|
||||
if ( listeners.length )
|
||||
{
|
||||
// As some listeners may remove themselves from the
|
||||
// event, the original array length is dinamic. So,
|
||||
// let's make a copy of all listeners, so we are
|
||||
// sure we'll call all of them.
|
||||
listeners = listeners.slice( 0 );
|
||||
|
||||
// Loop through all listeners.
|
||||
for ( var i = 0 ; i < listeners.length ; i++ )
|
||||
{
|
||||
// Call the listener, passing the event data.
|
||||
var retData = listeners[i].call( this, editor, data, stopEvent, cancelEvent );
|
||||
|
||||
if ( typeof retData != 'undefined' )
|
||||
data = retData;
|
||||
|
||||
// No further calls is stopped or canceled.
|
||||
if ( stopped || canceled )
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var ret = canceled || ( typeof data == 'undefined' ? false : data );
|
||||
|
||||
// Restore the previous stopped and canceled states.
|
||||
stopped = previousStopped;
|
||||
canceled = previousCancelled;
|
||||
|
||||
return ret;
|
||||
};
|
||||
})(),
|
||||
|
||||
/**
|
||||
* Fires an specific event in the object, releasing all listeners
|
||||
* registered to that event. The same listeners are not called again on
|
||||
* successive calls of it or of {@link #fire}.
|
||||
* @param {String} eventName The event name to fire.
|
||||
* @param {Object} [data] Data to be sent as the
|
||||
* {@link CKEDITOR.eventInfo#data} when calling the
|
||||
* listeners.
|
||||
* @param {CKEDITOR.editor} [editor] The editor instance to send as the
|
||||
* {@link CKEDITOR.eventInfo#editor} when calling the
|
||||
* listener.
|
||||
* @returns {Boolean|Object} A booloan indicating that the event is to be
|
||||
* canceled, or data returned by one of the listeners.
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function() { ... } );
|
||||
* someObject.fire( 'someEvent' ); // above listener called
|
||||
* <b>someObject.fireOnce( 'someEvent' )</b>; // above listener called
|
||||
* someObject.fire( 'someEvent' ); // no listeners called
|
||||
*/
|
||||
fireOnce : function( eventName, data, editor )
|
||||
{
|
||||
var ret = this.fire( eventName, data, editor );
|
||||
delete getPrivate( this )[ eventName ];
|
||||
return ret;
|
||||
},
|
||||
|
||||
/**
|
||||
* Unregisters a listener function from being called at the specified
|
||||
* event. No errors are thrown if the listener has not been
|
||||
* registered previously.
|
||||
* @param {String} eventName The event name.
|
||||
* @param {Function} listenerFunction The listener function to unregister.
|
||||
* @example
|
||||
* var myListener = function() { ... };
|
||||
* someObject.on( 'someEvent', myListener );
|
||||
* someObject.fire( 'someEvent' ); // myListener called
|
||||
* <b>someObject.removeListener( 'someEvent', myListener )</b>;
|
||||
* someObject.fire( 'someEvent' ); // myListener not called
|
||||
*/
|
||||
removeListener : function( eventName, listenerFunction )
|
||||
{
|
||||
// Get the event entry.
|
||||
var event = getPrivate( this )[ eventName ];
|
||||
|
||||
if ( event )
|
||||
{
|
||||
var index = event.getListenerIndex( listenerFunction );
|
||||
if ( index >= 0 )
|
||||
event.listeners.splice( index, 1 );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks if there is any listener registered to a given event.
|
||||
* @param {String} eventName The event name.
|
||||
* @example
|
||||
* var myListener = function() { ... };
|
||||
* someObject.on( 'someEvent', myListener );
|
||||
* alert( someObject.<b>hasListeners( 'someEvent' )</b> ); // "true"
|
||||
* alert( someObject.<b>hasListeners( 'noEvent' )</b> ); // "false"
|
||||
*/
|
||||
hasListeners : function( eventName )
|
||||
{
|
||||
var event = getPrivate( this )[ eventName ];
|
||||
return ( event && event.listeners.length > 0 ) ;
|
||||
}
|
||||
};
|
||||
})();
|
||||
}
|
|
@ -1,120 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the "virtual" {@link CKEDITOR.eventInfo} class, which
|
||||
* contains the defintions of the event object passed to event listeners.
|
||||
* This file is for documentation purposes only.
|
||||
*/
|
||||
|
||||
/**
|
||||
* (Virtual Class) Do not call this constructor. This class is not really part
|
||||
* of the API.
|
||||
* @class Virtual class that illustrates the features of the event object to be
|
||||
* passed to event listeners by a {@link CKEDITOR.event} based object.
|
||||
* @name CKEDITOR.eventInfo
|
||||
* @example
|
||||
* // Do not do this.
|
||||
* var myEvent = new CKEDITOR.eventInfo(); // Error: CKEDITOR.eventInfo is undefined
|
||||
*/
|
||||
|
||||
/**
|
||||
* The event name.
|
||||
* @name CKEDITOR.eventInfo.prototype.name
|
||||
* @field
|
||||
* @type String
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* alert( <b>event.name</b> ); // "someEvent"
|
||||
* });
|
||||
* someObject.fire( 'someEvent' );
|
||||
*/
|
||||
|
||||
/**
|
||||
* The object that publishes (sends) the event.
|
||||
* @name CKEDITOR.eventInfo.prototype.sender
|
||||
* @field
|
||||
* @type Object
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* alert( <b>event.sender</b> == someObject ); // "true"
|
||||
* });
|
||||
* someObject.fire( 'someEvent' );
|
||||
*/
|
||||
|
||||
/**
|
||||
* The editor instance that holds the sender. May be the same as sender. May be
|
||||
* null if the sender is not part of an editor instance, like a component
|
||||
* running in standalone mode.
|
||||
* @name CKEDITOR.eventInfo.prototype.editor
|
||||
* @field
|
||||
* @type CKEDITOR.editor
|
||||
* @example
|
||||
* myButton.on( 'someEvent', function( event )
|
||||
* {
|
||||
* alert( <b>event.editor</b> == myEditor ); // "true"
|
||||
* });
|
||||
* myButton.fire( 'someEvent', null, <b>myEditor</b> );
|
||||
*/
|
||||
|
||||
/**
|
||||
* Any kind of additional data. Its format and usage is event dependent.
|
||||
* @name CKEDITOR.eventInfo.prototype.data
|
||||
* @field
|
||||
* @type Object
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* alert( <b>event.data</b> ); // "Example"
|
||||
* });
|
||||
* someObject.fire( 'someEvent', <b>'Example'</b> );
|
||||
*/
|
||||
|
||||
/**
|
||||
* Any extra data appended during the listener registration.
|
||||
* @name CKEDITOR.eventInfo.prototype.listenerData
|
||||
* @field
|
||||
* @type Object
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* alert( <b>event.listenerData</b> ); // "Example"
|
||||
* }
|
||||
* , null, <b>'Example'</b> );
|
||||
*/
|
||||
|
||||
/**
|
||||
* Indicates that no further listeners are to be called.
|
||||
* @name CKEDITOR.eventInfo.prototype.stop
|
||||
* @function
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* <b>event.stop()</b>;
|
||||
* });
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* // This one will not be called.
|
||||
* });
|
||||
* alert( someObject.fire( 'someEvent' ) ); // "false"
|
||||
*/
|
||||
|
||||
/**
|
||||
* Indicates that the event is to be cancelled (if cancelable).
|
||||
* @name CKEDITOR.eventInfo.prototype.cancel
|
||||
* @function
|
||||
* @example
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* <b>event.cancel()</b>;
|
||||
* });
|
||||
* someObject.on( 'someEvent', function( event )
|
||||
* {
|
||||
* // This one will not be called.
|
||||
* });
|
||||
* alert( someObject.fire( 'someEvent' ) ); // "true"
|
||||
*/
|
|
@ -1,152 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.focusManager} class, which is used
|
||||
* to handle the focus on editor instances..
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates a focusManager class instance.
|
||||
* @class Manages the focus activity in an editor instance. This class is to be
|
||||
* used mainly by UI elements coders when adding interface elements that need
|
||||
* to set the focus state of the editor.
|
||||
* @param {CKEDITOR.editor} editor The editor instance.
|
||||
* @example
|
||||
* var focusManager = <b>new CKEDITOR.focusManager( editor )</b>;
|
||||
* focusManager.focus();
|
||||
*/
|
||||
CKEDITOR.focusManager = function( editor )
|
||||
{
|
||||
if ( editor.focusManager )
|
||||
return editor.focusManager;
|
||||
|
||||
/**
|
||||
* Indicates that the editor instance has focus.
|
||||
* @type Boolean
|
||||
* @example
|
||||
* alert( CKEDITOR.instances.editor1.focusManager.hasFocus ); // e.g "true"
|
||||
*/
|
||||
this.hasFocus = false;
|
||||
|
||||
/**
|
||||
* Object used to hold private stuff.
|
||||
* @private
|
||||
*/
|
||||
this._ =
|
||||
{
|
||||
editor : editor
|
||||
};
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
CKEDITOR.focusManager.prototype =
|
||||
{
|
||||
/**
|
||||
* Used to indicate that the editor instance has the focus.<br />
|
||||
* <br />
|
||||
* Note that this function will not explicitelly set the focus in the
|
||||
* editor (for example, making the caret blinking on it). Use
|
||||
* {@link CKEDITOR.editor#focus} for it instead.
|
||||
* @example
|
||||
* var editor = CKEDITOR.instances.editor1;
|
||||
* <b>editor.focusManager.focus()</b>;
|
||||
*/
|
||||
focus : function()
|
||||
{
|
||||
if ( this._.timer )
|
||||
clearTimeout( this._.timer );
|
||||
|
||||
if ( !this.hasFocus )
|
||||
{
|
||||
// If another editor has the current focus, we first "blur" it. In
|
||||
// this way the events happen in a more logical sequence, like:
|
||||
// "focus 1" > "blur 1" > "focus 2"
|
||||
// ... instead of:
|
||||
// "focus 1" > "focus 2" > "blur 1"
|
||||
if ( CKEDITOR.currentInstance )
|
||||
CKEDITOR.currentInstance.focusManager.forceBlur();
|
||||
|
||||
var editor = this._.editor;
|
||||
|
||||
editor.container.getChild( 1 ).addClass( 'cke_focus' );
|
||||
|
||||
this.hasFocus = true;
|
||||
editor.fire( 'focus' );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Used to indicate that the editor instance has lost the focus.<br />
|
||||
* <br />
|
||||
* Note that this functions acts asynchronously with a delay of 100ms to
|
||||
* avoid subsequent blur/focus effects. If you want the "blur" to happen
|
||||
* immediately, use the {@link #forceBlur} function instead.
|
||||
* @example
|
||||
* var editor = CKEDITOR.instances.editor1;
|
||||
* <b>editor.focusManager.blur()</b>;
|
||||
*/
|
||||
blur : function()
|
||||
{
|
||||
var focusManager = this;
|
||||
|
||||
if ( focusManager._.timer )
|
||||
clearTimeout( focusManager._.timer );
|
||||
|
||||
focusManager._.timer = setTimeout(
|
||||
function()
|
||||
{
|
||||
delete focusManager._.timer;
|
||||
focusManager.forceBlur();
|
||||
}
|
||||
, 100 );
|
||||
},
|
||||
|
||||
/**
|
||||
* Used to indicate that the editor instance has lost the focus. Unlike
|
||||
* {@link #blur}, this function is synchronous, marking the instance as
|
||||
* "blured" immediately.
|
||||
* @example
|
||||
* var editor = CKEDITOR.instances.editor1;
|
||||
* <b>editor.focusManager.forceBlur()</b>;
|
||||
*/
|
||||
forceBlur : function()
|
||||
{
|
||||
if ( this.hasFocus )
|
||||
{
|
||||
var editor = this._.editor;
|
||||
|
||||
editor.container.getChild( 1 ).removeClass( 'cke_focus' );
|
||||
|
||||
this.hasFocus = false;
|
||||
editor.fire( 'blur' );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Fired when the editor instance receives the input focus.
|
||||
* @name CKEDITOR.editor#focus
|
||||
* @event
|
||||
* @param {CKEDITOR.editor} editor The editor instance.
|
||||
* @example
|
||||
* editor.on( 'focus', function( e )
|
||||
* {
|
||||
* alert( 'The editor named ' + e.editor.name + ' is now focused' );
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired when the editor instance loses the input focus.
|
||||
* @name CKEDITOR.editor#blur
|
||||
* @event
|
||||
* @param {CKEDITOR.editor} editor The editor instance.
|
||||
* @example
|
||||
* editor.on( 'blur', function( e )
|
||||
* {
|
||||
* alert( 'The editor named ' + e.editor.name + ' lost the focus' );
|
||||
* });
|
||||
*/
|
|
@ -1,224 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates a {@link CKEDITOR.htmlParser} class instance.
|
||||
* @class Provides an "event like" system to parse strings of HTML data.
|
||||
* @example
|
||||
* var parser = new CKEDITOR.htmlParser();
|
||||
* parser.onTagOpen = function( tagName, attributes, selfClosing )
|
||||
* {
|
||||
* alert( tagName );
|
||||
* };
|
||||
* parser.parse( '<p>Some <b>text</b>.</p>' );
|
||||
*/
|
||||
CKEDITOR.htmlParser = function()
|
||||
{
|
||||
this._ =
|
||||
{
|
||||
htmlPartsRegex : new RegExp( '<(?:(?:\\/([^>]+)>)|(?:!--([\\S|\\s]*?)-->)|(?:([^\\s>]+)\\s*((?:(?:[^"\'>]+)|(?:"[^"]*")|(?:\'[^\']*\'))*)\\/?>))', 'g' )
|
||||
};
|
||||
};
|
||||
|
||||
(function()
|
||||
{
|
||||
var attribsRegex = /([\w\-:.]+)(?:(?:\s*=\s*(?:(?:"([^"]*)")|(?:'([^']*)')|([^\s>]+)))|(?=\s|$))/g,
|
||||
emptyAttribs = {checked:1,compact:1,declare:1,defer:1,disabled:1,ismap:1,multiple:1,nohref:1,noresize:1,noshade:1,nowrap:1,readonly:1,selected:1};
|
||||
|
||||
CKEDITOR.htmlParser.prototype =
|
||||
{
|
||||
/**
|
||||
* Function to be fired when a tag opener is found. This function
|
||||
* should be overriden when using this class.
|
||||
* @param {String} tagName The tag name. The name is guarantted to be
|
||||
* lowercased.
|
||||
* @param {Object} attributes An object containing all tag attributes. Each
|
||||
* property in this object represent and attribute name and its
|
||||
* value is the attribute value.
|
||||
* @param {Boolean} selfClosing true if the tag closes itself, false if the
|
||||
* tag doesn't.
|
||||
* @example
|
||||
* var parser = new CKEDITOR.htmlParser();
|
||||
* parser.onTagOpen = function( tagName, attributes, selfClosing )
|
||||
* {
|
||||
* alert( tagName ); // e.g. "b"
|
||||
* });
|
||||
* parser.parse( "<!-- Example --><b>Hello</b>" );
|
||||
*/
|
||||
onTagOpen : function() {},
|
||||
|
||||
/**
|
||||
* Function to be fired when a tag closer is found. This function
|
||||
* should be overriden when using this class.
|
||||
* @param {String} tagName The tag name. The name is guarantted to be
|
||||
* lowercased.
|
||||
* @example
|
||||
* var parser = new CKEDITOR.htmlParser();
|
||||
* parser.onTagClose = function( tagName )
|
||||
* {
|
||||
* alert( tagName ); // e.g. "b"
|
||||
* });
|
||||
* parser.parse( "<!-- Example --><b>Hello</b>" );
|
||||
*/
|
||||
onTagClose : function() {},
|
||||
|
||||
/**
|
||||
* Function to be fired when text is found. This function
|
||||
* should be overriden when using this class.
|
||||
* @param {String} text The text found.
|
||||
* @example
|
||||
* var parser = new CKEDITOR.htmlParser();
|
||||
* parser.onText = function( text )
|
||||
* {
|
||||
* alert( text ); // e.g. "Hello"
|
||||
* });
|
||||
* parser.parse( "<!-- Example --><b>Hello</b>" );
|
||||
*/
|
||||
onText : function() {},
|
||||
|
||||
/**
|
||||
* Function to be fired when CDATA section is found. This function
|
||||
* should be overriden when using this class.
|
||||
* @param {String} cdata The CDATA been found.
|
||||
* @example
|
||||
* var parser = new CKEDITOR.htmlParser();
|
||||
* parser.onCDATA = function( cdata )
|
||||
* {
|
||||
* alert( cdata ); // e.g. "var hello;"
|
||||
* });
|
||||
* parser.parse( "<script>var hello;</script>" );
|
||||
*/
|
||||
onCDATA : function() {},
|
||||
|
||||
/**
|
||||
* Function to be fired when a commend is found. This function
|
||||
* should be overriden when using this class.
|
||||
* @param {String} comment The comment text.
|
||||
* @example
|
||||
* var parser = new CKEDITOR.htmlParser();
|
||||
* parser.onComment = function( comment )
|
||||
* {
|
||||
* alert( comment ); // e.g. " Example "
|
||||
* });
|
||||
* parser.parse( "<!-- Example --><b>Hello</b>" );
|
||||
*/
|
||||
onComment : function() {},
|
||||
|
||||
/**
|
||||
* Parses text, looking for HTML tokens, like tag openers or closers,
|
||||
* or comments. This function fires the onTagOpen, onTagClose, onText
|
||||
* and onComment function during its execution.
|
||||
* @param {String} html The HTML to be parsed.
|
||||
* @example
|
||||
* var parser = new CKEDITOR.htmlParser();
|
||||
* // The onTagOpen, onTagClose, onText and onComment should be overriden
|
||||
* // at this point.
|
||||
* parser.parse( "<!-- Example --><b>Hello</b>" );
|
||||
*/
|
||||
parse : function( html )
|
||||
{
|
||||
var parts,
|
||||
tagName,
|
||||
nextIndex = 0,
|
||||
cdata; // The collected data inside a CDATA section.
|
||||
|
||||
while ( ( parts = this._.htmlPartsRegex.exec( html ) ) )
|
||||
{
|
||||
var tagIndex = parts.index;
|
||||
if ( tagIndex > nextIndex )
|
||||
{
|
||||
var text = html.substring( nextIndex, tagIndex );
|
||||
|
||||
if ( cdata )
|
||||
cdata.push( text );
|
||||
else
|
||||
this.onText( text );
|
||||
}
|
||||
|
||||
nextIndex = this._.htmlPartsRegex.lastIndex;
|
||||
|
||||
/*
|
||||
"parts" is an array with the following items:
|
||||
0 : The entire match for opening/closing tags and comments.
|
||||
1 : Group filled with the tag name for closing tags.
|
||||
2 : Group filled with the comment text.
|
||||
3 : Group filled with the tag name for opening tags.
|
||||
4 : Group filled with the attributes part of opening tags.
|
||||
*/
|
||||
|
||||
// Closing tag
|
||||
if ( ( tagName = parts[ 1 ] ) )
|
||||
{
|
||||
tagName = tagName.toLowerCase();
|
||||
|
||||
if ( cdata && CKEDITOR.dtd.$cdata[ tagName ] )
|
||||
{
|
||||
// Send the CDATA data.
|
||||
this.onCDATA( cdata.join('') );
|
||||
cdata = null;
|
||||
}
|
||||
|
||||
if ( !cdata )
|
||||
{
|
||||
this.onTagClose( tagName );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// If CDATA is enabled, just save the raw match.
|
||||
if ( cdata )
|
||||
{
|
||||
cdata.push( parts[ 0 ] );
|
||||
continue;
|
||||
}
|
||||
|
||||
// Opening tag
|
||||
if ( ( tagName = parts[ 3 ] ) )
|
||||
{
|
||||
tagName = tagName.toLowerCase();
|
||||
|
||||
// There are some tag names that can break things, so let's
|
||||
// simply ignore them when parsing. (#5224)
|
||||
if ( /="/.test( tagName ) )
|
||||
continue;
|
||||
|
||||
var attribs = {},
|
||||
attribMatch,
|
||||
attribsPart = parts[ 4 ],
|
||||
selfClosing = !!( attribsPart && attribsPart.charAt( attribsPart.length - 1 ) == '/' );
|
||||
|
||||
if ( attribsPart )
|
||||
{
|
||||
while ( ( attribMatch = attribsRegex.exec( attribsPart ) ) )
|
||||
{
|
||||
var attName = attribMatch[1].toLowerCase(),
|
||||
attValue = attribMatch[2] || attribMatch[3] || attribMatch[4] || '';
|
||||
|
||||
if ( !attValue && emptyAttribs[ attName ] )
|
||||
attribs[ attName ] = attName;
|
||||
else
|
||||
attribs[ attName ] = attValue;
|
||||
}
|
||||
}
|
||||
|
||||
this.onTagOpen( tagName, attribs, selfClosing );
|
||||
|
||||
// Open CDATA mode when finding the appropriate tags.
|
||||
if ( !cdata && CKEDITOR.dtd.$cdata[ tagName ] )
|
||||
cdata = [];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// Comment
|
||||
if ( ( tagName = parts[ 2 ] ) )
|
||||
this.onComment( tagName );
|
||||
}
|
||||
|
||||
if ( html.length > nextIndex )
|
||||
this.onText( html.substring( nextIndex, html.length ) );
|
||||
}
|
||||
};
|
||||
})();
|
|
@ -1,145 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.htmlParser.basicWriter = CKEDITOR.tools.createClass(
|
||||
{
|
||||
$ : function()
|
||||
{
|
||||
this._ =
|
||||
{
|
||||
output : []
|
||||
};
|
||||
},
|
||||
|
||||
proto :
|
||||
{
|
||||
/**
|
||||
* Writes the tag opening part for a opener tag.
|
||||
* @param {String} tagName The element name for this tag.
|
||||
* @param {Object} attributes The attributes defined for this tag. The
|
||||
* attributes could be used to inspect the tag.
|
||||
* @example
|
||||
* // Writes "<p".
|
||||
* writer.openTag( 'p', { class : 'MyClass', id : 'MyId' } );
|
||||
*/
|
||||
openTag : function( tagName, attributes )
|
||||
{
|
||||
this._.output.push( '<', tagName );
|
||||
},
|
||||
|
||||
/**
|
||||
* Writes the tag closing part for a opener tag.
|
||||
* @param {String} tagName The element name for this tag.
|
||||
* @param {Boolean} isSelfClose Indicates that this is a self-closing tag,
|
||||
* like "br" or "img".
|
||||
* @example
|
||||
* // Writes ">".
|
||||
* writer.openTagClose( 'p', false );
|
||||
* @example
|
||||
* // Writes " />".
|
||||
* writer.openTagClose( 'br', true );
|
||||
*/
|
||||
openTagClose : function( tagName, isSelfClose )
|
||||
{
|
||||
if ( isSelfClose )
|
||||
this._.output.push( ' />' );
|
||||
else
|
||||
this._.output.push( '>' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Writes an attribute. This function should be called after opening the
|
||||
* tag with {@link #openTagClose}.
|
||||
* @param {String} attName The attribute name.
|
||||
* @param {String} attValue The attribute value.
|
||||
* @example
|
||||
* // Writes ' class="MyClass"'.
|
||||
* writer.attribute( 'class', 'MyClass' );
|
||||
*/
|
||||
attribute : function( attName, attValue )
|
||||
{
|
||||
// Browsers don't always escape special character in attribute values. (#4683, #4719).
|
||||
if ( typeof attValue == 'string' )
|
||||
attValue = CKEDITOR.tools.htmlEncodeAttr( attValue );
|
||||
|
||||
this._.output.push( ' ', attName, '="', attValue, '"' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Writes a closer tag.
|
||||
* @param {String} tagName The element name for this tag.
|
||||
* @example
|
||||
* // Writes "</p>".
|
||||
* writer.closeTag( 'p' );
|
||||
*/
|
||||
closeTag : function( tagName )
|
||||
{
|
||||
this._.output.push( '</', tagName, '>' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Writes text.
|
||||
* @param {String} text The text value
|
||||
* @example
|
||||
* // Writes "Hello Word".
|
||||
* writer.text( 'Hello Word' );
|
||||
*/
|
||||
text : function( text )
|
||||
{
|
||||
this._.output.push( text );
|
||||
},
|
||||
|
||||
/**
|
||||
* Writes a comment.
|
||||
* @param {String} comment The comment text.
|
||||
* @example
|
||||
* // Writes "<!-- My comment -->".
|
||||
* writer.comment( ' My comment ' );
|
||||
*/
|
||||
comment : function( comment )
|
||||
{
|
||||
this._.output.push( '<!--', comment, '-->' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Writes any kind of data to the ouput.
|
||||
* @example
|
||||
* writer.write( 'This is an <b>example</b>.' );
|
||||
*/
|
||||
write : function( data )
|
||||
{
|
||||
this._.output.push( data );
|
||||
},
|
||||
|
||||
/**
|
||||
* Empties the current output buffer.
|
||||
* @example
|
||||
* writer.reset();
|
||||
*/
|
||||
reset : function()
|
||||
{
|
||||
this._.output = [];
|
||||
this._.indent = false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Empties the current output buffer.
|
||||
* @param {Boolean} reset Indicates that the {@link reset} function is to
|
||||
* be automatically called after retrieving the HTML.
|
||||
* @returns {String} The HTML written to the writer so far.
|
||||
* @example
|
||||
* var html = writer.getHtml();
|
||||
*/
|
||||
getHtml : function( reset )
|
||||
{
|
||||
var html = this._.output.join( '' );
|
||||
|
||||
if ( reset )
|
||||
this.reset();
|
||||
|
||||
return html;
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
|
||||
/**
|
||||
* A lightweight representation of HTML text.
|
||||
* @constructor
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.htmlParser.cdata = function( value )
|
||||
{
|
||||
/**
|
||||
* The CDATA value.
|
||||
* @type String
|
||||
* @example
|
||||
*/
|
||||
this.value = value;
|
||||
};
|
||||
|
||||
CKEDITOR.htmlParser.cdata.prototype =
|
||||
{
|
||||
/**
|
||||
* CDATA has the same type as {@link CKEDITOR.htmlParser.text} This is
|
||||
* a constant value set to {@link CKEDITOR.NODE_TEXT}.
|
||||
* @type Number
|
||||
* @example
|
||||
*/
|
||||
type : CKEDITOR.NODE_TEXT,
|
||||
|
||||
/**
|
||||
* Writes write the CDATA with no special manipulations.
|
||||
* @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
|
||||
*/
|
||||
writeHtml : function( writer )
|
||||
{
|
||||
writer.write( this.value );
|
||||
}
|
||||
};
|
||||
})();
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* A lightweight representation of an HTML comment.
|
||||
* @constructor
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.htmlParser.comment = function( value )
|
||||
{
|
||||
/**
|
||||
* The comment text.
|
||||
* @type String
|
||||
* @example
|
||||
*/
|
||||
this.value = value;
|
||||
|
||||
/** @private */
|
||||
this._ =
|
||||
{
|
||||
isBlockLike : false
|
||||
};
|
||||
};
|
||||
|
||||
CKEDITOR.htmlParser.comment.prototype =
|
||||
{
|
||||
/**
|
||||
* The node type. This is a constant value set to {@link CKEDITOR.NODE_COMMENT}.
|
||||
* @type Number
|
||||
* @example
|
||||
*/
|
||||
type : CKEDITOR.NODE_COMMENT,
|
||||
|
||||
/**
|
||||
* Writes the HTML representation of this comment to a CKEDITOR.htmlWriter.
|
||||
* @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
|
||||
* @example
|
||||
*/
|
||||
writeHtml : function( writer, filter )
|
||||
{
|
||||
var comment = this.value;
|
||||
|
||||
if ( filter )
|
||||
{
|
||||
if ( !( comment = filter.onComment( comment, this ) ) )
|
||||
return;
|
||||
|
||||
if ( typeof comment != 'string' )
|
||||
{
|
||||
comment.parent = this.parent;
|
||||
comment.writeHtml( writer, filter );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
writer.comment( comment );
|
||||
}
|
||||
};
|
|
@ -1,249 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, 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[ 'data-cke-real-element-type' ] || name || '';
|
||||
|
||||
// Reveal the real semantic of our internal custom tag name (#6639).
|
||||
var internalTag = tagName.match( /^cke:(.*)/ );
|
||||
internalTag && ( tagName = internalTag[ 1 ] );
|
||||
|
||||
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(), 0, element.clone() ).children;
|
||||
isChildrenFiltered = 1;
|
||||
}
|
||||
};
|
||||
|
||||
if ( filter )
|
||||
{
|
||||
while ( true )
|
||||
{
|
||||
if ( !( writeName = filter.onElementName( writeName ) ) )
|
||||
return;
|
||||
|
||||
element.name = writeName;
|
||||
|
||||
if ( !( element = filter.onElement( element ) ) )
|
||||
return;
|
||||
|
||||
element.parent = this.parent;
|
||||
|
||||
if ( element.name == writeName )
|
||||
break;
|
||||
|
||||
// If the element has been replaced with something of a
|
||||
// different type, then make the replacement write itself.
|
||||
if ( element.type != CKEDITOR.NODE_ELEMENT )
|
||||
{
|
||||
element.writeHtml( writer, filter );
|
||||
return;
|
||||
}
|
||||
|
||||
writeName = element.name;
|
||||
|
||||
// This indicate that the element has been dropped by
|
||||
// filter but not the children.
|
||||
if ( !writeName )
|
||||
{
|
||||
this.writeChildrenHtml.call( element, writer, isChildrenFiltered ? null : filter );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// The element may have been changed, so update the local
|
||||
// references.
|
||||
attributes = element.attributes;
|
||||
}
|
||||
|
||||
// Open element tag.
|
||||
writer.openTag( writeName, attributes );
|
||||
|
||||
// Copy all attributes to an array.
|
||||
var attribsArray = [];
|
||||
// Iterate over the attributes twice since filters may alter
|
||||
// other attributes.
|
||||
for ( var i = 0 ; i < 2; i++ )
|
||||
{
|
||||
for ( a in attributes )
|
||||
{
|
||||
newAttrName = a;
|
||||
value = attributes[ a ];
|
||||
if ( i == 1 )
|
||||
attribsArray.push( [ a, value ] );
|
||||
else if ( filter )
|
||||
{
|
||||
while ( true )
|
||||
{
|
||||
if ( !( newAttrName = filter.onAttributeName( a ) ) )
|
||||
{
|
||||
delete attributes[ a ];
|
||||
break;
|
||||
}
|
||||
else if ( newAttrName != a )
|
||||
{
|
||||
delete attributes[ a ];
|
||||
a = newAttrName;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
if ( newAttrName )
|
||||
{
|
||||
if ( ( value = filter.onAttribute( element, newAttrName, value ) ) === false )
|
||||
delete attributes[ newAttrName ];
|
||||
else
|
||||
attributes [ newAttrName ] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Sort the attributes by name.
|
||||
if ( writer.sortAttributes )
|
||||
attribsArray.sort( sortAttribs );
|
||||
|
||||
// Send the attributes.
|
||||
var len = attribsArray.length;
|
||||
for ( i = 0 ; i < len ; i++ )
|
||||
{
|
||||
var attrib = attribsArray[ i ];
|
||||
writer.attribute( attrib[0], attrib[1] );
|
||||
}
|
||||
|
||||
// Close the tag.
|
||||
writer.openTagClose( writeName, element.isEmpty );
|
||||
|
||||
if ( !element.isEmpty )
|
||||
{
|
||||
this.writeChildrenHtml.call( element, writer, isChildrenFiltered ? null : filter );
|
||||
// Close the element.
|
||||
writer.closeTag( writeName );
|
||||
}
|
||||
},
|
||||
|
||||
writeChildrenHtml : function( writer, filter )
|
||||
{
|
||||
// Send children.
|
||||
CKEDITOR.htmlParser.fragment.prototype.writeChildrenHtml.apply( this, arguments );
|
||||
|
||||
}
|
||||
};
|
||||
})();
|
|
@ -1,288 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, 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();
|
||||
}
|
||||
};
|
||||
*/
|
|
@ -1,492 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, 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( '<b>Sample</b> 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()
|
||||
{
|
||||
// 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 );
|
||||
|
||||
var listBlocks = { ol:1, ul:1 };
|
||||
|
||||
// Dtd of the fragment element, basically it accept anything except for intermediate structure, e.g. orphan <li>.
|
||||
var rootDtd = CKEDITOR.tools.extend( {}, { html: 1 }, CKEDITOR.dtd.html, CKEDITOR.dtd.body, CKEDITOR.dtd.head, { style:1,script:1 } );
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @param {CKEDITOR.htmlParser.element} contextNode Parse the html as the content of this element.
|
||||
* @returns CKEDITOR.htmlParser.fragment The fragment created.
|
||||
* @example
|
||||
* var fragment = CKEDITOR.htmlParser.fragment.fromHtml( '<b>Sample</b> Text' );
|
||||
* alert( fragment.children[0].name ); "b"
|
||||
* alert( fragment.children[1].value ); " Text"
|
||||
*/
|
||||
CKEDITOR.htmlParser.fragment.fromHtml = function( fragmentHtml, fixForBody, contextNode )
|
||||
{
|
||||
var parser = new CKEDITOR.htmlParser(),
|
||||
fragment = contextNode || new CKEDITOR.htmlParser.fragment(),
|
||||
pendingInline = [],
|
||||
pendingBRs = [],
|
||||
currentNode = fragment,
|
||||
// Indicate we're inside a <pre> element, spaces should be touched differently.
|
||||
inPre = false;
|
||||
|
||||
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() );
|
||||
}
|
||||
|
||||
/*
|
||||
* Beside of simply append specified element to target, this function also takes
|
||||
* care of other dirty lifts like forcing block in body, trimming spaces at
|
||||
* the block boundaries etc.
|
||||
*
|
||||
* @param {Element} element The element to be added as the last child of {@link target}.
|
||||
* @param {Element} target The parent element to relieve the new node.
|
||||
* @param {Boolean} [moveCurrent=false] Don't change the "currentNode" global unless
|
||||
* there's a return point node specified on the element, otherwise move current onto {@link target} node.
|
||||
*/
|
||||
function addElement( element, target, moveCurrent )
|
||||
{
|
||||
// Ignore any element that has already been added.
|
||||
if ( element.previous !== undefined )
|
||||
return;
|
||||
|
||||
target = target || currentNode || fragment;
|
||||
|
||||
// Current element might be mangled by fix body below,
|
||||
// save it for restore later.
|
||||
var savedCurrent = currentNode;
|
||||
|
||||
// If the target is the fragment and this inline element can't go inside
|
||||
// body (if fixForBody).
|
||||
if ( fixForBody && ( !target.type || target.name == 'body' ) )
|
||||
{
|
||||
var elementName, realElementName;
|
||||
if ( element.attributes
|
||||
&& ( realElementName =
|
||||
element.attributes[ 'data-cke-real-element-type' ] ) )
|
||||
elementName = realElementName;
|
||||
else
|
||||
elementName = element.name;
|
||||
|
||||
if ( elementName && !( elementName in CKEDITOR.dtd.$body || elementName == 'body' || element.isOrphan ) )
|
||||
{
|
||||
// Create a <p> in the fragment.
|
||||
currentNode = target;
|
||||
parser.onTagOpen( fixForBody, {} );
|
||||
|
||||
// The new target now is the <p>.
|
||||
element.returnPoint = target = currentNode;
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
else
|
||||
currentNode = moveCurrent ? target : savedCurrent;
|
||||
}
|
||||
|
||||
parser.onTagOpen = function( tagName, attributes, selfClosing, optionalClose )
|
||||
{
|
||||
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;
|
||||
|
||||
element.isOptionalClose = optionalClose;
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
var currentName = currentNode.name;
|
||||
|
||||
var currentDtd = currentName ? ( CKEDITOR.dtd[ currentName ]
|
||||
|| ( currentNode._.isBlockLike ? CKEDITOR.dtd.div : CKEDITOR.dtd.span ) )
|
||||
: rootDtd;
|
||||
|
||||
// If the element cannot be child of the current element.
|
||||
if ( !element.isUnknown && !currentNode.isUnknown && !currentDtd[ tagName ] )
|
||||
{
|
||||
// Current node doesn't have a close tag, time for a close
|
||||
// as this element isn't fit in. (#7497)
|
||||
if ( currentNode.isOptionalClose )
|
||||
parser.onTagClose( currentName );
|
||||
// Fixing malformed nested lists by moving it into a previous list item. (#3828)
|
||||
else 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 == 'li' ) )
|
||||
addElement( ( lastChild = new CKEDITOR.htmlParser.element( 'li' ) ), currentNode );
|
||||
|
||||
!element.returnPoint && ( element.returnPoint = currentNode );
|
||||
currentNode = lastChild;
|
||||
}
|
||||
// Establish new list root for orphan list items.
|
||||
else if ( tagName in CKEDITOR.dtd.$listItem && currentName != tagName )
|
||||
parser.onTagOpen( tagName == 'li' ? 'ul' : 'dl', {}, 0, 1 );
|
||||
// We're inside a structural block like table and list, AND the incoming element
|
||||
// is not of the same type (e.g. <td>td1<td>td2</td>), we simply add this new one before it,
|
||||
// and most importantly, return back to here once this element is added,
|
||||
// e.g. <table><tr><td>td1</td><p>p1</p><td>td2</td></tr></table>
|
||||
else if ( currentName in nonBreakingBlocks && currentName != tagName )
|
||||
{
|
||||
!element.returnPoint && ( element.returnPoint = currentNode );
|
||||
currentNode = currentNode.parent;
|
||||
}
|
||||
else
|
||||
{
|
||||
// The current element is an inline element, which
|
||||
// need to be continued even after the close, so put
|
||||
// it in the pending list.
|
||||
if ( currentName in CKEDITOR.dtd.$inline )
|
||||
pendingInline.unshift( currentNode );
|
||||
|
||||
// The most common case where we just need to close the
|
||||
// current one and append the new one to the parent.
|
||||
if ( currentNode.parent )
|
||||
addElement( currentNode, currentNode.parent, 1 );
|
||||
// We've tried our best to fix the embarrassment here, while
|
||||
// this element still doesn't find it's parent, mark it as
|
||||
// orphan and show our tolerance to it.
|
||||
else
|
||||
{
|
||||
element.isOrphan = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
checkPending( tagName );
|
||||
sendPendingBRs();
|
||||
|
||||
element.parent = currentNode;
|
||||
|
||||
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 != fragment && 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 );
|
||||
|
||||
// Make sure return point is properly restored.
|
||||
candidate = candidate.returnPoint || candidate.parent;
|
||||
}
|
||||
|
||||
if ( candidate != fragment )
|
||||
{
|
||||
// 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 <pre>.
|
||||
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, {}, 0, 1 );
|
||||
}
|
||||
|
||||
// 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 )
|
||||
{
|
||||
sendPendingBRs();
|
||||
checkPending();
|
||||
currentNode.add( new CKEDITOR.htmlParser.comment( comment ) );
|
||||
};
|
||||
|
||||
// Parse it.
|
||||
parser.parse( fragmentHtml );
|
||||
|
||||
// Send all pending BRs except one, which we consider a unwanted bogus. (#5293)
|
||||
sendPendingBRs( !CKEDITOR.env.ie && 1 );
|
||||
|
||||
// Close all pending nodes, make sure return point is properly restored.
|
||||
while ( currentNode != fragment )
|
||||
addElement( currentNode, currentNode.parent, 1 );
|
||||
|
||||
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 );
|
||||
}
|
||||
};
|
||||
})();
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, 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 );
|
||||
}
|
||||
};
|
||||
})();
|
|
@ -1,156 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
var loadedLangs = {};
|
||||
|
||||
/**
|
||||
* @namespace Holds language related functions.
|
||||
*/
|
||||
CKEDITOR.lang =
|
||||
{
|
||||
/**
|
||||
* The list of languages available in the editor core.
|
||||
* @type Object
|
||||
* @example
|
||||
* alert( CKEDITOR.lang.en ); // "true"
|
||||
*/
|
||||
languages :
|
||||
{
|
||||
'af' : 1,
|
||||
'ar' : 1,
|
||||
'bg' : 1,
|
||||
'bn' : 1,
|
||||
'bs' : 1,
|
||||
'ca' : 1,
|
||||
'cs' : 1,
|
||||
'cy' : 1,
|
||||
'da' : 1,
|
||||
'de' : 1,
|
||||
'el' : 1,
|
||||
'en-au' : 1,
|
||||
'en-ca' : 1,
|
||||
'en-gb' : 1,
|
||||
'en' : 1,
|
||||
'eo' : 1,
|
||||
'es' : 1,
|
||||
'et' : 1,
|
||||
'eu' : 1,
|
||||
'fa' : 1,
|
||||
'fi' : 1,
|
||||
'fo' : 1,
|
||||
'fr-ca' : 1,
|
||||
'fr' : 1,
|
||||
'gl' : 1,
|
||||
'gu' : 1,
|
||||
'he' : 1,
|
||||
'hi' : 1,
|
||||
'hr' : 1,
|
||||
'hu' : 1,
|
||||
'is' : 1,
|
||||
'it' : 1,
|
||||
'ja' : 1,
|
||||
'km' : 1,
|
||||
'ko' : 1,
|
||||
'lt' : 1,
|
||||
'lv' : 1,
|
||||
'mn' : 1,
|
||||
'ms' : 1,
|
||||
'nb' : 1,
|
||||
'nl' : 1,
|
||||
'no' : 1,
|
||||
'pl' : 1,
|
||||
'pt-br' : 1,
|
||||
'pt' : 1,
|
||||
'ro' : 1,
|
||||
'ru' : 1,
|
||||
'sk' : 1,
|
||||
'sl' : 1,
|
||||
'sr-latn' : 1,
|
||||
'sr' : 1,
|
||||
'sv' : 1,
|
||||
'th' : 1,
|
||||
'tr' : 1,
|
||||
'uk' : 1,
|
||||
'vi' : 1,
|
||||
'zh-cn' : 1,
|
||||
'zh' : 1
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads a specific language file, or auto detect it. A callback is
|
||||
* then called when the file gets loaded.
|
||||
* @param {String} languageCode The code of the language file to be
|
||||
* loaded. If null or empty, autodetection will be performed. The
|
||||
* same happens if the language is not supported.
|
||||
* @param {String} defaultLanguage The language to be used if
|
||||
* languageCode is not supported or if the autodetection fails.
|
||||
* @param {Function} callback A function to be called once the
|
||||
* language file is loaded. Two parameters are passed to this
|
||||
* function: the language code and the loaded language entries.
|
||||
* @example
|
||||
*/
|
||||
load : function( languageCode, defaultLanguage, callback )
|
||||
{
|
||||
// If no languageCode - fallback to browser or default.
|
||||
// If languageCode - fallback to no-localized version or default.
|
||||
if ( !languageCode || !CKEDITOR.lang.languages[ languageCode ] )
|
||||
languageCode = this.detect( defaultLanguage, languageCode );
|
||||
|
||||
if ( !this[ languageCode ] )
|
||||
{
|
||||
CKEDITOR.scriptLoader.load( CKEDITOR.getUrl(
|
||||
'_source/' + // @Packager.RemoveLine
|
||||
'lang/' + languageCode + '.js' ),
|
||||
function()
|
||||
{
|
||||
callback( languageCode, this[ languageCode ] );
|
||||
}
|
||||
, this );
|
||||
}
|
||||
else
|
||||
callback( languageCode, this[ languageCode ] );
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the language that best fit the user language. For example,
|
||||
* suppose that the user language is "pt-br". If this language is
|
||||
* supported by the editor, it is returned. Otherwise, if only "pt" is
|
||||
* supported, it is returned instead. If none of the previous are
|
||||
* supported, a default language is then returned.
|
||||
* @param {String} defaultLanguage The default language to be returned
|
||||
* if the user language is not supported.
|
||||
* @param {String} [probeLanguage] A language code to try to use,
|
||||
* instead of the browser based autodetection.
|
||||
* @returns {String} The detected language code.
|
||||
* @example
|
||||
* alert( CKEDITOR.lang.detect( 'en' ) ); // e.g., in a German browser: "de"
|
||||
*/
|
||||
detect : function( defaultLanguage, probeLanguage )
|
||||
{
|
||||
var languages = this.languages;
|
||||
probeLanguage = probeLanguage || navigator.userLanguage || navigator.language;
|
||||
|
||||
var parts = probeLanguage
|
||||
.toLowerCase()
|
||||
.match( /([a-z]+)(?:-([a-z]+))?/ ),
|
||||
lang = parts[1],
|
||||
locale = parts[2];
|
||||
|
||||
if ( languages[ lang + '-' + locale ] )
|
||||
lang = lang + '-' + locale;
|
||||
else if ( !languages[ lang ] )
|
||||
lang = null;
|
||||
|
||||
CKEDITOR.lang.detect = lang ?
|
||||
function() { return lang; } :
|
||||
function( defaultLanguage ) { return defaultLanguage; };
|
||||
|
||||
return lang || defaultLanguage;
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
|
@ -1,240 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.loader} objects, which is used to
|
||||
* load core scripts and their dependencies from _source.
|
||||
*/
|
||||
|
||||
if ( typeof CKEDITOR == 'undefined' )
|
||||
CKEDITOR = {};
|
||||
|
||||
if ( !CKEDITOR.loader )
|
||||
{
|
||||
/**
|
||||
* Load core scripts and their dependencies from _source.
|
||||
* @namespace
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.loader = (function()
|
||||
{
|
||||
// Table of script names and their dependencies.
|
||||
var scripts =
|
||||
{
|
||||
'core/_bootstrap' : [ 'core/config', 'core/ckeditor', 'core/plugins', 'core/scriptloader', 'core/tools', /* The following are entries that we want to force loading at the end to avoid dependence recursion */ 'core/dom/comment', 'core/dom/elementpath', 'core/dom/text', 'core/dom/rangelist' ],
|
||||
'core/ckeditor' : [ 'core/ckeditor_basic', 'core/dom', 'core/dtd', 'core/dom/document', 'core/dom/element', 'core/editor', 'core/event', 'core/htmlparser', 'core/htmlparser/element', 'core/htmlparser/fragment', 'core/htmlparser/filter', 'core/htmlparser/basicwriter', 'core/tools' ],
|
||||
'core/ckeditor_base' : [],
|
||||
'core/ckeditor_basic' : [ 'core/editor_basic', 'core/env', 'core/event' ],
|
||||
'core/command' : [],
|
||||
'core/config' : [ 'core/ckeditor_base' ],
|
||||
'core/dom' : [],
|
||||
'core/dom/comment' : [ 'core/dom/node' ],
|
||||
'core/dom/document' : [ 'core/dom', 'core/dom/domobject', 'core/dom/window' ],
|
||||
'core/dom/documentfragment' : [ 'core/dom/element' ],
|
||||
'core/dom/element' : [ 'core/dom', 'core/dom/document', 'core/dom/domobject', 'core/dom/node', 'core/dom/nodelist', 'core/tools' ],
|
||||
'core/dom/elementpath' : [ 'core/dom/element' ],
|
||||
'core/dom/event' : [],
|
||||
'core/dom/node' : [ 'core/dom/domobject', 'core/tools' ],
|
||||
'core/dom/nodelist' : [ 'core/dom/node' ],
|
||||
'core/dom/domobject' : [ 'core/dom/event' ],
|
||||
'core/dom/range' : [ 'core/dom/document', 'core/dom/documentfragment', 'core/dom/element', 'core/dom/walker' ],
|
||||
'core/dom/rangelist' : [ 'core/dom/range' ],
|
||||
'core/dom/text' : [ 'core/dom/node', 'core/dom/domobject' ],
|
||||
'core/dom/walker' : [ 'core/dom/node' ],
|
||||
'core/dom/window' : [ 'core/dom/domobject' ],
|
||||
'core/dtd' : [ 'core/tools' ],
|
||||
'core/editor' : [ 'core/command', 'core/config', 'core/editor_basic', 'core/focusmanager', 'core/lang', 'core/plugins', 'core/skins', 'core/themes', 'core/tools', 'core/ui' ],
|
||||
'core/editor_basic' : [ 'core/event' ],
|
||||
'core/env' : [],
|
||||
'core/event' : [],
|
||||
'core/focusmanager' : [],
|
||||
'core/htmlparser' : [],
|
||||
'core/htmlparser/comment' : [ 'core/htmlparser' ],
|
||||
'core/htmlparser/element' : [ 'core/htmlparser', 'core/htmlparser/fragment' ],
|
||||
'core/htmlparser/fragment' : [ 'core/htmlparser', 'core/htmlparser/comment', 'core/htmlparser/text', 'core/htmlparser/cdata' ],
|
||||
'core/htmlparser/text' : [ 'core/htmlparser' ],
|
||||
'core/htmlparser/cdata' : [ 'core/htmlparser' ],
|
||||
'core/htmlparser/filter' : [ 'core/htmlparser' ],
|
||||
'core/htmlparser/basicwriter': [ 'core/htmlparser' ],
|
||||
'core/lang' : [],
|
||||
'core/plugins' : [ 'core/resourcemanager' ],
|
||||
'core/resourcemanager' : [ 'core/scriptloader', 'core/tools' ],
|
||||
'core/scriptloader' : [ 'core/dom/element', 'core/env' ],
|
||||
'core/skins' : [ 'core/scriptloader' ],
|
||||
'core/themes' : [ 'core/resourcemanager' ],
|
||||
'core/tools' : [ 'core/env' ],
|
||||
'core/ui' : []
|
||||
};
|
||||
|
||||
var basePath = (function()
|
||||
{
|
||||
// This is a copy of CKEDITOR.basePath, but requires the script having
|
||||
// "_source/core/loader.js".
|
||||
if ( CKEDITOR && CKEDITOR.basePath )
|
||||
return CKEDITOR.basePath;
|
||||
|
||||
// Find out the editor directory path, based on its <script> tag.
|
||||
var path = '';
|
||||
var scripts = document.getElementsByTagName( 'script' );
|
||||
|
||||
for ( var i = 0 ; i < scripts.length ; i++ )
|
||||
{
|
||||
var match = scripts[i].src.match( /(^|.*?[\\\/])(?:_source\/)?core\/loader.js(?:\?.*)?$/i );
|
||||
|
||||
if ( match )
|
||||
{
|
||||
path = match[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// In IE (only) the script.src string is the raw valued entered in the
|
||||
// HTML. Other browsers return the full resolved URL instead.
|
||||
if ( path.indexOf('://') == -1 )
|
||||
{
|
||||
// Absolute path.
|
||||
if ( path.indexOf( '/' ) === 0 )
|
||||
path = location.href.match( /^.*?:\/\/[^\/]*/ )[0] + path;
|
||||
// Relative path.
|
||||
else
|
||||
path = location.href.match( /^[^\?]*\// )[0] + path;
|
||||
}
|
||||
|
||||
return path;
|
||||
})();
|
||||
|
||||
var timestamp = 'B37D54V';
|
||||
|
||||
var getUrl = function( resource )
|
||||
{
|
||||
if ( CKEDITOR && CKEDITOR.getUrl )
|
||||
return CKEDITOR.getUrl( resource );
|
||||
|
||||
return basePath + resource +
|
||||
( resource.indexOf( '?' ) >= 0 ? '&' : '?' ) +
|
||||
't=' + timestamp;
|
||||
};
|
||||
|
||||
var pendingLoad = [];
|
||||
|
||||
/** @lends CKEDITOR.loader */
|
||||
return {
|
||||
/**
|
||||
* The list of loaded scripts in their loading order.
|
||||
* @type Array
|
||||
* @example
|
||||
* // Alert the loaded script names.
|
||||
* alert( <b>CKEDITOR.loader.loadedScripts</b> );
|
||||
*/
|
||||
loadedScripts : [],
|
||||
|
||||
loadPending : function()
|
||||
{
|
||||
var scriptName = pendingLoad.shift();
|
||||
|
||||
if ( !scriptName )
|
||||
return;
|
||||
|
||||
var scriptSrc = getUrl( '_source/' + scriptName + '.js' );
|
||||
|
||||
var script = document.createElement( 'script' );
|
||||
script.type = 'text/javascript';
|
||||
script.src = scriptSrc;
|
||||
|
||||
function onScriptLoaded()
|
||||
{
|
||||
// Append this script to the list of loaded scripts.
|
||||
CKEDITOR.loader.loadedScripts.push( scriptName );
|
||||
|
||||
// Load the next.
|
||||
CKEDITOR.loader.loadPending();
|
||||
}
|
||||
|
||||
// We must guarantee the execution order of the scripts, so we
|
||||
// need to load them one by one. (#4145)
|
||||
// The following if/else block has been taken from the scriptloader core code.
|
||||
if ( typeof(script.onreadystatechange) !== "undefined" )
|
||||
{
|
||||
/** @ignore */
|
||||
script.onreadystatechange = function()
|
||||
{
|
||||
if ( script.readyState == 'loaded' || script.readyState == 'complete' )
|
||||
{
|
||||
script.onreadystatechange = null;
|
||||
onScriptLoaded();
|
||||
}
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
/** @ignore */
|
||||
script.onload = function()
|
||||
{
|
||||
// Some browsers, such as Safari, may call the onLoad function
|
||||
// immediately. Which will break the loading sequence. (#3661)
|
||||
setTimeout( function() { onScriptLoaded( scriptName ); }, 0 );
|
||||
};
|
||||
}
|
||||
|
||||
document.body.appendChild( script );
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads a specific script, including its dependencies. This is not a
|
||||
* synchronous loading, which means that the code to be loaded will
|
||||
* not necessarily be available after this call.
|
||||
* @example
|
||||
* CKEDITOR.loader.load( 'core/dom/element' );
|
||||
*/
|
||||
load : function( scriptName, defer )
|
||||
{
|
||||
// Check if the script has already been loaded.
|
||||
if ( scriptName in this.loadedScripts )
|
||||
return;
|
||||
|
||||
// Get the script dependencies list.
|
||||
var dependencies = scripts[ scriptName ];
|
||||
if ( !dependencies )
|
||||
throw 'The script name"' + scriptName + '" is not defined.';
|
||||
|
||||
// Mark the script as loaded, even before really loading it, to
|
||||
// avoid cross references recursion.
|
||||
this.loadedScripts[ scriptName ] = true;
|
||||
|
||||
// Load all dependencies first.
|
||||
for ( var i = 0 ; i < dependencies.length ; i++ )
|
||||
this.load( dependencies[ i ], true );
|
||||
|
||||
var scriptSrc = getUrl( '_source/' + scriptName + '.js' );
|
||||
|
||||
// Append the <script> element to the DOM.
|
||||
// If the page is fully loaded, we can't use document.write
|
||||
// but if the script is run while the body is loading then it's safe to use it
|
||||
// Unfortunately, Firefox <3.6 doesn't support document.readyState, so it won't get this improvement
|
||||
if ( document.body && (!document.readyState || document.readyState == 'complete') )
|
||||
{
|
||||
pendingLoad.push( scriptName );
|
||||
|
||||
if ( !defer )
|
||||
this.loadPending();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Append this script to the list of loaded scripts.
|
||||
this.loadedScripts.push( scriptName );
|
||||
|
||||
document.write( '<script src="' + scriptSrc + '" type="text/javascript"><\/script>' );
|
||||
}
|
||||
}
|
||||
};
|
||||
})();
|
||||
}
|
||||
|
||||
// Check if any script has been defined for autoload.
|
||||
if ( CKEDITOR._autoLoad )
|
||||
{
|
||||
CKEDITOR.loader.load( CKEDITOR._autoLoad );
|
||||
delete CKEDITOR._autoLoad;
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the "virtual" {@link CKEDITOR.pluginDefinition} class, which
|
||||
* contains the defintion of a plugin. This file is for documentation
|
||||
* purposes only.
|
||||
*/
|
||||
|
||||
/**
|
||||
* (Virtual Class) Do not call this constructor. This class is not really part
|
||||
* of the API. It just illustrates the features of plugin objects to be
|
||||
* passed to the {@link CKEDITOR.plugins.add} function.
|
||||
* @name CKEDITOR.pluginDefinition
|
||||
* @constructor
|
||||
* @example
|
||||
*/
|
||||
|
||||
/**
|
||||
* A list of plugins that are required by this plugin. Note that this property
|
||||
* doesn't guarantee the loading order of the plugins.
|
||||
* @name CKEDITOR.pluginDefinition.prototype.requires
|
||||
* @type Array
|
||||
* @example
|
||||
* CKEDITOR.plugins.add( 'sample',
|
||||
* {
|
||||
* requires : [ 'button', 'selection' ]
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Function called on initialization of every editor instance created in the
|
||||
* page before the init() call task. The beforeInit function will be called for
|
||||
* all plugins, after that the init function is called for all of them. This
|
||||
* feature makes it possible to initialize things that could be used in the
|
||||
* init function of other plugins.
|
||||
* @name CKEDITOR.pluginDefinition.prototype.beforeInit
|
||||
* @function
|
||||
* @param {CKEDITOR.editor} editor The editor instance being initialized.
|
||||
* @example
|
||||
* CKEDITOR.plugins.add( 'sample',
|
||||
* {
|
||||
* beforeInit : function( editor )
|
||||
* {
|
||||
* alert( 'Editor "' + editor.name + '" is to be initialized!' );
|
||||
* }
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Function called on initialization of every editor instance created in the
|
||||
* page.
|
||||
* @name CKEDITOR.pluginDefinition.prototype.init
|
||||
* @function
|
||||
* @param {CKEDITOR.editor} editor The editor instance being initialized.
|
||||
* @example
|
||||
* CKEDITOR.plugins.add( 'sample',
|
||||
* {
|
||||
* init : function( editor )
|
||||
* {
|
||||
* alert( 'Editor "' + editor.name + '" is being initialized!' );
|
||||
* }
|
||||
* });
|
||||
*/
|
|
@ -1,89 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.plugins} object, which is used to
|
||||
* manage plugins registration and loading.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Manages plugins registration and loading.
|
||||
* @namespace
|
||||
* @augments CKEDITOR.resourceManager
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.plugins = new CKEDITOR.resourceManager(
|
||||
'_source/' + // @Packager.RemoveLine
|
||||
'plugins/', 'plugin' );
|
||||
|
||||
// PACKAGER_RENAME( CKEDITOR.plugins )
|
||||
|
||||
CKEDITOR.plugins.load = CKEDITOR.tools.override( CKEDITOR.plugins.load, function( originalLoad )
|
||||
{
|
||||
return function( name, callback, scope )
|
||||
{
|
||||
var allPlugins = {};
|
||||
|
||||
var loadPlugins = function( names )
|
||||
{
|
||||
originalLoad.call( this, names, function( plugins )
|
||||
{
|
||||
CKEDITOR.tools.extend( allPlugins, plugins );
|
||||
|
||||
var requiredPlugins = [];
|
||||
for ( var pluginName in plugins )
|
||||
{
|
||||
var plugin = plugins[ pluginName ],
|
||||
requires = plugin && plugin.requires;
|
||||
|
||||
if ( requires )
|
||||
{
|
||||
for ( var i = 0 ; i < requires.length ; i++ )
|
||||
{
|
||||
if ( !allPlugins[ requires[ i ] ] )
|
||||
requiredPlugins.push( requires[ i ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( requiredPlugins.length )
|
||||
loadPlugins.call( this, requiredPlugins );
|
||||
else
|
||||
{
|
||||
// Call the "onLoad" function for all plugins.
|
||||
for ( pluginName in allPlugins )
|
||||
{
|
||||
plugin = allPlugins[ pluginName ];
|
||||
if ( plugin.onLoad && !plugin.onLoad._called )
|
||||
{
|
||||
plugin.onLoad();
|
||||
plugin.onLoad._called = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Call the callback.
|
||||
if ( callback )
|
||||
callback.call( scope || window, allPlugins );
|
||||
}
|
||||
}
|
||||
, this);
|
||||
|
||||
};
|
||||
|
||||
loadPlugins.call( this, name );
|
||||
};
|
||||
});
|
||||
|
||||
CKEDITOR.plugins.setLang = function( pluginName, languageCode, languageEntries )
|
||||
{
|
||||
var plugin = this.get( pluginName ),
|
||||
pluginLangEntries = plugin.langEntries || ( plugin.langEntries = {} ),
|
||||
pluginLang = plugin.lang || ( plugin.lang = [] );
|
||||
|
||||
if ( CKEDITOR.tools.indexOf( pluginLang, languageCode ) == -1 )
|
||||
pluginLang.push( languageCode );
|
||||
|
||||
pluginLangEntries[ languageCode ] = languageEntries;
|
||||
};
|
|
@ -1,238 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.resourceManager} class, which is
|
||||
* the base for resource managers, like plugins and themes.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for resource managers, like plugins and themes. This class is not
|
||||
* intended to be used out of the CKEditor core code.
|
||||
* @param {String} basePath The path for the resources folder.
|
||||
* @param {String} fileName The name used for resource files.
|
||||
* @namespace
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.resourceManager = function( basePath, fileName )
|
||||
{
|
||||
/**
|
||||
* The base directory containing all resources.
|
||||
* @name CKEDITOR.resourceManager.prototype.basePath
|
||||
* @type String
|
||||
* @example
|
||||
*/
|
||||
this.basePath = basePath;
|
||||
|
||||
/**
|
||||
* The name used for resource files.
|
||||
* @name CKEDITOR.resourceManager.prototype.fileName
|
||||
* @type String
|
||||
* @example
|
||||
*/
|
||||
this.fileName = fileName;
|
||||
|
||||
/**
|
||||
* Contains references to all resources that have already been registered
|
||||
* with {@link #add}.
|
||||
* @name CKEDITOR.resourceManager.prototype.registered
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
this.registered = {};
|
||||
|
||||
/**
|
||||
* Contains references to all resources that have already been loaded
|
||||
* with {@link #load}.
|
||||
* @name CKEDITOR.resourceManager.prototype.loaded
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
this.loaded = {};
|
||||
|
||||
/**
|
||||
* Contains references to all resources that have already been registered
|
||||
* with {@link #addExternal}.
|
||||
* @name CKEDITOR.resourceManager.prototype.externals
|
||||
* @type Object
|
||||
* @example
|
||||
*/
|
||||
this.externals = {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
this._ =
|
||||
{
|
||||
// List of callbacks waiting for plugins to be loaded.
|
||||
waitingList : {}
|
||||
};
|
||||
};
|
||||
|
||||
CKEDITOR.resourceManager.prototype =
|
||||
{
|
||||
/**
|
||||
* Registers a resource.
|
||||
* @param {String} name The resource name.
|
||||
* @param {Object} [definition] The resource definition.
|
||||
* @example
|
||||
* CKEDITOR.plugins.add( 'sample', { ... plugin definition ... } );
|
||||
* @see CKEDITOR.pluginDefinition
|
||||
*/
|
||||
add : function( name, definition )
|
||||
{
|
||||
if ( this.registered[ name ] )
|
||||
throw '[CKEDITOR.resourceManager.add] The resource name "' + name + '" is already registered.';
|
||||
|
||||
CKEDITOR.fire( name + CKEDITOR.tools.capitalize( this.fileName ) + 'Ready',
|
||||
this.registered[ name ] = definition || {} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the definition of a specific resource.
|
||||
* @param {String} name The resource name.
|
||||
* @type Object
|
||||
* @example
|
||||
* var definition = <b>CKEDITOR.plugins.get( 'sample' )</b>;
|
||||
*/
|
||||
get : function( name )
|
||||
{
|
||||
return this.registered[ name ] || null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the folder path for a specific loaded resource.
|
||||
* @param {String} name The resource name.
|
||||
* @type String
|
||||
* @example
|
||||
* alert( <b>CKEDITOR.plugins.getPath( 'sample' )</b> ); // "<editor path>/plugins/sample/"
|
||||
*/
|
||||
getPath : function( name )
|
||||
{
|
||||
var external = this.externals[ name ];
|
||||
return CKEDITOR.getUrl( ( external && external.dir ) || this.basePath + name + '/' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the file path for a specific loaded resource.
|
||||
* @param {String} name The resource name.
|
||||
* @type String
|
||||
* @example
|
||||
* alert( <b>CKEDITOR.plugins.getFilePath( 'sample' )</b> ); // "<editor path>/plugins/sample/plugin.js"
|
||||
*/
|
||||
getFilePath : function( name )
|
||||
{
|
||||
var external = this.externals[ name ];
|
||||
return CKEDITOR.getUrl(
|
||||
this.getPath( name ) +
|
||||
( ( external && ( typeof external.file == 'string' ) ) ? external.file : this.fileName + '.js' ) );
|
||||
},
|
||||
|
||||
/**
|
||||
* Registers one or more resources to be loaded from an external path
|
||||
* instead of the core base path.
|
||||
* @param {String} names The resource names, separated by commas.
|
||||
* @param {String} path The path of the folder containing the resource.
|
||||
* @param {String} [fileName] The resource file name. If not provided, the
|
||||
* default name is used; If provided with a empty string, will implicitly indicates that {@param path}
|
||||
* is already the full path.
|
||||
* @example
|
||||
* // Loads a plugin from '/myplugin/samples/plugin.js'.
|
||||
* CKEDITOR.plugins.addExternal( 'sample', '/myplugins/sample/' );
|
||||
* @example
|
||||
* // Loads a plugin from '/myplugin/samples/my_plugin.js'.
|
||||
* CKEDITOR.plugins.addExternal( 'sample', '/myplugins/sample/', 'my_plugin.js' );
|
||||
* @example
|
||||
* // Loads a plugin from '/myplugin/samples/my_plugin.js'.
|
||||
* CKEDITOR.plugins.addExternal( 'sample', '/myplugins/sample/my_plugin.js', '' );
|
||||
*/
|
||||
addExternal : function( names, path, fileName )
|
||||
{
|
||||
names = names.split( ',' );
|
||||
for ( var i = 0 ; i < names.length ; i++ )
|
||||
{
|
||||
var name = names[ i ];
|
||||
|
||||
this.externals[ name ] =
|
||||
{
|
||||
dir : path,
|
||||
file : fileName
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads one or more resources.
|
||||
* @param {String|Array} name The name of the resource to load. It may be a
|
||||
* string with a single resource name, or an array with several names.
|
||||
* @param {Function} callback A function to be called when all resources
|
||||
* are loaded. The callback will receive an array containing all
|
||||
* loaded names.
|
||||
* @param {Object} [scope] The scope object to be used for the callback
|
||||
* call.
|
||||
* @example
|
||||
* <b>CKEDITOR.plugins.load</b>( 'myplugin', function( plugins )
|
||||
* {
|
||||
* alert( plugins['myplugin'] ); // "object"
|
||||
* });
|
||||
*/
|
||||
load : function( names, callback, scope )
|
||||
{
|
||||
// Ensure that we have an array of names.
|
||||
if ( !CKEDITOR.tools.isArray( names ) )
|
||||
names = names ? [ names ] : [];
|
||||
|
||||
var loaded = this.loaded,
|
||||
registered = this.registered,
|
||||
urls = [],
|
||||
urlsNames = {},
|
||||
resources = {};
|
||||
|
||||
// Loop through all names.
|
||||
for ( var i = 0 ; i < names.length ; i++ )
|
||||
{
|
||||
var name = names[ i ];
|
||||
|
||||
if ( !name )
|
||||
continue;
|
||||
|
||||
// If not available yet.
|
||||
if ( !loaded[ name ] && !registered[ name ] )
|
||||
{
|
||||
var url = this.getFilePath( name );
|
||||
urls.push( url );
|
||||
if ( !( url in urlsNames ) )
|
||||
urlsNames[ url ] = [];
|
||||
urlsNames[ url ].push( name );
|
||||
}
|
||||
else
|
||||
resources[ name ] = this.get( name );
|
||||
}
|
||||
|
||||
CKEDITOR.scriptLoader.load( urls, function( completed, failed )
|
||||
{
|
||||
if ( failed.length )
|
||||
{
|
||||
throw '[CKEDITOR.resourceManager.load] Resource name "' + urlsNames[ failed[ 0 ] ].join( ',' )
|
||||
+ '" was not found at "' + failed[ 0 ] + '".';
|
||||
}
|
||||
|
||||
for ( var i = 0 ; i < completed.length ; i++ )
|
||||
{
|
||||
var nameList = urlsNames[ completed[ i ] ];
|
||||
for ( var j = 0 ; j < nameList.length ; j++ )
|
||||
{
|
||||
var name = nameList[ j ];
|
||||
resources[ name ] = this.get( name );
|
||||
|
||||
loaded[ name ] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
callback.call( scope, resources );
|
||||
}
|
||||
, this);
|
||||
}
|
||||
};
|
|
@ -1,180 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileOverview Defines the {@link CKEDITOR.scriptLoader} object, used to load scripts
|
||||
* asynchronously.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Load scripts asynchronously.
|
||||
* @namespace
|
||||
* @example
|
||||
*/
|
||||
CKEDITOR.scriptLoader = (function()
|
||||
{
|
||||
var uniqueScripts = {},
|
||||
waitingList = {};
|
||||
|
||||
return /** @lends CKEDITOR.scriptLoader */ {
|
||||
/**
|
||||
* Loads one or more external script checking if not already loaded
|
||||
* previously by this function.
|
||||
* @param {String|Array} scriptUrl One or more URLs pointing to the
|
||||
* scripts to be loaded.
|
||||
* @param {Function} [callback] A function to be called when the script
|
||||
* is loaded and executed. If a string is passed to "scriptUrl", a
|
||||
* boolean parameter is passed to the callback, indicating the
|
||||
* success of the load. If an array is passed instead, two array
|
||||
* parameters are passed to the callback; the first contains the
|
||||
* URLs that have been properly loaded, and the second the failed
|
||||
* ones.
|
||||
* @param {Object} [scope] The scope ("this" reference) to be used for
|
||||
* the callback call. Default to {@link CKEDITOR}.
|
||||
* @param {Boolean} [showBusy] Changes the cursor of the document while
|
||||
+ * the script is loaded.
|
||||
* @example
|
||||
* CKEDITOR.scriptLoader.load( '/myscript.js' );
|
||||
* @example
|
||||
* CKEDITOR.scriptLoader.load( '/myscript.js', function( success )
|
||||
* {
|
||||
* // Alerts "true" if the script has been properly loaded.
|
||||
* // HTTP error 404 should return "false".
|
||||
* alert( success );
|
||||
* });
|
||||
* @example
|
||||
* CKEDITOR.scriptLoader.load( [ '/myscript1.js', '/myscript2.js' ], function( completed, failed )
|
||||
* {
|
||||
* alert( 'Number of scripts loaded: ' + completed.length );
|
||||
* alert( 'Number of failures: ' + failed.length );
|
||||
* });
|
||||
*/
|
||||
load : function( scriptUrl, callback, scope, showBusy )
|
||||
{
|
||||
var isString = ( typeof scriptUrl == 'string' );
|
||||
|
||||
if ( isString )
|
||||
scriptUrl = [ scriptUrl ];
|
||||
|
||||
if ( !scope )
|
||||
scope = CKEDITOR;
|
||||
|
||||
var scriptCount = scriptUrl.length,
|
||||
completed = [],
|
||||
failed = [];
|
||||
|
||||
var doCallback = function( success )
|
||||
{
|
||||
if ( callback )
|
||||
{
|
||||
if ( isString )
|
||||
callback.call( scope, success );
|
||||
else
|
||||
callback.call( scope, completed, failed );
|
||||
}
|
||||
};
|
||||
|
||||
if ( scriptCount === 0 )
|
||||
{
|
||||
doCallback( true );
|
||||
return;
|
||||
}
|
||||
|
||||
var checkLoaded = function( url, success )
|
||||
{
|
||||
( success ? completed : failed ).push( url );
|
||||
|
||||
if ( --scriptCount <= 0 )
|
||||
{
|
||||
showBusy && CKEDITOR.document.getDocumentElement().removeStyle( 'cursor' );
|
||||
doCallback( success );
|
||||
}
|
||||
};
|
||||
|
||||
var onLoad = function( url, success )
|
||||
{
|
||||
// Mark this script as loaded.
|
||||
uniqueScripts[ url ] = 1;
|
||||
|
||||
// Get the list of callback checks waiting for this file.
|
||||
var waitingInfo = waitingList[ url ];
|
||||
delete waitingList[ url ];
|
||||
|
||||
// Check all callbacks waiting for this file.
|
||||
for ( var i = 0 ; i < waitingInfo.length ; i++ )
|
||||
waitingInfo[ i ]( url, success );
|
||||
};
|
||||
|
||||
var loadScript = function( url )
|
||||
{
|
||||
if ( uniqueScripts[ url ] )
|
||||
{
|
||||
checkLoaded( url, true );
|
||||
return;
|
||||
}
|
||||
|
||||
var waitingInfo = waitingList[ url ] || ( waitingList[ url ] = [] );
|
||||
waitingInfo.push( checkLoaded );
|
||||
|
||||
// Load it only for the first request.
|
||||
if ( waitingInfo.length > 1 )
|
||||
return;
|
||||
|
||||
// Create the <script> element.
|
||||
var script = new CKEDITOR.dom.element( 'script' );
|
||||
script.setAttributes( {
|
||||
type : 'text/javascript',
|
||||
src : url } );
|
||||
|
||||
if ( callback )
|
||||
{
|
||||
if ( CKEDITOR.env.ie )
|
||||
{
|
||||
// FIXME: For IE, we are not able to return false on error (like 404).
|
||||
|
||||
/** @ignore */
|
||||
script.$.onreadystatechange = function ()
|
||||
{
|
||||
if ( script.$.readyState == 'loaded' || script.$.readyState == 'complete' )
|
||||
{
|
||||
script.$.onreadystatechange = null;
|
||||
onLoad( url, true );
|
||||
}
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
/** @ignore */
|
||||
script.$.onload = function()
|
||||
{
|
||||
// Some browsers, such as Safari, may call the onLoad function
|
||||
// immediately. Which will break the loading sequence. (#3661)
|
||||
setTimeout( function() { onLoad( url, true ); }, 0 );
|
||||
};
|
||||
|
||||
// FIXME: Opera and Safari will not fire onerror.
|
||||
|
||||
/** @ignore */
|
||||
script.$.onerror = function()
|
||||
{
|
||||
onLoad( url, false );
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Append it to <head>.
|
||||
script.appendTo( CKEDITOR.document.getHead() );
|
||||
|
||||
CKEDITOR.fire( 'download', url ); // @Packager.RemoveLine
|
||||
};
|
||||
|
||||
showBusy && CKEDITOR.document.getDocumentElement().setStyle( 'cursor', 'wait' );
|
||||
for ( var i = 0 ; i < scriptCount ; i++ )
|
||||
{
|
||||
loadScript( scriptUrl[ i ] );
|
||||
}
|
||||
}
|
||||
};
|
||||
})();
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue