added initial checkout into new structure

This commit is contained in:
sanj 2010-03-07 21:51:14 +05:30
parent 5df4519d20
commit 94c1f5c2dd
733 changed files with 123926 additions and 0 deletions

2
edgware/.bzrignore Normal file
View File

@ -0,0 +1,2 @@
.bzrlog
settings.py

37
edgware/TODO.txt Normal file
View File

@ -0,0 +1,37 @@
Audio / Video / Bins:
i> Controls on items inside Bin to do various things, including adding audio and video to page. ( + some interface to show / edit audio / video associated with page, probably in the Canvas controls).
ii> For audio / video, a way to attach them to transcripts ? How the fuck is that working ?
iii> Work-flow of creating an image box from item inside bin. - ALMOST DONE.
iv> If needed, a way to filter within bins.
Revisions: -Sanjay
i> If using Django-Reversion, figure its API to do reversions.
ii> Else, create a url where front-end sends JSON of entire Article (or page?) to back-end as a revision to be pickled and stored in DB.
iii> If using Django-Reversion,
Article / Issue / Page:
i> Cleanly implement work-flow to create a new Issue, then Articles under that and pages under articles - some interface to browse and edit issues.
ii> Create the functions to add / delete articles, issues, pages. - Sanjay
Generate front-end pages:
i> Generate web view alongwith audio / video, scrolling logic, etc.
ii> Work on audio / video widgets.
iii> Generate really big view for printing based on parameters - figure math to do on CSS, etc. to make this possible.
DONE:
TextBoxes.
Image-Boxes:
i> DONE - in JS, create init functions etc. for imageBoxes as per textBoxes. -Sanjay
ii> DONE - Implement a url which handles cropping image and returns a url. -Sanjay
iii> DONE - Implement a url which handles resizing image and returns a url. -Sanjay
iv> DONE - Figure logic of paths / naming conventions to get cropped, resized, high quality, web quality, etc.
Misc:
i> DONE - Implement delete for boxes. -Sanjay

0
edgware/__init__.py Executable file
View File

20
edgware/dropandcreatedb.py Executable file
View File

@ -0,0 +1,20 @@
import sys
import os
from settings import DATABASE_NAME
try:
import settings # Assumed to be in the same directory.
except ImportError:
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
sys.exit(1)
filename = "/tmp/tmp.txt"
tmpfile = open(filename, "w")
tmpfile.write("DROP DATABASE %s;\nCREATE DATABASE %s;\n" % (DATABASE_NAME, DATABASE_NAME) )
tmpfile.close()
os.system("mysql -u root < " + filename)
os.system("python manage.py syncdb --noinput")
os.system("python manage.py createsuperuser --username admin --email user@user.com")

BIN
edgware/edge Normal file

Binary file not shown.

BIN
edgware/editor/.DS_Store vendored Normal file

Binary file not shown.

View File

27
edgware/editor/admin.py Normal file
View File

@ -0,0 +1,27 @@
from editor.models import *
from django.contrib import admin
class ProductTypeAdmin(admin.ModelAdmin):
pass
class ProductAdmin(admin.ModelAdmin):
pass
class LinksAdmin(admin.ModelAdmin):
pass
class LinkCategoryAdmin(admin.ModelAdmin):
pass
admin.site.register(ProductType, ProductTypeAdmin)
admin.site.register(Product, ProductAdmin)
admin.site.register(Link, LinksAdmin)
admin.site.register(LinkCategory, LinkCategoryAdmin)
admin.site.register(Article)
admin.site.register(ImageBox)
admin.site.register(TextBox)
admin.site.register(Video)
admin.site.register(Audio)
admin.site.register(Srt)
admin.site.register(SliderImage)

34
edgware/editor/fields.py Normal file
View File

@ -0,0 +1,34 @@
# Django Snippet from http://www.djangosnippets.org/snippets/1521/
import re
from django.forms import fields
from django.forms import ValidationError
from django.utils.encoding import smart_unicode
class HexColorField(fields.Field):
default_error_messages = {
'hex_error': u'This is an invalid color code. It must be a html hex color code e.g. #000000'
}
def clean(self, value):
super(HexColorField, self).clean(value)
if value in fields.EMPTY_VALUES:
return u''
value = smart_unicode(value)
value_length = len(value)
if value_length != 7 or not re.match('^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$', value):
raise ValidationError(self.error_messages['hex_error'])
return value
def widget_attrs(self, widget):
if isinstance(widget, (fields.TextInput)):
return {'maxlength': str(7)}
def __unicode__(self):
return self.value

627
edgware/editor/models.py Normal file
View File

@ -0,0 +1,627 @@
from django.db import models
from files.models import File
from fields import HexColorField
from django.contrib.comments.signals import comment_was_posted
import simplejson
from django.core.mail import send_mail
import os
from PIL import Image
from django.template import Template, Context
from django.template.loader import get_template
from settings import MEDIA_ROOT
from django.contrib.auth.models import User
from tagging.fields import TagField
from tagging.models import Tag
def addPx(val):
'''
Adds 'px' to an integer value for a CSS property from DB
'''
r = str(int(val)) + "px"
return r
def cleanCSS(prop):
'''
Takes a CSS property and returns it into a value safe for insertion into DB
'''
propStr = str(prop)
if propStr[-2:] == 'px':
r = int(propStr[:-2])
# elif prop[0] == '#':
# r = prop[1:]
else:
r = prop
return r
def isPx(s):
if s[:-2] == 'px':
return True
else:
return False
def baseFileName(filename):
r = filename.rindex('.')
return filename[0:r]
def extFileName(filename):
r = filename.rindex('.') + 1
return filename[r:]
class LinkCategory(models.Model):
title = models.CharField(max_length=255)
is_onfront = models.BooleanField(default=False)
class Link(models.Model):
product = models.ForeignKey("Product")
category = models.ForeignKey("LinkCategory")
thumbnail = models.ImageField(upload_to='images/link_thumbs/')
description = models.TextField(blank=True, null=True)
order = models.IntegerField()
def __unicode__(self):
return self.description
class ProductType(models.Model):
name = models.CharField(max_length=255)
aspect_ratio = models.FloatField(default=0.707, help_text="Default 0.707 as per http://en.wikipedia.org/wiki/Paper_size")
print_width = models.IntegerField(help_text="Unit: mm")
def __unicode__(self):
return self.name
class Product(models.Model):
title = models.CharField(max_length=255)
published = models.BooleanField(default=False)
date_published = models.DateField(blank=True, null=True)
typ = models.ForeignKey("ProductType")
tags = TagField()
creator = models.ForeignKey(User)
abstract = models.TextField(blank=True, null=True)
videos = models.ManyToManyField("Video", blank=True)
audios = models.ManyToManyField("Audio", blank=True)
def __unicode__(self):
return "%s" % (self.title)
class Video(models.Model):
fil = models.ForeignKey(File)
srt = models.ManyToManyField("Srt", blank=True, null=True)
def __unicode__(self):
return self.fil.title
class Audio(models.Model):
fil = models.ForeignKey(File)
srt = models.ManyToManyField("Srt", blank=True, null=True)
def __unicode__(self):
return self.fil.title
SRT_LANGS = (
('en', 'English'),
('ar', 'Arabic'),
)
SRT_TYPES = (
('transcript', 'Transcript'),
('description', 'Description'),
)
class Srt(models.Model):
fil = models.FileField(upload_to="srt/")
lang = models.CharField(max_length=20, choices=SRT_LANGS)
typ = models.CharField(max_length = 40, choices=SRT_TYPES)
'''
This models holds revisions, gets saved to whenever anything in an article changes - when a box changes, its pretty straightforward what's supposed to happen. When a new box or page is created, slightly strange things happen:
For a new box- prop = 'new_box', old_val='', new_val=String JSON representation of the new box.
For new page- prop = 'new_page', old_val='', new_val=String JSON representation of the new page.
For delete box, prop = 'delete_box'
For image_crop, prop = 'crop',
For image_resize, prop = 'image_resize'
(of course this is ugly).
'''
class Revision(models.Model):
article = models.ForeignKey("Article")
page = models.ForeignKey("Page")
box_type = models.CharField(max_length=100)
box_id = models.IntegerField()
prop = models.CharField(max_length=100)
old_val = models.TextField()
new_val = models.TextField()
uuid = models.IntegerField()
def saveRevision(r):
page = Page.objects.get(pk=r['page_id'])
article = page.article
rev = Revision(article=article, page=page, box_type=r['box_type'], box_id=r['box_id'], prop=r['prop'], old_val=r['old_val'], new_val=r['new_val'], uuid=r['uuid'])
rev.save()
return rev.id
class Article(models.Model):
"""
Each page references an article. A single page cannot reference more than one article. The article is what people comment on (and potentially what audio & video are attached to).
"""
name = models.CharField(max_length=255)
product = models.ForeignKey("Product")
order = models.IntegerField()
'''
'''
def changes(self, revision_no, uuid):
if int(revision_no) == self.current_revision():
return {'ok': 'ok'}
else:
d = []
new_revisions_all = Revision.objects.filter(article=self).filter(id__gt=revision_no)
new_revisions_others = new_revisions_all.exclude(uuid=uuid)
for rev in new_revisions_others:
if new_revisions_all.filter(id__gt=rev.id, prop=rev.prop, box_type=rev.box_type, page=rev.page).count() > 0:
UGLY_HACK = True
else:
d.append({
'page_id': rev.page.id,
'prop': rev.prop,
'old_val': rev.old_val,
'new_val': rev.new_val,
'box_type': rev.box_type,
'box_id': rev.box_id,
'uuid': rev.uuid,
'rev_no': rev.id
})
last_rev = self.current_revision()
return {'revs': d, 'rev_id': last_rev}
def current_revision(self):
try:
rev = Revision.objects.filter(article=self).order_by('-id')[0]
return rev.id
except:
return 0
def editor_size(self):
height = self.editor_width / self.aspect_ratio
return (self.editor_width, height,)
def view_size(self):
product = Product.objects.get(pk=self.product.id)
aspect_ratio = product.typ.aspect_ratio
width = 800
height = int(800.0 // aspect_ratio)
return (width, height,)
def print_size(self, print_width):
height = print_width / aspect_ratio
multiplier = print_width / (self.editor_width + .0)
return (self.print_width, height, multiplier,)
def get_print_multiplier(self, dpi):
product = Product.objects.get(pk=self.product.id)
print_width_mm = product.typ.print_width
dpm = dpi // 25.4
pixel_width = print_width_mm * dpm
m = pixel_width // 800.0
return m
def __unicode__(self):
return self.name
def get_dict(self, *args):
if len(args) > 0:
m = args[0]
else:
m = 1
if len(args) > 1:
page_id = args[1]
pages = Page.objects.filter(id__iexact=page_id)
else:
pages = Page.objects.filter(article=self).order_by('page_no')
rList = []
for p in pages:
rList.append(p.get_dict(m))
return rList
class Meta:
unique_together = ('product', 'order',)
class Page(models.Model):
# Question: Does Page need some custom CSS definitions like bg_color, borders, etc. ?
page_no = models.IntegerField()
article = models.ForeignKey('Article')
videos = models.ManyToManyField(Video)
audios = models.ManyToManyField(Audio)
background_color = models.CharField(max_length=30)
def __unicode__(self):
return "%s: %s" % (self.page_no, self.article)
def set_page_no(self, new_page_no):
"""
Use this function to set a new page no. on a Page instance. Changes page numbers of other pages in article accordingly.
"""
old_page_no = self.page_no
self.page_no = new_page_no
self.save()
if new_page_no < old_page_no:
pages_after = Page.objects.filter(article=self.article, page_no__gte=new_page_no).filter(page_no__lt=old_page_no).exclude(pk=self.id)
for a in pages_after:
a.page_no = a.page_no + 1
a.save()
else:
pages_before = Page.objects.filter(article=self.article, page_no__lte=new_page_no).filter(page_no__gt=old_page_no).exclude(pk=self.id)
for b in pages_before:
b.page_no = b.page_no - 1
b.save()
return self
def get_dict(self, m):
"""
This function iterates through all boxes on the page and returns a Dict representation which the view converts to json to send to front-end.
"""
# Image Boxes:
imageBoxes = []
for i in ImageBox.objects.filter(page = self).exclude(is_displayed = False):
imageBoxes.append(i.to_dict(m))
# Text Boxes:
textBoxes = []
for t in TextBox.objects.filter(page = self).exclude(is_displayed = False):
textBoxes.append(t.to_dict())
'''
videos = []
for v in self.videos:
r = {
'title' = v.fil.title,
'description' = v.fil.description
'srts' = []
for s in v.srt:
'''
#Resources:
'''
resources = []
for res in self.resources.all():
r = {}
r = {
'file': res.file,
'title': res.title,
'description': res.description,
'tags': res.tags,
'userID': res.userID,
'added': res.added,
'categories': res.categories
}
resources.append(r)
'''
rDict = {
'id': self.id,
'imageBoxes' : imageBoxes,
'textBoxes': textBoxes,
# 'resources' : resources
}
return rDict
def save_from_dict(self, d):
imageBoxes = d.imageBoxes
textBoxes = d.textBoxes
for i in imageBoxes:
img = ImageBox.objects.get(pk=i.id)
img.save_from_dict()
for t in textBoxes:
txt = TextBox.objects.get(pk=t.id)
txt.save_from_dict()
#The next two functions are painful. Whoever writes them wins a trip to the moon.
def save_revision(self):
"""
This function saves the json for the page as a Page Revision.
"""
return True
def load_revision(self, rev_no):
"""
Loads the json data from a revision to populate the page. First, of course, it saves its current state as a revision
"""
return True
def deleteme(self):
"""
Deletes self - needs to change next page numbers.
"""
return True
class TextBox(models.Model):
# Positioning stuff:
height = models.IntegerField()
width = models.IntegerField()
top = models.IntegerField()
left = models.IntegerField()
# Store reference to file containing text, if any:
file = models.ForeignKey(File, blank=True, null=True)
# Content, reference to page and whether is_displayed:
html = models.TextField()
page = models.ForeignKey(Page)
is_displayed = models.BooleanField(default=True)
# CSS:
z_index = models.IntegerField()
background_color = models.CharField(max_length=16)
border_style = models.CharField(max_length=16)
border_width = models.IntegerField()
# line_height = models.IntegerField(blank=True, null=True)
# letter_spacing = models.IntegerField(blank=True, null=True)
# word_spacing = models.IntegerField(blank=True, null=True)
border_color = models.CharField(max_length=10)
border_radius = models.IntegerField()
padding_top = models.IntegerField()
padding_left = models.IntegerField()
padding_bottom = models.IntegerField()
padding_right = models.IntegerField()
opacity = models.FloatField()
def set_css(self, prop, val):
p = prop.replace("-", "_")
self.__setattr__(p, cleanCSS(val))
return self
def get_css(self, prop):
p = prop.replace("-", "_")
r = self.__getattribute__(p)
return r
def to_dict(self):
return {
'id': self.id,
'html': self.html,
'css': {
'height': addPx(self.height),
'width': addPx(self.width),
'top': addPx(self.top),
'left': addPx(self.left),
'z-index': self.z_index,
'opacity': self.opacity,
'border-style': self.border_style,
'border-width': addPx(self.border_width),
'border-color': self.border_color,
'background-color': self.background_color,
'border-radius': addPx(self.border_radius),
'padding-top': addPx(self.padding_top),
'padding-left': addPx(self.padding_left),
'padding-right': addPx(self.padding_right),
'padding-bottom': addPx(self.padding_bottom)
}
}
def save_from_dict(self, d):
self.html = d.html
self.save()
for prop in d.css:
self.set_css(prop, d.css[prop])
return self
class ImageBox(models.Model):
# Positioning stuff:
height = models.IntegerField()
width = models.IntegerField()
top = models.IntegerField()
left = models.IntegerField()
# Data about the crop:
is_cropped = models.BooleanField(default=False)
crop_x1 = models.IntegerField(default = 0)
crop_x2 = models.IntegerField(default = 0)
crop_y1 = models.IntegerField(default = 0)
crop_y2 = models.IntegerField(default = 0)
# Filename (originally uploaded), reference to page and whether is_displayed:
file = models.ForeignKey(File)
page = models.ForeignKey(Page)
is_displayed = models.BooleanField(default=True)
# CSS:
z_index = models.IntegerField()
border_style = models.CharField(max_length=16)
border_width = models.IntegerField()
border_color = models.CharField(max_length=10)
opacity = models.FloatField()
def __unicode__(self):
return self.id
def set_css(self, prop, val):
p = prop.replace("-", "_")
self.__setattr__(p, cleanCSS(val))
return self
def get_css(self, prop):
p = prop.replace("-", "_")
r = self.__getattribute__(p)
return r
def to_dict(self, m):
return {
'id': self.id,
'original_print': self.original_print(),
# 'original_web': i.original_web(),
'output_web': self.get_path(m),
'css': {
'height': addPx(self.height),
'width': addPx(self.width),
'top': addPx(self.top),
'left': addPx(self.left),
'z-index': int(self.z_index),
'opacity': self.opacity,
'border-style': self.border_style,
'border-width': addPx(self.border_width),
'border-color': self.border_color,
},
#DIRTY HACK: Creates a 'resource' thingie to match the front-end droppable behaviour. Try n fix at some point.
'resource': {
'height': self.height * m,
'width': self.width * m,
'resized': self.get_path(m)
}
}
def save_from_dict(self, d):
self.html = d.html
for prop in d.css:
self.set_css(prop, d.css[prop])
return self
def from_dict(self, d):
self.html = d.html
self.crop_top = d.crop_top
self.crop_bottom = d.crop_bottom
self.crop_left = d.crop_left
self.crop_right = d.crop_right
self.save()
for prop in d.css:
self.set_css(prop, d.css[prop])
return self
def resize(self, width, height):
'''
self.width = width
self.height = height
self.save()
'''
return self
#Question: Can the following methods be constructed in such a way that if the filename (based on our naming conventions) exists, it returns the filename, else, it creates it ?
"""
This function returns the filename of the highest res original dimensions file, converted to jpeg
"""
def original_print(self):
basePath = "media/images/original/"
filename = os.path.basename(str(self.file.file))
if extFileName(filename) != 'jpg':
f = baseFileName(filename) + ".jpg"
else:
f = filename
return basePath + f
def crop(self, x1, y1, x2, y2, width, height):
original_image = Image.open(MEDIA_ROOT + "/" + self.actual_unresized())
original_width = original_image.size[0]
original_height = original_image.size[1]
current_width = self.width
current_height = self.height
divisor = original_width / (current_width + .0)
if self.is_cropped == False:
self.crop_x1 = int(x1 * divisor)
self.crop_y1 = int(y1 * divisor)
self.crop_x2 = int(x2 * divisor)
self.crop_y2 = int(y2 * divisor)
self.is_cropped = True
else:
old_x1 = self.crop_x1
old_y1 = self.crop_y1
old_x2 = self.crop_x2
old_y2 = self.crop_y2
self.crop_x1 = int(x1 * divisor) + old_x1
self.crop_y1 = int(y1 * divisor) + old_y1
self.crop_x2 = int(x2 * divisor) + old_x1
self.crop_y2 = int(y2 * divisor) + old_y1
self.width = width
self.height = height
self.save()
tpl = (self.crop_x1, self.crop_y1, self.crop_x2, self.crop_y2,)
original_cropped = Image.open(MEDIA_ROOT + "/" + self.original_print()).crop(tpl)
original_cropped.save(self.cropped_path())
return self
def cropped_fname(self):
filename = baseFileName(os.path.basename(self.original_print()))
cropped_fname = "%s_%d_%d_%d_%d.jpg" % (filename, self.crop_x1, self.crop_y1, self.crop_x2, self.crop_y2)
return cropped_fname
def cropped_path(self):
return MEDIA_ROOT + "/media/images/cropped/" + self.cropped_fname()
def actual_unresized(self):
if self.is_cropped:
return "media/images/cropped/" + self.cropped_fname()
else:
return self.original_print()
def get_path(self, *args):
if len(args) > 0:
m = args[0]
else:
m = 1
path = self.actual_unresized()
context = {
'path': path,
'size': (self.width * m, self.height * m,)
}
return get_template("thumbnailTmp.txt").render(Context(context))
'''
def original_web(self):
"""
This function returns the filename of the original dimensions file, converted to jpeg, low res for web
"""
return self
def output_print(self):
"""
This function returns the filename of the high-res cropped file
"""
return self
def output_web(self):
"""
This function returns the filename of the low-res cropped file
"""
return self
'''
class PageRev(models.Model):
"""
Stores states of the page (json representations of all boxes on page) with revision numbers so user can revert to a previous state of the page
"""
page = models.ForeignKey(Page)
pickle = models.TextField()
rev_no = models.IntegerField()
comment = models.TextField(blank=True)
def __unicode__(self):
return "%s: %s" % (self.page.page_no, self.rev_no)
class SliderImage(models.Model):
small_image = models.ImageField(upload_to='images/small/', width_field='width', height_field='height', blank=False, null=False)
big_image = models.ImageField(upload_to='images/big/', width_field='width', height_field='height', blank=False, null=False)
width = models.IntegerField(editable=False)
height = models.IntegerField(editable=False)
caption = models.CharField(max_length=255, blank=True)
def __unicode__(self):
return self.caption
def comments_notify(sender, **kwargs):
comment = kwargs['comment']
name = comment.name
email = comment.email
content = comment.comment
img_id = comment.content_object.id
url = "http://edgwareroad.org/slider/%d" % (img_id)
message = "Page: %s \n Name: %s \n Email: %s \n Comment: %s" % (url, name, email, content)
send_mail("New comment on edgwareroad.org", message, "do_not_reply@edgwareroad.org", ["hello@edgwareroad.org"])
# f = open("/home/sanj/tmp/edgeTest.txt", "w")
# f.write(message)
return True
comment_was_posted.connect(comments_notify)

View File

View File

@ -0,0 +1,33 @@
from django import template
import re
register = template.Library()
def make_really_big(value, m):
"""
>>>make_really_big("40px", 4)
>>>160px
"""
v = str(value).strip()
if v[-2:] == 'px':
no = int(value.replace("px", "")) * m
return str(int(no)) + "px"
else:
return value
def parse_html(value, m):
"""
>>>parse_html("foo is 20px", 4)
>>>"foo is 80px"
"""
p = "[0-9][0-9]?px"
matches = re.findall(p, value)
for match in matches:
val = int(match.replace("px", ""))
new_val = val * m
r = str(new_val) + "px"
value = value.replace(match, r)
return value
register.filter('make_really_big', make_really_big)
register.filter("parse_html", parse_html)

30
edgware/editor/urls.py Normal file
View File

@ -0,0 +1,30 @@
from django.conf.urls.defaults import *
import views
urlpatterns = patterns('',
(r'^editor/$', views.editor),
(r'^new_page/', views.new_page),
(r'^article/json/', views.article_json),
(r'^textbox/new/', views.textbox_new),
(r'^textbox/update_css/', views.textbox_update_css),
(r'^textbox/set_html/', views.textbox_set_html),
(r'^textbox/delete/', views.textbox_delete),
(r'^imagebox/new/', views.imagebox_new),
(r'^imagebox/update_css/', views.imagebox_update_css),
(r'^imagebox/resize/', views.imagebox_resize),
(r'^imagebox/crop/', views.imagebox_crop),
(r'^imagebox/delete/', views.imagebox_delete),
(r'^image/rotate/(?P<id>\d+)/$', views.image_rotate),
(r'^add_media/', views.add_media),
(r'^add_srt/', views.add_srt),
(r'^category/json/', views.category_json),
(r'^save_page/$', views.canvas_save),
(r'^article/(?P<id>\d+)/$', views.edit_article),
(r'^view_page/(?P<id>\d+)/$', views.view_page),
(r'^view_article/(?P<id>\d+)/$', views.view_article),
(r'^issue/(?P<id>\d+)/$', views.edit_issue),
(r'^issue_list/', views.issue_list),
(r'^new_issue/', views.new_issue),
(r'^page_pdf/', views.page_pdf),
(r'^poll_changes/', views.poll_changes),
)

604
edgware/editor/views.py Normal file
View File

@ -0,0 +1,604 @@
# Create your s here.
from models import *
from files.models import *
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response
from django.contrib.auth.decorators import login_required
try:
import json
except:
import simplejson as json
from django.template import Template, Context
from django.template.loader import get_template
from os.path import join
from settings import MEDIA_ROOT
from PIL import Image
import os
@login_required
def editor(request):
c = Category.objects.all()
return render_to_response("editor.html", {'categories': c})
'''
def edit_page(request, id):
page = Page.objects.get(pk=id)
pageDict = page.get_dict()
c = Category.objects.all()
rDict = {
'categories': c,
'page': pageDict
}
'''
"""
send GET request to to /edit/add_media/ with page_id and resource_id .
"""
def add_media(request):
page_id = request.GET['page_id']
file_id = request.GET['resource_id']
page = Page.objects.get(pk=page_id)
fil = File.objects.get(pk=file_id)
typ = Type.objects.get(pk=fil.type_id)
if typ.mime == 'ogv':
try:
video = Video.objects.get(fil__id=file_id)
page.videos.append(video)
except:
pass
elif typ.mime == 'mp3':
try:
audio = Audio.objects.get(fil__id=file_id)
page.audios.append(audio)
except:
pass
page.save()
r = {
'status': 1
}
return HttpResponse(simplejson.dumps(r), mimetype="application/json")
def add_srt(request):
file_id = request.POST['id']
mime = request.POST['mime']
srt_file = request.FILES['srt']
## REMEMBER TO SAVE SRT FILE!!!##
if mime == 'ogv':
media = Video.objects.get(fil_id=file_id)
elif mime == 'mp3':
media = Audio.objects.get(fil_id=file_id)
media.srt.append(srt)
media.save()
return HttpResponse("1")
# @login_required
def edit_article(request, id):
c = Category.objects.all()
a = Article.objects.get(pk=id)
rDict = {
'categories': c,
'article_id': id,
'article_width': a.view_size()[0],
'article_height': a.view_size()[1],
'rev_no': a.current_revision()
}
return render_to_response("editor.html", rDict)
def image_rotate(request, id):
image_id = int(id)
if request.GET.has_key('degree'):
degrees = int(request.GET['degree'])
else:
degrees = 0
image_obj = File.objects.get(pk=image_id)
if ImageBox.objects.filter(file=image_obj).filter(is_displayed=True).count() > 0:
return HttpResponse("This image is being used on a page. Cannot rotate")
else:
if degrees != 0:
full_path = MEDIA_ROOT + "/" + image_obj.original_print()
im = Image.open(full_path).rotate(degrees).save(full_path)
thumbs = baseFileName(full_path) + "_*"
cmd = "rm %s" % (thumbs,)
os.system(cmd)
path = image_obj.original_print()
return render_to_response("image_rotate.html", {'path': path, 'id': image_id})
def testCrop(request):
d = {
'path': "images/oldenglish/oepan1.jpg"
}
return render_to_response("testCrop.html", d)
def imagebox_crop(request):
o = request.GET
# project_path = "/home/sanj/soc/edgware-py/"
# tpl = (int(o['x1']), int(o['y1']), int(o['x2']), int(o['y2']), o['width'], o['height'])
thisBox = ImageBox.objects.get(pk=o['id'])
old_value = json.dumps({'path': thisBox.get_path(), 'height': thisBox.height, 'width': thisBox.width})
thisBox.crop(int(o['x1']), int(o['y1']), int(o['x2']), int(o['y2']), o['width'], o['height'])
revision_id = saveRevision({
'box_id': thisBox.id,
'box_type': 'image',
'prop': 'image_crop',
'old_val': old_value,
'new_val': json.dumps({'path': thisBox.get_path(), 'height': thisBox.height, 'width': thisBox.width}),
'page_id': thisBox.page.id,
'uuid': o['uuid']
})
r = {
'path': thisBox.get_path(),
'rev_id': revision_id
}
return HttpResponse(json.dumps(r), mimetype="application/json")
def test_thumb(request):
f = File.objects.filter(type__mime__exact='jpg')[0]
r = {'path': 'media/images/original/facade.jpg'}
return render_to_response("thumbnailTmp.txt", r)
def textbox_new(request):
if request.GET['json']:
box = TextBox()
d = json.loads(request.GET['json'])
box.html = d['html']
box.page = Page.objects.get(pk=request.GET['page_id'])
if d['resource_id'] != 0:
box.file = File.objects.get(pk=d['resource_id'])
for c in d['css']:
prop = c
val = d['css'][c]
box.set_css(prop, val)
box.save()
revision_id = saveRevision({
'box_id': box.id,
'box_type': 'text',
'prop': 'new_box',
'old_val': '',
'new_val': json.dumps(box.to_dict()),
'page_id': box.page.id,
'uuid': request.GET['uuid']
})
r = {
'id': box.id,
'rev_id': revision_id
}
j = json.dumps(r)
return HttpResponse(j, mimetype="application/json")
else:
return False
def textbox_update_css(request):
box_id = request.GET['id']
try:
box = TextBox.objects.get(pk=box_id)
for c in request.GET:
if c != 'id' and c != 'uuid':
prop = c
val = request.GET[c]
old_value = box.get_css(prop)
box.set_css(prop, val)
revision_id = saveRevision({
'box_id': box.id,
'box_type': 'text',
'prop': prop,
'old_val': old_value,
'new_val': val,
'page_id': box.page.id,
'uuid': request.GET['uuid']
})
box.save()
r = {
'status': 1,
'rev_id': revision_id
}
except:
r = {
'error': 'Invalid Id: No such box.',
'status': 0
}
j = json.dumps(r)
return HttpResponse(j, mimetype="application/json")
def textbox_set_html(request):
id = request.GET['id']
html = request.GET['html']
box = TextBox.objects.get(pk=id)
old_value = box.html
box.html = html
box.save()
revision_id = saveRevision({
'box_id': box.id,
'box_type': 'text',
'prop': 'html',
'old_val': old_value,
'new_val': html,
'page_id': box.page.id,
'uuid': request.GET['uuid']
})
r = {
'status': 1,
'rev_id': revision_id
}
return HttpResponse(json.dumps(r), mimetype="application/json")
def textbox_delete(request):
id = request.GET['id']
box = TextBox.objects.get(pk=id)
old_value = json.dumps(box.to_dict())
box.is_displayed = False
box.save()
rev_id = saveRevision({
'box_id': box.id,
'box_type': 'text',
'prop': 'delete_box',
'old_val': old_value,
'new_val': '',
'page_id': box.page.id,
'uuid': request.GET['uuid']
})
return HttpResponse(str(rev_id))
def imagebox_new(request):
jsonString = request.GET['json']
d = json.loads(jsonString)
page = Page.objects.get(pk=int(d['page_id']))
resource = File.objects.get(pk=int(d['resource_id']))
box = ImageBox()
box.file = resource
box.page = page
for c in d['css']:
prop = c
val = d['css'][c]
box.set_css(prop, val)
box.save()
revision_id = saveRevision({
'box_id': box.id,
'box_type': 'image',
'prop': 'new_box',
'old_val': '',
'new_val': json.dumps(box.to_dict(1)),
'page_id': box.page.id,
'uuid': request.GET['uuid']
})
r = {
'id': box.id,
'rev_id': revision_id,
'status': 1
}
j = json.dumps(r)
return HttpResponse(j, mimetype="application/json")
def imagebox_update_css(request):
box_id = request.GET['id']
box = ImageBox.objects.get(pk = box_id)
for c in request.GET:
if c != 'id' and c!= 'uuid':
prop = c
val = request.GET[c]
old_value = box.get_css(prop)
box.set_css(prop, val)
revision_id = saveRevision({
'box_id': box.id,
'box_type': 'image',
'prop': prop,
'old_val': old_value,
'new_val': val,
'page_id': box.page.id,
'uuid': request.GET['uuid']
})
box.save()
r = {
'status': 1,
'id': box.id,
'rev_id': revision_id
}
j = json.dumps(r)
return HttpResponse(j, mimetype="application/json")
def imagebox_resize(request):
box_id = request.GET['id']
width = request.GET['width']
height = request.GET['height']
box = ImageBox.objects.get(pk = box_id)
old_value = json.dumps({
'path': box.get_path(),
'width': box.width,
'height': box.height
})
box.resize(width, height)
box.set_css('width', width)
box.set_css('height', height)
box.save()
resizedPath = box.get_path()
revision_id = saveRevision({
'box_id': box.id,
'box_type': 'image',
'prop': 'image_resize',
'old_val': old_value,
'new_val': json.dumps({
'path': box.get_path(),
'width': width,
'height': height
}),
'page_id': box.page.id,
'uuid': request.GET['uuid']
})
r = {
'status': 1,
'path': resizedPath,
'rev_id': revision_id
}
j = json.dumps(r)
return HttpResponse(j, mimetype="application/json")
def imagebox_delete(request):
id = request.GET['id']
box = ImageBox.objects.get(pk=id)
old_value = json.dumps(box.to_dict(1))
box.is_displayed = False
box.save()
rev_id = saveRevision({
'box_id': box.id,
'box_type': 'image',
'prop': 'delete_box',
'old_val': old_value,
'new_val': '',
'page_id': box.page.id,
'uuid': request.GET['uuid']
})
return HttpResponse(str(rev_id))
def category_json(request):
if request.GET:
catid = request.GET['id']
resources = File.objects.filter(categories__id=catid)
rList = []
for r in resources:
# these should not be here
width = 0
height = 0
if r.type.mime == 'jpg':
filePath = r.original_print()
try:
fil = Image.open(join(MEDIA_ROOT, filePath))
TARGET_WIDTH = 320
width = TARGET_WIDTH
orig_size = fil.size;
aspect_ratio = orig_size[1] / (orig_size[0] + .0)
height = TARGET_WIDTH * aspect_ratio
output_size = (TARGET_WIDTH, int(height),)
context = {'path': filePath, 'size': (100,100,)}
context2 = {'path': filePath, 'size': output_size}
iconPath = get_template("thumbnailTmp.txt").render(Context(context))
resizedPath = get_template("thumbnailTmp.txt").render(Context(context2))
except:
iconPath = "/static/images/binimages/jpg.jpg"
resizedPath = filePath
else:
filePath = r.file.url
iconPath = "/static/images/binimages/%s.jpg" % (r.type.mime)
resizedPath = filePath
if r.type.mime == 'ogv':
try:
v = Video.objects.filter(fil=r)[0]
media_id = v.id
except:
media_id = 0
elif r.type.mime == 'mp3':
try:
a = Audio.objects.filter(fil=r)[0]
media_id = a.id
except:
media_id = 0
else:
media_id = 0
d = {
'id': r.id,
'type': r.type.name,
'title': r.title,
'file': filePath,
'description': r.description,
'tags': r.tags,
'icon': iconPath,
'width': width,
'height': int(height),
'resized': resizedPath,
'added': str(r.added),
'mime': r.type.mime,
'media_id': media_id
}
rList.append(d)
j = json.dumps(rList)
return HttpResponse(j, mimetype="application/json")
else:
return False
def canvas_save(request):
j1 = request.GET['json']
id = request.GET['id']
d = json.loads(j1)
canvas = Page.objects.get(pk=id)
canvas.save_from_dict(d)
json2 = json.dumps(d)
return HttpResponse(json2)
'''
Not using this views after all ... but maybe, just maybe, they were a good idea ...
def save_revision(request):
page_id = request.GET['page_id']
page = Page.objects.get(pk = page_id)
page.save_revision()
return HttpResponse("1")
def load_revision(request):
page_id = request.GET['page_id']
page = Page.objects.get(pk = page_id)
rev_no = request.GET['rev_no']
json = page.load_revision(rev_no)
#FIXME: Return Json with its proper mime-type, etc.
return HttpResponse(json)
'''
def get_page_json(request, issue_no, page_no):
#FIXME: There's got to be a better way to get the page based on issue no. and page no. (OR, pass the page id somehow, but the URL's look prettier if its /issue_no/page_no . Alternatively, at least make getPage() a function somewhere.
page = Page.objects.filter(issue__issue_no = issue_no).filter(page_no = page_no)[0]
d = page.get_dict()
json = json.dumps(d)
return HttpResponse(json)
def view_page(request, id):
"""
View for the actual front-end view of the page
"""
id = int(id)
page = Page.objects.get(pk=id)
d = page.get_dict()
return render_to_response("view_page.html", d)
def view_article(request, id):
if request.GET.has_key('m'):
m = float(request.GET['m'])
else:
m = 1
id = int(id)
article = Article.objects.get(pk=id)
if request.GET.has_key('p'):
p = int(request.GET['p'])
d = article.get_dict(m, p)
else:
d = article.get_dict(m)
page_width = article.view_size()[0]
page_height = article.view_size()[1]
return render_to_response("view_article.html", {'pages': d, 'm': m, 'width': addPx(page_width), 'height': addPx(page_height)})
def poll_changes(request):
a_id = request.GET['article_id']
article = Article.objects.get(pk=a_id)
rev_no = request.GET['rev_no']
uuid = request.GET['uuid']
changes = article.changes(rev_no, uuid)
return HttpResponse(json.dumps(changes), mimetype="application/javascript")
def page_pdf(request):
article_id = request.GET['a']
page_id = request.GET['p']
if request.GET.has_key('dpi'):
dpi = request.GET['dpi']
else:
dpi = 150
if request.GET.has_key('m'):
m = request.GET['m']
else:
article = Article.objects.get(pk=article_id)
m = article.get_print_multiplier(dpi)
print_width_mm = article.product.typ.print_width
print_height_mm = int(print_width_mm // article.product.typ.aspect_ratio)
output_path = MEDIA_ROOT + "/pdf/tmpPDF" + article_id + page_id + ".pdf"
cmd = "wkhtmltopdf --page-width %d --page-height %d 'http://localhost/edit/view_article/%s/?m=%f&p=%s' '%s'" % (print_width_mm, print_height_mm, article_id, m, page_id,output_path,)
os.system(cmd)
return HttpResponseRedirect(output_path.replace(MEDIA_ROOT, "/static"))
def article_json(request):
article_id = request.GET['id']
article = Article.objects.get(pk=article_id)
d = article.get_dict()
j = json.dumps(d)
return HttpResponse(j, mimetype="application/json")
def new_page(request):
article = Article.objects.get(pk=request.GET['article_id'])
p = Page()
p.article = article
try:
last_page = Page.objects.filter(article=article).order_by('-page_no')[0:1]
last_page_no = last_page.page_no
except:
last_page_no = 0
p.page_no = last_page_no + 1
p.save()
rev_id = saveRevision({
'box_id': 0,
'box_type': 'page',
'prop': 'new_page',
'old_val': 0,
'new_val': json.dumps(p.get_dict(1)),
'page_id': p.id,
'uuid': request.GET['uuid']
})
r = {
'id': p.id,
'rev_id': rev_id
}
return HttpResponse(json.dumps(r), mimetype="application/json")
def issue_list(request):
issues = Issue.objects.all().order_by('issue_no')
return render_to_response("issue_list.html", {'issues': issues})
def new_issue(request):
name = request.GET['issueName']
last_issue_no = Issue.objects.all().order_by('-issue_no')[0].issue_no
issue_no = last_issue_no + 1
i = Issue(title = name, issue_no = issue_no)
i.save()
return HttpResponse("saved")
def edit_issue(request, id):
i = Issue.objects.get(pk=id)
return render_to_response
"""
These are some views that I could think of that need to be created. Please add more.
def new_text_box(request):
return box_id
def new_image_box(request):
return box_id
def edit_page(request, issue, page):
def publish_issue(request):
"""
def show_slide(request, id):
img = SliderImage.objects.get(pk=id)
if request.GET.has_key('c'):
hasCommented = True
else:
hasCommented = False
try:
prevImage = SliderImage.objects.filter(id__lt=id).order_by('-id')[0]
hasPrev = prevImage.id
except:
hasPrev = False
try:
nextImage = SliderImage.objects.filter(id__gt=id)[0]
hasNext = nextImage.id
except:
hasNext = False
d = {
'img': img,
'hasPrev': hasPrev,
'hasNext': hasNext,
'hasCommented': hasCommented
}
return render_to_response("slider.html", d)
def show_slide2(request):
img = SliderImage.objects.get(pk=1)
hasPrev = False
nextImage = SliderImage.objects.filter(id__gt=1)[0]
hasNext = nextImage.id
d = {
'img': img,
'hasPrev': hasPrev,
'hasNext': hasNext
}
return render_to_response("slider.html", d)

BIN
edgware/files/.DS_Store vendored Normal file

Binary file not shown.

0
edgware/files/__init__.py Executable file
View File

26
edgware/files/admin.py Executable file
View File

@ -0,0 +1,26 @@
from files.models import File, Category, Type
from django.contrib import admin
from django.contrib.auth.models import User
class FilesAdmin(admin.ModelAdmin):
list_display = ('title', 'type', 'file_date')
list_filter = ('categories', 'added', 'file_date')
ordering = ('-file_date',)
search_fields = ('title', 'description')
exclude = ('userID',)
def save_model(self, request, obj, form, change):
if not change:
obj.userID = request.user
obj.save()
class CategoryAdmin(admin.ModelAdmin):
search_fields = ('name',)
class TypeAdmin(admin.ModelAdmin):
ordering = ('name',)
admin.site.register(File, FilesAdmin)
admin.site.register(Category, CategoryAdmin)
admin.site.register(Type, TypeAdmin)
#admin.site.register(SliderImage)

65
edgware/files/convert.py Normal file
View File

@ -0,0 +1,65 @@
# from files.models import *
#UGLY HACK trying to avoid circular import issue. Try n clean up.
import editor as e
from settings import MEDIA_ROOT
import os
def toJpg(f):
fname = str(f.file)
ext = e.models.extFileName(fname)
output_path = "%s/media/images/original/%s" % (MEDIA_ROOT, e.models.baseFileName(os.path.basename(f.file.path)) + ".jpg",)
if ext.lower() == 'jpg' or ext.lower() == 'jpeg':
# print ext.lower()
cmd = "cp '%s' '%s'" % (f.file.path, output_path,)
os.system(cmd)
# print cmd
return
def toOgg(f):
output_path = "%s/media/audio/%s" % (MEDIA_ROOT, e.models.baseFileName(os.path.basename(f.file.path)) + ".ogg",)
cmd = "ffmpeg2theora -o '%s' --no-skeleton --novideo '%s'" % (output_path, f.file.path,)
os.system(cmd)
a = e.models.Audio(fil=f)
a.save()
return
def toTxt(f):
return
# print f.file
def toOgv(f):
output_path = "%s/media/video/%s" % (MEDIA_ROOT, e.models.baseFileName(os.path.basename(f.file.path)) + ".ogv",)
if e.models.extFileName(str(f.file)).lower() == 'ogv' or e.models.extFileName(str(f.file)).lower() == 'ogg':
cmd = "cp %s %s" % (f.file.path, output_path)
else:
cmd = "ffmpeg2theora -p padma -o '%s' '%s'" % (output_path, f.file.path,)
os.system(cmd)
v = e.models.Video(fil=f)
v.save()
return
def ignoreFile(f):
pass
#This function is called from the post_save signal, receives kwargs['instance'] as a File instance
def convertFile(**kwargs):
fn = {
'jpg': toJpg,
'mp3': toOgg,
'txt': ignoreFile,
'ogv': toOgv,
'oth': ignoreFile,
'hid': ignoreFile
}
f = kwargs['instance']
fn[f.type.mime](f)
return
def convertAll():
#Again - ugliness hacking at circular import silliness - clean up.
import files
for f in files.models.File.objects.all():
convertFile(instance=f)
return

71
edgware/files/models.py Executable file
View File

@ -0,0 +1,71 @@
from django.db import models
from tagging.fields import TagField
from tagging.models import Tag
from django.contrib.auth.models import User
import os
from convert import convertFile
from django.db.models.signals import post_save
def baseFileName(filename):
r = filename.rindex('.')
return filename[0:r]
def extFileName(filename):
r = filename.rindex('.') + 1
return filename[r:]
MIME_TYPES = (
('jpg', 'Image'),
('ogv', 'Video'),
('mp3', 'Audio'),
('txt', 'Text'),
('oth', 'Other'),
('hid', 'Hidden'),
)
class File(models.Model):
file = models.FileField('File', upload_to='files')
title = models.CharField(max_length=255)
description = models.TextField(blank=True)
tags = TagField("Tags", help_text="Enter as many tags as you like, separated by commas")
userID = models.ForeignKey(User)
file_date = models.DateField("Date", blank=True, null=True)
added = models.DateField("Date Added", auto_now_add=True)
categories = models.ManyToManyField('Category', verbose_name='Stories')
type = models.ForeignKey('Type', verbose_name='File Type')
def __unicode__(self):
return self.title
def original_print(self):
basePath = "media/images/original/"
filename = os.path.basename(str(self.file.url))
if extFileName(filename).lower() != 'jpg':
f = baseFileName(filename) + ".jpg"
else:
f = filename
return basePath + f
class Category(models.Model):
name = models.CharField(max_length=255)
def __unicode__(self):
return self.name
class Meta:
verbose_name = 'Story'
verbose_name_plural = 'Stories'
class Type(models.Model):
name = models.CharField(max_length=255)
mime = models.CharField(choices=MIME_TYPES, verbose_name="Type of File", blank=True, null=True, max_length=20)
# mim = models.ChoiceField(choices=MIME_TYPES)
def __unicode__(self):
return "%s - %s" % (self.name, self.mime)
class Meta:
verbose_name = 'File Type'
verbose_name_plural = 'File Types'
# post_save.connect(convertFile, sender=File)

10
edgware/files/views.py Normal file
View File

@ -0,0 +1,10 @@
# Create your views here.
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
def editor(request):
return render_to_response("editor.html")
def gallery(request):
return HttpResponseRedirect('http://www.urbaanedge.com/wordpress')

11
edgware/manage.py Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
sys.exit(1)
if __name__ == "__main__":
execute_manager(settings)

113
edgware/monitor.py Executable file
View File

@ -0,0 +1,113 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
import os
import sys
import time
import signal
import threading
import atexit
import Queue
_interval = 1.0
_times = {}
_files = []
_running = False
_queue = Queue.Queue()
_lock = threading.Lock()
def _restart(path):
_queue.put(True)
prefix = 'monitor (pid=%d):' % os.getpid()
print >> sys.stderr, '%s Change detected to \'%s\'.' % (prefix, path)
print >> sys.stderr, '%s Triggering process restart.' % prefix
os.kill(os.getpid(), signal.SIGINT)
def _modified(path):
try:
# If path doesn't denote a file and were previously
# tracking it, then it has been removed or the file type
# has changed so force a restart. If not previously
# tracking the file then we can ignore it as probably
# pseudo reference such as when file extracted from a
# collection of modules contained in a zip file.
if not os.path.isfile(path):
return path in _times
# Check for when file last modified.
mtime = os.stat(path).st_mtime
if path not in _times:
_times[path] = mtime
# Force restart when modification time has changed, even
# if time now older, as that could indicate older file
# has been restored.
if mtime != _times[path]:
return True
except:
# If any exception occured, likely that file has been
# been removed just before stat(), so force a restart.
return True
return False
def _monitor():
while 1:
# Check modification times on all files in sys.modules.
for module in sys.modules.values():
if not hasattr(module, '__file__'):
continue
path = getattr(module, '__file__')
if not path:
continue
if os.path.splitext(path)[1] in ['.pyc', '.pyo', '.pyd']:
path = path[:-1]
if _modified(path):
return _restart(path)
# Check modification times on files which have
# specifically been registered for monitoring.
for path in _files:
if _modified(path):
return _restart(path)
# Go to sleep for specified interval.
try:
return _queue.get(timeout=_interval)
except:
pass
_thread = threading.Thread(target=_monitor)
_thread.setDaemon(True)
def _exiting():
try:
_queue.put(True)
except:
pass
_thread.join()
atexit.register(_exiting)
def track(path):
if not path in _files:
_files.append(path)
def start(interval=1.0):
global _interval
if interval < _interval:
_interval = interval
global _running
_lock.acquire()
if not _running:
_running = True
_thread.start()
_lock.release()

128
edgware/settings.py Normal file
View File

@ -0,0 +1,128 @@
# Django settings for edge project.
import os
from os.path import join
DEBUG = False
TEMPLATE_DEBUG = DEBUG
LOCAL_DEVELOPMENT = True
APPEND_SLASH = True
LOGGING_INTERCEPT_REDIRECTS = False
LOGGING_LOG_SQL = True
LOGGING_SHOW_METRICS = True
LOGGING_OUTPUT_ENABLED = True
INTERNAL_IPS = ('127.0.0.1',)
PROJECT_PATH = os.path.dirname(__file__)
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
LOGIN_URL = "/accounts/login/"
MANAGERS = ADMINS
DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'edge' # Or path to database file if using sqlite3.
DATABASE_USER = 'root' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Chicago'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = join(PROJECT_PATH, 'static')
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = '/static/'
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/admin/media/'
# Make this unique, and don't share it with anybody.
SECRET_KEY = '(yx#dcc((x(&^la3)1m(6a%0n*z3awt7_(6zjy&dq+0h+_b!7#'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
# 'django.template.loaders.eggs.load_template_source',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
)
ROOT_URLCONF = 'urls'
TEMPLATE_DIRS = (
join(PROJECT_PATH, 'templates'),
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'files',
'editor',
'tagging',
'django_extensions',
'django.contrib.flatpages',
'debug_toolbar',
# 'south',
'django.contrib.comments',
'sorl.thumbnail',
'firefogg',
)
#overwrite default settings with local settings
try:
from local_settings import *
except ImportError:
pass
# Make this unique, creates random key first at first time.
try:
SECRET_KEY
except NameError:
SECRET_FILE = os.path.join(PROJECT_ROOT, 'secret.txt')
try:
SECRET_KEY = open(SECRET_FILE).read().strip()
except IOError:
try:
from random import choice
SECRET_KEY = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)])
secret = file(SECRET_FILE, 'w')
secret.write(SECRET_KEY)
secret.close()
except IOError:
Exception('Please create a %s file with random characters to generate your secret key!' % SECRET_FILE)

