Include the full ckeditor, using composer (#148)

This shall make it easier for users to customize the editor
This commit is contained in:
onli 2014-05-12 21:40:05 +02:00
parent 1b80ba69a1
commit f1348373cb
12 changed files with 613 additions and 0 deletions

7
htmlarea/autoload.php Normal file
View File

@ -0,0 +1,7 @@
<?php
// autoload.php generated by Composer
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInit67b8e60e0324368dec91a14d1fccb859::getLoader();

@ -0,0 +1 @@
Subproject commit 5a3526cc90e3291d0193cffe02e3eceaef1318d3

View File

@ -0,0 +1,87 @@
/**
* @fileOverview A Serendipity CKEDITOR custom config file: ckeditor_custom_config.js, v. 1.1, 2014-04-24, Ian
*/
/**
* Substitute every config option to CKEDITOR in here
*/
CKEDITOR.editorConfig = function( config ) {
// Advanced Content Filter ACF works in two modes:
// automatic the filter is configured by editor features (like plugins, buttons, and commands) that are enabled with configuration options
// such as CKEDITOR.config.plugins, CKEDITOR.config.extraPlugins, and CKEDITOR.config.toolbar,
// custom the filter is configured by the CKEDITOR.config.allowedContent option and only features that match this setting are activated.
// In both modes it is possible to extend the filter configuration by using the CKEDITOR.config.extraAllowedContent setting.
// If you want to disable Advanced Content Filter, set CKEDITOR.config.allowedContent to true. All available editor features will be activated and input data will not be filtered.
// Allowed content rules. This setting is used when instantiating CKEDITOR.editor.filter.
// The following values are accepted:
// CKEDITOR.filter.allowedContentRules defined rules will be added to the CKEDITOR.editor.filter.
// true will disable the filter (data will not be filtered, all features will be activated).
// default the filter will be configured by loaded features (toolbar items, commands, etc.).
// In all cases filter configuration may be extended by extraAllowedContent. This option may be especially useful when you want to use the default allowedContent value along with some additional rules.
//
// config.allowedContent = CONFIG_ACF_OFF;
// List of regular expressions to be executed on ***input HTML***, indicating HTML source code that, when matched, must not be available in the WYSIWYG mode for editing.
// allow <script> tags
config.protectedSource.push( /<(script)[^>]*>.*<\/script>/ig ); // set default in ckeditor.js [/<script[\s\S]*?<\/script>/gi,/<noscript[\s\S]*?<\/noscript>/gi]
// allow imageselectorplus mediainsert tag code
config.protectedSource.push( /<(mediainsert)[^>]*>[\s\S]*?<\/mediainsert>/img );
// allow a Smarty like {} tag syntax without starting whitespace, which would be some other code part.
config.protectedSource.push( /\{[a-zA-Z\$].*?\}/gi );
// Set placeholder tag cases - elements [attributes]{styles}(classes)
// Allowed mediainsert, gallery, media tags (imageselectorplus galleries) - which tells ACF to not touch the code!
// Allowed div is a need for Media Library inserts - which tells ACF to not touch the code!
// img[height] is even needed to avoid ACF OFF removement of height attributes
config.extraAllowedContent = 'mediainsert[*]{*}(*);gallery[*]{*}(*);media[*]{*}(*);script[*]{*}(*);audio[*]{*}(*);div[*]{*}(*);img[height,width];';
// CKEDITOR.protectedSource patterns used regex Escape sequences
// \s any whitespace character;
// \S any character that is not a whitespace character
// \t tab (hex 09);
// \r carriage return (hex 0D);
// \n newline (hex 0A);
// Pattern Modifiers
// /i caseless, match both upper and lower case letters
// /m treat as multiline
// /g be greedy
// Prevent filler nodes in all empty blocks. - case switching source and wysiwyg mode multiple times
//config.fillEmptyBlocks = false; // default (true) - switches <p>&nbsp;</p> to <p></p>
//config.ignoreEmptyParagraph = false; // default(true) - Whether the editor must output an empty value ('') if it's contents is made by an empty paragraph only. (extends to config.fillEmptyBlocks)
// It will still generate an empty <p></p> though.
config.autoParagraph = false; // but this one definitely prevents adding multiple empty paragraphs when switching source mode!!!
// add custom Serendipity styles to ckeditor wysiwyg-mode, to repect css image floats
config.contentsCss = 'htmlarea/ckeditor/wysiwyg-style.css';
// The configuration setting that controls the ENTER mode is "config.enterMode" and it offers three options:
// (1) The default creates a paragraph element each time the "enter" key is pressed:
//config.enterMode = CKEDITOR.ENTER_P; // inserts <p></p>
// (2) You can choose to create a "div" element instead of a paragraph:
//config.enterMode = CKEDITOR.ENTER_DIV; // inserts <div></div>
// (3) If you prefer to not wrap the text in anything, you can choose to insert a line break tag:
//config.enterMode = CKEDITOR.ENTER_BR; // inserts <br />
// You can always use SHIFT+ENTER to set a br in the P-mode default option or change the SHIFT-mode to something else
//config.shiftEnterMode = CKEDITOR.ENTER_BR;
//config.entities = false;
//config.htmlEncodeOutput = false;
// ui configurations - just some examples
//config.uiColor = 'transparent'; // standard, but better disable config.uiColor all
//config.uiColor = '#CFD1CF'; // standard grey
//config.uiColor = '#f5f5f5'; // standard light grey
//config.uiColor = '#E6EDF3'; // extreme light blue
//config.uiColor = '#DFE8F6'; // very light blue
//config.uiColor = '#9AB8F3'; // light blue/violet
//config.uiColor = '#AADC6E'; // light green
//config.uiColor = '#FFDC6E'; // light gold
//config.uiColor = '#FF8040'; // mango
//config.uiColor = '#FF2400'; // scarlet red
//config.uiColor = '#14B8C4'; // light turquoise
config['skin'] = 'moono';
config['height'] = 400;
};

View File

@ -0,0 +1,86 @@
/**
* Adds custom Serendipity image float styles to CKEDITOR wysiwyg-mode
*/
.serendipity_image_left,
.serendipity_image_right,
.serendipity_image_center,
.serendipity_imageComment_center,
.serendipity_imageComment_left,
.serendipity_imageComment_right {
background: transparent;
border: 0 none;
padding: 0!important;
}
.serendipity_image_left,
.serendipity_image_right,
.serendipity_imageComment_left,
.serendipity_imageComment_right {
display: block;
float: none;
margin: 0 0 1em;
}
.serendipity_image_center {
display: block;
margin: 0 auto 1em auto;
}
.plain-images .serendipity_image_left,
.plain-images .serendipity_image_right,
.plain-images .serendipity_image_center,
.plain-images .serendipity_imageComment_center,
.plain-images .serendipity_imageComment_left,
.plain-images .serendipity_imageComment_right {
border: 1px solid #aaa;
}
.plain-images .serendipity_imageComment_txt {
background: #ddd;
}
.fancy-images .serendipity_image_left,
.fancy-images .serendipity_image_right,
.fancy-images .serendipity_image_center,
.fancy-images .serendipity_imageComment_img {
-webkit-box-shadow: 0 0 2px 1px rgba(0,0,0,.5);
-moz-box-shadow: 0 0 2px 1px rgba(0,0,0,.5);
box-shadow: 0 0 2px 1px rgba(0,0,0,.5);
}
.no-boxshadow .fancy-images .serendipity_image_left,
.no-boxshadow .fancy-images .serendipity_image_right,
.no-boxshadow .fancy-images .serendipity_image_center,
.no-boxshadow .fancy-images .serendipity_imageComment_img {
border: 1px solid #aaa;
}
.serendipity_imageComment_center,
.serendipity_imageComment_left,
.serendipity_imageComment_right {
height: auto;
max-width: 100%;
}
.serendipity_image_left {
float: left;
margin: 0 2em 1em 0;
}
.serendipity_image_right {
float: right;
margin: 0 0 1em 2em;
}
.serendipity_imageComment_left {
display: inline;
float: left;
margin: 0 2em 1em 0;
}
.serendipity_imageComment_right {
display: inline;
float: right;
margin: 0 0 1em 2em;
}

14
htmlarea/composer.json Normal file
View File

@ -0,0 +1,14 @@
{
"repositories": [
{
"type": "composer",
"url": "http://packages.zendframework.com/"
}
],
"require": {
"ckeditor": "dev-full/latest"
},
"config": {
"vendor-dir": "."
}
}

66
htmlarea/composer.lock generated Normal file
View File

@ -0,0 +1,66 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
"hash": "a52359b4196b7fcf0071bef5cafda970",
"packages": [
{
"name": "ckeditor/ckeditor",
"version": "dev-full/latest",
"source": {
"type": "git",
"url": "https://github.com/ckeditor/ckeditor-releases.git",
"reference": "5a3526cc90e3291d0193cffe02e3eceaef1318d3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ckeditor/ckeditor-releases/zipball/5a3526cc90e3291d0193cffe02e3eceaef1318d3",
"reference": "5a3526cc90e3291d0193cffe02e3eceaef1318d3",
"shasum": ""
},
"type": "library",
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-2.0+",
"LGPL-2.1+",
"MPL-1.1+"
],
"authors": [
{
"name": "CKSource - Frederico Knabben",
"homepage": "http://cksource.com"
}
],
"description": "JavaScript WYSIWYG web text editor.",
"homepage": "http://ckeditor.com",
"keywords": [
"CKEditor",
"editor",
"fckeditor",
"html",
"javascript",
"richtext",
"text",
"wysiwyg"
],
"time": "2014-04-24 14:03:41"
}
],
"packages-dev": [
],
"aliases": [
],
"minimum-stability": "stable",
"stability-flags": {
"ckeditor/ckeditor": 20
},
"platform": [
],
"platform-dev": [
]
}

