Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Commit f88bc52

Browse files
authored
Merge pull request #3 from ckeditor/t/1
Feature: Initial implementation. Closes #1.
2 parents ce5c033 + f280a8b commit f88bc52

31 files changed

+791
-0
lines changed

.gitattributes

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
* text=auto
2+
3+
*.htaccess eol=lf
4+
*.cgi eol=lf
5+
*.sh eol=lf
6+
7+
*.css text
8+
*.htm text
9+
*.html text
10+
*.js text
11+
*.json text
12+
*.php text
13+
*.txt text
14+
*.md text
15+
16+
*.png -text
17+
*.gif -text
18+
*.jpg -text

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/**

.npmignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
tests/**
2+
sample/**

CONTRIBUTING.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Contributing
2+
========================================
3+
4+
Information about contributing can be found on the following page: <https://github.com/ckeditor/ckeditor5/blob/master/CONTRIBUTING.md>.

LICENSE.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Software License Agreement
2+
==========================
3+
4+
**CKEditor 5 classic build**https://github.com/ckeditor/ckeditor5-build-classic <br>
5+
Copyright (c) 2003-2017, [CKSource](http://cksource.com) Frederico Knabben. All rights reserved.
6+
7+
Licensed under the terms of any of the following licenses at your choice:
8+
9+
* [GNU General Public License Version 2 or later (the "GPL")](http://www.gnu.org/licenses/gpl.html)
10+
* [GNU Lesser General Public License Version 2.1 or later (the "LGPL")](http://www.gnu.org/licenses/lgpl.html)
11+
* [Mozilla Public License Version 1.1 or later (the "MPL")](http://www.mozilla.org/MPL/MPL-1.1.html)
12+
13+
You are not required to, but if you want to explicitly declare the license you have chosen to be bound to when using, reproducing, modifying and distributing this software, just include a text file titled "legal.txt" in your version of this software, indicating your license choice. In any case, your choice will not restrict any recipient of your version of this software to use, reproduce, modify and distribute this software under any of the above licenses.
14+
15+
Sources of Intellectual Property Included in CKEditor
16+
-----------------------------------------------------
17+
18+
Where not otherwise indicated, all CKEditor content is authored by CKSource engineers and consists of CKSource-owned intellectual property. In some specific instances, CKEditor will incorporate work done by developers outside of CKSource with their express permission.
19+
20+
Trademarks
21+
----------
22+
23+
**CKEditor** is a trademark of [CKSource](http://cksource.com) Frederico Knabben. All other brand and product names are trademarks, registered trademarks or service marks of their respective holders.

README.md

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
CKEditor 5 classic build
2+
========================================
3+
4+
[![npm version](https://badge.fury.io/js/%40ckeditor%2Fckeditor5-build-classic.svg)](https://www.npmjs.com/package/@ckeditor/ckeditor5-build-classic)
5+
[![Dependency Status](https://david-dm.org/ckeditor/ckeditor5-build-classic/status.svg)](https://david-dm.org/ckeditor/ckeditor5-build-classic)
6+
[![devDependency Status](https://david-dm.org/ckeditor/ckeditor5-build-classic/dev-status.svg)](https://david-dm.org/ckeditor/ckeditor5-build-classic?type=dev)
7+
8+
Classic build of CKEditor 5. Features the [classic creator](https://github.com/ckeditor/ckeditor5-editor-classic) and the standard set of article features.
9+
10+
## Bundles
11+
12+
The package contain two bundles of the classic editor:
13+
14+
* `build/ckeditor.js` – minified, ES6 version of the bundle,
15+
* `build/ckeditor.compat.js` – minified, backward-compatible version of the bundle (`babel-preset-env` is configured to support `[ 'last 2 versions', 'ie >= 11' ]`).
16+
17+
## Usage
18+
19+
First, install the build from npm:
20+
21+
```
22+
npm install --save @ckeditor/ckeditor5-build-classic
23+
```
24+
25+
And use it in your website:
26+
27+
```html
28+
<div id="editor">
29+
<p>This is the editor content.</p>
30+
</div>
31+
<script src="./node_modules/@ckeditor/ckeditor5-build-classic/build/ckeditor.js"></script>
32+
<script>
33+
ClassicEditor.create( document.querySelector( '#editor' ) )
34+
.then( editor => {
35+
window.editor = editor;
36+
} )
37+
.catch( err => {
38+
console.error( err.stack );
39+
} );
40+
</script>
41+
```
42+
43+
Or in your JavaScript application:
44+
45+
```js
46+
import { ClassicEditor } from '@ckeditor/ckeditor5-build-classic/build/ckeditor';
47+
48+
// or using CommonJS verion:
49+
// const ClassicEditor = require( '@ckeditor/ckeditor5-build-classic/build/ckeditor' ).ClassicEditor;
50+
51+
ClassicEditor.create( document.querySelector( '#editor' ) )
52+
.then( editor => {
53+
window.editor = editor;
54+
} )
55+
.catch( err => {
56+
console.error( err.stack );
57+
} );
58+
```
59+
60+
**Note:** If you're planning to integrate CKEditor 5 deep into your application it's actually more convenient and recommended to install and import the source modules directly (like it happens in `ckeditor.js`).
61+
62+
## Rebuilding the bundle
63+
64+
**Note:** This section assumes that you cloned this package repository and execute the commands inside it.
65+
66+
You can modify `config-editor.js`, `config-build.js` or any of the Webpack configs and run:
67+
68+
```
69+
npm run build
70+
```
71+
72+
To rebuild the entry-point (`ckeditor.js`) and both builds (`build/*`).
73+
74+
You can also modify `ckeditor.js` directly and run one of `npm run build-ckeditor` or `npm run build-ckeditor-compat`.
75+
76+
## License
77+
78+
Licensed under the GPL, LGPL and MPL licenses, at your choice. For full details about the license, please check the `LICENSE.md` file.

bin/build-ckeditor-compat.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
3+
echo "Building 'build/ckeditor.compat.js'..."
4+
echo ""
5+
6+
webpack --config webpack.compat.config.js
7+
8+
echo ""
9+
echo "Done."

bin/build-ckeditor.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
3+
echo "Building 'build/ckeditor.js'..."
4+
echo ""
5+
6+
webpack
7+
8+
echo ""
9+
echo "Done."

bin/create-entry-file.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
5+
* For licensing, see LICENSE.md.
6+
*/
7+
8+
'use strict';
9+
10+
const { bundler } = require( '@ckeditor/ckeditor5-dev-utils' );
11+
const buildConfig = require( '../config-build' );
12+
13+
console.log( 'Creating the entry file...' );
14+
15+
bundler.createEntryFile( 'ckeditor.js', './config-editor', buildConfig );
16+
17+
console.log( 'Done.' );