103
edgware/settings.txt Executable file
View File

@ -0,0 +1,103 @@
# Django settings for edge project.
import os
from os.path import join
DEBUG = True
TEMPLATE_DEBUG = DEBUG
LOCAL_DEVELOPMENT = True
APPEND_SLASH = True
LOGGING_INTERCEPT_REDIRECTS = True
LOGGING_LOG_SQL = True
LOGGING_SHOW_METRICS = True
LOGGING_OUTPUT_ENABLED = True
INTERNAL_IPS = ('127.0.0.1',)
PROJECT_PATH = os.path.dirname(__file__)
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'edge' # Or path to database file if using sqlite3.
DATABASE_USER = 'root' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Chicago'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = join(PROJECT_PATH, 'static')
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = '/static/'
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/admin/media/'
# Make this unique, and don't share it with anybody.
SECRET_KEY = '(yx#dcc((x(&^la3)1m(6a%0n*z3awt7_(6zjy&dq+0h+_b!7#'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
# 'django.template.loaders.eggs.load_template_source',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
)
ROOT_URLCONF = 'urls'
TEMPLATE_DIRS = (
join(PROJECT_PATH, 'templates'),
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'files',
'editor',
# 'tagging',
'django_extensions',
'django.contrib.flatpages',
'debug_toolbar',
# 'south',
'django.contrib.comments',
'sorl.thumbnail',
)

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

View File

@ -0,0 +1,35 @@
/* Fixes issue here http://code.google.com/p/jcrop/issues/detail?id=1 */
.jcrop-holder { text-align: left; }
.jcrop-vline, .jcrop-hline
{
font-size: 0;
position: absolute;
background: white url('Jcrop.gif') top left repeat;
}
.jcrop-vline { height: 100%; width: 1px !important; }
.jcrop-hline { width: 100%; height: 1px !important; }
.jcrop-handle {
font-size: 1px;
width: 7px !important;
height: 7px !important;
border: 1px #eee solid;
background-color: #333;
*width: 9px;
*height: 9px;
}
.jcrop-tracker { width: 100%; height: 100%; }
.custom .jcrop-vline,
.custom .jcrop-hline
{
background: yellow;
}
.custom .jcrop-handle
{
border-color: black;
background-color: #C7BB00;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
}

View File