View File

@ -0,0 +1,246 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0 class loader
*
* See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
class ClassLoader
{
private $prefixes = array();
private $fallbackDirs = array();
private $useIncludePath = false;
private $classMap = array();
public function getPrefixes()
{
return call_user_func_array('array_merge', $this->prefixes);
}
public function getFallbackDirs()
{
return $this->fallbackDirs;
}
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array $classMap Class to filename map
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of classes, merging with any others previously set.
*
* @param string $prefix The classes prefix
* @param array|string $paths The location(s) of the classes
* @param bool $prepend Prepend the location(s)
*/
public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirs = array_merge(
(array) $paths,
$this->fallbackDirs
);
} else {
$this->fallbackDirs = array_merge(
$this->fallbackDirs,
(array) $paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixes[$first][$prefix])) {
$this->prefixes[$first][$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixes[$first][$prefix] = array_merge(
(array) $paths,
$this->prefixes[$first][$prefix]
);
} else {
$this->prefixes[$first][$prefix] = array_merge(
$this->prefixes[$first][$prefix],
(array) $paths
);
}
}
/**
* Registers a set of classes, replacing any others previously set.
*
* @param string $prefix The classes prefix
* @param array|string $paths The location(s) of the classes
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirs = (array) $paths;
return;
}
$this->prefixes[substr($prefix, 0, 1)][$prefix] = (array) $paths;
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}
/**
* Unregisters this instance as an autoloader.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
include $file;
return true;
}
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
if ('\\' == $class[0]) {
$class = substr($class, 1);
}
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$classPath = strtr(substr($class, 0, $pos), '\\', DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
$className = substr($class, $pos + 1);
} else {
// PEAR-like class name
$classPath = null;
$className = $class;
}
$classPath .= strtr($className, '_', DIRECTORY_SEPARATOR) . '.php';
$first = $class[0];
if (isset($this->prefixes[$first])) {
foreach ($this->prefixes[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) {
return $dir . DIRECTORY_SEPARATOR . $classPath;
}
}
}
}
}
foreach ($this->fallbackDirs as $dir) {
if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) {
return $dir . DIRECTORY_SEPARATOR . $classPath;
}
}
if ($this->useIncludePath && $file = stream_resolve_include_path($classPath)) {
return $file;
}
return $this->classMap[$class] = false;
}
}

View File

@ -0,0 +1,9 @@
<?php
// autoload_classmap.php generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = $vendorDir;
return array(
);

View File

@ -0,0 +1,9 @@
<?php
// autoload_namespaces.php generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = $vendorDir;
return array(
);

View File

@ -0,0 +1,43 @@
<?php
// autoload_real.php generated by Composer
class ComposerAutoloaderInit67b8e60e0324368dec91a14d1fccb859
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit67b8e60e0324368dec91a14d1fccb859', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit67b8e60e0324368dec91a14d1fccb859', 'loadClassLoader'));
$vendorDir = dirname(__DIR__);
$baseDir = $vendorDir;
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
$loader->register(true);
return $loader;
}
}

View File

@ -0,0 +1,45 @@
[
{
"name": "ckeditor/ckeditor",
"version": "dev-full/latest",
"version_normalized": "dev-full/latest",
"source": {
"type": "git",
"url": "https://github.com/ckeditor/ckeditor-releases.git",
"reference": "5a3526cc90e3291d0193cffe02e3eceaef1318d3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ckeditor/ckeditor-releases/zipball/5a3526cc90e3291d0193cffe02e3eceaef1318d3",
"reference": "5a3526cc90e3291d0193cffe02e3eceaef1318d3",
"shasum": ""
},
"time": "2014-04-24 14:03:41",
"type": "library",
"installation-source": "source",
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-2.0+",
"LGPL-2.1+",
"MPL-1.1+"
],
"authors": [
{
"name": "CKSource - Frederico Knabben",
"homepage": "http://cksource.com"
}
],
"description": "JavaScript WYSIWYG web text editor.",
"homepage": "http://ckeditor.com",
"keywords": [
"CKEditor",
"editor",
"fckeditor",
"html",
"javascript",
"richtext",
"text",
"wysiwyg"
]
}
]