build/ckeditor.compat.js

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/ckeditor.compat.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/ckeditor.js

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/ckeditor.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ckeditor.js

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
3+
* For licensing, see LICENSE.md.
4+
*/
5+
6+
import ClassicEditorBase from '@ckeditor/ckeditor5-editor-classic/src/classic';
7+
import AutoformatPlugin from '@ckeditor/ckeditor5-autoformat/src/autoformat';
8+
import BoldPlugin from '@ckeditor/ckeditor5-basic-styles/src/bold';
9+
import ItalicPlugin from '@ckeditor/ckeditor5-basic-styles/src/italic';
10+
import ClipboardPlugin from '@ckeditor/ckeditor5-clipboard/src/clipboard';
11+
import EnterPlugin from '@ckeditor/ckeditor5-enter/src/enter';
12+
import HeadingPlugin from '@ckeditor/ckeditor5-heading/src/heading';
13+
import ImagePlugin from '@ckeditor/ckeditor5-image/src/image';
14+
import ImagecaptionPlugin from '@ckeditor/ckeditor5-image/src/imagecaption';
15+
import ImagestylePlugin from '@ckeditor/ckeditor5-image/src/imagestyle';
16+
import ImagetoolbarPlugin from '@ckeditor/ckeditor5-image/src/imagetoolbar';
17+
import LinkPlugin from '@ckeditor/ckeditor5-link/src/link';
18+
import ListPlugin from '@ckeditor/ckeditor5-list/src/list';
19+
import ParagraphPlugin from '@ckeditor/ckeditor5-paragraph/src/paragraph';
20+
import TypingPlugin from '@ckeditor/ckeditor5-typing/src/typing';
21+
import UndoPlugin from '@ckeditor/ckeditor5-undo/src/undo';
22+
23+
export class ClassicEditor extends ClassicEditorBase {}
24+
25+
ClassicEditor.build = {
26+
plugins: [
27+
AutoformatPlugin,
28+
BoldPlugin,
29+
ItalicPlugin,
30+
ClipboardPlugin,
31+
EnterPlugin,
32+
HeadingPlugin,
33+
ImagePlugin,
34+
ImagecaptionPlugin,
35+
ImagestylePlugin,
36+
ImagetoolbarPlugin,
37+
LinkPlugin,
38+
ListPlugin,
39+
ParagraphPlugin,
40+
TypingPlugin,
41+
UndoPlugin
42+
],
43+
config: require( './config-editor' )
44+
};