@ -0,0 +1,106 @@
<?php
/**
* Jcrop image cropping plugin for jQuery
* Example cropping script
* @copyright 2008 Kelly Hallman
* More info: http://deepliquid.com/content/Jcrop_Implementation_Theory.html
*/
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
$targ_w = $targ_h = 150;
$jpeg_quality = 90;
$src = 'demo_files/flowers.jpg';
$img_r = imagecreatefromjpeg($src);
$dst_r = ImageCreateTrueColor( $targ_w, $targ_h );
imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'],
$targ_w,$targ_h,$_POST['w'],$_POST['h']);
header('Content-type: image/jpeg');
imagejpeg($dst_r,null,$jpeg_quality);
exit;
}
// If not a POST request, display page below:
?><html>
<head>
<script src="../js/jquery.pack.js"></script>
<script src="../js/jquery.Jcrop.pack.js"></script>
<link rel="stylesheet" href="../css/jquery.Jcrop.css" type="text/css" />
<link rel="stylesheet" href="demo_files/demos.css" type="text/css" />
<script language="Javascript">
$(function(){
$('#cropbox').Jcrop({
aspectRatio: 1,
onSelect: updateCoords
});
});
function updateCoords(c)
{
$('#x').val(c.x);
$('#y').val(c.y);
$('#w').val(c.w);
$('#h').val(c.h);
};
function checkCoords()
{
if (parseInt($('#w').val())) return true;
alert('Please select a crop region then press submit.');
return false;
};
</script>
</head>
<body>
<div id="outer">
<div class="jcExample">
<div class="article">
<h1>Jcrop - Crop Behavior</h1>
<!-- This is the image we're attaching Jcrop to -->
<img src="demo_files/flowers.jpg" id="cropbox" />
<!-- This is the form that our event handler fills -->
<form action="crop.php" method="post" onsubmit="return checkCoords();">
<input type="hidden" id="x" name="x" />
<input type="hidden" id="y" name="y" />
<input type="hidden" id="w" name="w" />
<input type="hidden" id="h" name="h" />
<input type="submit" value="Crop Image" />
</form>
<p>
<b>An example server-side crop script.</b> Hidden form values
are set when a selection is made. If you press the <i>Crop Image</i>
button, the form will be submitted and a 150x150 thumbnail will be
dumped to the browser. Try it!
</p>
<div id="dl_links">
<a href="http://deepliquid.com/content/Jcrop.html">Jcrop Home</a> |
<a href="http://deepliquid.com/content/Jcrop_Manual.html">Manual (Docs)</a>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,47 @@
body
{
margin: 0;
padding: 0;
background: #eee;
}
.jcropper-holder { border: 1px black solid; }
#outer {
text-align: center;
}
.jcExample
{
text-align: left;
background: white;
width: 700px;
font-size: 80%;
margin: 3.5em auto 2em auto;
*margin: 3.5em 10% 2em 10%;
border: 1px black solid;
padding: 1em 2em 2em;
}
.jcExample .article
{
width: 565px;
}
form
{
margin: 1.5em 0;
}
form label
{
margin-right: 1em;
font-weight: bold;
color: #990000;
}
.jcExample p
{
font-family: Verdana, Helvetica, Arial, sans-serif;
font-size: 90%;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

View File

@ -0,0 +1,43 @@
<html>
<head>
<script src="../js/jquery.min.js"></script>
<script src="../js/jquery.Jcrop.js"></script>
<link rel="stylesheet" href="../css/jquery.Jcrop.css" type="text/css" />
<link rel="stylesheet" href="demo_files/demos.css" type="text/css" />
<script language="Javascript">
jQuery(function(){
jQuery('#cropbox').Jcrop();
});
</script>
</head>
<body>
<div id="outer">
<div class="jcExample">
<div class="article">
<h1>Jcrop - Hello World</h1>
<img src="demo_files/flowers.jpg" id="cropbox" />
<p>
<b>This example is provided as a demo of the default behavior of Jcrop.</b>
Since no event handlers have been attached it only performs
the cropping behavior.
</p>
<div id="dl_links">
<a href="http://deepliquid.com/content/Jcrop.html">Jcrop Home</a> |
<a href="http://deepliquid.com/content/Jcrop_Manual.html">Manual (Docs)</a>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,81 @@
<html>
<head>
<script src="../js/jquery.min.js"></script>
<script src="../js/jquery.Jcrop.js"></script>
<link rel="stylesheet" href="../css/jquery.Jcrop.css" type="text/css" />
<link rel="stylesheet" href="demo_files/demos.css" type="text/css" />
<script language="Javascript">
// Remember to invoke within jQuery(window).load(...)
// If you don't, Jcrop may not initialize properly
jQuery(document).ready(function(){
jQuery('#cropbox').Jcrop({
onChange: showCoords,
onSelect: showCoords
});
});
// Our simple event handler, called from onChange and onSelect
// event handlers, as per the Jcrop invocation above
function showCoords(c)
{
jQuery('#x').val(c.x);
jQuery('#y').val(c.y);
jQuery('#x2').val(c.x2);
jQuery('#y2').val(c.y2);
jQuery('#w').val(c.w);
jQuery('#h').val(c.h);
};
</script>
</head>
<body>
<div id="outer">
<div class="jcExample">
<div class="article">
<h1>Jcrop - Event Handlers</h1>
<!-- This is the image we're attaching Jcrop to -->
<img src="demo_files/flowers.jpg" id="cropbox" />
<!-- This is the form that our event handler fills -->
<form onsubmit="return false;">
<label>X1 <input type="text" size="4" id="x" name="x" /></label>
<label>Y1 <input type="text" size="4" id="y" name="y" /></label>
<label>X2 <input type="text" size="4" id="x2" name="x2" /></label>
<label>Y2 <input type="text" size="4" id="y2" name="y2" /></label>
<label>W <input type="text" size="4" id="w" name="w" /></label>
<label>H <input type="text" size="4" id="h" name="h" /></label>
</form>
<p>
<b>An example with a basic event handler.</b> Here we've tied
several form values together with a simple event handler invocation.
The result is that the form values are updated in real-time as
the selection is changed, thanks to Jcrop's <em>onChange</em> event handler.
</p>
<p>
That's how easily Jcrop can be integrated into a traditional web form!
</p>
<div id="dl_links">
<a href="http://deepliquid.com/content/Jcrop.html">Jcrop Home</a> |
<a href="http://deepliquid.com/content/Jcrop_Manual.html">Manual (Docs)</a>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,88 @@
<html>
<head>
<script src="../js/jquery.min.js"></script>
<script src="../js/jquery.Jcrop.js"></script>
<link rel="stylesheet" href="../css/jquery.Jcrop.css" type="text/css" />
<link rel="stylesheet" href="demo_files/demos.css" type="text/css" />
<script language="Javascript">
// Remember to invoke within jQuery(window).load(...)
// If you don't, Jcrop may not initialize properly
jQuery(window).load(function(){
jQuery('#cropbox').Jcrop({
onChange: showPreview,
onSelect: showPreview,
aspectRatio: 1
});
});
// Our simple event handler, called from onChange and onSelect
// event handlers, as per the Jcrop invocation above
function showPreview(coords)
{
if (parseInt(coords.w) > 0)
{
var rx = 100 / coords.w;
var ry = 100 / coords.h;
jQuery('#preview').css({
width: Math.round(rx * 500) + 'px',
height: Math.round(ry * 370) + 'px',
marginLeft: '-' + Math.round(rx * coords.x) + 'px',
marginTop: '-' + Math.round(ry * coords.y) + 'px'
});
}
}
</script>
</head>
<body>
<div id="outer">
<div class="jcExample">
<div class="article">
<h1>Jcrop - Aspect ratio lock w/ preview pane</h1>
<!-- This is the image we're attaching Jcrop to -->
<table>
<tr>
<td>
<img src="demo_files/flowers.jpg" id="cropbox" />
</td>
<td>
<div style="width:100px;height:100px;overflow:hidden;">
<img src="demo_files/flowers.jpg" id="preview" />
</div>
</td>
</tr>
</table>
<p>
<b>An example with aspect ratio locking and preview pane.</b>
Obviously the most visual demo, the preview pane is accomplished
entirely outside of Jcrop with a simple jQuery-flavored callback.
This type of interface could be useful for creating a thumbnail
or avatar. The onChange event handler is used to update the
view in the preview pane.
</p>
<div id="dl_links">
<a href="http://deepliquid.com/content/Jcrop.html">Jcrop Home</a> |
<a href="http://deepliquid.com/content/Jcrop_Manual.html">Manual (Docs)</a>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,94 @@
<html>
<head>
<script src="../js/jquery.min.js"></script>
<script src="../js/jquery.Jcrop.js"></script>
<link rel="stylesheet" href="../css/jquery.Jcrop.css" type="text/css" />
<link rel="stylesheet" href="demo_files/demos.css" type="text/css" />
<script language="Javascript">
$(window).load(function(){
var api = $.Jcrop('#cropbox',{
setSelect: [ 100, 100, 200, 200 ]
});
var i, ac;
// A handler to kill the action
function nothing(e)
{
e.stopPropagation();
e.preventDefault();
return false;
};
// Returns event handler for animation callback
function anim_handler(ac)
{
return function(e) {
api.animateTo(ac);
return nothing(e);
};
};
// Setup some coordinates for animation
var ac =
{
anim1: [50,50,450,320],
anim2: [74,81,218,228],
anim3: [8,8,32,360],
anim4: [316,150,470,230],
anim5: [80,160,500,190]
};
// Attach respective event handlers
for(i in ac) jQuery('#'+i).click(anim_handler(ac[i]));
// Attach another one manually, to demonstrate "set" w/o animation
jQuery('#setsel').click(function(e) {
api.setSelect( [ 200, 200, 300, 300 ] );
return nothing(e);
});
});
</script>
</head>
<body>
<div id="outer">
<div class="jcExample">
<div class="article">
<h1>Jcrop - API Demo</h1>
<img src="demo_files/flowers.jpg" id="cropbox" />
<div style="margin: 20px 0;">
<button id="anim1">A1</button>
<button id="anim2">A2</button>
<button id="anim3">A3</button>
<button id="anim4">A4</button>
<button id="anim5">A5</button>
<button id="setsel">Set</button>
</div>
<p>
<b>API feature demonstration.</b>
Press the buttons above to animate different selections.
This was the original API demo, before additional API functionality
was added (see Advanced API demo).
</p>
<div id="dl_links">
<a href="http://deepliquid.com/content/Jcrop.html">Jcrop Home</a> |
<a href="http://deepliquid.com/content/Jcrop_Manual.html">Manual (Docs)</a>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,206 @@
<html>
<head>
<script src="../js/jquery.min.js"></script>
<script src="../js/jquery.Jcrop.js"></script>
<link rel="stylesheet" href="../css/jquery.Jcrop.css" type="text/css" />
<link rel="stylesheet" href="demo_files/demos.css" type="text/css" />
<style type="text/css">
fieldset.optdual { width: 500px; }
.optdual { position: relative; }
.optdual .offset { position: absolute; left: 18em; }
.optlist label { width: 16em; display: block; }
#dl_links { margin-top: .5em; }
</style>
<script language="Javascript">
$(window).load(function(){
var jcrop_api;
var i, ac;
initJcrop();
function initJcrop()//{{{
{
jcrop_api = $.Jcrop('#cropbox');
$('#can_click,#can_move,#can_size')
.attr('checked','checked');
$('#ar_lock,#size_lock,#bg_swap').attr('checked',false);
};
//}}}
// A handler to kill the action
// Probably not necessary, but I like it
function nothing(e)
{
e.stopPropagation();
e.preventDefault();
return false;
};
// Use the API to find cropping dimensions
// Then generate a random selection
// This function is used by setSelect and animateTo buttons
// Mainly for demonstration purposes
function getRandom() {
var dim = jcrop_api.getBounds();
return [
Math.round(Math.random() * dim[0]),
Math.round(Math.random() * dim[1]),
Math.round(Math.random() * dim[0]),
Math.round(Math.random() * dim[1])
];
};
// Attach interface buttons
// This may appear to be a lot of code but it's simple stuff
$('#setSelect').click(function(e) {
// Sets a random selection
jcrop_api.setSelect(getRandom());
});
$('#animateTo').click(function(e) {
// Animates to a random selection
jcrop_api.animateTo(getRandom());
});
$('#release').click(function(e) {
// Release method clears the selection
jcrop_api.release();
});
$('#disable').click(function(e) {
jcrop_api.disable();
$('#enable').show();
$('.requiresjcrop').hide();
});
$('#enable').click(function(e) {
jcrop_api.enable();
$('#enable').hide();
$('.requiresjcrop').show();
});
$('#rehook').click(function(e) {
initJcrop();
$('#rehook,#enable').hide();
$('#unhook,.requiresjcrop').show();
return nothing(e);
});
$('#unhook').click(function(e) {
jcrop_api.destroy();
$('#unhook,#enable,.requiresjcrop').hide();
$('#rehook').show();
return nothing(e);
});
// The checkboxes simply set options based on it's checked value
// Options are changed by passing a new options object
// Also, to prevent strange behavior, they are initially checked
// This matches the default initial state of Jcrop
$('#can_click').change(function(e) {
jcrop_api.setOptions({ allowSelect: !!this.checked });
jcrop_api.focus();
});
$('#can_move').change(function(e) {
jcrop_api.setOptions({ allowMove: !!this.checked });
jcrop_api.focus();
});
$('#can_size').change(function(e) {
jcrop_api.setOptions({ allowResize: !!this.checked });
jcrop_api.focus();
});
$('#ar_lock').change(function(e) {
jcrop_api.setOptions(this.checked? { aspectRatio: 4/3 }: { aspectRatio: 0 });
jcrop_api.focus();
});
$('#size_lock').change(function(e) {
jcrop_api.setOptions(this.checked? {
minSize: [ 80, 80 ],
maxSize: [ 350, 350 ]
}: {
minSize: [ 0, 0 ],
maxSize: [ 0, 0 ]
});
jcrop_api.focus();
});
$('#bg_swap').change(function(e) {
jcrop_api.setOptions( this.checked? {
outerImage: 'demo_files/sagomod.png',
bgOpacity: 1
}: {
outerImage: 'demo_files/sago.jpg',
bgOpacity: .6
});
jcrop_api.release();
});
});
</script>
</head>
<body>
<div id="outer">
<div class="jcExample">
<div class="article">
<h1>Jcrop - API Demo</h1>
<img src="demo_files/sago.jpg" id="cropbox" />
<div style="margin: 20px 0;">
<span class="requiresjcrop">
<button id="setSelect">setSelect</button>
<button id="animateTo">animateTo</button>
<button id="release">Release</button>
<button id="disable">Disable</button>
</span>
<button id="enable" style="display:none;">Re-Enable</button>
<button id="unhook">Destroy!</button>
<button id="rehook" style="display:none;">Attach Jcrop</button>
</div>
<fieldset class="optdual requiresjcrop">
<legend>Option Toggles</legend>
<div class="optlist offset">
<label><input type="checkbox" id="ar_lock" />Aspect ratio</label>
<label><input type="checkbox" id="size_lock" />minSize/maxSize setting</label>
<label><input type="checkbox" id="bg_swap" />Change outerImage</label>
</div>
<div class="optlist">
<label><input type="checkbox" id="can_click" />Allow new selections</label>
<label><input type="checkbox" id="can_move" />Selection can be moved</label>
<label><input type="checkbox" id="can_size" />Resizable selection</label>
</div>
</fieldset>
<div id="dl_links">
<a href="http://deepliquid.com/content/Jcrop.html">Jcrop Home</a> |
<a href="http://deepliquid.com/content/Jcrop_Manual.html">Manual (Docs)</a>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,65 @@
<html>
<head>
<title>Jcrop: the jQuery Image Cropping Plugin</title>
</head>
<body>
<div style="margin:0;padding:1em 5em;width:40em;">
<h1>Jcrop Image Cropping Plugin</h1>
<big>
<a href="http://deepliquid.com/content/Jcrop.html"><b>Jcrop</b></a>
is the image cropping plugin for
<a href="http://jquery.com/">jQuery</a>.<br>
You've successfully unpacked Jcrop.
</big>
<h3>Static Demos</h3>
<ul>
<li><a href="demos/tutorial1.html">Hello World</a> &mdash; default behavior</a></li>
<li><a href="demos/tutorial2.html">Basic Handler</a> &mdash; basic form integration</a></li>
<li><a href="demos/tutorial3.html">Aspect Ratio w/ Preview Pane</a> &mdash; nice visual example</a></li>
<li><a href="demos/tutorial4.html">Setting/Animating Selection</a> &mdash; animation demo</a></li>
<li><a href="demos/tutorial5.html">API Interface</a> &mdash; real-time API example</a></li>
</ul>
<h3>Live Demo</h3>
<ul>
<li><a href="demos/crop.php">PHP Cropping Demo</a> &mdash; requires PHP/gd support</a></li>
</ul>
<h3>Jcrop Links</h3>
<ul>
<li><a href="http://deepliquid.com/content/Jcrop.html">Jcrop Home</a></li>
<li><a href="http://deepliquid.com/content/Jcrop_Manual.html">Jcrop Manual</a></li>
</ul>
<hr noshade="noshade" size="1" style="margin-top:2em;" />
<small>
<b>&copy; 2008 Kelly Hallman and DeepLiquid.com</b><br>
Free software released under
<a href="http://deepliquid.com/content/Jcrop_License.html">MIT License</a>
</small>
</div>
<!-- Below here for internal analysis {{{ -->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-5176876-1");
pageTracker._trackPageview();
</script>
<!-- }}} -->
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,163 @@
/**
* Jcrop v.0.9.8 (minimized)
* (c) 2008 Kelly Hallman and DeepLiquid.com
* More information: http://deepliquid.com/content/Jcrop.html
* Released under MIT License - this header must remain with code
*/
(function($){$.Jcrop=function(obj,opt)
{var obj=obj,opt=opt;if(typeof(obj)!=='object')obj=$(obj)[0];if(typeof(opt)!=='object')opt={};if(!('trackDocument'in opt))
{opt.trackDocument=$.browser.msie?false:true;if($.browser.msie&&$.browser.version.split('.')[0]=='8')
opt.trackDocument=true;}
if(!('keySupport'in opt))
opt.keySupport=$.browser.msie?false:true;var defaults={trackDocument:false,baseClass:'jcrop',addClass:null,bgColor:'black',bgOpacity:.6,borderOpacity:.4,handleOpacity:.5,handlePad:5,handleSize:9,handleOffset:5,edgeMargin:14,aspectRatio:0,keySupport:true,cornerHandles:true,sideHandles:true,drawBorders:true,dragEdges:true,boxWidth:0,boxHeight:0,boundary:8,animationDelay:20,swingSpeed:3,allowSelect:true,allowMove:true,allowResize:true,minSelect:[0,0],maxSize:[0,0],minSize:[0,0],onChange:function(){},onSelect:function(){}};var options=defaults;setOptions(opt);var $origimg=$(obj);var $img=$origimg.clone().removeAttr('id').css({position:'absolute'});$img.width($origimg.width());$img.height($origimg.height());$origimg.after($img).hide();presize($img,options.boxWidth,options.boxHeight);var boundx=$img.width(),boundy=$img.height(),$div=$('<div />').width(boundx).height(boundy).addClass(cssClass('holder')).css({position:'relative',backgroundColor:options.bgColor}).insertAfter($origimg).append($img);;if(options.addClass)$div.addClass(options.addClass);var $img2=$('<img />').attr('src',$img.attr('src')).css('position','absolute').width(boundx).height(boundy);var $img_holder=$('<div />').width(pct(100)).height(pct(100)).css({zIndex:310,position:'absolute',overflow:'hidden'}).append($img2);var $hdl_holder=$('<div />').width(pct(100)).height(pct(100)).css('zIndex',320);var $sel=$('<div />').css({position:'absolute',zIndex:300}).insertBefore($img).append($img_holder,$hdl_holder);var bound=options.boundary;var $trk=newTracker().width(boundx+(bound*2)).height(boundy+(bound*2)).css({position:'absolute',top:px(-bound),left:px(-bound),zIndex:290}).mousedown(newSelection);var xlimit,ylimit,xmin,ymin;var xscale,yscale,enabled=true;var docOffset=getPos($img),btndown,lastcurs,dimmed,animating,shift_down;var Coords=function()
{var x1=0,y1=0,x2=0,y2=0,ox,oy;function setPressed(pos)
{var pos=rebound(pos);x2=x1=pos[0];y2=y1=pos[1];};function setCurrent(pos)
{var pos=rebound(pos);ox=pos[0]-x2;oy=pos[1]-y2;x2=pos[0];y2=pos[1];};function getOffset()
{return[ox,oy];};function moveOffset(offset)
{var ox=offset[0],oy=offset[1];if(0>x1+ox)ox-=ox+x1;if(0>y1+oy)oy-=oy+y1;if(boundy<y2+oy)oy+=boundy-(y2+oy);if(boundx<x2+ox)ox+=boundx-(x2+ox);x1+=ox;x2+=ox;y1+=oy;y2+=oy;};function getCorner(ord)
{var c=getFixed();switch(ord)
{case'ne':return[c.x2,c.y];case'nw':return[c.x,c.y];case'se':return[c.x2,c.y2];case'sw':return[c.x,c.y2];}};function getFixed()
{if(!options.aspectRatio)return getRect();var aspect=options.aspectRatio,min_x=options.minSize[0]/xscale,min_y=options.minSize[1]/yscale,max_x=options.maxSize[0]/xscale,max_y=options.maxSize[1]/yscale,rw=x2-x1,rh=y2-y1,rwa=Math.abs(rw),rha=Math.abs(rh),real_ratio=rwa/rha,xx,yy;if(max_x==0){max_x=boundx*10}
if(max_y==0){max_y=boundy*10}
if(real_ratio<aspect)
{yy=y2;w=rha*aspect;xx=rw<0?x1-w:w+x1;if(xx<0)
{xx=0;h=Math.abs((xx-x1)/aspect);yy=rh<0?y1-h:h+y1;}
else if(xx>boundx)
{xx=boundx;h=Math.abs((xx-x1)/aspect);yy=rh<0?y1-h:h+y1;}}
else
{xx=x2;h=rwa/aspect;yy=rh<0?y1-h:y1+h;if(yy<0)
{yy=0;w=Math.abs((yy-y1)*aspect);xx=rw<0?x1-w:w+x1;}
else if(yy>boundy)
{yy=boundy;w=Math.abs(yy-y1)*aspect;xx=rw<0?x1-w:w+x1;}}
if(xx>x1){if(xx-x1<min_x){xx=x1+min_x;}else if(xx-x1>max_x){xx=x1+max_x;}
if(yy>y1){yy=y1+(xx-x1)/aspect;}else{yy=y1-(xx-x1)/aspect;}}else if(xx<x1){if(x1-xx<min_x){xx=x1-min_x}else if(x1-xx>max_x){xx=x1-max_x;}
if(yy>y1){yy=y1+(x1-xx)/aspect;}else{yy=y1-(x1-xx)/aspect;}}
if(xx<0){x1-=xx;xx=0;}else if(xx>boundx){x1-=xx-boundx;xx=boundx;}
if(yy<0){y1-=yy;yy=0;}else if(yy>boundy){y1-=yy-boundy;yy=boundy;}
return last=makeObj(flipCoords(x1,y1,xx,yy));};function rebound(p)
{if(p[0]<0)p[0]=0;if(p[1]<0)p[1]=0;if(p[0]>boundx)p[0]=boundx;if(p[1]>boundy)p[1]=boundy;return[p[0],p[1]];};function flipCoords(x1,y1,x2,y2)
{var xa=x1,xb=x2,ya=y1,yb=y2;if(x2<x1)
{xa=x2;xb=x1;}
if(y2<y1)
{ya=y2;yb=y1;}
return[Math.round(xa),Math.round(ya),Math.round(xb),Math.round(yb)];};function getRect()
{var xsize=x2-x1;var ysize=y2-y1;if(xlimit&&(Math.abs(xsize)>xlimit))
x2=(xsize>0)?(x1+xlimit):(x1-xlimit);if(ylimit&&(Math.abs(ysize)>ylimit))
y2=(ysize>0)?(y1+ylimit):(y1-ylimit);if(ymin&&(Math.abs(ysize)<ymin))
y2=(ysize>0)?(y1+ymin):(y1-ymin);if(xmin&&(Math.abs(xsize)<xmin))
x2=(xsize>0)?(x1+xmin):(x1-xmin);if(x1<0){x2-=x1;x1-=x1;}
if(y1<0){y2-=y1;y1-=y1;}
if(x2<0){x1-=x2;x2-=x2;}
if(y2<0){y1-=y2;y2-=y2;}
if(x2>boundx){var delta=x2-boundx;x1-=delta;x2-=delta;}
if(y2>boundy){var delta=y2-boundy;y1-=delta;y2-=delta;}
if(x1>boundx){var delta=x1-boundy;y2-=delta;y1-=delta;}
if(y1>boundy){var delta=y1-boundy;y2-=delta;y1-=delta;}
return makeObj(flipCoords(x1,y1,x2,y2));};function makeObj(a)
{return{x:a[0],y:a[1],x2:a[2],y2:a[3],w:a[2]-a[0],h:a[3]-a[1]};};return{flipCoords:flipCoords,setPressed:setPressed,setCurrent:setCurrent,getOffset:getOffset,moveOffset:moveOffset,getCorner:getCorner,getFixed:getFixed};}();var Selection=function()
{var start,end,dragmode,awake,hdep=370;var borders={};var handle={};var seehandles=false;var hhs=options.handleOffset;if(options.drawBorders){borders={top:insertBorder('hline').css('top',$.browser.msie?px(-1):px(0)),bottom:insertBorder('hline'),left:insertBorder('vline'),right:insertBorder('vline')};}
if(options.dragEdges){handle.t=insertDragbar('n');handle.b=insertDragbar('s');handle.r=insertDragbar('e');handle.l=insertDragbar('w');}
options.sideHandles&&createHandles(['n','s','e','w']);options.cornerHandles&&createHandles(['sw','nw','ne','se']);function insertBorder(type)
{var jq=$('<div />').css({position:'absolute',opacity:options.borderOpacity}).addClass(cssClass(type));$img_holder.append(jq);return jq;};function dragDiv(ord,zi)
{var jq=$('<div />').mousedown(createDragger(ord)).css({cursor:ord+'-resize',position:'absolute',zIndex:zi});$hdl_holder.append(jq);return jq;};function insertHandle(ord)
{return dragDiv(ord,hdep++).css({top:px(-hhs+1),left:px(-hhs+1),opacity:options.handleOpacity}).addClass(cssClass('handle'));};function insertDragbar(ord)
{var s=options.handleSize,o=hhs,h=s,w=s,t=o,l=o;switch(ord)
{case'n':case's':w=pct(100);break;case'e':case'w':h=pct(100);break;}
return dragDiv(ord,hdep++).width(w).height(h).css({top:px(-t+1),left:px(-l+1)});};function createHandles(li)
{for(i in li)handle[li[i]]=insertHandle(li[i]);};function moveHandles(c)
{var midvert=Math.round((c.h/2)-hhs),midhoriz=Math.round((c.w/2)-hhs),north=west=-hhs+1,east=c.w-hhs,south=c.h-hhs,x,y;'e'in handle&&handle.e.css({top:px(midvert),left:px(east)})&&handle.w.css({top:px(midvert)})&&handle.s.css({top:px(south),left:px(midhoriz)})&&handle.n.css({left:px(midhoriz)});'ne'in handle&&handle.ne.css({left:px(east)})&&handle.se.css({top:px(south),left:px(east)})&&handle.sw.css({top:px(south)});'b'in handle&&handle.b.css({top:px(south)})&&handle.r.css({left:px(east)});};function moveto(x,y)
{$img2.css({top:px(-y),left:px(-x)});$sel.css({top:px(y),left:px(x)});};function resize(w,h)
{$sel.width(w).height(h);};function refresh()
{var c=Coords.getFixed();Coords.setPressed([c.x,c.y]);Coords.setCurrent([c.x2,c.y2]);updateVisible();};function updateVisible()
{if(awake)return update();};function update()
{var c=Coords.getFixed();resize(c.w,c.h);moveto(c.x,c.y);options.drawBorders&&borders['right'].css({left:px(c.w-1)})&&borders['bottom'].css({top:px(c.h-1)});seehandles&&moveHandles(c);awake||show();options.onChange(unscale(c));};function show()
{$sel.show();$img.css('opacity',options.bgOpacity);awake=true;};function release()
{disableHandles();$sel.hide();$img.css('opacity',1);awake=false;};function showHandles()
{if(seehandles)
{moveHandles(Coords.getFixed());$hdl_holder.show();}};function enableHandles()
{seehandles=true;if(options.allowResize)
{moveHandles(Coords.getFixed());$hdl_holder.show();return true;}};function disableHandles()
{seehandles=false;$hdl_holder.hide();};function animMode(v)
{(animating=v)?disableHandles():enableHandles();};function done()
{animMode(false);refresh();};var $track=newTracker().mousedown(createDragger('move')).css({cursor:'move',position:'absolute',zIndex:360})
$img_holder.append($track);disableHandles();return{updateVisible:updateVisible,update:update,release:release,refresh:refresh,setCursor:function(cursor){$track.css('cursor',cursor);},enableHandles:enableHandles,enableOnly:function(){seehandles=true;},showHandles:showHandles,disableHandles:disableHandles,animMode:animMode,done:done};}();var Tracker=function()
{var onMove=function(){},onDone=function(){},trackDoc=options.trackDocument;if(!trackDoc)
{$trk.mousemove(trackMove).mouseup(trackUp).mouseout(trackUp);}
function toFront()
{$trk.css({zIndex:450});if(trackDoc)
{$(document).mousemove(trackMove).mouseup(trackUp);}}
function toBack()
{$trk.css({zIndex:290});if(trackDoc)
{$(document).unbind('mousemove',trackMove).unbind('mouseup',trackUp);}}
function trackMove(e)
{onMove(mouseAbs(e));};function trackUp(e)
{e.preventDefault();e.stopPropagation();if(btndown)
{btndown=false;onDone(mouseAbs(e));options.onSelect(unscale(Coords.getFixed()));toBack();onMove=function(){};onDone=function(){};}
return false;};function activateHandlers(move,done)
{btndown=true;onMove=move;onDone=done;toFront();return false;};function setCursor(t){$trk.css('cursor',t);};$img.before($trk);return{activateHandlers:activateHandlers,setCursor:setCursor};}();var KeyManager=function()
{var $keymgr=$('<input type="radio" />').css({position:'absolute',left:'-30px'}).keypress(parseKey).blur(onBlur),$keywrap=$('<div />').css({position:'absolute',overflow:'hidden'}).append($keymgr);function watchKeys()
{if(options.keySupport)
{$keymgr.show();$keymgr.focus();}};function onBlur(e)
{$keymgr.hide();};function doNudge(e,x,y)
{if(options.allowMove){Coords.moveOffset([x,y]);Selection.updateVisible();};e.preventDefault();e.stopPropagation();};function parseKey(e)
{if(e.ctrlKey)return true;shift_down=e.shiftKey?true:false;var nudge=shift_down?10:1;switch(e.keyCode)
{case 37:doNudge(e,-nudge,0);break;case 39:doNudge(e,nudge,0);break;case 38:doNudge(e,0,-nudge);break;case 40:doNudge(e,0,nudge);break;case 27:Selection.release();break;case 9:return true;}
return nothing(e);};if(options.keySupport)$keywrap.insertBefore($img);return{watchKeys:watchKeys};}();function px(n){return''+parseInt(n)+'px';};function pct(n){return''+parseInt(n)+'%';};function cssClass(cl){return options.baseClass+'-'+cl;};function getPos(obj)
{var pos=$(obj).offset();return[pos.left,pos.top];};function mouseAbs(e)
{return[(e.pageX-docOffset[0]),(e.pageY-docOffset[1])];};function myCursor(type)
{if(type!=lastcurs)
{Tracker.setCursor(type);lastcurs=type;}};function startDragMode(mode,pos)
{docOffset=getPos($img);Tracker.setCursor(mode=='move'?mode:mode+'-resize');if(mode=='move')
return Tracker.activateHandlers(createMover(pos),doneSelect);var fc=Coords.getFixed();var opp=oppLockCorner(mode);var opc=Coords.getCorner(oppLockCorner(opp));Coords.setPressed(Coords.getCorner(opp));Coords.setCurrent(opc);Tracker.activateHandlers(dragmodeHandler(mode,fc),doneSelect);};function dragmodeHandler(mode,f)
{return function(pos){if(!options.aspectRatio)switch(mode)
{case'e':pos[1]=f.y2;break;case'w':pos[1]=f.y2;break;case'n':pos[0]=f.x2;break;case's':pos[0]=f.x2;break;}
else switch(mode)
{case'e':pos[1]=f.y+1;break;case'w':pos[1]=f.y+1;break;case'n':pos[0]=f.x+1;break;case's':pos[0]=f.x+1;break;}
Coords.setCurrent(pos);Selection.update();};};function createMover(pos)
{var lloc=pos;KeyManager.watchKeys();return function(pos)
{Coords.moveOffset([pos[0]-lloc[0],pos[1]-lloc[1]]);lloc=pos;Selection.update();};};function oppLockCorner(ord)
{switch(ord)
{case'n':return'sw';case's':return'nw';case'e':return'nw';case'w':return'ne';case'ne':return'sw';case'nw':return'se';case'se':return'nw';case'sw':return'ne';};};function createDragger(ord)
{return function(e){if(options.disabled)return false;if((ord=='move')&&!options.allowMove)return false;btndown=true;startDragMode(ord,mouseAbs(e));e.stopPropagation();e.preventDefault();return false;};};function presize($obj,w,h)
{var nw=$obj.width(),nh=$obj.height();if((nw>w)&&w>0)
{nw=w;nh=(w/$obj.width())*$obj.height();}
if((nh>h)&&h>0)
{nh=h;nw=(h/$obj.height())*$obj.width();}
xscale=$obj.width()/nw;yscale=$obj.height()/nh;$obj.width(nw).height(nh);};function unscale(c)
{return{x:parseInt(c.x*xscale),y:parseInt(c.y*yscale),x2:parseInt(c.x2*xscale),y2:parseInt(c.y2*yscale),w:parseInt(c.w*xscale),h:parseInt(c.h*yscale)};};function doneSelect(pos)
{var c=Coords.getFixed();if(c.w>options.minSelect[0]&&c.h>options.minSelect[1])
{Selection.enableHandles();Selection.done();}
else
{Selection.release();}
Tracker.setCursor(options.allowSelect?'crosshair':'default');};function newSelection(e)
{if(options.disabled)return false;if(!options.allowSelect)return false;btndown=true;docOffset=getPos($img);Selection.disableHandles();myCursor('crosshair');var pos=mouseAbs(e);Coords.setPressed(pos);Tracker.activateHandlers(selectDrag,doneSelect);KeyManager.watchKeys();Selection.update();e.stopPropagation();e.preventDefault();return false;};function selectDrag(pos)
{Coords.setCurrent(pos);Selection.update();};function newTracker()
{var trk=$('<div></div>').addClass(cssClass('tracker'));$.browser.msie&&trk.css({opacity:0,backgroundColor:'white'});return trk;};function animateTo(a)
{var x1=a[0]/xscale,y1=a[1]/yscale,x2=a[2]/xscale,y2=a[3]/yscale;if(animating)return;var animto=Coords.flipCoords(x1,y1,x2,y2);var c=Coords.getFixed();var animat=initcr=[c.x,c.y,c.x2,c.y2];var interv=options.animationDelay;var x=animat[0];var y=animat[1];var x2=animat[2];var y2=animat[3];var ix1=animto[0]-initcr[0];var iy1=animto[1]-initcr[1];var ix2=animto[2]-initcr[2];var iy2=animto[3]-initcr[3];var pcent=0;var velocity=options.swingSpeed;Selection.animMode(true);var animator=function()
{return function()
{pcent+=(100-pcent)/velocity;animat[0]=x+((pcent/100)*ix1);animat[1]=y+((pcent/100)*iy1);animat[2]=x2+((pcent/100)*ix2);animat[3]=y2+((pcent/100)*iy2);if(pcent<100)animateStart();else Selection.done();if(pcent>=99.8)pcent=100;setSelectRaw(animat);};}();function animateStart()
{window.setTimeout(animator,interv);};animateStart();};function setSelect(rect)
{setSelectRaw([rect[0]/xscale,rect[1]/yscale,rect[2]/xscale,rect[3]/yscale]);};function setSelectRaw(l)
{Coords.setPressed([l[0],l[1]]);Coords.setCurrent([l[2],l[3]]);Selection.update();};function setOptions(opt)
{if(typeof(opt)!='object')opt={};options=$.extend(options,opt);if(typeof(options.onChange)!=='function')
options.onChange=function(){};if(typeof(options.onSelect)!=='function')
options.onSelect=function(){};};function tellSelect()
{return unscale(Coords.getFixed());};function tellScaled()
{return Coords.getFixed();};function setOptionsNew(opt)
{setOptions(opt);interfaceUpdate();};function disableCrop()
{options.disabled=true;Selection.disableHandles();Selection.setCursor('default');Tracker.setCursor('default');};function enableCrop()
{options.disabled=false;interfaceUpdate();};function cancelCrop()
{Selection.done();Tracker.activateHandlers(null,null);};function destroy()
{$div.remove();$origimg.show();};function interfaceUpdate(alt)
{options.allowResize?alt?Selection.enableOnly():Selection.enableHandles():Selection.disableHandles();Tracker.setCursor(options.allowSelect?'crosshair':'default');Selection.setCursor(options.allowMove?'move':'default');$div.css('backgroundColor',options.bgColor);if('setSelect'in options){setSelect(opt.setSelect);Selection.done();delete(options.setSelect);}
if('trueSize'in options){xscale=options.trueSize[0]/boundx;yscale=options.trueSize[1]/boundy;}
xlimit=options.maxSize[0]||0;ylimit=options.maxSize[1]||0;xmin=options.minSize[0]||0;ymin=options.minSize[1]||0;if('outerImage'in options)
{$img.attr('src',options.outerImage);delete(options.outerImage);}
Selection.refresh();};$hdl_holder.hide();interfaceUpdate(true);var api={animateTo:animateTo,setSelect:setSelect,setOptions:setOptionsNew,tellSelect:tellSelect,tellScaled:tellScaled,disable:disableCrop,enable:enableCrop,cancel:cancelCrop,focus:KeyManager.watchKeys,getBounds:function(){return[boundx*xscale,boundy*yscale];},getWidgetSize:function(){return[boundx,boundy];},release:Selection.release,destroy:destroy};$origimg.data('Jcrop',api);return api;};$.fn.Jcrop=function(options)
{function attachWhenDone(from)
{var loadsrc=options.useImg||from.src;var img=new Image();img.onload=function(){$.Jcrop(from,options);};img.src=loadsrc;};if(typeof(options)!=='object')options={};this.each(function()
{if($(this).data('Jcrop'))
{if(options=='api')return $(this).data('Jcrop');else $(this).data('Jcrop').setOptions(options);}
else attachWhenDone(this);});return this;};})(jQuery);

19
edgware/static/Jcrop/js/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

BIN
edgware/static/ckeditor/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,24 @@
#
# Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
# For licensing, see LICENSE.html or http://ckeditor.com/license
#
#
# On some specific Linux installations you could face problems with Firefox.
# It could give you errors when loading the editor saying that some illegal
# characters were found (three strange chars in the beginning of the file).
# This could happen if you map the .js or .css files to PHP, for example.
#
# Those characters are the Byte Order Mask (BOM) of the Unicode encoded files.
# All FCKeditor files are Unicode encoded.
#
AddType application/x-javascript .js
AddType text/css .css
#
# If PHP is mapped to handle XML files, you could have some issues. The
# following will disable it.
#
AddType text/xml .xml

View File

@ -0,0 +1,440 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Changelog - CKEditor</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style type="text/css">
#footer hr
{
margin: 10px 0 15px 0;
height: 1px;
border: solid 1px gray;
border-bottom: none;
}
#footer p
{
margin: 0 10px 10px 10px;
float: left;
}
#footer #copy
{
float: right;
}
</style>
</head>
<body>
<h1>
CKEditor Changelog
</h1>
<h3>
CKEditor 3.1 (SVN)</h3>
<p>
New features:</p>
<ul>
<li><a href="http://dev.fckeditor.net/ticket/4729">#4729</a> : Added support to fake elements for comments.</li>
<li><a href="http://dev.fckeditor.net/ticket/4463">#4463</a> : Added inline CSS support in all places where custom stylesheet could apply.</li>
<li><a href="http://dev.fckeditor.net/ticket/3881">#3881</a> : Added color dialog for 'more color' option in color buttons.</li>
<li><a href="http://dev.fckeditor.net/ticket/2885">#2885</a> : Added 'div' dialog and corresponding context menu options.</li>
<li><a href="http://dev.fckeditor.net/ticket/4341">#4341</a> : Added the 'showborder' plugin.</li>
<li><a href="http://dev.fckeditor.net/ticket/4549">#4549</a> : Make the anti-cache query string configurable.</li>
<li><a href="http://dev.fckeditor.net/ticket/4708">#4708</a> : Added the 'htmlEncodeOutput' config option.</li>
<li><a href="http://dev.fckeditor.net/ticket/4574">#4574</a> : Added the table merging tools and corresponding context menu options.</li>
<li><a href="http://dev.fckeditor.net/ticket/4340">#4340</a> : Added the email protection option for link dialog.</li>
<li><a href="http://dev.fckeditor.net/ticket/4210">#4210</a> : Added CKEditor plugin for jQuery.</li>
<li><a href="http://dev.fckeditor.net/ticket/4067">#4067</a> : Introduced the full page editing support (from &lt;html&gt; to &lt;/html&gt;).</li>
<li><a href="http://dev.fckeditor.net/ticket/4342">#4342</a> : Introduced the bodyId and bodyClass settings to specify the id and class. to be used in the editing area at runtime.</li>
<li><a href="http://dev.fckeditor.net/ticket/3401">#3401</a> : Introduced the baseHref setting so it's possible to set the URL to be used to resolve absolute and relative URLs in the contents.</li>
<li><a href="http://dev.fckeditor.net/ticket/4228">#4228</a> : Introduced the Shared Spaces feature.</li>
<li></li>
</ul>
<p>
Fixed issues:</p>
<ul>
<li><a href="http://dev.fckeditor.net/ticket/4707">#4707</a> : Fixed invalid link is requested in image preview.</li>
<li><a href="http://dev.fckeditor.net/ticket/4461">#4461</a> : Fixed toolbar separator line along side combo penetrate toolbar height.</li>
<li><a href="http://dev.fckeditor.net/ticket/4596">#4596</a> : Fixed image re-size lock buttons aren't accessible in high-contrast mode.</li>
<li><a href="http://dev.fckeditor.net/ticket/4676">#4676</a> : Fixed editing tables using table properties dialog overwrites original style values.</li>
<li><a href="http://dev.fckeditor.net/ticket/4714">#4714</a> : Fixed IE6 JavaScript error when editing flash by commit 'Flash' dialog.</li>
<li><a href="http://dev.fckeditor.net/ticket/3905">#3905</a> : Fixed 'wysiwyg' mode causes unauthenticated content warnings over SSL in FF 3.5.</li>
<li><a href="http://dev.fckeditor.net/ticket/4768">#4768</a> : Fixed open context menu in IE throws js error when focus is not inside document.</li>
<li><a href="http://dev.fckeditor.net/ticket/4822">#4822</a> : Fixed applying 'Headers' to existing table does not work in IE.</li>
<li><a href="http://dev.fckeditor.net/ticket/4855">#4855</a> : Fixed toolbar doesn't wrap well for 'v2' skin in all browsers.</li>
<li><a href="http://dev.fckeditor.net/ticket/4882">#4882</a> : Fixed auto detect paste from MS-Word is not working for Safari.</li>
<li><a href="http://dev.fckeditor.net/ticket/4882">#4882</a> : Fixed unexpected margin style left behind on content cleaning up from MS-Word.</li>
<li><a href="http://dev.fckeditor.net/ticket/4896">#4896</a> : Fixed paste nested list from MS-Word with measurement units set to cm is broken.</li>
<li><a href="http://dev.fckeditor.net/ticket/4899">#4899</a> : Fixed unable to undo pre-formatted style.</li>
<li><a href="http://dev.fckeditor.net/ticket/4900">#4900</a> : Fixed ratio-lock inconsistent between browsers.</li>
<li><a href="http://dev.fckeditor.net/ticket/4901">#4901</a> : Fixed unable to edit any link with popup window's features in Firefox.</li>
<li><a href="http://dev.fckeditor.net/ticket/4904">#4904</a> : Fixed when paste happen from dialog, it always throw JavaScript error.</li>
<li><a href="http://dev.fckeditor.net/ticket/4905">#4905</a> : Fixed paste plain text result incorrect when content from dialog.</li>
<li><a href="http://dev.fckeditor.net/ticket/4889">#4889</a> : Fixed unable to undo 'New Page' command after typing inside editor.</li>
<li><a href="http://dev.fckeditor.net/ticket/4892">#4892</a> : Fixed table alignment style is not properly represented by the wrapping div.</li>
<li><a href="http://dev.fckeditor.net/ticket/4918">#4918</a> : Fixed switching mode when maximized is showing background page contents.</li>
</ul>
<h3>
CKEditor 3.0.2</h3>
<p>
New features:</p>
<ul>
<li><a href="http://dev.fckeditor.net/ticket/4343">#4343</a> : Added the configuration option &#39;browserContextMenuOnCtrl&#39; so it&#39;s possible to enable the default browser context menu by holding the CTRL key.</li>
</ul>
<p>
Fixed issues:</p>
<ul>
<li><a href="http://dev.fckeditor.net/ticket/4552">#4552</a> : Fixed float panel doesn't show up since editor instanced been destroyed once.</li>
<li><a href="http://dev.fckeditor.net/ticket/3918">#3918</a> : Fixed fake object is editable with Image dialog.</li>
<li><a href="http://dev.fckeditor.net/ticket/4053">#4053</a> : Fixed 'Form Properties' missing from context menu when selection collapsed inside form.</li>
<li><a href="http://dev.fckeditor.net/ticket/4401">#4401</a> : Fixed customized by removing 'upload' tab page from 'Link dialog' cause JavaScript error.</li>
<li><a href="http://dev.fckeditor.net/ticket/4477">#4477</a> : Adding missing tag names in object style elements.</li>
<li><a href="http://dev.fckeditor.net/ticket/4567">#4567</a> : Fixed IE throw error when pressing BACKSPACE in source mode.</li>
<li><a href="http://dev.fckeditor.net/ticket/4573">#4573</a> : Fixed 'IgnoreEmptyPargraph' config doesn't work with the config 'entities' is set to 'false'.</li>
<li><a href="http://dev.fckeditor.net/ticket/4614">#4614</a> : Fixed attribute protection fails because of line-break.</li>
<li><a href="http://dev.fckeditor.net/ticket/4546">#4546</a> : Fixed UIColor plugin doesn't work when editor id contains CSS selector preserved keywords.</li>
<li><a href="http://dev.fckeditor.net/ticket/4609">#4609</a> : Fixed flash object is lost when loading data from outside editor.</li>
<li><a href="http://dev.fckeditor.net/ticket/4625">#4625</a> : Fixed editor stays visible in a div with style 'visibility:hidden'.</li>
<li><a href="http://dev.fckeditor.net/ticket/4621">#4621</a> : Fixed clicking below table caused an empty table been generated.</li>
<li><a href="http://dev.fckeditor.net/ticket/3373">#3373</a> : Fixed empty context menu when there's no menu item at all.</li>
<li><a href="http://dev.fckeditor.net/ticket/4473">#4473</a> : Fixed setting rules on the same element tag name throws error.</li>
<li><a href="http://dev.fckeditor.net/ticket/4514">#4514</a> : Fixed press 'Back' button breaks wysiwyg editing mode is Firefox.</li>
<li><a href="http://dev.fckeditor.net/ticket/4542">#4542</a> : Fixed unable to access buttons using tab key in Safari and Opera.</li>
<li><a href="http://dev.fckeditor.net/ticket/4577">#4577</a> : Fixed relative link url is broken after opening 'Link' dialog.</li>
<li><a href="http://dev.fckeditor.net/ticket/4597">#4597</a> : Fixed custom style with same attribute name but different attribute value doesn't work.</li>
<li><a href="http://dev.fckeditor.net/ticket/4651">#4651</a> : Fixed 'Deleted' and 'Inserted' text style is not rendering in wysiwyg mode and is wrong is source mode.</li>
<li><a href="http://dev.fckeditor.net/ticket/4654">#4654</a> : Fixed 'CKEDITOR.config.font_defaultLabel(fontSize_defaultLabel)' is not working.</li>
<li><a href="http://dev.fckeditor.net/ticket/3950">#3950</a> : Fixed table column insertion incorrect when selecting empty cell area.</li>
<li><a href="http://dev.fckeditor.net/ticket/3912">#3912</a> : Fixed UIColor not working in IE when page has more than 30+ editors.</li>
<li><a href="http://dev.fckeditor.net/ticket/4031">#4031</a> : Fixed mouse cursor on toolbar combo has more than 3 shapes.</li>
<li><a href="http://dev.fckeditor.net/ticket/4041">#4041</a> : Fixed open context menu on multiple cells to remove them result in only one removed.</li>
<li><a href="http://dev.fckeditor.net/ticket/4185">#4185</a> : Fixed resize handler effect doesn't affect flash object on output.</li>
<li><a href="http://dev.fckeditor.net/ticket/4196">#4196</a> : Fixed 'Remove Numbered/Bulleted List' on nested list doesn't work well on nested list.</li>
<li><a href="http://dev.fckeditor.net/ticket/4200">#4200</a> : Fixed unable to insert 'password' type filed with attributes.</li>
<li><a href="http://dev.fckeditor.net/ticket/4530">#4530</a> : Fixed context menu couldn't open in Opera.</li>
<li><a href="http://dev.fckeditor.net/ticket/4536">#4536</a> : Fixed keyboard navigation doesn't work at all in IE quirks mode.</li>
<li><a href="http://dev.fckeditor.net/ticket/4584">#4584</a> : Fixed updated link Target field is not updating when updating to certain values.</li>
<li><a href="http://dev.fckeditor.net/ticket/4603">#4603</a> : Fixed unable to disable submenu items in contextmenu.</li>
<li><a href="http://dev.fckeditor.net/ticket/4672">#4672</a> : Fixed unable to redo the insertion of horizontal line.</li>
<li><a href="http://dev.fckeditor.net/ticket/4677">#4677</a> : Fixed 'Tab' key is trapped by hidden dialog elements.</li>
<li><a href="http://dev.fckeditor.net/ticket/4073">#4073</a> : Fixed insert template with replace option could result in empty document.</li>
<li><a href="http://dev.fckeditor.net/ticket/4455">#4455</a> : Fixed unable to start editing when image inside document not loaded.</li>
<li><a href="http://dev.fckeditor.net/ticket/4517">#4517</a> : Fixed 'dialog_backgroundCoverColor' doesn't work on IE6.</li>
<li><a href="http://dev.fckeditor.net/ticket/3165">#3165</a> : Fixed enter key in empty list item before nested one result in collapsed line.</li>
<li><a href="http://dev.fckeditor.net/ticket/4527">#4527</a> : Fixed checkbox generate invalid 'checked' attribute.</li>
<li><a href="http://dev.fckeditor.net/ticket/1659">#1659</a> : Fixed unable to click below content to start editing in IE with 'config.docType' setting to standard compliant.</li>
<li><a href="http://dev.fckeditor.net/ticket/3933">#3933</a> : Fixed extra &lt;br&gt; left at the end of document when the last element is a table.</li>
<li><a href="http://dev.fckeditor.net/ticket/4736">#4736</a> : Fixed PAGE UP and PAGE DOWN keys in standards mode are not working.</li>
<li><a href="http://dev.fckeditor.net/ticket/4725">#4725</a> : Fixed hitting 'enter' before html comment node produces a JavaScript error.</li>
<li><a href="http://dev.fckeditor.net/ticket/4522">#4522</a> : Fixed unable to redo when typing after insert an image with relative url.</li>
<li><a href="http://dev.fckeditor.net/ticket/4594">#4594</a> : Fixed context menu goes off-screen when mouse is at right had side of screen.</li>
<li><a href="http://dev.fckeditor.net/ticket/4673">#4673</a> : Fixed undo not available straight away if shift key is used to enter first character.</li>
<li><a href="http://dev.fckeditor.net/ticket/4690">#4690</a> : Fixed the parsing of nested inline elements.</li>
<li><a href="http://dev.fckeditor.net/ticket/4450">#4450</a> : Fixed selecting multiple table cells before apply justify commands generates spurious paragraph in Firefox.</li>
<li><a href="http://dev.fckeditor.net/ticket/4733">#4733</a> : Fixed dialog opening sometimes hang up Firefox and Safari.</li>
<li><a href="http://dev.fckeditor.net/ticket/4498">#4498</a> : Fixed toolbar collapse button missing tooltip.</li>
<li><a href="http://dev.fckeditor.net/ticket/4738">#4738</a> : Fixed inserting table inside bold/italic/underline generates error on ENTER_BR mode.</li>
<li><a href="http://dev.fckeditor.net/ticket/4246">#4246</a> : Fixed avoid XHTML deprecated attributes for image styling.</li>
<li><a href="http://dev.fckeditor.net/ticket/4543">#4543</a> : Fixed unable to move cursor between table and hr.</li>
<li><a href="http://dev.fckeditor.net/ticket/4764">#4764</a> : Fixed wrong exception message when CKEDITOR.editor.append() to non-existing elements.</li>
<li><a href="http://dev.fckeditor.net/ticket/4521">#4521</a> : Fixed dialog layout in IE6/7 may have scroll-bar and other weird effects.</li>
<li><a href="http://dev.fckeditor.net/ticket/4709">#4709</a> : Fixed inconsistent scroll-bar behavior on IE.</li>
<li><a href="http://dev.fckeditor.net/ticket/4776">#4776</a> : Fixed preview page failed to open when relative URl contains in document.</li>
<li><a href="http://dev.fckeditor.net/ticket/4812">#4812</a> : Fixed 'Esc' key not working on dialogs in Opera.</li>
<li>Updated the following language files:<ul>
<li><a href="http://dev.fckeditor.net/ticket/4346">#4346</a> : Dutch;</li>
<li><a href="http://dev.fckeditor.net/ticket/4837">#4837</a> : Finnish;</li>
<li><a href="http://dev.fckeditor.net/ticket/4371">#4371</a> : Hebrew;</li>
<li><a href="http://dev.fckeditor.net/ticket/4371">#4607</a> <a href="http://dev.fckeditor.net/ticket/4713">#4713</a> : Japanese;</li>
<li><a href="http://dev.fckeditor.net/ticket/4660">#4660</a> : Norwegian.</li>
</ul></li>
</ul>
<h3>
CKEditor 3.0.1</h3>
<p>
New features:</p>
<ul>
<li><a href="http://dev.fckeditor.net/ticket/4219">#4219</a> : Added fallback mechanism for config.language.</li>
<li><a href="http://dev.fckeditor.net/ticket/4194">#4194</a> : Added support for using multiple css style sheets within the editor.</li>
</ul>
<p>
Fixed issues:</p>
<ul>
<li><a href="http://dev.fckeditor.net/ticket/3898">#3898</a> : Added validation for URL value in Image dialog.</li>
<li><a href="http://dev.fckeditor.net/ticket/3528">#3528</a> : Fixed Context Menu issue when triggered using Shift+F10.</li>
<li><a href="http://dev.fckeditor.net/ticket/4028">#4028</a> : Maximize control's tool tip was wrong once it is maximized.</li>
<li><a href="http://dev.fckeditor.net/ticket/4237">#4237</a> : Toolbar is chopped off in Safari browser 3.x.</li>
<li><a href="http://dev.fckeditor.net/ticket/4241">#4241</a> : Float panels are left on screen while editor is destroyed.</li>
<li><a href="http://dev.fckeditor.net/ticket/4274">#4274</a> : Double click event is incorrect handled in 'divreplace' sample.</li>
<li><a href="http://dev.fckeditor.net/ticket/4354">#4354</a> : Fixed TAB key on toolbar to not focus disabled buttons.</li>
<li><a href="http://dev.fckeditor.net/ticket/3856">#3856</a> : Fixed focus and blur events in source view mode.</li>
<li><a href="http://dev.fckeditor.net/ticket/3438">#3438</a> : Floating panels are off by (-1px, 0px) in RTL mode.</li>
<li><a href="http://dev.fckeditor.net/ticket/3370">#3370</a> : Refactored use of CKEDITOR.env.isCustomDomain().</li>
<li><a href="http://dev.fckeditor.net/ticket/4230">#4230</a> : HC detection caused js error.</li>
<li><a href="http://dev.fckeditor.net/ticket/3978">#3978</a> : Fixed setStyle float on IE7 strict.</li>
<li><a href="http://dev.fckeditor.net/ticket/4262">#4262</a> : Tab and Shift+Tab was not working to cycle through CTRL+SHIFT+F10 context menu in IE.</li>
<li><a href="http://dev.fckeditor.net/ticket/3633">#3633</a> : Default context menu isn't disabled in toolbar, status bar, panels...</li>
<li><a href="http://dev.fckeditor.net/ticket/3897">#3897</a> : Now there is no image previews when the URL is empty in image dialog.</li>
<li><a href="http://dev.fckeditor.net/ticket/4048">#4048</a> : Context submenu was lacking uiColor.</li>
<li><a href="http://dev.fckeditor.net/ticket/3568">#3568</a> : Dialogs now select all text when tabbing to text inputs.</li>
<li><a href="http://dev.fckeditor.net/ticket/3727">#3727</a> : Cell Properties dialog was missing color selection option.</li>
<li><a href="http://dev.fckeditor.net/ticket/3517">#3517</a> : Fixed "Match cyclic" field in Find & Replace dialog.</li>
<li><a href="http://dev.fckeditor.net/ticket/4368">#4368</a> : borderColor table cell attribute haven't worked for none-IE</li>
<li><a href="http://dev.fckeditor.net/ticket/4203">#4203</a> : In IE quirks mode + toolbar collapsed + source mode editing block height was incorrect.</li>
<li><a href="http://dev.fckeditor.net/ticket/4387">#4387</a> : Fixed: right clicking in Kama skin can lead to a javascript error.</li>
<li><a href="http://dev.fckeditor.net/ticket/4397">#4397</a> : Wysiwyg mode caused the host page scroll.</li>
<li><a href="http://dev.fckeditor.net/ticket/4385">#4385</a> : Fixed editor's auto adjusting on DOM structure were confusing the dirty checking mechanism.</li>
<li><a href="http://dev.fckeditor.net/ticket/4397">#4397</a> : Fixed regression of [3816] where turn on design mode was causing Firefox3 to scroll the host page.</li>
<li><a href="http://dev.fckeditor.net/ticket/4254">#4254</a> : Added basic API sample.</li>
<li><a href="http://dev.fckeditor.net/ticket/4107">#4107</a> : Normalize css font-family style text for correct comparision.</li>
<li><a href="http://dev.fckeditor.net/ticket/3664">#3664</a> : Insert block element in empty editor document should not create new paragraph.</li>
<li><a href="http://dev.fckeditor.net/ticket/4037">#4037</a> : 'id' attribute is missing with Flash dialog advanced page.</li>
<li><a href="http://dev.fckeditor.net/ticket/4047">#4047</a> : Delete selected control type element when 'Backspace' is pressed on it.</li>
<li><a href="http://dev.fckeditor.net/ticket/4191">#4191</a> : Fixed: dialog changes confirmation on image dialog appeared even when no changes have been made.</li>
<li><a href="http://dev.fckeditor.net/ticket/4351">#4351</a> : Dash and dot could appear in attribute names.</li>
<li><a href="http://dev.fckeditor.net/ticket/4355">#4355</a> : 'maximize' and 'showblock' commands shouldn't take editor focus.</li>
<li><a href="http://dev.fckeditor.net/ticket/4504">#4504</a> : Fixed 'Enter'/'Esc' key is not working on dialog button.</li>
<li><a href="http://dev.fckeditor.net/ticket/4245">#4245</a> : 'Strange Template' now come with a style attribute for width.</li>
<li><a href="http://dev.fckeditor.net/ticket/4512">#4512</a> : Fixed styles plugin incorrectly adding semicolons to style text.</li>
<li><a href="http://dev.fckeditor.net/ticket/3855">#3855</a> : Fixed loading unminified _source files when ckeditor_source.js is used.</li>
<li><a href="http://dev.fckeditor.net/ticket/3717">#3717</a> : Dialog settings defaults can now be overridden in-page through the CKEDITOR.config object.</li>
<li><a href="http://dev.fckeditor.net/ticket/4481">#4481</a> : The 'stylesCombo_stylesSet' configuration entry didn't work for full URLs.</li>
<li><a href="http://dev.fckeditor.net/ticket/4480">#4480</a> : Fixed scope attribute in th.</li>
<li><a href="http://dev.fckeditor.net/ticket/4467">#4467</a> : Fixed bug to use custom icon in context menus. Thanks to george.</li>
<li><a href="http://dev.fckeditor.net/ticket/4190">#4190</a> : Fixed select field dialog layout in Safari.</li>
<li><a href="http://dev.fckeditor.net/ticket/4518">#4518</a> : Fixed unable to open dialog without editor focus in IE.</li>
<li><a href="http://dev.fckeditor.net/ticket/4519">#4519</a> : Fixed maximize without editor focus throw error in IE.</li>
<li>Updated the following language files:<ul>
<li><a href="http://dev.fckeditor.net/ticket/3947">#3947</a> : Arabic;</li>
<li><a href="http://dev.fckeditor.net/ticket/4466">#4466</a> : Czech;</li>
<li><a href="http://dev.fckeditor.net/ticket/4363">#4363</a> : Danish;</li>
<li><a href="http://dev.fckeditor.net/ticket/4346">#4346</a> : Dutch;</li>
<li><a href="http://dev.fckeditor.net/ticket/4371">#4371</a> <a href="http://dev.fckeditor.net/ticket/4456">#4456</a> : Hebrew;</li>
<li><a href="http://dev.fckeditor.net/ticket/4382">#4382</a> : Polish.</li>
</ul></li>
</ul>
<h3>
CKEditor 3.0</h3>
<p>
New features:</p>
<ul>
<li><a href="http://dev.fckeditor.net/ticket/3188">#3188</a> : Introduce
&lt;pre&gt; formatting feature when converting from other blocks.</li>
<li><a href="http://dev.fckeditor.net/ticket/4445">#4445</a> : editor::setData now support an optional callback parameter.</li>
</ul>
<p>
Fixed issues:</p>
<ul>
<li><a href="http://dev.fckeditor.net/ticket/2856">#2856</a> : Fixed problem with inches in Paste From Word plugin.</li>
<li><a href="http://dev.fckeditor.net/ticket/3929">#3929</a> : Using Paste dialog,
the text is pasted into current selection</li>
<li><a href="http://dev.fckeditor.net/ticket/3920">#3920</a> : Mouse cursor over characters in
Special Character dialog now is correct</li>
<li><a href="http://dev.fckeditor.net/ticket/3882">#3882</a> : Fixed an issue
with PasteFromWord dialog in which default values was ignored</li>
<li><a href="http://dev.fckeditor.net/ticket/3859">#3859</a> : Fixed Flash dialog layout in Webkit</li>
<li><a href="http://dev.fckeditor.net/ticket/3852">#3852</a> : Disabled textarea resizing in dialogs</li>
<li><a href="http://dev.fckeditor.net/ticket/3831">#3831</a> : The attempt to remove the contextmenu plugin
will not anymore break the editor</li>
<li><a href="http://dev.fckeditor.net/ticket/3781">#3781</a> : Colorbutton is now disabled in 'source' mode</li>
<li><a href="http://dev.fckeditor.net/ticket/3848">#3848</a> : Fixed an issue with Webkit in witch
elements in the Image and Link dialogs had wrong dimensions.</li>
<li><a href="http://dev.fckeditor.net/ticket/3808">#3808</a> : Fixed UI Color Picker dialog size in example page.</li>
<li><a href="http://dev.fckeditor.net/ticket/3658">#3658</a> : Editor had horizontal scrollbar in IE6.</li>
<li><a href="http://dev.fckeditor.net/ticket/3819">#3819</a> : The cursor was not visible
when applying style to collapsed selections in Firefox 2.</li>
<li><a href="http://dev.fckeditor.net/ticket/3809">#3809</a> : Fixed beam cursor
when mouse cursor is over text-only buttons in IE.</li>
<li><a href="http://dev.fckeditor.net/ticket/3815">#3815</a> : Fixed an issue
with the form dialog in which the "enctype" attribute is outputted as "encoding".</li>
<li><a href="http://dev.fckeditor.net/ticket/3785">#3785</a> : Fixed an issue
in CKEDITOR.tools.htmlEncode() which incorrectly outputs &amp;nbsp; in IE8.</li>
<li><a href="http://dev.fckeditor.net/ticket/3820">#3820</a> : Fixed an issue in
bullet list command in which a list created at the bottom of another gets merged to the top.
</li>
<li><a href="http://dev.fckeditor.net/ticket/3830">#3830</a> : Table cell properties dialog
doesn't apply to all selected cells.</li>
<li><a href="http://dev.fckeditor.net/ticket/3835">#3835</a> : Element path is not refreshed
after click on 'newpage'; and safari is not putting focus on document also.
</li>
<li><a href="http://dev.fckeditor.net/ticket/3821">#3821</a> : Fixed an issue with JAWS in which
toolbar items are read inconsistently between virtual cursor modes.</li>
<li><a href="http://dev.fckeditor.net/ticket/3789">#3789</a> : The &quot;src&quot; attribute
was getting duplicated in some situations.</li>
<li><a href="http://dev.fckeditor.net/ticket/3591">#3591</a> : Protecting flash related elements
including '&lt;object&gt;', '&lt;embed&gt;' and '&lt;param&gt;'.
</li>
<li><a href="http://dev.fckeditor.net/ticket/3759">#3759</a> : Fixed CKEDITOR.dom.element::scrollIntoView
logic bug which scroll even element is inside viewport.
</li>
<li><a href="http://dev.fckeditor.net/ticket/3773">#3773</a> : Fixed remove list will merge lines.
</li>
<li><a href="http://dev.fckeditor.net/ticket/3829">#3829</a> : Fixed remove empty link on output data.</li>
<li><a href="http://dev.fckeditor.net/ticket/3730">#3730</a> : Indent is performing on the whole
block instead of selected lines in enterMode = BR.</li>
<li><a href="http://dev.fckeditor.net/ticket/3844">#3844</a> : Fixed UndoManager register keydown on obsoleted document</li>
<li><a href="http://dev.fckeditor.net/ticket/3805">#3805</a> : Enabled SCAYT plugin for IE.</li>
<li><a href="http://dev.fckeditor.net/ticket/3834">#3834</a> : Context menu on table caption was incorrect.</li>
<li><a href="http://dev.fckeditor.net/ticket/3812">#3812</a> : Fixed an issue in which the editor
may show up empty or uneditable in IE7, 8 and Firefox 3.</li>
<li><a href="http://dev.fckeditor.net/ticket/3825">#3825</a> : Fixed JS error when opening spellingcheck.</li>
<li><a href="http://dev.fckeditor.net/ticket/3862">#3862</a> : Fixed html parser infinite loop on certain malformed
source code.</li>
<li><a href="http://dev.fckeditor.net/ticket/3639">#3639</a> : Button size was inconsistent.</li>
<li><a href="http://dev.fckeditor.net/ticket/3874">#3874</a> : Paste as plain text in Safari loosing lines.</li>
<li><a href="http://dev.fckeditor.net/ticket/3849">#3849</a> : Fixed IE8 crashes when applying lists and indenting.</li>
<li><a href="http://dev.fckeditor.net/ticket/3876">#3876</a> : Changed dialog checkbox and radio labels to explicit labels.</li>
<li><a href="http://dev.fckeditor.net/ticket/3843">#3843</a> : Fixed context submenu position in IE 6 & 7 RTL.</li>
<li><a href="http://dev.fckeditor.net/ticket/3864">#3864</a> : [FF]Document is not editable after inserting element on a fresh page.</li>
<li><a href="http://dev.fckeditor.net/ticket/3883">#3883</a> : Fixed removing inline style logic incorrect on Firefox2.</li>
<li><a href="http://dev.fckeditor.net/ticket/3884">#3884</a> : Empty "href" attribute was duplicated on output data.</li>
<li><a href="http://dev.fckeditor.net/ticket/3858">#3858</a> : Fixed the issue where toolbars
break up in IE6 and IE7 after the browser is resized.</li>
<li><a href="http://dev.fckeditor.net/ticket/3868">#3868</a> : [chrome] SCAYT toolbar options was in reversed order.</li>
<li><a href="http://dev.fckeditor.net/ticket/3875">#3875</a> : Fixed an issue in Safari where
table row/column/cell menus are not useable when table cells are selected.</li>
<li><a href="http://dev.fckeditor.net/ticket/3896">#3896</a> : The editing area was
flashing when switching forth and back to source view.</li>
<li><a href="http://dev.fckeditor.net/ticket/3894">#3894</a> : Fixed an issue where editor failed to initialize when using the on-demand loading way.</li>
<li><a href="http://dev.fckeditor.net/ticket/3903">#3903</a> : Color button plugin doesn't read config entry from editor instance correctly.</li>
<li><a href="http://dev.fckeditor.net/ticket/3801">#3801</a> : Comments at the start of the document was lost in IE.</li>
<li><a href="http://dev.fckeditor.net/ticket/3871">#3871</a> : Unable to redo when undos to the front of snapshots stack.</li>
<li><a href="http://dev.fckeditor.net/ticket/3909">#3909</a> : Move focus from editor into a text input control is broken.</li>
<li><a href="http://dev.fckeditor.net/ticket/3870">#3870</a> : The empty paragraph
desappears when hitting ENTER after &quot;New Page&quot;.</li>
<li><a href="http://dev.fckeditor.net/ticket/3887">#3887</a> : Fixed an issue in which the create
list command may leak outside of a selected table cell and into the rest of document.</li>
<li><a href="http://dev.fckeditor.net/ticket/3916">#3916</a> : Fixed maximize does not enlarge editor width when width is set.</li>
<li><a href="http://dev.fckeditor.net/ticket/3879">#3879</a> : [webkit] Color button panel had incorrect size on first open.</li>
<li><a href="http://dev.fckeditor.net/ticket/3839">#3839</a> : Update Scayt plugin to reflect the latest change from SpellChecker.net.</li>
<li><a href="http://dev.fckeditor.net/ticket/3742">#3742</a> : Fixed wrong dialog layout for dialogs without tab bar in IE RTL mode .</li>
<li><a href="http://dev.fckeditor.net/ticket/3671">#3671</a> : Fixed body fixing should be applied to the real type under fake elements.</li>
<li><a href="http://dev.fckeditor.net/ticket/3836">#3836</a> : Fixed remove list in enterMode=BR will merge sibling text to one line.</li>
<li><a href="http://dev.fckeditor.net/ticket/3949">#3949</a> : Fixed enterKey within pre-formatted text introduce wrong line-break.</li>
<li><a href="http://dev.fckeditor.net/ticket/3878">#3878</a> : Whenever possible,
dialogs will not present scrollbars if the content is too big for its standard
size.</li>
<li><a href="http://dev.fckeditor.net/ticket/3782">#3782</a> : Remove empty list in table cell result in collapsed cell.</li>
<li>Updated the following language files:<ul>
<li><a href="http://dev.fckeditor.net/ticket/4183">#4183</a> : Basque;</li>
<li><a href="http://dev.fckeditor.net/ticket/3837">#3837</a> : Brazilian Portuguese;</li>
<li><a href="http://dev.fckeditor.net/ticket/4171">#4171</a> : Catalan;</li>
<li><a href="http://dev.fckeditor.net/ticket/4115">#4115</a> : Chinese (Simplified);</li>
<li><a href="http://dev.fckeditor.net/ticket/4179">#4179</a> : Chinese (Traditional);</li>
<li><a href="http://dev.fckeditor.net/ticket/4102">#4102</a> : Croatian;</li>
<li><a href="http://dev.fckeditor.net/ticket/4105">#4105</a> : French;</li>
<li><a href="http://dev.fckeditor.net/ticket/4104">#4104</a> : German;</li>
<li><a href="http://dev.fckeditor.net/ticket/4116">#4116</a> : Italian;</li>
<li><a href="http://dev.fckeditor.net/ticket/4091">#4091</a> : Japanese;</li>
<li><a href="http://dev.fckeditor.net/ticket/4120">#4120</a> : Polish;</li>
<li><a href="http://dev.fckeditor.net/ticket/3987">#3987</a> : Spanish;</li>
<li><a href="http://dev.fckeditor.net/ticket/4089">#4089</a> : Ukrainian;</li>
<li><a href="http://dev.fckeditor.net/ticket/4166">#4166</a> : Vietnamese.</li>
</ul></li>
<li><a href="http://dev.fckeditor.net/ticket/3984">#3984</a> : [IE]The pre-formatted style is generating error.</li>
<li><a href="http://dev.fckeditor.net/ticket/3946">#3946</a> : Fixed unable to hide contextmenu.</li>
<li><a href="http://dev.fckeditor.net/ticket/3956">#3956</a> : Fixed About dialog in Source Mode for IE.</li>
<li><a href="http://dev.fckeditor.net/ticket/3953">#3953</a> : Fixed keystroke for close Paste dialog.</li>
<li><a href="http://dev.fckeditor.net/ticket/3951">#3951</a> : Reset size and lock ratio options were not accessible in Image dialog.</li>
<li><a href="http://dev.fckeditor.net/ticket/3921">#3921</a> : Fixed Container scroll issue on IE7.</li>
<li><a href="http://dev.fckeditor.net/ticket/3940">#3940</a> : Fixed list operation doesn't stop at table.</li>
<li><a href="http://dev.fckeditor.net/ticket/3891">#3891</a> : [IE] Fixed 'automatic' font color doesn't work.</li>
<li><a href="http://dev.fckeditor.net/ticket/3972">#3972</a> : Fixed unable to remove a single empty list in document in Firefox with enterMode=BR.</li>
<li><a href="http://dev.fckeditor.net/ticket/3973">#3973</a> : Fixed list creation error at the end of document.</li>
<li><a href="http://dev.fckeditor.net/ticket/3959">#3959</a> : Pasting styled text from word result in content lost.</li>
<li><a href="http://dev.fckeditor.net/ticket/3793">#3793</a> : Combined images into sprites.</li>
<li><a href="http://dev.fckeditor.net/ticket/3783">#3783</a> : Fixed indenting command in table cells create collapsed paragraph.</li>
<li><a href="http://dev.fckeditor.net/ticket/3968">#3968</a> : About dialog layout was broken with IE+Standards+RTL.</li>
<li><a href="http://dev.fckeditor.net/ticket/3991">#3991</a> : In IE quirks, text was not visible in v2 and office2003 skins.</li>
<li><a href="http://dev.fckeditor.net/ticket/3983">#3983</a> : In IE, we&#39;ll now
silently ignore wrong toolbar definition settings which have extra commas being
left around.</li>
<li>Fixed the following test cases:<ul>
<li><a href="http://dev.fckeditor.net/ticket/3992">#3992</a> : core/ckeditor2.html</li>
<li><a href="http://dev.fckeditor.net/ticket/4138">#4138</a> : core/plugins.html</li>
<li><a href="http://dev.fckeditor.net/ticket/3801">#3801</a> : plugins/htmldataprocessor/htmldataprocessor.html</li>
</ul></li>
<li><a href="http://dev.fckeditor.net/ticket/3989">#3989</a> : Host page horizontal scrolling a lot when on having righ-to-left direction.</li>
<li><a href="http://dev.fckeditor.net/ticket/4001">#4001</a> : Create link around existing image result incorrect.</li>
<li><a href="http://dev.fckeditor.net/ticket/3988">#3988</a> : Destroy editor on form submit event cause error.</li>
<li><a href="http://dev.fckeditor.net/ticket/3994">#3994</a> : Insert horizontal line at end of document cause error.</li>
<li><a href="http://dev.fckeditor.net/ticket/4074">#4074</a> : Indent error with 'indentClasses' config specified.</li>
<li><a href="http://dev.fckeditor.net/ticket/4057">#4057</a> : Fixed anchor is lost after switch between editing modes.</li>
<li><a href="http://dev.fckeditor.net/ticket/3644">#3644</a> : Image dialog was missin radio lock.</li>
<li><a href="http://dev.fckeditor.net/ticket/4014">#4014</a> : Firefox2 had no dialog button backgrounds.</li>
<li><a href="http://dev.fckeditor.net/ticket/4018">#4018</a> : Firefox2 had no richcombo text visible.</li>
<li><a href="http://dev.fckeditor.net/ticket/4035">#4035</a> : [IE6] Paste dialog size was too small.</li>
<li><a href="http://dev.fckeditor.net/ticket/4049">#4049</a> : Kama skin was too wide with config.width.</li>
<li>The following released files now doesn't require the _source folder<ul>
<li><a href="http://dev.fckeditor.net/ticket/4086">#4086</a> : _samples/ui_languages.html</li>
<li><a href="http://dev.fckeditor.net/ticket/4093">#4093</a> : _tests/core/dom/document.html</li>
<li><a href="http://dev.fckeditor.net/ticket/4094">#4094</a> : Smiley plugin file</li>
<li><a href="http://dev.fckeditor.net/ticket/4097">#4097</a> : No undo/redo support for fontColor and backgroundColor buttons.</li>
</ul></li>
<li><a href="http://dev.fckeditor.net/ticket/4085">#4085</a> : Paste and Paste from Word dialogs were not well styled in IE+RTL.</li>
<li><a href="http://dev.fckeditor.net/ticket/3982">#3982</a> : Fixed enterKey on empty list item result in weird dom structure.</li>
<li><a href="http://dev.fckeditor.net/ticket/4101">#4101</a> : Now it is possible to close dialog before gets focus.</li>
<li><a href="http://dev.fckeditor.net/ticket/4075">#4075</a> : [IE6/7]Fixed apply custom inline style with "class" attribute failed.</li>
<li><a href="http://dev.fckeditor.net/ticket/4087">#4087</a> : [Firefox]Fixed extra blocks created on create list when full document selected.</li>
<li><a href="http://dev.fckeditor.net/ticket/4097">#4097</a> : No undo/redo support for fontColor and backgroundColor buttons.</li>
<li><a href="http://dev.fckeditor.net/ticket/4111">#4111</a> : Fixed apply block style after inline style applied on full document error.</li>
<li><a href="http://dev.fckeditor.net/ticket/3622">#3622</a> : Fixed shift enter with selection not deleting highlighted text.</li>
<li><a href="http://dev.fckeditor.net/ticket/4092">#4092</a> : [IE6] Close button was missing for dialog without multiple tabs.</li>
<li><a href="http://dev.fckeditor.net/ticket/4003">#4003</a> : Markup on the image dialog was disrupted when removing the border input.</li>
<li><a href="http://dev.fckeditor.net/ticket/4096">#4096</a> : Editor content area was pushed down in IE RTL quirks.</li>
<li><a href="http://dev.fckeditor.net/ticket/4112">#4112</a> : [FF] Paste dialog had scrollbars in quirks.</li>
<li><a href="http://dev.fckeditor.net/ticket/4118">#4118</a> : Dialog dragging was
occasionally behaving strangely .</li>
<li><a href="http://dev.fckeditor.net/ticket/4077">#4077</a> : The toolbar combos
were rendering incorrectly in some languages, like Chinese.</li>
<li><a href="http://dev.fckeditor.net/ticket/3622">#3622</a> : The toolbar in the v2
skin was wrapping improperly in some languages.</li>
<li><a href="http://dev.fckeditor.net/ticket/4119">#4119</a> : Unable to edit image link with image dialog.</li>
<li><a href="http://dev.fckeditor.net/ticket/4117">#4117</a> : Fixed dialog error when transforming image into button.</li>
<li><a href="http://dev.fckeditor.net/ticket/4058">#4058</a> : [FF] wysiwyg mode is sometimes not been activated.</li>
<li><a href="http://dev.fckeditor.net/ticket/4114">#4114</a> : [IE] RTE + IE6/IE7 Quirks = dialog mispositoned.</li>
<li><a href="http://dev.fckeditor.net/ticket/4123">#4123</a> : Some dialog buttons were broken in IE7 quirks.</li>
<li><a href="http://dev.fckeditor.net/ticket/4122">#4122</a> : [IE] The image dialog
was being rendered improperly when loading an image with long URL.</li>
<li><a href="http://dev.fckeditor.net/ticket/4144">#4144</a> : Fixed the white-spaces at the end of &lt;pre&gt; is incorrectly removed.</li>
<li><a href="http://dev.fckeditor.net/ticket/4143">#4143</a> : Fixed element id is lost when extracting contents from the range.</li>
<li><a href="http://dev.fckeditor.net/ticket/4007">#4007</a> : [IE] Source area overflow from editor chrome.</li>
<li><a href="http://dev.fckeditor.net/ticket/4145">#4145</a> : Fixed the on demand
(&quot;basic&quot;) loading model of the editor.</li>
<li><a href="http://dev.fckeditor.net/ticket/4139">#4139</a> : Fixed list plugin regression of [3903].</li>
<li><a href="http://dev.fckeditor.net/ticket/4147">#4147</a> : Unify style text normalization logic when comparing styles.</li>
<li><a href="http://dev.fckeditor.net/ticket/4150">#4150</a> : Fixed enlarge list result incorrect at the inner boundary of block.</li>
<li><a href="http://dev.fckeditor.net/ticket/4164">#4164</a> : Now it is possible to paste text
in Source mode even if forcePasteAsPlainText = true.</li>
<li><a href="http://dev.fckeditor.net/ticket/4129">#4129</a> : [FF]Unable to remove list with Ctrl-A.</li>
<li><a href="http://dev.fckeditor.net/ticket/4172">#4172</a> : [Safari] The trailing
&lt;br&gt; was not been always added to blank lines ending with &amp;nbsp;.</li>
<li><a href="http://dev.fckeditor.net/ticket/4178">#4178</a> : It&#39;s now possible to
copy and paste Flash content among different editor instances.</li>
<li><a href="http://dev.fckeditor.net/ticket/4193">#4193</a> : Automatic font color produced empty span on Firefox 3.5.</li>
<li><a href="http://dev.fckeditor.net/ticket/4186">#4186</a> : [FF] Fixed First open float panel cause host page scrollbar blinking.</li>
<li><a href="http://dev.fckeditor.net/ticket/4227">#4227</a> : Fixed destroy editor instance created on textarea which is not within form cause error.</li>
<li><a href="http://dev.fckeditor.net/ticket/4240">#4240</a> : Fixed editor name containing hyphen break editor completely.</li>
<li><a href="http://dev.fckeditor.net/ticket/3828">#3828</a> : Malformed nested list is now corrected by the parser.</li>
</ul>
<h3>
CKEditor 3.0 RC</h3>
<p>
Changelog starts at this release.</p>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@ -0,0 +1,92 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Installation Guide - CKEditor</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style type="text/css">
h3
{
border-bottom: 1px solid #AAAAAA;
}
pre
{
background-color: #F9F9F9;
border: 1px dashed #2F6FAB;
padding: 1em;
line-height: 1.1em;
}
#footer hr
{
margin: 10px 0 15px 0;
height: 1px;
border: solid 1px gray;
border-bottom: none;
}
#footer p
{
margin: 0 10px 10px 10px;
float: left;
}
#footer #copy
{
float: right;
}
</style>
</head>
<body>
<h1>
CKEditor Installation Guide</h1>
<h3>
What&#39;s CKEditor?</h3>
<p>
CKEditor is a text editor to be used inside web pages. It&#39;s not a replacement
for desktop text editors like Word or OpenOffice, but a component to be used as
part of web applications and web sites.</p>
<h3>
Installation</h3>
<p>
Installing CKEditor is an easy task. Just follow these simple steps:</p>
<ol>
<li><strong>Download</strong> the latest version of the editor from our web site: <a
href="http://ckeditor.com">http://ckeditor.com</a>. You should have already completed
this step, but be sure you have the very latest version.</li>
<li><strong>Extract</strong> (decompress) the downloaded file into the root of your
web site.</li>
</ol>
<p>
<strong>Note:</strong> CKEditor is by default installed in the &quot;ckeditor&quot;
folder. You can place the files in whichever you want though.</p>
<h3>
Checking Your Installation
</h3>
<p>
The editor comes with a few sample pages that can be used to verify that installation
proceeded properly. Take a look at the <a href="_samples">_samples</a> directory.</p>
<p>
To test your installation, just call the following page at your web site:</p>
<pre>
http://&lt;your site&gt;/&lt;CKEditor installation path&gt;/_samples/index.html
For example:
http://www.example.com/ckeditor/_samples/index.html</pre>
<h3>
Documentation</h3>
<p>
The full editor documentation is available online at the following address:<br />
<a href="http://docs.cksource.com/ckeditor">http://docs.cksource.com/ckeditor</a></p>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,98 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Ajax - CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
//<![CDATA[
var editor;
function createEditor()
{
if ( editor )
return;
var html = document.getElementById( 'editorcontents' ).innerHTML;
// Create a new editor inside the <div id="editor">
editor = CKEDITOR.appendTo( 'editor' );
editor.setData( html );
// This sample may break here if the ckeditor_basic.js is used. In such case, the following code should be used instead:
/*
if ( editor.setData )
editor.setData( html );
else
CKEDITOR.on( 'loaded', function()
{
editor.setData( html );
});
*/
}
function removeEditor()
{
if ( !editor )
return;
// Retrieve the editor contents. In an Ajax application, this data would be
// sent to the server or used in any other way.
document.getElementById( 'editorcontents' ).innerHTML = editor.getData();
document.getElementById( 'contents' ).style.display = '';
// Destroy the editor.
editor.destroy();
editor = null;
}
//]]>
</script>
</head>
<body>
<h1>
CKEditor Sample
</h1>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<p>
<input onclick="createEditor();" type="button" value="Create Editor" />
<input onclick="removeEditor();" type="button" value="Remove Editor" />
</p>
<!-- This div will hold the editor. -->
<div id="editor">
</div>
<div id="contents" style="display: none">
<p>
Edited Contents:</p>
<!-- This div will be used to display the editor contents. -->
<div id="editorcontents">
</div>
</div>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@ -0,0 +1,152 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>API usage - CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
//<![CDATA[
// The instanceReady event is fired when an instance of CKEditor has finished
// its initialization.
CKEDITOR.on( 'instanceReady', function( ev )
{
// Show the editor name and description in the browser status bar.
document.getElementById( 'eMessage' ).innerHTML = '<p>Instance "' + ev.editor.name + '" loaded.<\/p>';
// Show this sample buttons.
document.getElementById( 'eButtons' ).style.visibility = '';
});
function InsertHTML()
{
// Get the editor instance that we want to interact with.
var oEditor = CKEDITOR.instances.editor1;
var value = document.getElementById( 'plainArea' ).value;
// Check the active editing mode.
if ( oEditor.mode == 'wysiwyg' )
{
// Insert the desired HTML.
oEditor.insertHtml( value );
}
else
alert( 'You must be on WYSIWYG mode!' );
}
function SetContents()
{
// Get the editor instance that we want to interact with.
var oEditor = CKEDITOR.instances.editor1;
var value = document.getElementById( 'plainArea' ).value;
// Set the editor contents (replace the actual one).
oEditor.setData( value );
}
function GetContents()
{
// Get the editor instance that we want to interact with.
var oEditor = CKEDITOR.instances.editor1;
// Get the editor contents
alert( oEditor.getData() );
}
function ExecuteCommand(commandName)
{
// Get the editor instance that we want to interact with.
var oEditor = CKEDITOR.instances.editor1;
// Check the active editing mode.
if ( oEditor.mode == 'wysiwyg' )
{
// Execute the command.
oEditor.execCommand( commandName );
}
else
alert( 'You must be on WYSIWYG mode!' );
}
function CheckDirty()
{
// Get the editor instance that we want to interact with.
var oEditor = CKEDITOR.instances.editor1;
alert( oEditor.checkDirty() );
}
function ResetDirty()
{
// Get the editor instance that we want to interact with.
var oEditor = CKEDITOR.instances.editor1;
oEditor.resetDirty();
alert( 'The "IsDirty" status has been reset' );
}
//]]>
</script>
</head>
<body>
<h1>
CKEditor Sample
</h1>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<form action="sample_posteddata.php" method="post">
<p>
This sample shows how to use the CKeditor JavaScript API to interact with the editor
at runtime.</p>
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
// Replace the <textarea id="editor1"> with an CKEditor instance.
var editor = CKEDITOR.replace( 'editor1' );
//]]>
</script>
<div id="eMessage">
</div>
<div id="eButtons" style="visibility: hidden">
<input onclick="InsertHTML();" type="button" value="Insert HTML" />
<input onclick="SetContents();" type="button" value="Set Editor Contents" />
<input onclick="GetContents();" type="button" value="Get Editor Contents (XHTML)" />
<br />
<textarea cols="80" id="plainArea" rows="3">&lt;h2&gt;Test&lt;/h2&gt;&lt;p&gt;This is some &lt;a href="/Test1.html"&gt;sample&lt;/a&gt; HTML&lt;/p&gt;</textarea>
<br />
<br />
<input onclick="ExecuteCommand('bold');" type="button" value="Execute &quot;bold&quot; Command" />
<input onclick="ExecuteCommand('link');" type="button" value="Execute &quot;link&quot; Command" />
<br />
<br />
<input onclick="CheckDirty();" type="button" value="checkDirty()" />
<input onclick="ResetDirty();" type="button" value="resetDirty()" />
</div>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@ -0,0 +1,181 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Using API to customize dialogs - CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
<style id="styles" type="text/css">
.cke_button_myDialogCmd .cke_icon
{
display: none !important;
}
.cke_button_myDialogCmd .cke_label
{
display: inline !important;
}
</style>
<script type="text/javascript">
//<![CDATA[
// When opening a dialog, its "definition" is created for it, for
// each editor instance. The "dialogDefinition" event is then
// fired. We should use this event to make customizations to the
// definition of existing dialogs.
CKEDITOR.on( 'dialogDefinition', function( ev )
{
// Take the dialog name and its definition from the event
// data.
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
// Check if the definition is from the dialog we're
// interested on (the "Link" dialog).
if ( dialogName == 'link' )
{
// Get a reference to the "Link Info" tab.
var infoTab = dialogDefinition.getContents( 'info' );
// Add a text field to the "info" tab.
infoTab.add( {
type : 'text',
label : 'My Custom Field',
id : 'customField',
'default' : 'Sample!',
validate : function()
{
if ( /\d/.test( this.getValue() ) )
return 'My Custom Field must not contain digits';
}
});
// Remove the "Link Type" combo and the "Browser
// Server" button from the "info" tab.
infoTab.remove( 'linkType' );
infoTab.remove( 'browse' );
// Set the default value for the URL field.
var urlField = infoTab.get( 'url' );
urlField['default'] = 'www.example.com';
// Remove the "Target" tab from the "Link" dialog.
dialogDefinition.removeContents( 'target' );
// Add a new tab to the "Link" dialog.
dialogDefinition.addContents({
id : 'customTab',
label : 'My Tab',
accessKey : 'M',
elements : [
{
id : 'myField1',
type : 'text',
label : 'My Text Field'
},
{
id : 'myField2',
type : 'text',
label : 'Another Text Field'
}
]
});
}
});
//]]>
</script>
</head>
<body>
<h1>
CKEditor Sample
</h1>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<!-- This <fieldset> holds the HTML that you will usually find in your
pages. -->
<p>
This sample shows how to use the dialog API to customize dialogs whithout changing
the original editor code. The following customizations are being done::</p>
<ol>
<li><strong>Add dialog pages</strong> ("My Tab" in the Link dialog).</li>
<li><strong>Remove a dialog tab</strong> ("Target" tab from the Link dialog).</li>
<li><strong>Add dialog fields</strong> ("My Custom Field" into the Link dialog).</li>
<li><strong>Remove dialog fields</strong> ("Link Type" and "Browser Server" the Link
dialog).</li>
<li><strong>Set default values for dialog fields</strong> (for the "URL" field in the
Link dialog). </li>
<li><strong>Create a custom dialog</strong> ("My Dialog" button).</li>
</ol>
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
// Replace the <textarea id="editor1"> with an CKEditor instance.
var editor = CKEDITOR.replace( 'editor1',
{
// Defines a simpler toolbar to be used in this sample.
// Note that we have added out "MyButton" button here.
toolbar : [ [ 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike','-','Link', '-', 'MyButton' ] ]
});
// Listen for the "pluginsLoaded" event, so we are sure that the
// "dialog" plugin has been loaded and we are able to do our
// customizations.
editor.on( 'pluginsLoaded', function( ev )
{
// If our custom dialog has not been registered, do that now.
if ( !CKEDITOR.dialog.exists( 'myDialog' ) )
{
// We need to do the following trick to find out the dialog
// definition file URL path. In the real world, you would simply
// point to an absolute path directly, like "/mydir/mydialog.js".
var href = document.location.href.split( '/' );
href.pop();
href.push( 'api_dialog', 'my_dialog.js' );
href = href.join( '/' );
// Finally, register the dialog.
CKEDITOR.dialog.add( 'myDialog', href );
}
// Register the command used to open the dialog.
editor.addCommand( 'myDialogCmd', new CKEDITOR.dialogCommand( 'myDialog' ) );
// Add the a custom toolbar buttons, which fires the above
// command..
editor.ui.addButton( 'MyButton',
{
label : 'My Dialog',
command : 'myDialogCmd'
} );
});
//]]>
</script>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@ -0,0 +1,28 @@
/*
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'
}
]
}
]
};
} );

View File

@ -0,0 +1,137 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Replace DIV - CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
<style id="styles" type="text/css">
div.editable
{
border: solid 2px Transparent;
padding-left: 15px;
padding-right: 15px;
}
div.editable:hover
{
border-color: black;
}
</style>
<script type="text/javascript">
//<![CDATA[
// Uncomment the following code to test the "Timeout Loading Method".
// CKEDITOR.loadFullCoreTimeout = 5;
window.onload = function()
{
// Listen to the double click event.
if ( window.addEventListener )
document.body.addEventListener( 'dblclick', onDoubleClick, false );
else if ( window.attachEvent )
document.body.attachEvent( 'ondblclick', onDoubleClick );
};
function onDoubleClick( ev )
{
// Get the element which fired the event. This is not necessarily the
// element to which the event has been attached.
var element = ev.target || ev.srcElement;
// Find out the div that holds this element.
element = element.parentNode;
if ( element.nodeName.toLowerCase() == 'div'
&& ( element.className.indexOf( 'editable' ) != -1 ) )
replaceDiv( element );
}
var editor;
function replaceDiv( div )
{
if ( editor )
editor.destroy();
editor = CKEDITOR.replace( div );
}
//]]>
</script>
</head>
<body>
<h1>
CKEditor Sample
</h1>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<p>
Double-click on any of the following DIVs to transform them into editor instances.</p>
<div class="editable">
<h3>
Part 1</h3>
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras et ipsum quis mi
semper accumsan. Integer pretium dui id massa. Suspendisse in nisl sit amet urna
rutrum imperdiet. Nulla eu tellus. Donec ante nisi, ullamcorper quis, fringilla
nec, sagittis eleifend, pede. Nulla commodo interdum massa. Donec id metus. Fusce
eu ipsum. Suspendisse auctor. Phasellus fermentum porttitor risus.
</p>
</div>
<div class="editable">
<h3>
Part 2</h3>
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras et ipsum quis mi
semper accumsan. Integer pretium dui id massa. Suspendisse in nisl sit amet urna
rutrum imperdiet. Nulla eu tellus. Donec ante nisi, ullamcorper quis, fringilla
nec, sagittis eleifend, pede. Nulla commodo interdum massa. Donec id metus. Fusce
eu ipsum. Suspendisse auctor. Phasellus fermentum porttitor risus.
</p>
<p>
Donec velit. Mauris massa. Vestibulum non nulla. Nam suscipit arcu nec elit. Phasellus
sollicitudin iaculis ante. Ut non mauris et sapien tincidunt adipiscing. Vestibulum
vitae leo. Suspendisse nec mi tristique nulla laoreet vulputate.
</p>
</div>
<div class="editable">
<h3>
Part 3</h3>
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras et ipsum quis mi
semper accumsan. Integer pretium dui id massa. Suspendisse in nisl sit amet urna
rutrum imperdiet. Nulla eu tellus. Donec ante nisi, ullamcorper quis, fringilla
nec, sagittis eleifend, pede. Nulla commodo interdum massa. Donec id metus. Fusce
eu ipsum. Suspendisse auctor. Phasellus fermentum porttitor risus.
</p>
</div>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@ -0,0 +1,88 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ENTER Key Configuration - CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
//<![CDATA[
var editor;
function changeEnter()
{
// If we already have an editor, let's destroy it first.
if ( editor )
editor.destroy( true );
// Create the editor again, with the appropriate settings.
editor = CKEDITOR.replace( 'editor1',
{
enterMode : Number( document.getElementById( 'xEnter' ).value ),
shiftEnterMode : Number( document.getElementById( 'xShiftEnter' ).value )
});
}
window.onload = changeEnter;
//]]>
</script>
</head>
<body>
<h1>
CKEditor Sample
</h1>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<div style="float: left; margin-right: 20px">
When ENTER is pressed:<br />
<select id="xEnter" onchange="changeEnter();">
<option selected="selected" value="1">Create new &lt;P&gt; (recommended)</option>
<option value="3">Create new &lt;DIV&gt;</option>
<option value="2">Break the line with a &lt;BR&gt;</option>
</select>
</div>
<div style="float: left">
When SHIFT + ENTER is pressed:<br />
<select id="xShiftEnter" onchange="changeEnter();">
<option value="1">Create new &lt;P&gt;</option>
<option value="3">Create new &lt;DIV&gt;</option>
<option selected="selected" value="2">Break the line with a &lt;BR&gt; (recommended)</option>
</select>
</div>
<br style="clear: both" />
<form action="sample_posteddata.php" method="post">
<p>
<br />
<textarea cols="80" id="editor1" name="editor1" rows="10">This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.</textarea>
</p>
<p>
<input type="submit" value="Submit" />
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@ -0,0 +1,62 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Full Page Editing - CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>
CKEditor Sample
</h1>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<form action="sample_posteddata.php" method="post">
<p>
In this sample the editor is configured to edit entire HTML pages, from the &lt;html&gt;
tag to &lt;/html&gt;.</p>
<p>
<label for="editor1">
Editor 1:</label><br />
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;html&gt;&lt;head&gt;&lt;title&gt;CKEditor Sample&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
CKEDITOR.replace( 'editor1',
{
fullPage : true
});
//]]>
</script>
</p>
<p>
<input type="submit" value="Submit" />
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@ -0,0 +1,53 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Samples List - CKEditor</title>
<link type="text/css" rel="stylesheet" href="sample.css" />
</head>
<body>
<h1>
CKEditor Samples List
</h1>
<h2>
Basic Samples
</h2>
<ul>
<li><a href="replacebyclass.html">Replace textareas by class name</a></li>
<li><a href="replacebycode.html">Replace textareas by code</a></li>
<li><a href="fullpage.html">Full page support (editing from &lt;html&gt; to &lt;/html&gt;)</a></li>
</ul>
<h2>
Basic Customization
</h2>
<ul>
<li><a href="skins.html">Skins</a></li>
<li><a href="ui_color.html">User Interface Color</a></li>
<li><a href="ui_languages.html">User Interface Languages</a></li>
</ul>
<h2>
Advanced Samples
</h2>
<ul>
<li><a href="divreplace.html">Replace DIV elements on the fly</a>&nbsp; </li>
<li><a href="ajax.html">Create and destroy editor instances for Ajax applications</a></li>
<li><a href="api.html">Basic usage of the API</a></li>
<li><a href="api_dialog.html">Using the JavaScript API to customize dialogs</a></li>
<li><a href="enterkey.html">Using the "Enter" key in CKEditor</a></li>
<li><a href="sharedspaces.html">Shared toolbars</a></li>
<li><a href="jqueryadapter.html">jQuery adapter example</a></li>
</ul>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@ -0,0 +1,73 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery adapter - CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
<script type="text/javascript" src="../ckeditor.js"></script>
<script type="text/javascript" src="../adapters/jquery.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
//<![CDATA[
$(function()
{
var config = {
toolbar:
[
['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink'],
['UIColor']
]
};
// Initialize the editor.
// Callback function can be passed and executed after full instance creation.
$('.jquery_ckeditor').ckeditor(config);
});
//]]>
</script>
</head>
<body>
<h1>
CKEditor Sample
</h1>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<!-- This <fieldset> holds the HTML that you will usually find in your
pages. -->
<form action="sample_posteddata.php" method="post">
<p>
<label for="editor1">
Editor 1:</label><br />
<textarea class="jquery_ckeditor" cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
</p>
<p>
<input type="submit" value="Submit" />
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@ -0,0 +1,92 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sample - CKEditor</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<link href="../sample.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h1>
CKEditor Sample
</h1>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<!-- This <fieldset> holds the HTML that you will usually find in your pages. -->
<fieldset title="Output">
<legend>Output</legend>
<form action="../sample_posteddata.php" method="post">
<p>
<label>Editor 1:</label><br/>
</p>
<?php
// Include CKEditor class.
include("../../ckeditor.php");
// Create class instance.
$CKEditor = new CKEditor();
// Do not print the code directly to the browser, return it instead
$CKEditor->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 = '<p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p>';
// Create first instance.
$code = $CKEditor->editor("editor1", $initialValue);
echo $code;
?>
<p>
<label>Editor 2:</label><br/>
</p>
<?php
// Configuration that will be used only by the second editor.
$config['toolbar'] = array(
array( 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike' ),
array( 'Image', 'Link', 'Unlink', 'Anchor' )
);
$config['skin'] = 'v2';
// Create second instance.
echo $CKEditor->editor("editor2", $initialValue, $config);
?>
<input type="submit" value="Submit"/>
</p>
</form>
</fieldset>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@ -0,0 +1,129 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sample - CKEditor</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<link href="../sample.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h1>
CKEditor Sample
</h1>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<!-- This <fieldset> holds the HTML that you will usually find in your pages. -->
<fieldset title="Output">
<legend>Output</legend>
<form action="../sample_posteddata.php" method="post">
<p>
<label>Editor 1:</label><br/>
</p>
<?php
/**
* Adds global event, will hide "Target" tab in Link dialog in all instances.
*/
function CKEditorHideLinkTargetTab(&$CKEditor) {
$function = 'function (ev) {
// Take the dialog name and its definition from the event data
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
// Check if the definition is from the Link dialog.
if ( dialogName == "link" )
dialogDefinition.removeContents("target")
}';
$CKEditor->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 = '<p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p>';
// 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();
?>
<p>
<label>Editor 2:</label><br/>
</p>
<?php
// Configuration that will be used only by the second editor.
$config['width'] = '600';
$config['toolbar'] = 'Basic';
// Add some global event handlers (for all editors).
CKEditorHideLinkTargetTab($CKEditor);
CKEditorNotifyAboutOpenedDialog($CKEditor);
// Event that will be handled only by the second editor.
// Instead of calling addEventHandler(), events may be passed as an argument.
$events['instanceReady'] = 'function (evt) {
alert("Loaded second editor: " + evt.editor.name);
}';
// Create second instance.
$CKEditor->editor("editor2", $initialValue, $config, $events);
?>
<input type="submit" value="Submit"/>
</p>
</form>
</fieldset>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@ -0,0 +1,63 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sample - CKEditor</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<link href="../sample.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h1>
CKEditor Sample
</h1>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<!-- This <fieldset> holds the HTML that you will usually find in your pages. -->
<fieldset title="Output">
<legend>Output</legend>
<form action="../sample_posteddata.php" method="post">
<p>
<label for="editor1">
Editor 1:</label><br/>
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
</p>
<p>
<input type="submit" value="Submit"/>
</p>
</form>
</fieldset>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
<?php
// Include CKEditor class.
include_once "../../ckeditor.php";
// 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 = '../../';
// Replace textarea with id (or name) "editor1".
$CKEditor->replace("editor1");
?>
</body>
</html>

View File

@ -0,0 +1,68 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sample - CKEditor</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<link href="../sample.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h1>
CKEditor Sample
</h1>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<!-- This <fieldset> holds the HTML that you will usually find in your pages. -->
<fieldset title="Output">
<legend>Output</legend>
<form action="../sample_posteddata.php" method="post">
<p>
<label for="editor1">
Editor 1:</label><br/>
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
</p>
<p>
<label for="editor2">
Editor 2:</label><br/>
<textarea cols="80" id="editor2" name="editor2" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
</p>
<p>
<input type="submit" value="Submit"/>
</p>
</form>
</fieldset>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
<?php
// Include CKEditor class.
include("../../ckeditor.php");
// 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 = '../../';
// Replace all textareas with CKEditor.
$CKEditor->replaceAll();
?>
</body>
</html>

View File

@ -0,0 +1,64 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sample - CKEditor</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<link href="../sample.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h1>
CKEditor Sample
</h1>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<!-- This <fieldset> holds the HTML that you will usually find in your pages. -->
<fieldset title="Output">
<legend>Output</legend>
<form action="../sample_posteddata.php" method="post">
<p>
<label for="editor1">
Editor 1:</label><br/>
</p>
<p>
<?php
// Include CKEditor class.
include_once "../../ckeditor.php";
// The initial value to be displayed in the editor.
$initialValue = '<p>This is some <strong>sample text</strong>.</p>';
// 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);
?>
<input type="submit" value="Submit"/>
</p>
</form>
</fieldset>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@ -0,0 +1,49 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Replace Textareas by Class Name - CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>
CKEditor Sample
</h1>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<form action="sample_posteddata.php" method="post">
<p>
<label for="editor1">
Editor 1:</label><br />
<textarea class="ckeditor" cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
</p>
<p>
<input type="submit" value="Submit" />
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@ -0,0 +1,80 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Replace Textarea by Code - CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>
CKEditor Sample
</h1>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<form action="sample_posteddata.php" method="post">
<p>
<label for="editor1">
Editor 1:</label><br />
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
// This call can be placed at any point after the
// <textarea>, or inside a <head><script> in a
// window.onload event handler.
// Replace the <textarea id="editor"> with an CKEditor
// instance, using default configurations.
CKEDITOR.replace( 'editor1' );
//]]>
</script>
</p>
<p>
<label for="editor2">
Editor 2:</label><br />
<textarea cols="80" id="editor2" name="editor2" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
// This call can be placed at any point after the
// <textarea>, or inside a <head><script> in a
// window.onload event handler.
// Replace the <textarea id="editor"> with an CKEditor
// instance, using default configurations.
CKEDITOR.replace( 'editor2' );
//]]>
</script>
</p>
<p>
<input type="submit" value="Submit" />
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@ -0,0 +1,81 @@
/*
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 */
}

View File

@ -0,0 +1,65 @@
/*
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 = '<p><strong>Your browser is not compatible with CKEditor.</strong>';
var browsers =
{
gecko : 'Firefox 2.0',
ie : 'Internet Explorer 6.0',
opera : 'Opera 9.5',
webkit : 'Safari 3.0'
};
var alsoBrowsers = '';
for ( var key in env )
{
if ( browsers[ key ] )
{
if ( env[key] )
html += ' CKEditor is compatible with ' + browsers[ key ] + ' or higher.';
else
alsoBrowsers += browsers[ key ] + '+, ';
}
}
alsoBrowsers = alsoBrowsers.replace( /\+,([^,]+), $/, '+ and $1' );
html += ' It is also compatible with ' + alsoBrowsers + '.';
html += '</p><p>With non compatible browsers, you should still be able to see and edit the contents (HTML) in a plain text field.</p>';
var alertsEl = document.getElementById( 'alerts' );
alertsEl && ( alertsEl.innerHTML = html );
};
var onload = function()
{
// Show a friendly compatibility message as soon as the page is loaded,
// for those browsers that are not compatible with CKEditor.
if ( !CKEDITOR.env.isCompatible )
showCompatibilityMsg();
};
// Register the onload listener.
if ( window.addEventListener )
window.addEventListener( 'load', onload, false );
else if ( window.attachEvent )
window.attachEvent( 'onload', onload );
})();
}

View File

@ -0,0 +1,59 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sample - CKEditor</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="sample.css" />
</head>
<body>
<h1>
CKEditor - Posted Data
</h1>
<table border="1" cellspacing="0" id="outputSample">
<colgroup><col width="100" /></colgroup>
<thead>
<tr>
<th>Field&nbsp;Name</th>
<th>Value</th>
</tr>
</thead>
<?php
if ( isset( $_POST ) )
$postArray = &$_POST ; // 4.1.0 or later, use $_POST
else
$postArray = &$HTTP_POST_VARS ; // prior to 4.1.0, use HTTP_POST_VARS
foreach ( $postArray as $sForm => $value )
{
if ( get_magic_quotes_gpc() )
$postedValue = htmlspecialchars( stripslashes( $value ) ) ;
else
$postedValue = htmlspecialchars( $value ) ;
?>
<tr>
<th style="vertical-align: top"><?php echo $sForm?></th>
<td><pre><?php echo $postedValue?></pre></td>
</tr>
<?php
}
?>
</table>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@ -0,0 +1,136 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Shared toolbars - CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
<style id="styles" type="text/css">
#editorsForm
{
height: 400px;
overflow: auto;
border: solid 1px #555;
margin: 10px 0;
padding: 0 10px;
}
</style>
</head>
<body>
<h1>
CKEditor Sample
</h1>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<div id="topSpace">
</div>
<form action="sample_posteddata.php" id="editorsForm" method="post">
<p>
<label for="editor1">
Editor 1 (uses the shared toolbar and element path):</label><br />
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
CKEDITOR.replace( 'editor1',
{
sharedSpaces :
{
top : 'topSpace',
bottom : 'bottomSpace'
},
// Removes the maximize plugin as it's not usable
// in a shared toolbar.
// Removes the resizer as it's not usable in a
// shared elements path.
removePlugins : 'maximize,resize'
} );
//]]>
</script>
</p>
<p>
<label for="editor2">
Editor 2 (uses the shared toolbar and element path):</label><br />
<textarea cols="80" id="editor2" name="editor2" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
CKEDITOR.replace( 'editor2',
{
sharedSpaces :
{
top : 'topSpace',
bottom : 'bottomSpace'
},
// Removes the maximize plugin as it's not usable
// in a shared toolbar.
// Removes the resizer as it's not usable in a
// shared elements path.
removePlugins : 'maximize,resize'
} );
//]]>
</script>
</p>
<p>
<label for="editor3">
Editor 3 (uses the shared toolbar only):</label><br />
<textarea cols="80" id="editor3" name="editor3" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
CKEDITOR.replace( 'editor3',
{
sharedSpaces :
{
top : 'topSpace'
},
// Removes the maximize plugin as it's not usable
// in a shared toolbar.
removePlugins : 'maximize'
} );
//]]>
</script>
</p>
<p>
<label for="editor4">
Editor 4 (no shared spaces):</label><br />
<textarea cols="80" id="editor4" name="editor4" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
CKEDITOR.replace( 'editor4' );
//]]>
</script>
</p>
<p>
<input type="submit" value="Submit" />
</p>
</form>
<div id="bottomSpace">
</div>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@ -0,0 +1,83 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Skins - CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>
CKEditor Sample
</h1>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<form action="sample_posteddata.php" method="post">
<p>
"Kama" skin:<br />
<textarea cols="80" id="editor_kama" name="editor_kama" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
CKEDITOR.replace( 'editor_kama',
{
skin : 'kama'
});
//]]>
</script>
</p>
<p>
"Office 2003" skin:<br />
<textarea cols="80" id="editor_office2003" name="editor_office2003" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
CKEDITOR.replace( 'editor_office2003',
{
skin : 'office2003'
});
//]]>
</script>
</p>
<p>
"V2" skin:<br />
<textarea cols="80" id="editor_v2" name="editor_v2" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
CKEDITOR.replace( 'editor_v2',
{
skin : 'v2'
});
//]]>
</script>
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@ -0,0 +1,87 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>UI Color Setting Tool - CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>
CKEditor Sample
</h1>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<p>
Click the UI Color Picker button to test your color preferences at runtime.</p>
<form action="sample_posteddata.php" method="post">
<p>
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
// Replace the <textarea id="editor"> with an CKEditor
// instance, using default configurations.
CKEDITOR.replace( 'editor1',
{
extraPlugins : 'uicolor',
toolbar :
[
[ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],
[ 'UIColor' ]
]
});
//]]>
</script>
</p>
<p>
<textarea cols="80" id="editor2" name="editor2" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
// Replace the <textarea id="editor"> with an CKEditor
// instance, using default configurations.
CKEDITOR.replace( 'editor2',
{
extraPlugins : 'uicolor',
uiColor: '#14B8C4',
toolbar :
[
[ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],
[ 'UIColor' ]
]
} );
//]]>
</script>
</p>
<p>
<input type="submit" value="Submit" />
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@ -0,0 +1,106 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>User Interface Globalization - CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script type="text/javascript" src="../lang/_languages.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>
CKEditor Sample
</h1>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<form action="sample_posteddata.php" method="post">
<p>
<label for="editor1">
Available languages (<span id="count"> </span>languages!):</label><br />
<select disabled="disabled" id="languages" onchange="createEditor( this.value );">
<script type="text/javascript">
//<![CDATA[
// Get the language list from the _languages.js file.
for ( var i = 0 ; i < window.CKEDITOR_LANGS.length ; i++ )
{
document.write(
'<option value="' + window.CKEDITOR_LANGS[i].code + '">' +
window.CKEDITOR_LANGS[i].name +
'</option>' );
}
//]]>
</script>
</select>
<br />
<span style="color: #888888">(You may see strange characters if your system doesn't
support the selected language)</span>
</p>
<p>
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
// Set the number of languages.
document.getElementById( 'count' ).innerHTML = window.CKEDITOR_LANGS.length;
var editor;
function createEditor( languageCode )
{
if ( editor )
editor.destroy();
// Replace the <textarea id="editor"> with an CKEditor
// instance, using default configurations.
editor = CKEDITOR.replace( 'editor1',
{
language : languageCode,
on :
{
instanceReady : function()
{
// Wait for the editor to be ready to set
// the language combo.
var languages = document.getElementById( 'languages' );
languages.value = this.langCode;
languages.disabled = false;
}
}
} );
}
// At page startup, load the default language:
createEditor( '' );
//]]>
</script>
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@ -0,0 +1,293 @@
/*
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
* <script src="jquery.js"></script>
* <script src="ckeditor.js"></script>
* <script src="adapters/jquery/adapter.js"></script>
*/
(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 );
// Unbind when editor destroyed.
$element.bind( 'destroy.ckeditor', function()
{
$element.parents( 'form' ).unbind( 'submit', 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;
};
});
}
})();

