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

Commit fbf04dd

Browse files
author
Piotr Jasiun
authored
Merge pull request #2 from ckeditor/t/1
Feature: Initialise repository and CloudeServices plugin. Closes #1.
2 parents 21d592a + 9b138bf commit fbf04dd

File tree

13 files changed

+380
-0
lines changed

13 files changed

+380
-0
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Configurations to normalize the IDE behavior.
2+
# http://editorconfig.org/
3+
4+
root = true
5+
6+
[*]
7+
indent_style = tab
8+
tab_width = 4
9+
charset = utf-8
10+
end_of_line = lf
11+
trim_trailing_whitespace = true
12+
insert_final_newline = true

.eslintrc.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
3+
* For licensing, see LICENSE.md.
4+
*/
5+
6+
/* eslint-env node */
7+
8+
'use strict';
9+
10+
module.exports = {
11+
extends: 'ckeditor5'
12+
};

.gitattributes

Lines changed: 18 additions & 0 deletions
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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

.travis.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
sudo: required
2+
dist: trusty
3+
addons:
4+
apt:
5+
sources:
6+
- google-chrome
7+
packages:
8+
- google-chrome-stable
9+
language: node_js
10+
node_js:
11+
- "6"
12+
cache:
13+
- node_modules
14+
before_install:
15+
- export DISPLAY=:99.0
16+
- sh -e /etc/init.d/xvfb start
17+
install:
18+
- npm install @ckeditor/ckeditor5-dev-tests
19+
- ckeditor5-dev-tests-install-dependencies
20+
script:
21+
- ckeditor5-dev-tests-travis
22+
after_success:
23+
- codeclimate-test-reporter < coverage/lcov.info
24+
- ckeditor5-dev-tests-save-revision

CONTRIBUTING.md

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