config-build.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
3+
* For licensing, see LICENSE.md.
4+
*/
5+
6+
'use strict';
7+
8+
module.exports = {
9+
editor: '@ckeditor/ckeditor5-editor-classic/src/classic',
10+
moduleName: 'ClassicEditor',
11+
plugins: [
12+
'@ckeditor/ckeditor5-autoformat/src/autoformat',
13+
'@ckeditor/ckeditor5-basic-styles/src/bold',
14+
'@ckeditor/ckeditor5-basic-styles/src/italic',
15+
'@ckeditor/ckeditor5-clipboard/src/clipboard',
16+
'@ckeditor/ckeditor5-enter/src/enter',
17+
'@ckeditor/ckeditor5-heading/src/heading',
18+
'@ckeditor/ckeditor5-image/src/image',
19+
'@ckeditor/ckeditor5-image/src/imagecaption',
20+
'@ckeditor/ckeditor5-image/src/imagestyle',
21+
'@ckeditor/ckeditor5-image/src/imagetoolbar',
22+
'@ckeditor/ckeditor5-link/src/link',
23+
'@ckeditor/ckeditor5-list/src/list',
24+
'@ckeditor/ckeditor5-paragraph/src/paragraph',
25+
'@ckeditor/ckeditor5-typing/src/typing',
26+
'@ckeditor/ckeditor5-undo/src/undo',
27+
]
28+
};

config-editor.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
3+
* For licensing, see LICENSE.md.
4+
*/
5+
6+
'use strict';
7+
8+
module.exports = {
9+
toolbar: [
10+
'headings',
11+
'bold',
12+
'italic',
13+
'link',
14+
'unlink',
15+
'bulletedList',
16+
'numberedList',
17+
'undo',
18+
'redo'
19+
]
20+
};