View File

@ -0,0 +1,78 @@
/*
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()
{
// 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(
'<div style="width:0px;height:0px;' +
'position:absolute;left:-10000px;' +
'background-image:url(' + backgroundImageUrl + ')"></div>', 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.
}
}
*/

View File

@ -0,0 +1,143 @@
/*
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 );
}
};
})();

View File

@ -0,0 +1,96 @@
/*
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( <b>CKEDITOR.instances</b>.editor1.name ); // "editor1"
*/
CKEDITOR.instances = {};
/**
* The document of the window holding the CKEDITOR object.
* @type {CKEDITOR.dom.document}
* @example
* alert( <b>CKEDITOR.document</b>.getBody().getName() ); // "body"
*/
CKEDITOR.document = new CKEDITOR.dom.document( document );
/**
* Adds an editor instance to the global {@link CKEDITOR} object. This function
* is available for internal use mainly.
* @param {CKEDITOR.editor} editor The editor instance to be added.
* @example
*/
CKEDITOR.add = function( editor )
{
CKEDITOR.instances[ editor.name ] = editor;
editor.on( 'focus', function()
{
if ( CKEDITOR.currentInstance != editor )
{
CKEDITOR.currentInstance = editor;
CKEDITOR.fire( 'currentInstance' );
}
});
editor.on( 'blur', function()
{
if ( CKEDITOR.currentInstance == editor )
{
CKEDITOR.currentInstance = null;
CKEDITOR.fire( 'currentInstance' );
}
});
};
/**
* Removes and editor instance from the global {@link CKEDITOR} object. his function
* is available for internal use mainly.
* @param {CKEDITOR.editor} editor The editor instance to be added.
* @example
*/
CKEDITOR.remove = function( editor )
{
delete CKEDITOR.instances[ editor.name ];
};
// Load the bootstrap script.
CKEDITOR.loader.load( 'core/_bootstrap' ); // @Packager.RemoveLine
// Tri-state constants.
/**
* Used to indicate the ON or ACTIVE state.
* @constant
* @example
*/
CKEDITOR.TRISTATE_ON = 1;
/**
* Used to indicate the OFF or NON ACTIVE state.
* @constant
* @example
*/
CKEDITOR.TRISTATE_OFF = 2;
/**
* Used to indicate DISABLED state.
* @constant
* @example
*/
CKEDITOR.TRISTATE_DISABLED = 0;

