diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a657790 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.bundle +db/*.sqlite3 +log/*.log +tmp/**/* +pkg diff --git a/LICENSE b/LICENSE deleted file mode 100644 index eb13f76..0000000 --- a/LICENSE +++ /dev/null @@ -1,16 +0,0 @@ -Easy CKEditor is a Rails Plugin WYSIWYG text editor and a fork of Gast�n Ramos's fork of Scott Rutherford great plugin - - Copyright (C) 2009 John Bradley - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . diff --git a/README.rdoc b/README.rdoc new file mode 100644 index 0000000..ea3ca2e --- /dev/null +++ b/README.rdoc @@ -0,0 +1,166 @@ += Rails CKEditor integration plugin with SWFUpload support + +CKEditor is a text editor to be used inside web pages. It's a WYSIWYG editor, which means that the text being edited on it looks as similar as possible to +the results users have when publishing it. It brings to the web common editing features found on desktop editing applications like Microsoft Word and OpenOffice. + +Because CKEditor is licensed under flexible Open Source and commercial licenses, you'll be able to integrate and use it inside any kind of application. +This is the ideal editor for developers, created to provide easy and powerful solutions to their users. + +CKEditor version: any (http://ckeditor.com/download/releases) + +SWFUpload version: 2.2.0.1 Core (http://swfupload.org) + +Rails version: 3.x + +Demo appication (Rails 2.3.8): +http://github.com/galetahub/rails-ckeditor-demo-app + +Demo appication (Rails 3.x): +http://github.com/galetahub/ckeditor-demo-app + +== Install + +=== Rails 3 + +In your appication "Gemfile": + + gem 'ckeditor' + +or + gem 'ckeditor', :git => 'git://github.com/galetahub/rails-ckeditor.git', :branch => 'rails3' + +Next step is download ckeditor core files and generate configuration file +Check "config/initializers/ckeditor.rb" for more configuration options: + + rails generate ckeditor:base + +You can pass version of ckeditor to download (http://ckeditor.com/download/releases): + + rails generate ckeditor:base --version=3.5.4 + +Generate ckeditor models for file upload support: +For paperclip: + + rails generate ckeditor:migration + +For attachment_fu: + + rails generate ckeditor:migration --backend=attachment_fu + +Don't forget about migration: + + rake db:migrate + +== Usage + +Basically include this in the page you wish to use the editor in: + + <%= javascript_include_tag :ckeditor %> + +Then instead of the normal textarea helper from Rails use this one: + + <%= ckeditor_textarea("object", "field", :width => '100%', :height => '200px') %> + +FormBuilder helper for more usefully: + + <%= form_for @page do |form| -%> + ... + <%= form.cktext_area :notes, :toolbar=>'Full', :width=>'400px', :height=>'200px' %> + ... + <%= form.cktext_area :content, :swf_params=>{:assetable_type=>'User', :assetable_id=>current_user.id} %> + ... + <% end -%> + +=== Support options + + :cols # Textarea cols (default: 70) + :rows # Textarea rows (default: 20) + :width # Editor width (default: 100%) + :height # Editor height (default: 100%) + :class # Textarea css class name + :toolbar # Toolbar name + :skin # Editor skin + :language # Editor language (default: I18n.locale) + :swf_params # SWFUpload additional params (Hash) + :id # textarea DOM element id + :index # element id index + :ckeditor_options => {} # all configurable options for ckeditor, check the ckeditor API. + # these will override width, height, toolbar, skin, and language if you define them here. + +For configure ckeditor default options check: + + public/javascripts/ckeditor/config.js + +This stylesheet use editor for displaying edit area: + + public/javascripts/ckeditor/contents.css + +=== AJAX + +To use a remote form you need to call "ckeditor_ajax_script" helper method: + + <%= form_for @page, :remote => true do |form| -%> + <%= form.cktext_area("note", "content") %> + ... + <%= form.cktext_area("note", "about") %> + ... + <%= ckeditor_ajax_script %> + ... + <%= form.submit "Save" %> + <% end %> + +Helper "ckeditor_ajax_script" generate next script (jquery): + + + +== File uploads + +We recommend using a paperclip plugin for file storage and processing images. Controller @../rails-ckeditor/app/controllers/ckeditor_controller.rb@ has actions +for displaying and uploading files. It uses classes Picture and AttachmentFile, who are descendants of the Asset class. So, your project must have these classes. + + http://github.com/thoughtbot/paperclip + +For S3 storage look at "../ckeditor/examples/s3" + +== Formtastic integration + + <%= form.input :content, :as => :ckeditor %> + <%= form.input :content, :as => :ckeditor, :input_html => { :height => 400, :swf_params => { ... } } %> + +== SimpleForm integration + + <%= form.ckeditor :content, :label => false, :input_html => { :height => 400, :toolbar=>'Full' } %> + +== Middleware + +Ckeditor appends middleware ("Ckeditor::Middleware") before session store to +support swf upload with AuthenticityToken. + + rake middleware + +== I18n + + en: + ckeditor: + page_title: "CKEditor Files Manager" + upload_files: "Upload New Files" + buttons: + cancel: "Cancel" + refresh: + title: "Refresh" + hint: "Refresh page" + upload: + title: "Upload" + hint: "Upload New File" + +== TODOs + +1. HTML5 File uploads diff --git a/README.textile b/README.textile deleted file mode 100644 index de922b9..0000000 --- a/README.textile +++ /dev/null @@ -1,224 +0,0 @@ -h1. Rails CKEditor integration plugin with SWFUpload support - -CKEditor is a text editor to be used inside web pages. It's a WYSIWYG editor, which means that the text being edited on it looks as similar as possible to -the results users have when publishing it. It brings to the web common editing features found on desktop editing applications like Microsoft Word and OpenOffice. - -Because CKEditor is licensed under flexible Open Source and commercial licenses, you'll be able to integrate and use it inside any kind of application. -This is the ideal editor for developers, created to provide easy and powerful solutions to their users. - -CKEditor version: 3.2 -SWFUpload version: 2.2.0 -Rails version: 2.3.x - -"ckeditor.com":http://ckeditor.com/ -"swfupload.org":http://swfupload.org/ - -Demo appication: -"rails-ckeditor-demo-app":http://github.com/galetahub/rails-ckeditor-demo-app - -h2. Install - -@./script/plugin install git://github.com/galetahub/rails-ckeditor.git@ - -@rake ckeditor:install@ - -@rake ckeditor:config@ - -Last rake generated file config/ckeditor.yml: -

-development: 
-  swf_file_post_name: "data"
-  swf_image_file_types_description: "Images"
-  swf_image_file_types: "*.jpg;*.jpeg;*.png;*.gif"
-  swf_image_file_size_limit: "5 MB"
-  swf_image_file_upload_limit: 10
-  swf_types_description: "Files"
-  swf_file_types: "*.doc;*.wpd;*.pdf;*.swf;*.xls"
-  swf_file_size_limit: "10 MB"
-  swf_file_file_upload_limit: 5
-  public_uri: "/uploads"
-  public_path: "public/uploads"
-  file_manager_uri: "/ckeditor/files"
-  file_manager_upload_uri: "/ckeditor/create?kind=file"
-  file_manager_image_upload_uri: "/ckeditor/create?kind=image"
-  file_manager_image_uri: "/ckeditor/images"
-
- -For attachment_fu: @swf_file_post_name: "uploaded_data"@ - -h2. Usage - -Basically include this in the page you wish to use the editor in -

-  <%= javascript_include_tag :ckeditor %>
-
- -Then instead of the normal textarea helper from Rails use this one -

-  <%= ckeditor_textarea("object", "field", :width => '100%', :height => '200px') %>
-
- -FormBuilder helper for more usefully - -
  
-  <% form_for :page, :url => pages_path do |form| -%>
-    ...
-    <%= form.cktext_area :notes, :toolbar=>'Full', :width=>'400px', :heigth=>'200px' %>
-    ...
-    <%= form.cktext_area :content, :swf_params=>{:assetable_type=>'User', :assetable_id=>current_user.id} %>
-    ...
-  <% end -%>
-
- -h3. Support options -
 
-  :cols    # Textarea cols
-  :rows    # Textarea rows
-  :width   # Editor width
-  :height  # Editor height
-  :class   # Textarea css class name
-  :toolbar # Toolbar name
-  :skin    # Editor skin
-  :language # Editor language
-  :swf_params # SWFUpload additional params
-
- -Check @public/javascripts/ckeditor/config.js@ for config default options. -Modify @public/javascripts/ckeditor/contents.css@ - this stylesheet use editor - -h3. AJAX - -To use a remote form you need to do something like this -

-  <%= form_remote_tag :url => @options.merge(:controller => @scaffold_controller),
-                    :before => Ckeditor_before_js('note', 'text') %>
-
-    <%= ckeditor_textarea( "note", "text", :ajax => true ) %>
-
-  <%= end_form_tag %>
-
- -If you forget to put in the :before it won't work, you can also use the Ckeditor_form_remote_tag described below - -h3. Multiple Editors in a form - -To create a form using multiple editors use the Ckeditor_form_remote_tag helper and pass the :editors option. This takes an hash of model symbol keys with each having -an array as its value. The array should contain the list of fields that will have editors attached to them. -

-  <%= ckeditor_form_remote_tag :url => @options.merge(:controller => @scaffold_controller),
-                              :editors => { :multinote => ['text1', 'text2'] } %>
-
-    <%= ckeditor_textarea( "multinote", "text1", :ajax => true ) %>
-    <%= ckeditor_textarea( "multinote", "text2", :ajax => true ) %>
-
-  <%= end_form_tag %>
-
- -h3. File uploads - -We recommend using a paperclip plugin for file storage and processing images. Controller @../rails-ckeditor/app/controllers/ckeditor_controller.rb@ has actions -for displaying and uploading files. It uses classes Picture and AttachmentFile, who are descendants of the Asset class. So, your project must have these classes. - -"http://github.com/thoughtbot/paperclip":http://github.com/thoughtbot/paperclip - -For S3 storage look at @../rails-ckeditor/examples/s3@ - -For paperclip: -ActiveRecord model Asset (asset.rb): -

-class Asset < ActiveRecord::Base
-  belongs_to :user
-  belongs_to :assetable, :polymorphic => true
-
-  def url(*args)
-    data.url(*args)
-  end
-  alias :public_filename :url
-
-  def filename
-    data_file_name
-  end
-  
-  def content_type
-    data_content_type
-  end
-  
-  def size
-    data_file_size
-  end
-  
-  def path
-    data.path
-  end
-  
-  def styles
-    data.styles
-  end
-  
-  def format_created_at
-    I18n.l(self.created_at, :format=>"%d.%m.%Y %H:%M")
-  end
-  
-  def to_xml(options = {})
-    xml = options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent])
-
-    xml.tag!(self.type.to_s.downcase) do
-      xml.filename{ xml.cdata!(self.filename) }
-      xml.size self.size
-      xml.path{ xml.cdata!(self.url) }
-      
-      xml.styles do
-        self.styles.each do |style|
-          xml.tag!(style.first, self.url(style.first))
-        end
-      end unless self.styles.empty?
-    end
-  end
-end
-
- -ActiveRecord model AttachmentFile (attachment_file.rb): -

-class AttachmentFile < Asset
-  has_attached_file :data,
-                    :url => "/assets/attachments/:id/:filename",
-                    :path => ":rails_root/public/assets/attachments/:id/:filename"
-
-  validates_attachment_size :data, :less_than => 10.megabytes
-end
-
- -ActiveRecord model Picture (picture.rb): -

-class Picture < Asset
-  has_attached_file :data,
-                    :url  => "/assets/pictures/:id/:style_:basename.:extension",
-                    :path => ":rails_root/public/assets/pictures/:id/:style_:basename.:extension",
-	            :styles => { :content => '575>', :thumb => '100x100' }
-	
-  validates_attachment_size :data, :less_than => 2.megabytes
-  
-  def url_content
-    url(:content)
-  end
-  
-  def url_thumb
-    url(:thumb)
-  end
-  
-  def to_json(options = {})
-    options[:methods] ||= []
-    options[:methods] << :url_content
-    options[:methods] << :url_thumb
-    super options
-  end
-end
-
- -More info in @../rails-ckeditor/examples/models@. -Do not forget about migration @../rails-ckeditor/examples/migrations@. - -h2. TODOs - -1. Add support for choose filemanager storage -2. More integration upload system diff --git a/Rakefile b/Rakefile index 4b8f19f..dcd5657 100644 --- a/Rakefile +++ b/Rakefile @@ -1,72 +1,46 @@ +# encoding: utf-8 require 'rake' require 'rake/testtask' -require 'rake/packagetask' require 'rake/rdoctask' -require 'find' +require File.join(File.dirname(__FILE__), 'lib', 'ckeditor', 'version') desc 'Default: run unit tests.' task :default => :test -desc 'Test the ckeditor plugin.' +desc 'Test the rails-ckeditor plugin.' Rake::TestTask.new(:test) do |t| t.libs << 'lib' + t.libs << 'test' t.pattern = 'test/**/*_test.rb' t.verbose = true end -desc 'Generate documentation for the ckeditor plugin.' +desc 'Generate documentation for the rails-ckeditor plugin.' Rake::RDocTask.new(:rdoc) do |rdoc| rdoc.rdoc_dir = 'rdoc' - rdoc.title = 'Ckeditor' + rdoc.title = 'Rails Ckeditor' rdoc.options << '--line-numbers' << '--inline-source' - rdoc.rdoc_files.include('README') + rdoc.rdoc_files.include('README.textile') rdoc.rdoc_files.include('lib/**/*.rb') end -# Globals -require 'lib/ckeditor_version' -PKG_NAME = 'ckeditor_plugin' -PKG_VERSION = CkeditorVersion.current - -PKG_FILES = ['README', 'CHANGELOG', 'init.rb', 'install.rb'] -PKG_DIRECTORIES = ['app/', 'lib/', 'public/', 'tasks/', 'test/'] -PKG_DIRECTORIES.each do |dir| - Find.find(dir) do |f| - if FileTest.directory?(f) and f =~ /\.svn/ - Find.prune - else - PKG_FILES << f - end - end -end - -# Tasks -task :package -Rake::PackageTask.new(PKG_NAME, PKG_VERSION) do |p| - p.need_tar = true - p.package_files = PKG_FILES -end - -# "Gem" part of the Rakefile begin - require 'rake/gempackagetask' - - spec = Gem::Specification.new do |s| - s.platform = Gem::Platform::RUBY - s.summary = "CKeditor plugin for Rails" - s.name = PKG_NAME - s.version = PKG_VERSION - s.requirements << 'none' - s.files = PKG_FILES - s.description = "Adds CKeditor helpers and code to Rails application" - end - - desc "Create gem package for CKeditor plugin" - task :package_gem - Rake::GemPackageTask.new(spec) do |pkg| - pkg.need_zip = true - pkg.need_tar = true + require 'jeweler' + Jeweler::Tasks.new do |gemspec| + gemspec.name = "ckeditor" + gemspec.version = Ckeditor::Version.dup + gemspec.summary = "Rails plugin for integration ckeditor 3.x" + gemspec.description = "CKEditor is a WYSIWYG editor to be used inside web pages" + gemspec.email = "galeta.igor@gmail.com" + gemspec.homepage = "http://github.com/galetahub/rails-ckeditor" + gemspec.authors = ["Igor Galeta"] + gemspec.files = FileList["[A-Z]*", "{app,config,lib}/**/*"] + gemspec.rubyforge_project = "ckeditor" + + gemspec.add_dependency('mime-types', '>= 1.16') end + + Jeweler::GemcutterTasks.new rescue LoadError + puts "Jeweler not available. Install it with: gem install jeweler" end - diff --git a/app/controllers/ckeditor/attachment_files_controller.rb b/app/controllers/ckeditor/attachment_files_controller.rb new file mode 100644 index 0000000..01bb860 --- /dev/null +++ b/app/controllers/ckeditor/attachment_files_controller.rb @@ -0,0 +1,23 @@ +class Ckeditor::AttachmentFilesController < Ckeditor::BaseController + + def index + @attachments = Ckeditor.file_model.order("id DESC") + respond_with(@attachments) + end + + def create + @attachment = Ckeditor.file_model.new + respond_with_asset(@attachment) + end + + def destroy + @attachment.destroy + respond_with(@attachment, :location => ckeditor_attachments_path) + end + + protected + + def find_asset + @attachment = Ckeditor.file_model.find(params[:id]) + end +end diff --git a/app/controllers/ckeditor/base_controller.rb b/app/controllers/ckeditor/base_controller.rb new file mode 100644 index 0000000..1d8dcbf --- /dev/null +++ b/app/controllers/ckeditor/base_controller.rb @@ -0,0 +1,60 @@ +class Ckeditor::BaseController < ApplicationController + skip_before_filter :verify_authenticity_token, :only => [:create] + + before_filter :swf_options, :only => [:index, :create] + before_filter :find_asset, :only => [:destroy] + + respond_to :html, :json + + layout "ckeditor" + + protected + + def swf_options + @swf_file_post_name = Ckeditor.swf_file_post_name + + if params[:controller] == 'ckeditor/pictures' + @file_size_limit = Ckeditor.swf_image_file_size_limit + @file_types = Ckeditor.swf_image_file_types + @file_types_description = Ckeditor.swf_image_file_types_description + @file_upload_limit = Ckeditor.swf_image_file_upload_limit + else + @file_size_limit = Ckeditor.swf_file_size_limit + @file_types = Ckeditor.swf_file_types + @file_types_description = Ckeditor.swf_file_types_description + @file_upload_limit = Ckeditor.swf_file_upload_limit + end + + @swf_file_post_name ||= 'data' + @file_size_limit ||= "5 MB" + @file_types ||= "*.jpg;*.jpeg;*.png;*.gif" + @file_types_description ||= "Images" + @file_upload_limit ||= 10 + end + + def respond_with_asset(record) + unless params[:CKEditor].blank? + params[@swf_file_post_name] = params.delete(:upload) + end + + options = {} + + params.each do |k, v| + key = k.to_s.downcase + options[key] = v if record.respond_to?("#{key}=") + end + + record.attributes = options + record.user ||= current_user if respond_to?(:current_user) + + if record.valid? && record.save + body = params[:CKEditor].blank? ? record.to_json(:only=>[:id, :type], :methods=>[:url, :content_type, :size, :filename, :format_created_at], :root => "asset") : %Q"" + + render :text => body + else + render :nothing => true + end + end +end diff --git a/app/controllers/ckeditor/pictures_controller.rb b/app/controllers/ckeditor/pictures_controller.rb new file mode 100644 index 0000000..ea9153a --- /dev/null +++ b/app/controllers/ckeditor/pictures_controller.rb @@ -0,0 +1,23 @@ +class Ckeditor::PicturesController < Ckeditor::BaseController + + def index + @pictures = Ckeditor.image_model.order("id DESC") + respond_with(@pictures) + end + + def create + @picture = Ckeditor.image_model.new + respond_with_asset(@picture) + end + + def destroy + @picture.destroy + respond_with(@picture, :location => ckeditor_pictures_path) + end + + protected + + def find_asset + @picture = Ckeditor.image_model.find(params[:id]) + end +end diff --git a/app/controllers/ckeditor_controller.rb b/app/controllers/ckeditor_controller.rb deleted file mode 100644 index aa0dcee..0000000 --- a/app/controllers/ckeditor_controller.rb +++ /dev/null @@ -1,89 +0,0 @@ -class CkeditorController < ActionController::Base - before_filter :swf_options, :only=>[:images, :files, :create] - - layout "ckeditor" - - # GET /ckeditor/images - def images - @images = Picture.find(:all, :order=>"id DESC") - - respond_to do |format| - format.html {} - format.xml { render :xml=>@images } - end - end - - # GET /ckeditor/files - def files - @files = AttachmentFile.find(:all, :order=>"id DESC") - - respond_to do |format| - format.html {} - format.xml { render :xml=>@files } - end - end - - # POST /ckeditor/create - def create - @kind = params[:kind] || 'file' - - @record = case @kind.downcase - when 'file' then AttachmentFile.new - when 'image' then Picture.new - end - - unless params[:CKEditor].blank? - params[@swf_file_post_name] = params.delete(:upload) - end - - options = {} - - params.each do |k, v| - key = k.to_s.downcase - options[key] = v if @record.respond_to?("#{key}=") - end - - @record.attributes = options - - if @record.valid? && @record.save - @text = params[:CKEditor].blank? ? @record.to_json(:only=>[:id, :type], :methods=>[:url, :content_type, :size, :filename, :format_created_at]) : %Q"" - - render :text=>@text - else - render :nothing => true - end - end - - private - - def swf_options - if Ckeditor::Config.exists? - @swf_file_post_name = Ckeditor::Config['swf_file_post_name'] - - if params[:action] == 'images' - @file_size_limit = Ckeditor::Config['swf_image_file_size_limit'] - @file_types = Ckeditor::Config['swf_image_file_types'] - @file_types_description = Ckeditor::Config['swf_image_file_types_description'] - @file_upload_limit = Ckeditor::Config['swf_image_file_upload_limit'] - else - @file_size_limit = Ckeditor::Config['swf_file_size_limit'] - @file_types = Ckeditor::Config['swf_file_types'] - @file_types_description = Ckeditor::Config['swf_file_types_description'] - @file_upload_limit = Ckeditor::Config['swf_file_upload_limit'] - end - end - - @swf_file_post_name ||= 'data' - @file_size_limit ||= "5 MB" - @file_types ||= "*.jpg;*.jpeg;*.png;*.gif" - @file_types_description ||= "Images" - @file_upload_limit ||= 10 - end - - def escape_single_quotes(str) - str.gsub('\\','\0\0').gsub(' :post) + options[:protocol] = "http://" + options[session_key] = Rack::Utils.escape(cookies[session_key]) + + if protect_against_forgery? + options[request_forgery_protection_token] = Rack::Utils.escape(form_authenticity_token) + end + + url_for(options) + end +end diff --git a/app/helpers/ckeditor_helper.rb b/app/helpers/ckeditor_helper.rb deleted file mode 100644 index 0828741..0000000 --- a/app/helpers/ckeditor_helper.rb +++ /dev/null @@ -1,41 +0,0 @@ -module CkeditorHelper - def new_attachment_path_with_session_information(kind) - session_key = ActionController::Base.session_options[:key] - - options = {} - controller = case kind - when :image then Ckeditor::PLUGIN_FILE_MANAGER_IMAGE_UPLOAD_URI - when :file then Ckeditor::PLUGIN_FILE_MANAGER_UPLOAD_URI - else '/ckeditor/create' - end - - if controller.include?('?') - arr = controller.split('?') - options = Rack::Utils.parse_query(arr.last) - controller = arr.first - end - - options[:controller] = controller - options[:protocol] = "http://" - options[session_key] = cookies[session_key] - options[request_forgery_protection_token] = form_authenticity_token unless request_forgery_protection_token.nil? - - url_for(options) - end - - def file_image_tag(filename, path) - extname = File.extname(filename) - - image = case extname.to_s - when '.swf' then '/javascripts/ckeditor/images/swf.gif' - when '.pdf' then '/javascripts/ckeditor/images/pdf.gif' - when '.doc', '.txt' then '/javascripts/ckeditor/images/doc.gif' - when '.mp3' then '/javascripts/ckeditor/images/mp3.gif' - when '.rar', '.zip', '.tg' then '/javascripts/ckeditor/images/rar.gif' - when '.xls' then '/javascripts/ckeditor/images/xls.gif' - else '/javascripts/ckeditor/images/ckfnothumb.gif' - end - - image_tag(image, :alt=>path, :title=>filename, :onerror=>"this.src='/javascripts/ckeditor/images/ckfnothumb.gif'", :class=>'image') - end -end diff --git a/app/views/ckeditor/_asset.html.erb b/app/views/ckeditor/_asset.html.erb new file mode 100644 index 0000000..6eb8486 --- /dev/null +++ b/app/views/ckeditor/_asset.html.erb @@ -0,0 +1,20 @@ +
+ <%= link_to(' '.html_safe, polymorphic_path(asset, :format => :json), + :method => :delete, :remote => true, :class => 'FCKFileDelete') %> + +
+ + + + + + +
+ <%= image_tag(asset.url_thumb, :alt => asset.url_content, :title => asset.filename, :onerror=>"this.src='/javascripts/ckeditor/images/ckfnothumb.gif'", :class=>'image') %> +
+ +
<%= asset.filename %>
+
<%= asset.format_created_at %>
+
<%= number_to_human_size(asset.size, :precision => 2) %>
+
+
diff --git a/app/views/ckeditor/_file.html.erb b/app/views/ckeditor/_file.html.erb deleted file mode 100644 index 4782564..0000000 --- a/app/views/ckeditor/_file.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -
- - - - - - -
- <%= file_image_tag(file.filename, file.url) %> -
- -
<%= file.filename %>
-
<%= file.format_created_at %>
-
<%= number_to_human_size(file.size, :precision => 2) %>
-
diff --git a/app/views/ckeditor/_image.html.erb b/app/views/ckeditor/_image.html.erb deleted file mode 100644 index 8d328a5..0000000 --- a/app/views/ckeditor/_image.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -
- - - - - - -
- <%= image_tag(image.url(:thumb), :alt=>image.url(:content), :title=>image.filename, :onerror=>"this.src='/javascripts/ckeditor/images/ckfnothumb.gif'", :class=>'image' ) %> -
- -
<%= image.filename %>
-
<%= image.format_created_at %>
-
<%= number_to_human_size(image.size, :precision => 2) %>
-
diff --git a/app/views/ckeditor/_swfupload.html.erb b/app/views/ckeditor/_swfupload.html.erb index 67ebb65..fb16f92 100644 --- a/app/views/ckeditor/_swfupload.html.erb +++ b/app/views/ckeditor/_swfupload.html.erb @@ -1,5 +1,27 @@ @@ -49,7 +11,7 @@ diff --git a/app/views/ckeditor/files.html.erb b/app/views/ckeditor/pictures/index.html.erb similarity index 52% rename from app/views/ckeditor/files.html.erb rename to app/views/ckeditor/pictures/index.html.erb index 980fdc1..2ea3b09 100644 --- a/app/views/ckeditor/files.html.erb +++ b/app/views/ckeditor/pictures/index.html.erb @@ -1,43 +1,5 @@
- <%= render :partial=>"image", :collection=>@images %> + <%= render :partial => "ckeditor/asset", :collection => @attachments, :as => :asset %>
@@ -49,7 +11,7 @@ diff --git a/app/views/layouts/ckeditor.html.erb b/app/views/layouts/ckeditor.html.erb index 2950bdf..052f783 100644 --- a/app/views/layouts/ckeditor.html.erb +++ b/app/views/layouts/ckeditor.html.erb @@ -1,20 +1,22 @@ - CKEditor Files Manager + <%= I18n.t('page_title', :scope => [:ckeditor]) %> + <%= csrf_meta_tag %> + - + - + ' - end - - def upload - self.upload_file - end - - ################################################################################# - # - private - - def load_file_from_params - @new_file = check_file(params[:newFile]) - @ck_url = upload_directory_path - @ftype = @new_file.content_type.strip - log_upload - end - - ############################################################################## - # Chek if mime type is included in the MIME_TYPES - # - def mime_types_ok(ftype) - mime_type_ok = MIME_TYPES.include?(ftype) ? true : false - if mime_type_ok - @errorNumber = 0 - else - @errorNumber = 202 - raise_mime_type_and_show_msg(ftype) - end - mime_type_ok - end - - ############################################################################## - # Raise and exception, log the msg error and show msg - # - def raise_mime_type_and_show_msg(ftype) - msg = "#{ftype} is invalid MIME type" - puts msg; - raise msg; - log msg - end - - ############################################################################## - # Copy tmp file to current_directory_path/tmp_file.original_filename - # - def copy_tmp_file(tmp_file) - path = current_directory_path + "/" + tmp_file.original_filename - File.open(path, "wb", 0664) do |fp| - FileUtils.copy_stream(tmp_file, fp) - end - end - - ############################################################################## - # Puts a messgae info in the current log, only if RAILS_ENV is 'development' - # - def log(str) - RAILS_DEFAULT_LOGGER.info str if RAILS_ENV == 'development' - end - - ############################################################################## - # Puts some data in the current log - # - def log_upload - log "CKEDITOR - #{params[:newFile]}" - log "CKEDITOR - UPLOAD_FOLDER: #{UPLOAD_FOLDER}" - log "CKEDITOR - #{File.expand_path(RAILS_ROOT)}/public#{UPLOAD_FOLDER}/" + - "#{@new_file.original_filename}" - end - - ############################################################################## - # Returns the filesystem folder with the current folder - # - def current_directory_path - base_dir = "#{UPLOAD_ROOT}/#{UPLOAD_FOLDER}/#{params[:type]}" - Dir.mkdir(base_dir,0775) unless File.exists?(base_dir) - check_path("#{base_dir}#{params[:currentFolder]}") - end - - ############################################################################## - # Returns the upload url folder with the current folder - # - def upload_directory_path - url_root = ActionController::Base.relative_url_root.to_s - uploaded = url_root + "#{UPLOAD_FOLDER}/#{params[:Type]}" - "#{uploaded}#{params[:currentFolder]}" - end - - ############################################################################## - # Current uploaded file path - # - def uploaded_file_path - "#{upload_directory_path}/#{@new_file.original_filename}" - end - - ############################################################################## - # check that the file is a tempfile object - # - def check_file(file) - log "CKEDITOR ---- CLASS OF UPLOAD OBJECT: #{file.class}" - - unless "#{file.class}" == "Tempfile" || "StringIO" - @errorNumber = 403 - throw Exception.new - end - file - end - - def check_path(path) - exp_path = File.expand_path path - if exp_path !~ %r[^#{File.expand_path(UPLOAD_ROOT)}] - @errorNumber = 403 - throw Exception.new - end - path - end - end -end diff --git a/lib/ckeditor/hooks/formtastic.rb b/lib/ckeditor/hooks/formtastic.rb new file mode 100644 index 0000000..de8dbe0 --- /dev/null +++ b/lib/ckeditor/hooks/formtastic.rb @@ -0,0 +1,15 @@ +module Ckeditor + module Hooks + module FormtasticBuilder + def self.included(base) + base.send(:include, InstanceMethods) + end + + module InstanceMethods + def ckeditor_input(method, options) + basic_input_helper(:cktext_area, :text, method, options) + end + end + end + end +end diff --git a/lib/ckeditor/hooks/simple_form.rb b/lib/ckeditor/hooks/simple_form.rb new file mode 100644 index 0000000..bd792af --- /dev/null +++ b/lib/ckeditor/hooks/simple_form.rb @@ -0,0 +1,28 @@ +module Ckeditor + module Hooks + module SimpleFormBuilder + class CkeditorInput < ::SimpleForm::Inputs::Base + def input + @builder.send(:cktext_area, attribute_name, input_html_options) + end + end + + def self.included(base) + base.send(:include, InstanceMethods) + end + + module InstanceMethods + def ckeditor(attribute_name, options={}, &block) + column = find_attribute_column(attribute_name) + input_type = default_input_type(attribute_name, column, options) + + if block_given? + SimpleForm::Inputs::BlockInput.new(self, attribute_name, column, input_type, options, &block).render + else + CkeditorInput.new(self, attribute_name, column, input_type, options).render + end + end + end + end + end +end diff --git a/lib/ckeditor/middleware.rb b/lib/ckeditor/middleware.rb new file mode 100644 index 0000000..675be96 --- /dev/null +++ b/lib/ckeditor/middleware.rb @@ -0,0 +1,18 @@ +require 'rack/utils' + +module Ckeditor + class Middleware + def initialize(app, session_key = '_session_id') + @app = app + @session_key = session_key + end + + def call(env) + if env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave)\s+Flash/ + params = ::Rack::Utils.parse_query(env['QUERY_STRING']) + env['HTTP_COOKIE'] = [ @session_key, ::Rack::Utils.unescape(params[@session_key]) ].join('=').freeze unless params[@session_key].nil? + end + @app.call(env) + end + end +end diff --git a/lib/ckeditor/safe_buffer.rb b/lib/ckeditor/safe_buffer.rb deleted file mode 100644 index 3525c22..0000000 --- a/lib/ckeditor/safe_buffer.rb +++ /dev/null @@ -1,23 +0,0 @@ -module ActionView #:nodoc: - class SafeBuffer < String - def <<(value) - super(value) - end - - def concat(value) - self << value - end - - def html_safe? - true - end - - def html_safe! - self - end - - def to_s - self - end - end -end diff --git a/lib/ckeditor/utils.rb b/lib/ckeditor/utils.rb index f58cd90..fb75457 100644 --- a/lib/ckeditor/utils.rb +++ b/lib/ckeditor/utils.rb @@ -1,81 +1,95 @@ +# encoding: utf-8 +require 'fileutils' +require 'open-uri' +require 'digest/sha1' +require 'mime/types' + module Ckeditor module Utils - CKEDITOR_INSTALL_DIRECTORY = File.join(RAILS_ROOT, '/public/javascripts/ckeditor/') - PLUGIN_INSTALL_DIRECTORY = File.join(RAILS_ROOT, '/vendor/plugins/rails-ckeditor/') - - def self.recursive_copy(options) - source = options[:source] - dest = options[:dest] - logging = options[:logging].nil? ? true : options[:logging] + # RemoteFile + # + # remote_file = RemoteFile.new("http://www.google.com/intl/en_ALL/images/logo.gif") + # remote_file.original_filename #=> logo.gif + # remote_file.content_type #= image/gif + # + class RemoteFile < ::Tempfile - Dir.foreach(source) do |entry| - next if entry =~ /^(\.|_)|(\.php)$/ + def initialize(path, tmpdir = Dir::tmpdir) + @original_filename = File.basename(path) + @remote_path = path + + super Digest::SHA1.hexdigest(path), tmpdir + fetch + end + + def fetch + string_io = OpenURI.send(:open, @remote_path) + body = string_io.read - if File.directory?(File.join(source, entry)) - unless File.exist?(File.join(dest, entry)) - puts "Creating directory #{entry}..." if logging - FileUtils.mkdir File.join(dest, entry) - end - recursive_copy(:source => File.join(source, entry), - :dest => File.join(dest, entry), - :logging => logging) - else - FileUtils.cp File.join(source, entry), File.join(dest, entry) + # Fix for ruby 1.9.2 (ASCII-8BIT and UTF-8 in hell issue) + if body && body.respond_to?(:encoding) && body.encoding.name == 'ASCII-8BIT' + body.force_encoding('UTF-8') end + + self.write body + self.rewind + self + end + + def original_filename + @original_filename + end + + def content_type + types = MIME::Types.type_for(self.path) + types.empty? ? extract_content_type : types.first.to_s end - end - - def self.backup_existing - source = File.join(RAILS_ROOT,'/public/javascripts/ckeditor') - dest = File.join(RAILS_ROOT,'/public/javascripts/ckeditor_bck') - - FileUtils.rm_r(dest) if File.exists? dest - FileUtils.mv source, dest - end - - def self.create_uploads_directory - uploads = File.join(RAILS_ROOT, '/public/uploads') - FileUtils.mkdir(uploads) unless File.exist?(uploads) - end - - def self.install(log) - directory = File.join(RAILS_ROOT, '/vendor/plugins/rails-ckeditor/') - source = File.join(directory,'/public/javascripts/ckeditor/') - FileUtils.mkdir(CKEDITOR_INSTALL_DIRECTORY) - # recursively copy all our files over - recursive_copy(:source => source, :dest => CKEDITOR_INSTALL_DIRECTORY, :logging => log) + protected + + def extract_content_type + mime = `file --mime -br #{self.path}`.strip + mime = mime.gsub(/^.*: */,"") + mime = mime.gsub(/;.*$/,"") + mime = mime.gsub(/,.*$/,"") + mime + end end - - ################################################################## - # remove the existing install (if any) - # - def self.destroy - if File.exist?(CKEDITOR_INSTALL_DIRECTORY) - FileUtils.rm_r(CKEDITOR_INSTALL_DIRECTORY) - - FileUtils.rm(File.join(RAILS_ROOT, '/public/javascripts/ckcustom.js')) \ - if File.exist? File.join(RAILS_ROOT, '/public/javascripts/ckcustom.js') + + class << self + # remove the existing install (if any) + def destroy + directory = Rails.root.join('public', 'javascripts', 'ckeditor') + if File.exist?(directory) + FileUtils.rm_r(directory, :force => true) + end end - end - - def self.rm_plugin - if File.exist?(PLUGIN_INSTALL_DIRECTORY) - FileUtils.rm_r(PLUGIN_INSTALL_DIRECTORY) + + def escape_single_quotes(str) + str.gsub('\\','\0\0').gsub(' true) + FileUtils.mkdir_p(dirpath) + end + end end end diff --git a/lib/ckeditor/version.rb b/lib/ckeditor/version.rb index 848048c..5854e06 100644 --- a/lib/ckeditor/version.rb +++ b/lib/ckeditor/version.rb @@ -1,10 +1,10 @@ module Ckeditor module Version - MAJOR = 1 - MINOR = 2 - RELEASE = 1 + MAJOR = 3 + MINOR = 5 + RELEASE = 4 - def self.current + def self.dup "#{MAJOR}.#{MINOR}.#{RELEASE}" end end diff --git a/lib/ckeditor/view_helper.rb b/lib/ckeditor/view_helper.rb index 184f6d8..1e91c42 100644 --- a/lib/ckeditor/view_helper.rb +++ b/lib/ckeditor/view_helper.rb @@ -1,134 +1,100 @@ module Ckeditor - PLUGIN_NAME = 'rails-ckeditor' - PLUGIN_PATH = File.join(RAILS_ROOT, "vendor/plugins", PLUGIN_NAME) - - PLUGIN_PUBLIC_PATH = Ckeditor::Config.exists? ? Ckeditor::Config['public_path'] : "#{RAILS_ROOT}/public/uploads" - PLUGIN_PUBLIC_URI = Ckeditor::Config.exists? ? Ckeditor::Config['public_uri'] : "/uploads" - - PLUGIN_CONTROLLER_PATH = File.join(PLUGIN_PATH, "/app/controllers") - PLUGIN_VIEWS_PATH = File.join(PLUGIN_PATH, "/app/views") - PLUGIN_HELPER_PATH = File.join(PLUGIN_PATH, "/app/helpers") - - PLUGIN_FILE_MANAGER_URI = Ckeditor::Config.exists? ? Ckeditor::Config['file_manager_uri'] : "" - PLUGIN_FILE_MANAGER_UPLOAD_URI = Ckeditor::Config.exists? ? Ckeditor::Config['file_manager_upload_uri'] : "" - PLUGIN_FILE_MANAGER_IMAGE_URI = Ckeditor::Config.exists? ? Ckeditor::Config['file_manager_image_uri'] : "" - PLUGIN_FILE_MANAGER_IMAGE_UPLOAD_URI = Ckeditor::Config.exists? ? Ckeditor::Config['file_manager_image_upload_uri'] : "" - module ViewHelper - include ActionView::Helpers - - # Example: + include ActionView::Helpers::JavaScriptHelper + include ActionView::Helpers::TagHelper + + # Ckeditor helper: # <%= ckeditor_textarea("object", "field", :width => '100%', :height => '200px') %> # - # To use a remote form you need to do something like this - # <%= form_remote_tag :url => @options.merge(:controller => @scaffold_controller), - # :before => Ckeditor_before_js('note', 'text') %> + # Two forms on one page: + # <%= form_tag "one" %> + # <%= ckeditor_textarea("object", "field", :index => "1") %> + # <% end %> + # ... + # <%= form_tag "two" %> + # <%= ckeditor_textarea("object", "field", :index => "2") %> + # <% end %> # - # <%= ckeditor_textarea( "note", "text", :ajax => true ) %> - # - # <%= end_form_tag %> - def ckeditor_textarea(object, field, options = {}) - options.symbolize_keys! - - var = options.delete(:object) if options.key?(:object) - var ||= @template.instance_variable_get("@#{object}") - - value = var.send(field.to_sym) if var - value ||= options[:value] || "" - - id = ckeditor_element_id(object, field) - - textarea_options = { :id => id } - - textarea_options[:cols] = options[:cols].nil? ? 70 : options[:cols].to_i - textarea_options[:rows] = options[:rows].nil? ? 20 : options[:rows].to_i - textarea_options[:class] = options[:class] unless options[:class].nil? + def ckeditor_textarea(object_name, field, options = {}) - width = options[:width].nil? ? '100%' : options[:width] - height = options[:height].nil? ? '100%' : options[:height] + options_for_ckeditor = options.delete(:ckeditor_options) || {} + options_for_ckeditor = options_for_ckeditor.dup.symbolize_keys + + options = options.dup.symbolize_keys - ckeditor_options = {} + object = options.delete(:object) if options.key?(:object) + object ||= @template.instance_variable_get("@#{object_name}") - ckeditor_options[:language] = options[:language] || I18n.locale.to_s - ckeditor_options[:toolbar] = options[:toolbar] unless options[:toolbar].nil? - ckeditor_options[:skin] = options[:skin] unless options[:skin].nil? - ckeditor_options[:width] = options[:width] unless options[:width].nil? - ckeditor_options[:height] = options[:height] unless options[:height].nil? + options[:value] = object.send(field) unless options.key?(:value) + + element_id = options.delete(:id) || ckeditor_element_id(object_name, field, options.delete(:index)) + width = options.delete(:width) || '100%' + height = options.delete(:height) || '100%' - ckeditor_options[:swf_params] = options[:swf_params] unless options[:swf_params].nil? + textarea_options = { :id => element_id } - ckeditor_options[:filebrowserBrowseUrl] = PLUGIN_FILE_MANAGER_URI - ckeditor_options[:filebrowserUploadUrl] = PLUGIN_FILE_MANAGER_UPLOAD_URI + textarea_options[:cols] = (options.delete(:cols) || 70).to_i + textarea_options[:rows] = (options.delete(:rows) || 20).to_i + textarea_options[:class] = (options.delete(:class) || 'editor').to_s + textarea_options[:style] = "width:#{width};height:#{height}" - ckeditor_options[:filebrowserImageBrowseUrl] = PLUGIN_FILE_MANAGER_IMAGE_URI - ckeditor_options[:filebrowserImageUploadUrl] = PLUGIN_FILE_MANAGER_IMAGE_UPLOAD_URI + ckeditor_options = {:width => width, :height => height } + ckeditor_options[:language] = (options.delete(:language) || I18n.locale).to_s + ckeditor_options[:toolbar] = options.delete(:toolbar) if options[:toolbar] + ckeditor_options[:skin] = options.delete(:skin) if options[:skin] - output_buffer = ActionView::SafeBuffer.new + ckeditor_options[:swf_params] = options.delete(:swf_params) if options[:swf_params] + + ckeditor_options[:filebrowserBrowseUrl] = Ckeditor.file_manager_uri + ckeditor_options[:filebrowserUploadUrl] = Ckeditor.file_manager_upload_uri - if options[:ajax] - textarea_options.update(:name => id) - - output_buffer << tag(:input, { "type" => "hidden", "name" => "#{object}[#{field}]", "id" => "#{id}_hidden"}) - output_buffer << ActionView::Base::InstanceTag.new(object, field, self, var).to_text_area_tag(textarea_options) - else - textarea_options.update(:style => "width:#{width};height:#{height}") - - output_buffer << ActionView::Base::InstanceTag.new(object, field, self, var).to_text_area_tag(textarea_options) + ckeditor_options[:filebrowserImageBrowseUrl] = Ckeditor.file_manager_image_uri + ckeditor_options[:filebrowserImageUploadUrl] = Ckeditor.file_manager_image_upload_uri + + # override ckeditor_options with options_for_ckeditor, should be backwards compatible + options_for_ckeditor.each do |k,v| + ckeditor_options[k] = options_for_ckeditor[k] end - output_buffer << javascript_tag("CKEDITOR.replace('#{object}[#{field}]', { - #{ckeditor_applay_options(ckeditor_options)} - });\n") + output_buffer = ActiveSupport::SafeBuffer.new + + output_buffer << ActionView::Base::InstanceTag.new(object_name, field, self, object).to_text_area_tag(textarea_options.merge(options)) + + output_buffer << javascript_tag("if (CKEDITOR.instances['#{element_id}']) { + CKEDITOR.remove(CKEDITOR.instances['#{element_id}']);} + CKEDITOR.replace('#{element_id}', { #{ckeditor_applay_options(ckeditor_options)} });") output_buffer end - - def ckeditor_form_remote_tag(options = {}) - editors = options[:editors] - before = "" - editors.keys.each do |e| - editors[e].each do |f| - before += ckeditor_before_js(e, f) - end - end - options[:before] = options[:before].nil? ? before : before + options[:before] - form_remote_tag(options) - end - - def ckeditor_remote_form_for(object_name, *args, &proc) - options = args.last.is_a?(Hash) ? args.pop : {} - concat(ckeditor_form_remote_tag(options), proc.binding) - fields_for(object_name, *(args << options), &proc) - concat('', proc.binding) - end - alias_method :ckeditor_form_remote_for, :ckeditor_remote_form_for - - def ckeditor_element_id(object, field) - "#{object}_#{field}_editor" - end - - def ckeditor_div_id(object, field) - id = eval("@#{object}.id") - "div-#{object}-#{id}-#{field}-editor" - end - - def ckeditor_before_js(object, field) - id = ckeditor_element_id(object, field) - "var oEditor = CKEDITOR.instances.#{id}.getData();" + + def ckeditor_ajax_script(backend = 'jquery') + javascript_tag("$(document).ready(function(){ + $('form[data-remote]').bind('ajax:before', function(){ + for (instance in CKEDITOR.instances){ + CKEDITOR.instances[instance].updateElement(); + } + }); + });") end - def ckeditor_applay_options(options={}) - str = [] - options.each do |k, v| - value = case v.class.to_s.downcase - when 'string' then "'#{v}'" - when 'hash' then "{ #{ckeditor_applay_options(v)} }" - else v - end - str << "#{k}: #{value}" + protected + + def ckeditor_element_id(object_name, field, index = nil) + [object_name, index, field, 'editor'].compact.join('_') end - str.join(',') - end + def ckeditor_applay_options(options={}) + str = [] + options.each do |k, v| + value = case v.class.to_s.downcase + when 'string' then "'#{v}'" + when 'hash' then "{ #{ckeditor_applay_options(v)} }" + else v + end + str << "#{k}: #{value}" + end + + str.join(',') + end end end diff --git a/lib/generators/ckeditor/base/USAGE b/lib/generators/ckeditor/base/USAGE new file mode 100644 index 0000000..c9b0bfd --- /dev/null +++ b/lib/generators/ckeditor/base/USAGE @@ -0,0 +1,9 @@ +CKEditor +======== + +# Download and extract ckeditor's core files into 'public/javascripts' +# and generate configuration file in 'config/initializers/ckeditor.rb' + +rails generate ckeditor:base + +rails generate ckeditor:base version=3.5.2 diff --git a/lib/generators/ckeditor/base/base_generator.rb b/lib/generators/ckeditor/base/base_generator.rb new file mode 100644 index 0000000..fd7088d --- /dev/null +++ b/lib/generators/ckeditor/base/base_generator.rb @@ -0,0 +1,41 @@ +require 'rails/generators' + +module Ckeditor + class BaseGenerator < Rails::Generators::Base + class_option :version, :type => :string, :default => '3.6', + :desc => "Version of ckeditor which be install" + + def self.source_root + @source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates')) + end + + # copy configuration + def copy_initializer + template "ckeditor.rb", "config/initializers/ckeditor.rb" + end + + # copy ckeditor files + def install_ckeditor + puts "Start download #{filename}" + file = Ckeditor::Utils.download(download_url) + + if File.exist?(file.path) + Ckeditor::Utils.extract(file.path, Rails.root.join('public', 'javascripts')) + directory "ckeditor", "public/javascripts/ckeditor" + file.unlink + else + raise Rails::Generators::Error.new("Cannot download file #{download_url}") + end + end + + protected + + def download_url + "http://download.cksource.com/CKEditor/CKEditor/CKEditor%20#{options[:version]}/ckeditor_#{options[:version]}.tar.gz" + end + + def filename + "ckeditor_#{options[:version]}.tar.gz" + end + end +end diff --git a/lib/generators/ckeditor/base/templates/ckeditor.rb b/lib/generators/ckeditor/base/templates/ckeditor.rb new file mode 100644 index 0000000..01ddab0 --- /dev/null +++ b/lib/generators/ckeditor/base/templates/ckeditor.rb @@ -0,0 +1,54 @@ +# Use this hook to configure ckeditor +if Object.const_defined?("Ckeditor") + Ckeditor.setup do |config| + # The file_post_name allows you to set the value name used to post the file. + # This is not related to the file name. The default value is 'data'. + # For maximum compatibility it is recommended that the default value is used. + #config.swf_file_post_name = "data" + + # A text description that is displayed to the user in the File Browser dialog. + #config.swf_file_types_description = "Files" + + # The file_types setting accepts a semi-colon separated list of file extensions + # that are allowed to be selected by the user. Use '*.*' to allow all file types. + #config.swf_file_types = "*.doc;*.wpd;*.pdf;*.swf;*.xls" + + # The file_size_limit setting defines the maximum allowed size of a file to be uploaded. + # This setting accepts a value and unit. Valid units are B, KB, MB and GB. + # If the unit is omitted default is KB. A value of 0 (zero) is interpreted as unlimited. + # Note: This setting only applies to the user's browser. It does not affect any settings or limits on the web server. + #config.swf_file_size_limit = "10 MB" + + # Defines the number of files allowed to be uploaded by SWFUpload. + # This setting also sets the upper bound of the file_queue_limit setting. + # Once the user has uploaded or queued the maximum number of files she will + # no longer be able to queue additional files. The value of 0 (zero) is interpreted as unlimited. + # Only successful uploads (uploads the trigger the uploadSuccess event) are counted toward the upload limit. + # The setStats function can be used to modify the number of successful uploads. + # Note: This value is not tracked across pages and is reset when a page is refreshed. + # File quotas should be managed by the web server. + #config.swf_file_upload_limit = 5 + + # The same as for downloads files, only to upload images + #config.swf_image_file_types_description = "Images" + #config.swf_image_file_types = "*.jpg;*.jpeg;*.png;*.gif" + #config.swf_image_file_size_limit = "5 MB" + #config.swf_image_file_upload_limit = 10 + + # Path for view all uploaded files + #config.file_manager_uri = "/ckeditor/attachments" + + # Path for upload files process + #config.file_manager_upload_uri = "/ckeditor/attachments" + + # Path for view all uploaded images + #config.file_manager_image_uri = "/ckeditor/pictures" + + # Path for upload images process + #config.file_manager_image_upload_uri = "/ckeditor/pictures" + + # Model's names witch processing in ckeditor_controller + #config.file_manager_image_model = "Ckeditor::Picture" + #config.file_manager_file_model = "Ckeditor::AttachmentFile" + end +end diff --git a/public/javascripts/ckeditor/_source/plugins/attachment/dialogs/attachment.js b/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/dialogs/attachment.js similarity index 100% rename from public/javascripts/ckeditor/_source/plugins/attachment/dialogs/attachment.js rename to lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/dialogs/attachment.js diff --git a/public/javascripts/ckeditor/_source/plugins/attachment/images/attachment.png b/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/images/attachment.png similarity index 100% rename from public/javascripts/ckeditor/_source/plugins/attachment/images/attachment.png rename to lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/images/attachment.png diff --git a/public/javascripts/ckeditor/_source/plugins/attachment/lang/en.js b/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/lang/en.js similarity index 100% rename from public/javascripts/ckeditor/_source/plugins/attachment/lang/en.js rename to lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/lang/en.js diff --git a/public/javascripts/ckeditor/_source/plugins/attachment/lang/ru.js b/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/lang/ru.js similarity index 100% rename from public/javascripts/ckeditor/_source/plugins/attachment/lang/ru.js rename to lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/lang/ru.js diff --git a/public/javascripts/ckeditor/_source/plugins/attachment/lang/uk.js b/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/lang/uk.js similarity index 100% rename from public/javascripts/ckeditor/_source/plugins/attachment/lang/uk.js rename to lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/lang/uk.js diff --git a/public/javascripts/ckeditor/_source/plugins/attachment/plugin.js b/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/plugin.js similarity index 100% rename from public/javascripts/ckeditor/_source/plugins/attachment/plugin.js rename to lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/plugin.js diff --git a/public/javascripts/ckeditor/_source/plugins/embed/dialogs/embed.js b/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/dialogs/embed.js similarity index 100% rename from public/javascripts/ckeditor/_source/plugins/embed/dialogs/embed.js rename to lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/dialogs/embed.js diff --git a/public/javascripts/ckeditor/_source/plugins/embed/images/embed.png b/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/images/embed.png similarity index 100% rename from public/javascripts/ckeditor/_source/plugins/embed/images/embed.png rename to lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/images/embed.png diff --git a/public/javascripts/ckeditor/_source/plugins/embed/lang/en.js b/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/lang/en.js similarity index 100% rename from public/javascripts/ckeditor/_source/plugins/embed/lang/en.js rename to lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/lang/en.js diff --git a/public/javascripts/ckeditor/_source/plugins/embed/lang/ru.js b/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/lang/ru.js similarity index 100% rename from public/javascripts/ckeditor/_source/plugins/embed/lang/ru.js rename to lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/lang/ru.js diff --git a/public/javascripts/ckeditor/_source/plugins/embed/lang/uk.js b/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/lang/uk.js similarity index 100% rename from public/javascripts/ckeditor/_source/plugins/embed/lang/uk.js rename to lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/lang/uk.js diff --git a/public/javascripts/ckeditor/_source/plugins/embed/plugin.js b/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/plugin.js similarity index 100% rename from public/javascripts/ckeditor/_source/plugins/embed/plugin.js rename to lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/plugin.js diff --git a/public/javascripts/ckeditor/config.js b/lib/generators/ckeditor/base/templates/ckeditor/config.js similarity index 93% rename from public/javascripts/ckeditor/config.js rename to lib/generators/ckeditor/base/templates/ckeditor/config.js index f8b0e1a..860e2f3 100644 --- a/public/javascripts/ckeditor/config.js +++ b/lib/generators/ckeditor/base/templates/ckeditor/config.js @@ -1,42 +1,43 @@ -/* +/* Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -CKEDITOR.editorConfig = function( config ) -{ - config.PreserveSessionOnFileBrowser = true; - // Define changes to default configuration here. For example: - config.language = 'en'; - // config.uiColor = '#AADC6E'; - - //config.ContextMenu = ['Generic','Anchor','Flash','Select','Textarea','Checkbox','Radio','TextField','HiddenField','ImageButton','Button','BulletedList','NumberedList','Table','Form'] ; - - config.height = '400px'; - config.width = '600px'; - - //config.resize_enabled = false; - //config.resize_maxHeight = 2000; - //config.resize_maxWidth = 750; - - //config.startupFocus = true; - - // works only with en, ru, uk languages - config.extraPlugins = "embed,attachment"; - - config.toolbar = 'Easy'; - - config.toolbar_Easy = - [ - ['Source','-','Preview','Templates'], - ['Cut','Copy','Paste','PasteText','PasteFromWord',], - ['Maximize','-','About'], - ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], - ['Styles','Format'], - ['Bold','Italic','Underline','Strike','-','Subscript','Superscript', 'TextColor'], - ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'], - ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['Link','Unlink','Anchor'], - ['Image','Embed','Flash','Attachment','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'] - ]; +*/ + +CKEDITOR.editorConfig = function( config ) +{ + config.PreserveSessionOnFileBrowser = true; + // Define changes to default configuration here. For example: + config.language = 'en'; + // config.uiColor = '#AADC6E'; + + //config.ContextMenu = ['Generic','Anchor','Flash','Select','Textarea','Checkbox','Radio','TextField','HiddenField','ImageButton','Button','BulletedList','NumberedList','Table','Form'] ; + + config.height = '400px'; + config.width = '600px'; + + //config.resize_enabled = false; + //config.resize_maxHeight = 2000; + //config.resize_maxWidth = 750; + + //config.startupFocus = true; + + // works only with en, ru, uk languages + config.extraPlugins = "embed,attachment"; + + config.toolbar = 'Easy'; + + config.toolbar_Easy = + [ + ['Source','-','Preview','Templates'], + ['Cut','Copy','Paste','PasteText','PasteFromWord',], + ['Maximize','-','About'], + ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], + ['Styles','Format'], + ['Bold','Italic','Underline','Strike','-','Subscript','Superscript', 'TextColor'], + ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], + ['Link','Unlink','Anchor'], + ['Image','Embed','Flash','Attachment','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'] + ]; }; + diff --git a/public/javascripts/ckeditor/css/ckfinder.css b/lib/generators/ckeditor/base/templates/ckeditor/css/ckfinder.css similarity index 87% rename from public/javascripts/ckeditor/css/ckfinder.css rename to lib/generators/ckeditor/base/templates/ckeditor/css/ckfinder.css index 469ed36..e238131 100644 --- a/public/javascripts/ckeditor/css/ckfinder.css +++ b/lib/generators/ckeditor/base/templates/ckeditor/css/ckfinder.css @@ -43,6 +43,11 @@ tr.FCKThumb td background-color: #99ccff !important; } +.FCKAsset { + cursor: pointer; + margin-top: 5px; +} + .FCKFileName, .FCKFileDate, .FCKFileSize { margin-top: 3px; @@ -206,6 +211,18 @@ td.FCKFileSize background-repeat: no-repeat; } +a.FCKFileDelete { + float:right; + background-image:url('/javascripts/ckeditor/images/cancelbutton.gif'); + background-repeat: no-repeat; + background-position:-14px 0; + width:14px; +} + +a.FCKFileDelete:hover { + background-position:0 0; +} + .CKFStatusBar { padding: 2px; diff --git a/public/javascripts/ckeditor/css/fck_dialog.css b/lib/generators/ckeditor/base/templates/ckeditor/css/fck_dialog.css similarity index 100% rename from public/javascripts/ckeditor/css/fck_dialog.css rename to lib/generators/ckeditor/base/templates/ckeditor/css/fck_dialog.css diff --git a/public/javascripts/ckeditor/css/fck_editor.css b/lib/generators/ckeditor/base/templates/ckeditor/css/fck_editor.css similarity index 100% rename from public/javascripts/ckeditor/css/fck_editor.css rename to lib/generators/ckeditor/base/templates/ckeditor/css/fck_editor.css diff --git a/public/javascripts/ckeditor/css/swfupload.css b/lib/generators/ckeditor/base/templates/ckeditor/css/swfupload.css similarity index 100% rename from public/javascripts/ckeditor/css/swfupload.css rename to lib/generators/ckeditor/base/templates/ckeditor/css/swfupload.css diff --git a/public/javascripts/ckeditor/images/add.gif b/lib/generators/ckeditor/base/templates/ckeditor/images/add.gif similarity index 100% rename from public/javascripts/ckeditor/images/add.gif rename to lib/generators/ckeditor/base/templates/ckeditor/images/add.gif diff --git a/public/javascripts/ckeditor/images/cancelbutton.gif b/lib/generators/ckeditor/base/templates/ckeditor/images/cancelbutton.gif similarity index 100% rename from public/javascripts/ckeditor/images/cancelbutton.gif rename to lib/generators/ckeditor/base/templates/ckeditor/images/cancelbutton.gif diff --git a/public/javascripts/ckeditor/images/ckfnothumb.gif b/lib/generators/ckeditor/base/templates/ckeditor/images/ckfnothumb.gif similarity index 100% rename from public/javascripts/ckeditor/images/ckfnothumb.gif rename to lib/generators/ckeditor/base/templates/ckeditor/images/ckfnothumb.gif diff --git a/public/javascripts/ckeditor/images/doc.gif b/lib/generators/ckeditor/base/templates/ckeditor/images/doc.gif similarity index 100% rename from public/javascripts/ckeditor/images/doc.gif rename to lib/generators/ckeditor/base/templates/ckeditor/images/doc.gif diff --git a/public/javascripts/ckeditor/images/mp3.gif b/lib/generators/ckeditor/base/templates/ckeditor/images/mp3.gif similarity index 100% rename from public/javascripts/ckeditor/images/mp3.gif rename to lib/generators/ckeditor/base/templates/ckeditor/images/mp3.gif diff --git a/lib/generators/ckeditor/base/templates/ckeditor/images/pdf.gif b/lib/generators/ckeditor/base/templates/ckeditor/images/pdf.gif new file mode 100644 index 0000000..550fe68 Binary files /dev/null and b/lib/generators/ckeditor/base/templates/ckeditor/images/pdf.gif differ diff --git a/public/javascripts/ckeditor/images/rar.gif b/lib/generators/ckeditor/base/templates/ckeditor/images/rar.gif similarity index 100% rename from public/javascripts/ckeditor/images/rar.gif rename to lib/generators/ckeditor/base/templates/ckeditor/images/rar.gif diff --git a/public/javascripts/ckeditor/images/refresh.gif b/lib/generators/ckeditor/base/templates/ckeditor/images/refresh.gif similarity index 100% rename from public/javascripts/ckeditor/images/refresh.gif rename to lib/generators/ckeditor/base/templates/ckeditor/images/refresh.gif diff --git a/public/javascripts/ckeditor/images/select_files.png b/lib/generators/ckeditor/base/templates/ckeditor/images/select_files.png similarity index 100% rename from public/javascripts/ckeditor/images/select_files.png rename to lib/generators/ckeditor/base/templates/ckeditor/images/select_files.png diff --git a/public/javascripts/ckeditor/images/spacer.gif b/lib/generators/ckeditor/base/templates/ckeditor/images/spacer.gif similarity index 100% rename from public/javascripts/ckeditor/images/spacer.gif rename to lib/generators/ckeditor/base/templates/ckeditor/images/spacer.gif diff --git a/public/javascripts/ckeditor/images/swf.gif b/lib/generators/ckeditor/base/templates/ckeditor/images/swf.gif similarity index 100% rename from public/javascripts/ckeditor/images/swf.gif rename to lib/generators/ckeditor/base/templates/ckeditor/images/swf.gif diff --git a/public/javascripts/ckeditor/images/toolbar.start.gif b/lib/generators/ckeditor/base/templates/ckeditor/images/toolbar.start.gif similarity index 100% rename from public/javascripts/ckeditor/images/toolbar.start.gif rename to lib/generators/ckeditor/base/templates/ckeditor/images/toolbar.start.gif diff --git a/public/javascripts/ckeditor/images/xls.gif b/lib/generators/ckeditor/base/templates/ckeditor/images/xls.gif similarity index 100% rename from public/javascripts/ckeditor/images/xls.gif rename to lib/generators/ckeditor/base/templates/ckeditor/images/xls.gif diff --git a/public/javascripts/ckeditor/plugins/attachment/dialogs/attachment.js b/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/dialogs/attachment.js similarity index 99% rename from public/javascripts/ckeditor/plugins/attachment/dialogs/attachment.js rename to lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/dialogs/attachment.js index 8ad448c..527bc06 100644 --- a/public/javascripts/ckeditor/plugins/attachment/dialogs/attachment.js +++ b/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/dialogs/attachment.js @@ -1 +1 @@ -(function(){CKEDITOR.dialog.add('attachment',function(editor){var selectableTargets=/^(_(?:self|top|parent|blank))$/;var parseLink=function(editor,element){var href=element?(element.getAttribute('_cke_saved_href')||element.getAttribute('href')):'',emailMatch,anchorMatch,urlMatch,retval={};retval.type='url';retval.url=href;if(element){var target=element.getAttribute('target');retval.target={};if(target){var targetMatch=target.match(selectableTargets);if(targetMatch)retval.target.type=retval.target.name=target;else{retval.target.type='frame';retval.target.name=target}}var me=this;retval.title=element.getAttribute('title')}var elements=editor.document.getElementsByTag('img'),realAnchors=new CKEDITOR.dom.nodeList(editor.document.$.anchors),anchors=retval.anchors=[];for(var i=0;i',editor.document);selection=editor.getSelection();element.moveChildren(newElement);element.copyAttributes(newElement,{name:1});newElement.replace(element);element=newElement;selection.selectElement(element)}element.setAttributes(attributes);element.removeAttributes(removeAttributes);if(element.getAttribute('title'))element.setHtml(element.getAttribute('title'));if(element.getAttribute('name'))element.addClass('cke_anchor');else element.removeClass('cke_anchor');if(this.fakeObj)editor.createFakeElement(element,'cke_anchor','anchor').replace(this.fakeObj);delete this._.selectedElement}},contents:[{label:editor.lang.common.generalTab,id:'general',accessKey:'I',elements:[{type:'vbox',padding:0,children:[{type:'html',html:''+CKEDITOR.tools.htmlEncode(editor.lang.attachment.url)+''},{type:'hbox',widths:['280px','110px'],align:'right',children:[{id:'src',type:'text',label:'',validate:CKEDITOR.dialog.validate.notEmpty(editor.lang.flash.validateSrc),setup:function(data){if(data.url)this.setValue(data.url);this.select()},commit:function(data){data.url=this.getValue()}},{type:'button',id:'browse',filebrowser:'general:src',hidden:true,align:'center',label:editor.lang.common.browseServer}]}]},{type:'vbox',padding:0,children:[{id:'name',type:'text',label:editor.lang.attachment.name,setup:function(data){if(data.title)this.setValue(data.title)},commit:function(data){data.title=this.getValue()}}]},{type:'hbox',widths:['50%','50%'],children:[{type:'select',id:'linkTargetType',label:editor.lang.link.target,'default':'notSet',style:'width : 100%;','items':[[editor.lang.link.targetNotSet,'notSet'],[editor.lang.link.targetFrame,'frame'],[editor.lang.link.targetNew,'_blank'],[editor.lang.link.targetTop,'_top'],[editor.lang.link.targetSelf,'_self'],[editor.lang.link.targetParent,'_parent']],onChange:targetChanged,setup:function(data){if(data.target)this.setValue(data.target.type)},commit:function(data){if(!data.target)data.target={};data.target.type=this.getValue()}},{type:'text',id:'linkTargetName',label:editor.lang.link.targetFrameName,'default':'',setup:function(data){if(data.target)this.setValue(data.target.name)},commit:function(data){if(!data.target)data.target={};data.target.name=this.getValue()}}]}]},{id:'Upload',hidden:true,filebrowser:'uploadButton',label:editor.lang.common.upload,elements:[{type:'file',id:'upload',label:editor.lang.common.upload,size:38},{type:'fileButton',id:'uploadButton',label:editor.lang.common.uploadSubmit,filebrowser:'general:src','for':['Upload','upload']}]},]}})})(); +(function(){CKEDITOR.dialog.add('attachment',function(editor){var selectableTargets=/^(_(?:self|top|parent|blank))$/;var parseLink=function(editor,element){var href=element?(element.getAttribute('_cke_saved_href')||element.getAttribute('href')):'',emailMatch,anchorMatch,urlMatch,retval={};retval.type='url';retval.url=href;if(element){var target=element.getAttribute('target');retval.target={};if(target){var targetMatch=target.match(selectableTargets);if(targetMatch)retval.target.type=retval.target.name=target;else{retval.target.type='frame';retval.target.name=target}}var me=this;retval.title=element.getAttribute('title')}var elements=editor.document.getElementsByTag('img'),realAnchors=new CKEDITOR.dom.nodeList(editor.document.$.anchors),anchors=retval.anchors=[];for(var i=0;i',editor.document);selection=editor.getSelection();element.moveChildren(newElement);element.copyAttributes(newElement,{name:1});newElement.replace(element);element=newElement;selection.selectElement(element)}element.setAttributes(attributes);element.removeAttributes(removeAttributes);if(element.getAttribute('title'))element.setHtml(element.getAttribute('title'));if(element.getAttribute('name'))element.addClass('cke_anchor');else element.removeClass('cke_anchor');if(this.fakeObj)editor.createFakeElement(element,'cke_anchor','anchor').replace(this.fakeObj);delete this._.selectedElement}},contents:[{label:editor.lang.common.generalTab,id:'general',accessKey:'I',elements:[{type:'vbox',padding:0,children:[{type:'html',html:''+CKEDITOR.tools.htmlEncode(editor.lang.attachment.url)+''},{type:'hbox',widths:['280px','110px'],align:'right',children:[{id:'src',type:'text',label:'',validate:CKEDITOR.dialog.validate.notEmpty(editor.lang.flash.validateSrc),setup:function(data){if(data.url)this.setValue(data.url);this.select()},commit:function(data){data.url=this.getValue()}},{type:'button',id:'browse',filebrowser:'general:src',hidden:true,align:'center',label:editor.lang.common.browseServer}]}]},{type:'vbox',padding:0,children:[{id:'name',type:'text',label:editor.lang.attachment.name,setup:function(data){if(data.title)this.setValue(data.title)},commit:function(data){data.title=this.getValue()}}]},{type:'hbox',widths:['50%','50%'],children:[{type:'select',id:'linkTargetType',label:editor.lang.link.target,'default':'notSet',style:'width : 100%;','items':[[editor.lang.link.targetNotSet,'notSet'],[editor.lang.link.targetFrame,'frame'],[editor.lang.link.targetNew,'_blank'],[editor.lang.link.targetTop,'_top'],[editor.lang.link.targetSelf,'_self'],[editor.lang.link.targetParent,'_parent']],onChange:targetChanged,setup:function(data){if(data.target)this.setValue(data.target.type)},commit:function(data){if(!data.target)data.target={};data.target.type=this.getValue()}},{type:'text',id:'linkTargetName',label:editor.lang.link.targetFrameName,'default':'',setup:function(data){if(data.target)this.setValue(data.target.name)},commit:function(data){if(!data.target)data.target={};data.target.name=this.getValue()}}]}]},{id:'Upload',hidden:true,filebrowser:'uploadButton',label:editor.lang.common.upload,elements:[{type:'file',id:'upload',label:editor.lang.common.upload,size:38},{type:'fileButton',id:'uploadButton',label:editor.lang.common.uploadSubmit,filebrowser:'general:src','for':['Upload','upload']}]},]}})})(); diff --git a/public/javascripts/ckeditor/plugins/attachment/images/attachment.png b/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/images/attachment.png similarity index 100% rename from public/javascripts/ckeditor/plugins/attachment/images/attachment.png rename to lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/images/attachment.png diff --git a/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/lang/en.js b/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/lang/en.js new file mode 100644 index 0000000..02e73d1 --- /dev/null +++ b/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/lang/en.js @@ -0,0 +1,10 @@ +CKEDITOR.plugins.setLang('attachment', 'en', +{ + attachment : + { + title : "Insert attachment", + url: "URL", + name: "Title", + button : "Insert attachment" + } +}); diff --git a/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/lang/ru.js b/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/lang/ru.js new file mode 100644 index 0000000..46b3415 --- /dev/null +++ b/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/lang/ru.js @@ -0,0 +1,10 @@ +CKEDITOR.plugins.setLang('attachment', 'ru', +{ + attachment : + { + title : "Включить вложения", + url: "URL", + name: "Название", + button : "Вставить" + } +}); diff --git a/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/lang/uk.js b/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/lang/uk.js new file mode 100644 index 0000000..fc40425 --- /dev/null +++ b/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/lang/uk.js @@ -0,0 +1,10 @@ +CKEDITOR.plugins.setLang('attachment', 'uk', +{ + attachment : + { + title : "Вставити файл", + url: "URL", + name: "Назва", + button : "Вставити" + } +}); diff --git a/public/javascripts/ckeditor/plugins/attachment/plugin.js b/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/plugin.js similarity index 99% rename from public/javascripts/ckeditor/plugins/attachment/plugin.js rename to lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/plugin.js index 3b10cd5..c407f80 100644 --- a/public/javascripts/ckeditor/plugins/attachment/plugin.js +++ b/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/plugin.js @@ -1 +1 @@ -(function(){var attachmentCmd={exec:function(editor){editor.openDialog('attachment');return}};CKEDITOR.plugins.add('attachment',{lang:['en','ru','uk'],requires:['dialog'],init:function(editor){var commandName='attachment';editor.addCommand(commandName,attachmentCmd);editor.ui.addButton('Attachment',{label:editor.lang.attachment.button,command:commandName,icon:this.path+"images/attachment.png"});CKEDITOR.dialog.add(commandName,CKEDITOR.getUrl(this.path+'dialogs/attachment.js'))}})})(); +(function(){var attachmentCmd={exec:function(editor){editor.openDialog('attachment');return}};CKEDITOR.plugins.add('attachment',{lang:['en','ru','uk'],requires:['dialog'],init:function(editor){var commandName='attachment';editor.addCommand(commandName,attachmentCmd);editor.ui.addButton('Attachment',{label:editor.lang.attachment.button,command:commandName,icon:this.path+"images/attachment.png"});CKEDITOR.dialog.add(commandName,CKEDITOR.getUrl(this.path+'dialogs/attachment.js'))}})})(); diff --git a/public/javascripts/ckeditor/plugins/embed/dialogs/embed.js b/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/dialogs/embed.js similarity index 99% rename from public/javascripts/ckeditor/plugins/embed/dialogs/embed.js rename to lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/dialogs/embed.js index 55f6acf..d8cdb72 100644 --- a/public/javascripts/ckeditor/plugins/embed/dialogs/embed.js +++ b/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/dialogs/embed.js @@ -1 +1 @@ -(function(){CKEDITOR.dialog.add('embed',function(editor){return{title:editor.lang.embed.title,minWidth:CKEDITOR.env.ie&&CKEDITOR.env.quirks?368:350,minHeight:240,onShow:function(){this.getContentElement('general','content').getInputElement().setValue('')},onOk:function(){var text=this.getContentElement('general','content').getInputElement().getValue();this.getParentEditor().insertHtml(text)},contents:[{label:editor.lang.common.generalTab,id:'general',elements:[{type:'html',id:'pasteMsg',html:'
'+editor.lang.embed.pasteMsg+'
'},{type:'html',id:'content',style:'width:340px;height:170px',html:'',focus:function(){this.getElement().focus()}}]}]}})})(); +(function(){CKEDITOR.dialog.add('embed',function(editor){return{title:editor.lang.embed.title,minWidth:CKEDITOR.env.ie&&CKEDITOR.env.quirks?368:350,minHeight:240,onShow:function(){this.getContentElement('general','content').getInputElement().setValue('')},onOk:function(){var text=this.getContentElement('general','content').getInputElement().getValue();this.getParentEditor().insertHtml(text)},contents:[{label:editor.lang.common.generalTab,id:'general',elements:[{type:'html',id:'pasteMsg',html:'
'+editor.lang.embed.pasteMsg+'
'},{type:'html',id:'content',style:'width:340px;height:170px',html:'',focus:function(){this.getElement().focus()}}]}]}})})(); diff --git a/public/javascripts/ckeditor/plugins/embed/images/embed.png b/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/images/embed.png similarity index 100% rename from public/javascripts/ckeditor/plugins/embed/images/embed.png rename to lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/images/embed.png diff --git a/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/lang/en.js b/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/lang/en.js new file mode 100644 index 0000000..657ddcc --- /dev/null +++ b/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/lang/en.js @@ -0,0 +1,9 @@ +CKEDITOR.plugins.setLang('embed', 'en', +{ + embed : + { + title : "Paste embed", + button : "Paste embed", + pasteMsg : "Please, paste embed-code from Youtube, Myspace, Flickr and others sources into rectangle, using the keyboard (Ctrl + V), and click OK." + } +}); diff --git a/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/lang/ru.js b/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/lang/ru.js new file mode 100644 index 0000000..e42e2a4 --- /dev/null +++ b/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/lang/ru.js @@ -0,0 +1,9 @@ +CKEDITOR.plugins.setLang('embed', 'ru', +{ + embed : + { + title : "Вставить embed", + button : "Вставить embed", + pasteMsg : "Пожалуйста, вставьте embed-код с Youtube, Myspace, Flickr и других ресурсов в прямоугольник, используя сочетание клавиш (Ctrl+V), и нажмите OK." + } +}); diff --git a/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/lang/uk.js b/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/lang/uk.js new file mode 100644 index 0000000..12988e7 --- /dev/null +++ b/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/lang/uk.js @@ -0,0 +1,9 @@ +CKEDITOR.plugins.setLang('embed', 'uk', +{ + embed : + { + title : "Вставити embed", + button : "Вставити embed", + pasteMsg : "Будь ласка, вставте embed-код з Youtube, Myspace, Flickr та інших ресурсів в прямокутник, використовуючи (Ctrl+V), та нажміть OK." + } +}); diff --git a/public/javascripts/ckeditor/plugins/embed/plugin.js b/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/plugin.js similarity index 99% rename from public/javascripts/ckeditor/plugins/embed/plugin.js rename to lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/plugin.js index d0850fc..bc72dcd 100644 --- a/public/javascripts/ckeditor/plugins/embed/plugin.js +++ b/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/plugin.js @@ -1 +1 @@ -(function(){var embedCmd={exec:function(editor){editor.openDialog('embed');return}};CKEDITOR.plugins.add('embed',{lang:['en','ru','uk'],requires:['dialog'],init:function(editor){var commandName='embed';editor.addCommand(commandName,embedCmd);editor.ui.addButton('Embed',{label:editor.lang.embed.button,command:commandName,icon:this.path+"images/embed.png"});CKEDITOR.dialog.add(commandName,CKEDITOR.getUrl(this.path+'dialogs/embed.js'))}})})(); +(function(){var embedCmd={exec:function(editor){editor.openDialog('embed');return}};CKEDITOR.plugins.add('embed',{lang:['en','ru','uk'],requires:['dialog'],init:function(editor){var commandName='embed';editor.addCommand(commandName,embedCmd);editor.ui.addButton('Embed',{label:editor.lang.embed.button,command:commandName,icon:this.path+"images/embed.png"});CKEDITOR.dialog.add(commandName,CKEDITOR.getUrl(this.path+'dialogs/embed.js'))}})})(); diff --git a/public/javascripts/ckeditor/swfupload/fileprogress.js b/lib/generators/ckeditor/base/templates/ckeditor/swfupload/fileprogress.js similarity index 53% rename from public/javascripts/ckeditor/swfupload/fileprogress.js rename to lib/generators/ckeditor/base/templates/ckeditor/swfupload/fileprogress.js index 1fbf492..b8b111f 100644 --- a/public/javascripts/ckeditor/swfupload/fileprogress.js +++ b/lib/generators/ckeditor/base/templates/ckeditor/swfupload/fileprogress.js @@ -3,129 +3,117 @@ * Control object for displaying file info * ****************************************** */ -var FileThumb = new Class({ - initialize: function(element){ - this.element = $(element); - this.init(); - }, - - init: function(){ - this.element.getElements('div.FCKThumb').addEvents({ - 'mouseover': function(){ - this.addClass('FCKSelectedBox'); - }, - 'mouseout': function(){ - this.removeClass('FCKSelectedBox'); - }, - 'click': function(){ - image = this.getElement('img.image'); - setUrl(image.alt); - } - }); +function FileThumb(element_id) { + this.element = $('#' + element_id); + this.init(); +} - } -}); +FileThumb.prototype.init = function(){ + this.element.find('div.FCKThumb').each(function(){ + FileThumb.observe(this); + }); +} -var ToolBar = new Class({ - initialize: function(element){ - this.container = $(element); - this.buttons = new Array(); - - this.table = null; - }, - - clear: function(){ - this.buttons = new Array(); - }, - - init: function(){ - this.table = document.createElement('table'); - this.table.appendChild(document.createElement("TBODY")); - this.table.border = 0; - this.table.setAttribute('cellspacing', 0); - this.table.setAttribute('cellpadding', 0); - this.table.className = "TB_Toolbar"; - - var row = this.table.tBodies[0].insertRow(0); - var cell = row.insertCell(row.cells.length); - - div = document.createElement('div'); - div.className = 'TB_Start'; - div.innerHTML = " " - cell.appendChild(div); - - this.init_buttons(row); - - this.container.appendChild(this.table); - }, +FileThumb.observe = function(element){ + var element = $(element); + + element.unbind('mouseover'); + element.unbind('mouseout'); + element.unbind('click'); - init_buttons: function(row){ - - for(var i = 0; i < this.buttons.length; i++) - { - var cell = row.insertCell(row.cells.length); - this.buttons[i].init(); - cell.appendChild(this.buttons[i].element); - } + element.bind('mouseover', function(){ $(this).addClass('FCKSelectedBox') } ); + element.bind('mouseout', function(){ $(this).removeClass('FCKSelectedBox') } ); + element.find('div.FCKAsset').bind('click', function(){ setUrl( $(this).find('img.image').attr('alt') ); return false; } ); +} + +function ToolBar(element_id){ + this.container = document.getElementById(element_id); + this.buttons = new Array(); - } - -}); + this.table = null; +} -var Button = new Class({ - initialize: function(title, text, image){ - this.title = title; - this.text = text; - this.image = image; - - this.callback = function(){}; - this.element = null; - }, +ToolBar.prototype.clear = function(){ + this.buttons = new Array(); +} + +ToolBar.prototype.init = function(){ + this.table = document.createElement('table'); + this.table.appendChild(document.createElement("TBODY")); + this.table.border = 0; + this.table.setAttribute('cellspacing', 0); + this.table.setAttribute('cellpadding', 0); + this.table.className = "TB_Toolbar"; - init: function(){ - this.element = document.createElement('div'); - this.element.title = this.title; - this.element.className = "TB_Button"; - - table = document.createElement('table'); - table.appendChild(document.createElement("TBODY")); - table.border = 0; - table.setAttribute('cellspacing', 0); - table.setAttribute('cellpadding', 0); - - var row = table.tBodies[0].insertRow(0); - var cell = row.insertCell(row.cells.length); - - image = document.createElement('img'); - image.src = '/javascripts/ckeditor/images/' + this.image; - image.className = 'TB_Button_Image'; - - cell.appendChild(image); - - var cell = row.insertCell(row.cells.length); - cell.className = 'TB_Button_Text'; - cell.innerHTML = this.text; - row.appendChild(cell); - - var cell = row.insertCell(row.cells.length); - image = document.createElement('img'); - image.src = '/javascripts/ckeditor/images/spacer.gif'; - image.className = 'TB_Button_Padding'; - cell.appendChild(image); - - this.element.appendChild(table); - - this.element.addEvents({ - 'mouseover': function(){ - this.className = "TB_Button_Off_Over" - }, - 'mouseout': function(){ - this.className = "TB_Button" - }, - 'click': this.callback.bind(this) - }); + var row = this.table.tBodies[0].insertRow(0); + var cell = row.insertCell(row.cells.length); + + div = document.createElement('div'); + div.className = 'TB_Start'; + div.innerHTML = " " + cell.appendChild(div); + + this.init_buttons(row); + + this.container.appendChild(this.table); +} + +ToolBar.prototype.init_buttons = function(row){ + + for(var i = 0; i < this.buttons.length; i++) + { + var cell = row.insertCell(row.cells.length); + this.buttons[i].init(); + cell.appendChild(this.buttons[i].element); } -}); +} + +function Button(title, text, image){ + this.title = title; + this.text = text; + this.image = image; + + this.callback = function(){}; + this.element = null; +} + +Button.prototype.init = function(){ + this.element = document.createElement('div'); + this.element.title = this.title; + this.element.className = "TB_Button"; + + table = document.createElement('table'); + table.appendChild(document.createElement("TBODY")); + table.border = 0; + table.setAttribute('cellspacing', 0); + table.setAttribute('cellpadding', 0); + + var row = table.tBodies[0].insertRow(0); + var cell = row.insertCell(row.cells.length); + + image = document.createElement('img'); + image.src = '/javascripts/ckeditor/images/' + this.image; + image.className = 'TB_Button_Image'; + + cell.appendChild(image); + + var cell = row.insertCell(row.cells.length); + cell.className = 'TB_Button_Text'; + cell.innerHTML = this.text; + row.appendChild(cell); + + var cell = row.insertCell(row.cells.length); + image = document.createElement('img'); + image.src = '/javascripts/ckeditor/images/spacer.gif'; + image.className = 'TB_Button_Padding'; + cell.appendChild(image); + + this.element.appendChild(table); + + this.element.onclick = this.callback; + this.element.onmouseover = function addButtonHover() { this.className = "TB_Button_Off_Over"; } + this.element.onmouseout = function removeButtonHover() { this.className = "TB_Button"; } +} function FileProgress(file, targetID) { this.fileProgressID = "divFileProgress"; @@ -213,15 +201,15 @@ FileProgress.prototype.toggleCancel = function (show, swfuploadInstance) { }; FileProgress.prototype.createThumbnail = function(serverData) { - var object = JSON.decode(serverData); - var container = $('container'); + var object = jQuery.parseJSON(serverData); + var container = document.getElementById('container'); + var asset = (typeof(object.asset) == 'undefined') ? object : object.asset; var image_src = null; var image_alt = null; var file_size = null; var file_name = null; var file_date = null; - var asset = (typeof object.picture != 'undefined') ? object.picture : object.attachment_file; if (typeof asset == 'undefined') return; @@ -231,41 +219,27 @@ FileProgress.prototype.createThumbnail = function(serverData) { file_name = asset.filename; file_date = asset.format_created_at; - switch(asset.type.toLowerCase()) - { - case "picture": - image_src = object.picture.url_thumb; - image_alt = object.picture.url_content; - - break; - case "attachment_file" : - image_src = '/javascripts/ckeditor/images/ckfnothumb.gif'; - - if (file_name.indexOf('.swf') != -1) - { - image_src = '/javascripts/ckeditor/images/swf.gif'; - } - else if (file_name.indexOf('.pdf') != -1) - { - image_src = '/javascripts/ckeditor/images/pdf.gif'; - } - - break; - } + image_src = asset.url_thumb; + image_alt = asset.url_content; + + var thumb = document.createElement('DIV'); + thumb.className = 'FCKThumb'; - var div = new Element('div'); - div.className = 'FCKThumb'; + var div = document.createElement('DIV'); + div.className = 'FCKAsset'; var table = document.createElement('TABLE'); table.appendChild(document.createElement("TBODY")); table.border = 0; table.setAttribute('cellspacing', 0); table.setAttribute('cellpadding', 0); - table.width = 100; - table.height = 100; + table.setAttribute('width', 100); + table.setAttribute('height', 100); var row = table.tBodies[0].insertRow(0); var cell = row.insertCell(row.cells.length); + cell.setAttribute('align', 'center'); + cell.setAttribute('valign', 'middle'); cell.innerHTML = "" + image_alt + "" @@ -285,8 +259,8 @@ FileProgress.prototype.createThumbnail = function(serverData) { div.appendChild(div_name); div.appendChild(div_date); div.appendChild(div_size); + thumb.appendChild(div); - //container.appendChild(div); - div.inject(container, 'top'); - var f = new FileThumb('qu'); + container.appendChild(thumb); + FileThumb.observe(thumb); }; diff --git a/public/javascripts/ckeditor/swfupload/handlers.js b/lib/generators/ckeditor/base/templates/ckeditor/swfupload/handlers.js similarity index 92% rename from public/javascripts/ckeditor/swfupload/handlers.js rename to lib/generators/ckeditor/base/templates/ckeditor/swfupload/handlers.js index b44e708..eacc93d 100644 --- a/public/javascripts/ckeditor/swfupload/handlers.js +++ b/lib/generators/ckeditor/base/templates/ckeditor/swfupload/handlers.js @@ -1,3 +1,14 @@ +function setUrl(url) +{ + CKEDITOR.tools.callFunction(CKEditorFuncNum, url); + window.close(); +} + +function uploadButton(button) +{ + $('#fj').toggle(); +} + function uploadStart(file) { try { /* I don't want to do any file validation or anything, I'll just update the UI and @@ -22,7 +33,8 @@ function fileQueued(file) { progress.setProgress(0); progress.toggleCancel(true, this); - $('divFileProgressContainer').show(); + var e = document.getElementById('divFileProgressContainer'); + e.style.display = ''; } catch (ex) { this.debug(ex); } @@ -166,8 +178,4 @@ function uploadError(file, errorCode, message) { function queueComplete(numFilesUploaded) { var e = document.getElementById('divFileProgressContainer'); e.style.display = 'none'; - - //new Ajax.Request('/control/pictures/reload', {asynchronous:true, evalScripts:true, parameters:"assetable_type=" + assetable_type + "&assetable_id=" + assetable_id }); - /*var status = document.getElementById("divStatus"); - status.innerHTML = numFilesUploaded + " file" + (numFilesUploaded === 1 ? "" : "s") + " uploaded.";*/ } diff --git a/lib/generators/ckeditor/base/templates/ckeditor/swfupload/jquery-1.5.1.min.js b/lib/generators/ckeditor/base/templates/ckeditor/swfupload/jquery-1.5.1.min.js new file mode 100644 index 0000000..6437874 --- /dev/null +++ b/lib/generators/ckeditor/base/templates/ckeditor/swfupload/jquery-1.5.1.min.js @@ -0,0 +1,16 @@ +/*! + * jQuery JavaScript Library v1.5.1 + * http://jquery.com/ + * + * Copyright 2011, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Wed Feb 23 13:55:29 2011 -0500 + */ +(function(a,b){function cg(a){return d.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cd(a){if(!bZ[a]){var b=d("<"+a+">").appendTo("body"),c=b.css("display");b.remove();if(c==="none"||c==="")c="block";bZ[a]=c}return bZ[a]}function cc(a,b){var c={};d.each(cb.concat.apply([],cb.slice(0,b)),function(){c[this]=a});return c}function bY(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function bX(){try{return new a.XMLHttpRequest}catch(b){}}function bW(){d(a).unload(function(){for(var a in bU)bU[a](0,1)})}function bQ(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var e=a.dataTypes,f={},g,h,i=e.length,j,k=e[0],l,m,n,o,p;for(g=1;g=0===c})}function N(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function F(a,b){return(a&&a!=="*"?a+".":"")+b.replace(r,"`").replace(s,"&")}function E(a){var b,c,e,f,g,h,i,j,k,l,m,n,o,q=[],r=[],s=d._data(this,"events");if(a.liveFired!==this&&s&&s.live&&!a.target.disabled&&(!a.button||a.type!=="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var t=s.live.slice(0);for(i=0;ic)break;a.currentTarget=f.elem,a.data=f.handleObj.data,a.handleObj=f.handleObj,o=f.handleObj.origHandler.apply(f.elem,arguments);if(o===!1||a.isPropagationStopped()){c=f.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function C(a,c,e){var f=d.extend({},e[0]);f.type=a,f.originalEvent={},f.liveFired=b,d.event.handle.call(c,f),f.isDefaultPrevented()&&e[0].preventDefault()}function w(){return!0}function v(){return!1}function g(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function f(a,c,f){if(f===b&&a.nodeType===1){f=a.getAttribute("data-"+c);if(typeof f==="string"){try{f=f==="true"?!0:f==="false"?!1:f==="null"?null:d.isNaN(f)?e.test(f)?d.parseJSON(f):f:parseFloat(f)}catch(g){}d.data(a,c,f)}else f=b}return f}var c=a.document,d=function(){function I(){if(!d.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(I,1);return}d.ready()}}var d=function(a,b){return new d.fn.init(a,b,g)},e=a.jQuery,f=a.$,g,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,i=/\S/,j=/^\s+/,k=/\s+$/,l=/\d/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=navigator.userAgent,w,x=!1,y,z="then done fail isResolved isRejected promise".split(" "),A,B=Object.prototype.toString,C=Object.prototype.hasOwnProperty,D=Array.prototype.push,E=Array.prototype.slice,F=String.prototype.trim,G=Array.prototype.indexOf,H={};d.fn=d.prototype={constructor:d,init:function(a,e,f){var g,i,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!e&&c.body){this.context=c,this[0]=c.body,this.selector="body",this.length=1;return this}if(typeof a==="string"){g=h.exec(a);if(!g||!g[1]&&e)return!e||e.jquery?(e||f).find(a):this.constructor(e).find(a);if(g[1]){e=e instanceof d?e[0]:e,k=e?e.ownerDocument||e:c,j=m.exec(a),j?d.isPlainObject(e)?(a=[c.createElement(j[1])],d.fn.attr.call(a,e,!0)):a=[k.createElement(j[1])]:(j=d.buildFragment([g[1]],[k]),a=(j.cacheable?d.clone(j.fragment):j.fragment).childNodes);return d.merge(this,a)}i=c.getElementById(g[2]);if(i&&i.parentNode){if(i.id!==g[2])return f.find(a);this.length=1,this[0]=i}this.context=c,this.selector=a;return this}if(d.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return d.makeArray(a,this)},selector:"",jquery:"1.5.1",length:0,size:function(){return this.length},toArray:function(){return E.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var e=this.constructor();d.isArray(a)?D.apply(e,a):d.merge(e,a),e.prevObject=this,e.context=this.context,b==="find"?e.selector=this.selector+(this.selector?" ":"")+c:b&&(e.selector=this.selector+"."+b+"("+c+")");return e},each:function(a,b){return d.each(this,a,b)},ready:function(a){d.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(E.apply(this,arguments),"slice",E.call(arguments).join(","))},map:function(a){return this.pushStack(d.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:D,sort:[].sort,splice:[].splice},d.fn.init.prototype=d.fn,d.extend=d.fn.extend=function(){var a,c,e,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i==="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!=="object"&&!d.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;y.resolveWith(c,[d]),d.fn.trigger&&d(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!x){x=!0;if(c.readyState==="complete")return setTimeout(d.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",A,!1),a.addEventListener("load",d.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",A),a.attachEvent("onload",d.ready);var b=!1;try{b=a.frameElement==null}catch(e){}c.documentElement.doScroll&&b&&I()}}},isFunction:function(a){return d.type(a)==="function"},isArray:Array.isArray||function(a){return d.type(a)==="array"},isWindow:function(a){return a&&typeof a==="object"&&"setInterval"in a},isNaN:function(a){return a==null||!l.test(a)||isNaN(a)},type:function(a){return a==null?String(a):H[B.call(a)]||"object"},isPlainObject:function(a){if(!a||d.type(a)!=="object"||a.nodeType||d.isWindow(a))return!1;if(a.constructor&&!C.call(a,"constructor")&&!C.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a){}return c===b||C.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!=="string"||!b)return null;b=d.trim(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return a.JSON&&a.JSON.parse?a.JSON.parse(b):(new Function("return "+b))();d.error("Invalid JSON: "+b)},parseXML:function(b,c,e){a.DOMParser?(e=new DOMParser,c=e.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),e=c.documentElement,(!e||!e.nodeName||e.nodeName==="parsererror")&&d.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(a){if(a&&i.test(a)){var b=c.head||c.getElementsByTagName("head")[0]||c.documentElement,e=c.createElement("script");d.support.scriptEval()?e.appendChild(c.createTextNode(a)):e.text=a,b.insertBefore(e,b.firstChild),b.removeChild(e)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,e){var f,g=0,h=a.length,i=h===b||d.isFunction(a);if(e){if(i){for(f in a)if(c.apply(a[f],e)===!1)break}else for(;g1){var f=E.call(arguments,0),g=b,h=function(a){return function(b){f[a]=arguments.length>1?E.call(arguments,0):b,--g||c.resolveWith(e,f)}};while(b--)a=f[b],a&&d.isFunction(a.promise)?a.promise().then(h(b),c.reject):--g;g||c.resolveWith(e,f)}else c!==a&&c.resolve(a);return e},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}d.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.subclass=this.subclass,a.fn.init=function b(b,c){c&&c instanceof d&&!(c instanceof a)&&(c=a(c));return d.fn.init.call(this,b,c,e)},a.fn.init.prototype=a.fn;var e=a(c);return a},browser:{}}),y=d._Deferred(),d.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){H["[object "+b+"]"]=b.toLowerCase()}),w=d.uaMatch(v),w.browser&&(d.browser[w.browser]=!0,d.browser.version=w.version),d.browser.webkit&&(d.browser.safari=!0),G&&(d.inArray=function(a,b){return G.call(b,a)}),i.test(" ")&&(j=/^[\s\xA0]+/,k=/[\s\xA0]+$/),g=d(c),c.addEventListener?A=function(){c.removeEventListener("DOMContentLoaded",A,!1),d.ready()}:c.attachEvent&&(A=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",A),d.ready())});return d}();(function(){d.support={};var b=c.createElement("div");b.style.display="none",b.innerHTML="
- <%= render :partial=>"file", :collection=>@files %> + <%= render :partial => "ckeditor/asset", :collection => @pictures, :as => :asset %>
a";var e=b.getElementsByTagName("*"),f=b.getElementsByTagName("a")[0],g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=b.getElementsByTagName("input")[0];if(e&&e.length&&f){d.support={leadingWhitespace:b.firstChild.nodeType===3,tbody:!b.getElementsByTagName("tbody").length,htmlSerialize:!!b.getElementsByTagName("link").length,style:/red/.test(f.getAttribute("style")),hrefNormalized:f.getAttribute("href")==="/a",opacity:/^0.55$/.test(f.style.opacity),cssFloat:!!f.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,deleteExpando:!0,optDisabled:!1,checkClone:!1,noCloneEvent:!0,noCloneChecked:!0,boxModel:null,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableHiddenOffsets:!0},i.checked=!0,d.support.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,d.support.optDisabled=!h.disabled;var j=null;d.support.scriptEval=function(){if(j===null){var b=c.documentElement,e=c.createElement("script"),f="script"+d.now();try{e.appendChild(c.createTextNode("window."+f+"=1;"))}catch(g){}b.insertBefore(e,b.firstChild),a[f]?(j=!0,delete a[f]):j=!1,b.removeChild(e),b=e=f=null}return j};try{delete b.test}catch(k){d.support.deleteExpando=!1}!b.addEventListener&&b.attachEvent&&b.fireEvent&&(b.attachEvent("onclick",function l(){d.support.noCloneEvent=!1,b.detachEvent("onclick",l)}),b.cloneNode(!0).fireEvent("onclick")),b=c.createElement("div"),b.innerHTML="";var m=c.createDocumentFragment();m.appendChild(b.firstChild),d.support.checkClone=m.cloneNode(!0).cloneNode(!0).lastChild.checked,d(function(){var a=c.createElement("div"),b=c.getElementsByTagName("body")[0];if(b){a.style.width=a.style.paddingLeft="1px",b.appendChild(a),d.boxModel=d.support.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,d.support.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="
",d.support.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
t
";var e=a.getElementsByTagName("td");d.support.reliableHiddenOffsets=e[0].offsetHeight===0,e[0].style.display="",e[1].style.display="none",d.support.reliableHiddenOffsets=d.support.reliableHiddenOffsets&&e[0].offsetHeight===0,a.innerHTML="",b.removeChild(a).style.display="none",a=e=null}});var n=function(a){var b=c.createElement("div");a="on"+a;if(!b.attachEvent)return!0;var d=a in b;d||(b.setAttribute(a,"return;"),d=typeof b[a]==="function"),b=null;return d};d.support.submitBubbles=n("submit"),d.support.changeBubbles=n("change"),b=e=f=null}})();var e=/^(?:\{.*\}|\[.*\])$/;d.extend({cache:{},uuid:0,expando:"jQuery"+(d.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?d.cache[a[d.expando]]:a[d.expando];return!!a&&!g(a)},data:function(a,c,e,f){if(d.acceptData(a)){var g=d.expando,h=typeof c==="string",i,j=a.nodeType,k=j?d.cache:a,l=j?a[d.expando]:a[d.expando]&&d.expando;if((!l||f&&l&&!k[l][g])&&h&&e===b)return;l||(j?a[d.expando]=l=++d.uuid:l=d.expando),k[l]||(k[l]={},j||(k[l].toJSON=d.noop));if(typeof c==="object"||typeof c==="function")f?k[l][g]=d.extend(k[l][g],c):k[l]=d.extend(k[l],c);i=k[l],f&&(i[g]||(i[g]={}),i=i[g]),e!==b&&(i[c]=e);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[c]:i}},removeData:function(b,c,e){if(d.acceptData(b)){var f=d.expando,h=b.nodeType,i=h?d.cache:b,j=h?b[d.expando]:d.expando;if(!i[j])return;if(c){var k=e?i[j][f]:i[j];if(k){delete k[c];if(!g(k))return}}if(e){delete i[j][f];if(!g(i[j]))return}var l=i[j][f];d.support.deleteExpando||i!=a?delete i[j]:i[j]=null,l?(i[j]={},h||(i[j].toJSON=d.noop),i[j][f]=l):h&&(d.support.deleteExpando?delete b[d.expando]:b.removeAttribute?b.removeAttribute(d.expando):b[d.expando]=null)}},_data:function(a,b,c){return d.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=d.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),d.fn.extend({data:function(a,c){var e=null;if(typeof a==="undefined"){if(this.length){e=d.data(this[0]);if(this[0].nodeType===1){var g=this[0].attributes,h;for(var i=0,j=g.length;i-1)return!0;return!1},val:function(a){if(!arguments.length){var c=this[0];if(c){if(d.nodeName(c,"option")){var e=c.attributes.value;return!e||e.specified?c.value:c.text}if(d.nodeName(c,"select")){var f=c.selectedIndex,g=[],h=c.options,i=c.type==="select-one";if(f<0)return null;for(var k=i?f:0,l=i?f+1:h.length;k=0;else if(d.nodeName(this,"select")){var f=d.makeArray(e);d("option",this).each(function(){this.selected=d.inArray(d(this).val(),f)>=0}),f.length||(this.selectedIndex=-1)}else this.value=e}})}}),d.extend({attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,e,f){if(!a||a.nodeType===3||a.nodeType===8||a.nodeType===2)return b;if(f&&c in d.attrFn)return d(a)[c](e);var g=a.nodeType!==1||!d.isXMLDoc(a),h=e!==b;c=g&&d.props[c]||c;if(a.nodeType===1){var i=k.test(c);if(c==="selected"&&!d.support.optSelected){var j=a.parentNode;j&&(j.selectedIndex,j.parentNode&&j.parentNode.selectedIndex)}if((c in a||a[c]!==b)&&g&&!i){h&&(c==="type"&&l.test(a.nodeName)&&a.parentNode&&d.error("type property can't be changed"),e===null?a.nodeType===1&&a.removeAttribute(c):a[c]=e);if(d.nodeName(a,"form")&&a.getAttributeNode(c))return a.getAttributeNode(c).nodeValue;if(c==="tabIndex"){var o=a.getAttributeNode("tabIndex");return o&&o.specified?o.value:m.test(a.nodeName)||n.test(a.nodeName)&&a.href?0:b}return a[c]}if(!d.support.style&&g&&c==="style"){h&&(a.style.cssText=""+e);return a.style.cssText}h&&a.setAttribute(c,""+e);if(!a.attributes[c]&&(a.hasAttribute&&!a.hasAttribute(c)))return b;var p=!d.support.hrefNormalized&&g&&i?a.getAttribute(c,2):a.getAttribute(c);return p===null?b:p}h&&(a[c]=e);return a[c]}});var p=/\.(.*)$/,q=/^(?:textarea|input|select)$/i,r=/\./g,s=/ /g,t=/[^\w\s.|`]/g,u=function(a){return a.replace(t,"\\$&")};d.event={add:function(c,e,f,g){if(c.nodeType!==3&&c.nodeType!==8){try{d.isWindow(c)&&(c!==a&&!c.frameElement)&&(c=a)}catch(h){}if(f===!1)f=v;else if(!f)return;var i,j;f.handler&&(i=f,f=i.handler),f.guid||(f.guid=d.guid++);var k=d._data(c);if(!k)return;var l=k.events,m=k.handle;l||(k.events=l={}),m||(k.handle=m=function(){return typeof d!=="undefined"&&!d.event.triggered?d.event.handle.apply(m.elem,arguments):b}),m.elem=c,e=e.split(" ");var n,o=0,p;while(n=e[o++]){j=i?d.extend({},i):{handler:f,data:g},n.indexOf(".")>-1?(p=n.split("."),n=p.shift(),j.namespace=p.slice(0).sort().join(".")):(p=[],j.namespace=""),j.type=n,j.guid||(j.guid=f.guid);var q=l[n],r=d.event.special[n]||{};if(!q){q=l[n]=[];if(!r.setup||r.setup.call(c,g,p,m)===!1)c.addEventListener?c.addEventListener(n,m,!1):c.attachEvent&&c.attachEvent("on"+n,m)}r.add&&(r.add.call(c,j),j.handler.guid||(j.handler.guid=f.guid)),q.push(j),d.event.global[n]=!0}c=null}},global:{},remove:function(a,c,e,f){if(a.nodeType!==3&&a.nodeType!==8){e===!1&&(e=v);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=d.hasData(a)&&d._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(e=c.handler,c=c.type);if(!c||typeof c==="string"&&c.charAt(0)==="."){c=c||"";for(h in t)d.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+d.map(m.slice(0).sort(),u).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!e){for(j=0;j=0&&(a.type=f=f.slice(0,-1),a.exclusive=!0),e||(a.stopPropagation(),d.event.global[f]&&d.each(d.cache,function(){var b=d.expando,e=this[b];e&&e.events&&e.events[f]&&d.event.trigger(a,c,e.handle.elem)}));if(!e||e.nodeType===3||e.nodeType===8)return b;a.result=b,a.target=e,c=d.makeArray(c),c.unshift(a)}a.currentTarget=e;var h=d._data(e,"handle");h&&h.apply(e,c);var i=e.parentNode||e.ownerDocument;try{e&&e.nodeName&&d.noData[e.nodeName.toLowerCase()]||e["on"+f]&&e["on"+f].apply(e,c)===!1&&(a.result=!1,a.preventDefault())}catch(j){}if(!a.isPropagationStopped()&&i)d.event.trigger(a,c,i,!0);else if(!a.isDefaultPrevented()){var k,l=a.target,m=f.replace(p,""),n=d.nodeName(l,"a")&&m==="click",o=d.event.special[m]||{};if((!o._default||o._default.call(e,a)===!1)&&!n&&!(l&&l.nodeName&&d.noData[l.nodeName.toLowerCase()])){try{l[m]&&(k=l["on"+m],k&&(l["on"+m]=null),d.event.triggered=!0,l[m]())}catch(q){}k&&(l["on"+m]=k),d.event.triggered=!1}}},handle:function(c){var e,f,g,h,i,j=[],k=d.makeArray(arguments);c=k[0]=d.event.fix(c||a.event),c.currentTarget=this,e=c.type.indexOf(".")<0&&!c.exclusive,e||(g=c.type.split("."),c.type=g.shift(),j=g.slice(0).sort(),h=new RegExp("(^|\\.)"+j.join("\\.(?:.*\\.)?")+"(\\.|$)")),c.namespace=c.namespace||j.join("."),i=d._data(this,"events"),f=(i||{})[c.type];if(i&&f){f=f.slice(0);for(var l=0,m=f.length;l-1?d.map(a.options,function(a){return a.selected}).join("-"):"":a.nodeName.toLowerCase()==="select"&&(c=a.selectedIndex);return c},B=function B(a){var c=a.target,e,f;if(q.test(c.nodeName)&&!c.readOnly){e=d._data(c,"_change_data"),f=A(c),(a.type!=="focusout"||c.type!=="radio")&&d._data(c,"_change_data",f);if(e===b||f===e)return;if(e!=null||f)a.type="change",a.liveFired=b,d.event.trigger(a,arguments[1],c)}};d.event.special.change={filters:{focusout:B,beforedeactivate:B,click:function(a){var b=a.target,c=b.type;(c==="radio"||c==="checkbox"||b.nodeName.toLowerCase()==="select")&&B.call(this,a)},keydown:function(a){var b=a.target,c=b.type;(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&B.call(this,a)},beforeactivate:function(a){var b=a.target;d._data(b,"_change_data",A(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in z)d.event.add(this,c+".specialChange",z[c]);return q.test(this.nodeName)},teardown:function(a){d.event.remove(this,".specialChange");return q.test(this.nodeName)}},z=d.event.special.change.filters,z.focus=z.beforeactivate}c.addEventListener&&d.each({focus:"focusin",blur:"focusout"},function(a,b){function c(a){a=d.event.fix(a),a.type=b;return d.event.handle.call(this,a)}d.event.special[b]={setup:function(){this.addEventListener(a,c,!0)},teardown:function(){this.removeEventListener(a,c,!0)}}}),d.each(["bind","one"],function(a,c){d.fn[c]=function(a,e,f){if(typeof a==="object"){for(var g in a)this[c](g,e,a[g],f);return this}if(d.isFunction(e)||e===!1)f=e,e=b;var h=c==="one"?d.proxy(f,function(a){d(this).unbind(a,h);return f.apply(this,arguments)}):f;if(a==="unload"&&c!=="one")this.one(a,e,f);else for(var i=0,j=this.length;i0?this.bind(b,a,c):this.trigger(b)},d.attrFn&&(d.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,e,g){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!=="string")return e;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(f.call(n)==="[object Array]")if(u)if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&e.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&e.push(j[t]);else e.push.apply(e,n);else p(n,e);o&&(k(o,h,e,g),k.uniqueSort(e));return e};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e":function(a,b){var c,d=typeof b==="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){return"text"===a.getAttribute("type")},radio:function(a){return"radio"===a.type},checkbox:function(a){return"checkbox"===a.type},file:function(a){return"file"===a.type},password:function(a){return"password"===a.type},submit:function(a){return"submit"===a.type},image:function(a){return"image"===a.type},reset:function(a){return"reset"===a.type},button:function(a){return"button"===a.type||a.nodeName.toLowerCase()==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(f.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length==="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!=="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!=="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!=="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!=="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector,d=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(e){d=!0}b&&(k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(d||!l.match.PSEUDO.test(c)&&!/!=/.test(c))return b.call(a,c)}catch(e){}return k(c,null,null,[a]).length>0})}(),function(){var a=c.createElement("div");a.innerHTML="
";if(a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!=="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g0)for(var g=c;g0},closest:function(a,b){var c=[],e,f,g=this[0];if(d.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(e=0,f=a.length;e-1:d(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=L.test(a)?d(a,b||this.context):null;for(e=0,f=this.length;e-1:d.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b)break}}c=c.length>1?d.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a==="string")return d.inArray(this[0],a?d(a):this.parent().children());return d.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a==="string"?d(a,b):d.makeArray(a),e=d.merge(this.get(),c);return this.pushStack(N(c[0])||N(e[0])?e:d.unique(e))},andSelf:function(){return this.add(this.prevObject)}}),d.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return d.dir(a,"parentNode")},parentsUntil:function(a,b,c){return d.dir(a,"parentNode",c)},next:function(a){return d.nth(a,2,"nextSibling")},prev:function(a){return d.nth(a,2,"previousSibling")},nextAll:function(a){return d.dir(a,"nextSibling")},prevAll:function(a){return d.dir(a,"previousSibling")},nextUntil:function(a,b,c){return d.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return d.dir(a,"previousSibling",c)},siblings:function(a){return d.sibling(a.parentNode.firstChild,a)},children:function(a){return d.sibling(a.firstChild)},contents:function(a){return d.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:d.makeArray(a.childNodes)}},function(a,b){d.fn[a]=function(c,e){var f=d.map(this,b,c),g=K.call(arguments);G.test(a)||(e=c),e&&typeof e==="string"&&(f=d.filter(e,f)),f=this.length>1&&!M[a]?d.unique(f):f,(this.length>1||I.test(e))&&H.test(a)&&(f=f.reverse());return this.pushStack(f,a,g.join(","))}}),d.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?d.find.matchesSelector(b[0],a)?[b[0]]:[]:d.find.matches(a,b)},dir:function(a,c,e){var f=[],g=a[c];while(g&&g.nodeType!==9&&(e===b||g.nodeType!==1||!d(g).is(e)))g.nodeType===1&&f.push(g),g=g[c];return f},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var P=/ jQuery\d+="(?:\d+|null)"/g,Q=/^\s+/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,S=/<([\w:]+)/,T=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};X.optgroup=X.option,X.tbody=X.tfoot=X.colgroup=X.caption=X.thead,X.th=X.td,d.support.htmlSerialize||(X._default=[1,"div
","
"]),d.fn.extend({text:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.text(a.call(this,b,c.text()))});if(typeof a!=="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return d.text(this)},wrapAll:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapAll(a.call(this,b))});if(this[0]){var b=d(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapInner(a.call(this,b))});return this.each(function(){var b=d(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){d(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){d.nodeName(this,"body")||d(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=d(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,d(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,e;(e=this[c])!=null;c++)if(!a||d.filter(a,[e]).length)!b&&e.nodeType===1&&(d.cleanData(e.getElementsByTagName("*")),d.cleanData([e])),e.parentNode&&e.parentNode.removeChild(e);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&d.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return d.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(P,""):null;if(typeof a!=="string"||V.test(a)||!d.support.leadingWhitespace&&Q.test(a)||X[(S.exec(a)||["",""])[1].toLowerCase()])d.isFunction(a)?this.each(function(b){var c=d(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);else{a=a.replace(R,"<$1>");try{for(var c=0,e=this.length;c1&&l0?this.clone(!0):this).get();d(f[h])[b](j),e=e.concat(j)}return this.pushStack(e,a,f.selector)}}),d.extend({clone:function(a,b,c){var e=a.cloneNode(!0),f,g,h;if((!d.support.noCloneEvent||!d.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!d.isXMLDoc(a)){$(a,e),f=_(a),g=_(e);for(h=0;f[h];++h)$(f[h],g[h])}if(b){Z(a,e);if(c){f=_(a),g=_(e);for(h=0;f[h];++h)Z(f[h],g[h])}}return e},clean:function(a,b,e,f){b=b||c,typeof b.createElement==="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var g=[];for(var h=0,i;(i=a[h])!=null;h++){typeof i==="number"&&(i+="");if(!i)continue;if(typeof i!=="string"||U.test(i)){if(typeof i==="string"){i=i.replace(R,"<$1>");var j=(S.exec(i)||["",""])[1].toLowerCase(),k=X[j]||X._default,l=k[0],m=b.createElement("div");m.innerHTML=k[1]+i+k[2];while(l--)m=m.lastChild;if(!d.support.tbody){var n=T.test(i),o=j==="table"&&!n?m.firstChild&&m.firstChild.childNodes:k[1]===""&&!n?m.childNodes:[];for(var p=o.length-1;p>=0;--p)d.nodeName(o[p],"tbody")&&!o[p].childNodes.length&&o[p].parentNode.removeChild(o[p])}!d.support.leadingWhitespace&&Q.test(i)&&m.insertBefore(b.createTextNode(Q.exec(i)[0]),m.firstChild),i=m.childNodes}}else i=b.createTextNode(i);i.nodeType?g.push(i):g=d.merge(g,i)}if(e)for(h=0;g[h];h++)!f||!d.nodeName(g[h],"script")||g[h].type&&g[h].type.toLowerCase()!=="text/javascript"?(g[h].nodeType===1&&g.splice.apply(g,[h+1,0].concat(d.makeArray(g[h].getElementsByTagName("script")))),e.appendChild(g[h])):f.push(g[h].parentNode?g[h].parentNode.removeChild(g[h]):g[h]);return g},cleanData:function(a){var b,c,e=d.cache,f=d.expando,g=d.event.special,h=d.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&d.noData[j.nodeName.toLowerCase()])continue;c=j[d.expando];if(c){b=e[c]&&e[c][f];if(b&&b.events){for(var k in b.events)g[k]?d.event.remove(j,k):d.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[d.expando]:j.removeAttribute&&j.removeAttribute(d.expando),delete e[c]}}}});var bb=/alpha\([^)]*\)/i,bc=/opacity=([^)]*)/,bd=/-([a-z])/ig,be=/([A-Z])/g,bf=/^-?\d+(?:px)?$/i,bg=/^-?\d/,bh={position:"absolute",visibility:"hidden",display:"block"},bi=["Left","Right"],bj=["Top","Bottom"],bk,bl,bm,bn=function(a,b){return b.toUpperCase()};d.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return d.access(this,a,c,!0,function(a,c,e){return e!==b?d.style(a,c,e):d.css(a,c)})},d.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bk(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{zIndex:!0,fontWeight:!0,opacity:!0,zoom:!0,lineHeight:!0},cssProps:{"float":d.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,e,f){if(a&&a.nodeType!==3&&a.nodeType!==8&&a.style){var g,h=d.camelCase(c),i=a.style,j=d.cssHooks[h];c=d.cssProps[h]||h;if(e===b){if(j&&"get"in j&&(g=j.get(a,!1,f))!==b)return g;return i[c]}if(typeof e==="number"&&isNaN(e)||e==null)return;typeof e==="number"&&!d.cssNumber[h]&&(e+="px");if(!j||!("set"in j)||(e=j.set(a,e))!==b)try{i[c]=e}catch(k){}}},css:function(a,c,e){var f,g=d.camelCase(c),h=d.cssHooks[g];c=d.cssProps[g]||g;if(h&&"get"in h&&(f=h.get(a,!0,e))!==b)return f;if(bk)return bk(a,c,g)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]},camelCase:function(a){return a.replace(bd,bn)}}),d.curCSS=d.css,d.each(["height","width"],function(a,b){d.cssHooks[b]={get:function(a,c,e){var f;if(c){a.offsetWidth!==0?f=bo(a,b,e):d.swap(a,bh,function(){f=bo(a,b,e)});if(f<=0){f=bk(a,b,b),f==="0px"&&bm&&(f=bm(a,b,b));if(f!=null)return f===""||f==="auto"?"0px":f}if(f<0||f==null){f=a.style[b];return f===""||f==="auto"?"0px":f}return typeof f==="string"?f:f+"px"}},set:function(a,b){if(!bf.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),d.support.opacity||(d.cssHooks.opacity={get:function(a,b){return bc.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style;c.zoom=1;var e=d.isNaN(b)?"":"alpha(opacity="+b*100+")",f=c.filter||"";c.filter=bb.test(f)?f.replace(bb,e):c.filter+" "+e}}),c.defaultView&&c.defaultView.getComputedStyle&&(bl=function(a,c,e){var f,g,h;e=e.replace(be,"-$1").toLowerCase();if(!(g=a.ownerDocument.defaultView))return b;if(h=g.getComputedStyle(a,null))f=h.getPropertyValue(e),f===""&&!d.contains(a.ownerDocument.documentElement,a)&&(f=d.style(a,e));return f}),c.documentElement.currentStyle&&(bm=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bf.test(d)&&bg.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bk=bl||bm,d.expr&&d.expr.filters&&(d.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!d.support.reliableHiddenOffsets&&(a.style.display||d.css(a,"display"))==="none"},d.expr.filters.visible=function(a){return!d.expr.filters.hidden(a)});var bp=/%20/g,bq=/\[\]$/,br=/\r?\n/g,bs=/#.*$/,bt=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bu=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bv=/(?:^file|^widget|\-extension):$/,bw=/^(?:GET|HEAD)$/,bx=/^\/\//,by=/\?/,bz=/)<[^<]*)*<\/script>/gi,bA=/^(?:select|textarea)/i,bB=/\s+/,bC=/([?&])_=[^&]*/,bD=/(^|\-)([a-z])/g,bE=function(a,b,c){return b+c.toUpperCase()},bF=/^([\w\+\.\-]+:)\/\/([^\/?#:]*)(?::(\d+))?/,bG=d.fn.load,bH={},bI={},bJ,bK;try{bJ=c.location.href}catch(bL){bJ=c.createElement("a"),bJ.href="",bJ=bJ.href}bK=bF.exec(bJ.toLowerCase()),d.fn.extend({load:function(a,c,e){if(typeof a!=="string"&&bG)return bG.apply(this,arguments);if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var g=a.slice(f,a.length);a=a.slice(0,f)}var h="GET";c&&(d.isFunction(c)?(e=c,c=b):typeof c==="object"&&(c=d.param(c,d.ajaxSettings.traditional),h="POST"));var i=this;d.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?d("
").append(c.replace(bz,"")).find(g):c)),e&&i.each(e,[c,b,a])}});return this},serialize:function(){return d.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?d.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bA.test(this.nodeName)||bu.test(this.type))}).map(function(a,b){var c=d(this).val();return c==null?null:d.isArray(c)?d.map(c,function(a,c){return{name:b.name,value:a.replace(br,"\r\n")}}):{name:b.name,value:c.replace(br,"\r\n")}}).get()}}),d.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){d.fn[b]=function(a){return this.bind(b,a)}}),d.each(["get","post"],function(a,c){d[c]=function(a,e,f,g){d.isFunction(e)&&(g=g||f,f=e,e=b);return d.ajax({type:c,url:a,data:e,success:f,dataType:g})}}),d.extend({getScript:function(a,c){return d.get(a,b,c,"script")},getJSON:function(a,b,c){return d.get(a,b,c,"json")},ajaxSetup:function(a,b){b?d.extend(!0,a,d.ajaxSettings,b):(b=a,a=d.extend(!0,d.ajaxSettings,b));for(var c in {context:1,url:1})c in b?a[c]=b[c]:c in d.ajaxSettings&&(a[c]=d.ajaxSettings[c]);return a},ajaxSettings:{url:bJ,isLocal:bv.test(bK[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":d.parseJSON,"text xml":d.parseXML}},ajaxPrefilter:bM(bH),ajaxTransport:bM(bI),ajax:function(a,c){function v(a,c,l,n){if(r!==2){r=2,p&&clearTimeout(p),o=b,m=n||"",u.readyState=a?4:0;var q,t,v,w=l?bP(e,u,l):b,x,y;if(a>=200&&a<300||a===304){if(e.ifModified){if(x=u.getResponseHeader("Last-Modified"))d.lastModified[k]=x;if(y=u.getResponseHeader("Etag"))d.etag[k]=y}if(a===304)c="notmodified",q=!0;else try{t=bQ(e,w),c="success",q=!0}catch(z){c="parsererror",v=z}}else{v=c;if(!c||a)c="error",a<0&&(a=0)}u.status=a,u.statusText=c,q?h.resolveWith(f,[t,c,u]):h.rejectWith(f,[u,c,v]),u.statusCode(j),j=b,s&&g.trigger("ajax"+(q?"Success":"Error"),[u,e,q?t:v]),i.resolveWith(f,[u,c]),s&&(g.trigger("ajaxComplete",[u,e]),--d.active||d.event.trigger("ajaxStop"))}}typeof a==="object"&&(c=a,a=b),c=c||{};var e=d.ajaxSetup({},c),f=e.context||e,g=f!==e&&(f.nodeType||f instanceof d)?d(f):d.event,h=d.Deferred(),i=d._Deferred(),j=e.statusCode||{},k,l={},m,n,o,p,q,r=0,s,t,u={readyState:0,setRequestHeader:function(a,b){r||(l[a.toLowerCase().replace(bD,bE)]=b);return this},getAllResponseHeaders:function(){return r===2?m:null},getResponseHeader:function(a){var c;if(r===2){if(!n){n={};while(c=bt.exec(m))n[c[1].toLowerCase()]=c[2]}c=n[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){r||(e.mimeType=a);return this},abort:function(a){a=a||"abort",o&&o.abort(a),v(0,a);return this}};h.promise(u),u.success=u.done,u.error=u.fail,u.complete=i.done,u.statusCode=function(a){if(a){var b;if(r<2)for(b in a)j[b]=[j[b],a[b]];else b=a[u.status],u.then(b,b)}return this},e.url=((a||e.url)+"").replace(bs,"").replace(bx,bK[1]+"//"),e.dataTypes=d.trim(e.dataType||"*").toLowerCase().split(bB),e.crossDomain||(q=bF.exec(e.url.toLowerCase()),e.crossDomain=q&&(q[1]!=bK[1]||q[2]!=bK[2]||(q[3]||(q[1]==="http:"?80:443))!=(bK[3]||(bK[1]==="http:"?80:443)))),e.data&&e.processData&&typeof e.data!=="string"&&(e.data=d.param(e.data,e.traditional)),bN(bH,e,c,u);if(r===2)return!1;s=e.global,e.type=e.type.toUpperCase(),e.hasContent=!bw.test(e.type),s&&d.active++===0&&d.event.trigger("ajaxStart");if(!e.hasContent){e.data&&(e.url+=(by.test(e.url)?"&":"?")+e.data),k=e.url;if(e.cache===!1){var w=d.now(),x=e.url.replace(bC,"$1_="+w);e.url=x+(x===e.url?(by.test(e.url)?"&":"?")+"_="+w:"")}}if(e.data&&e.hasContent&&e.contentType!==!1||c.contentType)l["Content-Type"]=e.contentType;e.ifModified&&(k=k||e.url,d.lastModified[k]&&(l["If-Modified-Since"]=d.lastModified[k]),d.etag[k]&&(l["If-None-Match"]=d.etag[k])),l.Accept=e.dataTypes[0]&&e.accepts[e.dataTypes[0]]?e.accepts[e.dataTypes[0]]+(e.dataTypes[0]!=="*"?", */*; q=0.01":""):e.accepts["*"];for(t in e.headers)u.setRequestHeader(t,e.headers[t]);if(e.beforeSend&&(e.beforeSend.call(f,u,e)===!1||r===2)){u.abort();return!1}for(t in {success:1,error:1,complete:1})u[t](e[t]);o=bN(bI,e,c,u);if(o){u.readyState=1,s&&g.trigger("ajaxSend",[u,e]),e.async&&e.timeout>0&&(p=setTimeout(function(){u.abort("timeout")},e.timeout));try{r=1,o.send(l,v)}catch(y){status<2?v(-1,y):d.error(y)}}else v(-1,"No Transport");return u},param:function(a,c){var e=[],f=function(a,b){b=d.isFunction(b)?b():b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=d.ajaxSettings.traditional);if(d.isArray(a)||a.jquery&&!d.isPlainObject(a))d.each(a,function(){f(this.name,this.value)});else for(var g in a)bO(g,a[g],c,f);return e.join("&").replace(bp,"+")}}),d.extend({active:0,lastModified:{},etag:{}});var bR=d.now(),bS=/(\=)\?(&|$)|()\?\?()/i;d.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return d.expando+"_"+bR++}}),d.ajaxPrefilter("json jsonp",function(b,c,e){var f=typeof b.data==="string";if(b.dataTypes[0]==="jsonp"||c.jsonpCallback||c.jsonp!=null||b.jsonp!==!1&&(bS.test(b.url)||f&&bS.test(b.data))){var g,h=b.jsonpCallback=d.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2",m=function(){a[h]=i,g&&d.isFunction(i)&&a[h](g[0])};b.jsonp!==!1&&(j=j.replace(bS,l),b.url===j&&(f&&(k=k.replace(bS,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},e.then(m,m),b.converters["script json"]=function(){g||d.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),d.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){d.globalEval(a);return a}}}),d.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),d.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var bT=d.now(),bU,bV;d.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&bX()||bY()}:bX,bV=d.ajaxSettings.xhr(),d.support.ajax=!!bV,d.support.cors=bV&&"withCredentials"in bV,bV=b,d.support.ajax&&d.ajaxTransport(function(a){if(!a.crossDomain||d.support.cors){var c;return{send:function(e,f){var g=a.xhr(),h,i;a.username?g.open(a.type,a.url,a.async,a.username,a.password):g.open(a.type,a.url,a.async);if(a.xhrFields)for(i in a.xhrFields)g[i]=a.xhrFields[i];a.mimeType&&g.overrideMimeType&&g.overrideMimeType(a.mimeType),(!a.crossDomain||a.hasContent)&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(i in e)g.setRequestHeader(i,e[i])}catch(j){}g.send(a.hasContent&&a.data||null),c=function(e,i){var j,k,l,m,n;try{if(c&&(i||g.readyState===4)){c=b,h&&(g.onreadystatechange=d.noop,delete bU[h]);if(i)g.readyState!==4&&g.abort();else{j=g.status,l=g.getAllResponseHeaders(),m={},n=g.responseXML,n&&n.documentElement&&(m.xml=n),m.text=g.responseText;try{k=g.statusText}catch(o){k=""}j||!a.isLocal||a.crossDomain?j===1223&&(j=204):j=m.text?200:404}}}catch(p){i||f(-1,p)}m&&f(j,k,m,l)},a.async&&g.readyState!==4?(bU||(bU={},bW()),h=bT++,g.onreadystatechange=bU[h]=c):c()},abort:function(){c&&c(0,1)}}}});var bZ={},b$=/^(?:toggle|show|hide)$/,b_=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,ca,cb=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];d.fn.extend({show:function(a,b,c){var e,f;if(a||a===0)return this.animate(cc("show",3),a,b,c);for(var g=0,h=this.length;g=0;a--)c[a].elem===this&&(b&&c[a](!0),c.splice(a,1))}),b||this.dequeue();return this}}),d.each({slideDown:cc("show",1),slideUp:cc("hide",1),slideToggle:cc("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){d.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),d.extend({speed:function(a,b,c){var e=a&&typeof a==="object"?d.extend({},a):{complete:c||!c&&b||d.isFunction(a)&&a,duration:a,easing:c&&b||b&&!d.isFunction(b)&&b};e.duration=d.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in d.fx.speeds?d.fx.speeds[e.duration]:d.fx.speeds._default,e.old=e.complete,e.complete=function(){e.queue!==!1&&d(this).dequeue(),d.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig||(b.orig={})}}),d.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(d.fx.step[this.prop]||d.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=d.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function g(a){return e.step(a)}var e=this,f=d.fx;this.startTime=d.now(),this.start=a,this.end=b,this.unit=c||this.unit||(d.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,g.elem=this.elem,g()&&d.timers.push(g)&&!ca&&(ca=setInterval(f.tick,f.interval))},show:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),d(this.elem).show()},hide:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=d.now(),c=!0;if(a||b>=this.options.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),this.options.curAnim[this.prop]=!0;for(var e in this.options.curAnim)this.options.curAnim[e]!==!0&&(c=!1);if(c){if(this.options.overflow!=null&&!d.support.shrinkWrapBlocks){var f=this.elem,g=this.options;d.each(["","X","Y"],function(a,b){f.style["overflow"+b]=g.overflow[a]})}this.options.hide&&d(this.elem).hide();if(this.options.hide||this.options.show)for(var h in this.options.curAnim)d.style(this.elem,h,this.options.orig[h]);this.options.complete.call(this.elem)}return!1}var i=b-this.startTime;this.state=i/this.options.duration;var j=this.options.specialEasing&&this.options.specialEasing[this.prop],k=this.options.easing||(d.easing.swing?"swing":"linear");this.pos=d.easing[j||k](this.state,i,0,1,this.options.duration),this.now=this.start+(this.end-this.start)*this.pos,this.update();return!0}},d.extend(d.fx,{tick:function(){var a=d.timers;for(var b=0;b
";d.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),e=b.firstChild,f=e.firstChild,h=e.nextSibling.firstChild.firstChild,this.doesNotAddBorder=f.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,f.style.position="fixed",f.style.top="20px",this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15,f.style.position=f.style.top="",e.style.overflow="hidden",e.style.position="relative",this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),a=b=e=f=g=h=null,d.offset.initialize=d.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;d.offset.initialize(),d.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(d.css(a,"marginTop"))||0,c+=parseFloat(d.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var e=d.css(a,"position");e==="static"&&(a.style.position="relative");var f=d(a),g=f.offset(),h=d.css(a,"top"),i=d.css(a,"left"),j=e==="absolute"&&d.inArray("auto",[h,i])>-1,k={},l={},m,n;j&&(l=f.position()),m=j?l.top:parseInt(h,10)||0,n=j?l.left:parseInt(i,10)||0,d.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):f.css(k)}},d.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),e=cf.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(d.css(a,"marginTop"))||0,c.left-=parseFloat(d.css(a,"marginLeft"))||0,e.top+=parseFloat(d.css(b[0],"borderTopWidth"))||0,e.left+=parseFloat(d.css(b[0],"borderLeftWidth"))||0;return{top:c.top-e.top,left:c.left-e.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&(!cf.test(a.nodeName)&&d.css(a,"position")==="static"))a=a.offsetParent;return a})}}),d.each(["Left","Top"],function(a,c){var e="scroll"+c;d.fn[e]=function(c){var f=this[0],g;if(!f)return null;if(c!==b)return this.each(function(){g=cg(this),g?g.scrollTo(a?d(g).scrollLeft():c,a?c:d(g).scrollTop()):this[e]=c});g=cg(f);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:d.support.boxModel&&g.document.documentElement[e]||g.document.body[e]:f[e]}}),d.each(["Height","Width"],function(a,c){var e=c.toLowerCase();d.fn["inner"+c]=function(){return this[0]?parseFloat(d.css(this[0],e,"padding")):null},d.fn["outer"+c]=function(a){return this[0]?parseFloat(d.css(this[0],e,a?"margin":"border")):null},d.fn[e]=function(a){var f=this[0];if(!f)return a==null?null:this;if(d.isFunction(a))return this.each(function(b){var c=d(this);c[e](a.call(this,b,c[e]()))});if(d.isWindow(f)){var g=f.document.documentElement["client"+c];return f.document.compatMode==="CSS1Compat"&&g||f.document.body["client"+c]||g}if(f.nodeType===9)return Math.max(f.documentElement["client"+c],f.body["scroll"+c],f.documentElement["scroll"+c],f.body["offset"+c],f.documentElement["offset"+c]);if(a===b){var h=d.css(f,e),i=parseFloat(h);return d.isNaN(i)?h:i}return this.css(e,typeof a==="string"?a:a+"px")}}),a.jQuery=a.$=d})(window); \ No newline at end of file diff --git a/public/javascripts/ckeditor/swfupload/querystring.js b/lib/generators/ckeditor/base/templates/ckeditor/swfupload/querystring.js similarity index 100% rename from public/javascripts/ckeditor/swfupload/querystring.js rename to lib/generators/ckeditor/base/templates/ckeditor/swfupload/querystring.js diff --git a/lib/generators/ckeditor/base/templates/ckeditor/swfupload/rails.js b/lib/generators/ckeditor/base/templates/ckeditor/swfupload/rails.js new file mode 100644 index 0000000..9c6cdaf --- /dev/null +++ b/lib/generators/ckeditor/base/templates/ckeditor/swfupload/rails.js @@ -0,0 +1,158 @@ +/** + * Unobtrusive scripting adapter for jQuery + * + * Requires jQuery 1.4.3 or later. + * https://github.com/rails/jquery-ujs + */ + +(function($) { + // Make sure that every Ajax request sends the CSRF token + function CSRFProtection(xhr) { + var token = $('meta[name="csrf-token"]').attr('content'); + if (token) xhr.setRequestHeader('X-CSRF-Token', token); + } + if ('ajaxPrefilter' in $) $.ajaxPrefilter(function(options, originalOptions, xhr){ CSRFProtection(xhr) }); + else $(document).ajaxSend(function(e, xhr){ CSRFProtection(xhr) }); + + // Triggers an event on an element and returns the event result + function fire(obj, name, data) { + var event = new $.Event(name); + obj.trigger(event, data); + return event.result !== false; + } + + // Submits "remote" forms and links with ajax + function handleRemote(element) { + var method, url, data, + dataType = element.attr('data-type') || ($.ajaxSettings && $.ajaxSettings.dataType); + + if (fire(element, 'ajax:before')) { + if (element.is('form')) { + method = element.attr('method'); + url = element.attr('action'); + data = element.serializeArray(); + // memoized value from clicked submit button + var button = element.data('ujs:submit-button'); + if (button) { + data.push(button); + element.data('ujs:submit-button', null); + } + } else { + method = element.attr('data-method'); + url = element.attr('href'); + data = null; + } + $.ajax({ + url: url, type: method || 'GET', data: data, dataType: dataType, + // stopping the "ajax:beforeSend" event will cancel the ajax request + beforeSend: function(xhr, settings) { + if (settings.dataType === undefined) { + xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script); + } + return fire(element, 'ajax:beforeSend', [xhr, settings]); + }, + success: function(data, status, xhr) { + element.trigger('ajax:success', [data, status, xhr]); + }, + complete: function(xhr, status) { + element.trigger('ajax:complete', [xhr, status]); + }, + error: function(xhr, status, error) { + element.trigger('ajax:error', [xhr, status, error]); + } + }); + } + } + + // Handles "data-method" on links such as: + // Delete + function handleMethod(link) { + var href = link.attr('href'), + method = link.attr('data-method'), + csrf_token = $('meta[name=csrf-token]').attr('content'), + csrf_param = $('meta[name=csrf-param]').attr('content'), + form = $('
'), + metadata_input = ''; + + if (csrf_param !== undefined && csrf_token !== undefined) { + metadata_input += ''; + } + + form.hide().append(metadata_input).appendTo('body'); + form.submit(); + } + + function disableFormElements(form) { + form.find('input[data-disable-with]').each(function() { + var input = $(this); + input.data('ujs:enable-with', input.val()) + .val(input.attr('data-disable-with')) + .attr('disabled', 'disabled'); + }); + } + + function enableFormElements(form) { + form.find('input[data-disable-with]').each(function() { + var input = $(this); + input.val(input.data('ujs:enable-with')).removeAttr('disabled'); + }); + } + + function allowAction(element) { + var message = element.attr('data-confirm'); + return !message || (fire(element, 'confirm') && confirm(message)); + } + + function requiredValuesMissing(form) { + var missing = false; + form.find('input[name][required]').each(function() { + if (!$(this).val()) missing = true; + }); + return missing; + } + + $('a[data-confirm], a[data-method], a[data-remote]').live('click.rails', function(e) { + var link = $(this); + if (!allowAction(link)) return false; + + if (link.attr('data-remote') != undefined) { + handleRemote(link); + return false; + } else if (link.attr('data-method')) { + handleMethod(link); + return false; + } + }); + + $('form').live('submit.rails', function(e) { + var form = $(this), remote = form.attr('data-remote') != undefined; + if (!allowAction(form)) return false; + + // skip other logic when required values are missing + if (requiredValuesMissing(form)) return !remote; + + if (remote) { + handleRemote(form); + return false; + } else { + // slight timeout so that the submit button gets properly serialized + setTimeout(function(){ disableFormElements(form) }, 13); + } + }); + + $('form input[type=submit], form button[type=submit], form button:not([type])').live('click.rails', function() { + var button = $(this); + if (!allowAction(button)) return false; + // register the pressed submit button + var name = button.attr('name'), data = name ? {name:name, value:button.val()} : null; + button.closest('form').data('ujs:submit-button', data); + }); + + $('form').live('ajax:beforeSend.rails', function(event) { + if (this == event.target) disableFormElements($(this)); + }); + + $('form').live('ajax:complete.rails', function(event) { + if (this == event.target) enableFormElements($(this)); + }); +})( jQuery ); diff --git a/lib/generators/ckeditor/base/templates/ckeditor/swfupload/swfupload.js b/lib/generators/ckeditor/base/templates/ckeditor/swfupload/swfupload.js new file mode 100644 index 0000000..7a7c8cc --- /dev/null +++ b/lib/generators/ckeditor/base/templates/ckeditor/swfupload/swfupload.js @@ -0,0 +1 @@ +var SWFUpload;if(SWFUpload==undefined){SWFUpload=function(settings){this.initSWFUpload(settings)}}SWFUpload.prototype.initSWFUpload=function(settings){try{this.customSettings={};this.settings=settings;this.eventQueue=[];this.movieName="SWFUpload_"+SWFUpload.movieCount++;this.movieElement=null;SWFUpload.instances[this.movieName]=this;this.initSettings();this.loadFlash();this.displayDebugInfo()}catch(ex){delete SWFUpload.instances[this.movieName];throw ex;}};SWFUpload.instances={};SWFUpload.movieCount=0;SWFUpload.version="2.2.0 2009-03-25";SWFUpload.QUEUE_ERROR={QUEUE_LIMIT_EXCEEDED:-100,FILE_EXCEEDS_SIZE_LIMIT:-110,ZERO_BYTE_FILE:-120,INVALID_FILETYPE:-130};SWFUpload.UPLOAD_ERROR={HTTP_ERROR:-200,MISSING_UPLOAD_URL:-210,IO_ERROR:-220,SECURITY_ERROR:-230,UPLOAD_LIMIT_EXCEEDED:-240,UPLOAD_FAILED:-250,SPECIFIED_FILE_ID_NOT_FOUND:-260,FILE_VALIDATION_FAILED:-270,FILE_CANCELLED:-280,UPLOAD_STOPPED:-290};SWFUpload.FILE_STATUS={QUEUED:-1,IN_PROGRESS:-2,ERROR:-3,COMPLETE:-4,CANCELLED:-5};SWFUpload.BUTTON_ACTION={SELECT_FILE:-100,SELECT_FILES:-110,START_UPLOAD:-120};SWFUpload.CURSOR={ARROW:-1,HAND:-2};SWFUpload.WINDOW_MODE={WINDOW:"window",TRANSPARENT:"transparent",OPAQUE:"opaque"};SWFUpload.completeURL=function(url){if(typeof(url)!=="string"||url.match(/^https?:\/\//i)||url.match(/^\//)){return url}var currentURL=window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"");var indexSlash=window.location.pathname.lastIndexOf("/");if(indexSlash<=0){path="/"}else{path=window.location.pathname.substr(0,indexSlash)+"/"}return path+url};SWFUpload.prototype.initSettings=function(){this.ensureDefault=function(settingName,defaultValue){this.settings[settingName]=(this.settings[settingName]==undefined)?defaultValue:this.settings[settingName]};this.ensureDefault("upload_url","");this.ensureDefault("preserve_relative_urls",false);this.ensureDefault("file_post_name","Filedata");this.ensureDefault("post_params",{});this.ensureDefault("use_query_string",false);this.ensureDefault("requeue_on_error",false);this.ensureDefault("http_success",[]);this.ensureDefault("assume_success_timeout",0);this.ensureDefault("file_types","*.*");this.ensureDefault("file_types_description","All Files");this.ensureDefault("file_size_limit",0);this.ensureDefault("file_upload_limit",0);this.ensureDefault("file_queue_limit",0);this.ensureDefault("flash_url","swfupload.swf");this.ensureDefault("prevent_swf_caching",true);this.ensureDefault("button_image_url","");this.ensureDefault("button_width",1);this.ensureDefault("button_height",1);this.ensureDefault("button_text","");this.ensureDefault("button_text_style","color: #000000; font-size: 16pt;");this.ensureDefault("button_text_top_padding",0);this.ensureDefault("button_text_left_padding",0);this.ensureDefault("button_action",SWFUpload.BUTTON_ACTION.SELECT_FILES);this.ensureDefault("button_disabled",false);this.ensureDefault("button_placeholder_id","");this.ensureDefault("button_placeholder",null);this.ensureDefault("button_cursor",SWFUpload.CURSOR.ARROW);this.ensureDefault("button_window_mode",SWFUpload.WINDOW_MODE.WINDOW);this.ensureDefault("debug",false);this.settings.debug_enabled=this.settings.debug;this.settings.return_upload_start_handler=this.returnUploadStart;this.ensureDefault("swfupload_loaded_handler",null);this.ensureDefault("file_dialog_start_handler",null);this.ensureDefault("file_queued_handler",null);this.ensureDefault("file_queue_error_handler",null);this.ensureDefault("file_dialog_complete_handler",null);this.ensureDefault("upload_start_handler",null);this.ensureDefault("upload_progress_handler",null);this.ensureDefault("upload_error_handler",null);this.ensureDefault("upload_success_handler",null);this.ensureDefault("upload_complete_handler",null);this.ensureDefault("debug_handler",this.debugMessage);this.ensureDefault("custom_settings",{});this.customSettings=this.settings.custom_settings;if(!!this.settings.prevent_swf_caching){this.settings.flash_url=this.settings.flash_url+(this.settings.flash_url.indexOf("?")<0?"?":"&")+"preventswfcaching="+new Date().getTime()}if(!this.settings.preserve_relative_urls){this.settings.upload_url=SWFUpload.completeURL(this.settings.upload_url);this.settings.button_image_url=SWFUpload.completeURL(this.settings.button_image_url)}delete this.ensureDefault};SWFUpload.prototype.loadFlash=function(){var targetElement,tempParent;if(document.getElementById(this.movieName)!==null){throw"ID "+this.movieName+" is already in use. The Flash Object could not be added";}targetElement=document.getElementById(this.settings.button_placeholder_id)||this.settings.button_placeholder;if(targetElement==undefined){throw"Could not find the placeholder element: "+this.settings.button_placeholder_id;}tempParent=document.createElement("div");tempParent.innerHTML=this.getFlashHTML();targetElement.parentNode.replaceChild(tempParent.firstChild,targetElement);if(window[this.movieName]==undefined){window[this.movieName]=this.getMovieElement()}};SWFUpload.prototype.getFlashHTML=function(){return['','','','','','','',''].join("")};SWFUpload.prototype.getFlashVars=function(){var paramString=this.buildParamString();var httpSuccessString=this.settings.http_success.join(",");return["movieName=",encodeURIComponent(this.movieName),"&uploadURL=",encodeURIComponent(this.settings.upload_url),"&useQueryString=",encodeURIComponent(this.settings.use_query_string),"&requeueOnError=",encodeURIComponent(this.settings.requeue_on_error),"&httpSuccess=",encodeURIComponent(httpSuccessString),"&assumeSuccessTimeout=",encodeURIComponent(this.settings.assume_success_timeout),"&params=",encodeURIComponent(paramString),"&filePostName=",encodeURIComponent(this.settings.file_post_name),"&fileTypes=",encodeURIComponent(this.settings.file_types),"&fileTypesDescription=",encodeURIComponent(this.settings.file_types_description),"&fileSizeLimit=",encodeURIComponent(this.settings.file_size_limit),"&fileUploadLimit=",encodeURIComponent(this.settings.file_upload_limit),"&fileQueueLimit=",encodeURIComponent(this.settings.file_queue_limit),"&debugEnabled=",encodeURIComponent(this.settings.debug_enabled),"&buttonImageURL=",encodeURIComponent(this.settings.button_image_url),"&buttonWidth=",encodeURIComponent(this.settings.button_width),"&buttonHeight=",encodeURIComponent(this.settings.button_height),"&buttonText=",encodeURIComponent(this.settings.button_text),"&buttonTextTopPadding=",encodeURIComponent(this.settings.button_text_top_padding),"&buttonTextLeftPadding=",encodeURIComponent(this.settings.button_text_left_padding),"&buttonTextStyle=",encodeURIComponent(this.settings.button_text_style),"&buttonAction=",encodeURIComponent(this.settings.button_action),"&buttonDisabled=",encodeURIComponent(this.settings.button_disabled),"&buttonCursor=",encodeURIComponent(this.settings.button_cursor)].join("")};SWFUpload.prototype.getMovieElement=function(){if(this.movieElement==undefined){this.movieElement=document.getElementById(this.movieName)}if(this.movieElement===null){throw"Could not find Flash element";}return this.movieElement};SWFUpload.prototype.buildParamString=function(){var postParams=this.settings.post_params;var paramStringPairs=[];if(typeof(postParams)==="object"){for(var name in postParams){if(postParams.hasOwnProperty(name)){paramStringPairs.push(encodeURIComponent(name.toString())+"="+encodeURIComponent(postParams[name].toString()))}}}return paramStringPairs.join("&")};SWFUpload.prototype.destroy=function(){try{this.cancelUpload(null,false);var movieElement=null;movieElement=this.getMovieElement();if(movieElement&&typeof(movieElement.CallFunction)==="unknown"){for(var i in movieElement){try{if(typeof(movieElement[i])==="function"){movieElement[i]=null}}catch(ex1){}}try{movieElement.parentNode.removeChild(movieElement)}catch(ex){}}window[this.movieName]=null;SWFUpload.instances[this.movieName]=null;delete SWFUpload.instances[this.movieName];this.movieElement=null;this.settings=null;this.customSettings=null;this.eventQueue=null;this.movieName=null;return true}catch(ex2){return false}};SWFUpload.prototype.displayDebugInfo=function(){this.debug(["---SWFUpload Instance Info---\n","Version: ",SWFUpload.version,"\n","Movie Name: ",this.movieName,"\n","Settings:\n","\t","upload_url: ",this.settings.upload_url,"\n","\t","flash_url: ",this.settings.flash_url,"\n","\t","use_query_string: ",this.settings.use_query_string.toString(),"\n","\t","requeue_on_error: ",this.settings.requeue_on_error.toString(),"\n","\t","http_success: ",this.settings.http_success.join(", "),"\n","\t","assume_success_timeout: ",this.settings.assume_success_timeout,"\n","\t","file_post_name: ",this.settings.file_post_name,"\n","\t","post_params: ",this.settings.post_params.toString(),"\n","\t","file_types: ",this.settings.file_types,"\n","\t","file_types_description: ",this.settings.file_types_description,"\n","\t","file_size_limit: ",this.settings.file_size_limit,"\n","\t","file_upload_limit: ",this.settings.file_upload_limit,"\n","\t","file_queue_limit: ",this.settings.file_queue_limit,"\n","\t","debug: ",this.settings.debug.toString(),"\n","\t","prevent_swf_caching: ",this.settings.prevent_swf_caching.toString(),"\n","\t","button_placeholder_id: ",this.settings.button_placeholder_id.toString(),"\n","\t","button_placeholder: ",(this.settings.button_placeholder?"Set":"Not Set"),"\n","\t","button_image_url: ",this.settings.button_image_url.toString(),"\n","\t","button_width: ",this.settings.button_width.toString(),"\n","\t","button_height: ",this.settings.button_height.toString(),"\n","\t","button_text: ",this.settings.button_text.toString(),"\n","\t","button_text_style: ",this.settings.button_text_style.toString(),"\n","\t","button_text_top_padding: ",this.settings.button_text_top_padding.toString(),"\n","\t","button_text_left_padding: ",this.settings.button_text_left_padding.toString(),"\n","\t","button_action: ",this.settings.button_action.toString(),"\n","\t","button_disabled: ",this.settings.button_disabled.toString(),"\n","\t","custom_settings: ",this.settings.custom_settings.toString(),"\n","Event Handlers:\n","\t","swfupload_loaded_handler assigned: ",(typeof this.settings.swfupload_loaded_handler==="function").toString(),"\n","\t","file_dialog_start_handler assigned: ",(typeof this.settings.file_dialog_start_handler==="function").toString(),"\n","\t","file_queued_handler assigned: ",(typeof this.settings.file_queued_handler==="function").toString(),"\n","\t","file_queue_error_handler assigned: ",(typeof this.settings.file_queue_error_handler==="function").toString(),"\n","\t","upload_start_handler assigned: ",(typeof this.settings.upload_start_handler==="function").toString(),"\n","\t","upload_progress_handler assigned: ",(typeof this.settings.upload_progress_handler==="function").toString(),"\n","\t","upload_error_handler assigned: ",(typeof this.settings.upload_error_handler==="function").toString(),"\n","\t","upload_success_handler assigned: ",(typeof this.settings.upload_success_handler==="function").toString(),"\n","\t","upload_complete_handler assigned: ",(typeof this.settings.upload_complete_handler==="function").toString(),"\n","\t","debug_handler assigned: ",(typeof this.settings.debug_handler==="function").toString(),"\n"].join(""))};SWFUpload.prototype.addSetting=function(name,value,default_value){if(value==undefined){return(this.settings[name]=default_value)}else{return(this.settings[name]=value)}};SWFUpload.prototype.getSetting=function(name){if(this.settings[name]!=undefined){return this.settings[name]}return""};SWFUpload.prototype.callFlash=function(functionName,argumentArray){argumentArray=argumentArray||[];var movieElement=this.getMovieElement();var returnValue,returnString;try{returnString=movieElement.CallFunction(''+__flash__argumentsToXML(argumentArray,0)+'');returnValue=eval(returnString)}catch(ex){throw"Call to "+functionName+" failed";}if(returnValue!=undefined&&typeof returnValue.post==="object"){returnValue=this.unescapeFilePostParams(returnValue)}return returnValue};SWFUpload.prototype.selectFile=function(){this.callFlash("SelectFile")};SWFUpload.prototype.selectFiles=function(){this.callFlash("SelectFiles")};SWFUpload.prototype.startUpload=function(fileID){this.callFlash("StartUpload",[fileID])};SWFUpload.prototype.cancelUpload=function(fileID,triggerErrorEvent){if(triggerErrorEvent!==false){triggerErrorEvent=true}this.callFlash("CancelUpload",[fileID,triggerErrorEvent])};SWFUpload.prototype.stopUpload=function(){this.callFlash("StopUpload")};SWFUpload.prototype.getStats=function(){return this.callFlash("GetStats")};SWFUpload.prototype.setStats=function(statsObject){this.callFlash("SetStats",[statsObject])};SWFUpload.prototype.getFile=function(fileID){if(typeof(fileID)==="number"){return this.callFlash("GetFileByIndex",[fileID])}else{return this.callFlash("GetFile",[fileID])}};SWFUpload.prototype.addFileParam=function(fileID,name,value){return this.callFlash("AddFileParam",[fileID,name,value])};SWFUpload.prototype.removeFileParam=function(fileID,name){this.callFlash("RemoveFileParam",[fileID,name])};SWFUpload.prototype.setUploadURL=function(url){this.settings.upload_url=url.toString();this.callFlash("SetUploadURL",[url])};SWFUpload.prototype.setPostParams=function(paramsObject){this.settings.post_params=paramsObject;this.callFlash("SetPostParams",[paramsObject])};SWFUpload.prototype.addPostParam=function(name,value){this.settings.post_params[name]=value;this.callFlash("SetPostParams",[this.settings.post_params])};SWFUpload.prototype.removePostParam=function(name){delete this.settings.post_params[name];this.callFlash("SetPostParams",[this.settings.post_params])};SWFUpload.prototype.setFileTypes=function(types,description){this.settings.file_types=types;this.settings.file_types_description=description;this.callFlash("SetFileTypes",[types,description])};SWFUpload.prototype.setFileSizeLimit=function(fileSizeLimit){this.settings.file_size_limit=fileSizeLimit;this.callFlash("SetFileSizeLimit",[fileSizeLimit])};SWFUpload.prototype.setFileUploadLimit=function(fileUploadLimit){this.settings.file_upload_limit=fileUploadLimit;this.callFlash("SetFileUploadLimit",[fileUploadLimit])};SWFUpload.prototype.setFileQueueLimit=function(fileQueueLimit){this.settings.file_queue_limit=fileQueueLimit;this.callFlash("SetFileQueueLimit",[fileQueueLimit])};SWFUpload.prototype.setFilePostName=function(filePostName){this.settings.file_post_name=filePostName;this.callFlash("SetFilePostName",[filePostName])};SWFUpload.prototype.setUseQueryString=function(useQueryString){this.settings.use_query_string=useQueryString;this.callFlash("SetUseQueryString",[useQueryString])};SWFUpload.prototype.setRequeueOnError=function(requeueOnError){this.settings.requeue_on_error=requeueOnError;this.callFlash("SetRequeueOnError",[requeueOnError])};SWFUpload.prototype.setHTTPSuccess=function(http_status_codes){if(typeof http_status_codes==="string"){http_status_codes=http_status_codes.replace(" ","").split(",")}this.settings.http_success=http_status_codes;this.callFlash("SetHTTPSuccess",[http_status_codes])};SWFUpload.prototype.setAssumeSuccessTimeout=function(timeout_seconds){this.settings.assume_success_timeout=timeout_seconds;this.callFlash("SetAssumeSuccessTimeout",[timeout_seconds])};SWFUpload.prototype.setDebugEnabled=function(debugEnabled){this.settings.debug_enabled=debugEnabled;this.callFlash("SetDebugEnabled",[debugEnabled])};SWFUpload.prototype.setButtonImageURL=function(buttonImageURL){if(buttonImageURL==undefined){buttonImageURL=""}this.settings.button_image_url=buttonImageURL;this.callFlash("SetButtonImageURL",[buttonImageURL])};SWFUpload.prototype.setButtonDimensions=function(width,height){this.settings.button_width=width;this.settings.button_height=height;var movie=this.getMovieElement();if(movie!=undefined){movie.style.width=width+"px";movie.style.height=height+"px"}this.callFlash("SetButtonDimensions",[width,height])};SWFUpload.prototype.setButtonText=function(html){this.settings.button_text=html;this.callFlash("SetButtonText",[html])};SWFUpload.prototype.setButtonTextPadding=function(left,top){this.settings.button_text_top_padding=top;this.settings.button_text_left_padding=left;this.callFlash("SetButtonTextPadding",[left,top])};SWFUpload.prototype.setButtonTextStyle=function(css){this.settings.button_text_style=css;this.callFlash("SetButtonTextStyle",[css])};SWFUpload.prototype.setButtonDisabled=function(isDisabled){this.settings.button_disabled=isDisabled;this.callFlash("SetButtonDisabled",[isDisabled])};SWFUpload.prototype.setButtonAction=function(buttonAction){this.settings.button_action=buttonAction;this.callFlash("SetButtonAction",[buttonAction])};SWFUpload.prototype.setButtonCursor=function(cursor){this.settings.button_cursor=cursor;this.callFlash("SetButtonCursor",[cursor])};SWFUpload.prototype.queueEvent=function(handlerName,argumentArray){if(argumentArray==undefined){argumentArray=[]}else if(!(argumentArray instanceof Array)){argumentArray=[argumentArray]}var self=this;if(typeof this.settings[handlerName]==="function"){this.eventQueue.push(function(){this.settings[handlerName].apply(this,argumentArray)});setTimeout(function(){self.executeNextEvent()},0)}else if(this.settings[handlerName]!==null){throw"Event handler "+handlerName+" is unknown or is not a function";}};SWFUpload.prototype.executeNextEvent=function(){var f=this.eventQueue?this.eventQueue.shift():null;if(typeof(f)==="function"){f.apply(this)}};SWFUpload.prototype.unescapeFilePostParams=function(file){var reg=/[$]([0-9a-f]{4})/i;var unescapedPost={};var uk;if(file!=undefined){for(var k in file.post){if(file.post.hasOwnProperty(k)){uk=k;var match;while((match=reg.exec(uk))!==null){uk=uk.replace(match[0],String.fromCharCode(parseInt("0x"+match[1],16)))}unescapedPost[uk]=file.post[k]}}file.post=unescapedPost}return file};SWFUpload.prototype.testExternalInterface=function(){try{return this.callFlash("TestExternalInterface")}catch(ex){return false}};SWFUpload.prototype.flashReady=function(){var movieElement=this.getMovieElement();if(!movieElement){this.debug("Flash called back ready but the flash movie can't be found.");return}this.cleanUp(movieElement);this.queueEvent("swfupload_loaded_handler")};SWFUpload.prototype.cleanUp=function(movieElement){try{if(this.movieElement&&typeof(movieElement.CallFunction)==="unknown"){this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");for(var key in movieElement){try{if(typeof(movieElement[key])==="function"){movieElement[key]=null}}catch(ex){}}}}catch(ex1){}window["__flash__removeCallback"]=function(instance,name){try{if(instance){instance[name]=null}}catch(flashEx){}}};SWFUpload.prototype.fileDialogStart=function(){this.queueEvent("file_dialog_start_handler")};SWFUpload.prototype.fileQueued=function(file){file=this.unescapeFilePostParams(file);this.queueEvent("file_queued_handler",file)};SWFUpload.prototype.fileQueueError=function(file,errorCode,message){file=this.unescapeFilePostParams(file);this.queueEvent("file_queue_error_handler",[file,errorCode,message])};SWFUpload.prototype.fileDialogComplete=function(numFilesSelected,numFilesQueued,numFilesInQueue){this.queueEvent("file_dialog_complete_handler",[numFilesSelected,numFilesQueued,numFilesInQueue])};SWFUpload.prototype.uploadStart=function(file){file=this.unescapeFilePostParams(file);this.queueEvent("return_upload_start_handler",file)};SWFUpload.prototype.returnUploadStart=function(file){var returnValue;if(typeof this.settings.upload_start_handler==="function"){file=this.unescapeFilePostParams(file);returnValue=this.settings.upload_start_handler.call(this,file)}else if(this.settings.upload_start_handler!=undefined){throw"upload_start_handler must be a function";}if(returnValue===undefined){returnValue=true}returnValue=!!returnValue;this.callFlash("ReturnUploadStart",[returnValue])};SWFUpload.prototype.uploadProgress=function(file,bytesComplete,bytesTotal){file=this.unescapeFilePostParams(file);this.queueEvent("upload_progress_handler",[file,bytesComplete,bytesTotal])};SWFUpload.prototype.uploadError=function(file,errorCode,message){file=this.unescapeFilePostParams(file);this.queueEvent("upload_error_handler",[file,errorCode,message])};SWFUpload.prototype.uploadSuccess=function(file,serverData,responseReceived){file=this.unescapeFilePostParams(file);this.queueEvent("upload_success_handler",[file,serverData,responseReceived])};SWFUpload.prototype.uploadComplete=function(file){file=this.unescapeFilePostParams(file);this.queueEvent("upload_complete_handler",file)};SWFUpload.prototype.debug=function(message){this.queueEvent("debug_handler",message)};SWFUpload.prototype.debugMessage=function(message){if(this.settings.debug){var exceptionMessage,exceptionValues=[];if(typeof message==="object"&&typeof message.name==="string"&&typeof message.message==="string"){for(var key in message){if(message.hasOwnProperty(key)){exceptionValues.push(key+": "+message[key])}}exceptionMessage=exceptionValues.join("\n")||"";exceptionValues=exceptionMessage.split("\n");exceptionMessage="EXCEPTION: "+exceptionValues.join("\nEXCEPTION: ");SWFUpload.Console.writeLine(exceptionMessage)}else{SWFUpload.Console.writeLine(message)}}};SWFUpload.Console={};SWFUpload.Console.writeLine=function(message){var console,documentForm;try{console=document.getElementById("SWFUpload_Console");if(!console){documentForm=document.createElement("form");document.getElementsByTagName("body")[0].appendChild(documentForm);console=document.createElement("textarea");console.id="SWFUpload_Console";console.style.fontFamily="monospace";console.setAttribute("wrap","off");console.wrap="off";console.style.overflow="auto";console.style.width="700px";console.style.height="350px";console.style.margin="5px";documentForm.appendChild(console)}console.value+=message+"\n";console.scrollTop=console.scrollHeight-console.clientHeight}catch(ex){alert("Exception: "+ex.name+" Message: "+ex.message)}}; diff --git a/lib/generators/ckeditor/base/templates/ckeditor/swfupload/swfupload.queue.js b/lib/generators/ckeditor/base/templates/ckeditor/swfupload/swfupload.queue.js new file mode 100644 index 0000000..1e1c323 --- /dev/null +++ b/lib/generators/ckeditor/base/templates/ckeditor/swfupload/swfupload.queue.js @@ -0,0 +1 @@ +var SWFUpload;if(typeof(SWFUpload)==="function"){SWFUpload.queue={};SWFUpload.prototype.initSettings=(function(oldInitSettings){return function(){if(typeof(oldInitSettings)==="function"){oldInitSettings.call(this)}this.queueSettings={};this.queueSettings.queue_cancelled_flag=false;this.queueSettings.queue_upload_count=0;this.queueSettings.user_upload_complete_handler=this.settings.upload_complete_handler;this.queueSettings.user_upload_start_handler=this.settings.upload_start_handler;this.settings.upload_complete_handler=SWFUpload.queue.uploadCompleteHandler;this.settings.upload_start_handler=SWFUpload.queue.uploadStartHandler;this.settings.queue_complete_handler=this.settings.queue_complete_handler||null}})(SWFUpload.prototype.initSettings);SWFUpload.prototype.startUpload=function(fileID){this.queueSettings.queue_cancelled_flag=false;this.callFlash("StartUpload",[fileID])};SWFUpload.prototype.cancelQueue=function(){this.queueSettings.queue_cancelled_flag=true;this.stopUpload();var stats=this.getStats();while(stats.files_queued>0){this.cancelUpload();stats=this.getStats()}};SWFUpload.queue.uploadStartHandler=function(file){var returnValue;if(typeof(this.queueSettings.user_upload_start_handler)==="function"){returnValue=this.queueSettings.user_upload_start_handler.call(this,file)}returnValue=(returnValue===false)?false:true;this.queueSettings.queue_cancelled_flag=!returnValue;return returnValue};SWFUpload.queue.uploadCompleteHandler=function(file){var user_upload_complete_handler=this.queueSettings.user_upload_complete_handler;var continueUpload;if(file.filestatus===SWFUpload.FILE_STATUS.COMPLETE){this.queueSettings.queue_upload_count++}if(typeof(user_upload_complete_handler)==="function"){continueUpload=(user_upload_complete_handler.call(this,file)===false)?false:true}else if(file.filestatus===SWFUpload.FILE_STATUS.QUEUED){continueUpload=false}else{continueUpload=true}if(continueUpload){var stats=this.getStats();if(stats.files_queued>0&&this.queueSettings.queue_cancelled_flag===false){this.startUpload()}else if(this.queueSettings.queue_cancelled_flag===false){this.queueEvent("queue_complete_handler",[this.queueSettings.queue_upload_count]);this.queueSettings.queue_upload_count=0}else{this.queueSettings.queue_cancelled_flag=false;this.queueSettings.queue_upload_count=0}}}} diff --git a/lib/generators/ckeditor/base/templates/ckeditor/swfupload/swfupload.swf b/lib/generators/ckeditor/base/templates/ckeditor/swfupload/swfupload.swf new file mode 100644 index 0000000..e3f7670 Binary files /dev/null and b/lib/generators/ckeditor/base/templates/ckeditor/swfupload/swfupload.swf differ diff --git a/public/javascripts/ckeditor/swfupload/swfupload.swfobject.js b/lib/generators/ckeditor/base/templates/ckeditor/swfupload/swfupload.swfobject.js similarity index 100% rename from public/javascripts/ckeditor/swfupload/swfupload.swfobject.js rename to lib/generators/ckeditor/base/templates/ckeditor/swfupload/swfupload.swfobject.js diff --git a/lib/generators/ckeditor/migration/USAGE b/lib/generators/ckeditor/migration/USAGE new file mode 100644 index 0000000..1a1f464 --- /dev/null +++ b/lib/generators/ckeditor/migration/USAGE @@ -0,0 +1,12 @@ +CKEditor +======== + +# Generate models to store uploaded images and files from ckeditor +# It generate three models: Ckeditor::Asset, Ckeditor::Picture and Ckeditor::AttachmentFile, +# and migration for "ckeditor_assets" table +# By default backend is paperclip + +rails generate ckeditor:migration + +# options: + --backend, [--backend=PROCESSOR] # Configure for selected file uploader (options: paperclip/attachment_fu) diff --git a/lib/generators/ckeditor/migration/migration_generator.rb b/lib/generators/ckeditor/migration/migration_generator.rb new file mode 100644 index 0000000..a279a94 --- /dev/null +++ b/lib/generators/ckeditor/migration/migration_generator.rb @@ -0,0 +1,46 @@ +require 'rails/generators' +require 'rails/generators/migration' + +module Ckeditor + class MigrationGenerator < Rails::Generators::Base + include Rails::Generators::Migration + + desc "Generates migration for Asset (Picture, AttachmentFile) models" + + class_option :backend, :type => :string, :default => 'paperclip', + :desc => "Backend processor for upload support" + + def self.source_root + @source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates', 'models/')) + end + + def self.next_migration_number(dirname) + Time.now.strftime("%Y%m%d%H%M%S") + end + + def create_models + template "#{generator_dir}/asset.rb", + File.join('app/models', ckeditor_dir, "asset.rb") + + template "#{generator_dir}/picture.rb", + File.join('app/models', ckeditor_dir, "picture.rb") + + template "#{generator_dir}/attachment_file.rb", + File.join('app/models', ckeditor_dir, "attachment_file.rb") + end + + def create_migration + migration_template "#{generator_dir}/migration.rb", File.join('db/migrate', "create_ckeditor_assets.rb") + end + + protected + + def ckeditor_dir + 'ckeditor' + end + + def generator_dir + options[:backend] || "paperclip" + end + end +end diff --git a/lib/generators/ckeditor/migration/templates/models/attachment_fu/asset.rb b/lib/generators/ckeditor/migration/templates/models/attachment_fu/asset.rb new file mode 100644 index 0000000..6b02b64 --- /dev/null +++ b/lib/generators/ckeditor/migration/templates/models/attachment_fu/asset.rb @@ -0,0 +1,32 @@ +class Ckeditor::Asset < ActiveRecord::Base + set_table_name "ckeditor_assets" + + belongs_to :user + belongs_to :assetable, :polymorphic => true + + scope :masters, where("parent_id IS NULL") + + def url(*args) + public_filename(*args) + end + + def format_created_at + I18n.l(self.created_at, :format=>"%d.%m.%Y %H:%M") + end + + def to_xml(options = {}) + xml = options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent]) + + xml.tag!(self.read_attribute(:type).to_s.downcase) do + xml.filename{ xml.cdata!(self.filename) } + xml.size self.size + xml.path{ xml.cdata!(self.public_filename) } + + xml.thumbnails do + self.thumbnails.each do |t| + xml.tag!(t.thumbnail, self.public_filename(t.thumbnail)) + end + end unless self.thumbnails.empty? + end + end +end diff --git a/lib/generators/ckeditor/migration/templates/models/attachment_fu/attachment_file.rb b/lib/generators/ckeditor/migration/templates/models/attachment_fu/attachment_file.rb new file mode 100644 index 0000000..b545163 --- /dev/null +++ b/lib/generators/ckeditor/migration/templates/models/attachment_fu/attachment_file.rb @@ -0,0 +1,24 @@ +class Ckeditor::AttachmentFile < Ckeditor::Asset + has_attachment :storage => :file_system, :path_prefix => 'public/assets/attachments', + :max_size => 10.megabytes + + validates_as_attachment + + # Map file extensions to mime types. + # Thanks to bug in Flash 8 the content type is always set to application/octet-stream. + # From: http://blog.airbladesoftware.com/2007/8/8/uploading-files-with-swfupload + def swf_uploaded_data=(data) + data.content_type = MIME::Types.type_for(data.original_filename) + self.uploaded_data = data + end + + def full_filename(thumbnail = nil) + file_system_path = self.attachment_options[:path_prefix] + Rails.root.join(file_system_path, file_name_for(self.id)) + end + + def file_name_for(asset = nil) + extension = filename.scan(/\.\w+$/) + return "#{asset}_#{filename}" + end +end diff --git a/lib/generators/ckeditor/migration/templates/models/attachment_fu/migration.rb b/lib/generators/ckeditor/migration/templates/models/attachment_fu/migration.rb new file mode 100644 index 0000000..c260d33 --- /dev/null +++ b/lib/generators/ckeditor/migration/templates/models/attachment_fu/migration.rb @@ -0,0 +1,30 @@ +class CreateCkeditorAssets < ActiveRecord::Migration + def self.up + create_table :ckeditor_assets do |t| + t.integer "parent_id" + t.string "content_type" + t.string "filename", :limit=>80 + t.string "thumbnail", :limit=>20 + t.integer "size" + t.integer "width" + t.integer "height" + t.string "type", :limit=>40 + t.integer "user_id" + t.integer "assetable_id" + t.string "assetable_type", :limit=>40 + + t.timestamps + end + + add_index "ckeditor_assets", ["assetable_id", "assetable_type", "type"], :name => "ndx_type_assetable" + add_index "ckeditor_assets", ["assetable_id", "assetable_type"], :name => "fk_assets" + add_index "ckeditor_assets", ["parent_id", "type"], :name => "ndx_type_name" + add_index "ckeditor_assets", ["thumbnail", "parent_id"], :name => "assets_thumbnail_parent_id" + add_index "ckeditor_assets", ["user_id", "assetable_type", "assetable_id"], :name => "assets_user_type_assetable_id" + add_index :ckeditor_assets, :user_id, :name => "fk_user" + end + + def self.down + drop_table :ckeditor_assets + end +end diff --git a/lib/generators/ckeditor/migration/templates/models/attachment_fu/picture.rb b/lib/generators/ckeditor/migration/templates/models/attachment_fu/picture.rb new file mode 100644 index 0000000..470e648 --- /dev/null +++ b/lib/generators/ckeditor/migration/templates/models/attachment_fu/picture.rb @@ -0,0 +1,25 @@ +class Ckeditor::Picture < Ckeditor::Asset + has_attachment :content_type => :image, + :storage => :file_system, :path_prefix => 'public/assets/pictures', + :max_size => 2.megabytes, + :size => 0.kilobytes..2000.kilobytes, + :processor => 'Rmagick', + :thumbnails => { :content => '575>', :thumb => '100x100!' } + + validates_as_attachment + + def url_content + public_filename(:content) + end + + def url_thumb + public_filename(:thumb) + end + + def to_json(options = {}) + options[:methods] ||= [] + options[:methods] << :url_content + options[:methods] << :url_thumb + super options + end +end diff --git a/lib/generators/ckeditor/migration/templates/models/paperclip/asset.rb b/lib/generators/ckeditor/migration/templates/models/paperclip/asset.rb new file mode 100644 index 0000000..978ec90 --- /dev/null +++ b/lib/generators/ckeditor/migration/templates/models/paperclip/asset.rb @@ -0,0 +1,97 @@ +require 'mime/types' + +class Ckeditor::Asset < ActiveRecord::Base + set_table_name "ckeditor_assets" + + belongs_to :user + belongs_to :assetable, :polymorphic => true + + before_validation :make_content_type + before_create :read_dimensions, :parameterize_filename + + attr_accessible :data, :assetable_type, :assetable_id + + def url(*args) + data.url(*args) + end + alias :public_filename :url + + def filename + data_file_name + end + + def content_type + data_content_type + end + + def size + data_file_size + end + + def path + data.path + end + + def styles + data.styles + end + + def format_created_at + I18n.l(created_at, :format=>"%d.%m.%Y %H:%M") + end + + def to_xml(options = {}) + builder = options[:builder] ||= Nokogiri::XML::Builder.new(options) + + builder.send(self.type.to_s.downcase) do |xml| + xml.id_ self.id + xml.filename self.filename + xml.size self.size + xml.path self.url + + xml.styles do + self.styles.each do |style| + xml.send(style.first, self.url(style.first)) + end + end unless self.styles.empty? + end + + builder.to_xml + end + + def has_dimensions? + respond_to?(:width) && respond_to?(:height) + end + + def image? + Ckeditor::IMAGE_TYPES.include?(data_content_type) + end + + def geometry + @geometry ||= Paperclip::Geometry.from_file(data.to_file) + @geometry + end + + protected + + def parameterize_filename + unless data_file_name.blank? + filename = Ckeditor::Utils.parameterize_filename(data_file_name) + self.data.instance_write(:file_name, filename) + end + end + + def read_dimensions + if image? && has_dimensions? + self.width = geometry.width + self.height = geometry.height + end + end + + def make_content_type + if data_content_type == "application/octet-stream" + content_types = MIME::Types.type_for(filename) + self.data_content_type = content_types.first.to_s unless content_types.empty? + end + end +end diff --git a/lib/generators/ckeditor/migration/templates/models/paperclip/attachment_file.rb b/lib/generators/ckeditor/migration/templates/models/paperclip/attachment_file.rb new file mode 100644 index 0000000..e5ebabe --- /dev/null +++ b/lib/generators/ckeditor/migration/templates/models/paperclip/attachment_file.rb @@ -0,0 +1,40 @@ +class Ckeditor::AttachmentFile < Ckeditor::Asset + has_attached_file :data, + :url => "/ckeditor_assets/attachments/:id/:filename", + :path => ":rails_root/public/ckeditor_assets/attachments/:id/:filename" + + validates_attachment_size :data, :less_than=>100.megabytes + + def url(*args) + if [:thumb, :content].include?(args.first) + send("url_#{args.first}") + else + data.url(*args) + end + end + + def url_content + data.url + end + + def url_thumb + extname = File.extname(filename) + + case extname.to_s + when '.swf' then '/javascripts/ckeditor/images/swf.gif' + when '.pdf' then '/javascripts/ckeditor/images/pdf.gif' + when '.doc', '.txt' then '/javascripts/ckeditor/images/doc.gif' + when '.mp3' then '/javascripts/ckeditor/images/mp3.gif' + when '.rar', '.zip', '.tg' then '/javascripts/ckeditor/images/rar.gif' + when '.xls' then '/javascripts/ckeditor/images/xls.gif' + else '/javascripts/ckeditor/images/ckfnothumb.gif' + end + end + + def to_json(options = {}) + options[:methods] ||= [] + options[:methods] << :url_content + options[:methods] << :url_thumb + super options + end +end diff --git a/lib/generators/ckeditor/migration/templates/models/paperclip/migration.rb b/lib/generators/ckeditor/migration/templates/models/paperclip/migration.rb new file mode 100644 index 0000000..426a6af --- /dev/null +++ b/lib/generators/ckeditor/migration/templates/models/paperclip/migration.rb @@ -0,0 +1,31 @@ +class CreateCkeditorAssets < ActiveRecord::Migration + def self.up + create_table :ckeditor_assets do |t| + t.string :data_file_name, :null => false + t.string :data_content_type + t.integer :data_file_size + + t.integer :assetable_id + t.string :assetable_type, :limit => 30 + t.string :type, :limit => 25 + t.string :guid, :limit => 10 + + t.integer :locale, :limit => 1, :default => 0 + t.integer :user_id + + # Uncomment it to save images dimensions, if your need it +# t.integer :width +# t.integer :height + + t.timestamps + end + + add_index "ckeditor_assets", ["assetable_type", "type", "assetable_id"], :name => "idx_assetable_type" + add_index "ckeditor_assets", ["assetable_type", "assetable_id"], :name => "fk_assetable" + add_index "ckeditor_assets", ["user_id"], :name => "fk_user" + end + + def self.down + drop_table :ckeditor_assets + end +end diff --git a/lib/generators/ckeditor/migration/templates/models/paperclip/picture.rb b/lib/generators/ckeditor/migration/templates/models/paperclip/picture.rb new file mode 100644 index 0000000..b27adc1 --- /dev/null +++ b/lib/generators/ckeditor/migration/templates/models/paperclip/picture.rb @@ -0,0 +1,23 @@ +class Ckeditor::Picture < Ckeditor::Asset + has_attached_file :data, + :url => "/ckeditor_assets/pictures/:id/:style_:basename.:extension", + :path => ":rails_root/public/ckeditor_assets/pictures/:id/:style_:basename.:extension", + :styles => { :content => '575>', :thumb => '80x80#' } + + validates_attachment_size :data, :less_than=>2.megabytes + + def url_content + url(:content) + end + + def url_thumb + url(:thumb) + end + + def to_json(options = {}) + options[:methods] ||= [] + options[:methods] << :url_content + options[:methods] << :url_thumb + super options + end +end diff --git a/lib/tasks/ckeditor_tasks.rake b/lib/tasks/ckeditor_tasks.rake new file mode 100644 index 0000000..f053f94 --- /dev/null +++ b/lib/tasks/ckeditor_tasks.rake @@ -0,0 +1,3 @@ +# Ckeditor tasks +#namespace :ckeditor do +#end diff --git a/public/javascripts/ckeditor/.htaccess b/public/javascripts/ckeditor/.htaccess deleted file mode 100644 index 7644c32..0000000 --- a/public/javascripts/ckeditor/.htaccess +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. -# For licensing, see LICENSE.html or http://ckeditor.com/license -# - -# -# On some specific Linux installations you could face problems with Firefox. -# It could give you errors when loading the editor saying that some illegal -# characters were found (three strange chars in the beginning of the file). -# This could happen if you map the .js or .css files to PHP, for example. -# -# Those characters are the Byte Order Mask (BOM) of the Unicode encoded files. -# All FCKeditor files are Unicode encoded. -# - -AddType application/x-javascript .js -AddType text/css .css - -# -# If PHP is mapped to handle XML files, you could have some issues. The -# following will disable it. -# - -AddType text/xml .xml diff --git a/public/javascripts/ckeditor/CHANGES.html b/public/javascripts/ckeditor/CHANGES.html deleted file mode 100644 index 93a1af1..0000000 --- a/public/javascripts/ckeditor/CHANGES.html +++ /dev/null @@ -1,642 +0,0 @@ - - - - - Changelog - CKEditor - - - - -

- CKEditor Changelog -

-

- CKEditor 3.2.1

-

- New features:

-
    -
  • #4478 : Enable the SelectAll command in source mode.
  • -
  • #5150 : Allow names in the CKEDITOR.config.colorButton_colors setting.
  • -
  • #4810 : Adding configuration option for image dialog preview area filling text.
  • -
  • #536 : Object style now could be applied on any parent element of current selection.
  • -
  • #5290 : Unified stylesSet loading removing dependencies from the styles combo. - Now the configuration entry is named 'config.stylesSet' instead of config.stylesCombo_stylesSet and the default location - is under the 'styles' plugin instead of 'stylescombo'.
  • -
  • #5352 : Allow to define the stylesSet array in the config object for the editor.
  • -
  • #5302 : Adding config option "forceEnterMode".
  • -
  • #5216 : Extend CKEDITOR.appendTo to allow a data parameter for the initial value.
  • -
  • #5024 : Added sample to show how to output XHTML and avoid deprecated tags.
  • -
-

- Fixed issues:

-
    -
  • #5152 : Indentation using class attribute doesn't work properly.
  • -
  • #4682 : It wasn't possible to edit block elements in IE that had styles like width, height or float.
  • -
  • #4750 : Correcting default order of buttons layout in dialogs on Mac.
  • -
  • #4932 : Fixed collapse button not clickable on simple toolbar.
  • -
  • #5228 : Link dialog is automatically changes protocol when URLs that starts with '?'.
  • -
  • #4877 : Fixed CKEditor displays source code in one long line (IE quirks mode + office2003 skin).
  • -
  • #5132 : Apply inline style leaks into sibling words which are seperated spaces.
  • -
  • #3599 : Background color style on sized text displayed as narrow band behind.
  • -
  • #4661 : Translation missing in link dialog.
  • -
  • #5240 : Flash alignment property is not presented visually on fake element.
  • -
  • #4910 : Pasting in IE scrolls document to the end.
  • -
  • #5041 : Table summary attribute can't be removed with dialog.
  • -
  • #5124 : All inline styles cannot be applied on empty spaces.
  • -
  • #3570 : SCAYT marker shouldn't appear inside elements path bar.
  • -
  • #4553 : Dirty check result incorrect when editor document is empty.
  • -
  • #4555 : Unreleased memory when editor is created and destroyed.
  • -
  • #5118 : Arrow keys navigation in RTL languages is incorrect.
  • -
  • #4721 : Remove attribute 'value' of checkbox in IE.
  • -
  • #5278 : IE: Add validation to check for bad window names of popup window.
  • -
  • #5171 : Dialogs contains lists don't have proper voice labels.
  • -
  • #4791 : Can't place cursor inside a form that end with a checkbox/radio.
  • -
  • #4479 : StylesCombo doesn't reflect the selection state until it's first opened.
  • -
  • #4717 : 'Unlink' and 'Outdent' command buttons should be disabled on editor startup.
  • -
  • #5119 : Disabled command buttons are not being properly styled when focused.
  • -
  • #5307 : Hide dialog page cause problem when there's two tab pages remain.
  • -
  • #5343 : Active list item ARIA role is wrongly placed.
  • -
  • #3599 : Background color style applying to text with font size style has been narrowly rendered.
  • -
  • #4711 : Line break character inside preformatted text makes it unable to type text at the end of previous line.
  • -
  • #4829 : [IE] Apply style from combo has wrong result on manually created selection.
  • -
  • #4830 : Retrieving selected element isn't always right, especially selecting using keyboard (SHIFT+ARROW).
  • -
  • #5128 : Element attribute inside preformatted text is corrupted when converting to other blocks.
  • -
  • #5190 : Template list entry shouldn't gain initial focus open templates list dialog opens.
  • -
  • #5238 : Menu button doesn't display arrow icon in high-contrast mode.
  • -
  • #3576 : Non-attributed element of the same name with the applied style is incorrectly removed.
  • -
  • #5221 : Insert table into empty document cause JavaScript error thrown.
  • -
  • #5242 : Apply 'automatic' color option of text color incorrectly removes background-color style.
  • -
  • #4719 : IE does not escape attribute values properly.
  • -
  • #5170 : Firefox does not insert text into styled element properly.
  • -
  • #4026 : Office2003 skin has no toolbar button borders in High Contrast in IE7.
  • -
  • #4348 : There should have exception thrown when 'CKEDITOR_BASEPATH' couldn't be figured out automatically.
  • -
  • #5364 : Focus may not be put into dialog correctly when dialog skin file is loading slow.
  • -
  • #4016 : Justify the layout of forms select dialog in Chrome and IE7.
  • -
  • #5373 : Variable 'pathBlockElements' defines wrong items in CKEDITOR.dom.elementPath.
  • -
  • #5082 : Ctrl key should be described as Cmd key on Mac.
  • -
  • #5182 : Context menu is not been announced correctly by ATs.
  • -
  • #4898 : Can't navigate outside table under the last paragraph of document.
  • -
  • #4950 : List commands could compromise list item attribute and styles.
  • -
  • #5018 : Find result highlighting remove normal font color styles unintentionally.
  • -
  • #5376 : Unable to exit list from within a empty block under list item.
  • -
  • #5145 : Various SCAYT fixes.
  • -
  • #5319 : Match whole word doesn't work anymore after replacement has happened.
  • -
  • #5363 : 'title' attribute now presents on all editor iframes.
  • -
  • #5374 : Unable to toggle inline style when the selection starts at the linefeed of the previous paragraph.
  • -
  • #4513 : Selected link element is not always correctly detected when using keyboard arrows to perform such selection.
  • -
  • #5372 : Newly created sub list should inherit nothing from the original (parent) list, except the list type.
  • -
  • #5274 : [IE6] Templates preview image is displayed in wrong size.
  • -
  • #5292 : Preview in font size and family doesn't work with custom styles.
  • -
  • #5396 : Selection is lost when use cell properties dialog to change cell type to header.
  • -
  • #4082 : [IE+Quirks] Preview text in the image dialog is not wrapping.
  • -
  • #4197 : Fixing format combo don't hide when editor blur on Safari.
  • -
  • #5401 : The context menu break layout with Office2003 and V2 skin on IE quirks mode.
  • -
  • #4825 : Fixing browser context menu is opened when clicking right mouse button twice.
  • -
  • #5356 : The SCAYT dialog had issues with Prototype enabled pages.
  • -
  • #5266 : SCAYT was disturbing the rendering of TH elements.
  • -
  • #4688 : SCAYT was interfering on checkDirty.
  • -
  • #5429 : High Contrast mode was being mistakenly detected when loading the editor through Dojo's xhrGet.
  • -
  • #5221 : Range is mangled when making collapsed selection in an empty paragraph.
  • -
  • #5261 : Config option 'scayt_autoStartup' slow down editor loading.
  • -
  • #3846 : Google Chrome - No Img properties after inserting.
  • -
  • #5465 : ShiftEnter=DIV doesn't respect list item when pressing enter at end of list item.
  • -
  • #5454 : After replaced success, the popup window couldn't be closed and a js error occured.
  • -
  • #4784 : Incorrect cursor position after delete table cells.
  • -
  • #5149 : [FF] Cursor disappears after maximize when the editor has focus.
  • -
  • #5220 : DTD now shows tolerance to <style> appear inside content.
  • -
  • #5540 : Mobile browsers (iPhone, Android...) are marked as incompatible as they don't support editing features.
  • -
  • #5504 : [IE6/7] 'Paste' dialog will always get opened even when user allows the clipboard access dialog when using 'Paste' button.
  • -
  • Updated the following language files:
  • -
-

- CKEditor 3.2

-

- New features:

-
    -
  • Several accessibility enhancements:
      -
    • #4502 : The editor accessibility is now totally based on WAI-ARIA.
    • -
    • #5015 : Adding accessibility help dialog plugin.
    • -
    • #5014 : Keyboard navigation compliance with screen reader suggested keys.
    • -
    • #4595 : Better accessibility in the Templates dialog.
    • -
    • #3389 : Esc/Arrow Key now works for closing sub menu.
    • -
  • -
  • #4973 : The Style field in the Div Container dialog is now loading the styles defined in the default styleset used by the Styles toolbar combo.
  • -
-

- Fixed issues:

-
    -
  • #5049 : Form Field list command in JAWS incorrectly lists extra fields.
  • -
  • #5008 : Lock/Unlock ratio buttons in the Image dialog was poorly designed in High Contrast mode.
  • -
  • #3980 : All labels in dialogs now use <label> instead of <div>.
  • -
  • #5213 : Reorganization of some entries in the language files to make it more consistent.
  • -
  • #5199 : In IE, single row toolbars didn't have the bottom padding.
  • -
-

- CKEditor 3.1.1

-

- New features:

-
    -
  • #4399 : Improved support for external file browsers by allowing executing a callback function.
  • -
  • #4612 : The text of links is now updated if it matches the URL to which it points to.
  • -
  • #4936 : New localization support for the Welsh language.
  • -
-

- Fixed issues:

-
    -
  • #4272 : Kama skin toolbar was broken in IE+Quirks+RTL.
  • -
  • #4987 : Changed the url which is called by the Browser Server button in the Link tab of Image Properties dialog.
  • -
  • #5030 : The CKEDITOR.timestamp wasn't been appended to the skin.js file.
  • -
  • #4993 : Removed the float style from images when the user selects 'not set' for alignment.
  • -
  • #4944 : Fixed a bug where nested list structures with inconsequent levels were not being pasted correctly from MS Word.
  • -
  • #4637 : Table cells' 'nowrap' attribute was not being loaded by the cell property dialog. Thanks to pomu0325.
  • -
  • #4724 : Using the mouse to insert a link in IE might create incorrect results.
  • -
  • #4640 : Small optimizations for the fileBrowser plugin.
  • -
  • #4583 : The "Target Frame Name" field is now visible when target is set to 'frame' only.
  • -
  • #4863 : Fixing iframedialog's height doesn't stretch to 100% (except IE Quirks).
  • -
  • #4964 : The BACKSPACE key positioning was not correct in some cases with Firefox.
  • -
  • #4980 : Setting border, vspace and hspace of images to zero was not working.
  • -
  • #4773 : The fileBrowser plugin was overwriting onClick functions eventually defined on fileButton elements.
  • -
  • #4731 : The clipboard plugin was missing a reference to the dialog plugin.
  • -
  • #5051 : The about plugin was missing a reference to the dialog plugin.
  • -
  • #5146 : The wsc plugin was missing a reference to the dialog plugin.
  • -
  • #4632 : The print command will now properly break on the insertion point of page break for printing.
  • -
  • #4862 : The English (United Kingdom) language file has been renamed to en-gb.js.
  • -
  • #4618 : Selecting an emoticon or the lock and reset buttons in the image dialog fired the onBeforeUnload event in IE.
  • -
  • #4678 : It was not possible to set tables' width to empty value.
  • -
  • #5012 : Fixed dependency issues with the menu plugin.
  • -
  • #5040 : The editor will not properly ignore font related settings that have extra item separators (semi-colons).
  • -
  • #4046 : Justify should respect config.enterMode = CKEDITOR.ENTER_BR.
  • -
  • #4622 : Inserting tables multiple times was corrupting the undo system.
  • -
  • #4647 : [IE] Selection on an element within positioned container is lost after open context-menu then click one menu item.
  • -
  • #4683 : Double-quote character in attribute values was not escaped in the editor output.
  • -
  • #4762 : [IE] Unexpected vertical-scrolling behavior happens whenever focus is moving out of editor in source mode.
  • -
  • #4772 : Text color was not being applied properly on links.
  • -
  • #4795 : [IE] Press 'Del' key on horizontal line or table result in error.
  • -
  • #4824 : [IE] <br/> at the very first table cell breaks the editor selection.
  • -
  • #4851 : [IE] Delete table rows with context-menu may cause error.
  • -
  • #4951 : Replacing text with empty string was throwing errors.
  • -
  • #4963 : Link dialog was not opening properly for e-mail type links.
  • -
  • #5043 : Removed the possibility of having an unwanted script tag being outputted with the editor contents.
  • -
  • #3678 : There were issues when editing links inside floating divs with IE.
  • -
  • #4763 : Pressing ENTER key with text selected was not deleting the text in some situations.
  • -
  • #5096 : Simple ampersand attribute value doesn't work for more than one occurrence.
  • -
  • #3494 : Context menu is too narrow in some translations.
  • -
  • #5005 : Fixed HTML errors in PHP samples.
  • -
  • #5123 : Fixed broken XHTML in User Interface Languages sample.
  • -
  • #4893 : Editor now understands table cell inline styles.
  • -
  • #4611 : Selection around <select> in editor doesn't cause error anymore.
  • -
  • #4886 : Extra BR tags were being created in the output HTML.
  • -
  • #4933 : Empty tags with BR were being left in the DOM.
  • -
  • #5127 : There were errors when removing dialog definition pages through code.
  • -
  • #4767 : CKEditor was not working when ckeditor_source.js is loaded in the <body> .
  • -
  • #5062 : Avoided security warning message when loading the wysiwyg area in IE6 under HTTPS.
  • -
  • #5135 : The TAB key will now behave properly when in Source mode.
  • -
  • #4988 : It wasn't possible to use forcePasteAsPlainText with Safari on Mac.
  • -
  • #5095 : Safari on Mac deleted the current selection in the editor when Edit menu was clicked.
  • -
  • #5140 : In High Contrast mode, arrows were now been displayed for menus with submenus.
  • -
  • #5163 : The undo system was not working on some specific cases.
  • -
  • #5162 : The ajax sample was throwing errors when loading data.
  • -
  • #4999 : The Template dialog was not generating an undo snapshot.
  • -
  • Updated the following language files:
  • -
-

- CKEditor 3.1

-

- New features:

-
    -
  • #4067 : Introduced the full page editing support (from <html> to </html>).
  • -
  • #4228 : Introduced the Shared Spaces feature.
  • -
  • #4379 : Introduced the new powerful pasting system and word cleanup procedure, including enhancements to the paste as plain text feature.
  • -
  • #2872 : Introduced the new native PHP API, the first standardized server side support.
  • -
  • #4210 : Added CKEditor plugin for jQuery.
  • -
  • #2885 : Added 'div' dialog and corresponding context menu options.
  • -
  • #4574 : Added the table merging tools and corresponding context menu options.
  • -
  • #4340 : Added the email protection option for link dialog.
  • -
  • #4463 : Added inline CSS support in all places where custom stylesheet could apply.
  • -
  • #3881 : Added color dialog for 'more color' option in color buttons.
  • -
  • #4341 : Added the 'showborder' plugin.
  • -
  • #4549 : Make the anti-cache query string configurable.
  • -
  • #4708 : Added the 'htmlEncodeOutput' config option.
  • -
  • #4342 : Introduced the bodyId and bodyClass settings to specify the id and class. to be used in the editing area at runtime.
  • -
  • #3401 : Introduced the baseHref setting so it's possible to set the URL to be used to resolve absolute and relative URLs in the contents.
  • -
  • #4729 : Added support to fake elements for comments.
  • -
-

- Fixed issues:

-
    -
  • #4707 : Fixed invalid link is requested in image preview.
  • -
  • #4461 : Fixed toolbar separator line along side combo enlarging the toolbar height.
  • -
  • #4596 : Fixed image re-size lock buttons aren't accessible in high-contrast mode.
  • -
  • #4676 : Fixed editing tables using table properties dialog overwrites original style values.
  • -
  • #4714 : Fixed IE6 JavaScript error when editing flash by commit 'Flash' dialog.
  • -
  • #3905 : Fixed 'wysiwyg' mode causes unauthenticated content warnings over SSL in FF 3.5.
  • -
  • #4768 : Fixed open context menu in IE throws js error when focus is not inside document.
  • -
  • #4822 : Fixed applying 'Headers' to existing table does not work in IE.
  • -
  • #4855 : Fixed toolbar doesn't wrap well for 'v2' skin in all browsers.
  • -
  • #4882 : Fixed auto detect paste from MS-Word is not working for Safari.
  • -
  • #4882 : Fixed unexpected margin style left behind on content cleaning up from MS-Word.
  • -
  • #4896 : Fixed paste nested list from MS-Word with measurement units set to cm is broken.
  • -
  • #4899 : Fixed unable to undo pre-formatted style.
  • -
  • #4900 : Fixed ratio-lock inconsistent between browsers.
  • -
  • #4901 : Fixed unable to edit any link with popup window's features in Firefox.
  • -
  • #4904 : Fixed when paste happen from dialog, it always throw JavaScript error.
  • -
  • #4905 : Fixed paste plain text result incorrect when content from dialog.
  • -
  • #4889 : Fixed unable to undo 'New Page' command after typing inside editor.
  • -
  • #4892 : Fixed table alignment style is not properly represented by the wrapping div.
  • -
  • #4918 : Fixed switching mode when maximized is showing background page contents.
  • -
-

- CKEditor 3.0.2

-

- New features:

-
    -
  • #4343 : Added the configuration option 'browserContextMenuOnCtrl' so it's possible to enable the default browser context menu by holding the CTRL key.
  • -
-

- Fixed issues:

-
    -
  • #4552 : Fixed float panel doesn't show up since editor instanced been destroyed once.
  • -
  • #3918 : Fixed fake object is editable with Image dialog.
  • -
  • #4053 : Fixed 'Form Properties' missing from context menu when selection collapsed inside form.
  • -
  • #4401 : Fixed customized by removing 'upload' tab page from 'Link dialog' cause JavaScript error.
  • -
  • #4477 : Adding missing tag names in object style elements.
  • -
  • #4567 : Fixed IE throw error when pressing BACKSPACE in source mode.
  • -
  • #4573 : Fixed 'IgnoreEmptyPargraph' config doesn't work with the config 'entities' is set to 'false'.
  • -
  • #4614 : Fixed attribute protection fails because of line-break.
  • -
  • #4546 : Fixed UIColor plugin doesn't work when editor id contains CSS selector preserved keywords.
  • -
  • #4609 : Fixed flash object is lost when loading data from outside editor.
  • -
  • #4625 : Fixed editor stays visible in a div with style 'visibility:hidden'.
  • -
  • #4621 : Fixed clicking below table caused an empty table been generated.
  • -
  • #3373 : Fixed empty context menu when there's no menu item at all.
  • -
  • #4473 : Fixed setting rules on the same element tag name throws error.
  • -
  • #4514 : Fixed press 'Back' button breaks wysiwyg editing mode is Firefox.
  • -
  • #4542 : Fixed unable to access buttons using tab key in Safari and Opera.
  • -
  • #4577 : Fixed relative link url is broken after opening 'Link' dialog.
  • -
  • #4597 : Fixed custom style with same attribute name but different attribute value doesn't work.
  • -
  • #4651 : Fixed 'Deleted' and 'Inserted' text style is not rendering in wysiwyg mode and is wrong is source mode.
  • -
  • #4654 : Fixed 'CKEDITOR.config.font_defaultLabel(fontSize_defaultLabel)' is not working.
  • -
  • #3950 : Fixed table column insertion incorrect when selecting empty cell area.
  • -
  • #3912 : Fixed UIColor not working in IE when page has more than 30+ editors.
  • -
  • #4031 : Fixed mouse cursor on toolbar combo has more than 3 shapes.
  • -
  • #4041 : Fixed open context menu on multiple cells to remove them result in only one removed.
  • -
  • #4185 : Fixed resize handler effect doesn't affect flash object on output.
  • -
  • #4196 : Fixed 'Remove Numbered/Bulleted List' on nested list doesn't work well on nested list.
  • -
  • #4200 : Fixed unable to insert 'password' type filed with attributes.
  • -
  • #4530 : Fixed context menu couldn't open in Opera.
  • -
  • #4536 : Fixed keyboard navigation doesn't work at all in IE quirks mode.
  • -
  • #4584 : Fixed updated link Target field is not updating when updating to certain values.
  • -
  • #4603 : Fixed unable to disable submenu items in contextmenu.
  • -
  • #4672 : Fixed unable to redo the insertion of horizontal line.
  • -
  • #4677 : Fixed 'Tab' key is trapped by hidden dialog elements.
  • -
  • #4073 : Fixed insert template with replace option could result in empty document.
  • -
  • #4455 : Fixed unable to start editing when image inside document not loaded.
  • -
  • #4517 : Fixed 'dialog_backgroundCoverColor' doesn't work on IE6.
  • -
  • #3165 : Fixed enter key in empty list item before nested one result in collapsed line.
  • -
  • #4527 : Fixed checkbox generate invalid 'checked' attribute.
  • -
  • #1659 : Fixed unable to click below content to start editing in IE with 'config.docType' setting to standard compliant.
  • -
  • #3933 : Fixed extra <br> left at the end of document when the last element is a table.
  • -
  • #4736 : Fixed PAGE UP and PAGE DOWN keys in standards mode are not working.
  • -
  • #4725 : Fixed hitting 'enter' before html comment node produces a JavaScript error.
  • -
  • #4522 : Fixed unable to redo when typing after insert an image with relative url.
  • -
  • #4594 : Fixed context menu goes off-screen when mouse is at right had side of screen.
  • -
  • #4673 : Fixed undo not available straight away if shift key is used to enter first character.
  • -
  • #4690 : Fixed the parsing of nested inline elements.
  • -
  • #4450 : Fixed selecting multiple table cells before apply justify commands generates spurious paragraph in Firefox.
  • -
  • #4733 : Fixed dialog opening sometimes hang up Firefox and Safari.
  • -
  • #4498 : Fixed toolbar collapse button missing tooltip.
  • -
  • #4738 : Fixed inserting table inside bold/italic/underline generates error on ENTER_BR mode.
  • -
  • #4246 : Fixed avoid XHTML deprecated attributes for image styling.
  • -
  • #4543 : Fixed unable to move cursor between table and hr.
  • -
  • #4764 : Fixed wrong exception message when CKEDITOR.editor.append() to non-existing elements.
  • -
  • #4521 : Fixed dialog layout in IE6/7 may have scroll-bar and other weird effects.
  • -
  • #4709 : Fixed inconsistent scroll-bar behavior on IE.
  • -
  • #4776 : Fixed preview page failed to open when relative URl contains in document.
  • -
  • #4812 : Fixed 'Esc' key not working on dialogs in Opera.
  • -
  • Updated the following language files:
  • -
-

- CKEditor 3.0.1

-

- New features:

-
    -
  • #4219 : Added fallback mechanism for config.language.
  • -
  • #4194 : Added support for using multiple css style sheets within the editor.
  • -
-

- Fixed issues:

-
    -
  • #3898 : Added validation for URL value in Image dialog.
  • -
  • #3528 : Fixed Context Menu issue when triggered using Shift+F10.
  • -
  • #4028 : Maximize control's tool tip was wrong once it is maximized.
  • -
  • #4237 : Toolbar is chopped off in Safari browser 3.x.
  • -
  • #4241 : Float panels are left on screen while editor is destroyed.
  • -
  • #4274 : Double click event is incorrect handled in 'divreplace' sample.
  • -
  • #4354 : Fixed TAB key on toolbar to not focus disabled buttons.
  • -
  • #3856 : Fixed focus and blur events in source view mode.
  • -
  • #3438 : Floating panels are off by (-1px, 0px) in RTL mode.
  • -
  • #3370 : Refactored use of CKEDITOR.env.isCustomDomain().
  • -
  • #4230 : HC detection caused js error.
  • -
  • #3978 : Fixed setStyle float on IE7 strict.
  • -
  • #4262 : Tab and Shift+Tab was not working to cycle through CTRL+SHIFT+F10 context menu in IE.
  • -
  • #3633 : Default context menu isn't disabled in toolbar, status bar, panels...
  • -
  • #3897 : Now there is no image previews when the URL is empty in image dialog.
  • -
  • #4048 : Context submenu was lacking uiColor.
  • -
  • #3568 : Dialogs now select all text when tabbing to text inputs.
  • -
  • #3727 : Cell Properties dialog was missing color selection option.
  • -
  • #3517 : Fixed "Match cyclic" field in Find & Replace dialog.
  • -
  • #4368 : borderColor table cell attribute haven't worked for none-IE
  • -
  • #4203 : In IE quirks mode + toolbar collapsed + source mode editing block height was incorrect.
  • -
  • #4387 : Fixed: right clicking in Kama skin can lead to a javascript error.
  • -
  • #4397 : Wysiwyg mode caused the host page scroll.
  • -
  • #4385 : Fixed editor's auto adjusting on DOM structure were confusing the dirty checking mechanism.
  • -
  • #4397 : Fixed regression of [3816] where turn on design mode was causing Firefox3 to scroll the host page.
  • -
  • #4254 : Added basic API sample.
  • -
  • #4107 : Normalize css font-family style text for correct comparision.
  • -
  • #3664 : Insert block element in empty editor document should not create new paragraph.
  • -
  • #4037 : 'id' attribute is missing with Flash dialog advanced page.
  • -
  • #4047 : Delete selected control type element when 'Backspace' is pressed on it.
  • -
  • #4191 : Fixed: dialog changes confirmation on image dialog appeared even when no changes have been made.
  • -
  • #4351 : Dash and dot could appear in attribute names.
  • -
  • #4355 : 'maximize' and 'showblock' commands shouldn't take editor focus.
  • -
  • #4504 : Fixed 'Enter'/'Esc' key is not working on dialog button.
  • -
  • #4245 : 'Strange Template' now come with a style attribute for width.
  • -
  • #4512 : Fixed styles plugin incorrectly adding semicolons to style text.
  • -
  • #3855 : Fixed loading unminified _source files when ckeditor_source.js is used.
  • -
  • #3717 : Dialog settings defaults can now be overridden in-page through the CKEDITOR.config object.
  • -
  • #4481 : The 'stylesCombo_stylesSet' configuration entry didn't work for full URLs.
  • -
  • #4480 : Fixed scope attribute in th.
  • -
  • #4467 : Fixed bug to use custom icon in context menus. Thanks to george.
  • -
  • #4190 : Fixed select field dialog layout in Safari.
  • -
  • #4518 : Fixed unable to open dialog without editor focus in IE.
  • -
  • #4519 : Fixed maximize without editor focus throw error in IE.
  • -
  • Updated the following language files:
  • -
-

- CKEditor 3.0

-

- New features:

-
    -
  • #3188 : Introduce - <pre> formatting feature when converting from other blocks.
  • -
  • #4445 : editor::setData now support an optional callback parameter.
  • -
-

- Fixed issues:

-
    -
  • #2856 : Fixed problem with inches in Paste From Word plugin.
  • -
  • #3929 : Using Paste dialog, - the text is pasted into current selection
  • -
  • #3920 : Mouse cursor over characters in - Special Character dialog now is correct
  • -
  • #3882 : Fixed an issue - with PasteFromWord dialog in which default values was ignored
  • -
  • #3859 : Fixed Flash dialog layout in Webkit
  • -
  • #3852 : Disabled textarea resizing in dialogs
  • -
  • #3831 : The attempt to remove the contextmenu plugin - will not anymore break the editor
  • -
  • #3781 : Colorbutton is now disabled in 'source' mode
  • -
  • #3848 : Fixed an issue with Webkit in witch - elements in the Image and Link dialogs had wrong dimensions.
  • -
  • #3808 : Fixed UI Color Picker dialog size in example page.
  • -
  • #3658 : Editor had horizontal scrollbar in IE6.
  • -
  • #3819 : The cursor was not visible - when applying style to collapsed selections in Firefox 2.
  • -
  • #3809 : Fixed beam cursor - when mouse cursor is over text-only buttons in IE.
  • -
  • #3815 : Fixed an issue - with the form dialog in which the "enctype" attribute is outputted as "encoding".
  • -
  • #3785 : Fixed an issue - in CKEDITOR.tools.htmlEncode() which incorrectly outputs &nbsp; in IE8.
  • -
  • #3820 : Fixed an issue in - bullet list command in which a list created at the bottom of another gets merged to the top. -
  • -
  • #3830 : Table cell properties dialog - doesn't apply to all selected cells.
  • -
  • #3835 : Element path is not refreshed - after click on 'newpage'; and safari is not putting focus on document also. -
  • -
  • #3821 : Fixed an issue with JAWS in which - toolbar items are read inconsistently between virtual cursor modes.
  • -
  • #3789 : The "src" attribute - was getting duplicated in some situations.
  • -
  • #3591 : Protecting flash related elements - including '<object>', '<embed>' and '<param>'. -
  • -
  • #3759 : Fixed CKEDITOR.dom.element::scrollIntoView - logic bug which scroll even element is inside viewport. -
  • -
  • #3773 : Fixed remove list will merge lines. -
  • -
  • #3829 : Fixed remove empty link on output data.
  • -
  • #3730 : Indent is performing on the whole - block instead of selected lines in enterMode = BR.
  • -
  • #3844 : Fixed UndoManager register keydown on obsoleted document
  • -
  • #3805 : Enabled SCAYT plugin for IE.
  • -
  • #3834 : Context menu on table caption was incorrect.
  • -
  • #3812 : Fixed an issue in which the editor - may show up empty or uneditable in IE7, 8 and Firefox 3.
  • -
  • #3825 : Fixed JS error when opening spellingcheck.
  • -
  • #3862 : Fixed html parser infinite loop on certain malformed - source code.
  • -
  • #3639 : Button size was inconsistent.
  • -
  • #3874 : Paste as plain text in Safari loosing lines.
  • -
  • #3849 : Fixed IE8 crashes when applying lists and indenting.
  • -
  • #3876 : Changed dialog checkbox and radio labels to explicit labels.
  • -
  • #3843 : Fixed context submenu position in IE 6 & 7 RTL.
  • -
  • #3864 : [FF]Document is not editable after inserting element on a fresh page.
  • -
  • #3883 : Fixed removing inline style logic incorrect on Firefox2.
  • -
  • #3884 : Empty "href" attribute was duplicated on output data.
  • -
  • #3858 : Fixed the issue where toolbars - break up in IE6 and IE7 after the browser is resized.
  • -
  • #3868 : [chrome] SCAYT toolbar options was in reversed order.
  • -
  • #3875 : Fixed an issue in Safari where - table row/column/cell menus are not useable when table cells are selected.
  • -
  • #3896 : The editing area was - flashing when switching forth and back to source view.
  • -
  • #3894 : Fixed an issue where editor failed to initialize when using the on-demand loading way.
  • -
  • #3903 : Color button plugin doesn't read config entry from editor instance correctly.
  • -
  • #3801 : Comments at the start of the document was lost in IE.
  • -
  • #3871 : Unable to redo when undos to the front of snapshots stack.
  • -
  • #3909 : Move focus from editor into a text input control is broken.
  • -
  • #3870 : The empty paragraph - desappears when hitting ENTER after "New Page".
  • -
  • #3887 : Fixed an issue in which the create - list command may leak outside of a selected table cell and into the rest of document.
  • -
  • #3916 : Fixed maximize does not enlarge editor width when width is set.
  • -
  • #3879 : [webkit] Color button panel had incorrect size on first open.
  • -
  • #3839 : Update Scayt plugin to reflect the latest change from SpellChecker.net.
  • -
  • #3742 : Fixed wrong dialog layout for dialogs without tab bar in IE RTL mode .
  • -
  • #3671 : Fixed body fixing should be applied to the real type under fake elements.
  • -
  • #3836 : Fixed remove list in enterMode=BR will merge sibling text to one line.
  • -
  • #3949 : Fixed enterKey within pre-formatted text introduce wrong line-break.
  • -
  • #3878 : Whenever possible, - dialogs will not present scrollbars if the content is too big for its standard - size.
  • -
  • #3782 : Remove empty list in table cell result in collapsed cell.
  • -
  • Updated the following language files:
  • -
  • #3984 : [IE]The pre-formatted style is generating error.
  • -
  • #3946 : Fixed unable to hide contextmenu.
  • -
  • #3956 : Fixed About dialog in Source Mode for IE.
  • -
  • #3953 : Fixed keystroke for close Paste dialog.
  • -
  • #3951 : Reset size and lock ratio options were not accessible in Image dialog.
  • -
  • #3921 : Fixed Container scroll issue on IE7.
  • -
  • #3940 : Fixed list operation doesn't stop at table.
  • -
  • #3891 : [IE] Fixed 'automatic' font color doesn't work.
  • -
  • #3972 : Fixed unable to remove a single empty list in document in Firefox with enterMode=BR.
  • -
  • #3973 : Fixed list creation error at the end of document.
  • -
  • #3959 : Pasting styled text from word result in content lost.
  • -
  • #3793 : Combined images into sprites.
  • -
  • #3783 : Fixed indenting command in table cells create collapsed paragraph.
  • -
  • #3968 : About dialog layout was broken with IE+Standards+RTL.
  • -
  • #3991 : In IE quirks, text was not visible in v2 and office2003 skins.
  • -
  • #3983 : In IE, we'll now - silently ignore wrong toolbar definition settings which have extra commas being - left around.
  • -
  • Fixed the following test cases:
      -
    • #3992 : core/ckeditor2.html
    • -
    • #4138 : core/plugins.html
    • -
    • #3801 : plugins/htmldataprocessor/htmldataprocessor.html
    • -
  • -
  • #3989 : Host page horizontal scrolling a lot when on having righ-to-left direction.
  • -
  • #4001 : Create link around existing image result incorrect.
  • -
  • #3988 : Destroy editor on form submit event cause error.
  • -
  • #3994 : Insert horizontal line at end of document cause error.
  • -
  • #4074 : Indent error with 'indentClasses' config specified.
  • -
  • #4057 : Fixed anchor is lost after switch between editing modes.
  • -
  • #3644 : Image dialog was missin radio lock.
  • -
  • #4014 : Firefox2 had no dialog button backgrounds.
  • -
  • #4018 : Firefox2 had no richcombo text visible.
  • -
  • #4035 : [IE6] Paste dialog size was too small.
  • -
  • #4049 : Kama skin was too wide with config.width.
  • -
  • The following released files now doesn't require the _source folder
      -
    • #4086 : _samples/ui_languages.html
    • -
    • #4093 : _tests/core/dom/document.html
    • -
    • #4094 : Smiley plugin file
    • -
    • #4097 : No undo/redo support for fontColor and backgroundColor buttons.
    • -
  • -
  • #4085 : Paste and Paste from Word dialogs were not well styled in IE+RTL.
  • -
  • #3982 : Fixed enterKey on empty list item result in weird dom structure.
  • -
  • #4101 : Now it is possible to close dialog before gets focus.
  • -
  • #4075 : [IE6/7]Fixed apply custom inline style with "class" attribute failed.
  • -
  • #4087 : [Firefox]Fixed extra blocks created on create list when full document selected.
  • -
  • #4097 : No undo/redo support for fontColor and backgroundColor buttons.
  • -
  • #4111 : Fixed apply block style after inline style applied on full document error.
  • -
  • #3622 : Fixed shift enter with selection not deleting highlighted text.
  • -
  • #4092 : [IE6] Close button was missing for dialog without multiple tabs.
  • -
  • #4003 : Markup on the image dialog was disrupted when removing the border input.
  • -
  • #4096 : Editor content area was pushed down in IE RTL quirks.
  • -
  • #4112 : [FF] Paste dialog had scrollbars in quirks.
  • -
  • #4118 : Dialog dragging was - occasionally behaving strangely .
  • -
  • #4077 : The toolbar combos - were rendering incorrectly in some languages, like Chinese.
  • -
  • #3622 : The toolbar in the v2 - skin was wrapping improperly in some languages.
  • -
  • #4119 : Unable to edit image link with image dialog.
  • -
  • #4117 : Fixed dialog error when transforming image into button.
  • -
  • #4058 : [FF] wysiwyg mode is sometimes not been activated.
  • -
  • #4114 : [IE] RTE + IE6/IE7 Quirks = dialog mispositoned.
  • -
  • #4123 : Some dialog buttons were broken in IE7 quirks.
  • -
  • #4122 : [IE] The image dialog - was being rendered improperly when loading an image with long URL.
  • -
  • #4144 : Fixed the white-spaces at the end of <pre> is incorrectly removed.
  • -
  • #4143 : Fixed element id is lost when extracting contents from the range.
  • -
  • #4007 : [IE] Source area overflow from editor chrome.
  • -
  • #4145 : Fixed the on demand - ("basic") loading model of the editor.
  • -
  • #4139 : Fixed list plugin regression of [3903].
  • -
  • #4147 : Unify style text normalization logic when comparing styles.
  • -
  • #4150 : Fixed enlarge list result incorrect at the inner boundary of block.
  • -
  • #4164 : Now it is possible to paste text - in Source mode even if forcePasteAsPlainText = true.
  • -
  • #4129 : [FF]Unable to remove list with Ctrl-A.
  • -
  • #4172 : [Safari] The trailing - <br> was not been always added to blank lines ending with &nbsp;.
  • -
  • #4178 : It's now possible to - copy and paste Flash content among different editor instances.
  • -
  • #4193 : Automatic font color produced empty span on Firefox 3.5.
  • -
  • #4186 : [FF] Fixed First open float panel cause host page scrollbar blinking.
  • -
  • #4227 : Fixed destroy editor instance created on textarea which is not within form cause error.
  • -
  • #4240 : Fixed editor name containing hyphen break editor completely.
  • -
  • #3828 : Malformed nested list is now corrected by the parser.
  • -
-

- CKEditor 3.0 RC

-

- Changelog starts at this release.

- - - diff --git a/public/javascripts/ckeditor/INSTALL.html b/public/javascripts/ckeditor/INSTALL.html deleted file mode 100644 index 8cf37f9..0000000 --- a/public/javascripts/ckeditor/INSTALL.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - Installation Guide - CKEditor - - - - -

- CKEditor Installation Guide

-

- What's CKEditor?

-

- CKEditor is a text editor to be used inside web pages. It's not a replacement - for desktop text editors like Word or OpenOffice, but a component to be used as - part of web applications and web sites.

-

- Installation

-

- Installing CKEditor is an easy task. Just follow these simple steps:

-
    -
  1. Download the latest version of the editor from our web site: http://ckeditor.com. You should have already completed - this step, but be sure you have the very latest version.
  2. -
  3. Extract (decompress) the downloaded file into the root of your - web site.
  4. -
-

- Note: CKEditor is by default installed in the "ckeditor" - folder. You can place the files in whichever you want though.

-

- Checking Your Installation -

-

- The editor comes with a few sample pages that can be used to verify that installation - proceeded properly. Take a look at the _samples directory.

-

- To test your installation, just call the following page at your web site:

-
-http://<your site>/<CKEditor installation path>/_samples/index.html
-
-For example:
-http://www.example.com/ckeditor/_samples/index.html
-

- Documentation

-

- The full editor documentation is available online at the following address:
- http://docs.cksource.com/ckeditor

- - - diff --git a/public/javascripts/ckeditor/LICENSE.html b/public/javascripts/ckeditor/LICENSE.html deleted file mode 100644 index ecbe06e..0000000 --- a/public/javascripts/ckeditor/LICENSE.html +++ /dev/null @@ -1,1334 +0,0 @@ - - - - - License - CKEditor - - -

- Software License Agreement -

-

- CKEditor™ - The text editor for Internet™ - - http://ckeditor.com
- Copyright © 2003-2010, CKSource - Frederico Knabben. All rights reserved. -

-

- Licensed under the terms of any of the following licenses at your choice: -

- -

- You are not required to, but if you want to explicitly declare the license you have - chosen to be bound to when using, reproducing, modifying and distributing this software, - just include a text file titled "LEGAL" in your version of this software, indicating - your license choice. In any case, your choice will not restrict any recipient of - your version of this software to use, reproduce, modify and distribute this software - under any of the above licenses. -

-

- Sources of Intellectual Property Included in CKEditor -

-

- Where not otherwise indicated, all CKEditor content is authored by CKSource engineers - and consists of CKSource-owned intellectual property. In some specific instances, - CKEditor will incorporate work done by developers outside of CKSource with their - express permission. -

-

- YUI Test: At _source/tests/yuitest.js - can be found part of the source code of YUI, which is licensed under the terms of - the BSD License. YUI is - Copyright © 2008, Yahoo! Inc. -

-

- Trademarks -

-

- CKEditor is a trademark of CKSource - Frederico Knabben. All other brand and product - names are trademarks, registered trademarks or service marks of their respective - holders. -

- - diff --git a/public/javascripts/ckeditor/_samples/ajax.html b/public/javascripts/ckeditor/_samples/ajax.html deleted file mode 100644 index 153e546..0000000 --- a/public/javascripts/ckeditor/_samples/ajax.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - Ajax - CKEditor Sample - - - - - - - -

- CKEditor Sample -

- -
- -
-

- - -

- -
-
- - - - diff --git a/public/javascripts/ckeditor/_samples/api.html b/public/javascripts/ckeditor/_samples/api.html deleted file mode 100644 index f853350..0000000 --- a/public/javascripts/ckeditor/_samples/api.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - API usage - CKEditor Sample - - - - - - - - -

- CKEditor Sample -

- -
- -
-
-

- This sample shows how to use the CKeditor JavaScript API to interact with the editor - at runtime.

- - - - -
-
- -
- - - diff --git a/public/javascripts/ckeditor/_samples/api_dialog.html b/public/javascripts/ckeditor/_samples/api_dialog.html deleted file mode 100644 index 2620625..0000000 --- a/public/javascripts/ckeditor/_samples/api_dialog.html +++ /dev/null @@ -1,181 +0,0 @@ - - - - - Using API to customize dialogs - CKEditor Sample - - - - - - - - - -

- CKEditor Sample -

- -
- -
- -

- This sample shows how to use the dialog API to customize dialogs whithout changing - the original editor code. The following customizations are being done::

-
    -
  1. Add dialog pages ("My Tab" in the Link dialog).
  2. -
  3. Remove a dialog tab ("Target" tab from the Link dialog).
  4. -
  5. Add dialog fields ("My Custom Field" into the Link dialog).
  6. -
  7. Remove dialog fields ("Link Type" and "Browser Server" the Link - dialog).
  8. -
  9. Set default values for dialog fields (for the "URL" field in the - Link dialog).
  10. -
  11. Create a custom dialog ("My Dialog" button).
  12. -
- - - - - diff --git a/public/javascripts/ckeditor/_samples/api_dialog/my_dialog.js b/public/javascripts/ckeditor/_samples/api_dialog/my_dialog.js deleted file mode 100644 index 02f412f..0000000 --- a/public/javascripts/ckeditor/_samples/api_dialog/my_dialog.js +++ /dev/null @@ -1,28 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -CKEDITOR.dialog.add( 'myDialog', function( editor ) -{ - return { - title : 'My Dialog', - minWidth : 400, - minHeight : 200, - contents : [ - { - id : 'tab1', - label : 'First Tab', - title : 'First Tab', - elements : - [ - { - id : 'input1', - type : 'text', - label : 'Input 1' - } - ] - } - ] - }; -} ); diff --git a/public/javascripts/ckeditor/_samples/assets/output_xhtml.css b/public/javascripts/ckeditor/_samples/assets/output_xhtml.css deleted file mode 100644 index 620ac64..0000000 --- a/public/javascripts/ckeditor/_samples/assets/output_xhtml.css +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (c) 2003-2010, 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; -} diff --git a/public/javascripts/ckeditor/_samples/divreplace.html b/public/javascripts/ckeditor/_samples/divreplace.html deleted file mode 100644 index bee6797..0000000 --- a/public/javascripts/ckeditor/_samples/divreplace.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - Replace DIV - CKEditor Sample - - - - - - - - - -

- CKEditor Sample -

- -
- -
-

- Double-click on any of the following DIVs to transform them into editor instances.

-
-

- Part 1

-

- Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras et ipsum quis mi - semper accumsan. Integer pretium dui id massa. Suspendisse in nisl sit amet urna - rutrum imperdiet. Nulla eu tellus. Donec ante nisi, ullamcorper quis, fringilla - nec, sagittis eleifend, pede. Nulla commodo interdum massa. Donec id metus. Fusce - eu ipsum. Suspendisse auctor. Phasellus fermentum porttitor risus. -

-
-
-

- Part 2

-

- Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras et ipsum quis mi - semper accumsan. Integer pretium dui id massa. Suspendisse in nisl sit amet urna - rutrum imperdiet. Nulla eu tellus. Donec ante nisi, ullamcorper quis, fringilla - nec, sagittis eleifend, pede. Nulla commodo interdum massa. Donec id metus. Fusce - eu ipsum. Suspendisse auctor. Phasellus fermentum porttitor risus. -

-

- Donec velit. Mauris massa. Vestibulum non nulla. Nam suscipit arcu nec elit. Phasellus - sollicitudin iaculis ante. Ut non mauris et sapien tincidunt adipiscing. Vestibulum - vitae leo. Suspendisse nec mi tristique nulla laoreet vulputate. -

-
-
-

- Part 3

-

- Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras et ipsum quis mi - semper accumsan. Integer pretium dui id massa. Suspendisse in nisl sit amet urna - rutrum imperdiet. Nulla eu tellus. Donec ante nisi, ullamcorper quis, fringilla - nec, sagittis eleifend, pede. Nulla commodo interdum massa. Donec id metus. Fusce - eu ipsum. Suspendisse auctor. Phasellus fermentum porttitor risus. -

-
- - - diff --git a/public/javascripts/ckeditor/_samples/enterkey.html b/public/javascripts/ckeditor/_samples/enterkey.html deleted file mode 100644 index def67ae..0000000 --- a/public/javascripts/ckeditor/_samples/enterkey.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - ENTER Key Configuration - CKEditor Sample - - - - - - - -

- CKEditor Sample -

- -
- -
-
- When ENTER is pressed:
- -
-
- When SHIFT + ENTER is pressed:
- -
-
-
-

-
- -

-

- -

-
- - - diff --git a/public/javascripts/ckeditor/_samples/fullpage.html b/public/javascripts/ckeditor/_samples/fullpage.html deleted file mode 100644 index bdd301e..0000000 --- a/public/javascripts/ckeditor/_samples/fullpage.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - Full Page Editing - CKEditor Sample - - - - - - -

- CKEditor Sample -

- -
- -
-
-

- In this sample the editor is configured to edit entire HTML pages, from the <html> - tag to </html>.

-

-
- - -

-

- -

-
- - - diff --git a/public/javascripts/ckeditor/_samples/index.html b/public/javascripts/ckeditor/_samples/index.html deleted file mode 100644 index 84fa75d..0000000 --- a/public/javascripts/ckeditor/_samples/index.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - - Samples List - CKEditor - - - -

- CKEditor Samples List -

-

- Basic Samples -

- -

- Basic Customization -

- -

- Advanced Samples -

- - - - diff --git a/public/javascripts/ckeditor/_samples/jqueryadapter.html b/public/javascripts/ckeditor/_samples/jqueryadapter.html deleted file mode 100644 index 66bf976..0000000 --- a/public/javascripts/ckeditor/_samples/jqueryadapter.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - - jQuery adapter - CKEditor Sample - - - - - - - - - -

- CKEditor Sample -

- -
- -
- -
-

-
- -

-

- -

-
- - - diff --git a/public/javascripts/ckeditor/_samples/output_xhtml.html b/public/javascripts/ckeditor/_samples/output_xhtml.html deleted file mode 100644 index c84ca0e..0000000 --- a/public/javascripts/ckeditor/_samples/output_xhtml.html +++ /dev/null @@ -1,159 +0,0 @@ - - - - - XHTML compliant output - CKEditor Sample - - - - - - -

- CKEditor Sample -

- -
- -
-
-

- This sample shows CKEditor configured to produce XHTML 1.1 compliant - HTML. Deprecated elements or attributes, like the <font> and <u> elements - or the "style" attribute, are avoided.

-

-
- - -

-

- -

-
- - - diff --git a/public/javascripts/ckeditor/_samples/php/advanced.php b/public/javascripts/ckeditor/_samples/php/advanced.php deleted file mode 100644 index 771cb0c..0000000 --- a/public/javascripts/ckeditor/_samples/php/advanced.php +++ /dev/null @@ -1,93 +0,0 @@ - - - - - Sample - CKEditor - - - - -

- CKEditor Sample -

- -
- -
- -
- Output -
-

-
-

-returnOutput = true; - -// Path to CKEditor directory, ideally instead of relative dir, use an absolute path: -// $CKEditor->basePath = '/ckeditor/' -// If not set, CKEditor will try to detect the correct path. -$CKEditor->basePath = '../../'; - -// Set global configuration (will be used by all instances of CKEditor). -$CKEditor->config['width'] = 600; - -// Change default textarea attributes -$CKEditor->textareaAttributes = array("cols" => 80, "rows" => 10); - -// The initial value to be displayed in the editor. -$initialValue = '

This is some sample text. You are using CKEditor.

'; - -// Create first instance. -$code = $CKEditor->editor("editor1", $initialValue); - -echo $code; -?> -

-
-

-editor("editor2", $initialValue, $config); -?> -

- -

-
-
- - - diff --git a/public/javascripts/ckeditor/_samples/php/events.php b/public/javascripts/ckeditor/_samples/php/events.php deleted file mode 100644 index 36f2be2..0000000 --- a/public/javascripts/ckeditor/_samples/php/events.php +++ /dev/null @@ -1,130 +0,0 @@ - - - - - Sample - CKEditor - - - - -

- CKEditor Sample -

- -
- -
- -
- Output -
-

-
-

-addGlobalEventHandler('dialogDefinition', $function); -} - -/** - * Adds global event, will notify about opened dialog. - */ -function CKEditorNotifyAboutOpenedDialog(&$CKEditor) { - $function = 'function (evt) { - alert("Loading dialog: " + evt.data.name); - }'; - - $CKEditor->addGlobalEventHandler('dialogDefinition', $function); -} - -// Include CKEditor class. -include("../../ckeditor.php"); - -// Create class instance. -$CKEditor = new CKEditor(); - -// Set configuration option for all editors. -$CKEditor->config['width'] = 750; - -// Path to CKEditor directory, ideally instead of relative dir, use an absolute path: -// $CKEditor->basePath = '/ckeditor/' -// If not set, CKEditor will try to detect the correct path. -$CKEditor->basePath = '../../'; - -// The initial value to be displayed in the editor. -$initialValue = '

This is some sample text. You are using CKEditor.

'; - -// Event that will be handled only by the first editor. -$CKEditor->addEventHandler('instanceReady', 'function (evt) { - alert("Loaded editor: " + evt.editor.name); -}'); - -// Create first instance. -$CKEditor->editor("editor1", $initialValue); - -// Clear event handlers, instances that will be created later will not have -// the 'instanceReady' listener defined a couple of lines above. -$CKEditor->clearEventHandlers(); -?> -

-
-

-editor("editor2", $initialValue, $config, $events); -?> -

- -

-
-
- - - diff --git a/public/javascripts/ckeditor/_samples/php/replace.php b/public/javascripts/ckeditor/_samples/php/replace.php deleted file mode 100644 index 80d813b..0000000 --- a/public/javascripts/ckeditor/_samples/php/replace.php +++ /dev/null @@ -1,63 +0,0 @@ - - - - - Sample - CKEditor - - - - -

- CKEditor Sample -

- -
- -
- -
- Output -
-

-
- -

-

- -

-
-
- - basePath = '/ckeditor/' - // If not set, CKEditor will try to detect the correct path. - $CKEditor->basePath = '../../'; - // Replace textarea with id (or name) "editor1". - $CKEditor->replace("editor1"); - ?> - - diff --git a/public/javascripts/ckeditor/_samples/php/replaceall.php b/public/javascripts/ckeditor/_samples/php/replaceall.php deleted file mode 100644 index 38efc80..0000000 --- a/public/javascripts/ckeditor/_samples/php/replaceall.php +++ /dev/null @@ -1,68 +0,0 @@ - - - - - Sample - CKEditor - - - - -

- CKEditor Sample -

- -
- -
- -
- Output -
-

-
- -

-

-
- -

-

- -

-
-
- - basePath = '/ckeditor/' - // If not set, CKEditor will try to detect the correct path. - $CKEditor->basePath = '../../'; - // Replace all textareas with CKEditor. - $CKEditor->replaceAll(); - ?> - - diff --git a/public/javascripts/ckeditor/_samples/php/standalone.php b/public/javascripts/ckeditor/_samples/php/standalone.php deleted file mode 100644 index 2a39ca1..0000000 --- a/public/javascripts/ckeditor/_samples/php/standalone.php +++ /dev/null @@ -1,64 +0,0 @@ - - - - - Sample - CKEditor - - - - -

- CKEditor Sample -

- -
- -
- -
- Output -
-

-
-

-

- This is some sample text.

'; - // Create class instance. - $CKEditor = new CKEditor(); - // Path to CKEditor directory, ideally instead of relative dir, use an absolute path: - // $CKEditor->basePath = '/ckeditor/' - // If not set, CKEditor will try to detect the correct path. - $CKEditor->basePath = '../../'; - // Create textarea element and attach CKEditor to it. - $CKEditor->editor("editor1", $initialValue); - ?> - -

-
-
- - - diff --git a/public/javascripts/ckeditor/_samples/replacebyclass.html b/public/javascripts/ckeditor/_samples/replacebyclass.html deleted file mode 100644 index fd31e7d..0000000 --- a/public/javascripts/ckeditor/_samples/replacebyclass.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - Replace Textareas by Class Name - CKEditor Sample - - - - - - -

- CKEditor Sample -

- -
- -
-
-

-
- -

-

- -

-
- - - diff --git a/public/javascripts/ckeditor/_samples/replacebycode.html b/public/javascripts/ckeditor/_samples/replacebycode.html deleted file mode 100644 index bd3f54d..0000000 --- a/public/javascripts/ckeditor/_samples/replacebycode.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - Replace Textarea by Code - CKEditor Sample - - - - - - -

- CKEditor Sample -

- -
- -
-
-

-
- - -

-

-
- - -

-

- -

-
- - - diff --git a/public/javascripts/ckeditor/_samples/sample.css b/public/javascripts/ckeditor/_samples/sample.css deleted file mode 100644 index cee85e8..0000000 --- a/public/javascripts/ckeditor/_samples/sample.css +++ /dev/null @@ -1,81 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -fieldset -{ - margin: 0; - padding: 10px; -} - -form -{ - margin: 0; - padding: 0; -} - -pre -{ - background-color: #F7F7F7; - border: 1px solid #D7D7D7; - overflow: auto; - margin: 0; - 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 */ -} diff --git a/public/javascripts/ckeditor/_samples/sample.js b/public/javascripts/ckeditor/_samples/sample.js deleted file mode 100644 index f7c023c..0000000 --- a/public/javascripts/ckeditor/_samples/sample.js +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright (c) 2003-2010, 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 = '

Your browser is not compatible with CKEditor.'; - - 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 += '

With non compatible browsers, you should still be able to see and edit the contents (HTML) in a plain text field.

'; - - 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 ); - })(); -} diff --git a/public/javascripts/ckeditor/_samples/sample_posteddata.php b/public/javascripts/ckeditor/_samples/sample_posteddata.php deleted file mode 100644 index af20e89..0000000 --- a/public/javascripts/ckeditor/_samples/sample_posteddata.php +++ /dev/null @@ -1,59 +0,0 @@ - - - - - Sample - CKEditor - - - - -

- CKEditor - Posted Data -

- - - - - - - - - $value ) -{ - if ( get_magic_quotes_gpc() ) - $postedValue = htmlspecialchars( stripslashes( $value ) ) ; - else - $postedValue = htmlspecialchars( $value ) ; - -?> - - - - - -
Field NameValue
- - - diff --git a/public/javascripts/ckeditor/_samples/sharedspaces.html b/public/javascripts/ckeditor/_samples/sharedspaces.html deleted file mode 100644 index 7b32b9f..0000000 --- a/public/javascripts/ckeditor/_samples/sharedspaces.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - Shared toolbars - CKEditor Sample - - - - - - - -

- CKEditor Sample -

- -
- -
-
-
-
-

-
- -

-

-
- -

-

-
- -

-

-
- -

-

- -

-
-
-
- - - - diff --git a/public/javascripts/ckeditor/_samples/skins.html b/public/javascripts/ckeditor/_samples/skins.html deleted file mode 100644 index 7f8ea83..0000000 --- a/public/javascripts/ckeditor/_samples/skins.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - Skins - CKEditor Sample - - - - - - -

- CKEditor Sample -

- -
- -
-
-

- "Kama" skin:
- - -

-

- "Office 2003" skin:
- - -

-

- "V2" skin:
- - -

-
- - - diff --git a/public/javascripts/ckeditor/_samples/ui_color.html b/public/javascripts/ckeditor/_samples/ui_color.html deleted file mode 100644 index 8ba1acf..0000000 --- a/public/javascripts/ckeditor/_samples/ui_color.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - UI Color Setting Tool - CKEditor Sample - - - - - - -

- CKEditor Sample -

- -
- -
-

- Click the UI Color Picker button to test your color preferences at runtime.

-
-

- - -

-

- - -

-

- -

-
- - - diff --git a/public/javascripts/ckeditor/_samples/ui_languages.html b/public/javascripts/ckeditor/_samples/ui_languages.html deleted file mode 100644 index e7c2e15..0000000 --- a/public/javascripts/ckeditor/_samples/ui_languages.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - User Interface Globalization - CKEditor Sample - - - - - - - -

- CKEditor Sample -

- -
- -
-
-

- Available languages ( languages!):
- -
- (You may see strange characters if your system doesn't - support the selected language) -

-

- - -

-
- - - diff --git a/public/javascripts/ckeditor/_source/adapters/jquery.js b/public/javascripts/ckeditor/_source/adapters/jquery.js deleted file mode 100644 index e633758..0000000 --- a/public/javascripts/ckeditor/_source/adapters/jquery.js +++ /dev/null @@ -1,297 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview jQuery adapter provides easy use of basic CKEditor functions - * and access to internal API. It also integrates some aspects of CKEditor with - * jQuery framework. - * - * Every TEXTAREA, DIV and P elements can be converted to working editor. - * - * Plugin exposes some of editor's event to jQuery event system. All of those are namespaces inside - * ".ckeditor" namespace and can be binded/listened on supported textarea, div and p nodes. - * - * Available jQuery events: - * - instanceReady.ckeditor( editor, rootNode ) - * Triggered when new instance is ready. - * - destroy.ckeditor( editor ) - * Triggered when instance is destroyed. - * - getData.ckeditor( editor, eventData ) - * Triggered when getData event is fired inside editor. It can change returned data using eventData reference. - * - setData.ckeditor( editor ) - * Triggered when getData event is fired inside editor. - * - * @example - * - * - * - */ - -(function() -{ - /** - * Allow CKEditor to override jQuery.fn.val(). This results in ability to use val() - * function on textareas as usual and having those calls synchronized with CKEditor - * Rich Text Editor component. - * - * This config option is global and executed during plugin load. - * Can't be customized across editor instances. - * - * @type Boolean - * @example - * $( 'textarea' ).ckeditor(); - * // ... - * $( 'textarea' ).val( 'New content' ); - */ - CKEDITOR.config.jqueryOverrideVal = typeof CKEDITOR.config.jqueryOverrideVal == 'undefined' - ? true : CKEDITOR.config.jqueryOverrideVal; - - var jQuery = window.jQuery; - - if ( typeof jQuery == 'undefined' ) - return; - - // jQuery object methods. - jQuery.extend( jQuery.fn, - /** @lends jQuery.fn */ - { - /** - * Return existing CKEditor instance for first matched element. - * Allows to easily use internal API. Doesn't return jQuery object. - * - * Raised exception if editor doesn't exist or isn't ready yet. - * - * @name jQuery.ckeditorGet - * @return CKEDITOR.editor - * @see CKEDITOR.editor - */ - ckeditorGet: function() - { - var instance = this.eq( 0 ).data( 'ckeditorInstance' ); - if ( !instance ) - throw "CKEditor not yet initialized, use ckeditor() with callback."; - return instance; - }, - /** - * Triggers creation of CKEditor in all matched elements (reduced to DIV, P and TEXTAREAs). - * Binds callback to instanceReady event of all instances. If editor is already created, than - * callback is fired right away. - * - * Mixed parameter order allowed. - * - * @param callback Function to be run on editor instance. Passed parameters: [ textarea ]. - * Callback is fiered in "this" scope being ckeditor instance and having source textarea as first param. - * - * @param config Configuration options for new instance(s) if not already created. - * See URL - * - * @example - * $( 'textarea' ).ckeditor( function( textarea ) { - * $( textarea ).val( this.getData() ) - * } ); - * - * @name jQuery.fn.ckeditor - * @return jQuery.fn - */ - ckeditor: function( callback, config ) - { - if ( !jQuery.isFunction( callback )) - { - var tmp = config; - config = callback; - callback = tmp; - } - config = config || {}; - - this.filter( 'textarea, div, p' ).each( function() - { - var $element = jQuery( this ), - editor = $element.data( 'ckeditorInstance' ), - instanceLock = $element.data( '_ckeditorInstanceLock' ), - element = this; - - if ( editor && !instanceLock ) - { - if ( callback ) - callback.apply( editor, [ this ] ); - } - else if ( !instanceLock ) - { - // CREATE NEW INSTANCE - - // Handle config.autoUpdateElement inside this plugin if desired. - if ( config.autoUpdateElement - || ( typeof config.autoUpdateElement == 'undefined' && CKEDITOR.config.autoUpdateElement ) ) - { - config.autoUpdateElementJquery = true; - } - - // Always disable config.autoUpdateElement. - config.autoUpdateElement = false; - $element.data( '_ckeditorInstanceLock', true ); - - // Set instance reference in element's data. - editor = CKEDITOR.replace( element, config ); - $element.data( 'ckeditorInstance', editor ); - - // Register callback. - editor.on( 'instanceReady', function( event ) - { - var editor = event.editor; - setTimeout( function() - { - // Delay bit more if editor is still not ready. - if ( !editor.element ) - { - setTimeout( arguments.callee, 100 ); - return; - } - - // Remove this listener. - event.removeListener( 'instanceReady', this.callee ); - - // Forward setData on dataReady. - editor.on( 'dataReady', function() - { - $element.trigger( 'setData' + '.ckeditor', [ editor ] ); - }); - - // Forward getData. - editor.on( 'getData', function( event ) { - $element.trigger( 'getData' + '.ckeditor', [ editor, event.data ] ); - }, 999 ); - - // Forward destroy event. - editor.on( 'destroy', function() - { - $element.trigger( 'destroy.ckeditor', [ editor ] ); - }); - - // Integrate with form submit. - if ( editor.config.autoUpdateElementJquery && $element.is( 'textarea' ) && $element.parents( 'form' ).length ) - { - var onSubmit = function() - { - $element.ckeditor( function() - { - editor.updateElement(); - }); - }; - - // Bind to submit event. - $element.parents( 'form' ).submit( onSubmit ); - - // Bind to form-pre-serialize from jQuery Forms plugin. - $element.parents( 'form' ).bind( 'form-pre-serialize', onSubmit ); - - // Unbind when editor destroyed. - $element.bind( 'destroy.ckeditor', function() - { - $element.parents( 'form' ).unbind( 'submit', onSubmit ); - $element.parents( 'form' ).unbind( 'form-pre-serialize', onSubmit ); - }); - } - - // Garbage collect on destroy. - editor.on( 'destroy', function() - { - $element.data( 'ckeditorInstance', null ); - }); - - // Remove lock. - $element.data( '_ckeditorInstanceLock', null ); - - // Fire instanceReady event. - $element.trigger( 'instanceReady.ckeditor', [ editor ] ); - - // Run given (first) code. - if ( callback ) - callback.apply( editor, [ element ] ); - }, 0 ); - }, null, null, 9999); - } - else - { - // Editor is already during creation process, bind our code to the event. - CKEDITOR.on( 'instanceReady', function( event ) - { - var editor = event.editor; - setTimeout( function() - { - // Delay bit more if editor is still not ready. - if ( !editor.element ) - { - setTimeout( arguments.callee, 100 ); - return; - } - - if ( editor.element.$ == element ) - { - // Run given code. - if ( callback ) - callback.apply( editor, [ element ] ); - } - }, 0 ); - }, null, null, 9999); - } - }); - return this; - } - }); - - // New val() method for objects. - if ( CKEDITOR.config.jqueryOverrideVal ) - { - jQuery.fn.val = CKEDITOR.tools.override( jQuery.fn.val, function( oldValMethod ) - { - /** - * CKEditor-aware val() method. - * - * Acts same as original jQuery val(), but for textareas which have CKEditor instances binded to them, method - * returns editor's content. It also works for settings values. - * - * @param oldValMethod - * @name jQuery.fn.val - */ - return function( newValue, forceNative ) - { - var isSetter = typeof newValue != 'undefined', - result; - - this.each( function() - { - var $this = jQuery( this ), - editor = $this.data( 'ckeditorInstance' ); - - if ( !forceNative && $this.is( 'textarea' ) && editor ) - { - if ( isSetter ) - editor.setData( newValue ); - else - { - result = editor.getData(); - // break; - return null; - } - } - else - { - if ( isSetter ) - oldValMethod.call( $this, newValue ); - else - { - result = oldValMethod.call( $this ); - // break; - return null; - } - } - - return true; - }); - return isSetter ? this : result; - }; - }); - } -})(); diff --git a/public/javascripts/ckeditor/_source/core/_bootstrap.js b/public/javascripts/ckeditor/_source/core/_bootstrap.js deleted file mode 100644 index f351ce6..0000000 --- a/public/javascripts/ckeditor/_source/core/_bootstrap.js +++ /dev/null @@ -1,91 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview API initialization code. - */ - -(function() -{ - // Disable HC detaction in WebKit. (#5429) - if ( CKEDITOR.env.webkit ) - { - CKEDITOR.env.hc = false; - return; - } - - // Check is High Contrast is active by creating a temporary element with a - // background image. - - var useSpacer = CKEDITOR.env.ie && CKEDITOR.env.version < 7, - useBlank = CKEDITOR.env.ie && CKEDITOR.env.version == 7; - - var backgroundImageUrl = useSpacer ? ( CKEDITOR.basePath + 'images/spacer.gif' ) : - useBlank ? 'about:blank' : 'data:image/png;base64,'; - - var hcDetect = CKEDITOR.dom.element.createFromHtml( - '
', CKEDITOR.document ); - - hcDetect.appendTo( CKEDITOR.document.getHead() ); - - // Update CKEDITOR.env. - // Catch exception needed sometimes for FF. (#4230) - try - { - CKEDITOR.env.hc = ( hcDetect.getComputedStyle( 'background-image' ) == 'none' ); - } - catch (e) - { - CKEDITOR.env.hc = false; - } - - if ( CKEDITOR.env.hc ) - CKEDITOR.env.cssClass += ' cke_hc'; - - hcDetect.remove(); -})(); - -// Load core plugins. -CKEDITOR.plugins.load( CKEDITOR.config.corePlugins.split( ',' ), function() - { - CKEDITOR.status = 'loaded'; - CKEDITOR.fire( 'loaded' ); - - // Process all instances created by the "basic" implementation. - var pending = CKEDITOR._.pending; - if ( pending ) - { - delete CKEDITOR._.pending; - - for ( var i = 0 ; i < pending.length ; i++ ) - CKEDITOR.add( pending[ i ] ); - } - }); - -/* -TODO: Enable the following and check if effective. - -if ( CKEDITOR.env.ie ) -{ - // Remove IE mouse flickering on IE6 because of background images. - try - { - document.execCommand( 'BackgroundImageCache', false, true ); - } - catch (e) - { - // We have been reported about loading problems caused by the above - // line. For safety, let's just ignore errors. - } -} -*/ - -/** - * Fired when a CKEDITOR core object is fully loaded and ready for interaction. - * @name CKEDITOR#loaded - * @event - */ diff --git a/public/javascripts/ckeditor/_source/core/ajax.js b/public/javascripts/ckeditor/_source/core/ajax.js deleted file mode 100644 index 078c15a..0000000 --- a/public/javascripts/ckeditor/_source/core/ajax.js +++ /dev/null @@ -1,143 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Defines the {@link CKEDITOR.ajax} object, which holds ajax methods for - * data loading. - */ - -/** - * Ajax methods for data loading. - * @namespace - * @example - */ -CKEDITOR.ajax = (function() -{ - var createXMLHttpRequest = function() - { - // In IE, using the native XMLHttpRequest for local files may throw - // "Access is Denied" errors. - if ( !CKEDITOR.env.ie || location.protocol != 'file:' ) - try { return new XMLHttpRequest(); } catch(e) {} - - try { return new ActiveXObject( 'Msxml2.XMLHTTP' ); } catch (e) {} - try { return new ActiveXObject( 'Microsoft.XMLHTTP' ); } catch (e) {} - - return null; - }; - - var checkStatus = function( xhr ) - { - // HTTP Status Codes: - // 2xx : Success - // 304 : Not Modified - // 0 : Returned when running locally (file://) - // 1223 : IE may change 204 to 1223 (see http://dev.jquery.com/ticket/1450) - - return ( xhr.readyState == 4 && - ( ( xhr.status >= 200 && xhr.status < 300 ) || - xhr.status == 304 || - xhr.status === 0 || - xhr.status == 1223 ) ); - }; - - var getResponseText = function( xhr ) - { - if ( checkStatus( xhr ) ) - return xhr.responseText; - return null; - }; - - var getResponseXml = function( xhr ) - { - if ( checkStatus( xhr ) ) - { - var xml = xhr.responseXML; - return new CKEDITOR.xml( xml && xml.firstChild ? xml : xhr.responseText ); - } - return null; - }; - - var load = function( url, callback, getResponseFn ) - { - var async = !!callback; - - var xhr = createXMLHttpRequest(); - - if ( !xhr ) - return null; - - xhr.open( 'GET', url, async ); - - if ( async ) - { - // TODO: perform leak checks on this closure. - /** @ignore */ - xhr.onreadystatechange = function() - { - if ( xhr.readyState == 4 ) - { - callback( getResponseFn( xhr ) ); - xhr = null; - } - }; - } - - xhr.send(null); - - return async ? '' : getResponseFn( xhr ); - }; - - return /** @lends CKEDITOR.ajax */ { - - /** - * Loads data from an URL as plain text. - * @param {String} url The URL from which load data. - * @param {Function} [callback] A callback function to be called on - * data load. If not provided, the data will be loaded - * asynchronously, passing the data value the function on load. - * @returns {String} The loaded data. For asynchronous requests, an - * empty string. For invalid requests, null. - * @example - * // Load data synchronously. - * var data = CKEDITOR.ajax.load( 'somedata.txt' ); - * alert( data ); - * @example - * // Load data asynchronously. - * var data = CKEDITOR.ajax.load( 'somedata.txt', function( data ) - * { - * alert( data ); - * } ); - */ - load : function( url, callback ) - { - return load( url, callback, getResponseText ); - }, - - /** - * Loads data from an URL as XML. - * @param {String} url The URL from which load data. - * @param {Function} [callback] A callback function to be called on - * data load. If not provided, the data will be loaded - * asynchronously, passing the data value the function on load. - * @returns {CKEDITOR.xml} An XML object holding the loaded data. For asynchronous requests, an - * empty string. For invalid requests, null. - * @example - * // Load XML synchronously. - * var xml = CKEDITOR.ajax.loadXml( 'somedata.xml' ); - * alert( xml.getInnerXml( '//' ) ); - * @example - * // Load XML asynchronously. - * var data = CKEDITOR.ajax.loadXml( 'somedata.xml', function( xml ) - * { - * alert( xml.getInnerXml( '//' ) ); - * } ); - */ - loadXml : function( url, callback ) - { - return load( url, callback, getResponseXml ); - } - }; -})(); diff --git a/public/javascripts/ckeditor/_source/core/ckeditor.js b/public/javascripts/ckeditor/_source/core/ckeditor.js deleted file mode 100644 index 1faddd2..0000000 --- a/public/javascripts/ckeditor/_source/core/ckeditor.js +++ /dev/null @@ -1,103 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Contains the third and last part of the {@link CKEDITOR} object - * definition. - */ - -// Remove the CKEDITOR.loadFullCore reference defined on ckeditor_basic. -delete CKEDITOR.loadFullCore; - -/** - * Holds references to all editor instances created. The name of the properties - * in this object correspond to instance names, and their values contains the - * {@link CKEDITOR.editor} object representing them. - * @type {Object} - * @example - * alert( CKEDITOR.instances.editor1.name ); // "editor1" - */ -CKEDITOR.instances = {}; - -/** - * The document of the window holding the CKEDITOR object. - * @type {CKEDITOR.dom.document} - * @example - * alert( CKEDITOR.document.getBody().getName() ); // "body" - */ -CKEDITOR.document = new CKEDITOR.dom.document( document ); - -/** - * Adds an editor instance to the global {@link CKEDITOR} object. This function - * is available for internal use mainly. - * @param {CKEDITOR.editor} editor The editor instance to be added. - * @example - */ -CKEDITOR.add = function( editor ) -{ - CKEDITOR.instances[ editor.name ] = editor; - - editor.on( 'focus', function() - { - if ( CKEDITOR.currentInstance != editor ) - { - CKEDITOR.currentInstance = editor; - CKEDITOR.fire( 'currentInstance' ); - } - }); - - editor.on( 'blur', function() - { - if ( CKEDITOR.currentInstance == editor ) - { - CKEDITOR.currentInstance = null; - CKEDITOR.fire( 'currentInstance' ); - } - }); -}; - -/** - * Removes and editor instance from the global {@link CKEDITOR} object. his function - * is available for internal use mainly. - * @param {CKEDITOR.editor} editor The editor instance to be added. - * @example - */ -CKEDITOR.remove = function( editor ) -{ - delete CKEDITOR.instances[ editor.name ]; -}; - -// Load the bootstrap script. -CKEDITOR.loader.load( 'core/_bootstrap' ); // @Packager.RemoveLine - -// Tri-state constants. - -/** - * Used to indicate the ON or ACTIVE state. - * @constant - * @example - */ -CKEDITOR.TRISTATE_ON = 1; - -/** - * Used to indicate the OFF or NON ACTIVE state. - * @constant - * @example - */ -CKEDITOR.TRISTATE_OFF = 2; - -/** - * Used to indicate DISABLED state. - * @constant - * @example - */ -CKEDITOR.TRISTATE_DISABLED = 0; - -/** - * Fired when the CKEDITOR.currentInstance object reference changes. This may - * happen when setting the focus on different editor instances in the page. - * @name CKEDITOR#currentInstance - * @event - */ diff --git a/public/javascripts/ckeditor/_source/core/ckeditor_base.js b/public/javascripts/ckeditor/_source/core/ckeditor_base.js deleted file mode 100644 index f608e0f..0000000 --- a/public/javascripts/ckeditor/_source/core/ckeditor_base.js +++ /dev/null @@ -1,193 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Contains the first and essential part of the {@link CKEDITOR} - * object definition. - */ - -// #### Compressed Code -// Must be updated on changes in the script, as well as updated in the -// ckeditor_source.js and ckeditor_basic_source.js files. - -// if(!window.CKEDITOR)window.CKEDITOR=(function(){var a={timestamp:'',version:'3.2.1',rev:'5372',_:{},status:'unloaded',basePath:(function(){var d=window.CKEDITOR_BASEPATH||'';if(!d){var e=document.getElementsByTagName('script');for(var f=0;f=0?'&':'?')+('t=')+this.timestamp;return d;}},b=window.CKEDITOR_GETURL;if(b){var c=a.getUrl;a.getUrl=function(d){return b.call(a,d)||c.call(a,d);};}return a;})(); - -// #### Raw code -// ATTENTION: read the above "Compressed Code" notes when changing this code. - -if ( !window.CKEDITOR ) -{ - /** - * This is the API entry point. The entire CKEditor code runs under this object. - * @name CKEDITOR - * @namespace - * @example - */ - window.CKEDITOR = (function() - { - var CKEDITOR = - /** @lends CKEDITOR */ - { - - /** - * A constant string unique for each release of CKEditor. Its value - * is used, by default, to build the URL for all resources loaded - * by the editor code, guaranteing clean cache results when - * upgrading. - * @type String - * @example - * alert( CKEDITOR.timestamp ); // e.g. '87dm' - */ - // The production implementation contains a fixed timestamp, unique - // for each release, generated by the releaser. - // (Base 36 value of each component of YYMMDDHH - 4 chars total - e.g. 87bm == 08071122) - timestamp : 'A39E', - - /** - * Contains the CKEditor version number. - * @type String - * @example - * alert( CKEDITOR.version ); // e.g. 'CKEditor 3.0 Beta' - */ - version : '3.2.1', - - /** - * Contains the CKEditor revision number. - * Revision number is incremented automatically after each modification of CKEditor source code. - * @type String - * @example - * alert( CKEDITOR.revision ); // e.g. '3975' - */ - revision : '5372', - - /** - * Private object used to hold core stuff. It should not be used out of - * the API code as properties defined here may change at any time - * without notice. - * @private - */ - _ : {}, - - /** - * Indicates the API loading status. The following status are available: - *
    - *
  • unloaded: the API is not yet loaded.
  • - *
  • basic_loaded: the basic API features are available.
  • - *
  • basic_ready: the basic API is ready to load the full core code.
  • - *
  • loading: the full API is being loaded.
  • - *
  • ready: the API can be fully used.
  • - *
- * @type String - * @example - * if ( CKEDITOR.status == 'ready' ) - * { - * // The API can now be fully used. - * } - */ - status : 'unloaded', - - /** - * Contains the full URL for the CKEditor installation directory. - * It's possible to manually provide the base path by setting a - * global variable named CKEDITOR_BASEPATH. This global variable - * must be set "before" the editor script loading. - * @type String - * @example - * alert( CKEDITOR.basePath ); // "http://www.example.com/ckeditor/" (e.g.) - */ - basePath : (function() - { - // ATTENTION: fixes on this code must be ported to - // var basePath in "core/loader.js". - - // Find out the editor directory path, based on its ")' ); - } - } - - return $ && new CKEDITOR.dom.document( $.contentWindow.document ); - }, - - /** - * Copy all the attributes from one node to the other, kinda like a clone - * skipAttributes is an object with the attributes that must NOT be copied. - * @param {CKEDITOR.dom.element} dest The destination element. - * @param {Object} skipAttributes A dictionary of attributes to skip. - * @example - */ - copyAttributes : function( dest, skipAttributes ) - { - var attributes = this.$.attributes; - skipAttributes = skipAttributes || {}; - - for ( var n = 0 ; n < attributes.length ; n++ ) - { - var attribute = attributes[n]; - - // Lowercase attribute name hard rule is broken for - // some attribute on IE, e.g. CHECKED. - var attrName = attribute.nodeName.toLowerCase(), - attrValue; - - // We can set the type only once, so do it with the proper value, not copying it. - if ( attrName in skipAttributes ) - continue; - - if ( attrName == 'checked' && ( attrValue = this.getAttribute( attrName ) ) ) - dest.setAttribute( attrName, attrValue ); - // IE BUG: value attribute is never specified even if it exists. - else if ( attribute.specified || - ( CKEDITOR.env.ie && attribute.nodeValue && attrName == 'value' ) ) - { - attrValue = this.getAttribute( attrName ); - if ( attrValue === null ) - attrValue = attribute.nodeValue; - - dest.setAttribute( attrName, attrValue ); - } - } - - // The style: - if ( this.$.style.cssText !== '' ) - dest.$.style.cssText = this.$.style.cssText; - }, - - /** - * Changes the tag name of the current element. - * @param {String} newTag The new tag for the element. - */ - renameNode : function( newTag ) - { - // If it's already correct exit here. - if ( this.getName() == newTag ) - return; - - var doc = this.getDocument(); - - // Create the new node. - var newNode = new CKEDITOR.dom.element( newTag, doc ); - - // Copy all attributes. - this.copyAttributes( newNode ); - - // Move children to the new node. - this.moveChildren( newNode ); - - // Replace the node. - this.$.parentNode.replaceChild( newNode.$, this.$ ); - newNode.$._cke_expando = this.$._cke_expando; - this.$ = newNode.$; - }, - - /** - * Gets a DOM tree descendant under the current node. - * @param {Array|Number} indices The child index or array of child indices under the node. - * @returns {CKEDITOR.dom.node} The specified DOM child under the current node. Null if child does not exist. - * @example - * var strong = p.getChild(0); - */ - getChild : function( indices ) - { - var rawNode = this.$; - - if ( !indices.slice ) - rawNode = rawNode.childNodes[ indices ]; - else - { - while ( indices.length > 0 && rawNode ) - rawNode = rawNode.childNodes[ indices.shift() ]; - } - - return rawNode ? new CKEDITOR.dom.node( rawNode ) : null; - }, - - getChildCount : function() - { - return this.$.childNodes.length; - }, - - disableContextMenu : function() - { - this.on( 'contextmenu', function( event ) - { - // Cancel the browser context menu. - if ( !event.data.getTarget().hasClass( 'cke_enable_context_menu' ) ) - event.data.preventDefault(); - } ); - } - }); diff --git a/public/javascripts/ckeditor/_source/core/dom/elementpath.js b/public/javascripts/ckeditor/_source/core/dom/elementpath.js deleted file mode 100644 index 974685f..0000000 --- a/public/javascripts/ckeditor/_source/core/dom/elementpath.js +++ /dev/null @@ -1,104 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -(function() -{ - // Elements that may be considered the "Block boundary" in an element path. - var pathBlockElements = { address:1,blockquote:1,dl:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1,li:1,dt:1,dd:1 }; - - // Elements that may be considered the "Block limit" in an element path. - var pathBlockLimitElements = { body:1,div:1,table:1,tbody:1,tr:1,td:1,th:1,caption:1,form:1 }; - - // Check if an element contains any block element. - var checkHasBlock = function( element ) - { - var childNodes = element.getChildren(); - - for ( var i = 0, count = childNodes.count() ; i < count ; i++ ) - { - var child = childNodes.getItem( i ); - - if ( child.type == CKEDITOR.NODE_ELEMENT && CKEDITOR.dtd.$block[ child.getName() ] ) - return true; - } - - return false; - }; - - CKEDITOR.dom.elementPath = function( lastNode ) - { - var block = null; - var blockLimit = null; - var elements = []; - - var e = lastNode; - - while ( e ) - { - if ( e.type == CKEDITOR.NODE_ELEMENT ) - { - if ( !this.lastElement ) - this.lastElement = e; - - var elementName = e.getName(); - if ( CKEDITOR.env.ie && e.$.scopeName != 'HTML' ) - elementName = e.$.scopeName.toLowerCase() + ':' + elementName; - - if ( !blockLimit ) - { - if ( !block && pathBlockElements[ elementName ] ) - block = e; - - if ( pathBlockLimitElements[ elementName ] ) - { - // DIV is considered the Block, if no block is available (#525) - // and if it doesn't contain other blocks. - if ( !block && elementName == 'div' && !checkHasBlock( e ) ) - block = e; - else - blockLimit = e; - } - } - - elements.push( e ); - - if ( elementName == 'body' ) - break; - } - e = e.getParent(); - } - - this.block = block; - this.blockLimit = blockLimit; - this.elements = elements; - }; -})(); - -CKEDITOR.dom.elementPath.prototype = -{ - /** - * Compares this element path with another one. - * @param {CKEDITOR.dom.elementPath} otherPath The elementPath object to be - * compared with this one. - * @returns {Boolean} "true" if the paths are equal, containing the same - * number of elements and the same elements in the same order. - */ - compare : function( otherPath ) - { - var thisElements = this.elements; - var otherElements = otherPath && otherPath.elements; - - if ( !otherElements || thisElements.length != otherElements.length ) - return false; - - for ( var i = 0 ; i < thisElements.length ; i++ ) - { - if ( !thisElements[ i ].equals( otherElements[ i ] ) ) - return false; - } - - return true; - } -}; diff --git a/public/javascripts/ckeditor/_source/core/dom/event.js b/public/javascripts/ckeditor/_source/core/dom/event.js deleted file mode 100644 index cf7d66c..0000000 --- a/public/javascripts/ckeditor/_source/core/dom/event.js +++ /dev/null @@ -1,142 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Defines the {@link CKEDITOR.dom.event} class, which - * represents the a native DOM event object. - */ - -/** - * Represents a native DOM event object. - * @constructor - * @param {Object} domEvent A native DOM event object. - * @example - */ -CKEDITOR.dom.event = function( domEvent ) -{ - /** - * The native DOM event object represented by this class instance. - * @type Object - * @example - */ - this.$ = domEvent; -}; - -CKEDITOR.dom.event.prototype = -{ - /** - * Gets the key code associated to the event. - * @returns {Number} The key code. - * @example - * alert( event.getKey() ); "65" is "a" has been pressed - */ - getKey : function() - { - return this.$.keyCode || this.$.which; - }, - - /** - * Gets a number represeting the combination of the keys pressed during the - * event. It is the sum with the current key code and the {@link CKEDITOR.CTRL}, - * {@link CKEDITOR.SHIFT} and {@link CKEDITOR.ALT} constants. - * @returns {Number} The number representing the keys combination. - * @example - * alert( event.getKeystroke() == 65 ); // "a" key - * alert( event.getKeystroke() == CKEDITOR.CTRL + 65 ); // CTRL + "a" key - * alert( event.getKeystroke() == CKEDITOR.CTRL + CKEDITOR.SHIFT + 65 ); // CTRL + SHIFT + "a" key - */ - getKeystroke : function() - { - var keystroke = this.getKey(); - - if ( this.$.ctrlKey || this.$.metaKey ) - keystroke += CKEDITOR.CTRL; - - if ( this.$.shiftKey ) - keystroke += CKEDITOR.SHIFT; - - if ( this.$.altKey ) - keystroke += CKEDITOR.ALT; - - return keystroke; - }, - - /** - * Prevents the original behavior of the event to happen. It can optionally - * stop propagating the event in the event chain. - * @param {Boolean} [stopPropagation] Stop propagating this event in the - * event chain. - * @example - * var element = CKEDITOR.document.getById( 'myElement' ); - * element.on( 'click', function( ev ) - * { - * // The DOM event object is passed by the "data" property. - * var domEvent = ev.data; - * // Prevent the click to chave any effect in the element. - * domEvent.preventDefault(); - * }); - */ - preventDefault : function( stopPropagation ) - { - var $ = this.$; - if ( $.preventDefault ) - $.preventDefault(); - else - $.returnValue = false; - - if ( stopPropagation ) - this.stopPropagation(); - }, - - stopPropagation : function() - { - var $ = this.$; - if ( $.stopPropagation ) - $.stopPropagation(); - else - $.cancelBubble = true; - }, - - /** - * Returns the DOM node where the event was targeted to. - * @returns {CKEDITOR.dom.node} The target DOM node. - * @example - * var element = CKEDITOR.document.getById( 'myElement' ); - * element.on( 'click', function( ev ) - * { - * // The DOM event object is passed by the "data" property. - * var domEvent = ev.data; - * // Add a CSS class to the event target. - * domEvent.getTarget().addClass( 'clicked' ); - * }); - */ - - getTarget : function() - { - var rawNode = this.$.target || this.$.srcElement; - return rawNode ? new CKEDITOR.dom.node( rawNode ) : null; - } -}; - -/** - * CTRL key (1000). - * @constant - * @example - */ -CKEDITOR.CTRL = 1000; - -/** - * SHIFT key (2000). - * @constant - * @example - */ -CKEDITOR.SHIFT = 2000; - -/** - * ALT key (4000). - * @constant - * @example - */ -CKEDITOR.ALT = 4000; diff --git a/public/javascripts/ckeditor/_source/core/dom/node.js b/public/javascripts/ckeditor/_source/core/dom/node.js deleted file mode 100644 index 2ae3a13..0000000 --- a/public/javascripts/ckeditor/_source/core/dom/node.js +++ /dev/null @@ -1,662 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Defines the {@link CKEDITOR.dom.node} class, which is the base - * class for classes that represent DOM nodes. - */ - -/** - * Base class for classes representing DOM nodes. This constructor may return - * and instance of classes that inherits this class, like - * {@link CKEDITOR.dom.element} or {@link CKEDITOR.dom.text}. - * @augments CKEDITOR.dom.domObject - * @param {Object} domNode A native DOM node. - * @constructor - * @see CKEDITOR.dom.element - * @see CKEDITOR.dom.text - * @example - */ -CKEDITOR.dom.node = function( domNode ) -{ - if ( domNode ) - { - switch ( domNode.nodeType ) - { - // Safari don't consider document as element node type. (#3389) - case CKEDITOR.NODE_DOCUMENT : - return new CKEDITOR.dom.document( domNode ); - - case CKEDITOR.NODE_ELEMENT : - return new CKEDITOR.dom.element( domNode ); - - case CKEDITOR.NODE_TEXT : - return new CKEDITOR.dom.text( domNode ); - } - - // Call the base constructor. - CKEDITOR.dom.domObject.call( this, domNode ); - } - - return this; -}; - -CKEDITOR.dom.node.prototype = new CKEDITOR.dom.domObject(); - -/** - * Element node type. - * @constant - * @example - */ -CKEDITOR.NODE_ELEMENT = 1; - -/** - * Document node type. - * @constant - * @example - */ -CKEDITOR.NODE_DOCUMENT = 9; - -/** - * Text node type. - * @constant - * @example - */ -CKEDITOR.NODE_TEXT = 3; - -/** - * Comment node type. - * @constant - * @example - */ -CKEDITOR.NODE_COMMENT = 8; - -CKEDITOR.NODE_DOCUMENT_FRAGMENT = 11; - -CKEDITOR.POSITION_IDENTICAL = 0; -CKEDITOR.POSITION_DISCONNECTED = 1; -CKEDITOR.POSITION_FOLLOWING = 2; -CKEDITOR.POSITION_PRECEDING = 4; -CKEDITOR.POSITION_IS_CONTAINED = 8; -CKEDITOR.POSITION_CONTAINS = 16; - -CKEDITOR.tools.extend( CKEDITOR.dom.node.prototype, - /** @lends CKEDITOR.dom.node.prototype */ - { - /** - * Makes this node child of another element. - * @param {CKEDITOR.dom.element} element The target element to which append - * this node. - * @returns {CKEDITOR.dom.element} The target element. - * @example - * var p = new CKEDITOR.dom.element( 'p' ); - * var strong = new CKEDITOR.dom.element( 'strong' ); - * strong.appendTo( p ); - * - * // result: "<p><strong></strong></p>" - */ - appendTo : function( element, toStart ) - { - element.append( this, toStart ); - return element; - }, - - clone : function( includeChildren, cloneId ) - { - var $clone = this.$.cloneNode( includeChildren ); - - if ( !cloneId ) - { - var removeIds = function( node ) - { - if ( node.nodeType != CKEDITOR.NODE_ELEMENT ) - return; - - node.removeAttribute( 'id', false ) ; - node.removeAttribute( '_cke_expando', false ) ; - - var childs = node.childNodes; - for ( var i=0 ; i < childs.length ; i++ ) - removeIds( childs[ i ] ); - }; - - // The "id" attribute should never be cloned to avoid duplication. - removeIds( $clone ); - } - - return new CKEDITOR.dom.node( $clone ); - }, - - hasPrevious : function() - { - return !!this.$.previousSibling; - }, - - hasNext : function() - { - return !!this.$.nextSibling; - }, - - /** - * Inserts this element after a node. - * @param {CKEDITOR.dom.node} node The that will preceed this element. - * @returns {CKEDITOR.dom.node} The node preceeding this one after - * insertion. - * @example - * var em = new CKEDITOR.dom.element( 'em' ); - * var strong = new CKEDITOR.dom.element( 'strong' ); - * strong.insertAfter( em ); - * - * // result: "<em></em><strong></strong>" - */ - insertAfter : function( node ) - { - node.$.parentNode.insertBefore( this.$, node.$.nextSibling ); - return node; - }, - - /** - * Inserts this element before a node. - * @param {CKEDITOR.dom.node} node The that will be after this element. - * @returns {CKEDITOR.dom.node} The node being inserted. - * @example - * var em = new CKEDITOR.dom.element( 'em' ); - * var strong = new CKEDITOR.dom.element( 'strong' ); - * strong.insertBefore( em ); - * - * // result: "<strong></strong><em></em>" - */ - insertBefore : function( node ) - { - node.$.parentNode.insertBefore( this.$, node.$ ); - return node; - }, - - insertBeforeMe : function( node ) - { - this.$.parentNode.insertBefore( node.$, this.$ ); - return node; - }, - - /** - * Retrieves a uniquely identifiable tree address for this node. - * The tree address returns is an array of integers, with each integer - * indicating a child index of a DOM node, starting from - * document.documentElement. - * - * For example, assuming is the second child from ( - * being the first), and we'd like to address the third child under the - * fourth child of body, the tree address returned would be: - * [1, 3, 2] - * - * The tree address cannot be used for finding back the DOM tree node once - * the DOM tree structure has been modified. - */ - getAddress : function( normalized ) - { - var address = []; - var $documentElement = this.getDocument().$.documentElement; - var node = this.$; - - while ( node && node != $documentElement ) - { - var parentNode = node.parentNode; - var currentIndex = -1; - - if ( parentNode ) - { - for ( var i = 0 ; i < parentNode.childNodes.length ; i++ ) - { - var candidate = parentNode.childNodes[i]; - - if ( normalized && - candidate.nodeType == 3 && - candidate.previousSibling && - candidate.previousSibling.nodeType == 3 ) - { - continue; - } - - currentIndex++; - - if ( candidate == node ) - break; - } - - address.unshift( currentIndex ); - } - - node = parentNode; - } - - return address; - }, - - /** - * Gets the document containing this element. - * @returns {CKEDITOR.dom.document} The document. - * @example - * var element = CKEDITOR.document.getById( 'example' ); - * alert( element.getDocument().equals( CKEDITOR.document ) ); // "true" - */ - getDocument : function() - { - var document = new CKEDITOR.dom.document( this.$.ownerDocument || this.$.parentNode.ownerDocument ); - - return ( - this.getDocument = function() - { - return document; - })(); - }, - - getIndex : function() - { - var $ = this.$; - - var currentNode = $.parentNode && $.parentNode.firstChild; - var currentIndex = -1; - - while ( currentNode ) - { - currentIndex++; - - if ( currentNode == $ ) - return currentIndex; - - currentNode = currentNode.nextSibling; - } - - return -1; - }, - - getNextSourceNode : function( startFromSibling, nodeType, guard ) - { - // If "guard" is a node, transform it in a function. - if ( guard && !guard.call ) - { - var guardNode = guard; - guard = function( node ) - { - return !node.equals( guardNode ); - }; - } - - var node = ( !startFromSibling && this.getFirst && this.getFirst() ), - parent; - - // Guarding when we're skipping the current element( no children or 'startFromSibling' ). - // send the 'moving out' signal even we don't actually dive into. - if ( !node ) - { - if ( this.type == CKEDITOR.NODE_ELEMENT && guard && guard( this, true ) === false ) - return null; - node = this.getNext(); - } - - while ( !node && ( parent = ( parent || this ).getParent() ) ) - { - // The guard check sends the "true" paramenter to indicate that - // we are moving "out" of the element. - if ( guard && guard( parent, true ) === false ) - return null; - - node = parent.getNext(); - } - - if ( !node ) - return null; - - if ( guard && guard( node ) === false ) - return null; - - if ( nodeType && nodeType != node.type ) - return node.getNextSourceNode( false, nodeType, guard ); - - return node; - }, - - getPreviousSourceNode : function( startFromSibling, nodeType, guard ) - { - if ( guard && !guard.call ) - { - var guardNode = guard; - guard = function( node ) - { - return !node.equals( guardNode ); - }; - } - - var node = ( !startFromSibling && this.getLast && this.getLast() ), - parent; - - // Guarding when we're skipping the current element( no children or 'startFromSibling' ). - // send the 'moving out' signal even we don't actually dive into. - if ( !node ) - { - if ( this.type == CKEDITOR.NODE_ELEMENT && guard && guard( this, true ) === false ) - return null; - node = this.getPrevious(); - } - - while ( !node && ( parent = ( parent || this ).getParent() ) ) - { - // The guard check sends the "true" paramenter to indicate that - // we are moving "out" of the element. - if ( guard && guard( parent, true ) === false ) - return null; - - node = parent.getPrevious(); - } - - if ( !node ) - return null; - - if ( guard && guard( node ) === false ) - return null; - - if ( nodeType && node.type != nodeType ) - return node.getPreviousSourceNode( false, nodeType, guard ); - - return node; - }, - - getPrevious : function( evaluator ) - { - var previous = this.$, retval; - do - { - previous = previous.previousSibling; - retval = previous && new CKEDITOR.dom.node( previous ); - } - while ( retval && evaluator && !evaluator( retval ) ) - return retval; - }, - - /** - * Gets the node that follows this element in its parent's child list. - * @param {Function} evaluator Filtering the result node. - * @returns {CKEDITOR.dom.node} The next node or null if not available. - * @example - * var element = CKEDITOR.dom.element.createFromHtml( '<div><b>Example</b> <i>next</i></div>' ); - * var first = element.getFirst().getNext(); - * alert( first.getName() ); // "i" - */ - getNext : function( evaluator ) - { - var next = this.$, retval; - do - { - next = next.nextSibling; - retval = next && new CKEDITOR.dom.node( next ); - } - while ( retval && evaluator && !evaluator( retval ) ) - return retval; - }, - - /** - * Gets the parent element for this node. - * @returns {CKEDITOR.dom.element} The parent element. - * @example - * var node = editor.document.getBody().getFirst(); - * var parent = node.getParent(); - * alert( node.getName() ); // "body" - */ - getParent : function() - { - var parent = this.$.parentNode; - return ( parent && parent.nodeType == 1 ) ? new CKEDITOR.dom.node( parent ) : null; - }, - - getParents : function( closerFirst ) - { - var node = this; - var parents = []; - - do - { - parents[ closerFirst ? 'push' : 'unshift' ]( node ); - } - while ( ( node = node.getParent() ) ) - - return parents; - }, - - getCommonAncestor : function( node ) - { - if ( node.equals( this ) ) - return this; - - if ( node.contains && node.contains( this ) ) - return node; - - var start = this.contains ? this : this.getParent(); - - do - { - if ( start.contains( node ) ) - return start; - } - while ( ( start = start.getParent() ) ); - - return null; - }, - - getPosition : function( otherNode ) - { - var $ = this.$; - var $other = otherNode.$; - - if ( $.compareDocumentPosition ) - return $.compareDocumentPosition( $other ); - - // IE and Safari have no support for compareDocumentPosition. - - if ( $ == $other ) - return CKEDITOR.POSITION_IDENTICAL; - - // Only element nodes support contains and sourceIndex. - if ( this.type == CKEDITOR.NODE_ELEMENT && otherNode.type == CKEDITOR.NODE_ELEMENT ) - { - if ( $.contains ) - { - if ( $.contains( $other ) ) - return CKEDITOR.POSITION_CONTAINS + CKEDITOR.POSITION_PRECEDING; - - if ( $other.contains( $ ) ) - return CKEDITOR.POSITION_IS_CONTAINED + CKEDITOR.POSITION_FOLLOWING; - } - - if ( 'sourceIndex' in $ ) - { - return ( $.sourceIndex < 0 || $other.sourceIndex < 0 ) ? CKEDITOR.POSITION_DISCONNECTED : - ( $.sourceIndex < $other.sourceIndex ) ? CKEDITOR.POSITION_PRECEDING : - CKEDITOR.POSITION_FOLLOWING; - } - } - - // For nodes that don't support compareDocumentPosition, contains - // or sourceIndex, their "address" is compared. - - var addressOfThis = this.getAddress(), - addressOfOther = otherNode.getAddress(), - minLevel = Math.min( addressOfThis.length, addressOfOther.length ); - - // Determinate preceed/follow relationship. - for ( var i = 0 ; i <= minLevel - 1 ; i++ ) - { - if ( addressOfThis[ i ] != addressOfOther[ i ] ) - { - if ( i < minLevel ) - { - return addressOfThis[ i ] < addressOfOther[ i ] ? - CKEDITOR.POSITION_PRECEDING : CKEDITOR.POSITION_FOLLOWING; - } - break; - } - } - - // Determinate contains/contained relationship. - return ( addressOfThis.length < addressOfOther.length ) ? - CKEDITOR.POSITION_CONTAINS + CKEDITOR.POSITION_PRECEDING : - CKEDITOR.POSITION_IS_CONTAINED + CKEDITOR.POSITION_FOLLOWING; - }, - - /** - * Gets the closes ancestor node of a specified node name. - * @param {String} name Node name of ancestor node. - * @param {Boolean} includeSelf (Optional) Whether to include the current - * node in the calculation or not. - * @returns {CKEDITOR.dom.node} Ancestor node. - */ - getAscendant : function( name, includeSelf ) - { - var $ = this.$; - - if ( !includeSelf ) - $ = $.parentNode; - - while ( $ ) - { - if ( $.nodeName && $.nodeName.toLowerCase() == name ) - return new CKEDITOR.dom.node( $ ); - - $ = $.parentNode; - } - return null; - }, - - hasAscendant : function( name, includeSelf ) - { - var $ = this.$; - - if ( !includeSelf ) - $ = $.parentNode; - - while ( $ ) - { - if ( $.nodeName && $.nodeName.toLowerCase() == name ) - return true; - - $ = $.parentNode; - } - return false; - }, - - move : function( target, toStart ) - { - target.append( this.remove(), toStart ); - }, - - /** - * Removes this node from the document DOM. - * @param {Boolean} [preserveChildren] Indicates that the children - * elements must remain in the document, removing only the outer - * tags. - * @example - * var element = CKEDITOR.dom.element.getById( 'MyElement' ); - * element.remove(); - */ - remove : function( preserveChildren ) - { - var $ = this.$; - var parent = $.parentNode; - - if ( parent ) - { - if ( preserveChildren ) - { - // Move all children before the node. - for ( var child ; ( child = $.firstChild ) ; ) - { - parent.insertBefore( $.removeChild( child ), $ ); - } - } - - parent.removeChild( $ ); - } - - return this; - }, - - replace : function( nodeToReplace ) - { - this.insertBefore( nodeToReplace ); - nodeToReplace.remove(); - }, - - trim : function() - { - this.ltrim(); - this.rtrim(); - }, - - ltrim : function() - { - var child; - while ( this.getFirst && ( child = this.getFirst() ) ) - { - if ( child.type == CKEDITOR.NODE_TEXT ) - { - var trimmed = CKEDITOR.tools.ltrim( child.getText() ), - originalLength = child.getLength(); - - if ( !trimmed ) - { - child.remove(); - continue; - } - else if ( trimmed.length < originalLength ) - { - child.split( originalLength - trimmed.length ); - - // IE BUG: child.remove() may raise JavaScript errors here. (#81) - this.$.removeChild( this.$.firstChild ); - } - } - break; - } - }, - - rtrim : function() - { - var child; - while ( this.getLast && ( child = this.getLast() ) ) - { - if ( child.type == CKEDITOR.NODE_TEXT ) - { - var trimmed = CKEDITOR.tools.rtrim( child.getText() ), - originalLength = child.getLength(); - - if ( !trimmed ) - { - child.remove(); - continue; - } - else if ( trimmed.length < originalLength ) - { - child.split( trimmed.length ); - - // IE BUG: child.getNext().remove() may raise JavaScript errors here. - // (#81) - this.$.lastChild.parentNode.removeChild( this.$.lastChild ); - } - } - break; - } - - if ( !CKEDITOR.env.ie && !CKEDITOR.env.opera ) - { - child = this.$.lastChild; - - if ( child && child.type == 1 && child.nodeName.toLowerCase() == 'br' ) - { - // Use "eChildNode.parentNode" instead of "node" to avoid IE bug (#324). - child.parentNode.removeChild( child ) ; - } - } - } - } -); diff --git a/public/javascripts/ckeditor/_source/core/dom/nodelist.js b/public/javascripts/ckeditor/_source/core/dom/nodelist.js deleted file mode 100644 index 7e82ba1..0000000 --- a/public/javascripts/ckeditor/_source/core/dom/nodelist.js +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -CKEDITOR.dom.nodeList = function( nativeList ) -{ - this.$ = nativeList; -}; - -CKEDITOR.dom.nodeList.prototype = -{ - count : function() - { - return this.$.length; - }, - - getItem : function( index ) - { - var $node = this.$[ index ]; - return $node ? new CKEDITOR.dom.node( $node ) : null; - } -}; diff --git a/public/javascripts/ckeditor/_source/core/dom/range.js b/public/javascripts/ckeditor/_source/core/dom/range.js deleted file mode 100644 index 127f7aa..0000000 --- a/public/javascripts/ckeditor/_source/core/dom/range.js +++ /dev/null @@ -1,1836 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -CKEDITOR.dom.range = function( document ) -{ - this.startContainer = null; - this.startOffset = null; - this.endContainer = null; - this.endOffset = null; - this.collapsed = true; - - this.document = document; -}; - -(function() -{ - // Updates the "collapsed" property for the given range object. - var updateCollapsed = function( range ) - { - range.collapsed = ( - range.startContainer && - range.endContainer && - range.startContainer.equals( range.endContainer ) && - range.startOffset == range.endOffset ); - }; - - // This is a shared function used to delete, extract and clone the range - // contents. - // V2 - var execContentsAction = function( range, action, docFrag ) - { - range.optimizeBookmark(); - - var startNode = range.startContainer; - var endNode = range.endContainer; - - var startOffset = range.startOffset; - var endOffset = range.endOffset; - - var removeStartNode; - var removeEndNode; - - // For text containers, we must simply split the node and point to the - // second part. The removal will be handled by the rest of the code . - if ( endNode.type == CKEDITOR.NODE_TEXT ) - endNode = endNode.split( endOffset ); - else - { - // If the end container has children and the offset is pointing - // to a child, then we should start from it. - if ( endNode.getChildCount() > 0 ) - { - // If the offset points after the last node. - if ( endOffset >= endNode.getChildCount() ) - { - // Let's create a temporary node and mark it for removal. - endNode = endNode.append( range.document.createText( '' ) ); - removeEndNode = true; - } - else - endNode = endNode.getChild( endOffset ); - } - } - - // For text containers, we must simply split the node. The removal will - // be handled by the rest of the code . - if ( startNode.type == CKEDITOR.NODE_TEXT ) - { - startNode.split( startOffset ); - - // In cases the end node is the same as the start node, the above - // splitting will also split the end, so me must move the end to - // the second part of the split. - if ( startNode.equals( endNode ) ) - endNode = startNode.getNext(); - } - else - { - // If the start container has children and the offset is pointing - // to a child, then we should start from its previous sibling. - - // If the offset points to the first node, we don't have a - // sibling, so let's use the first one, but mark it for removal. - if ( !startOffset ) - { - // Let's create a temporary node and mark it for removal. - startNode = startNode.getFirst().insertBeforeMe( range.document.createText( '' ) ); - removeStartNode = true; - } - else if ( startOffset >= startNode.getChildCount() ) - { - // Let's create a temporary node and mark it for removal. - startNode = startNode.append( range.document.createText( '' ) ); - removeStartNode = true; - } - else - startNode = startNode.getChild( startOffset ).getPrevious(); - } - - // Get the parent nodes tree for the start and end boundaries. - var startParents = startNode.getParents(); - var endParents = endNode.getParents(); - - // Compare them, to find the top most siblings. - var i, topStart, topEnd; - - for ( i = 0 ; i < startParents.length ; i++ ) - { - topStart = startParents[ i ]; - topEnd = endParents[ i ]; - - // The compared nodes will match until we find the top most - // siblings (different nodes that have the same parent). - // "i" will hold the index in the parents array for the top - // most element. - if ( !topStart.equals( topEnd ) ) - break; - } - - var clone = docFrag, levelStartNode, levelClone, currentNode, currentSibling; - - // Remove all successive sibling nodes for every node in the - // startParents tree. - for ( var j = i ; j < startParents.length ; j++ ) - { - levelStartNode = startParents[j]; - - // For Extract and Clone, we must clone this level. - if ( clone && !levelStartNode.equals( startNode ) ) // action = 0 = Delete - levelClone = clone.append( levelStartNode.clone() ); - - currentNode = levelStartNode.getNext(); - - while ( currentNode ) - { - // Stop processing when the current node matches a node in the - // endParents tree or if it is the endNode. - if ( currentNode.equals( endParents[ j ] ) || currentNode.equals( endNode ) ) - break; - - // Cache the next sibling. - currentSibling = currentNode.getNext(); - - // If cloning, just clone it. - if ( action == 2 ) // 2 = Clone - clone.append( currentNode.clone( true ) ); - else - { - // Both Delete and Extract will remove the node. - currentNode.remove(); - - // When Extracting, move the removed node to the docFrag. - if ( action == 1 ) // 1 = Extract - clone.append( currentNode ); - } - - currentNode = currentSibling; - } - - if ( clone ) - clone = levelClone; - } - - clone = docFrag; - - // Remove all previous sibling nodes for every node in the - // endParents tree. - for ( var k = i ; k < endParents.length ; k++ ) - { - levelStartNode = endParents[ k ]; - - // For Extract and Clone, we must clone this level. - if ( action > 0 && !levelStartNode.equals( endNode ) ) // action = 0 = Delete - levelClone = clone.append( levelStartNode.clone() ); - - // The processing of siblings may have already been done by the parent. - if ( !startParents[ k ] || levelStartNode.$.parentNode != startParents[ k ].$.parentNode ) - { - currentNode = levelStartNode.getPrevious(); - - while ( currentNode ) - { - // Stop processing when the current node matches a node in the - // startParents tree or if it is the startNode. - if ( currentNode.equals( startParents[ k ] ) || currentNode.equals( startNode ) ) - break; - - // Cache the next sibling. - currentSibling = currentNode.getPrevious(); - - // If cloning, just clone it. - if ( action == 2 ) // 2 = Clone - clone.$.insertBefore( currentNode.$.cloneNode( true ), clone.$.firstChild ) ; - else - { - // Both Delete and Extract will remove the node. - currentNode.remove(); - - // When Extracting, mode the removed node to the docFrag. - if ( action == 1 ) // 1 = Extract - clone.$.insertBefore( currentNode.$, clone.$.firstChild ); - } - - currentNode = currentSibling; - } - } - - if ( clone ) - clone = levelClone; - } - - if ( action == 2 ) // 2 = Clone. - { - // No changes in the DOM should be done, so fix the split text (if any). - - var startTextNode = range.startContainer; - if ( startTextNode.type == CKEDITOR.NODE_TEXT ) - { - startTextNode.$.data += startTextNode.$.nextSibling.data; - startTextNode.$.parentNode.removeChild( startTextNode.$.nextSibling ); - } - - var endTextNode = range.endContainer; - if ( endTextNode.type == CKEDITOR.NODE_TEXT && endTextNode.$.nextSibling ) - { - endTextNode.$.data += endTextNode.$.nextSibling.data; - endTextNode.$.parentNode.removeChild( endTextNode.$.nextSibling ); - } - } - else - { - // Collapse the range. - - // If a node has been partially selected, collapse the range between - // topStart and topEnd. Otherwise, simply collapse it to the start. (W3C specs). - if ( topStart && topEnd && ( startNode.$.parentNode != topStart.$.parentNode || endNode.$.parentNode != topEnd.$.parentNode ) ) - { - var endIndex = topEnd.getIndex(); - - // If the start node is to be removed, we must correct the - // index to reflect the removal. - if ( removeStartNode && topEnd.$.parentNode == startNode.$.parentNode ) - endIndex--; - - range.setStart( topEnd.getParent(), endIndex ); - } - - // Collapse it to the start. - range.collapse( true ); - } - - // Cleanup any marked node. - if ( removeStartNode ) - startNode.remove(); - - if ( removeEndNode && endNode.$.parentNode ) - endNode.remove(); - }; - - var inlineChildReqElements = { abbr:1,acronym:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1 }; - - // Creates the appropriate node evaluator for the dom walker used inside - // check(Start|End)OfBlock. - function getCheckStartEndBlockEvalFunction( isStart ) - { - var hadBr = false, bookmarkEvaluator = CKEDITOR.dom.walker.bookmark( true ); - return function( node ) - { - // First ignore bookmark nodes. - if ( bookmarkEvaluator( node ) ) - return true; - - if ( node.type == CKEDITOR.NODE_TEXT ) - { - // If there's any visible text, then we're not at the start. - if ( CKEDITOR.tools.trim( node.getText() ).length ) - return false; - } - else if ( node.type == CKEDITOR.NODE_ELEMENT ) - { - // If there are non-empty inline elements (e.g. ), then we're not - // at the start. - if ( !inlineChildReqElements[ node.getName() ] ) - { - // If we're working at the end-of-block, forgive the first
in non-IE - // browsers. - if ( !isStart && !CKEDITOR.env.ie && node.getName() == 'br' && !hadBr ) - hadBr = true; - else - return false; - } - } - return true; - }; - } - - // Evaluator for CKEDITOR.dom.element::checkBoundaryOfElement, reject any - // text node and non-empty elements unless it's being bookmark text. - function elementBoundaryEval( node ) - { - // Reject any text node unless it's being bookmark - // OR it's spaces. (#3883) - return node.type != CKEDITOR.NODE_TEXT - && node.getName() in CKEDITOR.dtd.$removeEmpty - || !CKEDITOR.tools.trim( node.getText() ) - || node.getParent().hasAttribute( '_fck_bookmark' ); - } - - var whitespaceEval = new CKEDITOR.dom.walker.whitespaces(), - bookmarkEval = new CKEDITOR.dom.walker.bookmark(); - - function nonWhitespaceOrBookmarkEval( node ) - { - // Whitespaces and bookmark nodes are to be ignored. - return !whitespaceEval( node ) && !bookmarkEval( node ); - } - - CKEDITOR.dom.range.prototype = - { - clone : function() - { - var clone = new CKEDITOR.dom.range( this.document ); - - clone.startContainer = this.startContainer; - clone.startOffset = this.startOffset; - clone.endContainer = this.endContainer; - clone.endOffset = this.endOffset; - clone.collapsed = this.collapsed; - - return clone; - }, - - collapse : function( toStart ) - { - if ( toStart ) - { - this.endContainer = this.startContainer; - this.endOffset = this.startOffset; - } - else - { - this.startContainer = this.endContainer; - this.startOffset = this.endOffset; - } - - this.collapsed = true; - }, - - // The selection may be lost when cloning (due to the splitText() call). - cloneContents : function() - { - var docFrag = new CKEDITOR.dom.documentFragment( this.document ); - - if ( !this.collapsed ) - execContentsAction( this, 2, docFrag ); - - return docFrag; - }, - - deleteContents : function() - { - if ( this.collapsed ) - return; - - execContentsAction( this, 0 ); - }, - - extractContents : function() - { - var docFrag = new CKEDITOR.dom.documentFragment( this.document ); - - if ( !this.collapsed ) - execContentsAction( this, 1, docFrag ); - - return docFrag; - }, - - /** - * Creates a bookmark object, which can be later used to restore the - * range by using the moveToBookmark function. - * This is an "intrusive" way to create a bookmark. It includes tags - * in the range boundaries. The advantage of it is that it is possible to - * handle DOM mutations when moving back to the bookmark. - * Attention: the inclusion of nodes in the DOM is a design choice and - * should not be changed as there are other points in the code that may be - * using those nodes to perform operations. See GetBookmarkNode. - * @param {Boolean} [serializable] Indicates that the bookmark nodes - * must contain ids, which can be used to restore the range even - * when these nodes suffer mutations (like a clonation or innerHTML - * change). - * @returns {Object} And object representing a bookmark. - */ - createBookmark : function( serializable ) - { - var startNode, endNode; - var baseId; - var clone; - - startNode = this.document.createElement( 'span' ); - startNode.setAttribute( '_fck_bookmark', 1 ); - startNode.setStyle( 'display', 'none' ); - - // For IE, it must have something inside, otherwise it may be - // removed during DOM operations. - startNode.setHtml( ' ' ); - - if ( serializable ) - { - baseId = 'cke_bm_' + CKEDITOR.tools.getNextNumber(); - startNode.setAttribute( 'id', baseId + 'S' ); - } - - // If collapsed, the endNode will not be created. - if ( !this.collapsed ) - { - endNode = startNode.clone(); - endNode.setHtml( ' ' ); - - if ( serializable ) - endNode.setAttribute( 'id', baseId + 'E' ); - - clone = this.clone(); - clone.collapse(); - clone.insertNode( endNode ); - } - - clone = this.clone(); - clone.collapse( true ); - clone.insertNode( startNode ); - - // Update the range position. - if ( endNode ) - { - this.setStartAfter( startNode ); - this.setEndBefore( endNode ); - } - else - this.moveToPosition( startNode, CKEDITOR.POSITION_AFTER_END ); - - return { - startNode : serializable ? baseId + 'S' : startNode, - endNode : serializable ? baseId + 'E' : endNode, - serializable : serializable - }; - }, - - /** - * Creates a "non intrusive" and "mutation sensible" bookmark. This - * kind of bookmark should be used only when the DOM is supposed to - * remain stable after its creation. - * @param {Boolean} [normalized] Indicates that the bookmark must - * normalized. When normalized, the successive text nodes are - * considered a single node. To sucessful load a normalized - * bookmark, the DOM tree must be also normalized before calling - * moveToBookmark. - * @returns {Object} An object representing the bookmark. - */ - createBookmark2 : function( normalized ) - { - var startContainer = this.startContainer, - endContainer = this.endContainer; - - var startOffset = this.startOffset, - endOffset = this.endOffset; - - var child, previous; - - // If there is no range then get out of here. - // It happens on initial load in Safari #962 and if the editor it's - // hidden also in Firefox - if ( !startContainer || !endContainer ) - return { start : 0, end : 0 }; - - if ( normalized ) - { - // Find out if the start is pointing to a text node that will - // be normalized. - if ( startContainer.type == CKEDITOR.NODE_ELEMENT ) - { - child = startContainer.getChild( startOffset ); - - // In this case, move the start information to that text - // node. - if ( child && child.type == CKEDITOR.NODE_TEXT - && startOffset > 0 && child.getPrevious().type == CKEDITOR.NODE_TEXT ) - { - startContainer = child; - startOffset = 0; - } - } - - // Normalize the start. - while ( startContainer.type == CKEDITOR.NODE_TEXT - && ( previous = startContainer.getPrevious() ) - && previous.type == CKEDITOR.NODE_TEXT ) - { - startContainer = previous; - startOffset += previous.getLength(); - } - - // Process the end only if not normalized. - if ( !this.isCollapsed ) - { - // Find out if the start is pointing to a text node that - // will be normalized. - if ( endContainer.type == CKEDITOR.NODE_ELEMENT ) - { - child = endContainer.getChild( endOffset ); - - // In this case, move the start information to that - // text node. - if ( child && child.type == CKEDITOR.NODE_TEXT - && endOffset > 0 && child.getPrevious().type == CKEDITOR.NODE_TEXT ) - { - endContainer = child; - endOffset = 0; - } - } - - // Normalize the end. - while ( endContainer.type == CKEDITOR.NODE_TEXT - && ( previous = endContainer.getPrevious() ) - && previous.type == CKEDITOR.NODE_TEXT ) - { - endContainer = previous; - endOffset += previous.getLength(); - } - } - } - - return { - start : startContainer.getAddress( normalized ), - end : this.isCollapsed ? null : endContainer.getAddress( normalized ), - startOffset : startOffset, - endOffset : endOffset, - normalized : normalized, - is2 : true // It's a createBookmark2 bookmark. - }; - }, - - moveToBookmark : function( bookmark ) - { - if ( bookmark.is2 ) // Created with createBookmark2(). - { - // Get the start information. - var startContainer = this.document.getByAddress( bookmark.start, bookmark.normalized ), - startOffset = bookmark.startOffset; - - // Get the end information. - var endContainer = bookmark.end && this.document.getByAddress( bookmark.end, bookmark.normalized ), - endOffset = bookmark.endOffset; - - // Set the start boundary. - this.setStart( startContainer, startOffset ); - - // Set the end boundary. If not available, collapse it. - if ( endContainer ) - this.setEnd( endContainer, endOffset ); - else - this.collapse( true ); - } - else // Created with createBookmark(). - { - var serializable = bookmark.serializable, - startNode = serializable ? this.document.getById( bookmark.startNode ) : bookmark.startNode, - endNode = serializable ? this.document.getById( bookmark.endNode ) : bookmark.endNode; - - // Set the range start at the bookmark start node position. - this.setStartBefore( startNode ); - - // Remove it, because it may interfere in the setEndBefore call. - startNode.remove(); - - // Set the range end at the bookmark end node position, or simply - // collapse it if it is not available. - if ( endNode ) - { - this.setEndBefore( endNode ); - endNode.remove(); - } - else - this.collapse( true ); - } - }, - - getBoundaryNodes : function() - { - var startNode = this.startContainer, - endNode = this.endContainer, - startOffset = this.startOffset, - endOffset = this.endOffset, - childCount; - - if ( startNode.type == CKEDITOR.NODE_ELEMENT ) - { - childCount = startNode.getChildCount(); - if ( childCount > startOffset ) - startNode = startNode.getChild( startOffset ); - else if ( childCount < 1 ) - startNode = startNode.getPreviousSourceNode(); - else // startOffset > childCount but childCount is not 0 - { - // Try to take the node just after the current position. - startNode = startNode.$; - while ( startNode.lastChild ) - startNode = startNode.lastChild; - startNode = new CKEDITOR.dom.node( startNode ); - - // Normally we should take the next node in DFS order. But it - // is also possible that we've already reached the end of - // document. - startNode = startNode.getNextSourceNode() || startNode; - } - } - if ( endNode.type == CKEDITOR.NODE_ELEMENT ) - { - childCount = endNode.getChildCount(); - if ( childCount > endOffset ) - endNode = endNode.getChild( endOffset ).getPreviousSourceNode( true ); - else if ( childCount < 1 ) - endNode = endNode.getPreviousSourceNode(); - else // endOffset > childCount but childCount is not 0 - { - // Try to take the node just before the current position. - endNode = endNode.$; - while ( endNode.lastChild ) - endNode = endNode.lastChild; - endNode = new CKEDITOR.dom.node( endNode ); - } - } - - // Sometimes the endNode will come right before startNode for collapsed - // ranges. Fix it. (#3780) - if ( startNode.getPosition( endNode ) & CKEDITOR.POSITION_FOLLOWING ) - startNode = endNode; - - return { startNode : startNode, endNode : endNode }; - }, - - /** - * Find the node which fully contains the range. - * @param includeSelf - * @param {Boolean} ignoreTextNode Whether ignore CKEDITOR.NODE_TEXT type. - */ - getCommonAncestor : function( includeSelf , ignoreTextNode ) - { - var start = this.startContainer, - end = this.endContainer, - ancestor; - - if ( start.equals( end ) ) - { - if ( includeSelf - && start.type == CKEDITOR.NODE_ELEMENT - && this.startOffset == this.endOffset - 1 ) - ancestor = start.getChild( this.startOffset ); - else - ancestor = start; - } - else - ancestor = start.getCommonAncestor( end ); - - return ignoreTextNode && !ancestor.is ? ancestor.getParent() : ancestor; - }, - - /** - * Transforms the startContainer and endContainer properties from text - * nodes to element nodes, whenever possible. This is actually possible - * if either of the boundary containers point to a text node, and its - * offset is set to zero, or after the last char in the node. - */ - optimize : function() - { - var container = this.startContainer; - var offset = this.startOffset; - - if ( container.type != CKEDITOR.NODE_ELEMENT ) - { - if ( !offset ) - this.setStartBefore( container ); - else if ( offset >= container.getLength() ) - this.setStartAfter( container ); - } - - container = this.endContainer; - offset = this.endOffset; - - if ( container.type != CKEDITOR.NODE_ELEMENT ) - { - if ( !offset ) - this.setEndBefore( container ); - else if ( offset >= container.getLength() ) - this.setEndAfter( container ); - } - }, - - /** - * Move the range out of bookmark nodes if they're been the container. - */ - optimizeBookmark: function() - { - var startNode = this.startContainer, - endNode = this.endContainer; - - if ( startNode.is && startNode.is( 'span' ) - && startNode.hasAttribute( '_fck_bookmark' ) ) - this.setStartAt( startNode, CKEDITOR.POSITION_BEFORE_START ); - if ( endNode && endNode.is && endNode.is( 'span' ) - && endNode.hasAttribute( '_fck_bookmark' ) ) - this.setEndAt( endNode, CKEDITOR.POSITION_AFTER_END ); - }, - - trim : function( ignoreStart, ignoreEnd ) - { - var startContainer = this.startContainer, - startOffset = this.startOffset, - collapsed = this.collapsed; - if ( ( !ignoreStart || collapsed ) - && startContainer && startContainer.type == CKEDITOR.NODE_TEXT ) - { - // If the offset is zero, we just insert the new node before - // the start. - if ( !startOffset ) - { - startOffset = startContainer.getIndex(); - startContainer = startContainer.getParent(); - } - // If the offset is at the end, we'll insert it after the text - // node. - else if ( startOffset >= startContainer.getLength() ) - { - startOffset = startContainer.getIndex() + 1; - startContainer = startContainer.getParent(); - } - // In other case, we split the text node and insert the new - // node at the split point. - else - { - var nextText = startContainer.split( startOffset ); - - startOffset = startContainer.getIndex() + 1; - startContainer = startContainer.getParent(); - - // Check all necessity of updating the end boundary. - if ( this.startContainer.equals( this.endContainer ) ) - this.setEnd( nextText, this.endOffset - this.startOffset ); - else if ( startContainer.equals( this.endContainer ) ) - this.endOffset += 1; - } - - this.setStart( startContainer, startOffset ); - - if ( collapsed ) - { - this.collapse( true ); - return; - } - } - - var endContainer = this.endContainer; - var endOffset = this.endOffset; - - if ( !( ignoreEnd || collapsed ) - && endContainer && endContainer.type == CKEDITOR.NODE_TEXT ) - { - // If the offset is zero, we just insert the new node before - // the start. - if ( !endOffset ) - { - endOffset = endContainer.getIndex(); - endContainer = endContainer.getParent(); - } - // If the offset is at the end, we'll insert it after the text - // node. - else if ( endOffset >= endContainer.getLength() ) - { - endOffset = endContainer.getIndex() + 1; - endContainer = endContainer.getParent(); - } - // In other case, we split the text node and insert the new - // node at the split point. - else - { - endContainer.split( endOffset ); - - endOffset = endContainer.getIndex() + 1; - endContainer = endContainer.getParent(); - } - - this.setEnd( endContainer, endOffset ); - } - }, - - enlarge : function( unit ) - { - switch ( unit ) - { - case CKEDITOR.ENLARGE_ELEMENT : - - if ( this.collapsed ) - return; - - // Get the common ancestor. - var commonAncestor = this.getCommonAncestor(); - - var body = this.document.getBody(); - - // For each boundary - // a. Depending on its position, find out the first node to be checked (a sibling) or, if not available, to be enlarge. - // b. Go ahead checking siblings and enlarging the boundary as much as possible until the common ancestor is not reached. After reaching the common ancestor, just save the enlargeable node to be used later. - - var startTop, endTop; - - var enlargeable, sibling, commonReached; - - // Indicates that the node can be added only if whitespace - // is available before it. - var needsWhiteSpace = false; - var isWhiteSpace; - var siblingText; - - // Process the start boundary. - - var container = this.startContainer; - var offset = this.startOffset; - - if ( container.type == CKEDITOR.NODE_TEXT ) - { - if ( offset ) - { - // Check if there is any non-space text before the - // offset. Otherwise, container is null. - container = !CKEDITOR.tools.trim( container.substring( 0, offset ) ).length && container; - - // If we found only whitespace in the node, it - // means that we'll need more whitespace to be able - // to expand. For example, can be expanded in - // "A [B]", but not in "A [B]". - needsWhiteSpace = !!container; - } - - if ( container ) - { - if ( !( sibling = container.getPrevious() ) ) - enlargeable = container.getParent(); - } - } - else - { - // If we have offset, get the node preceeding it as the - // first sibling to be checked. - if ( offset ) - sibling = container.getChild( offset - 1 ) || container.getLast(); - - // If there is no sibling, mark the container to be - // enlarged. - if ( !sibling ) - enlargeable = container; - } - - while ( enlargeable || sibling ) - { - if ( enlargeable && !sibling ) - { - // If we reached the common ancestor, mark the flag - // for it. - if ( !commonReached && enlargeable.equals( commonAncestor ) ) - commonReached = true; - - if ( !body.contains( enlargeable ) ) - break; - - // If we don't need space or this element breaks - // the line, then enlarge it. - if ( !needsWhiteSpace || enlargeable.getComputedStyle( 'display' ) != 'inline' ) - { - needsWhiteSpace = false; - - // If the common ancestor has been reached, - // we'll not enlarge it immediately, but just - // mark it to be enlarged later if the end - // boundary also enlarges it. - if ( commonReached ) - startTop = enlargeable; - else - this.setStartBefore( enlargeable ); - } - - sibling = enlargeable.getPrevious(); - } - - // Check all sibling nodes preceeding the enlargeable - // node. The node wil lbe enlarged only if none of them - // blocks it. - while ( sibling ) - { - // This flag indicates that this node has - // whitespaces at the end. - isWhiteSpace = false; - - if ( sibling.type == CKEDITOR.NODE_TEXT ) - { - siblingText = sibling.getText(); - - if ( /[^\s\ufeff]/.test( siblingText ) ) - sibling = null; - - isWhiteSpace = /[\s\ufeff]$/.test( siblingText ); - } - else - { - // If this is a visible element. - // We need to check for the bookmark attribute because IE insists on - // rendering the display:none nodes we use for bookmarks. (#3363) - if ( sibling.$.offsetWidth > 0 && !sibling.getAttribute( '_fck_bookmark' ) ) - { - // We'll accept it only if we need - // whitespace, and this is an inline - // element with whitespace only. - if ( needsWhiteSpace && CKEDITOR.dtd.$removeEmpty[ sibling.getName() ] ) - { - // It must contains spaces and inline elements only. - - siblingText = sibling.getText(); - - if ( (/[^\s\ufeff]/).test( siblingText ) ) // Spaces + Zero Width No-Break Space (U+FEFF) - sibling = null; - else - { - var allChildren = sibling.$.all || sibling.$.getElementsByTagName( '*' ); - for ( var i = 0, child ; child = allChildren[ i++ ] ; ) - { - if ( !CKEDITOR.dtd.$removeEmpty[ child.nodeName.toLowerCase() ] ) - { - sibling = null; - break; - } - } - } - - if ( sibling ) - isWhiteSpace = !!siblingText.length; - } - else - sibling = null; - } - } - - // A node with whitespaces has been found. - if ( isWhiteSpace ) - { - // Enlarge the last enlargeable node, if we - // were waiting for spaces. - if ( needsWhiteSpace ) - { - if ( commonReached ) - startTop = enlargeable; - else if ( enlargeable ) - this.setStartBefore( enlargeable ); - } - else - needsWhiteSpace = true; - } - - if ( sibling ) - { - var next = sibling.getPrevious(); - - if ( !enlargeable && !next ) - { - // Set the sibling as enlargeable, so it's - // parent will be get later outside this while. - enlargeable = sibling; - sibling = null; - break; - } - - sibling = next; - } - else - { - // If sibling has been set to null, then we - // need to stop enlarging. - enlargeable = null; - } - } - - if ( enlargeable ) - enlargeable = enlargeable.getParent(); - } - - // Process the end boundary. This is basically the same - // code used for the start boundary, with small changes to - // make it work in the oposite side (to the right). This - // makes it difficult to reuse the code here. So, fixes to - // the above code are likely to be replicated here. - - container = this.endContainer; - offset = this.endOffset; - - // Reset the common variables. - enlargeable = sibling = null; - commonReached = needsWhiteSpace = false; - - if ( container.type == CKEDITOR.NODE_TEXT ) - { - // Check if there is any non-space text after the - // offset. Otherwise, container is null. - container = !CKEDITOR.tools.trim( container.substring( offset ) ).length && container; - - // If we found only whitespace in the node, it - // means that we'll need more whitespace to be able - // to expand. For example, can be expanded in - // "A [B]", but not in "A [B]". - needsWhiteSpace = !( container && container.getLength() ); - - if ( container ) - { - if ( !( sibling = container.getNext() ) ) - enlargeable = container.getParent(); - } - } - else - { - // Get the node right after the boudary to be checked - // first. - sibling = container.getChild( offset ); - - if ( !sibling ) - enlargeable = container; - } - - while ( enlargeable || sibling ) - { - if ( enlargeable && !sibling ) - { - if ( !commonReached && enlargeable.equals( commonAncestor ) ) - commonReached = true; - - if ( !body.contains( enlargeable ) ) - break; - - if ( !needsWhiteSpace || enlargeable.getComputedStyle( 'display' ) != 'inline' ) - { - needsWhiteSpace = false; - - if ( commonReached ) - endTop = enlargeable; - else if ( enlargeable ) - this.setEndAfter( enlargeable ); - } - - sibling = enlargeable.getNext(); - } - - while ( sibling ) - { - isWhiteSpace = false; - - if ( sibling.type == CKEDITOR.NODE_TEXT ) - { - siblingText = sibling.getText(); - - if ( /[^\s\ufeff]/.test( siblingText ) ) - sibling = null; - - isWhiteSpace = /^[\s\ufeff]/.test( siblingText ); - } - else - { - // If this is a visible element. - // We need to check for the bookmark attribute because IE insists on - // rendering the display:none nodes we use for bookmarks. (#3363) - if ( sibling.$.offsetWidth > 0 && !sibling.getAttribute( '_fck_bookmark' ) ) - { - // We'll accept it only if we need - // whitespace, and this is an inline - // element with whitespace only. - if ( needsWhiteSpace && CKEDITOR.dtd.$removeEmpty[ sibling.getName() ] ) - { - // It must contains spaces and inline elements only. - - siblingText = sibling.getText(); - - if ( (/[^\s\ufeff]/).test( siblingText ) ) - sibling = null; - else - { - allChildren = sibling.$.all || sibling.$.getElementsByTagName( '*' ); - for ( i = 0 ; child = allChildren[ i++ ] ; ) - { - if ( !CKEDITOR.dtd.$removeEmpty[ child.nodeName.toLowerCase() ] ) - { - sibling = null; - break; - } - } - } - - if ( sibling ) - isWhiteSpace = !!siblingText.length; - } - else - sibling = null; - } - } - - if ( isWhiteSpace ) - { - if ( needsWhiteSpace ) - { - if ( commonReached ) - endTop = enlargeable; - else - this.setEndAfter( enlargeable ); - } - } - - if ( sibling ) - { - next = sibling.getNext(); - - if ( !enlargeable && !next ) - { - enlargeable = sibling; - sibling = null; - break; - } - - sibling = next; - } - else - { - // If sibling has been set to null, then we - // need to stop enlarging. - enlargeable = null; - } - } - - if ( enlargeable ) - enlargeable = enlargeable.getParent(); - } - - // If the common ancestor can be enlarged by both boundaries, then include it also. - if ( startTop && endTop ) - { - commonAncestor = startTop.contains( endTop ) ? endTop : startTop; - - this.setStartBefore( commonAncestor ); - this.setEndAfter( commonAncestor ); - } - break; - - case CKEDITOR.ENLARGE_BLOCK_CONTENTS: - case CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS: - - // Enlarging the start boundary. - var walkerRange = new CKEDITOR.dom.range( this.document ); - - body = this.document.getBody(); - - walkerRange.setStartAt( body, CKEDITOR.POSITION_AFTER_START ); - walkerRange.setEnd( this.startContainer, this.startOffset ); - - var walker = new CKEDITOR.dom.walker( walkerRange ), - blockBoundary, // The node on which the enlarging should stop. - tailBr, // - defaultGuard = CKEDITOR.dom.walker.blockBoundary( - ( unit == CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS ) ? { br : 1 } : null ), - // Record the encountered 'blockBoundary' for later use. - boundaryGuard = function( node ) - { - var retval = defaultGuard( node ); - if ( !retval ) - blockBoundary = node; - return retval; - }, - // Record the encounted 'tailBr' for later use. - tailBrGuard = function( node ) - { - var retval = boundaryGuard( node ); - if ( !retval && node.is && node.is( 'br' ) ) - tailBr = node; - return retval; - }; - - walker.guard = boundaryGuard; - - enlargeable = walker.lastBackward(); - - // It's the body which stop the enlarging if no block boundary found. - blockBoundary = blockBoundary || body; - - // Start the range at different position by comparing - // the document position of it with 'enlargeable' node. - this.setStartAt( - blockBoundary, - !blockBoundary.is( 'br' ) && - ( !enlargeable && this.checkStartOfBlock() - || enlargeable && blockBoundary.contains( enlargeable ) ) ? - CKEDITOR.POSITION_AFTER_START : - CKEDITOR.POSITION_AFTER_END ); - - // Enlarging the end boundary. - walkerRange = this.clone(); - walkerRange.collapse(); - walkerRange.setEndAt( body, CKEDITOR.POSITION_BEFORE_END ); - walker = new CKEDITOR.dom.walker( walkerRange ); - - // tailBrGuard only used for on range end. - walker.guard = ( unit == CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS ) ? - tailBrGuard : boundaryGuard; - blockBoundary = null; - // End the range right before the block boundary node. - - enlargeable = walker.lastForward(); - - // It's the body which stop the enlarging if no block boundary found. - blockBoundary = blockBoundary || body; - - // Start the range at different position by comparing - // the document position of it with 'enlargeable' node. - this.setEndAt( - blockBoundary, - ( !enlargeable && this.checkEndOfBlock() - || enlargeable && blockBoundary.contains( enlargeable ) ) ? - CKEDITOR.POSITION_BEFORE_END : - CKEDITOR.POSITION_BEFORE_START ); - // We must include the
at the end of range if there's - // one and we're expanding list item contents - if ( tailBr ) - this.setEndAfter( tailBr ); - } - }, - - /** - * Descrease the range to make sure that boundaries - * always anchor beside text nodes or innermost element. - * @param {Number} mode ( CKEDITOR.SHRINK_ELEMENT | CKEDITOR.SHRINK_TEXT ) The shrinking mode. - */ - shrink : function( mode ) - { - // Unable to shrink a collapsed range. - if ( !this.collapsed ) - { - mode = mode || CKEDITOR.SHRINK_TEXT; - - var walkerRange = this.clone(); - - var startContainer = this.startContainer, - endContainer = this.endContainer, - startOffset = this.startOffset, - endOffset = this.endOffset, - collapsed = this.collapsed; - - // Whether the start/end boundary is moveable. - var moveStart = 1, - moveEnd = 1; - - if ( startContainer && startContainer.type == CKEDITOR.NODE_TEXT ) - { - if ( !startOffset ) - walkerRange.setStartBefore( startContainer ); - else if ( startOffset >= startContainer.getLength( ) ) - walkerRange.setStartAfter( startContainer ); - else - { - // Enlarge the range properly to avoid walker making - // DOM changes caused by triming the text nodes later. - walkerRange.setStartBefore( startContainer ); - moveStart = 0; - } - } - - if ( endContainer && endContainer.type == CKEDITOR.NODE_TEXT ) - { - if ( !endOffset ) - walkerRange.setEndBefore( endContainer ); - else if ( endOffset >= endContainer.getLength( ) ) - walkerRange.setEndAfter( endContainer ); - else - { - walkerRange.setEndAfter( endContainer ); - moveEnd = 0; - } - } - - var walker = new CKEDITOR.dom.walker( walkerRange ); - - walker.evaluator = function( node ) - { - return node.type == ( mode == CKEDITOR.SHRINK_ELEMENT ? - CKEDITOR.NODE_ELEMENT : CKEDITOR.NODE_TEXT ); - }; - - var currentElement; - walker.guard = function( node, movingOut ) - { - // Stop when we're shrink in element mode while encountering a text node. - if ( mode == CKEDITOR.SHRINK_ELEMENT && node.type == CKEDITOR.NODE_TEXT ) - return false; - - // Stop when we've already walked "through" an element. - if ( movingOut && node.equals( currentElement ) ) - return false; - - if ( !movingOut && node.type == CKEDITOR.NODE_ELEMENT ) - currentElement = node; - - return true; - }; - - if ( moveStart ) - { - var textStart = walker[ mode == CKEDITOR.SHRINK_ELEMENT ? 'lastForward' : 'next'](); - textStart && this.setStartBefore( textStart ); - } - - if ( moveEnd ) - { - walker.reset(); - var textEnd = walker[ mode == CKEDITOR.SHRINK_ELEMENT ? 'lastBackward' : 'previous'](); - textEnd && this.setEndAfter( textEnd ); - } - - return !!( moveStart || moveEnd ); - } - }, - - /** - * Inserts a node at the start of the range. The range will be expanded - * the contain the node. - */ - insertNode : function( node ) - { - this.optimizeBookmark(); - this.trim( false, true ); - - var startContainer = this.startContainer; - var startOffset = this.startOffset; - - var nextNode = startContainer.getChild( startOffset ); - - if ( nextNode ) - node.insertBefore( nextNode ); - else - startContainer.append( node ); - - // Check if we need to update the end boundary. - if ( node.getParent().equals( this.endContainer ) ) - this.endOffset++; - - // Expand the range to embrace the new node. - this.setStartBefore( node ); - }, - - moveToPosition : function( node, position ) - { - this.setStartAt( node, position ); - this.collapse( true ); - }, - - selectNodeContents : function( node ) - { - this.setStart( node, 0 ); - this.setEnd( node, node.type == CKEDITOR.NODE_TEXT ? node.getLength() : node.getChildCount() ); - }, - - /** - * Sets the start position of a Range. - * @param {CKEDITOR.dom.node} startNode The node to start the range. - * @param {Number} startOffset An integer greater than or equal to zero - * representing the offset for the start of the range from the start - * of startNode. - */ - setStart : function( startNode, startOffset ) - { - // W3C requires a check for the new position. If it is after the end - // boundary, the range should be collapsed to the new start. It seams - // we will not need this check for our use of this class so we can - // ignore it for now. - - this.startContainer = startNode; - this.startOffset = startOffset; - - if ( !this.endContainer ) - { - this.endContainer = startNode; - this.endOffset = startOffset; - } - - updateCollapsed( this ); - }, - - /** - * Sets the end position of a Range. - * @param {CKEDITOR.dom.node} endNode The node to end the range. - * @param {Number} endOffset An integer greater than or equal to zero - * representing the offset for the end of the range from the start - * of endNode. - */ - setEnd : function( endNode, endOffset ) - { - // W3C requires a check for the new position. If it is before the start - // boundary, the range should be collapsed to the new end. It seams we - // will not need this check for our use of this class so we can ignore - // it for now. - - this.endContainer = endNode; - this.endOffset = endOffset; - - if ( !this.startContainer ) - { - this.startContainer = endNode; - this.startOffset = endOffset; - } - - updateCollapsed( this ); - }, - - setStartAfter : function( node ) - { - this.setStart( node.getParent(), node.getIndex() + 1 ); - }, - - setStartBefore : function( node ) - { - this.setStart( node.getParent(), node.getIndex() ); - }, - - setEndAfter : function( node ) - { - this.setEnd( node.getParent(), node.getIndex() + 1 ); - }, - - setEndBefore : function( node ) - { - this.setEnd( node.getParent(), node.getIndex() ); - }, - - setStartAt : function( node, position ) - { - switch( position ) - { - case CKEDITOR.POSITION_AFTER_START : - this.setStart( node, 0 ); - break; - - case CKEDITOR.POSITION_BEFORE_END : - if ( node.type == CKEDITOR.NODE_TEXT ) - this.setStart( node, node.getLength() ); - else - this.setStart( node, node.getChildCount() ); - break; - - case CKEDITOR.POSITION_BEFORE_START : - this.setStartBefore( node ); - break; - - case CKEDITOR.POSITION_AFTER_END : - this.setStartAfter( node ); - } - - updateCollapsed( this ); - }, - - setEndAt : function( node, position ) - { - switch( position ) - { - case CKEDITOR.POSITION_AFTER_START : - this.setEnd( node, 0 ); - break; - - case CKEDITOR.POSITION_BEFORE_END : - if ( node.type == CKEDITOR.NODE_TEXT ) - this.setEnd( node, node.getLength() ); - else - this.setEnd( node, node.getChildCount() ); - break; - - case CKEDITOR.POSITION_BEFORE_START : - this.setEndBefore( node ); - break; - - case CKEDITOR.POSITION_AFTER_END : - this.setEndAfter( node ); - } - - updateCollapsed( this ); - }, - - fixBlock : function( isStart, blockTag ) - { - var bookmark = this.createBookmark(), - fixedBlock = this.document.createElement( blockTag ); - - this.collapse( isStart ); - - this.enlarge( CKEDITOR.ENLARGE_BLOCK_CONTENTS ); - - this.extractContents().appendTo( fixedBlock ); - fixedBlock.trim(); - - if ( !CKEDITOR.env.ie ) - fixedBlock.appendBogus(); - - this.insertNode( fixedBlock ); - - this.moveToBookmark( bookmark ); - - return fixedBlock; - }, - - splitBlock : function( blockTag ) - { - var startPath = new CKEDITOR.dom.elementPath( this.startContainer ), - endPath = new CKEDITOR.dom.elementPath( this.endContainer ); - - var startBlockLimit = startPath.blockLimit, - endBlockLimit = endPath.blockLimit; - - var startBlock = startPath.block, - endBlock = endPath.block; - - var elementPath = null; - // Do nothing if the boundaries are in different block limits. - if ( !startBlockLimit.equals( endBlockLimit ) ) - return null; - - // Get or fix current blocks. - if ( blockTag != 'br' ) - { - if ( !startBlock ) - { - startBlock = this.fixBlock( true, blockTag ); - endBlock = new CKEDITOR.dom.elementPath( this.endContainer ).block; - } - - if ( !endBlock ) - endBlock = this.fixBlock( false, blockTag ); - } - - // Get the range position. - var isStartOfBlock = startBlock && this.checkStartOfBlock(), - isEndOfBlock = endBlock && this.checkEndOfBlock(); - - // Delete the current contents. - // TODO: Why is 2.x doing CheckIsEmpty()? - this.deleteContents(); - - if ( startBlock && startBlock.equals( endBlock ) ) - { - if ( isEndOfBlock ) - { - elementPath = new CKEDITOR.dom.elementPath( this.startContainer ); - this.moveToPosition( endBlock, CKEDITOR.POSITION_AFTER_END ); - endBlock = null; - } - else if ( isStartOfBlock ) - { - elementPath = new CKEDITOR.dom.elementPath( this.startContainer ); - this.moveToPosition( startBlock, CKEDITOR.POSITION_BEFORE_START ); - startBlock = null; - } - else - { - endBlock = this.splitElement( startBlock ); - - // In Gecko, the last child node must be a bogus
. - // Note: bogus
added under
    or
      would cause - // lists to be incorrectly rendered. - if ( !CKEDITOR.env.ie && !startBlock.is( 'ul', 'ol') ) - startBlock.appendBogus() ; - } - } - - return { - previousBlock : startBlock, - nextBlock : endBlock, - wasStartOfBlock : isStartOfBlock, - wasEndOfBlock : isEndOfBlock, - elementPath : elementPath - }; - }, - - /** - * Branch the specified element from the collapsed range position and - * place the caret between the two result branches. - * Note: The range must be collapsed and been enclosed by this element. - * @param {CKEDITOR.dom.element} element - * @return {CKEDITOR.dom.element} Root element of the new branch after the split. - */ - splitElement : function( toSplit ) - { - if ( !this.collapsed ) - return null; - - // Extract the contents of the block from the selection point to the end - // of its contents. - this.setEndAt( toSplit, CKEDITOR.POSITION_BEFORE_END ); - var documentFragment = this.extractContents(); - - // Duplicate the element after it. - var clone = toSplit.clone( false ); - - // Place the extracted contents into the duplicated element. - documentFragment.appendTo( clone ); - clone.insertAfter( toSplit ); - this.moveToPosition( toSplit, CKEDITOR.POSITION_AFTER_END ); - return clone; - }, - - /** - * Check whether current range is on the inner edge of the specified element. - * @param {Number} checkType ( CKEDITOR.START | CKEDITOR.END ) The checking side. - * @param {CKEDITOR.dom.element} element The target element to check. - */ - checkBoundaryOfElement : function( element, checkType ) - { - var walkerRange = this.clone(); - // Expand the range to element boundary. - walkerRange[ checkType == CKEDITOR.START ? - 'setStartAt' : 'setEndAt' ] - ( element, checkType == CKEDITOR.START ? - CKEDITOR.POSITION_AFTER_START - : CKEDITOR.POSITION_BEFORE_END ); - - var walker = new CKEDITOR.dom.walker( walkerRange ), - retval = false; - walker.evaluator = elementBoundaryEval; - return walker[ checkType == CKEDITOR.START ? - 'checkBackward' : 'checkForward' ](); - }, - // Calls to this function may produce changes to the DOM. The range may - // be updated to reflect such changes. - checkStartOfBlock : function() - { - var startContainer = this.startContainer, - startOffset = this.startOffset; - - // If the starting node is a text node, and non-empty before the offset, - // then we're surely not at the start of block. - if ( startOffset && startContainer.type == CKEDITOR.NODE_TEXT ) - { - var textBefore = CKEDITOR.tools.ltrim( startContainer.substring( 0, startOffset ) ); - if ( textBefore.length ) - return false; - } - - // Antecipate the trim() call here, so the walker will not make - // changes to the DOM, which would not get reflected into this - // range otherwise. - this.trim(); - - // We need to grab the block element holding the start boundary, so - // let's use an element path for it. - var path = new CKEDITOR.dom.elementPath( this.startContainer ); - - // Creates a range starting at the block start until the range start. - var walkerRange = this.clone(); - walkerRange.collapse( true ); - walkerRange.setStartAt( path.block || path.blockLimit, CKEDITOR.POSITION_AFTER_START ); - - var walker = new CKEDITOR.dom.walker( walkerRange ); - walker.evaluator = getCheckStartEndBlockEvalFunction( true ); - - return walker.checkBackward(); - }, - - checkEndOfBlock : function() - { - var endContainer = this.endContainer, - endOffset = this.endOffset; - - // If the ending node is a text node, and non-empty after the offset, - // then we're surely not at the end of block. - if ( endContainer.type == CKEDITOR.NODE_TEXT ) - { - var textAfter = CKEDITOR.tools.rtrim( endContainer.substring( endOffset ) ); - if ( textAfter.length ) - return false; - } - - // Antecipate the trim() call here, so the walker will not make - // changes to the DOM, which would not get reflected into this - // range otherwise. - this.trim(); - - // We need to grab the block element holding the start boundary, so - // let's use an element path for it. - var path = new CKEDITOR.dom.elementPath( this.endContainer ); - - // Creates a range starting at the block start until the range start. - var walkerRange = this.clone(); - walkerRange.collapse( false ); - walkerRange.setEndAt( path.block || path.blockLimit, CKEDITOR.POSITION_BEFORE_END ); - - var walker = new CKEDITOR.dom.walker( walkerRange ); - walker.evaluator = getCheckStartEndBlockEvalFunction( false ); - - return walker.checkForward(); - }, - - /** - * Moves the range boundaries to the first/end editing point inside an - * element. For example, in an element tree like - * "<p><b><i></i></b> Text</p>", the start editing point is - * "<p><b><i>^</i></b> Text</p>" (inside <i>). - * @param {CKEDITOR.dom.element} el The element into which look for the - * editing spot. - * @param {Boolean} isMoveToEnd Whether move to the end editable position. - */ - moveToElementEditablePosition : function( el, isMoveToEnd ) - { - var isEditable; - - // Empty elements are rejected. - if ( CKEDITOR.dtd.$empty[ el.getName() ] ) - return false; - - while ( el && el.type == CKEDITOR.NODE_ELEMENT ) - { - isEditable = el.isEditable(); - - // If an editable element is found, move inside it. - if ( isEditable ) - this.moveToPosition( el, isMoveToEnd ? - CKEDITOR.POSITION_BEFORE_END : - CKEDITOR.POSITION_AFTER_START ); - // Stop immediately if we've found a non editable inline element (e.g ). - else if ( CKEDITOR.dtd.$inline[ el.getName() ] ) - { - this.moveToPosition( el, isMoveToEnd ? - CKEDITOR.POSITION_AFTER_END : - CKEDITOR.POSITION_BEFORE_START ); - return true; - } - - // Non-editable non-inline elements are to be bypassed, getting the next one. - if ( CKEDITOR.dtd.$empty[ el.getName() ] ) - el = el[ isMoveToEnd ? 'getPrevious' : 'getNext' ]( nonWhitespaceOrBookmarkEval ); - else - el = el[ isMoveToEnd ? 'getLast' : 'getFirst' ]( nonWhitespaceOrBookmarkEval ); - - // Stop immediately if we've found a text node. - if ( el && el.type == CKEDITOR.NODE_TEXT ) - { - this.moveToPosition( el, isMoveToEnd ? - CKEDITOR.POSITION_AFTER_END : - CKEDITOR.POSITION_BEFORE_START ); - return true; - } - } - - return isEditable; - }, - - /** - *@see {CKEDITOR.dom.range.moveToElementEditablePosition} - */ - moveToElementEditStart : function( target ) - { - return this.moveToElementEditablePosition( target ); - }, - - /** - *@see {CKEDITOR.dom.range.moveToElementEditablePosition} - */ - moveToElementEditEnd : function( target ) - { - return this.moveToElementEditablePosition( target, true ); - }, - - /** - * Get the single node enclosed within the range if there's one. - */ - getEnclosedNode : function() - { - var walkerRange = this.clone(), - walker = new CKEDITOR.dom.walker( walkerRange ), - isNotBookmarks = CKEDITOR.dom.walker.bookmark( true ), - isNotWhitespaces = CKEDITOR.dom.walker.whitespaces( true ), - evaluator = function( node ) - { - return isNotWhitespaces( node ) && isNotBookmarks( node ); - }; - walkerRange.evaluator = evaluator; - var node = walker.next(); - walker.reset(); - return node && node.equals( walker.previous() ) ? node : null; - }, - - getTouchedStartNode : function() - { - var container = this.startContainer ; - - if ( this.collapsed || container.type != CKEDITOR.NODE_ELEMENT ) - return container ; - - return container.getChild( this.startOffset ) || container ; - }, - - getTouchedEndNode : function() - { - var container = this.endContainer ; - - if ( this.collapsed || container.type != CKEDITOR.NODE_ELEMENT ) - return container ; - - return container.getChild( this.endOffset - 1 ) || container ; - } - }; -})(); - -CKEDITOR.POSITION_AFTER_START = 1; // ^contents "^text" -CKEDITOR.POSITION_BEFORE_END = 2; // contents^ "text^" -CKEDITOR.POSITION_BEFORE_START = 3; // ^contents ^"text" -CKEDITOR.POSITION_AFTER_END = 4; // contents^ "text" - -CKEDITOR.ENLARGE_ELEMENT = 1; -CKEDITOR.ENLARGE_BLOCK_CONTENTS = 2; -CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS = 3; - -/** - * Check boundary types. - * @see CKEDITOR.dom.range::checkBoundaryOfElement - */ -CKEDITOR.START = 1; -CKEDITOR.END = 2; -CKEDITOR.STARTEND = 3; - -CKEDITOR.SHRINK_ELEMENT = 1; -CKEDITOR.SHRINK_TEXT = 2; diff --git a/public/javascripts/ckeditor/_source/core/dom/text.js b/public/javascripts/ckeditor/_source/core/dom/text.js deleted file mode 100644 index a1eb690..0000000 --- a/public/javascripts/ckeditor/_source/core/dom/text.js +++ /dev/null @@ -1,123 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Defines the {@link CKEDITOR.dom.text} class, which represents - * a DOM text node. - */ - -/** - * Represents a DOM text node. - * @constructor - * @augments CKEDITOR.dom.node - * @param {Object|String} text A native DOM text node or a string containing - * the text to use to create a new text node. - * @param {CKEDITOR.dom.document} [ownerDocument] The document that will contain - * the node in case of new node creation. Defaults to the current document. - * @example - * var nativeNode = document.createTextNode( 'Example' ); - * var text = CKEDITOR.dom.text( nativeNode ); - * @example - * var text = CKEDITOR.dom.text( 'Example' ); - */ -CKEDITOR.dom.text = function( text, ownerDocument ) -{ - if ( typeof text == 'string' ) - text = ( ownerDocument ? ownerDocument.$ : document ).createTextNode( text ); - - // Theoretically, we should call the base constructor here - // (not CKEDITOR.dom.node though). But, IE doesn't support expando - // properties on text node, so the features provided by domObject will not - // work for text nodes (which is not a big issue for us). - // - // CKEDITOR.dom.domObject.call( this, element ); - - /** - * The native DOM text node represented by this class instance. - * @type Object - * @example - * var element = new CKEDITOR.dom.text( 'Example' ); - * alert( element.$.nodeType ); // "3" - */ - this.$ = text; -}; - -CKEDITOR.dom.text.prototype = new CKEDITOR.dom.node(); - -CKEDITOR.tools.extend( CKEDITOR.dom.text.prototype, - /** @lends CKEDITOR.dom.text.prototype */ - { - /** - * The node type. This is a constant value set to - * {@link CKEDITOR.NODE_TEXT}. - * @type Number - * @example - */ - type : CKEDITOR.NODE_TEXT, - - getLength : function() - { - return this.$.nodeValue.length; - }, - - getText : function() - { - return this.$.nodeValue; - }, - - /** - * Breaks this text node into two nodes at the specified offset, - * keeping both in the tree as siblings. This node then only contains - * all the content up to the offset point. A new text node, which is - * inserted as the next sibling of this node, contains all the content - * at and after the offset point. When the offset is equal to the - * length of this node, the new node has no data. - * @param {Number} The position at which to split, starting from zero. - * @returns {CKEDITOR.dom.text} The new text node. - */ - split : function( offset ) - { - // If the offset is after the last char, IE creates the text node - // on split, but don't include it into the DOM. So, we have to do - // that manually here. - if ( CKEDITOR.env.ie && offset == this.getLength() ) - { - var next = this.getDocument().createText( '' ); - next.insertAfter( this ); - return next; - } - - var doc = this.getDocument(); - var retval = new CKEDITOR.dom.text( this.$.splitText( offset ), doc ); - - // IE BUG: IE8 does not update the childNodes array in DOM after splitText(), - // we need to make some DOM changes to make it update. (#3436) - if ( CKEDITOR.env.ie8 ) - { - var workaround = new CKEDITOR.dom.text( '', doc ); - workaround.insertAfter( retval ); - workaround.remove(); - } - - return retval; - }, - - /** - * Extracts characters from indexA up to but not including indexB. - * @param {Number} indexA An integer between 0 and one less than the - * length of the text. - * @param {Number} [indexB] An integer between 0 and the length of the - * string. If omitted, extracts characters to the end of the text. - */ - substring : function( indexA, indexB ) - { - // We need the following check due to a Firefox bug - // https://bugzilla.mozilla.org/show_bug.cgi?id=458886 - if ( typeof indexB != 'number' ) - return this.$.nodeValue.substr( indexA ); - else - return this.$.nodeValue.substring( indexA, indexB ); - } - }); diff --git a/public/javascripts/ckeditor/_source/core/dom/walker.js b/public/javascripts/ckeditor/_source/core/dom/walker.js deleted file mode 100644 index 1ef87f5..0000000 --- a/public/javascripts/ckeditor/_source/core/dom/walker.js +++ /dev/null @@ -1,451 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -(function() -{ - // This function is to be called under a "walker" instance scope. - function iterate( rtl, breakOnFalse ) - { - // Return null if we have reached the end. - if ( this._.end ) - return null; - - var node, - range = this.range, - guard, - userGuard = this.guard, - type = this.type, - getSourceNodeFn = ( rtl ? 'getPreviousSourceNode' : 'getNextSourceNode' ); - - // This is the first call. Initialize it. - if ( !this._.start ) - { - this._.start = 1; - - // Trim text nodes and optmize the range boundaries. DOM changes - // may happen at this point. - range.trim(); - - // A collapsed range must return null at first call. - if ( range.collapsed ) - { - this.end(); - return null; - } - } - - // Create the LTR guard function, if necessary. - if ( !rtl && !this._.guardLTR ) - { - // Gets the node that stops the walker when going LTR. - var limitLTR = range.endContainer, - blockerLTR = limitLTR.getChild( range.endOffset ); - - this._.guardLTR = function( node, movingOut ) - { - return ( ( !movingOut || !limitLTR.equals( node ) ) - && ( !blockerLTR || !node.equals( blockerLTR ) ) - && ( node.type != CKEDITOR.NODE_ELEMENT || !movingOut || node.getName() != 'body' ) ); - }; - } - - // Create the RTL guard function, if necessary. - if ( rtl && !this._.guardRTL ) - { - // Gets the node that stops the walker when going LTR. - var limitRTL = range.startContainer, - blockerRTL = ( range.startOffset > 0 ) && limitRTL.getChild( range.startOffset - 1 ); - - this._.guardRTL = function( node, movingOut ) - { - return ( ( !movingOut || !limitRTL.equals( node ) ) - && ( !blockerRTL || !node.equals( blockerRTL ) ) - && ( node.type != CKEDITOR.NODE_ELEMENT || !movingOut || node.getName() != 'body' ) ); - }; - } - - // Define which guard function to use. - var stopGuard = rtl ? this._.guardRTL : this._.guardLTR; - - // Make the user defined guard function participate in the process, - // otherwise simply use the boundary guard. - if ( userGuard ) - { - guard = function( node, movingOut ) - { - if ( stopGuard( node, movingOut ) === false ) - return false; - - return userGuard( node, movingOut ); - }; - } - else - guard = stopGuard; - - if ( this.current ) - node = this.current[ getSourceNodeFn ]( false, type, guard ); - else - { - // Get the first node to be returned. - - if ( rtl ) - { - node = range.endContainer; - - if ( range.endOffset > 0 ) - { - node = node.getChild( range.endOffset - 1 ); - if ( guard( node ) === false ) - node = null; - } - else - node = ( guard ( node, true ) === false ) ? - null : node.getPreviousSourceNode( true, type, guard ); - } - else - { - node = range.startContainer; - node = node.getChild( range.startOffset ); - - if ( node ) - { - if ( guard( node ) === false ) - node = null; - } - else - node = ( guard ( range.startContainer, true ) === false ) ? - null : range.startContainer.getNextSourceNode( true, type, guard ) ; - } - } - - while ( node && !this._.end ) - { - this.current = node; - - if ( !this.evaluator || this.evaluator( node ) !== false ) - { - if ( !breakOnFalse ) - return node; - } - else if ( breakOnFalse && this.evaluator ) - return false; - - node = node[ getSourceNodeFn ]( false, type, guard ); - } - - this.end(); - return this.current = null; - } - - function iterateToLast( rtl ) - { - var node, last = null; - - while ( ( node = iterate.call( this, rtl ) ) ) - last = node; - - return last; - } - - CKEDITOR.dom.walker = CKEDITOR.tools.createClass( - { - /** - * Utility class to "walk" the DOM inside a range boundaries. If - * necessary, partially included nodes (text nodes) are broken to - * reflect the boundaries limits, so DOM and range changes may happen. - * Outside changes to the range may break the walker. - * - * The walker may return nodes that are not totaly included into the - * range boundaires. Let's take the following range representation, - * where the square brackets indicate the boundaries: - * - * [<p>Some <b>sample] text</b> - * - * While walking forward into the above range, the following nodes are - * returned: <p>, "Some ", <b> and "sample". Going - * backwards instead we have: "sample" and "Some ". So note that the - * walker always returns nodes when "entering" them, but not when - * "leaving" them. The guard function is instead called both when - * entering and leaving nodes. - * - * @constructor - * @param {CKEDITOR.dom.range} range The range within which walk. - */ - $ : function( range ) - { - this.range = range; - - /** - * A function executed for every matched node, to check whether - * it's to be considered into the walk or not. If not provided, all - * matched nodes are considered good. - * If the function returns "false" the node is ignored. - * @name CKEDITOR.dom.walker.prototype.evaluator - * @property - * @type Function - */ - // this.evaluator = null; - - /** - * A function executed for every node the walk pass by to check - * whether the walk is to be finished. It's called when both - * entering and exiting nodes, as well as for the matched nodes. - * If this function returns "false", the walking ends and no more - * nodes are evaluated. - * @name CKEDITOR.dom.walker.prototype.guard - * @property - * @type Function - */ - // this.guard = null; - - /** @private */ - this._ = {}; - }, - -// statics : -// { -// /* Creates a CKEDITOR.dom.walker instance to walk inside DOM boundaries set by nodes. -// * @param {CKEDITOR.dom.node} startNode The node from wich the walk -// * will start. -// * @param {CKEDITOR.dom.node} [endNode] The last node to be considered -// * in the walk. No more nodes are retrieved after touching or -// * passing it. If not provided, the walker stops at the -// * <body> closing boundary. -// * @returns {CKEDITOR.dom.walker} A DOM walker for the nodes between the -// * provided nodes. -// */ -// createOnNodes : function( startNode, endNode, startInclusive, endInclusive ) -// { -// var range = new CKEDITOR.dom.range(); -// if ( startNode ) -// range.setStartAt( startNode, startInclusive ? CKEDITOR.POSITION_BEFORE_START : CKEDITOR.POSITION_AFTER_END ) ; -// else -// range.setStartAt( startNode.getDocument().getBody(), CKEDITOR.POSITION_AFTER_START ) ; -// -// if ( endNode ) -// range.setEndAt( endNode, endInclusive ? CKEDITOR.POSITION_AFTER_END : CKEDITOR.POSITION_BEFORE_START ) ; -// else -// range.setEndAt( startNode.getDocument().getBody(), CKEDITOR.POSITION_BEFORE_END ) ; -// -// return new CKEDITOR.dom.walker( range ); -// } -// }, -// - proto : - { - /** - * Stop walking. No more nodes are retrieved if this function gets - * called. - */ - end : function() - { - this._.end = 1; - }, - - /** - * Retrieves the next node (at right). - * @returns {CKEDITOR.dom.node} The next node or null if no more - * nodes are available. - */ - next : function() - { - return iterate.call( this ); - }, - - /** - * Retrieves the previous node (at left). - * @returns {CKEDITOR.dom.node} The previous node or null if no more - * nodes are available. - */ - previous : function() - { - return iterate.call( this, true ); - }, - - /** - * Check all nodes at right, executing the evaluation fuction. - * @returns {Boolean} "false" if the evaluator function returned - * "false" for any of the matched nodes. Otherwise "true". - */ - checkForward : function() - { - return iterate.call( this, false, true ) !== false; - }, - - /** - * Check all nodes at left, executing the evaluation fuction. - * @returns {Boolean} "false" if the evaluator function returned - * "false" for any of the matched nodes. Otherwise "true". - */ - checkBackward : function() - { - return iterate.call( this, true, true ) !== false; - }, - - /** - * Executes a full walk forward (to the right), until no more nodes - * are available, returning the last valid node. - * @returns {CKEDITOR.dom.node} The last node at the right or null - * if no valid nodes are available. - */ - lastForward : function() - { - return iterateToLast.call( this ); - }, - - /** - * Executes a full walk backwards (to the left), until no more nodes - * are available, returning the last valid node. - * @returns {CKEDITOR.dom.node} The last node at the left or null - * if no valid nodes are available. - */ - lastBackward : function() - { - return iterateToLast.call( this, true ); - }, - - reset : function() - { - delete this.current; - this._ = {}; - } - - } - }); - - /* - * Anything whose display computed style is block, list-item, table, - * table-row-group, table-header-group, table-footer-group, table-row, - * table-column-group, table-column, table-cell, table-caption, or whose node - * name is hr, br (when enterMode is br only) is a block boundary. - */ - var blockBoundaryDisplayMatch = - { - block : 1, - 'list-item' : 1, - table : 1, - 'table-row-group' : 1, - 'table-header-group' : 1, - 'table-footer-group' : 1, - 'table-row' : 1, - 'table-column-group' : 1, - 'table-column' : 1, - 'table-cell' : 1, - 'table-caption' : 1 - }, - blockBoundaryNodeNameMatch = { hr : 1 }; - - CKEDITOR.dom.element.prototype.isBlockBoundary = function( customNodeNames ) - { - var nodeNameMatches = CKEDITOR.tools.extend( {}, - blockBoundaryNodeNameMatch, customNodeNames || {} ); - - return blockBoundaryDisplayMatch[ this.getComputedStyle( 'display' ) ] || - nodeNameMatches[ this.getName() ]; - }; - - CKEDITOR.dom.walker.blockBoundary = function( customNodeNames ) - { - return function( node , type ) - { - return ! ( node.type == CKEDITOR.NODE_ELEMENT - && node.isBlockBoundary( customNodeNames ) ); - }; - }; - - CKEDITOR.dom.walker.listItemBoundary = function() - { - return this.blockBoundary( { br : 1 } ); - }; - /** - * Whether the node is a bookmark node's inner text node. - */ - CKEDITOR.dom.walker.bookmarkContents = function( node ) - { - }, - - /** - * Whether the to-be-evaluated node is a bookmark node OR bookmark node - * inner contents. - * @param {Boolean} contentOnly Whether only test againt the text content of - * bookmark node instead of the element itself(default). - * @param {Boolean} isReject Whether should return 'false' for the bookmark - * node instead of 'true'(default). - */ - CKEDITOR.dom.walker.bookmark = function( contentOnly, isReject ) - { - function isBookmarkNode( node ) - { - return ( node && node.getName - && node.getName() == 'span' - && node.hasAttribute('_fck_bookmark') ); - } - - return function( node ) - { - var isBookmark, parent; - // Is bookmark inner text node? - isBookmark = ( node && !node.getName && ( parent = node.getParent() ) - && isBookmarkNode( parent ) ); - // Is bookmark node? - isBookmark = contentOnly ? isBookmark : isBookmark || isBookmarkNode( node ); - return isReject ^ isBookmark; - }; - }; - - /** - * Whether the node is a text node containing only whitespaces characters. - * @param isReject - */ - CKEDITOR.dom.walker.whitespaces = function( isReject ) - { - return function( node ) - { - var isWhitespace = node && ( node.type == CKEDITOR.NODE_TEXT ) - && !CKEDITOR.tools.trim( node.getText() ); - return isReject ^ isWhitespace; - }; - }; - - /** - * Whether the node is invisible in wysiwyg mode. - * @param isReject - */ - CKEDITOR.dom.walker.invisible = function( isReject ) - { - var whitespace = CKEDITOR.dom.walker.whitespaces(); - return function( node ) - { - // Nodes that take no spaces in wysiwyg: - // 1. White-spaces but not including NBSP; - // 2. Empty inline elements, e.g. we're checking here - // 'offsetHeight' instead of 'offsetWidth' for properly excluding - // all sorts of empty paragraph, e.g.
      . - var isInvisible = whitespace( node ) || node.is && !node.$.offsetHeight; - return isReject ^ isInvisible; - }; - }; - - var tailNbspRegex = /^[\t\r\n ]*(?: |\xa0)$/, - isNotWhitespaces = CKEDITOR.dom.walker.whitespaces( true ), - isNotBookmark = CKEDITOR.dom.walker.bookmark( false, true ), - fillerEvaluator = function( element ) - { - return isNotBookmark( element ) && isNotWhitespaces( element ); - }; - - // Check if there's a filler node at the end of an element, and return it. - CKEDITOR.dom.element.prototype.getBogus = function () - { - var tail = this.getLast( fillerEvaluator ); - if ( tail && ( !CKEDITOR.env.ie ? tail.is && tail.is( 'br' ) - : tail.getText && tailNbspRegex.test( tail.getText() ) ) ) - { - return tail; - } - return false; - }; - -})(); diff --git a/public/javascripts/ckeditor/_source/core/dom/window.js b/public/javascripts/ckeditor/_source/core/dom/window.js deleted file mode 100644 index 01e2d58..0000000 --- a/public/javascripts/ckeditor/_source/core/dom/window.js +++ /dev/null @@ -1,96 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Defines the {@link CKEDITOR.dom.document} class, which - * represents a DOM document. - */ - -/** - * Represents a DOM window. - * @constructor - * @augments CKEDITOR.dom.domObject - * @param {Object} domWindow A native DOM window. - * @example - * var document = new CKEDITOR.dom.window( window ); - */ -CKEDITOR.dom.window = function( domWindow ) -{ - CKEDITOR.dom.domObject.call( this, domWindow ); -}; - -CKEDITOR.dom.window.prototype = new CKEDITOR.dom.domObject(); - -CKEDITOR.tools.extend( CKEDITOR.dom.window.prototype, - /** @lends CKEDITOR.dom.window.prototype */ - { - /** - * Moves the selection focus to this window. - * @function - * @example - * var win = new CKEDITOR.dom.window( window ); - * win.focus(); - */ - focus : function() - { - // Webkit is sometimes failed to focus iframe, blur it first(#3835). - if ( CKEDITOR.env.webkit && this.$.parent ) - this.$.parent.focus(); - this.$.focus(); - }, - - /** - * Gets the width and height of this window's viewable area. - * @function - * @returns {Object} An object with the "width" and "height" - * properties containing the size. - * @example - * var win = new CKEDITOR.dom.window( window ); - * var size = win.getViewPaneSize(); - * alert( size.width ); - * alert( size.height ); - */ - getViewPaneSize : function() - { - var doc = this.$.document, - stdMode = doc.compatMode == 'CSS1Compat'; - return { - width : ( stdMode ? doc.documentElement.clientWidth : doc.body.clientWidth ) || 0, - height : ( stdMode ? doc.documentElement.clientHeight : doc.body.clientHeight ) || 0 - }; - }, - - /** - * Gets the current position of the window's scroll. - * @function - * @returns {Object} An object with the "x" and "y" properties - * containing the scroll position. - * @example - * var win = new CKEDITOR.dom.window( window ); - * var pos = win.getScrollPosition(); - * alert( pos.x ); - * alert( pos.y ); - */ - getScrollPosition : function() - { - var $ = this.$; - - if ( 'pageXOffset' in $ ) - { - return { - x : $.pageXOffset || 0, - y : $.pageYOffset || 0 - }; - } - else - { - var doc = $.document; - return { - x : doc.documentElement.scrollLeft || doc.body.scrollLeft || 0, - y : doc.documentElement.scrollTop || doc.body.scrollTop || 0 - }; - } - } - }); diff --git a/public/javascripts/ckeditor/_source/core/dtd.js b/public/javascripts/ckeditor/_source/core/dtd.js deleted file mode 100644 index d5af5bf..0000000 --- a/public/javascripts/ckeditor/_source/core/dtd.js +++ /dev/null @@ -1,233 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Defines the {@link CKEDITOR.dtd} object, which holds the DTD - * mapping for XHTML 1.0 Transitional. This file was automatically - * generated from the file: xhtml1-transitional.dtd. - */ - -/** - * Holds and object representation of the HTML DTD to be used by the editor in - * its internal operations. - * - * Each element in the DTD is represented by a - * property in this object. Each property contains the list of elements that - * can be contained by the element. Text is represented by the "#" property. - * - * Several special grouping properties are also available. Their names start - * with the "$" character. - * @namespace - * @example - * // Check if "div" can be contained in a "p" element. - * alert( !!CKEDITOR.dtd[ 'p' ][ 'div' ] ); "false" - * @example - * // Check if "p" can be contained in a "div" element. - * alert( !!CKEDITOR.dtd[ 'div' ][ 'p' ] ); "true" - * @example - * // Check if "p" is a block element. - * alert( !!CKEDITOR.dtd.$block[ 'p' ] ); "true" - */ -CKEDITOR.dtd = (function() -{ - var X = CKEDITOR.tools.extend, - - A = {isindex:1,fieldset:1}, - B = {input:1,button:1,select:1,textarea:1,label:1}, - C = X({a:1},B), - D = X({iframe:1},C), - E = {hr:1,ul:1,menu:1,div:1,blockquote:1,noscript:1,table:1,center:1,address:1,dir:1,pre:1,h5:1,dl:1,h4:1,noframes:1,h6:1,ol:1,h1:1,h3:1,h2:1}, - F = {ins:1,del:1,script:1,style:1}, - G = X({b:1,acronym:1,bdo:1,'var':1,'#':1,abbr:1,code:1,br:1,i:1,cite:1,kbd:1,u:1,strike:1,s:1,tt:1,strong:1,q:1,samp:1,em:1,dfn:1,span:1},F), - H = X({sub:1,img:1,object:1,sup:1,basefont:1,map:1,applet:1,font:1,big:1,small:1},G), - I = X({p:1},H), - J = X({iframe:1},H,B), - K = {img:1,noscript:1,br:1,kbd:1,center:1,button:1,basefont:1,h5:1,h4:1,samp:1,h6:1,ol:1,h1:1,h3:1,h2:1,form:1,font:1,'#':1,select:1,menu:1,ins:1,abbr:1,label:1,code:1,table:1,script:1,cite:1,input:1,iframe:1,strong:1,textarea:1,noframes:1,big:1,small:1,span:1,hr:1,sub:1,bdo:1,'var':1,div:1,object:1,sup:1,strike:1,dir:1,map:1,dl:1,applet:1,del:1,isindex:1,fieldset:1,ul:1,b:1,acronym:1,a:1,blockquote:1,i:1,u:1,s:1,tt:1,address:1,q:1,pre:1,p:1,em:1,dfn:1}, - - L = X({a:1},J), - M = {tr:1}, - N = {'#':1}, - O = X({param:1},K), - P = X({form:1},A,D,E,I), - Q = {li:1}, - R = {style:1,script:1}, - S = {base:1,link:1,meta:1,title:1}, - T = X(S,R), - U = {head:1,body:1}, - V = {html:1}; - - var block = {address:1,blockquote:1,center:1,dir:1,div:1,dl:1,fieldset:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,isindex:1,menu:1,noframes:1,ol:1,p:1,pre:1,table:1,ul:1}; - - return /** @lends CKEDITOR.dtd */ { - - // The "$" items have been added manually. - - // List of elements living outside body. - $nonBodyContent: X(V,U,S), - - /** - * List of block elements, like "p" or "div". - * @type Object - * @example - */ - $block : block, - - /** - * List of block limit elements. - * @type Object - * @example - */ - $blockLimit : { body:1,div:1,td:1,th:1,caption:1,form:1 }, - - $inline : L, // Just like span. - - $body : X({script:1,style:1}, block), - - $cdata : {script:1,style:1}, - - /** - * List of empty (self-closing) elements, like "br" or "img". - * @type Object - * @example - */ - $empty : {area:1,base:1,br:1,col:1,hr:1,img:1,input:1,link:1,meta:1,param:1}, - - /** - * List of list item elements, like "li" or "dd". - * @type Object - * @example - */ - $listItem : {dd:1,dt:1,li:1}, - - /** - * List of list root elements. - * @type Object - * @example - */ - $list: { ul:1,ol:1,dl:1}, - - /** - * Elements that accept text nodes, but are not possible to edit into - * the browser. - * @type Object - * @example - */ - $nonEditable : {applet:1,button:1,embed:1,iframe:1,map:1,object:1,option:1,script:1,textarea:1,param:1}, - - /** - * List of elements that can be ignored if empty, like "b" or "span". - * @type Object - * @example - */ - $removeEmpty : {abbr:1,acronym:1,address:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,s:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1}, - - /** - * List of elements that have tabindex set to zero by default. - * @type Object - * @example - */ - $tabIndex : {a:1,area:1,button:1,input:1,object:1,select:1,textarea:1}, - - /** - * List of elements used inside the "table" element, like "tbody" or "td". - * @type Object - * @example - */ - $tableContent : {caption:1,col:1,colgroup:1,tbody:1,td:1,tfoot:1,th:1,thead:1,tr:1}, - - html: U, - head: T, - style: N, - script: N, - body: P, - base: {}, - link: {}, - meta: {}, - title: N, - col : {}, - tr : {td:1,th:1}, - img : {}, - colgroup : {col:1}, - noscript : P, - td : P, - br : {}, - th : P, - center : P, - kbd : L, - button : X(I,E), - basefont : {}, - h5 : L, - h4 : L, - samp : L, - h6 : L, - ol : Q, - h1 : L, - h3 : L, - option : N, - h2 : L, - form : X(A,D,E,I), - select : {optgroup:1,option:1}, - font : L, - ins : L, - menu : Q, - abbr : L, - label : L, - table : {thead:1,col:1,tbody:1,tr:1,colgroup:1,caption:1,tfoot:1}, - code : L, - script : N, - tfoot : M, - cite : L, - li : P, - input : {}, - iframe : P, - strong : L, - textarea : N, - noframes : P, - big : L, - small : L, - span : L, - hr : {}, - dt : L, - sub : L, - optgroup : {option:1}, - param : {}, - bdo : L, - 'var' : L, - div : P, - object : O, - sup : L, - dd : P, - strike : L, - area : {}, - dir : Q, - map : X({area:1,form:1,p:1},A,F,E), - applet : O, - dl : {dt:1,dd:1}, - del : L, - isindex : {}, - fieldset : X({legend:1},K), - thead : M, - ul : Q, - acronym : L, - b : L, - a : J, - blockquote : P, - caption : L, - i : L, - u : L, - tbody : M, - s : L, - address : X(D,I), - tt : L, - legend : L, - q : L, - pre : X(G,C), - p : L, - em : L, - dfn : L - }; -})(); - -// PACKAGER_RENAME( CKEDITOR.dtd ) diff --git a/public/javascripts/ckeditor/_source/core/editor.js b/public/javascripts/ckeditor/_source/core/editor.js deleted file mode 100644 index f0f3682..0000000 --- a/public/javascripts/ckeditor/_source/core/editor.js +++ /dev/null @@ -1,756 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Defines the {@link CKEDITOR.editor} class, which represents an - * editor instance. - */ - -(function() -{ - // The counter for automatic instance names. - var nameCounter = 0; - - var getNewName = function() - { - var name = 'editor' + ( ++nameCounter ); - return ( CKEDITOR.instances && CKEDITOR.instances[ name ] ) ? getNewName() : name; - }; - - // ##### START: Config Privates - - // These function loads custom configuration files and cache the - // CKEDITOR.editorConfig functions defined on them, so there is no need to - // download them more than once for several instances. - var loadConfigLoaded = {}; - var loadConfig = function( editor ) - { - var customConfig = editor.config.customConfig; - - // Check if there is a custom config to load. - if ( !customConfig ) - return false; - - customConfig = CKEDITOR.getUrl( customConfig ); - - var loadedConfig = loadConfigLoaded[ customConfig ] || ( loadConfigLoaded[ customConfig ] = {} ); - - // If the custom config has already been downloaded, reuse it. - if ( loadedConfig.fn ) - { - // Call the cached CKEDITOR.editorConfig defined in the custom - // config file for the editor instance depending on it. - loadedConfig.fn.call( editor, editor.config ); - - // If there is no other customConfig in the chain, fire the - // "configLoaded" event. - if ( CKEDITOR.getUrl( editor.config.customConfig ) == customConfig || !loadConfig( editor ) ) - editor.fireOnce( 'customConfigLoaded' ); - } - else - { - // Load the custom configuration file. - CKEDITOR.scriptLoader.load( customConfig, function() - { - // If the CKEDITOR.editorConfig function has been properly - // defined in the custom configuration file, cache it. - if ( CKEDITOR.editorConfig ) - loadedConfig.fn = CKEDITOR.editorConfig; - else - loadedConfig.fn = function(){}; - - // Call the load config again. This time the custom - // config is already cached and so it will get loaded. - loadConfig( editor ); - }); - } - - return true; - }; - - var initConfig = function( editor, instanceConfig ) - { - // Setup the lister for the "customConfigLoaded" event. - editor.on( 'customConfigLoaded', function() - { - if ( instanceConfig ) - { - // Register the events that may have been set at the instance - // configuration object. - if ( instanceConfig.on ) - { - for ( var eventName in instanceConfig.on ) - { - editor.on( eventName, instanceConfig.on[ eventName ] ); - } - } - - // Overwrite the settings from the in-page config. - CKEDITOR.tools.extend( editor.config, instanceConfig, true ); - - delete editor.config.on; - } - - onConfigLoaded( editor ); - }); - - // The instance config may override the customConfig setting to avoid - // loading the default ~/config.js file. - if ( instanceConfig && instanceConfig.customConfig != undefined ) - editor.config.customConfig = instanceConfig.customConfig; - - // Load configs from the custom configuration files. - if ( !loadConfig( editor ) ) - editor.fireOnce( 'customConfigLoaded' ); - }; - - // ##### END: Config Privates - - var onConfigLoaded = function( editor ) - { - // Set config related properties. - - var skin = editor.config.skin.split( ',' ), - skinName = skin[ 0 ], - skinPath = CKEDITOR.getUrl( skin[ 1 ] || ( - '_source/' + // @Packager.RemoveLine - 'skins/' + skinName + '/' ) ); - - editor.skinName = skinName; - editor.skinPath = skinPath; - editor.skinClass = 'cke_skin_' + skinName; - - editor.tabIndex = editor.config.tabIndex || editor.element.getAttribute( 'tabindex' ) || 0; - - // Fire the "configLoaded" event. - editor.fireOnce( 'configLoaded' ); - - // Load language file. - loadSkin( editor ); - }; - - var loadLang = function( editor ) - { - CKEDITOR.lang.load( editor.config.language, editor.config.defaultLanguage, function( languageCode, lang ) - { - editor.langCode = languageCode; - - // As we'll be adding plugin specific entries that could come - // from different language code files, we need a copy of lang, - // not a direct reference to it. - editor.lang = CKEDITOR.tools.prototypedCopy( lang ); - - // We're not able to support RTL in Firefox 2 at this time. - if ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 && editor.lang.dir == 'rtl' ) - editor.lang.dir = 'ltr'; - - loadPlugins( editor ); - }); - }; - - var loadPlugins = function( editor ) - { - var config = editor.config, - plugins = config.plugins, - extraPlugins = config.extraPlugins, - removePlugins = config.removePlugins; - - if ( extraPlugins ) - { - // Remove them first to avoid duplications. - var removeRegex = new RegExp( '(?:^|,)(?:' + extraPlugins.replace( /\s*,\s*/g, '|' ) + ')(?=,|$)' , 'g' ); - plugins = plugins.replace( removeRegex, '' ); - - plugins += ',' + extraPlugins; - } - - if ( removePlugins ) - { - removeRegex = new RegExp( '(?:^|,)(?:' + removePlugins.replace( /\s*,\s*/g, '|' ) + ')(?=,|$)' , 'g' ); - plugins = plugins.replace( removeRegex, '' ); - } - - // Load all plugins defined in the "plugins" setting. - CKEDITOR.plugins.load( plugins.split( ',' ), function( plugins ) - { - // The list of plugins. - var pluginsArray = []; - - // The language code to get loaded for each plugin. Null - // entries will be appended for plugins with no language files. - var languageCodes = []; - - // The list of URLs to language files. - var languageFiles = []; - - // Cache the loaded plugin names. - editor.plugins = plugins; - - // Loop through all plugins, to build the list of language - // files to get loaded. - for ( var pluginName in plugins ) - { - var plugin = plugins[ pluginName ], - pluginLangs = plugin.lang, - pluginPath = CKEDITOR.plugins.getPath( pluginName ), - lang = null; - - // Set the plugin path in the plugin. - plugin.path = pluginPath; - - // If the plugin has "lang". - if ( pluginLangs ) - { - // Resolve the plugin language. If the current language - // is not available, get the first one (default one). - lang = ( CKEDITOR.tools.indexOf( pluginLangs, editor.langCode ) >= 0 ? editor.langCode : pluginLangs[ 0 ] ); - - if ( !plugin.lang[ lang ] ) - { - // Put the language file URL into the list of files to - // get downloaded. - languageFiles.push( CKEDITOR.getUrl( pluginPath + 'lang/' + lang + '.js' ) ); - } - else - { - CKEDITOR.tools.extend( editor.lang, plugin.lang[ lang ] ); - lang = null; - } - } - - // Save the language code, so we know later which - // language has been resolved to this plugin. - languageCodes.push( lang ); - - pluginsArray.push( plugin ); - } - - // Load all plugin specific language files in a row. - CKEDITOR.scriptLoader.load( languageFiles, function() - { - // Initialize all plugins that have the "beforeInit" and "init" methods defined. - var methods = [ 'beforeInit', 'init', 'afterInit' ]; - for ( var m = 0 ; m < methods.length ; m++ ) - { - for ( var i = 0 ; i < pluginsArray.length ; i++ ) - { - var plugin = pluginsArray[ i ]; - - // Uses the first loop to update the language entries also. - if ( m === 0 && languageCodes[ i ] && plugin.lang ) - CKEDITOR.tools.extend( editor.lang, plugin.lang[ languageCodes[ i ] ] ); - - // Call the plugin method (beforeInit and init). - if ( plugin[ methods[ m ] ] ) - plugin[ methods[ m ] ]( editor ); - } - } - - // Load the editor skin. - editor.fire( 'pluginsLoaded' ); - loadTheme( editor ); - }); - }); - }; - - var loadSkin = function( editor ) - { - CKEDITOR.skins.load( editor, 'editor', function() - { - loadLang( editor ); - }); - }; - - var loadTheme = function( editor ) - { - var theme = editor.config.theme; - CKEDITOR.themes.load( theme, function() - { - var editorTheme = editor.theme = CKEDITOR.themes.get( theme ); - editorTheme.path = CKEDITOR.themes.getPath( theme ); - editorTheme.build( editor ); - - if ( editor.config.autoUpdateElement ) - attachToForm( editor ); - }); - }; - - var attachToForm = function( editor ) - { - var element = editor.element; - - // If are replacing a textarea, we must - if ( editor.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE && element.is( 'textarea' ) ) - { - var form = element.$.form && new CKEDITOR.dom.element( element.$.form ); - if ( form ) - { - function onSubmit() - { - editor.updateElement(); - } - form.on( 'submit',onSubmit ); - - // Setup the submit function because it doesn't fire the - // "submit" event. - if ( !form.$.submit.nodeName ) - { - form.$.submit = CKEDITOR.tools.override( form.$.submit, function( originalSubmit ) - { - return function() - { - editor.updateElement(); - - // For IE, the DOM submit function is not a - // function, so we need thid check. - if ( originalSubmit.apply ) - originalSubmit.apply( this, arguments ); - else - originalSubmit(); - }; - }); - } - - // Remove 'submit' events registered on form element before destroying.(#3988) - editor.on( 'destroy', function() - { - form.removeListener( 'submit', onSubmit ); - } ); - } - } - }; - - function updateCommandsMode() - { - var command, - commands = this._.commands, - mode = this.mode; - - for ( var name in commands ) - { - command = commands[ name ]; - command[ command.startDisabled ? 'disable' : command.modes[ mode ] ? 'enable' : 'disable' ](); - } - } - - /** - * Initializes the editor instance. This function is called by the editor - * contructor (editor_basic.js). - * @private - */ - CKEDITOR.editor.prototype._init = function() - { - // Get the properties that have been saved in the editor_base - // implementation. - var element = CKEDITOR.dom.element.get( this._.element ), - instanceConfig = this._.instanceConfig; - delete this._.element; - delete this._.instanceConfig; - - this._.commands = {}; - this._.styles = []; - - /** - * The DOM element that has been replaced by this editor instance. This - * element holds the editor data on load and post. - * @name CKEDITOR.editor.prototype.element - * @type CKEDITOR.dom.element - * @example - * var editor = CKEDITOR.instances.editor1; - * alert( editor.element.getName() ); "textarea" - */ - this.element = element; - - /** - * The editor instance name. It hay be the replaced element id, name or - * a default name using a progressive counter (editor1, editor2, ...). - * @name CKEDITOR.editor.prototype.name - * @type String - * @example - * var editor = CKEDITOR.instances.editor1; - * alert( editor.name ); "editor1" - */ - this.name = ( element && ( this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE ) - && ( element.getId() || element.getNameAtt() ) ) - || getNewName(); - - if ( this.name in CKEDITOR.instances ) - throw '[CKEDITOR.editor] The instance "' + this.name + '" already exists.'; - - /** - * The configurations for this editor instance. It inherits all - * settings defined in (@link CKEDITOR.config}, combined with settings - * loaded from custom configuration files and those defined inline in - * the page when creating the editor. - * @name CKEDITOR.editor.prototype.config - * @type Object - * @example - * var editor = CKEDITOR.instances.editor1; - * alert( editor.config.theme ); "default" e.g. - */ - this.config = CKEDITOR.tools.prototypedCopy( CKEDITOR.config ); - - /** - * Namespace containing UI features related to this editor instance. - * @name CKEDITOR.editor.prototype.ui - * @type CKEDITOR.ui - * @example - */ - this.ui = new CKEDITOR.ui( this ); - - /** - * Controls the focus state of this editor instance. This property - * is rarely used for normal API operations. It is mainly - * destinated to developer adding UI elements to the editor interface. - * @name CKEDITOR.editor.prototype.focusManager - * @type CKEDITOR.focusManager - * @example - */ - this.focusManager = new CKEDITOR.focusManager( this ); - - CKEDITOR.fire( 'instanceCreated', null, this ); - - this.on( 'mode', updateCommandsMode, null, null, 1 ); - - initConfig( this, instanceConfig ); - }; -})(); - -CKEDITOR.tools.extend( CKEDITOR.editor.prototype, - /** @lends CKEDITOR.editor.prototype */ - { - /** - * Adds a command definition to the editor instance. Commands added with - * this function can be later executed with {@link #execCommand}. - * @param {String} commandName The indentifier name of the command. - * @param {CKEDITOR.commandDefinition} commandDefinition The command definition. - * @example - * editorInstance.addCommand( 'sample', - * { - * exec : function( editor ) - * { - * alert( 'Executing a command for the editor name "' + editor.name + '"!' ); - * } - * }); - */ - addCommand : function( commandName, commandDefinition ) - { - return this._.commands[ commandName ] = new CKEDITOR.command( this, commandDefinition ); - }, - - /** - * Add a trunk of css text to the editor which will be applied to the wysiwyg editing document. - * Note: This function should be called before editor is loaded to take effect. - * @param css {String} CSS text. - * @example - * editorInstance.addCss( 'body { background-color: grey; }' ); - */ - addCss : function( css ) - { - this._.styles.push( css ); - }, - - /** - * Destroys the editor instance, releasing all resources used by it. - * If the editor replaced an element, the element will be recovered. - * @param {Boolean} [noUpdate] If the instance is replacing a DOM - * element, this parameter indicates whether or not to update the - * element with the instance contents. - * @example - * alert( CKEDITOR.instances.editor1 ); e.g "object" - * CKEDITOR.instances.editor1.destroy(); - * alert( CKEDITOR.instances.editor1 ); "undefined" - */ - destroy : function( noUpdate ) - { - if ( !noUpdate ) - this.updateElement(); - - if ( this.mode ) - { - // -> currentMode.unload( holderElement ); - this._.modes[ this.mode ].unload( this.getThemeSpace( 'contents' ) ); - } - - this.theme.destroy( this ); - - var toolbars, - index = 0, - j, - items, - instance; - - if ( this.toolbox ) - { - toolbars = this.toolbox.toolbars; - for ( ; index < toolbars.length ; index++ ) - { - items = toolbars[ index ].items; - for ( j = 0 ; j < items.length ; j++ ) - { - instance = items[ j ]; - if ( instance.clickFn ) CKEDITOR.tools.removeFunction( instance.clickFn ); - if ( instance.keyDownFn ) CKEDITOR.tools.removeFunction( instance.keyDownFn ); - - if ( instance.index ) CKEDITOR.ui.button._.instances[ instance.index ] = null; - } - } - } - - if ( this.contextMenu ) - CKEDITOR.tools.removeFunction( this.contextMenu._.functionId ); - - if ( this._.filebrowserFn ) - CKEDITOR.tools.removeFunction( this._.filebrowserFn ); - - this.fire( 'destroy' ); - CKEDITOR.remove( this ); - CKEDITOR.fire( 'instanceDestroyed', null, this ); - }, - - /** - * Executes a command. - * @param {String} commandName The indentifier name of the command. - * @param {Object} [data] Data to be passed to the command - * @returns {Boolean} "true" if the command has been successfuly - * executed, otherwise "false". - * @example - * editorInstance.execCommand( 'Bold' ); - */ - execCommand : function( commandName, data ) - { - var command = this.getCommand( commandName ); - - var eventData = - { - name: commandName, - commandData: data, - command: command - }; - - if ( command && command.state != CKEDITOR.TRISTATE_DISABLED ) - { - if ( this.fire( 'beforeCommandExec', eventData ) !== true ) - { - eventData.returnValue = command.exec( eventData.commandData ); - - // Fire the 'afterCommandExec' immediately if command is synchronous. - if ( !command.async && this.fire( 'afterCommandExec', eventData ) !== true ) - return eventData.returnValue; - } - } - - // throw 'Unknown command name "' + commandName + '"'; - return false; - }, - - /** - * Gets one of the registered commands. Note that, after registering a - * command definition with addCommand, it is transformed internally - * into an instance of {@link CKEDITOR.command}, which will be then - * returned by this function. - * @param {String} commandName The name of the command to be returned. - * This is the same used to register the command with addCommand. - * @returns {CKEDITOR.command} The command object identified by the - * provided name. - */ - getCommand : function( commandName ) - { - return this._.commands[ commandName ]; - }, - - /** - * Gets the editor data. The data will be in raw format. It is the same - * data that is posted by the editor. - * @type String - * @returns (String) The editor data. - * @example - * if ( CKEDITOR.instances.editor1.getData() == '' ) - * alert( 'There is no data available' ); - */ - getData : function() - { - this.fire( 'beforeGetData' ); - - var eventData = this._.data; - - if ( typeof eventData != 'string' ) - { - var element = this.element; - if ( element && this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE ) - eventData = element.is( 'textarea' ) ? element.getValue() : element.getHtml(); - else - eventData = ''; - } - - eventData = { dataValue : eventData }; - - // Fire "getData" so data manipulation may happen. - this.fire( 'getData', eventData ); - - return eventData.dataValue; - }, - - getSnapshot : function() - { - var data = this.fire( 'getSnapshot' ); - - if ( typeof data != 'string' ) - { - var element = this.element; - if ( element && this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE ) - data = element.is( 'textarea' ) ? element.getValue() : element.getHtml(); - } - - return data; - }, - - loadSnapshot : function( snapshot ) - { - this.fire( 'loadSnapshot', snapshot ); - }, - - /** - * Sets the editor data. The data must be provided in raw format (HTML).
      - *
      - * Note that this menthod is asynchronous. The "callback" parameter must - * be used if interaction with the editor is needed after setting the data. - * @param {String} data HTML code to replace the curent content in the - * editor. - * @param {Function} callback Function to be called after the setData - * is completed. - * @example - * CKEDITOR.instances.editor1.setData( '<p>This is the editor data.</p>' ); - * @example - * CKEDITOR.instances.editor1.setData( '<p>Some other editor data.</p>', function() - * { - * this.checkDirty(); // true - * }); - */ - setData : function( data , callback ) - { - if( callback ) - { - this.on( 'dataReady', function( evt ) - { - evt.removeListener(); - callback.call( evt.editor ); - } ); - } - - // Fire "setData" so data manipulation may happen. - var eventData = { dataValue : data }; - this.fire( 'setData', eventData ); - - this._.data = eventData.dataValue; - - this.fire( 'afterSetData', eventData ); - }, - - /** - * Inserts HTML into the currently selected position in the editor. - * @param {String} data HTML code to be inserted into the editor. - * @example - * CKEDITOR.instances.editor1.insertHtml( '<p>This is a new paragraph.</p>' ); - */ - insertHtml : function( data ) - { - this.fire( 'insertHtml', data ); - }, - - /** - * Inserts an element into the currently selected position in the - * editor. - * @param {CKEDITOR.dom.element} element The element to be inserted - * into the editor. - * @example - * var element = CKEDITOR.dom.element.createFromHtml( '<img src="hello.png" border="0" title="Hello" />' ); - * CKEDITOR.instances.editor1.insertElement( element ); - */ - insertElement : function( element ) - { - this.fire( 'insertElement', element ); - }, - - checkDirty : function() - { - return ( this.mayBeDirty && this._.previousValue !== this.getSnapshot() ); - }, - - resetDirty : function() - { - if ( this.mayBeDirty ) - this._.previousValue = this.getSnapshot(); - }, - - /** - * Updates the <textarea> element that has been replaced by the editor with - * the current data available in the editor. - * @example - * CKEDITOR.instances.editor1.updateElement(); - * alert( document.getElementById( 'editor1' ).value ); // The current editor data. - */ - updateElement : function() - { - var element = this.element; - if ( element && this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE ) - { - var data = this.getData(); - - if ( this.config.htmlEncodeOutput ) - data = CKEDITOR.tools.htmlEncode( data ); - - if ( element.is( 'textarea' ) ) - element.setValue( data ); - else - element.setHtml( data ); - } - } - }); - -CKEDITOR.on( 'loaded', function() - { - // Run the full initialization for pending editors. - var pending = CKEDITOR.editor._pending; - if ( pending ) - { - delete CKEDITOR.editor._pending; - - for ( var i = 0 ; i < pending.length ; i++ ) - pending[ i ]._init(); - } - }); - -/** - * Whether escape HTML when editor update original input element. - * @name CKEDITOR.config.htmlEncodeOutput - * @since 3.1 - * @type Boolean - * @default false - * @example - * config.htmlEncodeOutput = true; - */ - -/** - * Fired when a CKEDITOR instance is created, but still before initializing it. - * To interact with a fully initialized instance, use the - * {@link CKEDITOR#instanceReady} event instead. - * @name CKEDITOR#instanceCreated - * @event - * @param {CKEDITOR.editor} editor The editor instance that has been created. - */ - -/** - * Fired when a CKEDITOR instance is destroyed. - * @name CKEDITOR#instanceDestroyed - * @event - * @param {CKEDITOR.editor} editor The editor instance that has been destroyed. - */ - -/** - * Fired when all plugins are loaded and initialized into the editor instance. - * @name CKEDITOR#pluginsLoaded - * @event - */ diff --git a/public/javascripts/ckeditor/_source/core/editor_basic.js b/public/javascripts/ckeditor/_source/core/editor_basic.js deleted file mode 100644 index ec90bf7..0000000 --- a/public/javascripts/ckeditor/_source/core/editor_basic.js +++ /dev/null @@ -1,182 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -if ( !CKEDITOR.editor ) -{ - /** - * No element is linked to the editor instance. - * @constant - * @example - */ - CKEDITOR.ELEMENT_MODE_NONE = 0; - - /** - * The element is to be replaced by the editor instance. - * @constant - * @example - */ - CKEDITOR.ELEMENT_MODE_REPLACE = 1; - - /** - * The editor is to be created inside the element. - * @constant - * @example - */ - CKEDITOR.ELEMENT_MODE_APPENDTO = 2; - - /** - * Represents an editor instance. This constructor should be rarely used, - * being the {@link CKEDITOR} methods preferible. - * @constructor - * @param {Object} instanceConfig Configuration values for this specific - * instance. - * @param {CKEDITOR.dom.element} [element] The element linked to this - * instance. - * @param {Number} [mode] The mode in which the element is linked to this - * instance. - * @param {String} [data] Since 3.3. Initial value for the instance. - * @augments CKEDITOR.event - * @example - */ - CKEDITOR.editor = function( instanceConfig, element, mode, data ) - { - this._ = - { - // Save the config to be processed later by the full core code. - instanceConfig : instanceConfig, - element : element, - data : data - }; - - /** - * The mode in which the {@link #element} is linked to this editor - * instance. It can be any of the following values: - *
        - *
      • CKEDITOR.ELEMENT_MODE_NONE: No element is linked to the - * editor instance.
      • - *
      • CKEDITOR.ELEMENT_MODE_REPLACE: The element is to be - * replaced by the editor instance.
      • - *
      • CKEDITOR.ELEMENT_MODE_APPENDTO: The editor is to be - * created inside the element.
      • - *
      - * @name CKEDITOR.editor.prototype.elementMode - * @type Number - * @example - * var editor = CKEDITOR.replace( 'editor1' ); - * alert( editor.elementMode ); "1" - */ - this.elementMode = mode || CKEDITOR.ELEMENT_MODE_NONE; - - // Call the CKEDITOR.event constructor to initialize this instance. - CKEDITOR.event.call( this ); - - this._init(); - }; - - /** - * Replaces a <textarea> or a DOM element (DIV) with a CKEditor - * instance. For textareas, the initial value in the editor will be the - * textarea value. For DOM elements, their innerHTML will be used - * instead. We recommend using TEXTAREA and DIV elements only. Do not use - * this function directly. Use {@link CKEDITOR.replace} instead. - * @param {Object|String} elementOrIdOrName The DOM element (textarea), its - * ID or name. - * @param {Object} [config] The specific configurations to apply to this - * editor instance. Configurations set here will override global CKEditor - * settings. - * @returns {CKEDITOR.editor} The editor instance created. - * @example - */ - CKEDITOR.editor.replace = function( elementOrIdOrName, config ) - { - var element = elementOrIdOrName; - - if ( typeof element != 'object' ) - { - // Look for the element by id. We accept any kind of element here. - element = document.getElementById( elementOrIdOrName ); - - // If not found, look for elements by name. In this case we accept only - // textareas. - if ( !element ) - { - var i = 0, - textareasByName = document.getElementsByName( elementOrIdOrName ); - - while ( ( element = textareasByName[ i++ ] ) && element.tagName.toLowerCase() != 'textarea' ) - { /*jsl:pass*/ } - } - - if ( !element ) - throw '[CKEDITOR.editor.replace] The element with id or name "' + elementOrIdOrName + '" was not found.'; - } - - // Do not replace the textarea right now, just hide it. The effective - // replacement will be done by the _init function. - element.style.visibility = 'hidden'; - - // Create the editor instance. - return new CKEDITOR.editor( config, element, CKEDITOR.ELEMENT_MODE_REPLACE ); - }; - - /** - * Creates a new editor instance inside a specific DOM element. Do not use - * this function directly. Use {@link CKEDITOR.appendTo} instead. - * @param {Object|String} elementOrId The DOM element or its ID. - * @param {Object} [config] The specific configurations to apply to this - * editor instance. Configurations set here will override global CKEditor - * settings. - * @param {String} [data] Since 3.3. Initial value for the instance. - * @returns {CKEDITOR.editor} The editor instance created. - * @example - */ - CKEDITOR.editor.appendTo = function( elementOrId, config, data ) - { - var element = elementOrId; - if ( typeof element != 'object' ) - { - element = document.getElementById( elementOrId ); - - if ( !element ) - throw '[CKEDITOR.editor.appendTo] The element with id "' + elementOrId + '" was not found.'; - } - - // Create the editor instance. - return new CKEDITOR.editor( config, element, CKEDITOR.ELEMENT_MODE_APPENDTO, data ); - }; - - CKEDITOR.editor.prototype = - { - /** - * Initializes the editor instance. This function will be overriden by the - * full CKEDITOR.editor implementation (editor.js). - * @private - */ - _init : function() - { - var pending = CKEDITOR.editor._pending || ( CKEDITOR.editor._pending = [] ); - pending.push( this ); - }, - - // Both fire and fireOnce will always pass this editor instance as the - // "editor" param in CKEDITOR.event.fire. So, we override it to do that - // automaticaly. - - /** @ignore */ - fire : function( eventName, data ) - { - return CKEDITOR.event.prototype.fire.call( this, eventName, data, this ); - }, - - /** @ignore */ - fireOnce : function( eventName, data ) - { - return CKEDITOR.event.prototype.fireOnce.call( this, eventName, data, this ); - } - }; - - // "Inherit" (copy actually) from CKEDITOR.event. - CKEDITOR.event.implementOn( CKEDITOR.editor.prototype, true ); -} diff --git a/public/javascripts/ckeditor/_source/core/env.js b/public/javascripts/ckeditor/_source/core/env.js deleted file mode 100644 index b289538..0000000 --- a/public/javascripts/ckeditor/_source/core/env.js +++ /dev/null @@ -1,222 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Defines the {@link CKEDITOR.env} object, which constains - * environment and browser information. - */ - -if ( !CKEDITOR.env ) -{ - /** - * Environment and browser information. - * @namespace - * @example - */ - CKEDITOR.env = (function() - { - var agent = navigator.userAgent.toLowerCase(); - var opera = window.opera; - - var env = - /** @lends CKEDITOR.env */ - { - /** - * Indicates that CKEditor is running on Internet Explorer. - * @type Boolean - * @example - * if ( CKEDITOR.env.ie ) - * alert( "I'm on IE!" ); - */ - ie : /*@cc_on!@*/false, - - /** - * Indicates that CKEditor is running on Opera. - * @type Boolean - * @example - * if ( CKEDITOR.env.opera ) - * alert( "I'm on Opera!" ); - */ - opera : ( !!opera && opera.version ), - - /** - * Indicates that CKEditor is running on a WebKit based browser, like - * Safari. - * @type Boolean - * @example - * if ( CKEDITOR.env.webkit ) - * alert( "I'm on WebKit!" ); - */ - webkit : ( agent.indexOf( ' applewebkit/' ) > -1 ), - - /** - * Indicates that CKEditor is running on Adobe AIR. - * @type Boolean - * @example - * if ( CKEDITOR.env.air ) - * alert( "I'm on AIR!" ); - */ - air : ( agent.indexOf( ' adobeair/' ) > -1 ), - - /** - * Indicates that CKEditor is running on Macintosh. - * @type Boolean - * @example - * if ( CKEDITOR.env.mac ) - * alert( "I love apples!" ); - */ - mac : ( agent.indexOf( 'macintosh' ) > -1 ), - - quirks : ( document.compatMode == 'BackCompat' ), - - mobile : ( agent.indexOf( 'mobile' ) > -1 ), - - isCustomDomain : function() - { - return this.ie && document.domain != window.location.hostname; - } - }; - - /** - * Indicates that CKEditor is running on a Gecko based browser, like - * Firefox. - * @name CKEDITOR.env.gecko - * @type Boolean - * @example - * if ( CKEDITOR.env.gecko ) - * alert( "I'm riding a gecko!" ); - */ - env.gecko = ( navigator.product == 'Gecko' && !env.webkit && !env.opera ); - - var version = 0; - - // Internet Explorer 6.0+ - if ( env.ie ) - { - version = parseFloat( agent.match( /msie (\d+)/ )[1] ); - - /** - * Indicate IE8 browser. - */ - env.ie8 = !!document.documentMode; - - /** - * Indicte IE8 document mode. - */ - env.ie8Compat = document.documentMode == 8; - - /** - * Indicates that CKEditor is running on an IE7-like environment, which - * includes IE7 itself and IE8's IE7 document mode. - * @type Boolean - */ - env.ie7Compat = ( ( version == 7 && !document.documentMode ) - || document.documentMode == 7 ); - - /** - * Indicates that CKEditor is running on an IE6-like environment, which - * includes IE6 itself and IE7 and IE8 quirks mode. - * @type Boolean - * @example - * if ( CKEDITOR.env.ie6Compat ) - * alert( "I'm on IE6 or quirks mode!" ); - */ - env.ie6Compat = ( version < 7 || env.quirks ); - - } - - // Gecko. - if ( env.gecko ) - { - var geckoRelease = agent.match( /rv:([\d\.]+)/ ); - if ( geckoRelease ) - { - geckoRelease = geckoRelease[1].split( '.' ); - version = geckoRelease[0] * 10000 + ( geckoRelease[1] || 0 ) * 100 + ( geckoRelease[2] || 0 ) * 1; - } - } - - // Opera 9.50+ - if ( env.opera ) - version = parseFloat( opera.version() ); - - // Adobe AIR 1.0+ - // Checked before Safari because AIR have the WebKit rich text editor - // features from Safari 3.0.4, but the version reported is 420. - if ( env.air ) - version = parseFloat( agent.match( / adobeair\/(\d+)/ )[1] ); - - // WebKit 522+ (Safari 3+) - if ( env.webkit ) - version = parseFloat( agent.match( / applewebkit\/(\d+)/ )[1] ); - - /** - * Contains the browser version. - * - * For gecko based browsers (like Firefox) it contains the revision - * number with first three parts concatenated with a padding zero - * (e.g. for revision 1.9.0.2 we have 10900). - * - * For webkit based browser (like Safari and Chrome) it contains the - * WebKit build version (e.g. 522). - * @name CKEDITOR.env.version - * @type Boolean - * @example - * if ( CKEDITOR.env.ie && CKEDITOR.env.version <= 6 ) - * alert( "Ouch!" ); - */ - env.version = version; - - /** - * Indicates that CKEditor is running on a compatible browser. - * @name CKEDITOR.env.isCompatible - * @type Boolean - * @example - * if ( CKEDITOR.env.isCompatible ) - * alert( "Your browser is pretty cool!" ); - */ - env.isCompatible = - !env.mobile && ( - ( env.ie && version >= 6 ) || - ( env.gecko && version >= 10801 ) || - ( env.opera && version >= 9.5 ) || - ( env.air && version >= 1 ) || - ( env.webkit && version >= 522 ) || - false ); - - // The CSS class to be appended on the main UI containers, making it - // easy to apply browser specific styles to it. - env.cssClass = - 'cke_browser_' + ( - env.ie ? 'ie' : - env.gecko ? 'gecko' : - env.opera ? 'opera' : - env.air ? 'air' : - env.webkit ? 'webkit' : - 'unknown' ); - - if ( env.quirks ) - env.cssClass += ' cke_browser_quirks'; - - if ( env.ie ) - { - env.cssClass += ' cke_browser_ie' + ( - env.version < 7 ? '6' : - env.version >= 8 ? '8' : - '7' ); - - if ( env.quirks ) - env.cssClass += ' cke_browser_iequirks'; - } - - if ( env.gecko && version < 10900 ) - env.cssClass += ' cke_browser_gecko18'; - - return env; - })(); -} - -// PACKAGER_RENAME( CKEDITOR.env ) -// PACKAGER_RENAME( CKEDITOR.env.ie ) diff --git a/public/javascripts/ckeditor/_source/core/event.js b/public/javascripts/ckeditor/_source/core/event.js deleted file mode 100644 index 8668a3d..0000000 --- a/public/javascripts/ckeditor/_source/core/event.js +++ /dev/null @@ -1,336 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Defines the {@link CKEDITOR.event} class, which serves as the - * base for classes and objects that require event handling features. - */ - -if ( !CKEDITOR.event ) -{ - /** - * This is a base class for classes and objects that require event handling - * features. - * @constructor - * @example - */ - CKEDITOR.event = function() - {}; - - /** - * Implements the {@link CKEDITOR.event} features in an object. - * @param {Object} targetObject The object in which implement the features. - * @example - * var myObject = { message : 'Example' }; - * CKEDITOR.event.implementOn( myObject }; - * myObject.on( 'testEvent', function() - * { - * alert( this.message ); // "Example" - * }); - * myObject.fire( 'testEvent' ); - */ - CKEDITOR.event.implementOn = function( targetObject, isTargetPrototype ) - { - var eventProto = CKEDITOR.event.prototype; - - for ( var prop in eventProto ) - { - if ( targetObject[ prop ] == undefined ) - targetObject[ prop ] = eventProto[ prop ]; - } - }; - - CKEDITOR.event.prototype = (function() - { - // Returns the private events object for a given object. - var getPrivate = function( obj ) - { - var _ = ( obj.getPrivate && obj.getPrivate() ) || obj._ || ( obj._ = {} ); - return _.events || ( _.events = {} ); - }; - - var eventEntry = function( eventName ) - { - this.name = eventName; - this.listeners = []; - }; - - eventEntry.prototype = - { - // Get the listener index for a specified function. - // Returns -1 if not found. - getListenerIndex : function( listenerFunction ) - { - for ( var i = 0, listeners = this.listeners ; i < listeners.length ; i++ ) - { - if ( listeners[i].fn == listenerFunction ) - return i; - } - return -1; - } - }; - - return /** @lends CKEDITOR.event.prototype */ { - /** - * Registers a listener to a specific event in the current object. - * @param {String} eventName The event name to which listen. - * @param {Function} listenerFunction The function listening to the - * event. A single {@link CKEDITOR.eventInfo} object instanced - * is passed to this function containing all the event data. - * @param {Object} [scopeObj] The object used to scope the listener - * call (the this object. If omitted, the current object is used. - * @param {Object} [listenerData] Data to be sent as the - * {@link CKEDITOR.eventInfo#listenerData} when calling the - * listener. - * @param {Number} [priority] The listener priority. Lower priority - * listeners are called first. Listeners with the same priority - * value are called in registration order. Defaults to 10. - * @example - * someObject.on( 'someEvent', function() - * { - * alert( this == someObject ); // "true" - * }); - * @example - * someObject.on( 'someEvent', function() - * { - * alert( this == anotherObject ); // "true" - * } - * , anotherObject ); - * @example - * someObject.on( 'someEvent', function( event ) - * { - * alert( event.listenerData ); // "Example" - * } - * , null, 'Example' ); - * @example - * someObject.on( 'someEvent', function() { ... } ); // 2nd called - * someObject.on( 'someEvent', function() { ... }, null, null, 100 ); // 3rd called - * someObject.on( 'someEvent', function() { ... }, null, null, 1 ); // 1st called - */ - on : function( eventName, listenerFunction, scopeObj, listenerData, priority ) - { - // Get the event entry (create it if needed). - var events = getPrivate( this ), - event = events[ eventName ] || ( events[ eventName ] = new eventEntry( eventName ) ); - - if ( event.getListenerIndex( listenerFunction ) < 0 ) - { - // Get the listeners. - var listeners = event.listeners; - - // Fill the scope. - if ( !scopeObj ) - scopeObj = this; - - // Default the priority, if needed. - if ( isNaN( priority ) ) - priority = 10; - - var me = this; - - // Create the function to be fired for this listener. - var listenerFirer = function( editor, publisherData, stopFn, cancelFn ) - { - var ev = - { - name : eventName, - sender : this, - editor : editor, - data : publisherData, - listenerData : listenerData, - stop : stopFn, - cancel : cancelFn, - removeListener : function() - { - me.removeListener( eventName, listenerFunction ); - } - }; - - listenerFunction.call( scopeObj, ev ); - - return ev.data; - }; - listenerFirer.fn = listenerFunction; - listenerFirer.priority = priority; - - // Search for the right position for this new listener, based on its - // priority. - for ( var i = listeners.length - 1 ; i >= 0 ; i-- ) - { - // Find the item which should be before the new one. - if ( listeners[ i ].priority <= priority ) - { - // Insert the listener in the array. - listeners.splice( i + 1, 0, listenerFirer ); - return; - } - } - - // If no position has been found (or zero length), put it in - // the front of list. - listeners.unshift( listenerFirer ); - } - }, - - /** - * Fires an specific event in the object. All registered listeners are - * called at this point. - * @function - * @param {String} eventName The event name to fire. - * @param {Object} [data] Data to be sent as the - * {@link CKEDITOR.eventInfo#data} when calling the - * listeners. - * @param {CKEDITOR.editor} [editor] The editor instance to send as the - * {@link CKEDITOR.eventInfo#editor} when calling the - * listener. - * @returns {Boolean|Object} A booloan indicating that the event is to be - * canceled, or data returned by one of the listeners. - * @example - * someObject.on( 'someEvent', function() { ... } ); - * someObject.on( 'someEvent', function() { ... } ); - * someObject.fire( 'someEvent' ); // both listeners are called - * @example - * someObject.on( 'someEvent', function( event ) - * { - * alert( event.data ); // "Example" - * }); - * someObject.fire( 'someEvent', 'Example' ); - */ - fire : (function() - { - // Create the function that marks the event as stopped. - var stopped = false; - var stopEvent = function() - { - stopped = true; - }; - - // Create the function that marks the event as canceled. - var canceled = false; - var cancelEvent = function() - { - canceled = true; - }; - - return function( eventName, data, editor ) - { - // Get the event entry. - var event = getPrivate( this )[ eventName ]; - - // Save the previous stopped and cancelled states. We may - // be nesting fire() calls. - var previousStopped = stopped, - previousCancelled = canceled; - - // Reset the stopped and canceled flags. - stopped = canceled = false; - - if ( event ) - { - var listeners = event.listeners; - - if ( listeners.length ) - { - // As some listeners may remove themselves from the - // event, the original array length is dinamic. So, - // let's make a copy of all listeners, so we are - // sure we'll call all of them. - listeners = listeners.slice( 0 ); - - // Loop through all listeners. - for ( var i = 0 ; i < listeners.length ; i++ ) - { - // Call the listener, passing the event data. - var retData = listeners[i].call( this, editor, data, stopEvent, cancelEvent ); - - if ( typeof retData != 'undefined' ) - data = retData; - - // No further calls is stopped or canceled. - if ( stopped || canceled ) - break; - } - } - } - - var ret = canceled || ( typeof data == 'undefined' ? false : data ); - - // Restore the previous stopped and canceled states. - stopped = previousStopped; - canceled = previousCancelled; - - return ret; - }; - })(), - - /** - * Fires an specific event in the object, releasing all listeners - * registered to that event. The same listeners are not called again on - * successive calls of it or of {@link #fire}. - * @param {String} eventName The event name to fire. - * @param {Object} [data] Data to be sent as the - * {@link CKEDITOR.eventInfo#data} when calling the - * listeners. - * @param {CKEDITOR.editor} [editor] The editor instance to send as the - * {@link CKEDITOR.eventInfo#editor} when calling the - * listener. - * @returns {Boolean|Object} A booloan indicating that the event is to be - * canceled, or data returned by one of the listeners. - * @example - * someObject.on( 'someEvent', function() { ... } ); - * someObject.fire( 'someEvent' ); // above listener called - * someObject.fireOnce( 'someEvent' ); // above listener called - * someObject.fire( 'someEvent' ); // no listeners called - */ - fireOnce : function( eventName, data, editor ) - { - var ret = this.fire( eventName, data, editor ); - delete getPrivate( this )[ eventName ]; - return ret; - }, - - /** - * Unregisters a listener function from being called at the specified - * event. No errors are thrown if the listener has not been - * registered previously. - * @param {String} eventName The event name. - * @param {Function} listenerFunction The listener function to unregister. - * @example - * var myListener = function() { ... }; - * someObject.on( 'someEvent', myListener ); - * someObject.fire( 'someEvent' ); // myListener called - * someObject.removeListener( 'someEvent', myListener ); - * someObject.fire( 'someEvent' ); // myListener not called - */ - removeListener : function( eventName, listenerFunction ) - { - // Get the event entry. - var event = getPrivate( this )[ eventName ]; - - if ( event ) - { - var index = event.getListenerIndex( listenerFunction ); - if ( index >= 0 ) - event.listeners.splice( index, 1 ); - } - }, - - /** - * Checks if there is any listener registered to a given event. - * @param {String} eventName The event name. - * @example - * var myListener = function() { ... }; - * someObject.on( 'someEvent', myListener ); - * alert( someObject.hasListeners( 'someEvent' ) ); // "true" - * alert( someObject.hasListeners( 'noEvent' ) ); // "false" - */ - hasListeners : function( eventName ) - { - var event = getPrivate( this )[ eventName ]; - return ( event && event.listeners.length > 0 ) ; - } - }; - })(); -} diff --git a/public/javascripts/ckeditor/_source/core/eventInfo.js b/public/javascripts/ckeditor/_source/core/eventInfo.js deleted file mode 100644 index dbeca5c..0000000 --- a/public/javascripts/ckeditor/_source/core/eventInfo.js +++ /dev/null @@ -1,120 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Defines the "virtual" {@link CKEDITOR.eventInfo} class, which - * contains the defintions of the event object passed to event listeners. - * This file is for documentation purposes only. - */ - -/** - * This class is not really part of the API. It just illustrates the features - * of the event object passed to event listeners by a {@link CKEDITOR.event} - * based object. - * @name CKEDITOR.eventInfo - * @constructor - * @example - * // Do not do this. - * var myEvent = new CKEDITOR.eventInfo(); // Error: CKEDITOR.eventInfo is undefined - */ - -/** - * The event name. - * @name CKEDITOR.eventInfo.prototype.name - * @field - * @type String - * @example - * someObject.on( 'someEvent', function( event ) - * { - * alert( event.name ); // "someEvent" - * }); - * someObject.fire( 'someEvent' ); - */ - -/** - * The object that publishes (sends) the event. - * @name CKEDITOR.eventInfo.prototype.sender - * @field - * @type Object - * @example - * someObject.on( 'someEvent', function( event ) - * { - * alert( event.sender == someObject ); // "true" - * }); - * someObject.fire( 'someEvent' ); - */ - -/** - * The editor instance that holds the sender. May be the same as sender. May be - * null if the sender is not part of an editor instance, like a component - * running in standalone mode. - * @name CKEDITOR.eventInfo.prototype.editor - * @field - * @type CKEDITOR.editor - * @example - * myButton.on( 'someEvent', function( event ) - * { - * alert( event.editor == myEditor ); // "true" - * }); - * myButton.fire( 'someEvent', null, myEditor ); - */ - -/** - * Any kind of additional data. Its format and usage is event dependent. - * @name CKEDITOR.eventInfo.prototype.data - * @field - * @type Object - * @example - * someObject.on( 'someEvent', function( event ) - * { - * alert( event.data ); // "Example" - * }); - * someObject.fire( 'someEvent', 'Example' ); - */ - -/** - * Any extra data appended during the listener registration. - * @name CKEDITOR.eventInfo.prototype.listenerData - * @field - * @type Object - * @example - * someObject.on( 'someEvent', function( event ) - * { - * alert( event.listenerData ); // "Example" - * } - * , null, 'Example' ); - */ - -/** - * Indicates that no further listeners are to be called. - * @name CKEDITOR.eventInfo.prototype.stop - * @function - * @example - * someObject.on( 'someEvent', function( event ) - * { - * event.stop(); - * }); - * someObject.on( 'someEvent', function( event ) - * { - * // This one will not be called. - * }); - * alert( someObject.fire( 'someEvent' ) ); // "false" - */ - -/** - * Indicates that the event is to be cancelled (if cancelable). - * @name CKEDITOR.eventInfo.prototype.cancel - * @function - * @example - * someObject.on( 'someEvent', function( event ) - * { - * event.cancel(); - * }); - * someObject.on( 'someEvent', function( event ) - * { - * // This one will not be called. - * }); - * alert( someObject.fire( 'someEvent' ) ); // "true" - */ diff --git a/public/javascripts/ckeditor/_source/core/focusmanager.js b/public/javascripts/ckeditor/_source/core/focusmanager.js deleted file mode 100644 index 933c3cf..0000000 --- a/public/javascripts/ckeditor/_source/core/focusmanager.js +++ /dev/null @@ -1,137 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Defines the {@link CKEDITOR.focusManager} class, which is used - * to handle the focus on editor instances.. - */ - -/** - * Manages the focus activity in an editor instance. This class is to be used - * mainly by UI elements coders when adding interface elements to CKEditor. - * @constructor - * @param {CKEDITOR.editor} editor The editor instance. - * @example - */ -CKEDITOR.focusManager = function( editor ) -{ - if ( editor.focusManager ) - return editor.focusManager; - - /** - * Indicates that the editor instance has focus. - * @type Boolean - * @example - * alert( CKEDITOR.instances.editor1.focusManager.hasFocus ); // e.g "true" - */ - this.hasFocus = false; - - /** - * Object used to hold private stuff. - * @private - */ - this._ = - { - editor : editor - }; - - return this; -}; - -CKEDITOR.focusManager.prototype = -{ - /** - * Indicates that the editor instance has the focus. - * - * This function is not used to set the focus in the editor. Use - * {@link CKEDITOR.editor#focus} for it instead. - * @example - * var editor = CKEDITOR.instances.editor1; - * editor.focusManager.focus(); - */ - focus : function() - { - if ( this._.timer ) - clearTimeout( this._.timer ); - - if ( !this.hasFocus ) - { - // If another editor has the current focus, we first "blur" it. In - // this way the events happen in a more logical sequence, like: - // "focus 1" > "blur 1" > "focus 2" - // ... instead of: - // "focus 1" > "focus 2" > "blur 1" - if ( CKEDITOR.currentInstance ) - CKEDITOR.currentInstance.focusManager.forceBlur(); - - var editor = this._.editor; - - editor.container.getChild( 1 ).addClass( 'cke_focus' ); - - this.hasFocus = true; - editor.fire( 'focus' ); - } - }, - - /** - * Indicates that the editor instance has lost the focus. Note that this - * functions acts asynchronously with a delay of 100ms to avoid subsequent - * blur/focus effects. If you want the "blur" to happen immediately, use - * the {@link #forceBlur} function instead. - * @example - * var editor = CKEDITOR.instances.editor1; - * editor.focusManager.blur(); - */ - blur : function() - { - var focusManager = this; - - if ( focusManager._.timer ) - clearTimeout( focusManager._.timer ); - - focusManager._.timer = setTimeout( - function() - { - delete focusManager._.timer; - focusManager.forceBlur(); - } - , 100 ); - }, - - /** - * Indicates that the editor instance has lost the focus. Unlike - * {@link #blur}, this function is synchronous, marking the instance as - * "blured" immediately. - * @example - * var editor = CKEDITOR.instances.editor1; - * editor.focusManager.forceBlur(); - */ - forceBlur : function() - { - if ( this.hasFocus ) - { - var editor = this._.editor; - - editor.container.getChild( 1 ).removeClass( 'cke_focus' ); - - this.hasFocus = false; - editor.fire( 'blur' ); - } - } -}; - -/** - * Fired when the editor instance receives the input focus. - * @name CKEDITOR.editor#focus - * @event - * @param {CKEDITOR.editor} editor The editor instance. - */ - -/** - * Fired when the editor instance loses the input focus. - * @name CKEDITOR.editor#blur - * @event - * @param {CKEDITOR.editor} editor The editor instance. - */ diff --git a/public/javascripts/ckeditor/_source/core/htmlparser.js b/public/javascripts/ckeditor/_source/core/htmlparser.js deleted file mode 100644 index ac1420d..0000000 --- a/public/javascripts/ckeditor/_source/core/htmlparser.js +++ /dev/null @@ -1,212 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * HTML text parser. - * @constructor - * @example - */ -CKEDITOR.htmlParser = function() -{ - this._ = - { - htmlPartsRegex : new RegExp( '<(?:(?:\\/([^>]+)>)|(?:!--([\\S|\\s]*?)-->)|(?:([^\\s>]+)\\s*((?:(?:[^"\'>]+)|(?:"[^"]*")|(?:\'[^\']*\'))*)\\/?>))', 'g' ) - }; -}; - -(function() -{ - var attribsRegex = /([\w\-:.]+)(?:(?:\s*=\s*(?:(?:"([^"]*)")|(?:'([^']*)')|([^\s>]+)))|(?=\s|$))/g, - emptyAttribs = {checked:1,compact:1,declare:1,defer:1,disabled:1,ismap:1,multiple:1,nohref:1,noresize:1,noshade:1,nowrap:1,readonly:1,selected:1}; - - CKEDITOR.htmlParser.prototype = - { - /** - * Function to be fired when a tag opener is found. This function - * should be overriden when using this class. - * @param {String} tagName The tag name. The name is guarantted to be - * lowercased. - * @param {Object} attributes An object containing all tag attributes. Each - * property in this object represent and attribute name and its - * value is the attribute value. - * @param {Boolean} selfClosing true if the tag closes itself, false if the - * tag doesn't. - * @example - * var parser = new CKEDITOR.htmlParser(); - * parser.onTagOpen = function( tagName, attributes, selfClosing ) - * { - * alert( tagName ); // e.g. "b" - * }); - * parser.parse( "<!-- Example --><b>Hello</b>" ); - */ - onTagOpen : function() {}, - - /** - * Function to be fired when a tag closer is found. This function - * should be overriden when using this class. - * @param {String} tagName The tag name. The name is guarantted to be - * lowercased. - * @example - * var parser = new CKEDITOR.htmlParser(); - * parser.onTagClose = function( tagName ) - * { - * alert( tagName ); // e.g. "b" - * }); - * parser.parse( "<!-- Example --><b>Hello</b>" ); - */ - onTagClose : function() {}, - - /** - * Function to be fired when text is found. This function - * should be overriden when using this class. - * @param {String} text The text found. - * @example - * var parser = new CKEDITOR.htmlParser(); - * parser.onText = function( text ) - * { - * alert( text ); // e.g. "Hello" - * }); - * parser.parse( "<!-- Example --><b>Hello</b>" ); - */ - onText : function() {}, - - /** - * Function to be fired when CDATA section is found. This function - * should be overriden when using this class. - * @param {String} cdata The CDATA been found. - * @example - * var parser = new CKEDITOR.htmlParser(); - * parser.onCDATA = function( cdata ) - * { - * alert( cdata ); // e.g. "var hello;" - * }); - * parser.parse( "<script>var hello;</script>" ); - */ - onCDATA : function() {}, - - /** - * Function to be fired when a commend is found. This function - * should be overriden when using this class. - * @param {String} comment The comment text. - * @example - * var parser = new CKEDITOR.htmlParser(); - * parser.onText = function( comment ) - * { - * alert( comment ); // e.g. " Example " - * }); - * parser.parse( "<!-- Example --><b>Hello</b>" ); - */ - onComment : function() {}, - - /** - * Parses text, looking for HTML tokens, like tag openers or closers, - * or comments. This function fires the onTagOpen, onTagClose, onText - * and onComment function during its execution. - * @param {String} html The HTML to be parsed. - * @example - * var parser = new CKEDITOR.htmlParser(); - * // The onTagOpen, onTagClose, onText and onComment should be overriden - * // at this point. - * parser.parse( "<!-- Example --><b>Hello</b>" ); - */ - parse : function( html ) - { - var parts, - tagName, - nextIndex = 0, - cdata; // The collected data inside a CDATA section. - - while ( ( parts = this._.htmlPartsRegex.exec( html ) ) ) - { - var tagIndex = parts.index; - if ( tagIndex > nextIndex ) - { - var text = html.substring( nextIndex, tagIndex ); - - if ( cdata ) - cdata.push( text ); - else - this.onText( text ); - } - - nextIndex = this._.htmlPartsRegex.lastIndex; - - /* - "parts" is an array with the following items: - 0 : The entire match for opening/closing tags and comments. - 1 : Group filled with the tag name for closing tags. - 2 : Group filled with the comment text. - 3 : Group filled with the tag name for opening tags. - 4 : Group filled with the attributes part of opening tags. - */ - - // Closing tag - if ( ( tagName = parts[ 1 ] ) ) - { - tagName = tagName.toLowerCase(); - - if ( cdata && CKEDITOR.dtd.$cdata[ tagName ] ) - { - // Send the CDATA data. - this.onCDATA( cdata.join('') ); - cdata = null; - } - - if ( !cdata ) - { - this.onTagClose( tagName ); - continue; - } - } - - // If CDATA is enabled, just save the raw match. - if ( cdata ) - { - cdata.push( parts[ 0 ] ); - continue; - } - - // Opening tag - if ( ( tagName = parts[ 3 ] ) ) - { - tagName = tagName.toLowerCase(); - var attribs = {}, - attribMatch, - attribsPart = parts[ 4 ], - selfClosing = !!( attribsPart && attribsPart.charAt( attribsPart.length - 1 ) == '/' ); - - if ( attribsPart ) - { - while ( ( attribMatch = attribsRegex.exec( attribsPart ) ) ) - { - var attName = attribMatch[1].toLowerCase(), - attValue = attribMatch[2] || attribMatch[3] || attribMatch[4] || ''; - - if ( !attValue && emptyAttribs[ attName ] ) - attribs[ attName ] = attName; - else - attribs[ attName ] = attValue; - } - } - - this.onTagOpen( tagName, attribs, selfClosing ); - - // Open CDATA mode when finding the appropriate tags. - if ( !cdata && CKEDITOR.dtd.$cdata[ tagName ] ) - cdata = []; - - continue; - } - - // Comment - if ( ( tagName = parts[ 2 ] ) ) - this.onComment( tagName ); - } - - if ( html.length > nextIndex ) - this.onText( html.substring( nextIndex, html.length ) ); - } - }; -})(); diff --git a/public/javascripts/ckeditor/_source/core/htmlparser/basicwriter.js b/public/javascripts/ckeditor/_source/core/htmlparser/basicwriter.js deleted file mode 100644 index 3a0231c..0000000 --- a/public/javascripts/ckeditor/_source/core/htmlparser/basicwriter.js +++ /dev/null @@ -1,145 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -CKEDITOR.htmlParser.basicWriter = CKEDITOR.tools.createClass( -{ - $ : function() - { - this._ = - { - output : [] - }; - }, - - proto : - { - /** - * Writes the tag opening part for a opener tag. - * @param {String} tagName The element name for this tag. - * @param {Object} attributes The attributes defined for this tag. The - * attributes could be used to inspect the tag. - * @example - * // Writes "<p". - * writer.openTag( 'p', { class : 'MyClass', id : 'MyId' } ); - */ - openTag : function( tagName, attributes ) - { - this._.output.push( '<', tagName ); - }, - - /** - * Writes the tag closing part for a opener tag. - * @param {String} tagName The element name for this tag. - * @param {Boolean} isSelfClose Indicates that this is a self-closing tag, - * like "br" or "img". - * @example - * // Writes ">". - * writer.openTagClose( 'p', false ); - * @example - * // Writes " />". - * writer.openTagClose( 'br', true ); - */ - openTagClose : function( tagName, isSelfClose ) - { - if ( isSelfClose ) - this._.output.push( ' />' ); - else - this._.output.push( '>' ); - }, - - /** - * Writes an attribute. This function should be called after opening the - * tag with {@link #openTagClose}. - * @param {String} attName The attribute name. - * @param {String} attValue The attribute value. - * @example - * // Writes ' class="MyClass"'. - * writer.attribute( 'class', 'MyClass' ); - */ - attribute : function( attName, attValue ) - { - // Browsers don't always escape special character in attribute values. (#4683, #4719). - if ( typeof attValue == 'string' ) - attValue = CKEDITOR.tools.htmlEncodeAttr( attValue ); - - this._.output.push( ' ', attName, '="', attValue, '"' ); - }, - - /** - * Writes a closer tag. - * @param {String} tagName The element name for this tag. - * @example - * // Writes "</p>". - * writer.closeTag( 'p' ); - */ - closeTag : function( tagName ) - { - this._.output.push( '' ); - }, - - /** - * Writes text. - * @param {String} text The text value - * @example - * // Writes "Hello Word". - * writer.text( 'Hello Word' ); - */ - text : function( text ) - { - this._.output.push( text ); - }, - - /** - * Writes a comment. - * @param {String} comment The comment text. - * @example - * // Writes "<!-- My comment -->". - * writer.comment( ' My comment ' ); - */ - comment : function( comment ) - { - this._.output.push( '' ); - }, - - /** - * Writes any kind of data to the ouput. - * @example - * writer.write( 'This is an <b>example</b>.' ); - */ - write : function( data ) - { - this._.output.push( data ); - }, - - /** - * Empties the current output buffer. - * @example - * writer.reset(); - */ - reset : function() - { - this._.output = []; - this._.indent = false; - }, - - /** - * Empties the current output buffer. - * @param {Boolean} reset Indicates that the {@link reset} function is to - * be automatically called after retrieving the HTML. - * @returns {String} The HTML written to the writer so far. - * @example - * var html = writer.getHtml(); - */ - getHtml : function( reset ) - { - var html = this._.output.join( '' ); - - if ( reset ) - this.reset(); - - return html; - } - } -}); diff --git a/public/javascripts/ckeditor/_source/core/htmlparser/cdata.js b/public/javascripts/ckeditor/_source/core/htmlparser/cdata.js deleted file mode 100644 index ff2f227..0000000 --- a/public/javascripts/ckeditor/_source/core/htmlparser/cdata.js +++ /dev/null @@ -1,43 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -(function() -{ - - /** - * A lightweight representation of HTML text. - * @constructor - * @example - */ - CKEDITOR.htmlParser.cdata = function( value ) - { - /** - * The CDATA value. - * @type String - * @example - */ - this.value = value; - }; - - CKEDITOR.htmlParser.cdata.prototype = - { - /** - * CDATA has the same type as {@link CKEDITOR.htmlParser.text} This is - * a constant value set to {@link CKEDITOR.NODE_TEXT}. - * @type Number - * @example - */ - type : CKEDITOR.NODE_TEXT, - - /** - * Writes write the CDATA with no special manipulations. - * @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML. - */ - writeHtml : function( writer ) - { - writer.write( this.value ); - } - }; -})(); diff --git a/public/javascripts/ckeditor/_source/core/htmlparser/comment.js b/public/javascripts/ckeditor/_source/core/htmlparser/comment.js deleted file mode 100644 index 67830d9..0000000 --- a/public/javascripts/ckeditor/_source/core/htmlparser/comment.js +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * A lightweight representation of an HTML comment. - * @constructor - * @example - */ -CKEDITOR.htmlParser.comment = function( value ) -{ - /** - * The comment text. - * @type String - * @example - */ - this.value = value; - - /** @private */ - this._ = - { - isBlockLike : false - }; -}; - -CKEDITOR.htmlParser.comment.prototype = -{ - /** - * The node type. This is a constant value set to {@link CKEDITOR.NODE_COMMENT}. - * @type Number - * @example - */ - type : CKEDITOR.NODE_COMMENT, - - /** - * Writes the HTML representation of this comment to a CKEDITOR.htmlWriter. - * @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML. - * @example - */ - writeHtml : function( writer, filter ) - { - var comment = this.value; - - if ( filter ) - { - if ( !( comment = filter.onComment( comment, this ) ) ) - return; - - if ( typeof comment != 'string' ) - { - comment.parent = this.parent; - comment.writeHtml( writer, filter ); - return; - } - } - - writer.comment( comment ); - } -}; diff --git a/public/javascripts/ckeditor/_source/core/htmlparser/element.js b/public/javascripts/ckeditor/_source/core/htmlparser/element.js deleted file mode 100644 index 69bacda..0000000 --- a/public/javascripts/ckeditor/_source/core/htmlparser/element.js +++ /dev/null @@ -1,240 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * A lightweight representation of an HTML element. - * @param {String} name The element name. - * @param {Object} attributes And object holding all attributes defined for - * this element. - * @constructor - * @example - */ -CKEDITOR.htmlParser.element = function( name, attributes ) -{ - /** - * The element name. - * @type String - * @example - */ - this.name = name; - - /** - * Holds the attributes defined for this element. - * @type Object - * @example - */ - this.attributes = attributes || ( attributes = {} ); - - /** - * The nodes that are direct children of this element. - * @type Array - * @example - */ - this.children = []; - - var tagName = attributes._cke_real_element_type || name; - - var dtd = CKEDITOR.dtd, - isBlockLike = !!( dtd.$nonBodyContent[ tagName ] || dtd.$block[ tagName ] || dtd.$listItem[ tagName ] || dtd.$tableContent[ tagName ] || dtd.$nonEditable[ tagName ] || tagName == 'br' ), - isEmpty = !!dtd.$empty[ name ]; - - this.isEmpty = isEmpty; - this.isUnknown = !dtd[ name ]; - - /** @private */ - this._ = - { - isBlockLike : isBlockLike, - hasInlineStarted : isEmpty || !isBlockLike - }; -}; - -(function() -{ - // Used to sort attribute entries in an array, where the first element of - // each object is the attribute name. - var sortAttribs = function( a, b ) - { - a = a[0]; - b = b[0]; - return a < b ? -1 : a > b ? 1 : 0; - }; - - CKEDITOR.htmlParser.element.prototype = - { - /** - * The node type. This is a constant value set to {@link CKEDITOR.NODE_ELEMENT}. - * @type Number - * @example - */ - type : CKEDITOR.NODE_ELEMENT, - - /** - * Adds a node to the element children list. - * @param {Object} node The node to be added. It can be any of of the - * following types: {@link CKEDITOR.htmlParser.element}, - * {@link CKEDITOR.htmlParser.text} and - * {@link CKEDITOR.htmlParser.comment}. - * @function - * @example - */ - add : CKEDITOR.htmlParser.fragment.prototype.add, - - /** - * Clone this element. - * @returns {CKEDITOR.htmlParser.element} The element clone. - * @example - */ - clone : function() - { - return new CKEDITOR.htmlParser.element( this.name, this.attributes ); - }, - - /** - * Writes the element HTML to a CKEDITOR.htmlWriter. - * @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML. - * @example - */ - writeHtml : function( writer, filter ) - { - var attributes = this.attributes; - - // Ignore cke: prefixes when writing HTML. - var element = this, - writeName = element.name, - a, newAttrName, value; - - var isChildrenFiltered; - - /** - * Providing an option for bottom-up filtering order ( element - * children to be pre-filtered before the element itself ). - */ - element.filterChildren = function() - { - if ( !isChildrenFiltered ) - { - var writer = new CKEDITOR.htmlParser.basicWriter(); - CKEDITOR.htmlParser.fragment.prototype.writeChildrenHtml.call( element, writer, filter ); - element.children = new CKEDITOR.htmlParser.fragment.fromHtml( writer.getHtml() ).children; - isChildrenFiltered = 1; - } - }; - - if ( filter ) - { - while ( true ) - { - if ( !( writeName = filter.onElementName( writeName ) ) ) - return; - - element.name = writeName; - - if ( !( element = filter.onElement( element ) ) ) - return; - - element.parent = this.parent; - - if ( element.name == writeName ) - break; - - // If the element has been replaced with something of a - // different type, then make the replacement write itself. - if ( element.type != CKEDITOR.NODE_ELEMENT ) - { - element.writeHtml( writer, filter ); - return; - } - - writeName = element.name; - - // This indicate that the element has been dropped by - // filter but not the children. - if ( !writeName ) - { - this.writeChildrenHtml.call( element, writer, isChildrenFiltered ? null : filter ); - return; - } - } - - // The element may have been changed, so update the local - // references. - attributes = element.attributes; - } - - // Open element tag. - writer.openTag( writeName, attributes ); - - // Copy all attributes to an array. - var attribsArray = []; - // Iterate over the attributes twice since filters may alter - // other attributes. - for ( var i = 0 ; i < 2; i++ ) - { - for ( a in attributes ) - { - newAttrName = a; - value = attributes[ a ]; - if ( i == 1 ) - attribsArray.push( [ a, value ] ); - else if ( filter ) - { - while ( true ) - { - if ( !( newAttrName = filter.onAttributeName( a ) ) ) - { - delete attributes[ a ]; - break; - } - else if ( newAttrName != a ) - { - delete attributes[ a ]; - a = newAttrName; - continue; - } - else - break; - } - if ( newAttrName ) - { - if ( ( value = filter.onAttribute( element, newAttrName, value ) ) === false ) - delete attributes[ newAttrName ]; - else - attributes [ newAttrName ] = value; - } - } - } - } - // Sort the attributes by name. - if ( writer.sortAttributes ) - attribsArray.sort( sortAttribs ); - - // Send the attributes. - var len = attribsArray.length; - for ( i = 0 ; i < len ; i++ ) - { - var attrib = attribsArray[ i ]; - writer.attribute( attrib[0], attrib[1] ); - } - - // Close the tag. - writer.openTagClose( writeName, element.isEmpty ); - - if ( !element.isEmpty ) - { - this.writeChildrenHtml.call( element, writer, isChildrenFiltered ? null : filter ); - // Close the element. - writer.closeTag( writeName ); - } - }, - - writeChildrenHtml : function( writer, filter ) - { - // Send children. - CKEDITOR.htmlParser.fragment.prototype.writeChildrenHtml.apply( this, arguments ); - - } - }; -})(); diff --git a/public/javascripts/ckeditor/_source/core/htmlparser/filter.js b/public/javascripts/ckeditor/_source/core/htmlparser/filter.js deleted file mode 100644 index 1699eb2..0000000 --- a/public/javascripts/ckeditor/_source/core/htmlparser/filter.js +++ /dev/null @@ -1,262 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -(function() -{ - CKEDITOR.htmlParser.filter = CKEDITOR.tools.createClass( - { - $ : function( rules ) - { - this._ = - { - elementNames : [], - attributeNames : [], - elements : { $length : 0 }, - attributes : { $length : 0 } - }; - - if ( rules ) - this.addRules( rules, 10 ); - }, - - proto : - { - addRules : function( rules, priority ) - { - if ( typeof priority != 'number' ) - priority = 10; - - // Add the elementNames. - addItemsToList( this._.elementNames, rules.elementNames, priority ); - - // Add the attributeNames. - addItemsToList( this._.attributeNames, rules.attributeNames, priority ); - - // Add the elements. - addNamedItems( this._.elements, rules.elements, priority ); - - // Add the attributes. - addNamedItems( this._.attributes, rules.attributes, priority ); - - // Add the text. - this._.text = transformNamedItem( this._.text, rules.text, priority ) || this._.text; - - // Add the comment. - this._.comment = transformNamedItem( this._.comment, rules.comment, priority ) || this._.comment; - - // Add root fragment. - this._.root = transformNamedItem( this._.root, rules.root, priority ) || this._.root; - }, - - onElementName : function( name ) - { - return filterName( name, this._.elementNames ); - }, - - onAttributeName : function( name ) - { - return filterName( name, this._.attributeNames ); - }, - - onText : function( text ) - { - var textFilter = this._.text; - return textFilter ? textFilter.filter( text ) : text; - }, - - onComment : function( commentText, comment ) - { - var textFilter = this._.comment; - return textFilter ? textFilter.filter( commentText, comment ) : commentText; - }, - - onFragment : function( element ) - { - var rootFilter = this._.root; - return rootFilter ? rootFilter.filter( element ) : element; - }, - - onElement : function( element ) - { - // We must apply filters set to the specific element name as - // well as those set to the generic $ name. So, add both to an - // array and process them in a small loop. - var filters = [ this._.elements[ '^' ], this._.elements[ element.name ], this._.elements.$ ], - filter, ret; - - for ( var i = 0 ; i < 3 ; i++ ) - { - filter = filters[ i ]; - if ( filter ) - { - ret = filter.filter( element, this ); - - if ( ret === false ) - return null; - - if ( ret && ret != element ) - return this.onNode( ret ); - - // The non-root element has been dismissed by one of the filters. - if ( element.parent && !element.name ) - break; - } - } - - return element; - }, - - onNode : function( node ) - { - var type = node.type; - - return type == CKEDITOR.NODE_ELEMENT ? this.onElement( node ) : - type == CKEDITOR.NODE_TEXT ? new CKEDITOR.htmlParser.text( this.onText( node.value ) ) : - type == CKEDITOR.NODE_COMMENT ? new CKEDITOR.htmlParser.comment( this.onComment( node.value ) ): - null; - }, - - onAttribute : function( element, name, value ) - { - var filter = this._.attributes[ name ]; - - if ( filter ) - { - var ret = filter.filter( value, element, this ); - - if ( ret === false ) - return false; - - if ( typeof ret != 'undefined' ) - return ret; - } - - return value; - } - } - }); - - function filterName( name, filters ) - { - for ( var i = 0 ; name && i < filters.length ; i++ ) - { - var filter = filters[ i ]; - name = name.replace( filter[ 0 ], filter[ 1 ] ); - } - return name; - } - - function addItemsToList( list, items, priority ) - { - if ( typeof items == 'function' ) - items = [ items ]; - - var i, j, - listLength = list.length, - itemsLength = items && items.length; - - if ( itemsLength ) - { - // Find the index to insert the items at. - for ( i = 0 ; i < listLength && list[ i ].pri < priority ; i++ ) - { /*jsl:pass*/ } - - // Add all new items to the list at the specific index. - for ( j = itemsLength - 1 ; j >= 0 ; j-- ) - { - var item = items[ j ]; - if ( item ) - { - item.pri = priority; - list.splice( i, 0, item ); - } - } - } - } - - function addNamedItems( hashTable, items, priority ) - { - if ( items ) - { - for ( var name in items ) - { - var current = hashTable[ name ]; - - hashTable[ name ] = - transformNamedItem( - current, - items[ name ], - priority ); - - if ( !current ) - hashTable.$length++; - } - } - } - - function transformNamedItem( current, item, priority ) - { - if ( item ) - { - item.pri = priority; - - if ( current ) - { - // If the current item is not an Array, transform it. - if ( !current.splice ) - { - if ( current.pri > priority ) - current = [ item, current ]; - else - current = [ current, item ]; - - current.filter = callItems; - } - else - addItemsToList( current, item, priority ); - - return current; - } - else - { - item.filter = item; - return item; - } - } - } - - function callItems( currentEntry ) - { - var isObject = ( typeof currentEntry == 'object' ); - - for ( var i = 0 ; i < this.length ; i++ ) - { - var item = this[ i ], - ret = item.apply( window, arguments ); - - if ( typeof ret != 'undefined' ) - { - if ( ret === false ) - return false; - - if ( isObject && ret != currentEntry ) - return ret; - } - } - - return null; - } -})(); - -// "entities" plugin -/* -{ - text : function( text ) - { - // TODO : Process entities. - return text.toUpperCase(); - } -}; -*/ diff --git a/public/javascripts/ckeditor/_source/core/htmlparser/fragment.js b/public/javascripts/ckeditor/_source/core/htmlparser/fragment.js deleted file mode 100644 index 244e298..0000000 --- a/public/javascripts/ckeditor/_source/core/htmlparser/fragment.js +++ /dev/null @@ -1,496 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * A lightweight representation of an HTML DOM structure. - * @constructor - * @example - */ -CKEDITOR.htmlParser.fragment = function() -{ - /** - * The nodes contained in the root of this fragment. - * @type Array - * @example - * var fragment = CKEDITOR.htmlParser.fragment.fromHtml( 'Sample Text' ); - * alert( fragment.children.length ); "2" - */ - this.children = []; - - /** - * Get the fragment parent. Should always be null. - * @type Object - * @default null - * @example - */ - this.parent = null; - - /** @private */ - this._ = - { - isBlockLike : true, - hasInlineStarted : false - }; -}; - -(function() -{ - // Elements which the end tag is marked as optional in the HTML 4.01 DTD - // (expect empty elements). - var optionalClose = {colgroup:1,dd:1,dt:1,li:1,option:1,p:1,td:1,tfoot:1,th:1,thead:1,tr:1}; - - // Block-level elements whose internal structure should be respected during - // parser fixing. - var nonBreakingBlocks = CKEDITOR.tools.extend( - {table:1,ul:1,ol:1,dl:1}, - CKEDITOR.dtd.table, CKEDITOR.dtd.ul, CKEDITOR.dtd.ol, CKEDITOR.dtd.dl ), - listBlocks = CKEDITOR.dtd.$list, listItems = CKEDITOR.dtd.$listItem; - - /** - * Creates a {@link CKEDITOR.htmlParser.fragment} from an HTML string. - * @param {String} fragmentHtml The HTML to be parsed, filling the fragment. - * @param {Number} [fixForBody=false] Wrap body with specified element if needed. - * @returns CKEDITOR.htmlParser.fragment The fragment created. - * @example - * var fragment = CKEDITOR.htmlParser.fragment.fromHtml( 'Sample Text' ); - * alert( fragment.children[0].name ); "b" - * alert( fragment.children[1].value ); " Text" - */ - CKEDITOR.htmlParser.fragment.fromHtml = function( fragmentHtml, fixForBody ) - { - var parser = new CKEDITOR.htmlParser(), - html = [], - fragment = new CKEDITOR.htmlParser.fragment(), - pendingInline = [], - pendingBRs = [], - currentNode = fragment, - // Indicate we're inside a
       element, spaces should be touched differently.
      -			inPre = false,
      -			returnPoint;
      -
      -		function checkPending( newTagName )
      -		{
      -			var pendingBRsSent;
      -
      -			if ( pendingInline.length > 0 )
      -			{
      -				for ( var i = 0 ; i < pendingInline.length ; i++ )
      -				{
      -					var pendingElement = pendingInline[ i ],
      -						pendingName = pendingElement.name,
      -						pendingDtd = CKEDITOR.dtd[ pendingName ],
      -						currentDtd = currentNode.name && CKEDITOR.dtd[ currentNode.name ];
      -
      -					if ( ( !currentDtd || currentDtd[ pendingName ] ) && ( !newTagName || !pendingDtd || pendingDtd[ newTagName ] || !CKEDITOR.dtd[ newTagName ] ) )
      -					{
      -						if ( !pendingBRsSent )
      -						{
      -							sendPendingBRs();
      -							pendingBRsSent = 1;
      -						}
      -
      -						// Get a clone for the pending element.
      -						pendingElement = pendingElement.clone();
      -
      -						// Add it to the current node and make it the current,
      -						// so the new element will be added inside of it.
      -						pendingElement.parent = currentNode;
      -						currentNode = pendingElement;
      -
      -						// Remove the pending element (back the index by one
      -						// to properly process the next entry).
      -						pendingInline.splice( i, 1 );
      -						i--;
      -					}
      -				}
      -			}
      -		}
      -
      -		function sendPendingBRs()
      -		{
      -			while ( pendingBRs.length )
      -				currentNode.add( pendingBRs.shift() );
      -		}
      -
      -		function addElement( element, target, enforceCurrent )
      -		{
      -			target = target || currentNode || fragment;
      -
      -			// If the target is the fragment and this element can't go inside
      -			// body (if fixForBody).
      -			if ( fixForBody && !target.type )
      -			{
      -				var elementName, realElementName;
      -				if ( element.attributes
      -					 && ( realElementName =
      -						  element.attributes[ '_cke_real_element_type' ] ) )
      -					elementName = realElementName;
      -				else
      -					elementName =  element.name;
      -				if ( elementName
      -						&& !( elementName in CKEDITOR.dtd.$body )
      -						&& !( elementName in CKEDITOR.dtd.$nonBodyContent )  )
      -				{
      -					var savedCurrent = currentNode;
      -
      -					// Create a 

      in the fragment. - currentNode = target; - parser.onTagOpen( fixForBody, {} ); - - // The new target now is the

      . - target = currentNode; - - if ( enforceCurrent ) - currentNode = savedCurrent; - } - } - - // Rtrim empty spaces on block end boundary. (#3585) - if ( element._.isBlockLike - && element.name != 'pre' ) - { - - var length = element.children.length, - lastChild = element.children[ length - 1 ], - text; - if ( lastChild && lastChild.type == CKEDITOR.NODE_TEXT ) - { - if ( !( text = CKEDITOR.tools.rtrim( lastChild.value ) ) ) - element.children.length = length -1; - else - lastChild.value = text; - } - } - - target.add( element ); - - if ( element.returnPoint ) - { - currentNode = element.returnPoint; - delete element.returnPoint; - } - } - - parser.onTagOpen = function( tagName, attributes, selfClosing ) - { - var element = new CKEDITOR.htmlParser.element( tagName, attributes ); - - // "isEmpty" will be always "false" for unknown elements, so we - // must force it if the parser has identified it as a selfClosing tag. - if ( element.isUnknown && selfClosing ) - element.isEmpty = true; - - // This is a tag to be removed if empty, so do not add it immediately. - if ( CKEDITOR.dtd.$removeEmpty[ tagName ] ) - { - pendingInline.push( element ); - return; - } - else if ( tagName == 'pre' ) - inPre = true; - else if ( tagName == 'br' && inPre ) - { - currentNode.add( new CKEDITOR.htmlParser.text( '\n' ) ); - return; - } - - if ( tagName == 'br' ) - { - pendingBRs.push( element ); - return; - } - - var currentName = currentNode.name; - - var currentDtd = currentName - && ( CKEDITOR.dtd[ currentName ] - || ( currentNode._.isBlockLike ? CKEDITOR.dtd.div : CKEDITOR.dtd.span ) ); - - // If the element cannot be child of the current element. - if ( currentDtd // Fragment could receive any elements. - && !element.isUnknown && !currentNode.isUnknown && !currentDtd[ tagName ] ) - { - - var reApply = false, - addPoint; // New position to start adding nodes. - - // Fixing malformed nested lists by moving it into a previous list item. (#3828) - if ( tagName in listBlocks - && currentName in listBlocks ) - { - var children = currentNode.children, - lastChild = children[ children.length - 1 ]; - - // Establish the list item if it's not existed. - if ( !( lastChild && lastChild.name in listItems ) ) - addElement( ( lastChild = new CKEDITOR.htmlParser.element( 'li' ) ), currentNode ); - - returnPoint = currentNode, addPoint = lastChild; - } - // If the element name is the same as the current element name, - // then just close the current one and append the new one to the - // parent. This situation usually happens with

      ,

    1. ,
      and - //
      , specially in IE. Do not enter in this if block in this case. - else if ( tagName == currentName ) - { - addElement( currentNode, currentNode.parent ); - } - else - { - if ( nonBreakingBlocks[ currentName ] ) - { - if ( !returnPoint ) - returnPoint = currentNode; - } - else - { - addElement( currentNode, currentNode.parent, true ); - - if ( !optionalClose[ currentName ] ) - { - // The current element is an inline element, which - // cannot hold the new one. Put it in the pending list, - // and try adding the new one after it. - pendingInline.unshift( currentNode ); - } - } - - reApply = true; - } - - if ( addPoint ) - currentNode = addPoint; - // Try adding it to the return point, or the parent element. - else - currentNode = currentNode.returnPoint || currentNode.parent; - - if ( reApply ) - { - parser.onTagOpen.apply( this, arguments ); - return; - } - } - - checkPending( tagName ); - sendPendingBRs(); - - element.parent = currentNode; - element.returnPoint = returnPoint; - returnPoint = 0; - - if ( element.isEmpty ) - addElement( element ); - else - currentNode = element; - }; - - parser.onTagClose = function( tagName ) - { - // Check if there is any pending tag to be closed. - for ( var i = pendingInline.length - 1 ; i >= 0 ; i-- ) - { - // If found, just remove it from the list. - if ( tagName == pendingInline[ i ].name ) - { - pendingInline.splice( i, 1 ); - return; - } - } - - var pendingAdd = [], - newPendingInline = [], - candidate = currentNode; - - while ( candidate.type && candidate.name != tagName ) - { - // If this is an inline element, add it to the pending list, if we're - // really closing one of the parents element later, they will continue - // after it. - if ( !candidate._.isBlockLike ) - newPendingInline.unshift( candidate ); - - // This node should be added to it's parent at this point. But, - // it should happen only if the closing tag is really closing - // one of the nodes. So, for now, we just cache it. - pendingAdd.push( candidate ); - - candidate = candidate.parent; - } - - if ( candidate.type ) - { - // Add all elements that have been found in the above loop. - for ( i = 0 ; i < pendingAdd.length ; i++ ) - { - var node = pendingAdd[ i ]; - addElement( node, node.parent ); - } - - currentNode = candidate; - - if ( currentNode.name == 'pre' ) - inPre = false; - - if ( candidate._.isBlockLike ) - sendPendingBRs(); - - addElement( candidate, candidate.parent ); - - // The parent should start receiving new nodes now, except if - // addElement changed the currentNode. - if ( candidate == currentNode ) - currentNode = currentNode.parent; - - pendingInline = pendingInline.concat( newPendingInline ); - } - - if ( tagName == 'body' ) - fixForBody = false; - }; - - parser.onText = function( text ) - { - // Trim empty spaces at beginning of element contents except
      .
      -			if ( !currentNode._.hasInlineStarted && !inPre )
      -			{
      -				text = CKEDITOR.tools.ltrim( text );
      -
      -				if ( text.length === 0 )
      -					return;
      -			}
      -
      -			sendPendingBRs();
      -			checkPending();
      -
      -			if ( fixForBody
      -				 && ( !currentNode.type || currentNode.name == 'body' )
      -				 && CKEDITOR.tools.trim( text ) )
      -			{
      -				this.onTagOpen( fixForBody, {} );
      -			}
      -
      -			// Shrinking consequential spaces into one single for all elements
      -			// text contents.
      -			if ( !inPre )
      -				text = text.replace( /[\t\r\n ]{2,}|[\t\r\n]/g, ' ' );
      -
      -			currentNode.add( new CKEDITOR.htmlParser.text( text ) );
      -		};
      -
      -		parser.onCDATA = function( cdata )
      -		{
      -			currentNode.add( new CKEDITOR.htmlParser.cdata( cdata ) );
      -		};
      -
      -		parser.onComment = function( comment )
      -		{
      -			currentNode.add( new CKEDITOR.htmlParser.comment( comment ) );
      -		};
      -
      -		// Parse it.
      -		parser.parse( fragmentHtml );
      -
      -		sendPendingBRs();
      -
      -		// Close all pending nodes.
      -		while ( currentNode.type )
      -		{
      -			var parent = currentNode.parent,
      -				node = currentNode;
      -
      -			if ( fixForBody
      -				 && ( !parent.type || parent.name == 'body' )
      -				 && !CKEDITOR.dtd.$body[ node.name ] )
      -			{
      -				currentNode = parent;
      -				parser.onTagOpen( fixForBody, {} );
      -				parent = currentNode;
      -			}
      -
      -			parent.add( node );
      -			currentNode = parent;
      -		}
      -
      -		return fragment;
      -	};
      -
      -	CKEDITOR.htmlParser.fragment.prototype =
      -	{
      -		/**
      -		 * Adds a node to this fragment.
      -		 * @param {Object} node The node to be added. It can be any of of the
      -		 *		following types: {@link CKEDITOR.htmlParser.element},
      -		 *		{@link CKEDITOR.htmlParser.text} and
      -		 *		{@link CKEDITOR.htmlParser.comment}.
      -		 * @example
      -		 */
      -		add : function( node )
      -		{
      -			var len = this.children.length,
      -				previous = len > 0 && this.children[ len - 1 ] || null;
      -
      -			if ( previous )
      -			{
      -				// If the block to be appended is following text, trim spaces at
      -				// the right of it.
      -				if ( node._.isBlockLike && previous.type == CKEDITOR.NODE_TEXT )
      -				{
      -					previous.value = CKEDITOR.tools.rtrim( previous.value );
      -
      -					// If we have completely cleared the previous node.
      -					if ( previous.value.length === 0 )
      -					{
      -						// Remove it from the list and add the node again.
      -						this.children.pop();
      -						this.add( node );
      -						return;
      -					}
      -				}
      -
      -				previous.next = node;
      -			}
      -
      -			node.previous = previous;
      -			node.parent = this;
      -
      -			this.children.push( node );
      -
      -			this._.hasInlineStarted = node.type == CKEDITOR.NODE_TEXT || ( node.type == CKEDITOR.NODE_ELEMENT && !node._.isBlockLike );
      -		},
      -
      -		/**
      -		 * Writes the fragment HTML to a CKEDITOR.htmlWriter.
      -		 * @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
      -		 * @example
      -		 * var writer = new CKEDITOR.htmlWriter();
      -		 * var fragment = CKEDITOR.htmlParser.fragment.fromHtml( '<P><B>Example' );
      -		 * fragment.writeHtml( writer )
      -		 * alert( writer.getHtml() );  "<p><b>Example</b></p>"
      -		 */
      -		writeHtml : function( writer, filter )
      -		{
      -			var isChildrenFiltered;
      -			this.filterChildren = function()
      -			{
      -				var writer = new CKEDITOR.htmlParser.basicWriter();
      -				this.writeChildrenHtml.call( this, writer, filter, true );
      -				var html = writer.getHtml();
      -				this.children = new CKEDITOR.htmlParser.fragment.fromHtml( html ).children;
      -				isChildrenFiltered = 1;
      -			};
      -
      -			// Filtering the root fragment before anything else.
      -			!this.name && filter && filter.onFragment( this );
      -
      -			this.writeChildrenHtml( writer, isChildrenFiltered ? null : filter );
      -		},
      -
      -		writeChildrenHtml : function( writer, filter )
      -		{
      -			for ( var i = 0 ; i < this.children.length ; i++ )
      -				this.children[i].writeHtml( writer, filter );
      -		}
      -	};
      -})();
      diff --git a/public/javascripts/ckeditor/_source/core/htmlparser/text.js b/public/javascripts/ckeditor/_source/core/htmlparser/text.js
      deleted file mode 100644
      index 0d63ac9..0000000
      --- a/public/javascripts/ckeditor/_source/core/htmlparser/text.js
      +++ /dev/null
      @@ -1,55 +0,0 @@
      -/*
      -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
      -For licensing, see LICENSE.html or http://ckeditor.com/license
      -*/
      -
      -(function()
      -{
      -	var spacesRegex = /[\t\r\n ]{2,}|[\t\r\n]/g;
      -
      -	/**
      -	 * A lightweight representation of HTML text.
      -	 * @constructor
      -	 * @example
      -	 */
      - 	CKEDITOR.htmlParser.text = function( value )
      -	{
      -		/**
      -		 * The text value.
      -		 * @type String
      -		 * @example
      -		 */
      -		this.value = value;
      -
      -		/** @private */
      -		this._ =
      -		{
      -			isBlockLike : false
      -		};
      -	};
      -
      -	CKEDITOR.htmlParser.text.prototype =
      -	{
      -		/**
      -		 * The node type. This is a constant value set to {@link CKEDITOR.NODE_TEXT}.
      -		 * @type Number
      -		 * @example
      -		 */
      -		type : CKEDITOR.NODE_TEXT,
      -
      -		/**
      -		 * Writes the HTML representation of this text to a CKEDITOR.htmlWriter.
      -		 * @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
      -		 * @example
      -		 */
      -		writeHtml : function( writer, filter )
      -		{
      -			var text = this.value;
      -
      -			if ( filter && !( text = filter.onText( text, this ) ) )
      -				return;
      -
      -			writer.text( text );
      -		}
      -	};
      -})();
      diff --git a/public/javascripts/ckeditor/_source/core/imagecacher.js b/public/javascripts/ckeditor/_source/core/imagecacher.js
      deleted file mode 100644
      index 0704556..0000000
      --- a/public/javascripts/ckeditor/_source/core/imagecacher.js
      +++ /dev/null
      @@ -1,59 +0,0 @@
      -/*
      -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
      -For licensing, see LICENSE.html or http://ckeditor.com/license
      -*/
      -
      -(function()
      -{
      -	var loaded = {};
      -
      -	var loadImage = function( image, callback )
      -	{
      -		var doCallback = function()
      -			{
      -				img.removeAllListeners();
      -				loaded[ image ] = 1;
      -				callback();
      -			};
      -
      -		var img = new CKEDITOR.dom.element( 'img' );
      -		img.on( 'load', doCallback );
      -		img.on( 'error', doCallback );
      -		img.setAttribute( 'src', image );
      -	};
      -
      -	/**
      -	 * Load images into the browser cache.
      -	 * @namespace
      -	 * @example
      -	 */
      - 	CKEDITOR.imageCacher =
      -	{
      -		/**
      -		 * Loads one or more images.
      -		 * @param {Array} images The URLs for the images to be loaded.
      -		 * @param {Function} callback The function to be called once all images
      -		 *		are loaded.
      -		 */
      -		load : function( images, callback )
      -		{
      -			var pendingCount = images.length;
      -
      -			var checkPending = function()
      -			{
      -				if ( --pendingCount === 0 )
      -					callback();
      -			};
      -
      -			for ( var i = 0 ; i < images.length ; i++ )
      -			{
      -				var image = images[ i ];
      -
      -				if ( loaded[ image ] )
      -					checkPending();
      -				else
      -					loadImage( image, checkPending );
      -			}
      -		}
      -	};
      -})();
      diff --git a/public/javascripts/ckeditor/_source/core/lang.js b/public/javascripts/ckeditor/_source/core/lang.js
      deleted file mode 100644
      index add9982..0000000
      --- a/public/javascripts/ckeditor/_source/core/lang.js
      +++ /dev/null
      @@ -1,152 +0,0 @@
      -/*
      -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
      -For licensing, see LICENSE.html or http://ckeditor.com/license
      -*/
      -
      -(function()
      -{
      -	var loadedLangs = {};
      -
      -	CKEDITOR.lang =
      -	{
      -		/**
      -		 * The list of languages available in the editor core.
      -		 * @type Object
      -		 * @example
      -		 * alert( CKEDITOR.lang.en );  // "true"
      -		 */
      -		languages :
      -		{
      -			'af'	: 1,
      -			'ar'	: 1,
      -			'bg'	: 1,
      -			'bn'	: 1,
      -			'bs'	: 1,
      -			'ca'	: 1,
      -			'cs'	: 1,
      -			'cy'	: 1,
      -			'da'	: 1,
      -			'de'	: 1,
      -			'el'	: 1,
      -			'en-au'	: 1,
      -			'en-ca'	: 1,
      -			'en-gb'	: 1,
      -			'en'	: 1,
      -			'eo'	: 1,
      -			'es'	: 1,
      -			'et'	: 1,
      -			'eu'	: 1,
      -			'fa'	: 1,
      -			'fi'	: 1,
      -			'fo'	: 1,
      -			'fr-ca'	: 1,
      -			'fr'	: 1,
      -			'gl'	: 1,
      -			'gu'	: 1,
      -			'he'	: 1,
      -			'hi'	: 1,
      -			'hr'	: 1,
      -			'hu'	: 1,
      -			'is'	: 1,
      -			'it'	: 1,
      -			'ja'	: 1,
      -			'km'	: 1,
      -			'ko'	: 1,
      -			'lt'	: 1,
      -			'lv'	: 1,
      -			'mn'	: 1,
      -			'ms'	: 1,
      -			'nb'	: 1,
      -			'nl'	: 1,
      -			'no'	: 1,
      -			'pl'	: 1,
      -			'pt-br'	: 1,
      -			'pt'	: 1,
      -			'ro'	: 1,
      -			'ru'	: 1,
      -			'sk'	: 1,
      -			'sl'	: 1,
      -			'sr-latn'	: 1,
      -			'sr'	: 1,
      -			'sv'	: 1,
      -			'th'	: 1,
      -			'tr'	: 1,
      -			'uk'	: 1,
      -			'vi'	: 1,
      -			'zh-cn'	: 1,
      -			'zh'	: 1
      -		},
      -
      -		/**
      -		 * Loads a specific language file, or auto detect it. A callback is
      -		 * then called when the file gets loaded.
      -		 * @param {String} languageCode The code of the language file to be
      -		 *		loaded. If "autoDetect" is set to true, this language will be
      -		 *		used as the default one, if the detect language is not
      -		 *		available in the core.
      -		 * @param {Boolean} autoDetect Indicates that the function must try to
      -		 *		detect the user language and load it instead.
      -		 * @param {Function} callback The function to be called once the
      -		 *		language file is loaded. Two parameters are passed to this
      -		 *		function: the language code and the loaded language entries.
      -		 * @example
      -		 */
      -		load : function( languageCode, defaultLanguage, callback )
      -		{
      -			// If no languageCode - fallback to browser or default.
      -			// If languageCode - fallback to no-localized version or default.
      -			if ( !languageCode || !CKEDITOR.lang.languages[ languageCode ] )
      -				languageCode = this.detect( defaultLanguage, languageCode );
      -
      -			if ( !this[ languageCode ] )
      -			{
      -				CKEDITOR.scriptLoader.load( CKEDITOR.getUrl(
      -					'_source/' +	// @Packager.RemoveLine
      -					'lang/' + languageCode + '.js' ),
      -					function()
      -						{
      -							callback( languageCode, this[ languageCode ] );
      -						}
      -						, this );
      -			}
      -			else
      -				callback( languageCode, this[ languageCode ] );
      -		},
      -
      -		/**
      -		 * Returns the language that best fit the user language. For example,
      -		 * suppose that the user language is "pt-br". If this language is
      -		 * supported by the editor, it is returned. Otherwise, if only "pt" is
      -		 * supported, it is returned instead. If none of the previous are
      -		 * supported, a default language is then returned.
      -		 * @param {String} defaultLanguage The default language to be returned
      -		 *		if the user language is not supported.
      -		 * @returns {String} The detected language code.
      -		 * @example
      -		 * alert( CKEDITOR.lang.detect( 'en' ) );  // e.g., in a German browser: "de"
      -		 */
      -		detect : function( defaultLanguage, probeLanguage )
      -		{
      -			var languages = this.languages;
      -			probeLanguage = probeLanguage || navigator.userLanguage || navigator.language;
      -
      -			var parts = probeLanguage
      -					.toLowerCase()
      -					.match( /([a-z]+)(?:-([a-z]+))?/ ),
      -				lang = parts[1],
      -				locale = parts[2];
      -
      -			if ( languages[ lang + '-' + locale ] )
      -				lang = lang + '-' + locale;
      -			else if ( !languages[ lang ] )
      -				lang = null;
      -
      -			CKEDITOR.lang.detect = lang ?
      -				function() { return lang; } :
      -				function( defaultLanguage ) { return defaultLanguage; };
      -
      -			return lang || defaultLanguage;
      -		}
      -	};
      -
      -})();
      diff --git a/public/javascripts/ckeditor/_source/core/loader.js b/public/javascripts/ckeditor/_source/core/loader.js
      deleted file mode 100644
      index 4c408fb..0000000
      --- a/public/javascripts/ckeditor/_source/core/loader.js
      +++ /dev/null
      @@ -1,242 +0,0 @@
      -/*
      -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
      -For licensing, see LICENSE.html or http://ckeditor.com/license
      -*/
      -
      -/**
      - * @fileOverview Defines the {@link CKEDITOR.loader} objects, which is used to
      - *		load core scripts and their dependencies from _source.
      - */
      -
      -if ( typeof CKEDITOR == 'undefined' )
      -	CKEDITOR = {};
      -
      -if ( !CKEDITOR.loader )
      -{
      -	/**
      -	 * Load core scripts and their dependencies from _source.
      -	 * @namespace
      -	 * @example
      -	 */
      -	CKEDITOR.loader = (function()
      -	{
      -		// Table of script names and their dependencies.
      -		var scripts =
      -		{
      -			'core/_bootstrap'		: [ 'core/config', 'core/ckeditor', 'core/plugins', 'core/scriptloader', 'core/tools', /* The following are entries that we want to force loading at the end to avoid dependence recursion */ 'core/dom/comment', 'core/dom/elementpath', 'core/dom/text', 'core/dom/range' ],
      -			'core/ajax'				: [ 'core/xml' ],
      -			'core/ckeditor'			: [ 'core/ckeditor_basic', 'core/dom', 'core/dtd', 'core/dom/document', 'core/dom/element', 'core/editor', 'core/event', 'core/htmlparser', 'core/htmlparser/element', 'core/htmlparser/fragment', 'core/htmlparser/filter', 'core/htmlparser/basicwriter', 'core/tools' ],
      -			'core/ckeditor_base'	: [],
      -			'core/ckeditor_basic'	: [ 'core/editor_basic', 'core/env', 'core/event' ],
      -			'core/command'			: [],
      -			'core/config'			: [ 'core/ckeditor_base' ],
      -			'core/dom'				: [],
      -			'core/dom/comment'		: [ 'core/dom/node' ],
      -			'core/dom/document'		: [ 'core/dom', 'core/dom/domobject', 'core/dom/window' ],
      -			'core/dom/documentfragment'	: [ 'core/dom/element' ],
      -			'core/dom/element'		: [ 'core/dom', 'core/dom/document', 'core/dom/domobject', 'core/dom/node', 'core/dom/nodelist', 'core/tools' ],
      -			'core/dom/elementpath'	: [ 'core/dom/element' ],
      -			'core/dom/event'		: [],
      -			'core/dom/node'			: [ 'core/dom/domobject', 'core/tools' ],
      -			'core/dom/nodelist'		: [ 'core/dom/node' ],
      -			'core/dom/domobject'	: [ 'core/dom/event' ],
      -			'core/dom/range'		: [ 'core/dom/document', 'core/dom/documentfragment', 'core/dom/element', 'core/dom/walker' ],
      -			'core/dom/text'			: [ 'core/dom/node', 'core/dom/domobject' ],
      -			'core/dom/walker'		: [ 'core/dom/node' ],
      -			'core/dom/window'		: [ 'core/dom/domobject' ],
      -			'core/dtd'				: [ 'core/tools' ],
      -			'core/editor'			: [ 'core/command', 'core/config', 'core/editor_basic', 'core/focusmanager', 'core/lang', 'core/plugins', 'core/skins', 'core/themes', 'core/tools', 'core/ui' ],
      -			'core/editor_basic'		: [ 'core/event' ],
      -			'core/env'				: [],
      -			'core/event'			: [],
      -			'core/focusmanager'		: [],
      -			'core/htmlparser'		: [],
      -			'core/htmlparser/comment'	: [ 'core/htmlparser' ],
      -			'core/htmlparser/element'	: [ 'core/htmlparser', 'core/htmlparser/fragment' ],
      -			'core/htmlparser/fragment'	: [ 'core/htmlparser', 'core/htmlparser/comment', 'core/htmlparser/text', 'core/htmlparser/cdata' ],
      -			'core/htmlparser/text'		: [ 'core/htmlparser' ],
      -			'core/htmlparser/cdata'		: [ 'core/htmlparser' ],
      -			'core/htmlparser/filter'	: [ 'core/htmlparser' ],
      -			'core/htmlparser/basicwriter': [ 'core/htmlparser' ],
      -			'core/imagecacher'		: [ 'core/dom/element' ],
      -			'core/lang'				: [],
      -			'core/plugins'			: [ 'core/resourcemanager' ],
      -			'core/resourcemanager'	: [ 'core/scriptloader', 'core/tools' ],
      -			'core/scriptloader'		: [ 'core/dom/element', 'core/env' ],
      -			'core/skins'			: [ 'core/imagecacher', 'core/scriptloader' ],
      -			'core/themes'			: [ 'core/resourcemanager' ],
      -			'core/tools'			: [ 'core/env' ],
      -			'core/ui'				: [],
      -			'core/xml'				: [ 'core/env' ]
      -		};
      -
      -		var basePath = (function()
      -		{
      -			// This is a copy of CKEDITOR.basePath, but requires the script having
      -			// "_source/core/loader.js".
      -			if ( CKEDITOR && CKEDITOR.basePath )
      -				return CKEDITOR.basePath;
      -
      -			// Find out the editor directory path, based on its ';
      -
      -			var iframe = CKEDITOR.dom.element.createFromHtml(
      -						'' );
      -
      -			iframe.on( 'load', function( e )
      -			{
      -				e.removeListener();
      -				var doc = iframe.getFrameDocument().$;
      -				// Custom domain handling is needed after each document.open().
      -				doc.open();
      -				if ( isCustomDomain )
      -					doc.domain = document.domain;
      -				doc.write( htmlToLoad );
      -				doc.close();
      -			}, this );
      -
      -			iframe.setStyles(
      -				{
      -					width : '346px',
      -					height : '130px',
      -					'background-color' : 'white',
      -					border : '1px solid black'
      -				} );
      -			iframe.setCustomData( 'dialog', this );
      -
      -			var field = this.getContentElement( 'general', 'editing_area' ),
      -				container = field.getElement();
      -			container.setHtml( '' );
      -			container.append( iframe );
      -
      -			field.getInputElement = function(){ return iframe; };
      -
      -			// Force container to scale in IE.
      -			if ( CKEDITOR.env.ie )
      -			{
      -				container.setStyle( 'display', 'block' );
      -				container.setStyle( 'height', ( iframe.$.offsetHeight + 2 ) + 'px' );
      -			}
      -		},
      -
      -		onHide : function()
      -		{
      -			if ( CKEDITOR.env.ie )
      -				this.getParentEditor().document.getBody().$.contentEditable = 'true';
      -		},
      -
      -		onLoad : function()
      -		{
      -			if ( ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) && editor.lang.dir == 'rtl' )
      -				this.parts.contents.setStyle( 'overflow', 'hidden' );
      -		},
      -
      -		onOk : function()
      -		{
      -			var container = this.getContentElement( 'general', 'editing_area' ).getElement(),
      -				iframe = container.getElementsByTag( 'iframe' ).getItem( 0 ),
      -				editor = this.getParentEditor(),
      -				html = iframe.$.contentWindow.document.body.innerHTML;
      -
      -			setTimeout( function(){
      -				editor.fire( 'paste', { 'html' : html } );
      -			}, 0 );
      -
      -		},
      -
      -		contents : [
      -			{
      -				id : 'general',
      -				label : editor.lang.common.generalTab,
      -				elements : [
      -					{
      -						type : 'html',
      -						id : 'securityMsg',
      -						html : '
      ' + lang.securityMsg + '
      ' - }, - { - type : 'html', - id : 'pasteMsg', - html : '
      '+lang.pasteMsg +'
      ' - }, - { - type : 'html', - id : 'editing_area', - style : 'width: 100%; height: 100%;', - html : '', - focus : function() - { - var win = this.getInputElement().$.contentWindow, - body = win && win.document.body; - - // #3291 : JAWS needs the 500ms delay to detect that the editor iframe - // iframe is no longer editable. So that it will put the focus into the - // Paste from Word dialog's editable area instead. - setTimeout( function() - { - // Reactivate design mode for IE to make the cursor blinking. - CKEDITOR.env.ie && body && ( body.contentEditable = "true" ); - win.focus(); - }, 500 ); - } - } - ] - } - ] - }; -}); diff --git a/public/javascripts/ckeditor/_source/plugins/clipboard/plugin.js b/public/javascripts/ckeditor/_source/plugins/clipboard/plugin.js deleted file mode 100644 index 23c58bf..0000000 --- a/public/javascripts/ckeditor/_source/plugins/clipboard/plugin.js +++ /dev/null @@ -1,379 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @file Clipboard support - */ - -(function() -{ - // Tries to execute any of the paste, cut or copy commands in IE. Returns a - // boolean indicating that the operation succeeded. - var execIECommand = function( editor, command ) - { - var doc = editor.document, - body = doc.getBody(); - - var enabled = false; - var onExec = function() - { - enabled = true; - }; - - // The following seems to be the only reliable way to detect that - // clipboard commands are enabled in IE. It will fire the - // onpaste/oncut/oncopy events only if the security settings allowed - // the command to execute. - body.on( command, onExec ); - - // IE6/7: document.execCommand has problem to paste into positioned element. - ( CKEDITOR.env.version > 7 ? doc.$ : doc.$.selection.createRange() ) [ 'execCommand' ]( command ); - - body.removeListener( command, onExec ); - - return enabled; - }; - - // Attempts to execute the Cut and Copy operations. - var tryToCutCopy = - CKEDITOR.env.ie ? - function( editor, type ) - { - return execIECommand( editor, type ); - } - : // !IE. - function( editor, type ) - { - try - { - // Other browsers throw an error if the command is disabled. - return editor.document.$.execCommand( type ); - } - catch( e ) - { - return false; - } - }; - - // A class that represents one of the cut or copy commands. - var cutCopyCmd = function( type ) - { - this.type = type; - this.canUndo = ( this.type == 'cut' ); // We can't undo copy to clipboard. - }; - - cutCopyCmd.prototype = - { - exec : function( editor, data ) - { - var success = tryToCutCopy( editor, this.type ); - - if ( !success ) - alert( editor.lang.clipboard[ this.type + 'Error' ] ); // Show cutError or copyError. - - return success; - } - }; - - // Paste command. - var pasteCmd = - { - canUndo : false, - - exec : - CKEDITOR.env.ie ? - function( editor ) - { - // Prevent IE from pasting at the begining of the document. - editor.focus(); - - if ( !editor.document.getBody().fire( 'beforepaste' ) - && !execIECommand( editor, 'paste' ) ) - { - editor.fire( 'pasteDialog' ); - return false; - } - } - : - function( editor ) - { - try - { - if ( !editor.document.getBody().fire( 'beforepaste' ) - && !editor.document.$.execCommand( 'Paste', false, null ) ) - { - throw 0; - } - } - catch ( e ) - { - setTimeout( function() - { - editor.fire( 'pasteDialog' ); - }, 0 ); - return false; - } - } - }; - - // Listens for some clipboard related keystrokes, so they get customized. - var onKey = function( event ) - { - if ( this.mode != 'wysiwyg' ) - return; - - switch ( event.data.keyCode ) - { - // Paste - case CKEDITOR.CTRL + 86 : // CTRL+V - case CKEDITOR.SHIFT + 45 : // SHIFT+INS - - var body = this.document.getBody(); - - // Simulate 'beforepaste' event for all none-IEs. - if ( !CKEDITOR.env.ie && body.fire( 'beforepaste' ) ) - event.cancel(); - // Simulate 'paste' event for Opera/Firefox2. - else if ( CKEDITOR.env.opera - || CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 ) - body.fire( 'paste' ); - return; - - // Cut - case CKEDITOR.CTRL + 88 : // CTRL+X - case CKEDITOR.SHIFT + 46 : // SHIFT+DEL - - // Save Undo snapshot. - var editor = this; - this.fire( 'saveSnapshot' ); // Save before paste - setTimeout( function() - { - editor.fire( 'saveSnapshot' ); // Save after paste - }, 0 ); - } - }; - - // Allow to peek clipboard content by redirecting the - // pasting content into a temporary bin and grab the content of it. - function getClipboardData( evt, mode, callback ) - { - var doc = this.document; - - // Avoid recursions on 'paste' event for IE. - if ( CKEDITOR.env.ie && doc.getById( 'cke_pastebin' ) ) - return; - - // If the browser supports it, get the data directly - if (mode == 'text' && evt.data && evt.data.$.clipboardData) - { - // evt.data.$.clipboardData.types contains all the flavours in Mac's Safari, but not on windows. - var plain = evt.data.$.clipboardData.getData( 'text/plain' ); - if (plain) - { - evt.data.preventDefault(); - callback( plain ); - return; - } - } - - var sel = this.getSelection(), - range = new CKEDITOR.dom.range( doc ); - - // Create container to paste into - var pastebin = new CKEDITOR.dom.element( mode == 'text' ? 'textarea' : 'div', doc ); - pastebin.setAttribute( 'id', 'cke_pastebin' ); - // Safari requires a filler node inside the div to have the content pasted into it. (#4882) - CKEDITOR.env.webkit && pastebin.append( doc.createText( '\xa0' ) ); - doc.getBody().append( pastebin ); - - // It's definitely a better user experience if we make the paste-bin pretty unnoticed - // by pulling it off the screen. - pastebin.setStyles( - { - position : 'absolute', - left : '-1000px', - // Position the bin exactly at the position of the selected element - // to avoid any subsequent document scroll. - top : sel.getStartElement().getDocumentPosition().y + 'px', - width : '1px', - height : '1px', - overflow : 'hidden' - }); - - var bms = sel.createBookmarks(); - - // Turn off design mode temporarily before give focus to the paste bin. - if ( mode == 'text' ) - { - if ( CKEDITOR.env.ie ) - { - var ieRange = doc.getBody().$.createTextRange(); - ieRange.moveToElementText( pastebin.$ ); - ieRange.execCommand( 'Paste' ); - evt.data.preventDefault(); - } - else - { - doc.$.designMode = 'off'; - pastebin.$.focus(); - } - } - else - { - range.setStartAt( pastebin, CKEDITOR.POSITION_AFTER_START ); - range.setEndAt( pastebin, CKEDITOR.POSITION_BEFORE_END ); - range.select( true ); - } - - // Wait a while and grab the pasted contents - window.setTimeout( function() - { - mode == 'text' && !CKEDITOR.env.ie && ( doc.$.designMode = 'on' ); - pastebin.remove(); - - // Grab the HTML contents. - // We need to look for a apple style wrapper on webkit it also adds - // a div wrapper if you copy/paste the body of the editor. - // Remove hidden div and restore selection. - var bogusSpan; - pastebin = ( CKEDITOR.env.webkit - && ( bogusSpan = pastebin.getFirst() ) - && ( bogusSpan.is && bogusSpan.hasClass( 'Apple-style-span' ) ) ? - bogusSpan : pastebin ); - - sel.selectBookmarks( bms ); - callback( pastebin[ 'get' + ( mode == 'text' ? 'Value' : 'Html' ) ]() ); - }, 0 ); - } - - // Register the plugin. - CKEDITOR.plugins.add( 'clipboard', - { - requires : [ 'dialog', 'htmldataprocessor' ], - init : function( editor ) - { - // Inserts processed data into the editor at the end of the - // events chain. - editor.on( 'paste', function( evt ) - { - var data = evt.data; - if ( data[ 'html' ] ) - editor.insertHtml( data[ 'html' ] ); - else if ( data[ 'text' ] ) - editor.insertText( data[ 'text' ] ); - - }, null, null, 1000 ); - - editor.on( 'pasteDialog', function( evt ) - { - setTimeout( function() - { - // Open default paste dialog. - editor.openDialog( 'paste' ); - }, 0 ); - }); - - function addButtonCommand( buttonName, commandName, command, ctxMenuOrder ) - { - var lang = editor.lang[ commandName ]; - - editor.addCommand( commandName, command ); - editor.ui.addButton( buttonName, - { - label : lang, - command : commandName - }); - - // If the "menu" plugin is loaded, register the menu item. - if ( editor.addMenuItems ) - { - editor.addMenuItem( commandName, - { - label : lang, - command : commandName, - group : 'clipboard', - order : ctxMenuOrder - }); - } - } - - addButtonCommand( 'Cut', 'cut', new cutCopyCmd( 'cut' ), 1 ); - addButtonCommand( 'Copy', 'copy', new cutCopyCmd( 'copy' ), 4 ); - addButtonCommand( 'Paste', 'paste', pasteCmd, 8 ); - - CKEDITOR.dialog.add( 'paste', CKEDITOR.getUrl( this.path + 'dialogs/paste.js' ) ); - - editor.on( 'key', onKey, editor ); - - var mode = editor.config.forcePasteAsPlainText ? 'text' : 'html'; - - // We'll be catching all pasted content in one line, regardless of whether the - // it's introduced by a document command execution (e.g. toolbar buttons) or - // user paste behaviors. (e.g. Ctrl-V) - editor.on( 'contentDom', function() - { - var body = editor.document.getBody(); - body.on( ( (mode == 'text' && CKEDITOR.env.ie) || CKEDITOR.env.webkit ) ? 'paste' : 'beforepaste', - function( evt ) - { - if ( depressBeforePasteEvent ) - return; - - getClipboardData.call( editor, evt, mode, function ( data ) - { - // The very last guard to make sure the - // paste has successfully happened. - if ( !data ) - return; - - var dataTransfer = {}; - dataTransfer[ mode ] = data; - editor.fire( 'paste', dataTransfer ); - } ); - }); - - }); - - // If the "contextmenu" plugin is loaded, register the listeners. - if ( editor.contextMenu ) - { - var depressBeforePasteEvent; - function stateFromNamedCommand( command ) - { - // IE Bug: queryCommandEnabled('paste') fires also 'beforepaste', - // guard to distinguish from the ordinary sources( either - // keyboard paste or execCommand ) (#4874). - CKEDITOR.env.ie && command == 'Paste'&& ( depressBeforePasteEvent = 1 ); - - var retval = editor.document.$.queryCommandEnabled( command ) ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED; - depressBeforePasteEvent = 0; - return retval; - } - - editor.contextMenu.addListener( function() - { - return { - cut : stateFromNamedCommand( 'Cut' ), - - // Browser bug: 'Cut' has the correct states for both Copy and Cut. - copy : stateFromNamedCommand( 'Cut' ), - paste : CKEDITOR.env.webkit ? CKEDITOR.TRISTATE_OFF : stateFromNamedCommand( 'Paste' ) - }; - }); - } - } - }); -})(); - -/** - * Fired when a clipboard operation is about to be taken into the editor. - * Listeners can manipulate the data to be pasted before having it effectively - * inserted into the document. - * @name CKEDITOR.editor#paste - * @since 3.1 - * @event - * @param {String} [data.html] The HTML data to be pasted. If not available, e.data.text will be defined. - * @param {String} [data.text] The plain text data to be pasted, available when plain text operations are to used. If not available, e.data.html will be defined. - */ diff --git a/public/javascripts/ckeditor/_source/plugins/colorbutton/plugin.js b/public/javascripts/ckeditor/_source/plugins/colorbutton/plugin.js deleted file mode 100644 index 2a14bb0..0000000 --- a/public/javascripts/ckeditor/_source/plugins/colorbutton/plugin.js +++ /dev/null @@ -1,247 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -CKEDITOR.plugins.add( 'colorbutton', -{ - requires : [ 'panelbutton', 'floatpanel', 'styles' ], - - init : function( editor ) - { - var config = editor.config, - lang = editor.lang.colorButton; - - var clickFn; - - if ( !CKEDITOR.env.hc ) - { - addButton( 'TextColor', 'fore', lang.textColorTitle ); - addButton( 'BGColor', 'back', lang.bgColorTitle ); - } - - function addButton( name, type, title ) - { - editor.ui.add( name, CKEDITOR.UI_PANELBUTTON, - { - label : title, - title : title, - className : 'cke_button_' + name.toLowerCase(), - modes : { wysiwyg : 1 }, - - panel : - { - css : editor.skin.editor.css, - attributes : { role : 'listbox', 'aria-label' : lang.panelTitle } - }, - - onBlock : function( panel, block ) - { - block.autoSize = true; - block.element.addClass( 'cke_colorblock' ); - block.element.setHtml( renderColors( panel, type ) ); - - var keys = block.keys; - keys[ 39 ] = 'next'; // ARROW-RIGHT - keys[ 40 ] = 'next'; // ARROW-DOWN - keys[ 9 ] = 'next'; // TAB - keys[ 37 ] = 'prev'; // ARROW-LEFT - keys[ 38 ] = 'prev'; // ARROW-UP - keys[ CKEDITOR.SHIFT + 9 ] = 'prev'; // SHIFT + TAB - keys[ 32 ] = 'click'; // SPACE - } - }); - } - - - function renderColors( panel, type ) - { - var output = [], - colors = config.colorButton_colors.split( ',' ), - total = colors.length + ( config.colorButton_enableMore ? 2 : 1 ); - - var clickFn = CKEDITOR.tools.addFunction( function( color, type ) - { - if ( color == '?' ) - { - var applyColorStyle = arguments.callee; - function onColorDialogClose( evt ) - { - this.removeListener( 'ok', onColorDialogClose ); - this.removeListener( 'cancel', onColorDialogClose ); - - evt.name == 'ok' && applyColorStyle( this.getContentElement( 'picker', 'selectedColor' ).getValue(), type ); - } - - editor.openDialog( 'colordialog', function() - { - this.on( 'ok', onColorDialogClose ); - this.on( 'cancel', onColorDialogClose ); - } ); - - return; - } - - editor.focus(); - - panel.hide(); - - - editor.fire( 'saveSnapshot' ); - - // Clean up any conflicting style within the range. - new CKEDITOR.style( config['colorButton_' + type + 'Style'], { color : 'inherit' } ).remove( editor.document ); - - if ( color ) - { - var colorStyle = config['colorButton_' + type + 'Style']; - - colorStyle.childRule = type == 'back' ? - // It's better to apply background color as the innermost style. (#3599) - function(){ return false; } : - // Fore color style must be applied inside links instead of around it. - function( element ){ return element.getName() != 'a'; }; - - new CKEDITOR.style( colorStyle, { color : color } ).apply( editor.document ); - } - - editor.fire( 'saveSnapshot' ); - }); - - // Render the "Automatic" button. - output.push( - '' + - '' + - '' + - '' + - '' + - '' + - '
      ' + - '' + - '', - lang.auto, - '
      ' + - '
      ' + - '' ); - - // Render the color boxes. - for ( var i = 0 ; i < colors.length ; i++ ) - { - if ( ( i % 8 ) === 0 ) - output.push( '' ); - - var parts = colors[ i ].split( '/' ), - colorName = parts[ 0 ], - colorCode = parts[ 1 ] || colorName; - - // The data can be only a color code (without #) or colorName + color code - // If only a color code is provided, then the colorName is the color with the hash - if (!parts[1]) - colorName = '#' + colorName; - - var colorLabel = editor.lang.colors[ colorCode ] || colorCode; - output.push( - '' ); - } - - // Render the "More Colors" button. - if ( config.colorButton_enableMore ) - { - output.push( - '' + - '' + - '' ); // It is later in the code. - } - - output.push( '
      ' + - '' + - '' + - '' + - '
      ' + - '', - lang.more, - '' + - '
      ' ); - - return output.join( '' ); - } - } -}); - -/** - * Whether to enable the "More Colors..." button in the color selectors. - * @default false - * @type Boolean - * @example - * config.colorButton_enableMore = false; - */ -CKEDITOR.config.colorButton_enableMore = true; - -/** - * Defines the colors to be displayed in the color selectors. It's a string - * containing the hexadecimal notation for HTML colors, without the "#" prefix. - * - * Since 3.3: A name may be optionally defined by prefixing the entries with the - * name and the slash character. For example, "FontColor1/FF9900" will be - * displayed as the color #FF9900 in the selector, but will be outputted as "FontColor1". - * @type String - * @default '000,800000,8B4513,2F4F4F,008080,000080,4B0082,696969,B22222,A52A2A,DAA520,006400,40E0D0,0000CD,800080,808080,F00,FF8C00,FFD700,008000,0FF,00F,EE82EE,A9A9A9,FFA07A,FFA500,FFFF00,00FF00,AFEEEE,ADD8E6,DDA0DD,D3D3D3,FFF0F5,FAEBD7,FFFFE0,F0FFF0,F0FFFF,F0F8FF,E6E6FA,FFF' - * @example - * // Brazil colors only. - * config.colorButton_colors = '00923E,F8C100,28166F'; - * @example - * config.colorButton_colors = 'FontColor1/FF9900,FontColor2/0066CC,FontColor3/F00' - */ -CKEDITOR.config.colorButton_colors = - '000,800000,8B4513,2F4F4F,008080,000080,4B0082,696969,' + - 'B22222,A52A2A,DAA520,006400,40E0D0,0000CD,800080,808080,' + - 'F00,FF8C00,FFD700,008000,0FF,00F,EE82EE,A9A9A9,' + - 'FFA07A,FFA500,FFFF00,00FF00,AFEEEE,ADD8E6,DDA0DD,D3D3D3,' + - 'FFF0F5,FAEBD7,FFFFE0,F0FFF0,F0FFFF,F0F8FF,E6E6FA,FFF'; - -/** - * Holds the style definition to be used to apply the text foreground color. - * @type Object - * @example - * // This is basically the default setting value. - * config.colorButton_foreStyle = - * { - * element : 'span', - * styles : { 'color' : '#(color)' } - * }; - */ -CKEDITOR.config.colorButton_foreStyle = - { - element : 'span', - styles : { 'color' : '#(color)' }, - overrides : [ { element : 'font', attributes : { 'color' : null } } ] - }; - -/** - * Holds the style definition to be used to apply the text background color. - * @type Object - * @example - * // This is basically the default setting value. - * config.colorButton_backStyle = - * { - * element : 'span', - * styles : { 'background-color' : '#(color)' } - * }; - */ -CKEDITOR.config.colorButton_backStyle = - { - element : 'span', - styles : { 'background-color' : '#(color)' } - }; diff --git a/public/javascripts/ckeditor/_source/plugins/colordialog/dialogs/colordialog.js b/public/javascripts/ckeditor/_source/plugins/colordialog/dialogs/colordialog.js deleted file mode 100644 index d99d033..0000000 --- a/public/javascripts/ckeditor/_source/plugins/colordialog/dialogs/colordialog.js +++ /dev/null @@ -1,191 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -CKEDITOR.dialog.add( 'colordialog', function( editor ) - { - // Define some shorthands. - var $el = CKEDITOR.dom.element, - $doc = CKEDITOR.document, - $tools = CKEDITOR.tools, - lang = editor.lang.colordialog; - - // Reference the dialog. - var dialog; - - function spacer() - { - return { - type : 'html', - html : ' ' - }; - } - - var table = new $el( 'table' ); - createColorTable(); - - var cellMouseover = function( event ) - { - var color = new $el( event.data.getTarget() ).getAttribute( 'title' ); - $doc.getById( 'hicolor' ).setStyle( 'background-color', color ); - $doc.getById( 'hicolortext' ).setHtml( color ); - }; - - var cellClick = function( event ) - { - var color = new $el( event.data.getTarget() ).getAttribute( 'title' ); - dialog.getContentElement( 'picker', 'selectedColor' ).setValue( color ); - }; - - function createColorTable() - { - // Create the base colors array. - var aColors = ['00','33','66','99','cc','ff']; - - // This function combines two ranges of three values from the color array into a row. - function appendColorRow( rangeA, rangeB ) - { - for ( var i = rangeA ; i < rangeA + 3 ; i++ ) - { - var row = table.$.insertRow(-1); - - for ( var j = rangeB ; j < rangeB + 3 ; j++ ) - { - for ( var n = 0 ; n < 6 ; n++ ) - { - appendColorCell( row, '#' + aColors[j] + aColors[n] + aColors[i] ); - } - } - } - } - - // This function create a single color cell in the color table. - function appendColorCell( targetRow, color ) - { - var cell = new $el( targetRow.insertCell( -1 ) ); - cell.setAttribute( 'class', 'ColorCell' ); - cell.setStyle( 'background-color', color ); - - cell.setStyle( 'width', '15px' ); - cell.setStyle( 'height', '15px' ); - - // Pass unparsed color value in some markup-degradable form. - cell.setAttribute( 'title', color ); - } - - appendColorRow( 0, 0 ); - appendColorRow( 3, 0 ); - appendColorRow( 0, 3 ); - appendColorRow( 3, 3 ); - - // Create the last row. - var oRow = table.$.insertRow(-1) ; - - // Create the gray scale colors cells. - for ( var n = 0 ; n < 6 ; n++ ) - { - appendColorCell( oRow, '#' + aColors[n] + aColors[n] + aColors[n] ) ; - } - - // Fill the row with black cells. - for ( var i = 0 ; i < 12 ; i++ ) - { - appendColorCell( oRow, '#000000' ) ; - } - } - - function clear() - { - $doc.getById( 'selhicolor' ).removeStyle( 'background-color' ); - dialog.getContentElement( 'picker', 'selectedColor' ).setValue( '' ); - } - - var clearActual = $tools.addFunction( function() - { - $doc.getById( 'hicolor' ).removeStyle( 'background-color' ); - $doc.getById( 'hicolortext' ).setHtml( ' ' ); - } ); - - return { - title : lang.title, - minWidth : 360, - minHeight : 220, - onLoad : function() - { - // Update reference. - dialog = this; - }, - contents : [ - { - id : 'picker', - label : lang.title, - accessKey : 'I', - elements : - [ - { - type : 'hbox', - padding : 0, - widths : [ '70%', '10%', '30%' ], - children : - [ - { - type : 'html', - html : '' + table.getHtml() + '
      ', - onLoad : function() - { - var table = CKEDITOR.document.getById( this.domId ); - table.on( 'mouseover', cellMouseover ); - table.on( 'click', cellClick ); - } - }, - spacer(), - { - type : 'vbox', - padding : 0, - widths : [ '70%', '5%', '25%' ], - children : - [ - { - type : 'html', - html : '' + lang.highlight +'\ -
      \ -
       
      \ - ' + lang.selected +'\ -
      ' - }, - { - type : 'text', - id : 'selectedColor', - style : 'width: 74px', - onChange : function() - { - // Try to update color preview with new value. If fails, then set it no none. - try - { - $doc.getById( 'selhicolor' ).setStyle( 'background-color', this.getValue() ); - } - catch ( e ) - { - clear(); - } - } - }, - spacer(), - { - type : 'button', - id : 'clear', - style : 'margin-top: 5px', - label : lang.clear, - onClick : clear - } - ] - } - ] - } - ] - } - ] - }; - } - ); diff --git a/public/javascripts/ckeditor/_source/plugins/colordialog/plugin.js b/public/javascripts/ckeditor/_source/plugins/colordialog/plugin.js deleted file mode 100644 index 7006d68..0000000 --- a/public/javascripts/ckeditor/_source/plugins/colordialog/plugin.js +++ /dev/null @@ -1,13 +0,0 @@ -( function() -{ - CKEDITOR.plugins.colordialog = - { - init : function( editor ) - { - editor.addCommand( 'colordialog', new CKEDITOR.dialogCommand( 'colordialog' ) ); - CKEDITOR.dialog.add( 'colordialog', this.path + 'dialogs/colordialog.js' ); - } - }; - - CKEDITOR.plugins.add( 'colordialog', CKEDITOR.plugins.colordialog ); -} )(); diff --git a/public/javascripts/ckeditor/_source/plugins/contextmenu/plugin.js b/public/javascripts/ckeditor/_source/plugins/contextmenu/plugin.js deleted file mode 100644 index 926333b..0000000 --- a/public/javascripts/ckeditor/_source/plugins/contextmenu/plugin.js +++ /dev/null @@ -1,274 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -CKEDITOR.plugins.add( 'contextmenu', -{ - requires : [ 'menu' ], - - beforeInit : function( editor ) - { - editor.contextMenu = new CKEDITOR.plugins.contextMenu( editor ); - - editor.addCommand( 'contextMenu', - { - exec : function() - { - editor.contextMenu.show( editor.document.getBody() ); - } - }); - } -}); - -CKEDITOR.plugins.contextMenu = CKEDITOR.tools.createClass( -{ - $ : function( editor ) - { - this.id = 'cke_' + CKEDITOR.tools.getNextNumber(); - this.editor = editor; - this._.listeners = []; - this._.functionId = CKEDITOR.tools.addFunction( function( commandName ) - { - this._.panel.hide(); - editor.focus(); - editor.execCommand( commandName ); - }, - this); - - this.definition = - { - panel: - { - className : editor.skinClass + ' cke_contextmenu', - attributes : - { - 'aria-label' : editor.lang.contextmenu.options - } - } - }; - }, - - _ : - { - onMenu : function( offsetParent, corner, offsetX, offsetY ) - { - var menu = this._.menu, - editor = this.editor; - - if ( menu ) - { - menu.hide(); - menu.removeAll(); - } - else - { - menu = this._.menu = new CKEDITOR.menu( editor, this.definition ); - menu.onClick = CKEDITOR.tools.bind( function( item ) - { - menu.hide(); - - if ( item.onClick ) - item.onClick(); - else if ( item.command ) - editor.execCommand( item.command ); - - }, this ); - - menu.onEscape = function( keystroke ) - { - var parent = this.parent; - // 1. If it's sub-menu, restore the last focused item - // of upper level menu. - // 2. In case of a top-menu, close it. - if ( parent ) - { - parent._.panel.hideChild(); - // Restore parent block item focus. - var parentBlock = parent._.panel._.panel._.currentBlock, - parentFocusIndex = parentBlock._.focusIndex; - parentBlock._.markItem( parentFocusIndex ); - } - else if ( keystroke == 27 ) - { - this.hide(); - editor.focus(); - } - return false; - }; - } - - var listeners = this._.listeners, - includedItems = []; - - var selection = this.editor.getSelection(), - element = selection && selection.getStartElement(); - - menu.onHide = CKEDITOR.tools.bind( function() - { - menu.onHide = null; - - if ( CKEDITOR.env.ie ) - { - var selection = editor.getSelection(); - selection && selection.unlock(); - } - - this.onHide && this.onHide(); - }, - this ); - - // Call all listeners, filling the list of items to be displayed. - for ( var i = 0 ; i < listeners.length ; i++ ) - { - var listenerItems = listeners[ i ]( element, selection ); - - if ( listenerItems ) - { - for ( var itemName in listenerItems ) - { - var item = this.editor.getMenuItem( itemName ); - - if ( item ) - { - item.state = listenerItems[ itemName ]; - menu.add( item ); - } - } - } - } - - // Don't show context menu with zero items. - menu.items.length && menu.show( offsetParent, corner || ( editor.lang.dir == 'rtl' ? 2 : 1 ), offsetX, offsetY ); - } - }, - - proto : - { - addTarget : function( element, nativeContextMenuOnCtrl ) - { - // Opera doesn't support 'contextmenu' event, we have duo approaches employed here: - // 1. Inherit the 'button override' hack we introduced in v2 (#4530), while this require the Opera browser - // option 'Allow script to detect context menu/right click events' to be always turned on. - // 2. Considering the fact that ctrl/meta key is not been occupied - // for multiple range selecting (like Gecko), we use this key - // combination as a fallback for triggering context-menu. (#4530) - if ( CKEDITOR.env.opera ) - { - var contextMenuOverrideButton; - element.on( 'mousedown', function( evt ) - { - evt = evt.data; - if ( evt.$.button != 2 ) - { - if ( evt.getKeystroke() == CKEDITOR.CTRL + 1 ) - element.fire( 'contextmenu', evt ); - return; - } - - if ( nativeContextMenuOnCtrl - && ( evt.$.ctrlKey || evt.$.metaKey ) ) - return; - - var target = evt.getTarget(); - - if ( !contextMenuOverrideButton ) - { - var ownerDoc = target.getDocument(); - contextMenuOverrideButton = ownerDoc.createElement( 'input' ) ; - contextMenuOverrideButton.$.type = 'button' ; - ownerDoc.getBody().append( contextMenuOverrideButton ) ; - } - - contextMenuOverrideButton.setAttribute( 'style', 'position:absolute;top:' + ( evt.$.clientY - 2 ) + - 'px;left:' + ( evt.$.clientX - 2 ) + - 'px;width:5px;height:5px;opacity:0.01' ); - - } ); - - element.on( 'mouseup', function ( evt ) - { - if ( contextMenuOverrideButton ) - { - contextMenuOverrideButton.remove(); - contextMenuOverrideButton = undefined; - // Simulate 'contextmenu' event. - element.fire( 'contextmenu', evt.data ); - } - } ); - } - - element.on( 'contextmenu', function( event ) - { - var domEvent = event.data; - - if ( nativeContextMenuOnCtrl && - // Safari on Windows always show 'ctrlKey' as true in 'contextmenu' event, - // which make this property unreliable. (#4826) - ( CKEDITOR.env.webkit ? holdCtrlKey : domEvent.$.ctrlKey || domEvent.$.metaKey ) ) - return; - - // Selection will be unavailable after context menu shows up - // in IE, lock it now. - if ( CKEDITOR.env.ie ) - { - var selection = this.editor.getSelection(); - selection && selection.lock(); - } - - // Cancel the browser context menu. - domEvent.preventDefault(); - - var offsetParent = domEvent.getTarget().getDocument().getDocumentElement(), - offsetX = domEvent.$.clientX, - offsetY = domEvent.$.clientY; - - CKEDITOR.tools.setTimeout( function() - { - this.show( offsetParent, null, offsetX, offsetY ); - }, - 0, this ); - }, - this ); - - if ( CKEDITOR.env.webkit ) - { - var holdCtrlKey, - onKeyDown = function( event ) - { - holdCtrlKey = event.data.$.ctrlKey || event.data.$.metaKey; - }, - resetOnKeyUp = function() - { - holdCtrlKey = 0; - }; - - element.on( 'keydown', onKeyDown ); - element.on( 'keyup', resetOnKeyUp ); - element.on( 'contextmenu', resetOnKeyUp ); - } - }, - - addListener : function( listenerFn ) - { - this._.listeners.push( listenerFn ); - }, - - show : function( offsetParent, corner, offsetX, offsetY ) - { - this.editor.focus(); - this._.onMenu( offsetParent || CKEDITOR.document.getDocumentElement(), corner, offsetX || 0, offsetY || 0 ); - } - } -}); - -/** - * Whether to show the browser native context menu when the CTRL or the - * META (Mac) key is pressed while opening the context menu. - * @name CKEDITOR.config.browserContextMenuOnCtrl - * @since 3.0.2 - * @type Boolean - * @default true - * @example - * config.browserContextMenuOnCtrl = false; - */ diff --git a/public/javascripts/ckeditor/_source/plugins/dialog/dialogDefinition.js b/public/javascripts/ckeditor/_source/plugins/dialog/dialogDefinition.js deleted file mode 100644 index a3094f6..0000000 --- a/public/javascripts/ckeditor/_source/plugins/dialog/dialogDefinition.js +++ /dev/null @@ -1,315 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Defines the "virtual" dialog, dialog content and dialog button - * definition classes. - */ - -/** - * This class is not really part of the API. It just illustrates the properties - * that developers can use to define and create dialogs. - * @name CKEDITOR.dialog.dialogDefinition - * @constructor - * @example - * // There is no constructor for this class, the user just has to define an - * // object with the appropriate properties. - * - * CKEDITOR.dialog.add( 'testOnly', function( editor ) - * { - * return { - * title : 'Test Dialog', - * resizable : CKEDITOR.DIALOG_RESIZE_BOTH, - * minWidth : 500, - * minHeight : 400, - * contents : [ - * { - * id : 'tab1', - * label : 'First Tab', - * title : 'First Tab Title', - * accessKey : 'Q', - * elements : [ - * { - * type : 'text', - * label : 'Test Text 1', - * id : 'testText1', - * 'default' : 'hello world!' - * } - * ] - * } - * ] - * }; - * }); - */ - -/** - * The dialog title, displayed in the dialog's header. Required. - * @name CKEDITOR.dialog.dialogDefinition.prototype.title - * @field - * @type String - * @example - */ - -/** - * How the dialog can be resized, must be one of the four contents defined below. - *

      - * CKEDITOR.DIALOG_RESIZE_NONE
      - * CKEDITOR.DIALOG_RESIZE_WIDTH
      - * CKEDITOR.DIALOG_RESIZE_HEIGHT
      - * CKEDITOR.DIALOG_RESIZE_BOTH
      - * @name CKEDITOR.dialog.dialogDefinition.prototype.resizable - * @field - * @type Number - * @default CKEDITOR.DIALOG_RESIZE_NONE - * @example - */ - -/** - * The minimum width of the dialog, in pixels. - * @name CKEDITOR.dialog.dialogDefinition.prototype.minWidth - * @field - * @type Number - * @default 600 - * @example - */ - -/** - * The minimum height of the dialog, in pixels. - * @name CKEDITOR.dialog.dialogDefinition.prototype.minHeight - * @field - * @type Number - * @default 400 - * @example - */ - -/** - * The buttons in the dialog, defined as an array of - * {@link CKEDITOR.dialog.buttonDefinition} objects. - * @name CKEDITOR.dialog.dialogDefinition.prototype.buttons - * @field - * @type Array - * @default [ CKEDITOR.dialog.okButton, CKEDITOR.dialog.cancelButton ] - * @example - */ - -/** - * The contents in the dialog, defined as an array of - * {@link CKEDITOR.dialog.contentDefinition} objects. Required. - * @name CKEDITOR.dialog.dialogDefinition.prototype.contents - * @field - * @type Array - * @example - */ - -/** - * The function to execute when OK is pressed. - * @name CKEDITOR.dialog.dialogDefinition.prototype.onOk - * @field - * @type Function - * @example - */ - -/** - * The function to execute when Cancel is pressed. - * @name CKEDITOR.dialog.dialogDefinition.prototype.onCancel - * @field - * @type Function - * @example - */ - -/** - * The function to execute when the dialog is displayed for the first time. - * @name CKEDITOR.dialog.dialogDefinition.prototype.onLoad - * @field - * @type Function - * @example - */ - -/** - * This class is not really part of the API. It just illustrates the properties - * that developers can use to define and create dialog content pages. - * @name CKEDITOR.dialog.contentDefinition - * @constructor - * @example - * // There is no constructor for this class, the user just has to define an - * // object with the appropriate properties. - */ - -/** - * The id of the content page. - * @name CKEDITOR.dialog.contentDefinition.prototype.id - * @field - * @type String - * @example - */ - -/** - * The tab label of the content page. - * @name CKEDITOR.dialog.contentDefinition.prototype.label - * @field - * @type String - * @example - */ - -/** - * The popup message of the tab label. - * @name CKEDITOR.dialog.contentDefinition.prototype.title - * @field - * @type String - * @example - */ - -/** - * The CTRL hotkey for switching to the tab. - * @name CKEDITOR.dialog.contentDefinition.prototype.accessKey - * @field - * @type String - * @example - * contentDefinition.accessKey = 'Q'; // Switch to this page when CTRL-Q is pressed. - */ - -/** - * The UI elements contained in this content page, defined as an array of - * {@link CKEDITOR.dialog.uiElementDefinition} objects. - * @name CKEDITOR.dialog.contentDefinition.prototype.elements - * @field - * @type Array - * @example - */ - -/** - * This class is not really part of the API. It just illustrates the properties - * that developers can use to define and create dialog buttons. - * @name CKEDITOR.dialog.buttonDefinition - * @constructor - * @example - * // There is no constructor for this class, the user just has to define an - * // object with the appropriate properties. - */ - -/** - * The id of the dialog button. Required. - * @name CKEDITOR.dialog.buttonDefinition.prototype.id - * @type String - * @field - * @example - */ - -/** - * The label of the dialog button. Required. - * @name CKEDITOR.dialog.buttonDefinition.prototype.label - * @type String - * @field - * @example - */ - -/** - * The popup message of the dialog button. - * @name CKEDITOR.dialog.buttonDefinition.prototype.title - * @type String - * @field - * @example - */ - -/** - * The CTRL hotkey for the button. - * @name CKEDITOR.dialog.buttonDefinition.prototype.accessKey - * @type String - * @field - * @example - * exitButton.accessKey = 'X'; // Button will be pressed when user presses CTRL-X - */ - -/** - * Whether the button is disabled. - * @name CKEDITOR.dialog.buttonDefinition.prototype.disabled - * @type Boolean - * @field - * @default false - * @example - */ - -/** - * The function to execute when the button is clicked. - * @name CKEDITOR.dialog.buttonDefinition.prototype.onClick - * @type Function - * @field - * @example - */ - -/** - * This class is not really part of the API. It just illustrates the properties - * that developers can use to define and create dialog UI elements. - * @name CKEDITOR.dialog.uiElementDefinition - * @constructor - * @see CKEDITOR.ui.dialog.uiElement - * @example - * // There is no constructor for this class, the user just has to define an - * // object with the appropriate properties. - */ - -/** - * The id of the UI element. - * @name CKEDITOR.dialog.uiElementDefinition.prototype.id - * @field - * @type String - * @example - */ - -/** - * The type of the UI element. Required. - * @name CKEDITOR.dialog.uiElementDefinition.prototype.type - * @field - * @type String - * @example - */ - -/** - * The popup label of the UI element. - * @name CKEDITOR.dialog.uiElementDefinition.prototype.title - * @field - * @type String - * @example - */ - -/** - * CSS class names to append to the UI element. - * @name CKEDITOR.dialog.uiElementDefinition.prototype.className - * @field - * @type String - * @example - */ - -/** - * Inline CSS classes to append to the UI element. - * @name CKEDITOR.dialog.uiElementDefinition.prototype.style - * @field - * @type String - * @example - */ - -/** - * Function to execute the first time the UI element is displayed. - * @name CKEDITOR.dialog.uiElementDefinition.prototype.onLoad - * @field - * @type Function - * @example - */ - -/** - * Function to execute whenever the UI element's parent dialog is displayed. - * @name CKEDITOR.dialog.uiElementDefinition.prototype.onShow - * @field - * @type Function - * @example - */ - -/** - * Function to execute whenever the UI element's parent dialog is closed. - * @name CKEDITOR.dialog.uiElementDefinition.prototype.onHide - * @field - * @type Function - * @example - */ diff --git a/public/javascripts/ckeditor/_source/plugins/dialog/plugin.js b/public/javascripts/ckeditor/_source/plugins/dialog/plugin.js deleted file mode 100644 index ee8d0e6..0000000 --- a/public/javascripts/ckeditor/_source/plugins/dialog/plugin.js +++ /dev/null @@ -1,2913 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview The floating dialog plugin. - */ - -/** - * No resize for this dialog. - * @constant - */ -CKEDITOR.DIALOG_RESIZE_NONE = 0; - -/** - * Only allow horizontal resizing for this dialog, disable vertical resizing. - * @constant - */ -CKEDITOR.DIALOG_RESIZE_WIDTH = 1; - -/** - * Only allow vertical resizing for this dialog, disable horizontal resizing. - * @constant - */ -CKEDITOR.DIALOG_RESIZE_HEIGHT = 2; - -/* - * Allow the dialog to be resized in both directions. - * @constant - */ -CKEDITOR.DIALOG_RESIZE_BOTH = 3; - -(function() -{ - function isTabVisible( tabId ) - { - return !!this._.tabs[ tabId ][ 0 ].$.offsetHeight; - } - - function getPreviousVisibleTab() - { - var tabId = this._.currentTabId, - length = this._.tabIdList.length, - tabIndex = CKEDITOR.tools.indexOf( this._.tabIdList, tabId ) + length; - - for ( var i = tabIndex - 1 ; i > tabIndex - length ; i-- ) - { - if ( isTabVisible.call( this, this._.tabIdList[ i % length ] ) ) - return this._.tabIdList[ i % length ]; - } - - return null; - } - - function getNextVisibleTab() - { - var tabId = this._.currentTabId, - length = this._.tabIdList.length, - tabIndex = CKEDITOR.tools.indexOf( this._.tabIdList, tabId ); - - for ( var i = tabIndex + 1 ; i < tabIndex + length ; i++ ) - { - if ( isTabVisible.call( this, this._.tabIdList[ i % length ] ) ) - return this._.tabIdList[ i % length ]; - } - - return null; - } - - /** - * This is the base class for runtime dialog objects. An instance of this - * class represents a single named dialog for a single editor instance. - * @param {Object} editor The editor which created the dialog. - * @param {String} dialogName The dialog's registered name. - * @constructor - * @example - * var dialogObj = new CKEDITOR.dialog( editor, 'smiley' ); - */ - CKEDITOR.dialog = function( editor, dialogName ) - { - // Load the dialog definition. - var definition = CKEDITOR.dialog._.dialogDefinitions[ dialogName ]; - - // Completes the definition with the default values. - definition = CKEDITOR.tools.extend( definition( editor ), defaultDialogDefinition ); - - // Clone a functionally independent copy for this dialog. - definition = CKEDITOR.tools.clone( definition ); - - // Create a complex definition object, extending it with the API - // functions. - definition = new definitionObject( this, definition ); - - - var doc = CKEDITOR.document; - - var themeBuilt = editor.theme.buildDialog( editor ); - - // Initialize some basic parameters. - this._ = - { - editor : editor, - element : themeBuilt.element, - name : dialogName, - contentSize : { width : 0, height : 0 }, - size : { width : 0, height : 0 }, - updateSize : false, - contents : {}, - buttons : {}, - accessKeyMap : {}, - - // Initialize the tab and page map. - tabs : {}, - tabIdList : [], - currentTabId : null, - currentTabIndex : null, - pageCount : 0, - lastTab : null, - tabBarMode : false, - - // Initialize the tab order array for input widgets. - focusList : [], - currentFocusIndex : 0, - hasFocus : false - }; - - this.parts = themeBuilt.parts; - - CKEDITOR.tools.setTimeout( function() - { - editor.fire( 'ariaWidget', this.parts.contents ); - }, - 0, this ); - - // Set the startup styles for the dialog, avoiding it enlarging the - // page size on the dialog creation. - this.parts.dialog.setStyles( - { - position : CKEDITOR.env.ie6Compat ? 'absolute' : 'fixed', - top : 0, - left: 0, - visibility : 'hidden' - }); - - // Call the CKEDITOR.event constructor to initialize this instance. - CKEDITOR.event.call( this ); - - // Fire the "dialogDefinition" event, making it possible to customize - // the dialog definition. - this.definition = definition = CKEDITOR.fire( 'dialogDefinition', - { - name : dialogName, - definition : definition - } - , editor ).definition; - // Initialize load, show, hide, ok and cancel events. - if ( definition.onLoad ) - this.on( 'load', definition.onLoad ); - - if ( definition.onShow ) - this.on( 'show', definition.onShow ); - - if ( definition.onHide ) - this.on( 'hide', definition.onHide ); - - if ( definition.onOk ) - { - this.on( 'ok', function( evt ) - { - if ( definition.onOk.call( this, evt ) === false ) - evt.data.hide = false; - }); - } - - if ( definition.onCancel ) - { - this.on( 'cancel', function( evt ) - { - if ( definition.onCancel.call( this, evt ) === false ) - evt.data.hide = false; - }); - } - - var me = this; - - // Iterates over all items inside all content in the dialog, calling a - // function for each of them. - var iterContents = function( func ) - { - var contents = me._.contents, - stop = false; - - for ( var i in contents ) - { - for ( var j in contents[i] ) - { - stop = func.call( this, contents[i][j] ); - if ( stop ) - return; - } - } - }; - - this.on( 'ok', function( evt ) - { - iterContents( function( item ) - { - if ( item.validate ) - { - var isValid = item.validate( this ); - - if ( typeof isValid == 'string' ) - { - alert( isValid ); - isValid = false; - } - - if ( isValid === false ) - { - if ( item.select ) - item.select(); - else - item.focus(); - - evt.data.hide = false; - evt.stop(); - return true; - } - } - }); - }, this, null, 0 ); - - this.on( 'cancel', function( evt ) - { - iterContents( function( item ) - { - if ( item.isChanged() ) - { - if ( !confirm( editor.lang.common.confirmCancel ) ) - evt.data.hide = false; - return true; - } - }); - }, this, null, 0 ); - - this.parts.close.on( 'click', function( evt ) - { - if ( this.fire( 'cancel', { hide : true } ).hide !== false ) - this.hide(); - }, this ); - - // Sort focus list according to tab order definitions. - function setupFocus() - { - var focusList = me._.focusList; - focusList.sort( function( a, b ) - { - // Mimics browser tab order logics; - if ( a.tabIndex != b.tabIndex ) - return b.tabIndex - a.tabIndex; - // Sort is not stable in some browsers, - // fall-back the comparator to 'focusIndex'; - else - return a.focusIndex - b.focusIndex; - }); - - var size = focusList.length; - for ( var i = 0; i < size; i++ ) - focusList[ i ].focusIndex = i; - } - - function changeFocus( forward ) - { - var focusList = me._.focusList, - offset = forward ? 1 : -1; - if ( focusList.length < 1 ) - return; - - var current = me._.currentFocusIndex; - - // Trigger the 'blur' event of any input element before anything, - // since certain UI updates may depend on it. - try - { - focusList[ current ].getInputElement().$.blur(); - } - catch( e ){} - - var startIndex = ( current + offset + focusList.length ) % focusList.length, - currentIndex = startIndex; - while ( !focusList[ currentIndex ].isFocusable() ) - { - currentIndex = ( currentIndex + offset + focusList.length ) % focusList.length; - if ( currentIndex == startIndex ) - break; - } - focusList[ currentIndex ].focus(); - - // Select whole field content. - if ( focusList[ currentIndex ].type == 'text' ) - focusList[ currentIndex ].select(); - } - - this.changeFocus = changeFocus; - - var processed; - - function focusKeydownHandler( evt ) - { - // If I'm not the top dialog, ignore. - if ( me != CKEDITOR.dialog._.currentTop ) - return; - - var keystroke = evt.data.getKeystroke(); - - processed = 0; - if ( keystroke == 9 || keystroke == CKEDITOR.SHIFT + 9 ) - { - var shiftPressed = ( keystroke == CKEDITOR.SHIFT + 9 ); - - // Handling Tab and Shift-Tab. - if ( me._.tabBarMode ) - { - // Change tabs. - var nextId = shiftPressed ? getPreviousVisibleTab.call( me ) : getNextVisibleTab.call( me ); - me.selectPage( nextId ); - me._.tabs[ nextId ][ 0 ].focus(); - } - else - { - // Change the focus of inputs. - changeFocus( !shiftPressed ); - } - - processed = 1; - } - else if ( keystroke == CKEDITOR.ALT + 121 && !me._.tabBarMode && me.getPageCount() > 1 ) - { - // Alt-F10 puts focus into the current tab item in the tab bar. - me._.tabBarMode = true; - me._.tabs[ me._.currentTabId ][ 0 ].focus(); - processed = 1; - } - else if ( ( keystroke == 37 || keystroke == 39 ) && me._.tabBarMode ) - { - // Arrow keys - used for changing tabs. - nextId = ( keystroke == 37 ? getPreviousVisibleTab.call( me ) : getNextVisibleTab.call( me ) ); - me.selectPage( nextId ); - me._.tabs[ nextId ][ 0 ].focus(); - processed = 1; - } - else if ( ( keystroke == 13 || keystroke == 32 ) && me._.tabBarMode ) - { - this.selectPage( this._.currentTabId ); - this._.tabBarMode = false; - this._.currentFocusIndex = -1; - changeFocus( true ); - processed = 1; - } - - if ( processed ) - { - evt.stop(); - evt.data.preventDefault(); - } - } - - function focusKeyPressHandler( evt ) - { - processed && evt.data.preventDefault(); - } - - var dialogElement = this._.element; - // Add the dialog keyboard handlers. - this.on( 'show', function() - { - dialogElement.on( 'keydown', focusKeydownHandler, this, null, 0 ); - // Some browsers instead, don't cancel key events in the keydown, but in the - // keypress. So we must do a longer trip in those cases. (#4531) - if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) ) - dialogElement.on( 'keypress', focusKeyPressHandler, this ); - - if ( CKEDITOR.env.ie6Compat ) - { - var coverDoc = coverElement.getChild( 0 ).getFrameDocument(); - coverDoc.on( 'keydown', focusKeydownHandler, this, null, 0 ); - } - } ); - this.on( 'hide', function() - { - dialogElement.removeListener( 'keydown', focusKeydownHandler ); - if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) ) - dialogElement.removeListener( 'keypress', focusKeyPressHandler ); - } ); - this.on( 'iframeAdded', function( evt ) - { - var doc = new CKEDITOR.dom.document( evt.data.iframe.$.contentWindow.document ); - doc.on( 'keydown', focusKeydownHandler, this, null, 0 ); - } ); - - // Auto-focus logic in dialog. - this.on( 'show', function() - { - // Setup tabIndex on showing the dialog instead of on loading - // to allow dynamic tab order happen in dialog definition. - setupFocus(); - - if ( editor.config.dialog_startupFocusTab - && me._.tabIdList.length > 1 ) - { - me._.tabBarMode = true; - me._.tabs[ me._.currentTabId ][ 0 ].focus(); - } - else if ( !this._.hasFocus ) - { - this._.currentFocusIndex = -1; - - // Decide where to put the initial focus. - if ( definition.onFocus ) - { - var initialFocus = definition.onFocus.call( this ); - // Focus the field that the user specified. - initialFocus && initialFocus.focus(); - } - // Focus the first field in layout order. - else - changeFocus( true ); - - /* - * IE BUG: If the initial focus went into a non-text element (e.g. button), - * then IE would still leave the caret inside the editing area. - */ - if ( this._.editor.mode == 'wysiwyg' && CKEDITOR.env.ie ) - { - var $selection = editor.document.$.selection, - $range = $selection.createRange(); - - if ( $range ) - { - if ( $range.parentElement && $range.parentElement().ownerDocument == editor.document.$ - || $range.item && $range.item( 0 ).ownerDocument == editor.document.$ ) - { - var $myRange = document.body.createTextRange(); - $myRange.moveToElementText( this.getElement().getFirst().$ ); - $myRange.collapse( true ); - $myRange.select(); - } - } - } - } - }, this, null, 0xffffffff ); - - // IE6 BUG: Text fields and text areas are only half-rendered the first time the dialog appears in IE6 (#2661). - // This is still needed after [2708] and [2709] because text fields in hidden TR tags are still broken. - if ( CKEDITOR.env.ie6Compat ) - { - this.on( 'load', function( evt ) - { - var outer = this.getElement(), - inner = outer.getFirst(); - inner.remove(); - inner.appendTo( outer ); - }, this ); - } - - initDragAndDrop( this ); - initResizeHandles( this ); - - // Insert the title. - ( new CKEDITOR.dom.text( definition.title, CKEDITOR.document ) ).appendTo( this.parts.title ); - - // Insert the tabs and contents. - for ( var i = 0 ; i < definition.contents.length ; i++ ) - this.addPage( definition.contents[i] ); - - this.parts['tabs'].on( 'click', function( evt ) - { - var target = evt.data.getTarget(); - // If we aren't inside a tab, bail out. - if ( target.hasClass( 'cke_dialog_tab' ) ) - { - var id = target.$.id; - this.selectPage( id.substr( 0, id.lastIndexOf( '_' ) ) ); - if ( this._.tabBarMode ) - { - this._.tabBarMode = false; - this._.currentFocusIndex = -1; - changeFocus( true ); - } - evt.data.preventDefault(); - } - }, this ); - - // Insert buttons. - var buttonsHtml = [], - buttons = CKEDITOR.dialog._.uiElementBuilders.hbox.build( this, - { - type : 'hbox', - className : 'cke_dialog_footer_buttons', - widths : [], - children : definition.buttons - }, buttonsHtml ).getChild(); - this.parts.footer.setHtml( buttonsHtml.join( '' ) ); - - for ( i = 0 ; i < buttons.length ; i++ ) - this._.buttons[ buttons[i].id ] = buttons[i]; - }; - - // Focusable interface. Use it via dialog.addFocusable. - function Focusable( dialog, element, index ) - { - this.element = element; - this.focusIndex = index; - // TODO: support tabIndex for focusables. - this.tabIndex = 0; - this.isFocusable = function() - { - return !element.getAttribute( 'disabled' ) && element.isVisible(); - }; - this.focus = function() - { - dialog._.currentFocusIndex = this.focusIndex; - this.element.focus(); - }; - // Bind events - element.on( 'keydown', function( e ) - { - if ( e.data.getKeystroke() in { 32:1, 13:1 } ) - this.fire( 'click' ); - } ); - element.on( 'focus', function() - { - this.fire( 'mouseover' ); - } ); - element.on( 'blur', function() - { - this.fire( 'mouseout' ); - } ); - } - - CKEDITOR.dialog.prototype = - { - /** - * Resizes the dialog. - * @param {Number} width The width of the dialog in pixels. - * @param {Number} height The height of the dialog in pixels. - * @function - * @example - * dialogObj.resize( 800, 640 ); - */ - resize : (function() - { - return function( width, height ) - { - if ( this._.contentSize && this._.contentSize.width == width && this._.contentSize.height == height ) - return; - - CKEDITOR.dialog.fire( 'resize', - { - dialog : this, - skin : this._.editor.skinName, - width : width, - height : height - }, this._.editor ); - - this._.contentSize = { width : width, height : height }; - this._.updateSize = true; - }; - })(), - - /** - * Gets the current size of the dialog in pixels. - * @returns {Object} An object with "width" and "height" properties. - * @example - * var width = dialogObj.getSize().width; - */ - getSize : function() - { - if ( !this._.updateSize ) - return this._.size; - var element = this._.element.getFirst(); - var size = this._.size = { width : element.$.offsetWidth || 0, height : element.$.offsetHeight || 0}; - - // If either the offsetWidth or offsetHeight is 0, the element isn't visible. - this._.updateSize = !size.width || !size.height; - - return size; - }, - - /** - * Moves the dialog to an (x, y) coordinate relative to the window. - * @function - * @param {Number} x The target x-coordinate. - * @param {Number} y The target y-coordinate. - * @example - * dialogObj.move( 10, 40 ); - */ - move : (function() - { - var isFixed; - return function( x, y ) - { - // The dialog may be fixed positioned or absolute positioned. Ask the - // browser what is the current situation first. - var element = this._.element.getFirst(); - if ( isFixed === undefined ) - isFixed = element.getComputedStyle( 'position' ) == 'fixed'; - - if ( isFixed && this._.position && this._.position.x == x && this._.position.y == y ) - return; - - // Save the current position. - this._.position = { x : x, y : y }; - - // If not fixed positioned, add scroll position to the coordinates. - if ( !isFixed ) - { - var scrollPosition = CKEDITOR.document.getWindow().getScrollPosition(); - x += scrollPosition.x; - y += scrollPosition.y; - } - - element.setStyles( - { - 'left' : ( x > 0 ? x : 0 ) + 'px', - 'top' : ( y > 0 ? y : 0 ) + 'px' - }); - }; - })(), - - /** - * Gets the dialog's position in the window. - * @returns {Object} An object with "x" and "y" properties. - * @example - * var dialogX = dialogObj.getPosition().x; - */ - getPosition : function(){ return CKEDITOR.tools.extend( {}, this._.position ); }, - - /** - * Shows the dialog box. - * @example - * dialogObj.show(); - */ - show : function() - { - var editor = this._.editor; - if ( editor.mode == 'wysiwyg' && CKEDITOR.env.ie ) - { - var selection = editor.getSelection(); - selection && selection.lock(); - } - - // Insert the dialog's element to the root document. - var element = this._.element; - var definition = this.definition; - if ( !( element.getParent() && element.getParent().equals( CKEDITOR.document.getBody() ) ) ) - element.appendTo( CKEDITOR.document.getBody() ); - else - return; - - // FIREFOX BUG: Fix vanishing caret for Firefox 2 or Gecko 1.8. - if ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 ) - { - var dialogElement = this.parts.dialog; - dialogElement.setStyle( 'position', 'absolute' ); - setTimeout( function() - { - dialogElement.setStyle( 'position', 'fixed' ); - }, 0 ); - } - - - // First, set the dialog to an appropriate size. - this.resize( definition.minWidth, definition.minHeight ); - - // Select the first tab by default. - this.selectPage( this.definition.contents[0].id ); - - // Reset all inputs back to their default value. - this.reset(); - - // Set z-index. - if ( CKEDITOR.dialog._.currentZIndex === null ) - CKEDITOR.dialog._.currentZIndex = this._.editor.config.baseFloatZIndex; - this._.element.getFirst().setStyle( 'z-index', CKEDITOR.dialog._.currentZIndex += 10 ); - - // Maintain the dialog ordering and dialog cover. - // Also register key handlers if first dialog. - if ( CKEDITOR.dialog._.currentTop === null ) - { - CKEDITOR.dialog._.currentTop = this; - this._.parentDialog = null; - addCover( this._.editor ); - - element.on( 'keydown', accessKeyDownHandler ); - element.on( CKEDITOR.env.opera ? 'keypress' : 'keyup', accessKeyUpHandler ); - - // Prevent some keys from bubbling up. (#4269) - for ( var event in { keyup :1, keydown :1, keypress :1 } ) - element.on( event, preventKeyBubbling ); - } - else - { - this._.parentDialog = CKEDITOR.dialog._.currentTop; - var parentElement = this._.parentDialog.getElement().getFirst(); - parentElement.$.style.zIndex -= Math.floor( this._.editor.config.baseFloatZIndex / 2 ); - CKEDITOR.dialog._.currentTop = this; - } - - // Register the Esc hotkeys. - registerAccessKey( this, this, '\x1b', null, function() - { - this.getButton( 'cancel' ) && this.getButton( 'cancel' ).click(); - } ); - - // Reset the hasFocus state. - this._.hasFocus = false; - - // Rearrange the dialog to the middle of the window. - CKEDITOR.tools.setTimeout( function() - { - var viewSize = CKEDITOR.document.getWindow().getViewPaneSize(); - var dialogSize = this.getSize(); - - // We're using definition size for initial position because of - // offten corrupted data in offsetWidth at this point. (#4084) - this.move( ( viewSize.width - definition.minWidth ) / 2, ( viewSize.height - dialogSize.height ) / 2 ); - - this.parts.dialog.setStyle( 'visibility', '' ); - - // Execute onLoad for the first show. - this.fireOnce( 'load', {} ); - this.fire( 'show', {} ); - this._.editor.fire( 'dialogShow', this ); - - // Save the initial values of the dialog. - this.foreach( function( contentObj ) { contentObj.setInitValue && contentObj.setInitValue(); } ); - - }, - 100, this ); - }, - - /** - * Executes a function for each UI element. - * @param {Function} fn Function to execute for each UI element. - * @returns {CKEDITOR.dialog} The current dialog object. - */ - foreach : function( fn ) - { - for ( var i in this._.contents ) - { - for ( var j in this._.contents[i] ) - fn( this._.contents[i][j]); - } - return this; - }, - - /** - * Resets all input values in the dialog. - * @example - * dialogObj.reset(); - * @returns {CKEDITOR.dialog} The current dialog object. - */ - reset : (function() - { - var fn = function( widget ){ if ( widget.reset ) widget.reset(); }; - return function(){ this.foreach( fn ); return this; }; - })(), - - setupContent : function() - { - var args = arguments; - this.foreach( function( widget ) - { - if ( widget.setup ) - widget.setup.apply( widget, args ); - }); - }, - - commitContent : function() - { - var args = arguments; - this.foreach( function( widget ) - { - if ( widget.commit ) - widget.commit.apply( widget, args ); - }); - }, - - /** - * Hides the dialog box. - * @example - * dialogObj.hide(); - */ - hide : function() - { - this.fire( 'hide', {} ); - this._.editor.fire( 'dialogHide', this ); - - // Remove the dialog's element from the root document. - var element = this._.element; - if ( !element.getParent() ) - return; - - element.remove(); - this.parts.dialog.setStyle( 'visibility', 'hidden' ); - - // Unregister all access keys associated with this dialog. - unregisterAccessKey( this ); - - // Maintain dialog ordering and remove cover if needed. - if ( !this._.parentDialog ) - removeCover(); - else - { - var parentElement = this._.parentDialog.getElement().getFirst(); - parentElement.setStyle( 'z-index', parseInt( parentElement.$.style.zIndex, 10 ) + Math.floor( this._.editor.config.baseFloatZIndex / 2 ) ); - } - CKEDITOR.dialog._.currentTop = this._.parentDialog; - - // Deduct or clear the z-index. - if ( !this._.parentDialog ) - { - CKEDITOR.dialog._.currentZIndex = null; - - // Remove access key handlers. - element.removeListener( 'keydown', accessKeyDownHandler ); - element.removeListener( CKEDITOR.env.opera ? 'keypress' : 'keyup', accessKeyUpHandler ); - - // Remove bubbling-prevention handler. (#4269) - for ( var event in { keyup :1, keydown :1, keypress :1 } ) - element.removeListener( event, preventKeyBubbling ); - - var editor = this._.editor; - editor.focus(); - - if ( editor.mode == 'wysiwyg' && CKEDITOR.env.ie ) - { - var selection = editor.getSelection(); - selection && selection.unlock( true ); - } - } - else - CKEDITOR.dialog._.currentZIndex -= 10; - - - // Reset the initial values of the dialog. - this.foreach( function( contentObj ) { contentObj.resetInitValue && contentObj.resetInitValue(); } ); - }, - - /** - * Adds a tabbed page into the dialog. - * @param {Object} contents Content definition. - * @example - */ - addPage : function( contents ) - { - var pageHtml = [], - titleHtml = contents.label ? ' title="' + CKEDITOR.tools.htmlEncode( contents.label ) + '"' : '', - elements = contents.elements, - vbox = CKEDITOR.dialog._.uiElementBuilders.vbox.build( this, - { - type : 'vbox', - className : 'cke_dialog_page_contents', - children : contents.elements, - expand : !!contents.expand, - padding : contents.padding, - style : contents.style || 'width: 100%; height: 100%;' - }, pageHtml ); - - // Create the HTML for the tab and the content block. - var page = CKEDITOR.dom.element.createFromHtml( pageHtml.join( '' ) ); - page.setAttribute( 'role', 'tabpanel' ); - - var env = CKEDITOR.env; - var tabId = contents.id + '_' + CKEDITOR.tools.getNextNumber(), - tab = CKEDITOR.dom.element.createFromHtml( [ - ' 0 ? ' cke_last' : 'cke_first' ), - titleHtml, - ( !!contents.hidden ? ' style="display:none"' : '' ), - ' id="', tabId, '"', - env.gecko && env.version >= 10900 && !env.hc ? '' : ' href="javascript:void(0)"', - ' tabIndex="-1"', - ' hidefocus="true"', - ' role="tab">', - contents.label, - '' - ].join( '' ) ); - - page.setAttribute( 'aria-labelledby', tabId ); - - // Take records for the tabs and elements created. - this._.tabs[ contents.id ] = [ tab, page ]; - this._.tabIdList.push( contents.id ); - !contents.hidden && this._.pageCount++; - this._.lastTab = tab; - this.updateStyle(); - - var contentMap = this._.contents[ contents.id ] = {}, - cursor, - children = vbox.getChild(); - - while ( ( cursor = children.shift() ) ) - { - contentMap[ cursor.id ] = cursor; - if ( typeof( cursor.getChild ) == 'function' ) - children.push.apply( children, cursor.getChild() ); - } - - // Attach the DOM nodes. - - page.setAttribute( 'name', contents.id ); - page.appendTo( this.parts.contents ); - - tab.unselectable(); - this.parts.tabs.append( tab ); - - // Add access key handlers if access key is defined. - if ( contents.accessKey ) - { - registerAccessKey( this, this, 'CTRL+' + contents.accessKey, - tabAccessKeyDown, tabAccessKeyUp ); - this._.accessKeyMap[ 'CTRL+' + contents.accessKey ] = contents.id; - } - }, - - /** - * Activates a tab page in the dialog by its id. - * @param {String} id The id of the dialog tab to be activated. - * @example - * dialogObj.selectPage( 'tab_1' ); - */ - selectPage : function( id ) - { - // Hide the non-selected tabs and pages. - for ( var i in this._.tabs ) - { - var tab = this._.tabs[i][0], - page = this._.tabs[i][1]; - if ( i != id ) - { - tab.removeClass( 'cke_dialog_tab_selected' ); - page.hide(); - } - page.setAttribute( 'aria-hidden', i != id ); - } - - var selected = this._.tabs[id]; - selected[0].addClass( 'cke_dialog_tab_selected' ); - selected[1].show(); - this._.currentTabId = id; - this._.currentTabIndex = CKEDITOR.tools.indexOf( this._.tabIdList, id ); - }, - - // Dialog state-specific style updates. - updateStyle : function() - { - // If only a single page shown, a different style is used in the central pane. - this.parts.dialog[ ( this._.pageCount === 1 ? 'add' : 'remove' ) + 'Class' ]( 'cke_single_page' ); - }, - - /** - * Hides a page's tab away from the dialog. - * @param {String} id The page's Id. - * @example - * dialog.hidePage( 'tab_3' ); - */ - hidePage : function( id ) - { - var tab = this._.tabs[id] && this._.tabs[id][0]; - if ( !tab || this._.pageCount == 1 ) - return; - // Switch to other tab first when we're hiding the active tab. - else if ( id == this._.currentTabId ) - this.selectPage( getPreviousVisibleTab.call( this ) ); - - tab.hide(); - this._.pageCount--; - this.updateStyle(); - }, - - /** - * Unhides a page's tab. - * @param {String} id The page's Id. - * @example - * dialog.showPage( 'tab_2' ); - */ - showPage : function( id ) - { - var tab = this._.tabs[id] && this._.tabs[id][0]; - if ( !tab ) - return; - tab.show(); - this._.pageCount++; - this.updateStyle(); - }, - - /** - * Gets the root DOM element of the dialog. - * @returns {CKEDITOR.dom.element} The <span> element containing this dialog. - * @example - * var dialogElement = dialogObj.getElement().getFirst(); - * dialogElement.setStyle( 'padding', '5px' ); - */ - getElement : function() - { - return this._.element; - }, - - /** - * Gets the name of the dialog. - * @returns {String} The name of this dialog. - * @example - * var dialogName = dialogObj.getName(); - */ - getName : function() - { - return this._.name; - }, - - /** - * Gets a dialog UI element object from a dialog page. - * @param {String} pageId id of dialog page. - * @param {String} elementId id of UI element. - * @example - * @returns {CKEDITOR.ui.dialog.uiElement} The dialog UI element. - */ - getContentElement : function( pageId, elementId ) - { - var page = this._.contents[ pageId ]; - return page && page[ elementId ]; - }, - - /** - * Gets the value of a dialog UI element. - * @param {String} pageId id of dialog page. - * @param {String} elementId id of UI element. - * @example - * @returns {Object} The value of the UI element. - */ - getValueOf : function( pageId, elementId ) - { - return this.getContentElement( pageId, elementId ).getValue(); - }, - - /** - * Sets the value of a dialog UI element. - * @param {String} pageId id of the dialog page. - * @param {String} elementId id of the UI element. - * @param {Object} value The new value of the UI element. - * @example - */ - setValueOf : function( pageId, elementId, value ) - { - return this.getContentElement( pageId, elementId ).setValue( value ); - }, - - /** - * Gets the UI element of a button in the dialog's button row. - * @param {String} id The id of the button. - * @example - * @returns {CKEDITOR.ui.dialog.button} The button object. - */ - getButton : function( id ) - { - return this._.buttons[ id ]; - }, - - /** - * Simulates a click to a dialog button in the dialog's button row. - * @param {String} id The id of the button. - * @example - * @returns The return value of the dialog's "click" event. - */ - click : function( id ) - { - return this._.buttons[ id ].click(); - }, - - /** - * Disables a dialog button. - * @param {String} id The id of the button. - * @example - */ - disableButton : function( id ) - { - return this._.buttons[ id ].disable(); - }, - - /** - * Enables a dialog button. - * @param {String} id The id of the button. - * @example - */ - enableButton : function( id ) - { - return this._.buttons[ id ].enable(); - }, - - /** - * Gets the number of pages in the dialog. - * @returns {Number} Page count. - */ - getPageCount : function() - { - return this._.pageCount; - }, - - /** - * Gets the editor instance which opened this dialog. - * @returns {CKEDITOR.editor} Parent editor instances. - */ - getParentEditor : function() - { - return this._.editor; - }, - - /** - * Gets the element that was selected when opening the dialog, if any. - * @returns {CKEDITOR.dom.element} The element that was selected, or null. - */ - getSelectedElement : function() - { - return this.getParentEditor().getSelection().getSelectedElement(); - }, - - /** - * Adds element to dialog's focusable list. - * - * @param {CKEDITOR.dom.element} element - * @param {Number} [index] - */ - addFocusable: function( element, index ) { - if ( typeof index == 'undefined' ) - { - index = this._.focusList.length; - this._.focusList.push( new Focusable( this, element, index ) ); - } - else - { - this._.focusList.splice( index, 0, new Focusable( this, element, index ) ); - for ( var i = index + 1 ; i < this._.focusList.length ; i++ ) - this._.focusList[ i ].focusIndex++; - } - } - }; - - CKEDITOR.tools.extend( CKEDITOR.dialog, - /** - * @lends CKEDITOR.dialog - */ - { - /** - * Registers a dialog. - * @param {String} name The dialog's name. - * @param {Function|String} dialogDefinition - * A function returning the dialog's definition, or the URL to the .js file holding the function. - * The function should accept an argument "editor" which is the current editor instance, and - * return an object conforming to {@link CKEDITOR.dialog.dialogDefinition}. - * @example - * @see CKEDITOR.dialog.dialogDefinition - */ - add : function( name, dialogDefinition ) - { - // Avoid path registration from multiple instances override definition. - if ( !this._.dialogDefinitions[name] - || typeof dialogDefinition == 'function' ) - this._.dialogDefinitions[name] = dialogDefinition; - }, - - exists : function( name ) - { - return !!this._.dialogDefinitions[ name ]; - }, - - getCurrent : function() - { - return CKEDITOR.dialog._.currentTop; - }, - - /** - * The default OK button for dialogs. Fires the "ok" event and closes the dialog if the event succeeds. - * @static - * @field - * @example - * @type Function - */ - okButton : (function() - { - var retval = function( editor, override ) - { - override = override || {}; - return CKEDITOR.tools.extend( { - id : 'ok', - type : 'button', - label : editor.lang.common.ok, - 'class' : 'cke_dialog_ui_button_ok', - onClick : function( evt ) - { - var dialog = evt.data.dialog; - if ( dialog.fire( 'ok', { hide : true } ).hide !== false ) - dialog.hide(); - } - }, override, true ); - }; - retval.type = 'button'; - retval.override = function( override ) - { - return CKEDITOR.tools.extend( function( editor ){ return retval( editor, override ); }, - { type : 'button' }, true ); - }; - return retval; - })(), - - /** - * The default cancel button for dialogs. Fires the "cancel" event and closes the dialog if no UI element value changed. - * @static - * @field - * @example - * @type Function - */ - cancelButton : (function() - { - var retval = function( editor, override ) - { - override = override || {}; - return CKEDITOR.tools.extend( { - id : 'cancel', - type : 'button', - label : editor.lang.common.cancel, - 'class' : 'cke_dialog_ui_button_cancel', - onClick : function( evt ) - { - var dialog = evt.data.dialog; - if ( dialog.fire( 'cancel', { hide : true } ).hide !== false ) - dialog.hide(); - } - }, override, true ); - }; - retval.type = 'button'; - retval.override = function( override ) - { - return CKEDITOR.tools.extend( function( editor ){ return retval( editor, override ); }, - { type : 'button' }, true ); - }; - return retval; - })(), - - /** - * Registers a dialog UI element. - * @param {String} typeName The name of the UI element. - * @param {Function} builder The function to build the UI element. - * @example - */ - addUIElement : function( typeName, builder ) - { - this._.uiElementBuilders[ typeName ] = builder; - } - }); - - CKEDITOR.dialog._ = - { - uiElementBuilders : {}, - - dialogDefinitions : {}, - - currentTop : null, - - currentZIndex : null - }; - - // "Inherit" (copy actually) from CKEDITOR.event. - CKEDITOR.event.implementOn( CKEDITOR.dialog ); - CKEDITOR.event.implementOn( CKEDITOR.dialog.prototype, true ); - - var defaultDialogDefinition = - { - resizable : CKEDITOR.DIALOG_RESIZE_BOTH, - minWidth : 600, - minHeight : 400, - buttons : [ CKEDITOR.dialog.okButton, CKEDITOR.dialog.cancelButton ] - }; - - // The buttons in MacOS Apps are in reverse order #4750 - CKEDITOR.env.mac && defaultDialogDefinition.buttons.reverse(); - - // Tool function used to return an item from an array based on its id - // property. - var getById = function( array, id, recurse ) - { - for ( var i = 0, item ; ( item = array[ i ] ) ; i++ ) - { - if ( item.id == id ) - return item; - if ( recurse && item[ recurse ] ) - { - var retval = getById( item[ recurse ], id, recurse ) ; - if ( retval ) - return retval; - } - } - return null; - }; - - // Tool function used to add an item into an array. - var addById = function( array, newItem, nextSiblingId, recurse, nullIfNotFound ) - { - if ( nextSiblingId ) - { - for ( var i = 0, item ; ( item = array[ i ] ) ; i++ ) - { - if ( item.id == nextSiblingId ) - { - array.splice( i, 0, newItem ); - return newItem; - } - - if ( recurse && item[ recurse ] ) - { - var retval = addById( item[ recurse ], newItem, nextSiblingId, recurse, true ); - if ( retval ) - return retval; - } - } - - if ( nullIfNotFound ) - return null; - } - - array.push( newItem ); - return newItem; - }; - - // Tool function used to remove an item from an array based on its id. - var removeById = function( array, id, recurse ) - { - for ( var i = 0, item ; ( item = array[ i ] ) ; i++ ) - { - if ( item.id == id ) - return array.splice( i, 1 ); - if ( recurse && item[ recurse ] ) - { - var retval = removeById( item[ recurse ], id, recurse ); - if ( retval ) - return retval; - } - } - return null; - }; - - /** - * This class is not really part of the API. It is the "definition" property value - * passed to "dialogDefinition" event handlers. - * @constructor - * @name CKEDITOR.dialog.dialogDefinitionObject - * @extends CKEDITOR.dialog.dialogDefinition - * @example - * CKEDITOR.on( 'dialogDefinition', function( evt ) - * { - * var definition = evt.data.definition; - * var content = definition.getContents( 'page1' ); - * ... - * } ); - */ - var definitionObject = function( dialog, dialogDefinition ) - { - // TODO : Check if needed. - this.dialog = dialog; - - // Transform the contents entries in contentObjects. - var contents = dialogDefinition.contents; - for ( var i = 0, content ; ( content = contents[i] ) ; i++ ) - contents[ i ] = new contentObject( dialog, content ); - - CKEDITOR.tools.extend( this, dialogDefinition ); - }; - - definitionObject.prototype = - /** @lends CKEDITOR.dialog.dialogDefinitionObject.prototype */ - { - /** - * Gets a content definition. - * @param {String} id The id of the content definition. - * @returns {CKEDITOR.dialog.contentDefinition} The content definition - * matching id. - */ - getContents : function( id ) - { - return getById( this.contents, id ); - }, - - /** - * Gets a button definition. - * @param {String} id The id of the button definition. - * @returns {CKEDITOR.dialog.buttonDefinition} The button definition - * matching id. - */ - getButton : function( id ) - { - return getById( this.buttons, id ); - }, - - /** - * Adds a content definition object under this dialog definition. - * @param {CKEDITOR.dialog.contentDefinition} contentDefinition The - * content definition. - * @param {String} [nextSiblingId] The id of an existing content - * definition which the new content definition will be inserted - * before. Omit if the new content definition is to be inserted as - * the last item. - * @returns {CKEDITOR.dialog.contentDefinition} The inserted content - * definition. - */ - addContents : function( contentDefinition, nextSiblingId ) - { - return addById( this.contents, contentDefinition, nextSiblingId ); - }, - - /** - * Adds a button definition object under this dialog definition. - * @param {CKEDITOR.dialog.buttonDefinition} buttonDefinition The - * button definition. - * @param {String} [nextSiblingId] The id of an existing button - * definition which the new button definition will be inserted - * before. Omit if the new button definition is to be inserted as - * the last item. - * @returns {CKEDITOR.dialog.buttonDefinition} The inserted button - * definition. - */ - addButton : function( buttonDefinition, nextSiblingId ) - { - return addById( this.buttons, buttonDefinition, nextSiblingId ); - }, - - /** - * Removes a content definition from this dialog definition. - * @param {String} id The id of the content definition to be removed. - * @returns {CKEDITOR.dialog.contentDefinition} The removed content - * definition. - */ - removeContents : function( id ) - { - removeById( this.contents, id ); - }, - - /** - * Removes a button definition from the dialog definition. - * @param {String} id The id of the button definition to be removed. - * @returns {CKEDITOR.dialog.buttonDefinition} The removed button - * definition. - */ - removeButton : function( id ) - { - removeById( this.buttons, id ); - } - }; - - /** - * This class is not really part of the API. It is the template of the - * objects representing content pages inside the - * CKEDITOR.dialog.dialogDefinitionObject. - * @constructor - * @name CKEDITOR.dialog.contentDefinitionObject - * @example - * CKEDITOR.on( 'dialogDefinition', function( evt ) - * { - * var definition = evt.data.definition; - * var content = definition.getContents( 'page1' ); - * content.remove( 'textInput1' ); - * ... - * } ); - */ - function contentObject( dialog, contentDefinition ) - { - this._ = - { - dialog : dialog - }; - - CKEDITOR.tools.extend( this, contentDefinition ); - } - - contentObject.prototype = - /** @lends CKEDITOR.dialog.contentDefinitionObject.prototype */ - { - /** - * Gets a UI element definition under the content definition. - * @param {String} id The id of the UI element definition. - * @returns {CKEDITOR.dialog.uiElementDefinition} - */ - get : function( id ) - { - return getById( this.elements, id, 'children' ); - }, - - /** - * Adds a UI element definition to the content definition. - * @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition The - * UI elemnet definition to be added. - * @param {String} nextSiblingId The id of an existing UI element - * definition which the new UI element definition will be inserted - * before. Omit if the new button definition is to be inserted as - * the last item. - * @returns {CKEDITOR.dialog.uiElementDefinition} The element - * definition inserted. - */ - add : function( elementDefinition, nextSiblingId ) - { - return addById( this.elements, elementDefinition, nextSiblingId, 'children' ); - }, - - /** - * Removes a UI element definition from the content definition. - * @param {String} id The id of the UI element definition to be - * removed. - * @returns {CKEDITOR.dialog.uiElementDefinition} The element - * definition removed. - * @example - */ - remove : function( id ) - { - removeById( this.elements, id, 'children' ); - } - }; - - function initDragAndDrop( dialog ) - { - var lastCoords = null, - abstractDialogCoords = null, - element = dialog.getElement().getFirst(), - editor = dialog.getParentEditor(), - magnetDistance = editor.config.dialog_magnetDistance, - margins = editor.skin.margins || [ 0, 0, 0, 0 ]; - - if ( typeof magnetDistance == 'undefined' ) - magnetDistance = 20; - - function mouseMoveHandler( evt ) - { - var dialogSize = dialog.getSize(), - viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize(), - x = evt.data.$.screenX, - y = evt.data.$.screenY, - dx = x - lastCoords.x, - dy = y - lastCoords.y, - realX, realY; - - lastCoords = { x : x, y : y }; - abstractDialogCoords.x += dx; - abstractDialogCoords.y += dy; - - if ( abstractDialogCoords.x + margins[3] < magnetDistance ) - realX = - margins[3]; - else if ( abstractDialogCoords.x - margins[1] > viewPaneSize.width - dialogSize.width - magnetDistance ) - realX = viewPaneSize.width - dialogSize.width + margins[1]; - else - realX = abstractDialogCoords.x; - - if ( abstractDialogCoords.y + margins[0] < magnetDistance ) - realY = - margins[0]; - else if ( abstractDialogCoords.y - margins[2] > viewPaneSize.height - dialogSize.height - magnetDistance ) - realY = viewPaneSize.height - dialogSize.height + margins[2]; - else - realY = abstractDialogCoords.y; - - dialog.move( realX, realY ); - - evt.data.preventDefault(); - } - - function mouseUpHandler( evt ) - { - CKEDITOR.document.removeListener( 'mousemove', mouseMoveHandler ); - CKEDITOR.document.removeListener( 'mouseup', mouseUpHandler ); - - if ( CKEDITOR.env.ie6Compat ) - { - var coverDoc = coverElement.getChild( 0 ).getFrameDocument(); - coverDoc.removeListener( 'mousemove', mouseMoveHandler ); - coverDoc.removeListener( 'mouseup', mouseUpHandler ); - } - } - - dialog.parts.title.on( 'mousedown', function( evt ) - { - dialog._.updateSize = true; - - lastCoords = { x : evt.data.$.screenX, y : evt.data.$.screenY }; - - CKEDITOR.document.on( 'mousemove', mouseMoveHandler ); - CKEDITOR.document.on( 'mouseup', mouseUpHandler ); - abstractDialogCoords = dialog.getPosition(); - - if ( CKEDITOR.env.ie6Compat ) - { - var coverDoc = coverElement.getChild( 0 ).getFrameDocument(); - coverDoc.on( 'mousemove', mouseMoveHandler ); - coverDoc.on( 'mouseup', mouseUpHandler ); - } - - evt.data.preventDefault(); - }, dialog ); - } - - function initResizeHandles( dialog ) - { - var definition = dialog.definition, - minWidth = definition.minWidth || 0, - minHeight = definition.minHeight || 0, - resizable = definition.resizable, - margins = dialog.getParentEditor().skin.margins || [ 0, 0, 0, 0 ]; - - function topSizer( coords, dy ) - { - coords.y += dy; - } - - function rightSizer( coords, dx ) - { - coords.x2 += dx; - } - - function bottomSizer( coords, dy ) - { - coords.y2 += dy; - } - - function leftSizer( coords, dx ) - { - coords.x += dx; - } - - var lastCoords = null, - abstractDialogCoords = null, - magnetDistance = dialog._.editor.config.magnetDistance, - parts = [ 'tl', 't', 'tr', 'l', 'r', 'bl', 'b', 'br' ]; - - function mouseDownHandler( evt ) - { - var partName = evt.listenerData.part, size = dialog.getSize(); - abstractDialogCoords = dialog.getPosition(); - CKEDITOR.tools.extend( abstractDialogCoords, - { - x2 : abstractDialogCoords.x + size.width, - y2 : abstractDialogCoords.y + size.height - } ); - lastCoords = { x : evt.data.$.screenX, y : evt.data.$.screenY }; - - CKEDITOR.document.on( 'mousemove', mouseMoveHandler, dialog, { part : partName } ); - CKEDITOR.document.on( 'mouseup', mouseUpHandler, dialog, { part : partName } ); - - if ( CKEDITOR.env.ie6Compat ) - { - var coverDoc = coverElement.getChild( 0 ).getFrameDocument(); - coverDoc.on( 'mousemove', mouseMoveHandler, dialog, { part : partName } ); - coverDoc.on( 'mouseup', mouseUpHandler, dialog, { part : partName } ); - } - - evt.data.preventDefault(); - } - - function mouseMoveHandler( evt ) - { - var x = evt.data.$.screenX, - y = evt.data.$.screenY, - dx = x - lastCoords.x, - dy = y - lastCoords.y, - viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize(), - partName = evt.listenerData.part; - - if ( partName.search( 't' ) != -1 ) - topSizer( abstractDialogCoords, dy ); - if ( partName.search( 'l' ) != -1 ) - leftSizer( abstractDialogCoords, dx ); - if ( partName.search( 'b' ) != -1 ) - bottomSizer( abstractDialogCoords, dy ); - if ( partName.search( 'r' ) != -1 ) - rightSizer( abstractDialogCoords, dx ); - - lastCoords = { x : x, y : y }; - - var realX, realY, realX2, realY2; - - if ( abstractDialogCoords.x + margins[3] < magnetDistance ) - realX = - margins[3]; - else if ( partName.search( 'l' ) != -1 && abstractDialogCoords.x2 - abstractDialogCoords.x < minWidth + magnetDistance ) - realX = abstractDialogCoords.x2 - minWidth; - else - realX = abstractDialogCoords.x; - - if ( abstractDialogCoords.y + margins[0] < magnetDistance ) - realY = - margins[0]; - else if ( partName.search( 't' ) != -1 && abstractDialogCoords.y2 - abstractDialogCoords.y < minHeight + magnetDistance ) - realY = abstractDialogCoords.y2 - minHeight; - else - realY = abstractDialogCoords.y; - - if ( abstractDialogCoords.x2 - margins[1] > viewPaneSize.width - magnetDistance ) - realX2 = viewPaneSize.width + margins[1] ; - else if ( partName.search( 'r' ) != -1 && abstractDialogCoords.x2 - abstractDialogCoords.x < minWidth + magnetDistance ) - realX2 = abstractDialogCoords.x + minWidth; - else - realX2 = abstractDialogCoords.x2; - - if ( abstractDialogCoords.y2 - margins[2] > viewPaneSize.height - magnetDistance ) - realY2= viewPaneSize.height + margins[2] ; - else if ( partName.search( 'b' ) != -1 && abstractDialogCoords.y2 - abstractDialogCoords.y < minHeight + magnetDistance ) - realY2 = abstractDialogCoords.y + minHeight; - else - realY2 = abstractDialogCoords.y2 ; - - dialog.move( realX, realY ); - dialog.resize( realX2 - realX, realY2 - realY ); - - evt.data.preventDefault(); - } - - function mouseUpHandler( evt ) - { - CKEDITOR.document.removeListener( 'mouseup', mouseUpHandler ); - CKEDITOR.document.removeListener( 'mousemove', mouseMoveHandler ); - - if ( CKEDITOR.env.ie6Compat ) - { - var coverDoc = coverElement.getChild( 0 ).getFrameDocument(); - coverDoc.removeListener( 'mouseup', mouseUpHandler ); - coverDoc.removeListener( 'mousemove', mouseMoveHandler ); - } - } - -// TODO : Simplify the resize logic, having just a single resize grip
      . -// var widthTest = /[lr]/, -// heightTest = /[tb]/; -// for ( var i = 0 ; i < parts.length ; i++ ) -// { -// var element = dialog.parts[ parts[i] + '_resize' ]; -// if ( resizable == CKEDITOR.DIALOG_RESIZE_NONE || -// resizable == CKEDITOR.DIALOG_RESIZE_HEIGHT && widthTest.test( parts[i] ) || -// resizable == CKEDITOR.DIALOG_RESIZE_WIDTH && heightTest.test( parts[i] ) ) -// { -// element.hide(); -// continue; -// } -// element.on( 'mousedown', mouseDownHandler, dialog, { part : parts[i] } ); -// } - } - - var resizeCover; - var coverElement; - - var addCover = function( editor ) - { - var win = CKEDITOR.document.getWindow(); - - if ( !coverElement ) - { - var backgroundColorStyle = editor.config.dialog_backgroundCoverColor || 'white'; - - var html = [ - '
      ' - ]; - - - if ( CKEDITOR.env.ie6Compat ) - { - // Support for custom document.domain in IE. - var isCustomDomain = CKEDITOR.env.isCustomDomain(), - iframeHtml = ''; - - html.push( - '' + - '' ); - } - - html.push( '
      ' ); - - coverElement = CKEDITOR.dom.element.createFromHtml( html.join( '' ) ); - } - - var element = coverElement; - - var resizeFunc = function() - { - var size = win.getViewPaneSize(); - element.setStyles( - { - width : size.width + 'px', - height : size.height + 'px' - } ); - }; - - var scrollFunc = function() - { - var pos = win.getScrollPosition(), - cursor = CKEDITOR.dialog._.currentTop; - element.setStyles( - { - left : pos.x + 'px', - top : pos.y + 'px' - }); - - do - { - var dialogPos = cursor.getPosition(); - cursor.move( dialogPos.x, dialogPos.y ); - } while ( ( cursor = cursor._.parentDialog ) ); - }; - - resizeCover = resizeFunc; - win.on( 'resize', resizeFunc ); - resizeFunc(); - if ( CKEDITOR.env.ie6Compat ) - { - // IE BUG: win.$.onscroll assignment doesn't work.. it must be window.onscroll. - // So we need to invent a really funny way to make it work. - var myScrollHandler = function() - { - scrollFunc(); - arguments.callee.prevScrollHandler.apply( this, arguments ); - }; - win.$.setTimeout( function() - { - myScrollHandler.prevScrollHandler = window.onscroll || function(){}; - window.onscroll = myScrollHandler; - }, 0 ); - scrollFunc(); - } - - var opacity = editor.config.dialog_backgroundCoverOpacity; - element.setOpacity( typeof opacity != 'undefined' ? opacity : 0.5 ); - - element.appendTo( CKEDITOR.document.getBody() ); - }; - - var removeCover = function() - { - if ( !coverElement ) - return; - - var win = CKEDITOR.document.getWindow(); - coverElement.remove(); - win.removeListener( 'resize', resizeCover ); - - if ( CKEDITOR.env.ie6Compat ) - { - win.$.setTimeout( function() - { - var prevScrollHandler = window.onscroll && window.onscroll.prevScrollHandler; - window.onscroll = prevScrollHandler || null; - }, 0 ); - } - resizeCover = null; - }; - - var accessKeyProcessors = {}; - - var accessKeyDownHandler = function( evt ) - { - var ctrl = evt.data.$.ctrlKey || evt.data.$.metaKey, - alt = evt.data.$.altKey, - shift = evt.data.$.shiftKey, - key = String.fromCharCode( evt.data.$.keyCode ), - keyProcessor = accessKeyProcessors[( ctrl ? 'CTRL+' : '' ) + ( alt ? 'ALT+' : '') + ( shift ? 'SHIFT+' : '' ) + key]; - - if ( !keyProcessor || !keyProcessor.length ) - return; - - keyProcessor = keyProcessor[keyProcessor.length - 1]; - keyProcessor.keydown && keyProcessor.keydown.call( keyProcessor.uiElement, keyProcessor.dialog, keyProcessor.key ); - evt.data.preventDefault(); - }; - - var accessKeyUpHandler = function( evt ) - { - var ctrl = evt.data.$.ctrlKey || evt.data.$.metaKey, - alt = evt.data.$.altKey, - shift = evt.data.$.shiftKey, - key = String.fromCharCode( evt.data.$.keyCode ), - keyProcessor = accessKeyProcessors[( ctrl ? 'CTRL+' : '' ) + ( alt ? 'ALT+' : '') + ( shift ? 'SHIFT+' : '' ) + key]; - - if ( !keyProcessor || !keyProcessor.length ) - return; - - keyProcessor = keyProcessor[keyProcessor.length - 1]; - if ( keyProcessor.keyup ) - { - keyProcessor.keyup.call( keyProcessor.uiElement, keyProcessor.dialog, keyProcessor.key ); - evt.data.preventDefault(); - } - }; - - var registerAccessKey = function( uiElement, dialog, key, downFunc, upFunc ) - { - var procList = accessKeyProcessors[key] || ( accessKeyProcessors[key] = [] ); - procList.push( { - uiElement : uiElement, - dialog : dialog, - key : key, - keyup : upFunc || uiElement.accessKeyUp, - keydown : downFunc || uiElement.accessKeyDown - } ); - }; - - var unregisterAccessKey = function( obj ) - { - for ( var i in accessKeyProcessors ) - { - var list = accessKeyProcessors[i]; - for ( var j = list.length - 1 ; j >= 0 ; j-- ) - { - if ( list[j].dialog == obj || list[j].uiElement == obj ) - list.splice( j, 1 ); - } - if ( list.length === 0 ) - delete accessKeyProcessors[i]; - } - }; - - var tabAccessKeyUp = function( dialog, key ) - { - if ( dialog._.accessKeyMap[key] ) - dialog.selectPage( dialog._.accessKeyMap[key] ); - }; - - var tabAccessKeyDown = function( dialog, key ) - { - }; - - // ESC, ENTER - var preventKeyBubblingKeys = { 27 :1, 13 :1 }; - var preventKeyBubbling = function( e ) - { - if ( e.data.getKeystroke() in preventKeyBubblingKeys ) - e.data.stopPropagation(); - }; - - (function() - { - CKEDITOR.ui.dialog = - { - /** - * The base class of all dialog UI elements. - * @constructor - * @param {CKEDITOR.dialog} dialog Parent dialog object. - * @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition Element - * definition. Accepted fields: - *
        - *
      • id (Required) The id of the UI element. See {@link - * CKEDITOR.dialog#getContentElement}
      • - *
      • type (Required) The type of the UI element. The - * value to this field specifies which UI element class will be used to - * generate the final widget.
      • - *
      • title (Optional) The popup tooltip for the UI - * element.
      • - *
      • hidden (Optional) A flag that tells if the element - * should be initially visible.
      • - *
      • className (Optional) Additional CSS class names - * to add to the UI element. Separated by space.
      • - *
      • style (Optional) Additional CSS inline styles - * to add to the UI element. A semicolon (;) is required after the last - * style declaration.
      • - *
      • accessKey (Optional) The alphanumeric access key - * for this element. Access keys are automatically prefixed by CTRL.
      • - *
      • on* (Optional) Any UI element definition field that - * starts with on followed immediately by a capital letter and - * probably more letters is an event handler. Event handlers may be further - * divided into registered event handlers and DOM event handlers. Please - * refer to {@link CKEDITOR.ui.dialog.uiElement#registerEvents} and - * {@link CKEDITOR.ui.dialog.uiElement#eventProcessors} for more - * information.
      • - *
      - * @param {Array} htmlList - * List of HTML code to be added to the dialog's content area. - * @param {Function|String} nodeNameArg - * A function returning a string, or a simple string for the node name for - * the root DOM node. Default is 'div'. - * @param {Function|Object} stylesArg - * A function returning an object, or a simple object for CSS styles applied - * to the DOM node. Default is empty object. - * @param {Function|Object} attributesArg - * A fucntion returning an object, or a simple object for attributes applied - * to the DOM node. Default is empty object. - * @param {Function|String} contentsArg - * A function returning a string, or a simple string for the HTML code inside - * the root DOM node. Default is empty string. - * @example - */ - uiElement : function( dialog, elementDefinition, htmlList, nodeNameArg, stylesArg, attributesArg, contentsArg ) - { - if ( arguments.length < 4 ) - return; - - var nodeName = ( nodeNameArg.call ? nodeNameArg( elementDefinition ) : nodeNameArg ) || 'div', - html = [ '<', nodeName, ' ' ], - styles = ( stylesArg && stylesArg.call ? stylesArg( elementDefinition ) : stylesArg ) || {}, - attributes = ( attributesArg && attributesArg.call ? attributesArg( elementDefinition ) : attributesArg ) || {}, - innerHTML = ( contentsArg && contentsArg.call ? contentsArg.call( this, dialog, elementDefinition ) : contentsArg ) || '', - domId = this.domId = attributes.id || CKEDITOR.tools.getNextNumber() + '_uiElement', - id = this.id = elementDefinition.id, - i; - - // Set the id, a unique id is required for getElement() to work. - attributes.id = domId; - - // Set the type and definition CSS class names. - var classes = {}; - if ( elementDefinition.type ) - classes[ 'cke_dialog_ui_' + elementDefinition.type ] = 1; - if ( elementDefinition.className ) - classes[ elementDefinition.className ] = 1; - var attributeClasses = ( attributes['class'] && attributes['class'].split ) ? attributes['class'].split( ' ' ) : []; - for ( i = 0 ; i < attributeClasses.length ; i++ ) - { - if ( attributeClasses[i] ) - classes[ attributeClasses[i] ] = 1; - } - var finalClasses = []; - for ( i in classes ) - finalClasses.push( i ); - attributes['class'] = finalClasses.join( ' ' ); - - // Set the popup tooltop. - if ( elementDefinition.title ) - attributes.title = elementDefinition.title; - - // Write the inline CSS styles. - var styleStr = ( elementDefinition.style || '' ).split( ';' ); - for ( i in styles ) - styleStr.push( i + ':' + styles[i] ); - if ( elementDefinition.hidden ) - styleStr.push( 'display:none' ); - for ( i = styleStr.length - 1 ; i >= 0 ; i-- ) - { - if ( styleStr[i] === '' ) - styleStr.splice( i, 1 ); - } - if ( styleStr.length > 0 ) - attributes.style = ( attributes.style ? ( attributes.style + '; ' ) : '' ) + styleStr.join( '; ' ); - - // Write the attributes. - for ( i in attributes ) - html.push( i + '="' + CKEDITOR.tools.htmlEncode( attributes[i] ) + '" '); - - // Write the content HTML. - html.push( '>', innerHTML, '' ); - - // Add contents to the parent HTML array. - htmlList.push( html.join( '' ) ); - - ( this._ || ( this._ = {} ) ).dialog = dialog; - - // Override isChanged if it is defined in element definition. - if ( typeof( elementDefinition.isChanged ) == 'boolean' ) - this.isChanged = function(){ return elementDefinition.isChanged; }; - if ( typeof( elementDefinition.isChanged ) == 'function' ) - this.isChanged = elementDefinition.isChanged; - - // Add events. - CKEDITOR.event.implementOn( this ); - - this.registerEvents( elementDefinition ); - if ( this.accessKeyUp && this.accessKeyDown && elementDefinition.accessKey ) - registerAccessKey( this, dialog, 'CTRL+' + elementDefinition.accessKey ); - - var me = this; - dialog.on( 'load', function() - { - if ( me.getInputElement() ) - { - me.getInputElement().on( 'focus', function() - { - dialog._.tabBarMode = false; - dialog._.hasFocus = true; - me.fire( 'focus' ); - }, me ); - } - } ); - - // Register the object as a tab focus if it can be included. - if ( this.keyboardFocusable ) - { - this.tabIndex = elementDefinition.tabIndex || 0; - - this.focusIndex = dialog._.focusList.push( this ) - 1; - this.on( 'focus', function() - { - dialog._.currentFocusIndex = me.focusIndex; - } ); - } - - // Completes this object with everything we have in the - // definition. - CKEDITOR.tools.extend( this, elementDefinition ); - }, - - /** - * Horizontal layout box for dialog UI elements, auto-expends to available width of container. - * @constructor - * @extends CKEDITOR.ui.dialog.uiElement - * @param {CKEDITOR.dialog} dialog - * Parent dialog object. - * @param {Array} childObjList - * Array of {@link CKEDITOR.ui.dialog.uiElement} objects inside this - * container. - * @param {Array} childHtmlList - * Array of HTML code that correspond to the HTML output of all the - * objects in childObjList. - * @param {Array} htmlList - * Array of HTML code that this element will output to. - * @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition - * The element definition. Accepted fields: - *
        - *
      • widths (Optional) The widths of child cells.
      • - *
      • height (Optional) The height of the layout.
      • - *
      • padding (Optional) The padding width inside child - * cells.
      • - *
      • align (Optional) The alignment of the whole layout - *
      • - *
      - * @example - */ - hbox : function( dialog, childObjList, childHtmlList, htmlList, elementDefinition ) - { - if ( arguments.length < 4 ) - return; - - this._ || ( this._ = {} ); - - var children = this._.children = childObjList, - widths = elementDefinition && elementDefinition.widths || null, - height = elementDefinition && elementDefinition.height || null, - styles = {}, - i; - /** @ignore */ - var innerHTML = function() - { - var html = [ '' ]; - for ( i = 0 ; i < childHtmlList.length ; i++ ) - { - var className = 'cke_dialog_ui_hbox_child', - styles = []; - if ( i === 0 ) - className = 'cke_dialog_ui_hbox_first'; - if ( i == childHtmlList.length - 1 ) - className = 'cke_dialog_ui_hbox_last'; - html.push( ' 0 ) - html.push( 'style="' + styles.join('; ') + '" ' ); - html.push( '>', childHtmlList[i], '' ); - } - html.push( '' ); - return html.join( '' ); - }; - - var attribs = { role : 'presentation' }; - elementDefinition && elementDefinition.align && ( attribs.align = elementDefinition.align ); - - CKEDITOR.ui.dialog.uiElement.call( - this, - dialog, - elementDefinition || { type : 'hbox' }, - htmlList, - 'table', - styles, - attribs, - innerHTML ); - }, - - /** - * Vertical layout box for dialog UI elements. - * @constructor - * @extends CKEDITOR.ui.dialog.hbox - * @param {CKEDITOR.dialog} dialog - * Parent dialog object. - * @param {Array} childObjList - * Array of {@link CKEDITOR.ui.dialog.uiElement} objects inside this - * container. - * @param {Array} childHtmlList - * Array of HTML code that correspond to the HTML output of all the - * objects in childObjList. - * @param {Array} htmlList - * Array of HTML code that this element will output to. - * @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition - * The element definition. Accepted fields: - *
        - *
      • width (Optional) The width of the layout.
      • - *
      • heights (Optional) The heights of individual cells. - *
      • - *
      • align (Optional) The alignment of the layout.
      • - *
      • padding (Optional) The padding width inside child - * cells.
      • - *
      • expand (Optional) Whether the layout should expand - * vertically to fill its container.
      • - *
      - * @example - */ - vbox : function( dialog, childObjList, childHtmlList, htmlList, elementDefinition ) - { - if (arguments.length < 3 ) - return; - - this._ || ( this._ = {} ); - - var children = this._.children = childObjList, - width = elementDefinition && elementDefinition.width || null, - heights = elementDefinition && elementDefinition.heights || null; - /** @ignore */ - var innerHTML = function() - { - var html = [ '' ); - for ( var i = 0 ; i < childHtmlList.length ; i++ ) - { - var styles = []; - html.push( '' ); - } - html.push( '
      0 ) - html.push( 'style="', styles.join( '; ' ), '" ' ); - html.push( ' class="cke_dialog_ui_vbox_child">', childHtmlList[i], '
      ' ); - return html.join( '' ); - }; - CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition || { type : 'vbox' }, htmlList, 'div', null, { role : 'presentation' }, innerHTML ); - } - }; - })(); - - CKEDITOR.ui.dialog.uiElement.prototype = - { - /** - * Gets the root DOM element of this dialog UI object. - * @returns {CKEDITOR.dom.element} Root DOM element of UI object. - * @example - * uiElement.getElement().hide(); - */ - getElement : function() - { - return CKEDITOR.document.getById( this.domId ); - }, - - /** - * Gets the DOM element that the user inputs values. - * This function is used by setValue(), getValue() and focus(). It should - * be overrided in child classes where the input element isn't the root - * element. - * @returns {CKEDITOR.dom.element} The element where the user input values. - * @example - * var rawValue = textInput.getInputElement().$.value; - */ - getInputElement : function() - { - return this.getElement(); - }, - - /** - * Gets the parent dialog object containing this UI element. - * @returns {CKEDITOR.dialog} Parent dialog object. - * @example - * var dialog = uiElement.getDialog(); - */ - getDialog : function() - { - return this._.dialog; - }, - - /** - * Sets the value of this dialog UI object. - * @param {Object} value The new value. - * @returns {CKEDITOR.dialog.uiElement} The current UI element. - * @example - * uiElement.setValue( 'Dingo' ); - */ - setValue : function( value ) - { - this.getInputElement().setValue( value ); - this.fire( 'change', { value : value } ); - return this; - }, - - /** - * Gets the current value of this dialog UI object. - * @returns {Object} The current value. - * @example - * var myValue = uiElement.getValue(); - */ - getValue : function() - { - return this.getInputElement().getValue(); - }, - - /** - * Tells whether the UI object's value has changed. - * @returns {Boolean} true if changed, false if not changed. - * @example - * if ( uiElement.isChanged() ) - *   confirm( 'Value changed! Continue?' ); - */ - isChanged : function() - { - // Override in input classes. - return false; - }, - - /** - * Selects the parent tab of this element. Usually called by focus() or overridden focus() methods. - * @returns {CKEDITOR.dialog.uiElement} The current UI element. - * @example - * focus : function() - * { - * this.selectParentTab(); - * // do something else. - * } - */ - selectParentTab : function() - { - var element = this.getInputElement(), - cursor = element, - tabId; - while ( ( cursor = cursor.getParent() ) && cursor.$.className.search( 'cke_dialog_page_contents' ) == -1 ) - { /*jsl:pass*/ } - - // Some widgets don't have parent tabs (e.g. OK and Cancel buttons). - if ( !cursor ) - return this; - - tabId = cursor.getAttribute( 'name' ); - // Avoid duplicate select. - if ( this._.dialog._.currentTabId != tabId ) - this._.dialog.selectPage( tabId ); - return this; - }, - - /** - * Puts the focus to the UI object. Switches tabs if the UI object isn't in the active tab page. - * @returns {CKEDITOR.dialog.uiElement} The current UI element. - * @example - * uiElement.focus(); - */ - focus : function() - { - this.selectParentTab().getInputElement().focus(); - return this; - }, - - /** - * Registers the on* event handlers defined in the element definition. - * The default behavior of this function is: - *
        - *
      1. - * If the on* event is defined in the class's eventProcesors list, - * then the registration is delegated to the corresponding function - * in the eventProcessors list. - *
      2. - *
      3. - * If the on* event is not defined in the eventProcessors list, then - * register the event handler under the corresponding DOM event of - * the UI element's input DOM element (as defined by the return value - * of {@link CKEDITOR.ui.dialog.uiElement#getInputElement}). - *
      4. - *
      - * This function is only called at UI element instantiation, but can - * be overridded in child classes if they require more flexibility. - * @param {CKEDITOR.dialog.uiElementDefinition} definition The UI element - * definition. - * @returns {CKEDITOR.dialog.uiElement} The current UI element. - * @example - */ - registerEvents : function( definition ) - { - var regex = /^on([A-Z]\w+)/, - match; - - var registerDomEvent = function( uiElement, dialog, eventName, func ) - { - dialog.on( 'load', function() - { - uiElement.getInputElement().on( eventName, func, uiElement ); - }); - }; - - for ( var i in definition ) - { - if ( !( match = i.match( regex ) ) ) - continue; - if ( this.eventProcessors[i] ) - this.eventProcessors[i].call( this, this._.dialog, definition[i] ); - else - registerDomEvent( this, this._.dialog, match[1].toLowerCase(), definition[i] ); - } - - return this; - }, - - /** - * The event processor list used by - * {@link CKEDITOR.ui.dialog.uiElement#getInputElement} at UI element - * instantiation. The default list defines three on* events: - *
        - *
      1. onLoad - Called when the element's parent dialog opens for the - * first time
      2. - *
      3. onShow - Called whenever the element's parent dialog opens.
      4. - *
      5. onHide - Called whenever the element's parent dialog closes.
      6. - *
      - * @field - * @type Object - * @example - * // This connects the 'click' event in CKEDITOR.ui.dialog.button to onClick - * // handlers in the UI element's definitions. - * CKEDITOR.ui.dialog.button.eventProcessors = CKEDITOR.tools.extend( {}, - *   CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors, - *   { onClick : function( dialog, func ) { this.on( 'click', func ); } }, - *   true ); - */ - eventProcessors : - { - onLoad : function( dialog, func ) - { - dialog.on( 'load', func, this ); - }, - - onShow : function( dialog, func ) - { - dialog.on( 'show', func, this ); - }, - - onHide : function( dialog, func ) - { - dialog.on( 'hide', func, this ); - } - }, - - /** - * The default handler for a UI element's access key down event, which - * tries to put focus to the UI element.
      - * Can be overridded in child classes for more sophisticaed behavior. - * @param {CKEDITOR.dialog} dialog The parent dialog object. - * @param {String} key The key combination pressed. Since access keys - * are defined to always include the CTRL key, its value should always - * include a 'CTRL+' prefix. - * @example - */ - accessKeyDown : function( dialog, key ) - { - this.focus(); - }, - - /** - * The default handler for a UI element's access key up event, which - * does nothing.
      - * Can be overridded in child classes for more sophisticated behavior. - * @param {CKEDITOR.dialog} dialog The parent dialog object. - * @param {String} key The key combination pressed. Since access keys - * are defined to always include the CTRL key, its value should always - * include a 'CTRL+' prefix. - * @example - */ - accessKeyUp : function( dialog, key ) - { - }, - - /** - * Disables a UI element. - * @example - */ - disable : function() - { - var element = this.getInputElement(); - element.setAttribute( 'disabled', 'true' ); - element.addClass( 'cke_disabled' ); - }, - - /** - * Enables a UI element. - * @example - */ - enable : function() - { - var element = this.getInputElement(); - element.removeAttribute( 'disabled' ); - element.removeClass( 'cke_disabled' ); - }, - - /** - * Determines whether an UI element is enabled or not. - * @returns {Boolean} Whether the UI element is enabled. - * @example - */ - isEnabled : function() - { - return !this.getInputElement().getAttribute( 'disabled' ); - }, - - /** - * Determines whether an UI element is visible or not. - * @returns {Boolean} Whether the UI element is visible. - * @example - */ - isVisible : function() - { - return this.getInputElement().isVisible(); - }, - - /** - * Determines whether an UI element is focus-able or not. - * Focus-able is defined as being both visible and enabled. - * @returns {Boolean} Whether the UI element can be focused. - * @example - */ - isFocusable : function() - { - if ( !this.isEnabled() || !this.isVisible() ) - return false; - return true; - } - }; - - CKEDITOR.ui.dialog.hbox.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement, - /** - * @lends CKEDITOR.ui.dialog.hbox.prototype - */ - { - /** - * Gets a child UI element inside this container. - * @param {Array|Number} indices An array or a single number to indicate the child's - * position in the container's descendant tree. Omit to get all the children in an array. - * @returns {Array|CKEDITOR.ui.dialog.uiElement} Array of all UI elements in the container - * if no argument given, or the specified UI element if indices is given. - * @example - * var checkbox = hbox.getChild( [0,1] ); - * checkbox.setValue( true ); - */ - getChild : function( indices ) - { - // If no arguments, return a clone of the children array. - if ( arguments.length < 1 ) - return this._.children.concat(); - - // If indices isn't array, make it one. - if ( !indices.splice ) - indices = [ indices ]; - - // Retrieve the child element according to tree position. - if ( indices.length < 2 ) - return this._.children[ indices[0] ]; - else - return ( this._.children[ indices[0] ] && this._.children[ indices[0] ].getChild ) ? - this._.children[ indices[0] ].getChild( indices.slice( 1, indices.length ) ) : - null; - } - }, true ); - - CKEDITOR.ui.dialog.vbox.prototype = new CKEDITOR.ui.dialog.hbox(); - - - - (function() - { - var commonBuilder = { - build : function( dialog, elementDefinition, output ) - { - var children = elementDefinition.children, - child, - childHtmlList = [], - childObjList = []; - for ( var i = 0 ; ( i < children.length && ( child = children[i] ) ) ; i++ ) - { - var childHtml = []; - childHtmlList.push( childHtml ); - childObjList.push( CKEDITOR.dialog._.uiElementBuilders[ child.type ].build( dialog, child, childHtml ) ); - } - return new CKEDITOR.ui.dialog[elementDefinition.type]( dialog, childObjList, childHtmlList, output, elementDefinition ); - } - }; - - CKEDITOR.dialog.addUIElement( 'hbox', commonBuilder ); - CKEDITOR.dialog.addUIElement( 'vbox', commonBuilder ); - })(); - - /** - * Generic dialog command. It opens a specific dialog when executed. - * @constructor - * @augments CKEDITOR.commandDefinition - * @param {string} dialogName The name of the dialog to open when executing - * this command. - * @example - * // Register the "link" command, which opens the "link" dialog. - * editor.addCommand( 'link', new CKEDITOR.dialogCommand( 'link' ) ); - */ - CKEDITOR.dialogCommand = function( dialogName ) - { - this.dialogName = dialogName; - }; - - CKEDITOR.dialogCommand.prototype = - { - /** @ignore */ - exec : function( editor ) - { - editor.openDialog( this.dialogName ); - }, - - // Dialog commands just open a dialog ui, thus require no undo logic, - // undo support should dedicate to specific dialog implementation. - canUndo: false, - - editorFocus : CKEDITOR.env.ie - }; - - (function() - { - var notEmptyRegex = /^([a]|[^a])+$/, - integerRegex = /^\d*$/, - numberRegex = /^\d*(?:\.\d+)?$/; - - CKEDITOR.VALIDATE_OR = 1; - CKEDITOR.VALIDATE_AND = 2; - - CKEDITOR.dialog.validate = - { - functions : function() - { - return function() - { - /** - * It's important for validate functions to be able to accept the value - * as argument in addition to this.getValue(), so that it is possible to - * combine validate functions together to make more sophisticated - * validators. - */ - var value = this && this.getValue ? this.getValue() : arguments[0]; - - var msg = undefined, - relation = CKEDITOR.VALIDATE_AND, - functions = [], i; - - for ( i = 0 ; i < arguments.length ; i++ ) - { - if ( typeof( arguments[i] ) == 'function' ) - functions.push( arguments[i] ); - else - break; - } - - if ( i < arguments.length && typeof( arguments[i] ) == 'string' ) - { - msg = arguments[i]; - i++; - } - - if ( i < arguments.length && typeof( arguments[i]) == 'number' ) - relation = arguments[i]; - - var passed = ( relation == CKEDITOR.VALIDATE_AND ? true : false ); - for ( i = 0 ; i < functions.length ; i++ ) - { - if ( relation == CKEDITOR.VALIDATE_AND ) - passed = passed && functions[i]( value ); - else - passed = passed || functions[i]( value ); - } - - if ( !passed ) - { - if ( msg !== undefined ) - alert( msg ); - if ( this && ( this.select || this.focus ) ) - ( this.select || this.focus )(); - return false; - } - - return true; - }; - }, - - regex : function( regex, msg ) - { - /* - * Can be greatly shortened by deriving from functions validator if code size - * turns out to be more important than performance. - */ - return function() - { - var value = this && this.getValue ? this.getValue() : arguments[0]; - if ( !regex.test( value ) ) - { - if ( msg !== undefined ) - alert( msg ); - if ( this && ( this.select || this.focus ) ) - { - if ( this.select ) - this.select(); - else - this.focus(); - } - return false; - } - return true; - }; - }, - - notEmpty : function( msg ) - { - return this.regex( notEmptyRegex, msg ); - }, - - integer : function( msg ) - { - return this.regex( integerRegex, msg ); - }, - - 'number' : function( msg ) - { - return this.regex( numberRegex, msg ); - }, - - equals : function( value, msg ) - { - return this.functions( function( val ){ return val == value; }, msg ); - }, - - notEqual : function( value, msg ) - { - return this.functions( function( val ){ return val != value; }, msg ); - } - }; - })(); -})(); - -// Extend the CKEDITOR.editor class with dialog specific functions. -CKEDITOR.tools.extend( CKEDITOR.editor.prototype, - /** @lends CKEDITOR.editor.prototype */ - { - /** - * Loads and opens a registered dialog. - * @param {String} dialogName The registered name of the dialog. - * @param {Function} callback The function to be invoked after dialog instance created. - * @see CKEDITOR.dialog.add - * @example - * CKEDITOR.instances.editor1.openDialog( 'smiley' ); - * @returns {CKEDITOR.dialog} The dialog object corresponding to the dialog displayed. null if the dialog name is not registered. - */ - openDialog : function( dialogName, callback ) - { - var dialogDefinitions = CKEDITOR.dialog._.dialogDefinitions[ dialogName ], - dialogSkin = this.skin.dialog; - - // If the dialogDefinition is already loaded, open it immediately. - if ( typeof dialogDefinitions == 'function' && dialogSkin._isLoaded ) - { - var storedDialogs = this._.storedDialogs || - ( this._.storedDialogs = {} ); - - var dialog = storedDialogs[ dialogName ] || - ( storedDialogs[ dialogName ] = new CKEDITOR.dialog( this, dialogName ) ); - - callback && callback.call( dialog, dialog ); - dialog.show(); - - return dialog; - } - else if ( dialogDefinitions == 'failed' ) - throw new Error( '[CKEDITOR.dialog.openDialog] Dialog "' + dialogName + '" failed when loading definition.' ); - - // Not loaded? Load the .js file first. - var body = CKEDITOR.document.getBody(), - cursor = body.$.style.cursor, - me = this; - - body.setStyle( 'cursor', 'wait' ); - - function onDialogFileLoaded( success ) - { - var dialogDefinition = CKEDITOR.dialog._.dialogDefinitions[ dialogName ], - skin = me.skin.dialog; - - // Check if both skin part and definition is loaded. - if ( !skin._isLoaded || loadDefinition && typeof success == 'undefined' ) - return; - - // In case of plugin error, mark it as loading failed. - if ( typeof dialogDefinition != 'function' ) - CKEDITOR.dialog._.dialogDefinitions[ dialogName ] = 'failed'; - - me.openDialog( dialogName, callback ); - body.setStyle( 'cursor', cursor ); - } - - if ( typeof dialogDefinitions == 'string' ) - { - var loadDefinition = 1; - CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( dialogDefinitions ), onDialogFileLoaded ); - } - - CKEDITOR.skins.load( this, 'dialog', onDialogFileLoaded ); - - return null; - } - }); - -CKEDITOR.plugins.add( 'dialog', - { - requires : [ 'dialogui' ] - }); - -// Dialog related configurations. - -/** - * The color of the dialog background cover. It should be a valid CSS color - * string. - * @name CKEDITOR.config.dialog_backgroundCoverColor - * @type String - * @default 'white' - * @example - * config.dialog_backgroundCoverColor = 'rgb(255, 254, 253)'; - */ - -/** - * The opacity of the dialog background cover. It should be a number within the - * range [0.0, 1.0]. - * @name CKEDITOR.config.dialog_backgroundCoverOpacity - * @type Number - * @default 0.5 - * @example - * config.dialog_backgroundCoverOpacity = 0.7; - */ - -/** - * If the dialog has more than one tab, put focus into the first tab as soon as dialog is opened. - * @name CKEDITOR.config.dialog_startupFocusTab - * @type Boolean - * @default false - * @example - * config.dialog_startupFocusTab = true; - */ - -/** - * The distance of magnetic borders used in moving and resizing dialogs, - * measured in pixels. - * @name CKEDITOR.config.dialog_magnetDistance - * @type Number - * @default 20 - * @example - * config.dialog_magnetDistance = 30; - */ - -/** - * Fired when a dialog definition is about to be used to create a dialog into - * an editor instance. This event makes it possible to customize the definition - * before creating it. - *

      Note that this event is called only the first time a specific dialog is - * opened. Successive openings will use the cached dialog, and this event will - * not get fired.

      - * @name CKEDITOR#dialogDefinition - * @event - * @param {CKEDITOR.dialog.dialogDefinition} data The dialog defination that - * is being loaded. - * @param {CKEDITOR.editor} editor The editor instance that will use the - * dialog. - */ diff --git a/public/javascripts/ckeditor/_source/plugins/dialogui/plugin.js b/public/javascripts/ckeditor/_source/plugins/dialogui/plugin.js deleted file mode 100644 index 1567c94..0000000 --- a/public/javascripts/ckeditor/_source/plugins/dialogui/plugin.js +++ /dev/null @@ -1,1408 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** @fileoverview The "dialogui" plugin. */ - -CKEDITOR.plugins.add( 'dialogui' ); - -(function() -{ - var initPrivateObject = function( elementDefinition ) - { - this._ || ( this._ = {} ); - this._['default'] = this._.initValue = elementDefinition['default'] || ''; - this._.required = elementDefinition[ 'required' ] || false; - var args = [ this._ ]; - for ( var i = 1 ; i < arguments.length ; i++ ) - args.push( arguments[i] ); - args.push( true ); - CKEDITOR.tools.extend.apply( CKEDITOR.tools, args ); - return this._; - }, - textBuilder = - { - build : function( dialog, elementDefinition, output ) - { - return new CKEDITOR.ui.dialog.textInput( dialog, elementDefinition, output ); - } - }, - commonBuilder = - { - build : function( dialog, elementDefinition, output ) - { - return new CKEDITOR.ui.dialog[elementDefinition.type]( dialog, elementDefinition, output ); - } - }, - containerBuilder = - { - build : function( dialog, elementDefinition, output ) - { - var children = elementDefinition.children, - child, - childHtmlList = [], - childObjList = []; - for ( var i = 0 ; ( i < children.length && ( child = children[i] ) ) ; i++ ) - { - var childHtml = []; - childHtmlList.push( childHtml ); - childObjList.push( CKEDITOR.dialog._.uiElementBuilders[ child.type ].build( dialog, child, childHtml ) ); - } - return new CKEDITOR.ui.dialog[ elementDefinition.type ]( dialog, childObjList, childHtmlList, output, elementDefinition ); - } - }, - commonPrototype = - { - isChanged : function() - { - return this.getValue() != this.getInitValue(); - }, - - reset : function() - { - this.setValue( this.getInitValue() ); - }, - - setInitValue : function() - { - this._.initValue = this.getValue(); - }, - - resetInitValue : function() - { - this._.initValue = this._['default']; - }, - - getInitValue : function() - { - return this._.initValue; - } - }, - commonEventProcessors = CKEDITOR.tools.extend( {}, CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors, - { - onChange : function( dialog, func ) - { - if ( !this._.domOnChangeRegistered ) - { - dialog.on( 'load', function() - { - this.getInputElement().on( 'change', function(){ this.fire( 'change', { value : this.getValue() } ); }, this ); - }, this ); - this._.domOnChangeRegistered = true; - } - - this.on( 'change', func ); - } - }, true ), - eventRegex = /^on([A-Z]\w+)/, - cleanInnerDefinition = function( def ) - { - // An inner UI element should not have the parent's type, title or events. - for ( var i in def ) - { - if ( eventRegex.test( i ) || i == 'title' || i == 'type' ) - delete def[i]; - } - return def; - }; - - CKEDITOR.tools.extend( CKEDITOR.ui.dialog, - /** @lends CKEDITOR.ui.dialog */ - { - /** - * Base class for all dialog elements with a textual label on the left. - * @constructor - * @example - * @extends CKEDITOR.ui.dialog.uiElement - * @param {CKEDITOR.dialog} dialog - * Parent dialog object. - * @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition - * The element definition. Accepted fields: - *
        - *
      • label (Required) The label string.
      • - *
      • labelLayout (Optional) Put 'horizontal' here if the - * label element is to be layed out horizontally. Otherwise a vertical - * layout will be used.
      • - *
      • widths (Optional) This applies only for horizontal - * layouts - an 2-element array of lengths to specify the widths of the - * label and the content element.
      • - *
      - * @param {Array} htmlList - * List of HTML code to output to. - * @param {Function} contentHtml - * A function returning the HTML code string to be added inside the content - * cell. - */ - labeledElement : function( dialog, elementDefinition, htmlList, contentHtml ) - { - if ( arguments.length < 4 ) - return; - - var _ = initPrivateObject.call( this, elementDefinition ); - _.labelId = CKEDITOR.tools.getNextNumber() + '_label'; - var children = this._.children = []; - /** @ignore */ - var innerHTML = function() - { - var html = []; - if ( elementDefinition.labelLayout != 'horizontal' ) - html.push( '', - '' ); - else - { - var hboxDefinition = { - type : 'hbox', - widths : elementDefinition.widths, - padding : 0, - children : - [ - { - type : 'html', - html : '