package.json

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "@ckeditor/ckeditor5-build-classic",
3+
"version": "0.0.1",
4+
"description": "CKEditor 5 classic build.",
5+
"keywords": [],
6+
"main": "./build/ckeditor.js",
7+
"dependencies": {
8+
"@ckeditor/ckeditor5-editor-classic": "*",
9+
"@ckeditor/ckeditor5-autoformat": "*",
10+
"@ckeditor/ckeditor5-basic-styles": "*",
11+
"@ckeditor/ckeditor5-clipboard": "*",
12+
"@ckeditor/ckeditor5-enter": "*",
13+
"@ckeditor/ckeditor5-heading": "*",
14+
"@ckeditor/ckeditor5-image": "*",
15+
"@ckeditor/ckeditor5-link": "*",
16+
"@ckeditor/ckeditor5-list": "*",
17+
"@ckeditor/ckeditor5-paragraph": "*",
18+
"@ckeditor/ckeditor5-typing": "*",
19+
"@ckeditor/ckeditor5-undo": "*"
20+
},
21+
"devDependencies": {
22+
"@ckeditor/ckeditor5-dev-utils": "^2.5.0",
23+
"babel-core": "^6.24.0",
24+
"babel-loader": "^6.4.0",
25+
"babel-preset-env": "^1.2.2",
26+
"babili-webpack-plugin": "^0.0.11",
27+
"regenerator-runtime": "^0.10.3",
28+
"webpack": "^2.3.2"
29+
},
30+
"engines": {
31+
"node": ">=6.0.0",
32+
"npm": ">=3.0.0"
33+
},
34+
"author": "CKSource (http://cksource.com/)",
35+
"license": "(GPL-2.0 OR LGPL-2.1 OR MPL-1.1)",
36+
"homepage": "https://ckeditor5.github.io",
37+
"bugs": "https://github.com/ckeditor/ckeditor5-build-classic/issues",
38+
"repository": {
39+
"type": "git",
40+
"url": "https://github.com/ckeditor/ckeditor5-build-classic.git"
41+
},
42+
"scripts": {
43+
"build": "npm run create-entry-file && npm run build-ckeditor && npm run build-ckeditor-compat",
44+
"create-entry-file": "./bin/create-entry-file.js",
45+
"build-ckeditor": "./bin/build-ckeditor.sh",
46+
"build-ckeditor-compat": "./bin/build-ckeditor-compat.sh"
47+
}
48+
}

sample/index.html

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>CKEditor 5 – classic build sample</title>
6+
<style>
7+
body {
8+
max-width: 800px;
9+
margin: 20px auto;
10+
}
11+
</style>
12+
</head>
13+
<body>
14+
15+
<h1>CKEditor 5 – classic build sample</h1>
16+
17+
<div id="editor">
18+
<h2>About CKEditor&nbsp;5</h2>
19+
20+
<p>This is <a href="https://ckeditor5.github.io">CKEditor&nbsp;5</a>.
21+
</p>
22+
23+
<figure class="image">
24+
<img src="../tests/manual/sample.jpg" alt="Autumn fields" />
25+
</figure>
26+
27+
<p>After more than 2 years of building the next generation editor from
28+
scratch and closing over 980 tickets, we created a highly <strong>extensible
29+
and flexible architecture</strong> which consists of an <strong>amazing
30+
editing framework</strong> and <strong>editing
31+
solutions</strong> that will be built on top of it.</p>
32+
33+
<h3>Notes</h3>
34+
35+
<p><a href="https://ckeditor5.github.io">CKEditor&nbsp;5</a> is <em>under
36+
heavy development</em> and this demo is not production-ready
37+
software. For example:</p>
38+
39+
<ul>
40+
<li><strong>Only Chrome, Opera and Safari are supported</strong>.
41+
</li>
42+
<li>Firefox requires enabling the <a
43+
href="https://developer.mozilla.org/en-US/docs/Web/API/Document/onselectionchange">&ldquo;dom.select_events.enabled&rdquo;</a>
44+
option.
45+
</li>
46+
<li><a href="https://github.com/ckeditor/ckeditor5/issues/342">Support
47+
for pasting</a> is under development (content filtering is
48+
unstable).
49+
</li>
50+
</ul>
51+
52+
<p>It has <em>bugs</em> that we are aware of &mdash; and that we
53+
will be working on in the next few iterations of the project. Stay
54+
tuned for some updates soon!</p>
55+
</div>
56+
57+
<script src="../build/ckeditor.js"></script>
58+
<script>
59+
ClassicEditor.create( document.querySelector( '#editor' ) )
60+
.then( editor => {
61+
window.editor = editor;
62+
} )
63+
.catch( err => {
64+
console.error( err.stack );
65+
} );
66+
</script>
67+
68+
</body>
69+
</html>

0 commit comments

Comments
 (0)