View File

@ -0,0 +1,190 @@
/*
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.1 SVN',rev:'4867',_:{},status:'unloaded',basePath:(function(){var d=window.CKEDITOR_BASEPATH||'';if(!d){var e=document.getElementsByTagName('script');for(var f=0;f<e.length;f++){var g=e[f].src.match(/(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i);if(g){d=g[1];break;}}}if(d.indexOf('://')==-1)if(d.indexOf('/')===0)d=location.href.match(/^.*?:\/\/[^\/]*/)[0]+d;else d=location.href.match(/^[^\?]*\/(?:)/)[0]+d;return d;})(),getUrl:function(d){if(d.indexOf('://')==-1&&d.indexOf('/')!==0)d=this.basePath+d;if(this.timestamp&&d.charAt(d.length-1)!='/')d+=(d.indexOf('?')>=0?'&':'?')+('t=')+this.timestamp;return d;}},b=window.CKEDITOR_GETURL;if(b){var c=a.getUrl;a.getUrl=function(d){return b.call(a,d)||c.call(a,d);};}return a;})();
// #### Raw code
// ATTENTION: read the above "Compressed Code" notes when changing this code.
if ( !window.CKEDITOR )
{
/**
* This is the API entry point. The entire CKEditor code runs under this object.
* @name CKEDITOR
* @namespace
* @example
*/
window.CKEDITOR = (function()
{
var CKEDITOR =
/** @lends CKEDITOR */
{
/**
* A constant string unique for each release of CKEditor. Its value
* is used, by default, to build the URL for all resources loaded
* by the editor code, guaranteing clean cache results when
* upgrading.
* @type String
* @example
* alert( CKEDITOR.timestamp ); // e.g. '87dm'
*/
// The production implementation contains a fixed timestamp, unique
// for each release, generated by the releaser.
// (Base 36 value of each component of YYMMDDHH - 4 chars total - e.g. 87bm == 08071122)
timestamp : 'A038',
/**
* Contains the CKEditor version number.
* @type String
* @example
* alert( CKEDITOR.version ); // e.g. 'CKEditor 3.0 Beta'
*/
version : '3.1 SVN',
/**
* 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 : '4867',
/**
* Private object used to hold core stuff. It should not be used out of
* the API code as properties defined here may change at any time
* without notice.
* @private
*/
_ : {},
/**
* Indicates the API loading status. The following status are available:
* <ul>
* <li><b>unloaded</b>: the API is not yet loaded.</li>
* <li><b>basic_loaded</b>: the basic API features are available.</li>
* <li><b>basic_ready</b>: the basic API is ready to load the full core code.</li>
* <li><b>loading</b>: the full API is being loaded.</li>
* <li><b>ready</b>: the API can be fully used.</li>
* </ul>
* @type String
* @example
* if ( <b>CKEDITOR.status</b> == 'ready' )
* {
* // The API can now be fully used.
* }
*/
status : 'unloaded',
/**
* Contains the full URL for the CKEditor installation directory.
* It's possible to manually provide the base path by setting a
* global variable named CKEDITOR_BASEPATH. This global variable
* must be set "before" the editor script loading.
* @type String
* @example
* alert( <b>CKEDITOR.basePath</b> ); // "http://www.example.com/ckeditor/" (e.g.)
*/
basePath : (function()
{
// ATTENTION: fixes on this code must be ported to
// var basePath in "core/loader.js".
// Find out the editor directory path, based on its <script> tag.
var path = window.CKEDITOR_BASEPATH || '';
if ( !path )
{
var scripts = document.getElementsByTagName( 'script' );
for ( var i = 0 ; i < scripts.length ; i++ )
{
var match = scripts[i].src.match( /(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i );
if ( match )
{
path = match[1];
break;
}
}
}
// In IE (only) the script.src string is the raw valued entered in the
// HTML. Other browsers return the full resolved URL instead.
if ( path.indexOf('://') == -1 )
{
// Absolute path.
if ( path.indexOf( '/' ) === 0 )
path = location.href.match( /^.*?:\/\/[^\/]*/ )[0] + path;
// Relative path.
else
path = location.href.match( /^[^\?]*\/(?:)/ )[0] + path;
}
return path;
})(),
/**
* Gets the full URL for CKEditor resources. By default, URLs
* returned by this function contains a querystring parameter ("t")
* set to the {@link CKEDITOR.timestamp} value.
* It's possible to provide a custom implementation to this
* function by setting a global variable named CKEDITOR_GETURL.
* This global variable must be set "before" the editor script
* loading. If the custom implementation returns nothing, the
* default implementation is used.
* @returns {String} The full URL.
* @example
* // e.g. http://www.example.com/ckeditor/skins/default/editor.css?t=87dm
* alert( CKEDITOR.getUrl( 'skins/default/editor.css' ) );
* @example
* // e.g. http://www.example.com/skins/default/editor.css?t=87dm
* alert( CKEDITOR.getUrl( '/skins/default/editor.css' ) );
* @example
* // e.g. http://www.somesite.com/skins/default/editor.css?t=87dm
* alert( CKEDITOR.getUrl( 'http://www.somesite.com/skins/default/editor.css' ) );
*/
getUrl : function( resource )
{
// If this is not a full or absolute path.
if ( resource.indexOf('://') == -1 && resource.indexOf( '/' ) !== 0 )
resource = this.basePath + resource;
// Add the timestamp, except for directories.
if ( this.timestamp && resource.charAt( resource.length - 1 ) != '/' )
resource += ( resource.indexOf( '?' ) >= 0 ? '&' : '?' ) + 't=' + this.timestamp;
return resource;
}
};
// Make it possible to override the getUrl function with a custom
// implementation pointing to a global named CKEDITOR_GETURL.
var newGetUrl = window.CKEDITOR_GETURL;
if ( newGetUrl )
{
var originalGetUrl = CKEDITOR.getUrl;
CKEDITOR.getUrl = function ( resource )
{
return newGetUrl.call( CKEDITOR, resource ) ||
originalGetUrl.call( CKEDITOR, resource );
};
}
return CKEDITOR;
})();
}
// PACKAGER_RENAME( CKEDITOR )

View File

@ -0,0 +1,241 @@
/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Contains the second part of the {@link CKEDITOR} object
* definition, which defines the basic editor features to be available in
* the root ckeditor_basic.js file.
*/
if ( CKEDITOR.status == 'unloaded' )
{
(function()
{
CKEDITOR.event.implementOn( CKEDITOR );
/**
* Forces the full CKEditor core code, in the case only the basic code has been
* loaded (ckeditor_basic.js). This method self-destroys (becomes undefined) in
* the first call or as soon as the full code is available.
* @example
* // Check if the full core code has been loaded and load it.
* if ( CKEDITOR.loadFullCore )
* <b>CKEDITOR.loadFullCore()</b>;
*/
CKEDITOR.loadFullCore = function()
{
// If not the basic code is not ready it, just mark it to be loaded.
if ( CKEDITOR.status != 'basic_ready' )
{
CKEDITOR.loadFullCore._load = true;
return;
}
// Destroy this function.
delete CKEDITOR.loadFullCore;
// Append the script to the head.
var script = document.createElement( 'script' );
script.type = 'text/javascript';
script.src = CKEDITOR.basePath + 'ckeditor.js';
document.getElementsByTagName( 'head' )[0].appendChild( script );
};
/**
* The time to wait (in seconds) to load the full editor code after the
* page load, if the "ckeditor_basic" file is used. If set to zero, the
* editor is loaded on demand, as soon as an instance is created.
*
* This value must be set on the page before the page load completion.
* @type Number
* @default 0 (zero)
* @example
* // Loads the full source after five seconds.
* CKEDITOR.loadFullCoreTimeout = 5;
*/
CKEDITOR.loadFullCoreTimeout = 0;
/**
* The class name used to identify &lt;textarea&gt; elements to be replace
* by CKEditor instances.
* @type String
* @default 'ckeditor'
* @example
* <b>CKEDITOR.replaceClass</b> = 'rich_editor';
*/
CKEDITOR.replaceClass = 'ckeditor';
/**
* Enables the replacement of all textareas with class name matching
* {@link CKEDITOR.replaceClass}.
* @type Boolean
* @default true
* @example
* // Disable the auto-replace feature.
* <b>CKEDITOR.replaceByClassEnabled</b> = false;
*/
CKEDITOR.replaceByClassEnabled = true;
var createInstance = function( elementOrIdOrName, config, creationFunction )
{
if ( CKEDITOR.env.isCompatible )
{
// Load the full core.
if ( CKEDITOR.loadFullCore )
CKEDITOR.loadFullCore();
var editor = creationFunction( elementOrIdOrName, config );
CKEDITOR.add( editor );
return editor;
}
return null;
};
/**
* Replaces a &lt;textarea&gt; or a DOM element (DIV) with a CKEditor
* instance. For textareas, the initial value in the editor will be the
* textarea value. For DOM elements, their innerHTML will be used
* instead. We recommend using TEXTAREA and DIV elements only.
* @param {Object|String} elementOrIdOrName The DOM element (textarea), its
* ID or name.
* @param {Object} [config] The specific configurations to apply to this
* editor instance. Configurations set here will override global CKEditor
* settings.
* @returns {CKEDITOR.editor} The editor instance created.
* @example
* &lt;textarea id="myfield" name="myfield"&gt;&lt:/textarea&gt;
* ...
* <b>CKEDITOR.replace( 'myfield' )</b>;
* @example
* var textarea = document.body.appendChild( document.createElement( 'textarea' ) );
* <b>CKEDITOR.replace( textarea )</b>;
*/
CKEDITOR.replace = function( elementOrIdOrName, config )
{
return createInstance( elementOrIdOrName, config, CKEDITOR.editor.replace );
};
/**
* Creates a new editor instance inside a specific DOM element.
* @param {Object|String} elementOrId The DOM element or its ID.
* @param {Object} [config] The specific configurations to apply to this
* editor instance. Configurations set here will override global CKEditor
* settings.
* @returns {CKEDITOR.editor} The editor instance created.
* @example
* &lt;div id="editorSpace"&gt;&lt:/div&gt;
* ...
* <b>CKEDITOR.appendTo( 'editorSpace' )</b>;
*/
CKEDITOR.appendTo = function( elementOrId, config )
{
return createInstance( elementOrId, config, CKEDITOR.editor.appendTo );
};
/**
* @ignore
* Documented at ckeditor.js.
*/
CKEDITOR.add = function( editor )
{
// For now, just put the editor in the pending list. It will be
// processed as soon as the full code gets loaded.
var pending = this._.pending || ( this._.pending = [] );
pending.push( editor );
};
/**
* Replace all &lt;textarea&gt; elements available in the document with
* editor instances.
* @example
* // Replace all &lt;textarea&gt; elements in the page.
* CKEDITOR.replaceAll();
* @example
* // Replace all &lt;textarea class="myClassName"&gt; elements in the page.
* CKEDITOR.replaceAll( 'myClassName' );
* @example
* // Selectively replace &lt;textarea&gt; elements, based on custom assertions.
* CKEDITOR.replaceAll( function( textarea, config )
* {
* // Custom code to evaluate the replace, returning false
* // if it must not be done.
* // It also passes the "config" parameter, so the
* // developer can customize the instance.
* } );
*/
CKEDITOR.replaceAll = function()
{
var textareas = document.getElementsByTagName( 'textarea' );
for ( var i = 0 ; i < textareas.length ; i++ )
{
var config = null;
var textarea = textareas[i];
var name = textarea.name;
// The "name" and/or "id" attribute must exist.
if ( !textarea.name && !textarea.id )
continue;
if ( typeof arguments[0] == 'string' )
{
// The textarea class name could be passed as the function
// parameter.
var classRegex = new RegExp( '(?:^| )' + arguments[0] + '(?:$| )' );
if ( !classRegex.test( textarea.className ) )
continue;
}
else if ( typeof arguments[0] == 'function' )
{
// An assertion function could be passed as the function parameter.
// It must explicitly return "false" to ignore a specific <textarea>.
config = {};
if ( arguments[0]( textarea, config ) === false )
continue;
}
this.replace( textarea, config );
}
};
(function()
{
var onload = function()
{
var loadFullCore = CKEDITOR.loadFullCore,
loadFullCoreTimeout = CKEDITOR.loadFullCoreTimeout;
// Replace all textareas with the default class name.
if ( CKEDITOR.replaceByClassEnabled )
CKEDITOR.replaceAll( CKEDITOR.replaceClass );
CKEDITOR.status = 'basic_ready';
if ( loadFullCore && loadFullCore._load )
loadFullCore();
else if ( loadFullCoreTimeout )
{
setTimeout( function()
{
if ( CKEDITOR.loadFullCore )
CKEDITOR.loadFullCore();
}
, loadFullCoreTimeout * 1000 );
}
};
if ( window.addEventListener )
window.addEventListener( 'load', onload, false );
else if ( window.attachEvent )
window.attachEvent( 'onload', onload );
})();
CKEDITOR.status = 'basic_loaded';
})();
}

View File

@ -0,0 +1,73 @@
/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.command = function( editor, commandDefinition )
{
this.uiItems = [];
this.exec = function( data )
{
if ( this.state == CKEDITOR.TRISTATE_DISABLED )
return false;
if( this.editorFocus ) // Give editor focus if necessary (#4355).
editor.focus();
return ( commandDefinition.exec.call( this, editor, data ) !== false );
};
CKEDITOR.tools.extend( this, commandDefinition,
// Defaults
{
modes : { wysiwyg : 1 },
editorFocus : true,
state : CKEDITOR.TRISTATE_OFF
});
// Call the CKEDITOR.event constructor to initialize this instance.
CKEDITOR.event.call( this );
};
CKEDITOR.command.prototype =
{
enable : function()
{
if ( this.state == CKEDITOR.TRISTATE_DISABLED )
this.setState( ( !this.preserveState || ( typeof this.previousState == 'undefined' ) ) ? CKEDITOR.TRISTATE_OFF : this.previousState );
},
disable : function()
{
this.setState( CKEDITOR.TRISTATE_DISABLED );
},
setState : function( newState )
{
// Do nothing if there is no state change.
if ( this.state == newState )
return false;
this.previousState = this.state;
// Set the new state.
this.state = newState;
// Fire the "state" event, so other parts of the code can react to the
// change.
this.fire( 'state' );
return true;
},
toggleState : function()
{
if ( this.state == CKEDITOR.TRISTATE_OFF )
this.setState( CKEDITOR.TRISTATE_ON );
else if ( this.state == CKEDITOR.TRISTATE_ON )
this.setState( CKEDITOR.TRISTATE_OFF );
}
};
CKEDITOR.event.implementOn( CKEDITOR.command.prototype, true );

View File

@ -0,0 +1,86 @@
/*
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.commandDefinition} class,
* which contains the defintion of a command. This file is for
* documentation purposes only.
*/
/**
* (Virtual Class) Do not call this constructor. This class is not really part
* of the API. It just illustrates the features of command objects to be
* passed to the {@link CKEDITOR.editor.prototype.addCommand} function.
* @name CKEDITOR.commandDefinition
* @constructor
* @example
*/
/**
* Executes the command.
* @name CKEDITOR.commandDefinition.prototype.exec
* @function
* @param {CKEDITOR.editor} editor The editor within which run the command.
* @param {Object} [data] Additional data to be used to execute the command.
* @returns {Boolean} Whether the command has been successfully executed.
* Defaults to "true", if nothing is returned.
* @example
* editorInstance.addCommand( 'sample',
* {
* exec : function( editor )
* {
* alert( 'Executing a command for the editor name "' + editor.name + '"!' );
* }
* });
*/
/**
* Whether the command need to be hooked into the redo/undo system.
* @name CKEDITOR.commandDefinition.canUndo
* @type {Boolean} If not defined or 'true' both hook into undo system, set it
* to 'false' explicitly keep it out.
* @field
* @example
* editorInstance.addCommand( 'alertName',
* {
* exec : function( editor )
* {
* alert( editor.name );
* },
* canUndo : false // No support for undo/redo
* });
*/
/**
* Whether the command is asynchronous, which means the 'afterCommandExec' event
* will be fired by the command itself manually, and the 'exec' function return value
* of this command is not to be returned.
* @name CKEDITOR.commandDefinition.async
* @type {Boolean} If defined as 'true', the command is asynchronous.
* @example
* editorInstance.addCommand( 'alertName',
* {
* exec : function( editor )
* {
* // Asynchronous operation below.
* CKEDITOR.ajax.loadXml( 'data.xml' );
* },
* async : true // The command need some time to complete after exec function returns.
* });
*/
/**
* Whether the command should give focus to the editor before execution.
* @name CKEDITOR.commandDefinition.editorFocus
* @type {Boolean}
* @example
* editorInstance.addCommand( 'maximize',
* {
* exec : function( editor )
* {
* },
* editorFocus : false // The command doesn't require focusing the editing document.
* });
*/

View File

@ -0,0 +1,302 @@
/*
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.config} object, which holds the
* default configuration settings.
*/
CKEDITOR.ENTER_P = 1;
CKEDITOR.ENTER_BR = 2;
CKEDITOR.ENTER_DIV = 3;
/**
* Holds the default configuration settings. Changes to this object are
* reflected in all editor instances, if not specificaly specified for those
* instances.
* @namespace
* @example
* // All editor created after the following setting will not load custom
* // configuration files.
* CKEDITOR.config.customConfig = '';
*/
CKEDITOR.config =
{
/**
* The URL path for the custom configuration file to be loaded. If not
* overloaded with inline configurations, it defaults to the "config.js"
* file present in the root of the CKEditor installation directory.<br /><br />
*
* CKEditor will recursively load custom configuration files defined inside
* other custom configuration files.
* @type String
* @default '&lt;CKEditor folder&gt;/config.js'
* @example
* // Load a specific configuration file.
* CKEDITOR.replace( 'myfiled', { customConfig : '/myconfig.js' } );
* @example
* // Do not load any custom configuration file.
* CKEDITOR.replace( 'myfiled', { customConfig : '' } );
*/
customConfig : 'config.js',
/**
* Whether the replaced element (usually a textarea) is to be updated
* automatically when posting the form containing the editor.
* @type Boolean
* @default true
* @example
* config.autoUpdateElement = true;
*/
autoUpdateElement : true,
/**
* The base href URL used to resolve relative and absolute URLs in the
* editor content.
* @type String
* @default '' (empty string)
* @example
* config.baseHref = 'http://www.example.com/path/';
*/
baseHref : '',
/**
* The CSS file(s) to be used to apply style to the contents. It should
* reflect the CSS used in the final pages where the contents are to be
* used.
* @type String|Array
* @default '&lt;CKEditor folder&gt;/contents.css'
* @example
* config.contentsCss = '/css/mysitestyles.css';
* config.contentsCss = ['/css/mysitestyles.css', '/css/anotherfile.css'];
*/
contentsCss : CKEDITOR.basePath + 'contents.css',
/**
* The writting direction of the language used to write the editor
* contents. Allowed values are 'ltr' for Left-To-Right language (like
* English), or 'rtl' for Right-To-Left languages (like Arabic).
* @default 'ltr'
* @type String
* @example
* config.contentsLangDirection = 'rtl';
*/
contentsLangDirection : 'ltr',
/**
* The user interface language localization to use. If empty, the editor
* automatically localize the editor to the user language, if supported,
* otherwise the {@link CKEDITOR.config.defaultLanguage} language is used.
* @default true
* @type Boolean
* @example
* // Load the German interface.
* config.language = 'de';
*/
language : '',
/**
* The language to be used if {@link CKEDITOR.config.language} is left empty and it's not
* possible to localize the editor to the user language.
* @default 'en'
* @type String
* @example
* config.defaultLanguage = 'it';
*/
defaultLanguage : 'en',
/**
* Sets the behavior for the ENTER key. It also dictates other behaviour
* rules in the editor, like whether the &lt;br&gt; element is to be used
* as a paragraph separator when indenting text.
* The allowed values are the following constants, and their relative
* behavior:
* <ul>
* <li>{@link CKEDITOR.ENTER_P} (1): new &lt;p&gt; paragraphs are created;</li>
* <li>{@link CKEDITOR.ENTER_BR} (2): lines are broken with &lt;br&gt; elements;</li>
* <li>{@link CKEDITOR.ENTER_DIV} (3): new &lt;div&gt; blocks are created.</li>
* </ul>
* <strong>Note</strong>: It's recommended to use the
* {@link CKEDITOR.ENTER_P} value because of its semantic value and
* correctness. The editor is optimized for this value.
* @type Number
* @default {@link CKEDITOR.ENTER_P}
* @example
* // Not recommended.
* config.enterMode = CKEDITOR.ENTER_BR;
*/
enterMode : CKEDITOR.ENTER_P,
/**
* Just like the {@link CKEDITOR.config.enterMode} setting, it defines the behavior for the SHIFT+ENTER key.
* The allowed values are the following constants, and their relative
* behavior:
* <ul>
* <li>{@link CKEDITOR.ENTER_P} (1): new &lt;p&gt; paragraphs are created;</li>
* <li>{@link CKEDITOR.ENTER_BR} (2): lines are broken with &lt;br&gt; elements;</li>
* <li>{@link CKEDITOR.ENTER_DIV} (3): new &lt;div&gt; blocks are created.</li>
* </ul>
* @type Number
* @default {@link CKEDITOR.ENTER_BR}
* @example
* config.shiftEnterMode = CKEDITOR.ENTER_P;
*/
shiftEnterMode : CKEDITOR.ENTER_BR,
/**
* A comma separated list of plugins that are not related to editor
* instances. Reserved to plugins that extend the core code only.<br /><br />
*
* There are no ways to override this setting, except by editing the source
* code of CKEditor (_source/core/config.js).
* @type String
* @example
*/
corePlugins : '',
/**
* Sets the doctype to be used when loading the editor content as HTML.
* @type String
* @default '&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;'
* @example
* // Set the doctype to the HTML 4 (quirks) mode.
* config.docType = '&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"&gt;';
*/
docType : '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
/**
* Sets the 'id' attribute to be used on body if it doesn't have one.
* @type String
* @default ''
*/
bodyId : '',
/**
* Sets the 'class' attribute to be used on body if it doesn't have one.
* @type String
* @default ''
*/
bodyClass : '',
/**
* Indicates whether the contents to be edited are being inputted as a full
* HTML page. A full page includes the &lt;html&gt;, &lt;head&gt; and
* &lt;body&gt; tags. The final output will also reflect this setting,
* including the &lt;body&gt; contents only if this setting is disabled.
* @type Boolean
* @default false
* @example
* config.fullPage = true;
*/
fullPage : false,
/**
* The height of editing area( content ), in relative or absolute, e.g. 30px, 5em.
* Note: Percentage unit is not supported yet. e.g. 30%.
* @type Number|String
* @default '200'
* @example
* config.height = 500;
* config.height = '25em';
* config.height = '300px';
*/
height : 200,
/**
* Comma separated list of plugins to load and initialize for an editor
* instance. This should be rarely changed, using instead the
* {@link CKEDITOR.config.extraPlugins} and
* {@link CKEDITOR.config.removePlugins} for customizations.
* @type String
* @example
*/
plugins : 'about,basicstyles,blockquote,button,clipboard,colorbutton,colordialog,contextmenu,div,elementspath,enterkey,entities,filebrowser,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,maximize,newpage,pagebreak,pastefromword,pastetext,popup,preview,print,removeformat,resize,save,scayt,smiley,showblocks,showborders,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',
/**
* List of additional plugins to be loaded. This is a tool setting which
* makes it easier to add new plugins, whithout having to touch and
* possibly breaking the {@link CKEDITOR.config.plugins} setting.
* @type String
* @example
* config.extraPlugins = 'myplugin,anotherplugin';
*/
extraPlugins : '',
/**
* List of plugins that must not be loaded. This is a tool setting which
* makes it easier to avoid loading plugins definied in the
* {@link CKEDITOR.config.plugins} setting, whithout having to touch it and
* potentially breaking it.
* @type String
* @example
* config.removePlugins = 'elementspath,save,font';
*/
removePlugins : '',
/**
* List of regular expressions to be executed over the input HTML,
* indicating code that must stay untouched.
* @type Array
* @default [] (empty array)
* @example
* config.protectedSource.push( /<\?[\s\S]*?\?>/g ); // PHP Code
* config.protectedSource.push( /<%[\s\S]*?%>/g ); // ASP Code
* config.protectedSource.push( /(<asp:[^\>]+>[\s|\S]*?<\/asp:[^\>]+>)|(<asp:[^\>]+\/>)/gi ); // ASP.Net Code
*/
protectedSource : [],
/**
* The editor tabindex value.
* @type Number
* @default 0 (zero)
* @example
* config.tabIndex = 1;
*/
tabIndex : 0,
/**
* The theme to be used to build the UI.
* @type String
* @default 'default'
* @see CKEDITOR.config.skin
* @example
* config.theme = 'default';
*/
theme : 'default',
/**
* The skin to load. It may be the name of the skin folder inside the
* editor installation path, or the name and the path separated by a comma.
* @type String
* @default 'default'
* @example
* config.skin = 'v2';
* @example
* config.skin = 'myskin,/customstuff/myskin/';
*/
skin : 'kama',
/**
* The editor width in CSS size format or pixel integer.
* @type String|Number
* @default '' (empty)
* @example
* config.width = 850;
* @example
* config.width = '75%';
*/
width : '',
/**
* The base Z-index for floating dialogs and popups.
* @type Number
* @default 10000
* @example
* config.baseFloatZIndex = 2000
*/
baseFloatZIndex : 10000
};
// PACKAGER_RENAME( CKEDITOR.config )

View File

@ -0,0 +1,21 @@
/*
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} object, which contains DOM
* manipulation objects and function.
*/
/**
* DOM manipulation objects and function.<br /><br />
* @see CKEDITOR.dom.element
* @see CKEDITOR.dom.node
* @namespace
* @example
*/
CKEDITOR.dom =
{};
// PACKAGER_RENAME( CKEDITOR.dom )

View File

@ -0,0 +1,32 @@
/*
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.comment} class, which represents
* a DOM comment node.
*/
CKEDITOR.dom.comment = CKEDITOR.tools.createClass(
{
base : CKEDITOR.dom.node,
$ : function( text, ownerDocument )
{
if ( typeof text == 'string' )
text = ( ownerDocument ? ownerDocument.$ : document ).createComment( text );
this.base( text );
},
proto :
{
type : CKEDITOR.NODE_COMMENT,
getOuterHtml : function()
{
return '<!--' + this.$.nodeValue + '-->';
}
}
});

View File

@ -0,0 +1,225 @@
/*
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 document.
* @constructor
* @augments CKEDITOR.dom.domObject
* @param {Object} domDocument A native DOM document.
* @example
* var document = new CKEDITOR.dom.document( document );
*/
CKEDITOR.dom.document = function( domDocument )
{
CKEDITOR.dom.domObject.call( this, domDocument );
};
// PACKAGER_RENAME( CKEDITOR.dom.document )
CKEDITOR.dom.document.prototype = new CKEDITOR.dom.domObject();
CKEDITOR.tools.extend( CKEDITOR.dom.document.prototype,
/** @lends CKEDITOR.dom.document.prototype */
{
/**
* Appends a CSS file to the document.
* @param {String} cssFileUrl The CSS file URL.
* @example
* <b>CKEDITOR.document.appendStyleSheet( '/mystyles.css' )</b>;
*/
appendStyleSheet : function( cssFileUrl )
{
if ( this.$.createStyleSheet )
this.$.createStyleSheet( cssFileUrl );
else
{
var link = new CKEDITOR.dom.element( 'link' );
link.setAttributes(
{
rel :'stylesheet',
type : 'text/css',
href : cssFileUrl
});
this.getHead().append( link );
}
},
appendStyleText : function( cssStyleText )
{
if ( this.$.createStyleSheet )
{
var styleSheet = this.$.createStyleSheet( "" );
styleSheet.cssText = cssStyleText ;
}
else
{
var style = new CKEDITOR.dom.element( 'style', this );
style.append( new CKEDITOR.dom.text( cssStyleText, this ) );
this.getHead().append( style );
}
},
createElement : function( name, attribsAndStyles )
{
var element = new CKEDITOR.dom.element( name, this );
if ( attribsAndStyles )
{
if ( attribsAndStyles.attributes )
element.setAttributes( attribsAndStyles.attributes );
if ( attribsAndStyles.styles )
element.setStyles( attribsAndStyles.styles );
}
return element;
},
createText : function( text )
{
return new CKEDITOR.dom.text( text, this );
},
focus : function()
{
this.getWindow().focus();
},
/**
* Gets and element based on its id.
* @param {String} elementId The element id.
* @returns {CKEDITOR.dom.element} The element instance, or null if not found.
* @example
* var element = <b>CKEDITOR.document.getById( 'myElement' )</b>;
* alert( element.getId() ); // "myElement"
*/
getById : function( elementId )
{
var $ = this.$.getElementById( elementId );
return $ ? new CKEDITOR.dom.element( $ ) : null;
},
getByAddress : function( address, normalized )
{
var $ = this.$.documentElement;
for ( var i = 0 ; $ && i < address.length ; i++ )
{
var target = address[ i ];
if ( !normalized )
{
$ = $.childNodes[ target ];
continue;
}
var currentIndex = -1;
for (var j = 0 ; j < $.childNodes.length ; j++ )
{
var candidate = $.childNodes[ j ];
if ( normalized === true &&
candidate.nodeType == 3 &&
candidate.previousSibling &&
candidate.previousSibling.nodeType == 3 )
{
continue;
}
currentIndex++;
if ( currentIndex == target )
{
$ = candidate;
break;
}
}
}
return $ ? new CKEDITOR.dom.node( $ ) : null;
},
getElementsByTag : function( tagName, namespace )
{
if ( !CKEDITOR.env.ie && namespace )
tagName = namespace + ':' + tagName;
return new CKEDITOR.dom.nodeList( this.$.getElementsByTagName( tagName ) );
},
/**
* Gets the &lt;head&gt; element for this document.
* @returns {CKEDITOR.dom.element} The &lt;head&gt; element.
* @example
* var element = <b>CKEDITOR.document.getHead()</b>;
* alert( element.getName() ); // "head"
*/
getHead : function()
{
var head = this.$.getElementsByTagName( 'head' )[0];
head = new CKEDITOR.dom.element( head );
return (
/** @ignore */
this.getHead = function()
{
return head;
})();
},
/**
* Gets the &lt;body&gt; element for this document.
* @returns {CKEDITOR.dom.element} The &lt;body&gt; element.
* @example
* var element = <b>CKEDITOR.document.getBody()</b>;
* alert( element.getName() ); // "body"
*/
getBody : function()
{
var body = new CKEDITOR.dom.element( this.$.body );
return (
/** @ignore */
this.getBody = function()
{
return body;
})();
},
getDocumentElement : function()
{
var documentElement = new CKEDITOR.dom.element( this.$.documentElement );
return (
/** @ignore */
this.getDocumentElement = function()
{
return documentElement;
})();
},
/**
* Gets the window object that holds this document.
* @returns {CKEDITOR.dom.window} The window object.
* @example
*/
getWindow : function()
{
var win = new CKEDITOR.dom.window( this.$.parentWindow || this.$.defaultView );
return (
/** @ignore */
this.getWindow = function()
{
return win;
})();
}
});

View File

@ -0,0 +1,49 @@
/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* DocumentFragment is a "lightweight" or "minimal" Document object. It is
* commonly used to extract a portion of a document's tree or to create a new
* fragment of a document. Various operations may take DocumentFragment objects
* as arguments and results in all the child nodes of the DocumentFragment being
* moved to the child list of this node.
*
* @param {Object} ownerDocument
*/
CKEDITOR.dom.documentFragment = function( ownerDocument )
{
ownerDocument = ownerDocument || CKEDITOR.document;
this.$ = ownerDocument.$.createDocumentFragment();
};
CKEDITOR.tools.extend( CKEDITOR.dom.documentFragment.prototype,
CKEDITOR.dom.element.prototype,
{
type : CKEDITOR.NODE_DOCUMENT_FRAGMENT,
insertAfterNode : function( node )
{
node = node.$;
node.parentNode.insertBefore( this.$, node.nextSibling );
}
},
true,
{
'append' : 1,
'appendBogus' : 1,
'getFirst' : 1,
'getLast' : 1,
'appendTo' : 1,
'moveChildren' : 1,
'insertBefore' : 1,
'insertAfterNode' : 1,
'replace' : 1,
'trim' : 1,
'type' : 1,
'ltrim' : 1,
'rtrim' : 1,
'getDocument' : 1,
'getChildCount' : 1,
'getChild' : 1,
'getChildren' : 1
} );

View File

@ -0,0 +1,204 @@
/*
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 is the base
* for other classes representing DOM objects.
*/
/**
* Represents a DOM object. This class is not intended to be used directly. It
* serves as the base class for other classes representing specific DOM
* objects.
* @constructor
* @param {Object} nativeDomObject A native DOM object.
* @augments CKEDITOR.event
* @example
*/
CKEDITOR.dom.domObject = function( nativeDomObject )
{
if ( nativeDomObject )
{
/**
* The native DOM object represented by this class instance.
* @type Object
* @example
* var element = new CKEDITOR.dom.element( 'span' );
* alert( element.$.nodeType ); // "1"
*/
this.$ = nativeDomObject;
}
};
CKEDITOR.dom.domObject.prototype = (function()
{
// Do not define other local variables here. We want to keep the native
// listener closures as clean as possible.
var getNativeListener = function( domObject, eventName )
{
return function( domEvent )
{
// In FF, when reloading the page with the editor focused, it may
// throw an error because the CKEDITOR global is not anymore
// available. So, we check it here first. (#2923)
if ( typeof CKEDITOR != 'undefined' )
domObject.fire( eventName, new CKEDITOR.dom.event( domEvent ) );
};
};
return /** @lends CKEDITOR.dom.domObject.prototype */ {
getPrivate : function()
{
var priv;
// Get the main private function from the custom data. Create it if not
// defined.
if ( !( priv = this.getCustomData( '_' ) ) )
this.setCustomData( '_', ( priv = {} ) );
return priv;
},
/** @ignore */
on : function( eventName )
{
// We customize the "on" function here. The basic idea is that we'll have
// only one listener for a native event, which will then call all listeners
// set to the event.
// Get the listeners holder object.
var nativeListeners = this.getCustomData( '_cke_nativeListeners' );
if ( !nativeListeners )
{
nativeListeners = {};
this.setCustomData( '_cke_nativeListeners', nativeListeners );
}
// Check if we have a listener for that event.
if ( !nativeListeners[ eventName ] )
{
var listener = nativeListeners[ eventName ] = getNativeListener( this, eventName );
if ( this.$.addEventListener )
this.$.addEventListener( eventName, listener, !!CKEDITOR.event.useCapture );
else if ( this.$.attachEvent )
this.$.attachEvent( 'on' + eventName, listener );
}
// Call the original implementation.
return CKEDITOR.event.prototype.on.apply( this, arguments );
},
/** @ignore */
removeListener : function( eventName )
{
// Call the original implementation.
CKEDITOR.event.prototype.removeListener.apply( this, arguments );
// If we don't have listeners for this event, clean the DOM up.
if ( !this.hasListeners( eventName ) )
{
var nativeListeners = this.getCustomData( '_cke_nativeListeners' );
var listener = nativeListeners && nativeListeners[ eventName ];
if ( listener )
{
if ( this.$.removeEventListener )
this.$.removeEventListener( eventName, listener, false );
else if ( this.$.detachEvent )
this.$.detachEvent( 'on' + eventName, listener );
delete nativeListeners[ eventName ];
}
}
}
};
})();
(function( domObjectProto )
{
var customData = {};
/**
* Determines whether the specified object is equal to the current object.
* @name CKEDITOR.dom.domObject.prototype.equals
* @function
* @param {Object} object The object to compare with the current object.
* @returns {Boolean} "true" if the object is equal.
* @example
* var doc = new CKEDITOR.dom.document( document );
* alert( doc.equals( CKEDITOR.document ) ); // "true"
* alert( doc == CKEDITOR.document ); // "false"
*/
domObjectProto.equals = function( object )
{
return ( object && object.$ === this.$ );
};
/**
* Sets a data slot value for this object. These values are shared by all
* instances pointing to that same DOM object.
* @name CKEDITOR.dom.domObject.prototype.setCustomData
* @function
* @param {String} key A key used to identify the data slot.
* @param {Object} value The value to set to the data slot.
* @returns {CKEDITOR.dom.domObject} This DOM object instance.
* @see CKEDITOR.dom.domObject.prototype.getCustomData
* @example
* var element = new CKEDITOR.dom.element( 'span' );
* element.setCustomData( 'hasCustomData', true );
*/
domObjectProto.setCustomData = function( key, value )
{
var expandoNumber = this.getUniqueId(),
dataSlot = customData[ expandoNumber ] || ( customData[ expandoNumber ] = {} );
dataSlot[ key ] = value;
return this;
};
/**
* Gets the value set to a data slot in this object.
* @name CKEDITOR.dom.domObject.prototype.getCustomData
* @function
* @param {String} key The key used to identify the data slot.
* @returns {Object} This value set to the data slot.
* @see CKEDITOR.dom.domObject.prototype.setCustomData
* @example
* var element = new CKEDITOR.dom.element( 'span' );
* alert( element.getCustomData( 'hasCustomData' ) ); // e.g. 'true'
*/
domObjectProto.getCustomData = function( key )
{
var expandoNumber = this.$._cke_expando,
dataSlot = expandoNumber && customData[ expandoNumber ];
return dataSlot && dataSlot[ key ];
};
domObjectProto.removeCustomData = function( key )
{
var expandoNumber = this.$._cke_expando,
dataSlot = expandoNumber && customData[ expandoNumber ],
retval = dataSlot && dataSlot[ key ];
if ( typeof retval != 'undefined' )
delete dataSlot[ key ];
return retval || null;
};
domObjectProto.getUniqueId = function()
{
return this.$._cke_expando || ( this.$._cke_expando = CKEDITOR.tools.getNextNumber() );
};
// Implement CKEDITOR.event.
CKEDITOR.event.implementOn( domObjectProto );
})( CKEDITOR.dom.domObject.prototype );

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,104 @@
/*
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,de: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;
}
};

View File

@ -0,0 +1,142 @@
/*
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;

View File

@ -0,0 +1,649 @@
/*
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 )
{
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;
/**
* 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: "&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;"
*/
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: "&lt;em&gt;&lt;/em&gt;&lt;strong&gt;&lt;/strong&gt;"
*/
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: "&lt;strong&gt;&lt;/strong&gt;&lt;em&gt;&lt;/em&gt;"
*/
insertBefore : function( node )
{
node.$.parentNode.insertBefore( this.$, node.$ );
return node;
},
insertBeforeMe : function( node )
{
this.$.parentNode.insertBefore( node.$, this.$ );
return node;
},
/**
* Retrieves a uniquely identifiable tree address for this node.
* The tree address returns is an array of integers, with each integer
* indicating a child index of a DOM node, starting from
* document.documentElement.
*
* For example, assuming <body> is the second child from <html> (<head>
* being the first), and we'd like to address the third child under the
* fourth child of body, the tree address returned would be:
* [1, 3, 2]
*
* The tree address cannot be used for finding back the DOM tree node once
* the DOM tree structure has been modified.
*/
getAddress : function( normalized )
{
var address = [];
var $documentElement = this.getDocument().$.documentElement;
var node = this.$;
while ( node && node != $documentElement )
{
var parentNode = node.parentNode;
var currentIndex = -1;
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 = node.parentNode;
}
return address;
},
/**
* Gets the document containing this element.
* @returns {CKEDITOR.dom.document} The document.
* @example
* var element = CKEDITOR.document.getById( 'example' );
* alert( <b>element.getDocument().equals( CKEDITOR.document )</b> ); // "true"
*/
getDocument : function()
{
var document = new CKEDITOR.dom.document( this.$.ownerDocument || this.$.parentNode.ownerDocument );
return (
/** @ignore */
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( '&lt;div&gt;&lt;b&gt;Example&lt;/b&gt; &lt;i&gt;next&lt;/i&gt;&lt;/div&gt;' );
* var first = <b>element.getFirst().getNext()</b>;
* alert( first.getName() ); // "i"
*/
getNext : function( evaluator )
{
var next = this.$, retval;
do
{
next = next.nextSibling;
retval = next && new CKEDITOR.dom.node( next );
}
while ( retval && evaluator && !evaluator( retval ) )
return retval;
},
/**
* Gets the parent element for this node.
* @returns {CKEDITOR.dom.element} The parent element.
* @example
* var node = editor.document.getBody().getFirst();
* var parent = node.<b>getParent()</b>;
* alert( node.getName() ); // "body"
*/
getParent : function()
{
var parent = this.$.parentNode;
return ( parent && parent.nodeType == 1 ) ? new CKEDITOR.dom.node( parent ) : null;
},
getParents : function( closerFirst )
{
var node = this;
var parents = [];
do
{
parents[ closerFirst ? 'push' : 'unshift' ]( node );
}
while ( ( node = node.getParent() ) )
return parents;
},
getCommonAncestor : function( node )
{
if ( node.equals( this ) )
return this;
if ( node.contains && node.contains( this ) )
return node;
var start = this.contains ? this : this.getParent();
do
{
if ( start.contains( node ) )
return start;
}
while ( ( start = start.getParent() ) );
return null;
},
getPosition : function( otherNode )
{
var $ = this.$;
var $other = otherNode.$;
if ( $.compareDocumentPosition )
return $.compareDocumentPosition( $other );
// IE and Safari have no support for compareDocumentPosition.
if ( $ == $other )
return CKEDITOR.POSITION_IDENTICAL;
// Only element nodes support contains and sourceIndex.
if ( this.type == CKEDITOR.NODE_ELEMENT && otherNode.type == CKEDITOR.NODE_ELEMENT )
{
if ( $.contains )
{
if ( $.contains( $other ) )
return CKEDITOR.POSITION_CONTAINS + CKEDITOR.POSITION_PRECEDING;
if ( $other.contains( $ ) )
return CKEDITOR.POSITION_IS_CONTAINED + CKEDITOR.POSITION_FOLLOWING;
}
if ( 'sourceIndex' in $ )
{
return ( $.sourceIndex < 0 || $other.sourceIndex < 0 ) ? CKEDITOR.POSITION_DISCONNECTED :
( $.sourceIndex < $other.sourceIndex ) ? CKEDITOR.POSITION_PRECEDING :
CKEDITOR.POSITION_FOLLOWING;
}
}
// For nodes that don't support compareDocumentPosition, contains
// or sourceIndex, their "address" is compared.
var addressOfThis = this.getAddress(),
addressOfOther = otherNode.getAddress(),
minLevel = Math.min( addressOfThis.length, addressOfOther.length );
// Determinate preceed/follow relationship.
for ( var i = 0 ; i <= minLevel - 1 ; i++ )
{
if ( addressOfThis[ i ] != addressOfOther[ i ] )
{
if ( i < minLevel )
{
return addressOfThis[ i ] < addressOfOther[ i ] ?
CKEDITOR.POSITION_PRECEDING : CKEDITOR.POSITION_FOLLOWING;
}
break;
}
}
// Determinate contains/contained relationship.
return ( addressOfThis.length < addressOfOther.length ) ?
CKEDITOR.POSITION_CONTAINS + CKEDITOR.POSITION_PRECEDING :
CKEDITOR.POSITION_IS_CONTAINED + CKEDITOR.POSITION_FOLLOWING;
},
/**
* Gets the 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' );
* <b>element.remove()</b>;
*/
remove : function( preserveChildren )
{
var $ = this.$;
var parent = $.parentNode;
if ( parent )
{
if ( preserveChildren )
{
// Move all children before the node.
for ( var child ; ( child = $.firstChild ) ; )
{
parent.insertBefore( $.removeChild( child ), $ );
}
}
parent.removeChild( $ );
}
return this;
},
replace : function( nodeToReplace )
{
this.insertBefore( nodeToReplace );
nodeToReplace.remove();
},
trim : function()
{
this.ltrim();
this.rtrim();
},
ltrim : function()
{
var child;
while ( this.getFirst && ( child = this.getFirst() ) )
{
if ( child.type == CKEDITOR.NODE_TEXT )
{
var trimmed = CKEDITOR.tools.ltrim( child.getText() ),
originalLength = child.getLength();
if ( !trimmed )
{
child.remove();
continue;
}
else if ( trimmed.length < originalLength )
{
child.split( originalLength - trimmed.length );
// IE BUG: child.remove() may raise JavaScript errors here. (#81)
this.$.removeChild( this.$.firstChild );
}
}
break;
}
},
rtrim : function()
{
var child;
while ( this.getLast && ( child = this.getLast() ) )
{
if ( child.type == CKEDITOR.NODE_TEXT )
{
var trimmed = CKEDITOR.tools.rtrim( child.getText() ),
originalLength = child.getLength();
if ( !trimmed )
{
child.remove();
continue;
}
else if ( trimmed.length < originalLength )
{
child.split( trimmed.length );
// IE BUG: child.getNext().remove() may raise JavaScript errors here.
// (#81)
this.$.lastChild.parentNode.removeChild( this.$.lastChild );
}
}
break;
}
if ( !CKEDITOR.env.ie && !CKEDITOR.env.opera )
{
child = this.$.lastChild;
if ( child && child.type == 1 && child.nodeName.toLowerCase() == 'br' )
{
// Use "eChildNode.parentNode" instead of "node" to avoid IE bug (#324).
child.parentNode.removeChild( child ) ;
}
}
}
}
);

View File

@ -0,0 +1,23 @@
/*
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;
}
};

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,123 @@
/*
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 );
}
});

View File

@ -0,0 +1,451 @@
/*
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 ) === 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 ) === 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:
*
* [&lt;p&gt;Some &lt;b&gt;sample] text&lt;/b&gt;
*
* While walking forward into the above range, the following nodes are
* returned: &lt;p&gt;, "Some ", &lt;b&gt; 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
// * &lt;body&gt; 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. <b></b> we're checking here
// 'offsetHeight' instead of 'offsetWidth' for properly excluding
// all sorts of empty paragraph, e.g. <br />.
var isInvisible = whitespace( node ) || node.is && !node.$.offsetHeight;
return isReject ^ isInvisible;
};
};
var tailNbspRegex = /^[\t\r\n ]*(?:&nbsp;|\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;
};
})();

View File

@ -0,0 +1,96 @@
/*
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 );
* <b>win.focus()</b>;
*/
focus : function()
{
// Webkit is sometimes failed to focus iframe, blur it first(#3835).
if( CKEDITOR.env.webkit && this.$.parent )
this.$.parent.focus();
this.$.focus();
},
/**
* Gets the width and height of this window's viewable area.
* @function
* @returns {Object} An object with the "width" and "height"
* properties containing the size.
* @example
* var win = new CKEDITOR.dom.window( window );
* var size = <b>win.getViewPaneSize()</b>;
* alert( size.width );
* alert( size.height );
*/
getViewPaneSize : function()
{
var doc = this.$.document,
stdMode = doc.compatMode == 'CSS1Compat';
return {
width : ( stdMode ? doc.documentElement.clientWidth : doc.body.clientWidth ) || 0,
height : ( stdMode ? doc.documentElement.clientHeight : doc.body.clientHeight ) || 0
};
},
/**
* Gets the current position of the window's scroll.
* @function
* @returns {Object} An object with the "x" and "y" properties
* containing the scroll position.
* @example
* var win = new CKEDITOR.dom.window( window );
* var pos = <b>win.getScrollPosition()</b>;
* alert( pos.x );
* alert( pos.y );
*/
getScrollPosition : function()
{
var $ = this.$;
if ( 'pageXOffset' in $ )
{
return {
x : $.pageXOffset || 0,
y : $.pageYOffset || 0
};
}
else
{
var doc = $.document;
return {
x : doc.documentElement.scrollLeft || doc.body.scrollLeft || 0,
y : doc.documentElement.scrollTop || doc.body.scrollTop || 0
};
}
}
});