LICENSE.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Software License Agreement
2+
==========================
3+
4+
**CKEditor 5 Cloud Services**https://github.com/ckeditor/ckeditor5-cloudservices <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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,19 @@
11
CKEditor 5 Cloud Services base package
22
======================================
3+
4+
[![Join the chat at https://gitter.im/ckeditor/ckeditor5](https://badges.gitter.im/ckeditor/ckeditor5.svg)](https://gitter.im/ckeditor/ckeditor5?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5+
[![npm version](https://badge.fury.io/js/%40ckeditor%2Fckeditor5-cloudservices.svg)](https://www.npmjs.com/package/@ckeditor/ckeditor5-cloudservices)
6+
[![Build Status](https://travis-ci.org/ckeditor/ckeditor5-cloudservices.svg?branch=master)](https://travis-ci.org/ckeditor/ckeditor5-cloudservices)
7+
[![Test Coverage](https://codeclimate.com/github/ckeditor/ckeditor5-cloudservices/badges/coverage.svg)](https://codeclimate.com/github/ckeditor/ckeditor5-cloudservices/coverage)
8+
[![Dependency Status](https://david-dm.org/ckeditor/ckeditor5-cloudservices/status.svg)](https://david-dm.org/ckeditor/ckeditor5-cloudservices)
9+
[![devDependency Status](https://david-dm.org/ckeditor/ckeditor5-cloudservices/dev-status.svg)](https://david-dm.org/ckeditor/ckeditor5-cloudservices?type=dev)
10+
11+
Base package for Cloud Services' integration, which handles CKEditor's `cloudservices` configuration and tokens.
12+
13+
## Documentation
14+
15+
See the [`@ckeditor/ckeditor5-cloudservices` package](https://ckeditor5.github.io/docs/nightly/ckeditor5/latest/api/cloudservices.html) page in [CKEditor 5 documentation](https://ckeditor5.github.io/docs/nightly/ckeditor5/latest/).
16+
17+
## License
18+
19+
Licensed under the GPL, LGPL and MPL licenses, at your choice. For full details about the license, please check the `LICENSE.md` file.

package.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "@ckeditor/ckeditor5-cloudservices",
3+
"version": "1.0.0-alpha.1",
4+
"description": "Base package for CKEditor 5' Cloud Services.",
5+
"keywords": [
6+
"ckeditor5"
7+
],
8+
"dependencies": {
9+
"@ckeditor/ckeditor-cloudservices-core": "^0.2.0",
10+
"@ckeditor/ckeditor5-core": "^1.0.0-alpha.1",
11+
"@ckeditor/ckeditor5-utils": "^1.0.0-alpha.1"
12+
},
13+
"devDependencies": {
14+
"eslint": "^4.8.0",
15+
"eslint-config-ckeditor5": "^1.0.6",
16+
"husky": "^0.14.3",
17+
"lint-staged": "^4.2.3"
18+
},
19+
"engines": {
20+
"node": ">=6.0.0",
21+
"npm": ">=3.0.0"
22+
},
23+
"author": "CKSource (http://cksource.com/)",
24+
"license": "(GPL-2.0 OR LGPL-2.1 OR MPL-1.1)",
25+
"homepage": "https://ckeditor5.github.io",
26+
"bugs": "https://github.com/ckeditor/ckeditor5-cloudservices/issues",
27+
"repository": {
28+
"type": "git",
29+
"url": "https://github.com/ckeditor/ckeditor5-cloudservices.git"
30+
},
31+
"files": [
32+
"src"
33+
],
34+
"scripts": {
35+
"lint": "eslint --quiet '**/*.js'",
36+
"precommit": "lint-staged"
37+
},
38+
"lint-staged": {
39+
"**/*.js": [
40+
"eslint --quiet"
41+
]
42+
},
43+
"eslintIgnore": [
44+
"src/lib/**",
45+
"packages/**"
46+
]
47+
}

src/cloudservices.js

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
/**
2+
* @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
3+
* For licensing, see LICENSE.md.
4+
*/
5+
6+
/**
7+
* @module cloudservices/cloudservices
8+
*/
9+
10+
import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
11+
import Token from '@ckeditor/ckeditor-cloudservices-core/src/token/token';
12+
import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
13+
14+
/**
15+
* Base plugin for Cloud Services. It takes care about the `cloudServices` config options and initializes token provider.
16+
*/
17+
export default class CloudServices extends Plugin {
18+
/**
19+
* @inheritDoc
20+
*/
21+
init() {
22+
const editor = this.editor;
23+
const config = editor.config;
24+
25+
const options = config.get( 'cloudServices' );
26+
27+
for ( const optionName in options ) {
28+
this[ optionName ] = options[ optionName ];
29+
}
30+
31+
/**
32+
* The authentication token URL for CloudServices.
33+
*
34+
* @readonly
35+
* @member {String} #tokenUrl
36+
*/
37+
38+
if ( !this.tokenUrl ) {
39+
/**
40+
* The authentication `cloudServices.token` config is not provided.
41+
*
42+
* @error cloudservices-token-endpoint-not-provided
43+
*/
44+
throw new CKEditorError(
45+
'cloudservices-token-endpoint-not-provided: The authentication `cloudServices.token` config is not provided.'
46+
);
47+
}
48+
49+
/**
50+
* Other plugins use this token for authorization process. It handles token requesting and refreshing.
51+
*
52+
* @readonly
53+
*/
54+
this.token = new CloudServices.Token( this.tokenUrl );
55+
56+
return this.token.init();
57+
}
58+
}
59+
60+
CloudServices.Token = Token;
61+
62+
/**
63+
* The configuration of the Cloud Services. Introduced by the {@link module:cloudservices/cloudservices~CloudServices} plugin.
64+
*
65+
* Read more in {@link module:cloudservices/cloudservices~CloudServices}.
66+
*
67+
* @member {module:cloudservices/cloudservices~CloudServicesConfig} module:core/editor/editorconfig~EditorConfig#cloudServices
68+
*/
69+
70+
/**
71+
* The configuration for all plugins using Cloud Services.
72+
*
73+
* ClassicEditor
74+
* .create( {
75+
* cloudServices: ... // CloudServices config.
76+
* } )
77+
* .then( ... )
78+
* .catch( ... );
79+
*
80+
* @interface CloudServicesConfig
81+
*/
82+
83+
/**
84+
* The authentication token URL for CloudServices. Token us used to authenticate all plugins using CloudServices,
85+
* for instance Easy Image. The token URL have to point to the service where the token is generated.
86+
*
87+
* ClassicEditor
88+
* .create( document.querySelector( '#editor' ), {
89+
* cloudServices: {
90+
* tokenUrl: TOKEN_URL
91+
* },
92+
* plugins: [ ArticlePluginSet, EasyImage ],
93+
* toolbar: [ 'headings', 'undo', 'redo', 'insertImage' ],
94+
* image: {
95+
* toolbar: [ 'imageStyleFull', 'imageStyleSide', '|', 'imageTextAlternative' ]
96+
* }
97+
* } );
98+
*
99+
* @member {String} module:cloudservices/cloudservices~CloudServicesConfig#tokenUrl
100+
*/

0 commit comments

Comments
 (0)