View File

@ -0,0 +1,233 @@
/*
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},
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 )

View File

@ -0,0 +1,690 @@
/*
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 = CKEDITOR.getUrl( editor.config.customConfig );
// Check if there is a custom config to load.
if ( !customConfig )
return false;
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;
// 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.modes[ mode ] ? 'enable' : 'disable' ]();
}
}
/**
* Initializes the editor instance. This function is called by the editor
* contructor (editor_basic.js).
* @private
*/
CKEDITOR.editor.prototype._init = function()
{
// Get the properties that have been saved in the editor_base
// implementation.
var element = CKEDITOR.dom.element.get( this._.element ),
instanceConfig = this._.instanceConfig;
delete this._.element;
delete this._.instanceConfig;
this._.commands = {};
this._.styles = [];
/**
* The DOM element that has been replaced by this editor instance. This
* element holds the editor data on load and post.
* @name CKEDITOR.editor.prototype.element
* @type CKEDITOR.dom.element
* @example
* var editor = CKEDITOR.instances.editor1;
* alert( <b>editor.element</b>.getName() ); "textarea"
*/
this.element = element;
/**
* The editor instance name. It hay be the replaced element id, name or
* a default name using a progressive counter (editor1, editor2, ...).
* @name CKEDITOR.editor.prototype.name
* @type String
* @example
* var editor = CKEDITOR.instances.editor1;
* alert( <b>editor.name</b> ); "editor1"
*/
this.name = ( element && ( this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE )
&& ( element.getId() || element.getNameAtt() ) )
|| getNewName();
if ( this.name in CKEDITOR.instances )
throw '[CKEDITOR.editor] The instance "' + this.name + '" already exists.';
/**
* The configurations for this editor instance. It inherits all
* settings defined in (@link CKEDITOR.config}, combined with settings
* loaded from custom configuration files and those defined inline in
* the page when creating the editor.
* @name CKEDITOR.editor.prototype.config
* @type Object
* @example
* var editor = CKEDITOR.instances.editor1;
* alert( <b>editor.config.theme</b> ); "default" e.g.
*/
this.config = CKEDITOR.tools.prototypedCopy( CKEDITOR.config );
/**
* Namespace containing UI features related to this editor instance.
* @name CKEDITOR.editor.prototype.ui
* @type CKEDITOR.ui
* @example
*/
this.ui = new CKEDITOR.ui( this );
/**
* Controls the focus state of this editor instance. This property
* is rarely used for normal API operations. It is mainly
* destinated to developer adding UI elements to the editor interface.
* @name CKEDITOR.editor.prototype.focusManager
* @type CKEDITOR.focusManager
* @example
*/
this.focusManager = new CKEDITOR.focusManager( this );
CKEDITOR.fire( 'instanceCreated', null, this );
this.on( 'mode', updateCommandsMode, null, null, 1 );
initConfig( this, instanceConfig );
};
})();
CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
/** @lends CKEDITOR.editor.prototype */
{
/**
* Adds a command definition to the editor instance. Commands added with
* this function can be later executed with {@link #execCommand}.
* @param {String} commandName The indentifier name of the command.
* @param {CKEDITOR.commandDefinition} commandDefinition The command definition.
* @example
* editorInstance.addCommand( 'sample',
* {
* exec : function( editor )
* {
* alert( 'Executing a command for the editor name "' + editor.name + '"!' );
* }
* });
*/
addCommand : function( commandName, commandDefinition )
{
return this._.commands[ commandName ] = new CKEDITOR.command( this, commandDefinition );
},
/**
* Add a trunk of css text to the editor which will be applied to the wysiwyg editing document.
* Note: This function should be called before editor is loaded to take effect.
* @param css {String} CSS text.
* @example
* editorInstance.addCss( 'body { background-color: grey; }' );
*/
addCss : function( css )
{
this._.styles.push( css );
},
/**
* Destroys the editor instance, releasing all resources used by it.
* If the editor replaced an element, the element will be recovered.
* @param {Boolean} [noUpdate] If the instance is replacing a DOM
* element, this parameter indicates whether or not to update the
* element with the instance contents.
* @example
* alert( CKEDITOR.instances.editor1 ); e.g "object"
* <b>CKEDITOR.instances.editor1.destroy()</b>;
* alert( CKEDITOR.instances.editor1 ); "undefined"
*/
destroy : function( noUpdate )
{
if ( !noUpdate )
this.updateElement();
this.theme.destroy( this );
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.<b>getData()</b> == '' )
* alert( 'There is no data available' );
*/
getData : function()
{
this.fire( 'beforeGetData' );
var eventData = this._.data;
if ( typeof eventData != 'string' )
{
var element = this.element;
if ( element && this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE )
eventData = element.is( 'textarea' ) ? element.getValue() : element.getHtml();
else
eventData = '';
}
eventData = { dataValue : eventData };
// Fire "getData" so data manipulation may happen.
this.fire( 'getData', eventData );
return eventData.dataValue;
},
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).
* <b>Note:</b> This's an asynchronous method, the {@param callback}
* function should be relied on if you want to interact with the editor
* after data is fully loaded.
*
* @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.<b>setData( '&lt;p&gt;This is the editor data.&lt;/p&gt;' )</b>;
* CKEDITOR.instances.editor1.setData( '&lt;p&gt;Some other editor data.&lt;/p&gt;', function()
* {
* CKEDITOR.instances.editor1.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.<b>insertHtml( '&lt;p&gt;This is a new paragraph.&lt;/p&gt;' )</b>;
*/
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( '&lt;img src="hello.png" border="0" title="Hello" /&gt;' );
* CKEDITOR.instances.editor1.<b>insertElement( element )</b>;
*/
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 &lt;textarea&gt; 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
* @type {Boolean}
* @default false
* @example
* config.htmlEncodeOutput = true;
*/

View File

@ -0,0 +1,179 @@
/*
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.
* @augments CKEDITOR.event
* @example
*/
CKEDITOR.editor = function( instanceConfig, element, mode )
{
this._ =
{
// Save the config to be processed later by the full core code.
instanceConfig : instanceConfig,
element : element
};
/**
* The mode in which the {@link #element} is linked to this editor
* instance. It can be any of the following values:
* <ul>
* <li><b>CKEDITOR.ELEMENT_MODE_NONE</b>: No element is linked to the
* editor instance.</li>
* <li><b>CKEDITOR.ELEMENT_MODE_REPLACE</b>: The element is to be
* replaced by the editor instance.</li>
* <li><b>CKEDITOR.ELEMENT_MODE_APPENDTO</b>: The editor is to be
* created inside the element.</li>
* </ul>
* @name CKEDITOR.editor.prototype.elementMode
* @type Number
* @example
* var editor = CKEDITOR.replace( 'editor1' );
* alert( <b>editor.elementMode</b> ); "1"
*/
this.elementMode = mode || CKEDITOR.ELEMENT_MODE_NONE;
// Call the CKEDITOR.event constructor to initialize this instance.
CKEDITOR.event.call( this );
this._init();
};
/**
* Replaces a &lt;textarea&gt; or a DOM element (DIV) with a CKEditor
* instance. For textareas, the initial value in the editor will be the
* textarea value. For DOM elements, their innerHTML will be used
* instead. We recommend using TEXTAREA and DIV elements only. 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.
* @returns {CKEDITOR.editor} The editor instance created.
* @example
*/
CKEDITOR.editor.appendTo = function( elementOrId, config )
{
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 );
};
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 );
}

View File

@ -0,0 +1,219 @@
/*
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' ),
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 && <b>CKEDITOR.env.version</b> <= 6 )
* alert( "Ouch!" );
*/
env.version = version;
/**
* Indicates that CKEditor is running on a compatible browser.
* @name CKEDITOR.env.isCompatible
* @type Boolean
* @example
* if ( CKEDITOR.env.isCompatible )
* alert( "Your browser is pretty cool!" );
*/
env.isCompatible =
( env.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 )

View File

@ -0,0 +1,335 @@
/*
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' };
* <b>CKEDITOR.event.implementOn( myObject }</b>;
* 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.
* @param {Object} [scopeObj] The object used to scope the listener
* call (the this object. If omitted, the current object is used.
* @param {Object} [listenerData] Data to be sent as the
* {@link CKEDITOR.eventInfo#listenerData} when calling the
* listener.
* @param {Number} [priority] The listener priority. Lower priority
* listeners are called first. Listeners with the same priority
* value are called in registration order. Defaults to 10.
* @example
* someObject.on( 'someEvent', function()
* {
* alert( this == someObject ); // "true"
* });
* @example
* someObject.on( 'someEvent', function()
* {
* alert( this == anotherObject ); // "true"
* }
* , anotherObject );
* @example
* someObject.on( 'someEvent', function( event )
* {
* alert( event.listenerData ); // "Example"
* }
* , null, 'Example' );
* @example
* someObject.on( 'someEvent', function() { ... } ); // 2nd called
* someObject.on( 'someEvent', function() { ... }, null, null, 100 ); // 3rd called
* someObject.on( 'someEvent', function() { ... }, null, null, 1 ); // 1st called
*/
on : function( eventName, listenerFunction, scopeObj, listenerData, priority )
{
// Get the event entry (create it if needed).
var events = getPrivate( this ),
event = events[ eventName ] || ( events[ eventName ] = new eventEntry( eventName ) );
if ( event.getListenerIndex( listenerFunction ) < 0 )
{
// Get the listeners.
var listeners = event.listeners;
// Fill the scope.
if ( !scopeObj )
scopeObj = this;
// Default the priority, if needed.
if ( isNaN( priority ) )
priority = 10;
var me = this;
// Create the function to be fired for this listener.
var listenerFirer = function( editor, publisherData, stopFn, cancelFn )
{
var ev =
{
name : eventName,
sender : this,
editor : editor,
data : publisherData,
listenerData : listenerData,
stop : stopFn,
cancel : cancelFn,
removeListener : function()
{
me.removeListener( eventName, listenerFunction );
}
};
listenerFunction.call( scopeObj, ev );
return ev.data;
};
listenerFirer.fn = listenerFunction;
listenerFirer.priority = priority;
// Search for the right position for this new listener, based on its
// priority.
for ( var i = listeners.length - 1 ; i >= 0 ; i-- )
{
// Find the item which should be before the new one.
if ( listeners[ i ].priority <= priority )
{
// Insert the listener in the array.
listeners.splice( i + 1, 0, listenerFirer );
return;
}
}
// If no position has been found (or zero length), put it in
// the front of list.
listeners.unshift( listenerFirer );
}
},
/**
* Fires an specific event in the object. All registered listeners are
* called at this point.
* @function
* @param {String} eventName The event name to fire.
* @param {Object} [data] Data to be sent as the
* {@link CKEDITOR.eventInfo#data} when calling the
* listeners.
* @param {CKEDITOR.editor} [editor] The editor instance to send as the
* {@link CKEDITOR.eventInfo#editor} when calling the
* listener.
* @returns {Boolean|Object} A booloan indicating that the event is to be
* canceled, or data returned by one of the listeners.
* @example
* someObject.on( 'someEvent', function() { ... } );
* someObject.on( 'someEvent', function() { ... } );
* <b>someObject.fire( 'someEvent' )</b>; // both listeners are called
* @example
* someObject.on( 'someEvent', function( event )
* {
* alert( event.data ); // "Example"
* });
* <b>someObject.fire( 'someEvent', 'Example' )</b>;
*/
fire : (function()
{
// Create the function that marks the event as stopped.
var stopped = false;
var stopEvent = function()
{
stopped = true;
};
// Create the function that marks the event as canceled.
var canceled = false;
var cancelEvent = function()
{
canceled = true;
};
return function( eventName, data, editor )
{
// Get the event entry.
var event = getPrivate( this )[ eventName ];
// Save the previous stopped and cancelled states. We may
// be nesting fire() calls.
var previousStopped = stopped,
previousCancelled = canceled;
// Reset the stopped and canceled flags.
stopped = canceled = false;
if ( event )
{
var listeners = event.listeners;
if ( listeners.length )
{
// As some listeners may remove themselves from the
// event, the original array length is dinamic. So,
// let's make a copy of all listeners, so we are
// sure we'll call all of them.
listeners = listeners.slice( 0 );
// Loop through all listeners.
for ( var i = 0 ; i < listeners.length ; i++ )
{
// Call the listener, passing the event data.
var retData = listeners[i].call( this, editor, data, stopEvent, cancelEvent );
if ( typeof retData != 'undefined' )
data = retData;
// No further calls is stopped or canceled.
if ( stopped || canceled )
break;
}
}
}
var ret = canceled || ( typeof data == 'undefined' ? false : data );
// Restore the previous stopped and canceled states.
stopped = previousStopped;
canceled = previousCancelled;
return ret;
};
})(),
/**
* Fires an specific event in the object, releasing all listeners
* registered to that event. The same listeners are not called again on
* successive calls of it or of {@link #fire}.
* @param {String} eventName The event name to fire.
* @param {Object} [data] Data to be sent as the
* {@link CKEDITOR.eventInfo#data} when calling the
* listeners.
* @param {CKEDITOR.editor} [editor] The editor instance to send as the
* {@link CKEDITOR.eventInfo#editor} when calling the
* listener.
* @returns {Boolean|Object} A booloan indicating that the event is to be
* canceled, or data returned by one of the listeners.
* @example
* someObject.on( 'someEvent', function() { ... } );
* someObject.fire( 'someEvent' ); // above listener called
* <b>someObject.fireOnce( 'someEvent' )</b>; // above listener called
* someObject.fire( 'someEvent' ); // no listeners called
*/
fireOnce : function( eventName, data, editor )
{
var ret = this.fire( eventName, data, editor );
delete getPrivate( this )[ eventName ];
return ret;
},
/**
* Unregisters a listener function from being called at the specified
* event. No errors are thrown if the listener has not been
* registered previously.
* @param {String} eventName The event name.
* @param {Function} listenerFunction The listener function to unregister.
* @example
* var myListener = function() { ... };
* someObject.on( 'someEvent', myListener );
* someObject.fire( 'someEvent' ); // myListener called
* <b>someObject.removeListener( 'someEvent', myListener )</b>;
* someObject.fire( 'someEvent' ); // myListener not called
*/
removeListener : function( eventName, listenerFunction )
{
// Get the event entry.
var event = getPrivate( this )[ eventName ];
if ( event )
{
var index = event.getListenerIndex( listenerFunction );
if ( index >= 0 )
event.listeners.splice( index, 1 );
}
},
/**
* Checks if there is any listener registered to a given event.
* @param {String} eventName The event name.
* @example
* var myListener = function() { ... };
* someObject.on( 'someEvent', myListener );
* alert( someObject.<b>hasListeners( 'someEvent' )</b> ); // "true"
* alert( someObject.<b>hasListeners( 'noEvent' )</b> ); // "false"
*/
hasListeners : function( eventName )
{
var event = getPrivate( this )[ eventName ];
return ( event && event.listeners.length > 0 ) ;
}
};
})();
}

View File

@ -0,0 +1,120 @@
/*
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( <b>event.name</b> ); // "someEvent"
* });
* someObject.fire( 'someEvent' );
*/
/**
* The object that publishes (sends) the event.
* @name CKEDITOR.eventInfo.prototype.sender
* @field
* @type Object
* @example
* someObject.on( 'someEvent', function( event )
* {
* alert( <b>event.sender</b> == someObject ); // "true"
* });
* someObject.fire( 'someEvent' );
*/
/**
* The editor instance that holds the sender. May be the same as sender. May be
* null if the sender is not part of an editor instance, like a component
* running in standalone mode.
* @name CKEDITOR.eventInfo.prototype.editor
* @field
* @type CKEDITOR.editor
* @example
* myButton.on( 'someEvent', function( event )
* {
* alert( <b>event.editor</b> == myEditor ); // "true"
* });
* myButton.fire( 'someEvent', null, <b>myEditor</b> );
*/
/**
* Any kind of additional data. Its format and usage is event dependent.
* @name CKEDITOR.eventInfo.prototype.data
* @field
* @type Object
* @example
* someObject.on( 'someEvent', function( event )
* {
* alert( <b>event.data</b> ); // "Example"
* });
* someObject.fire( 'someEvent', <b>'Example'</b> );
*/
/**
* Any extra data appended during the listener registration.
* @name CKEDITOR.eventInfo.prototype.listenerData
* @field
* @type Object
* @example
* someObject.on( 'someEvent', function( event )
* {
* alert( <b>event.listenerData</b> ); // "Example"
* }
* , null, <b>'Example'</b> );
*/
/**
* Indicates that no further listeners are to be called.
* @name CKEDITOR.eventInfo.prototype.stop
* @function
* @example
* someObject.on( 'someEvent', function( event )
* {
* <b>event.stop()</b>;
* });
* someObject.on( 'someEvent', function( event )
* {
* // This one will not be called.
* });
* alert( someObject.fire( 'someEvent' ) ); // "false"
*/
/**
* Indicates that the event is to be cancelled (if cancelable).
* @name CKEDITOR.eventInfo.prototype.cancel
* @function
* @example
* someObject.on( 'someEvent', function( event )
* {
* <b>event.cancel()</b>;
* });
* someObject.on( 'someEvent', function( event )
* {
* // This one will not be called.
* });
* alert( someObject.fire( 'someEvent' ) ); // "true"
*/

View File

@ -0,0 +1,123 @@
/*
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;
* <b>editor.focusManager.focus()</b>;
*/
focus : function()
{
if ( this._.timer )
clearTimeout( this._.timer );
if ( !this.hasFocus )
{
// If another editor has the current focus, we first "blur" it. In
// this way the events happen in a more logical sequence, like:
// "focus 1" > "blur 1" > "focus 2"
// ... instead of:
// "focus 1" > "focus 2" > "blur 1"
if ( CKEDITOR.currentInstance )
CKEDITOR.currentInstance.focusManager.forceBlur();
var editor = this._.editor;
editor.container.getFirst().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;
* <b>editor.focusManager.blur()</b>;
*/
blur : function()
{
var focusManager = this;
if ( focusManager._.timer )
clearTimeout( focusManager._.timer );
focusManager._.timer = setTimeout(
function()
{
delete focusManager._.timer;
focusManager.forceBlur();
}
, 100 );
},
/**
* 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;
* <b>editor.focusManager.forceBlur()</b>;
*/
forceBlur : function()
{
if ( this.hasFocus )
{
var editor = this._.editor;
editor.container.getFirst().removeClass( 'cke_focus' );
this.hasFocus = false;
editor.fire( 'blur' );
}
}
};

View File

@ -0,0 +1,212 @@
/*
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( "&lt;!-- Example --&gt;&lt;b&gt;Hello&lt;/b&gt;" );
*/
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( "&lt;!-- Example --&gt;&lt;b&gt;Hello&lt;/b&gt;" );
*/
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( "&lt;!-- Example --&gt;&lt;b&gt;Hello&lt;/b&gt;" );
*/
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( "&lt;script&gt;var hello;&lt;/script&gt;" );
*/
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( "&lt;!-- Example --&gt;&lt;b&gt;Hello&lt;/b&gt;" );
*/
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( "&lt;!-- Example --&gt;&lt;b&gt;Hello&lt;/b&gt;" );
*/
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 ) );
}
};
})();

Some files were not shown because too many files have changed in this diff Show More