Parcourir la source

Merge branch 'master' into t/473

Piotrek Koszuliński il y a 8 ans
Parent
commit
2340743e2a

+ 19 - 0
.github/ISSUE_TEMPLATE.md

@@ -0,0 +1,19 @@
+## 🐞 Is this a bug report or feature request? (choose one)
+
+- Bug report
+- Feature request
+
+## 💻 Version of CKEditor
+
+<!-- Please specify CKEditor version, build type and all customizations. -->
+
+## 📋 Steps to reproduce
+
+1.
+2.
+
+## ✅ Expected result
+
+## ❎ Actual result
+
+## 📃 Other details that might be useful

+ 1 - 1
.travis.yml

@@ -22,7 +22,7 @@ script:
   - npm t -- --reporter=dots
   - npm run docs:api -- --validate-only
 after_success:
-  - ./node_modules/.bin/ckeditor5-dev-docs-publish-nightly
+  - travis_wait ./node_modules/.bin/ckeditor5-dev-docs-publish-nightly
 notifications:
   slack:
     rooms:

+ 10 - 10
docs/_snippets/examples/balloon-editor.js

@@ -6,17 +6,17 @@
 /* globals console, window, document */
 
 import BalloonEditor from '@ckeditor/ckeditor5-build-balloon/src/ckeditor';
-import getToken from '@ckeditor/ckeditor5-easy-image/tests/_utils/gettoken';
 
-getToken()
-	.then( token => {
-		return BalloonEditor
-			.create( document.querySelector( '#snippet-balloon-editor' ), {
-				cloudServices: { token }
-			} )
-			.then( editor => {
-				window.editor = editor;
-			} );
+import { TOKEN_URL } from '@ckeditor/ckeditor5-cloudservices/tests/_utils/cloudservices-config';
+
+BalloonEditor
+	.create( document.querySelector( '#snippet-balloon-editor' ), {
+		cloudServices: {
+			tokenUrl: TOKEN_URL
+		}
+	} )
+	.then( editor => {
+		window.editor = editor;
 	} )
 	.catch( err => {
 		console.error( err );

+ 12 - 13
docs/_snippets/examples/classic-editor.js

@@ -5,20 +5,19 @@
 
 /* globals ClassicEditor, console, window, document */
 
-import getToken from '@ckeditor/ckeditor5-easy-image/tests/_utils/gettoken';
+import { TOKEN_URL } from '@ckeditor/ckeditor5-cloudservices/tests/_utils/cloudservices-config';
 
-getToken()
-	.then( token => {
-		return ClassicEditor
-			.create( document.querySelector( '#snippet-classic-editor' ), {
-				cloudServices: { token },
-				toolbar: {
-					viewportTopOffset: 60
-				}
-			} )
-			.then( editor => {
-				window.editor = editor;
-			} );
+ClassicEditor
+	.create( document.querySelector( '#snippet-classic-editor' ), {
+		cloudServices: {
+			tokenUrl: TOKEN_URL
+		},
+		toolbar: {
+			viewportTopOffset: 60
+		}
+	} )
+	.then( editor => {
+		window.editor = editor;
 	} )
 	.catch( err => {
 		console.error( err );

+ 8 - 10
docs/_snippets/examples/inline-editor.js

@@ -6,7 +6,7 @@
 /* globals console, window, document */
 
 import InlineEditor from '@ckeditor/ckeditor5-build-inline/src/ckeditor';
-import getToken from '@ckeditor/ckeditor5-easy-image/tests/_utils/gettoken';
+import { TOKEN_URL } from '@ckeditor/ckeditor5-cloudservices/tests/_utils/cloudservices-config';
 
 const inlineInjectElements = document.querySelectorAll( '#snippet-inline-editor [data-inline-inject]' );
 
@@ -18,6 +18,9 @@ Array.from( inlineInjectElements ).forEach( inlineElement => {
 		},
 		toolbar: {
 			viewportTopOffset: 60
+		},
+		cloudServices: {
+			tokenUrl: TOKEN_URL
 		}
 	};
 
@@ -36,15 +39,10 @@ Array.from( inlineInjectElements ).forEach( inlineElement => {
 		config.toolbar.items = [ 'headings', 'bold', 'italic', 'link' ];
 	}
 
-	getToken()
-		.then( token => {
-			config.cloudServices = { token };
-
-			return InlineEditor
-				.create( inlineElement, config )
-				.then( editor => {
-					window.editor = editor;
-				} );
+	InlineEditor
+		.create( inlineElement, config )
+		.then( editor => {
+			window.editor = editor;
 		} )
 		.catch( err => {
 			console.error( err );

+ 1 - 1
docs/features/image-upload.md

@@ -50,7 +50,7 @@ To make enabling image upload in CKEditor 5 a breeze, by default all builds incl
 	ClassicCreator
 		.create( document.querySelector( '#editor' ), {
 			cloudServices: {
-				token: 'token-retrieved-from-the-cs-token-server'
+				tokenUrl: 'http://url-to-retrieve-token.example.com/'
 			}
 		} )
 		.then( ... )

+ 7 - 7
docs/framework/guides/architecture/intro.md

@@ -35,7 +35,7 @@ The editor is a root object, gluing all other components. It holds a couple of p
 * {@link module:core/editor/editor~Editor#plugins} and {@link module:core/editor/editor~Editor#commands} &ndash; The collection of loaded plugins and commands.
 * {@link module:core/editor/editor~Editor#document} &ndash; The document. It is the editing engine's entry point.
 * {@link module:core/editor/editor~Editor#data} &ndash; The data controller (there is also the {@link module:core/editor/editor~Editor#editing editing controller} but [we plan to merge it](https://github.com/ckeditor/ckeditor5-engine/issues/678) into the data controller). It is a set of high-level utilities to work on the document,
-* {@link module:core/editor/editor~Editor#keystrokes} &ndash; The keystroke handler. It allows to bind keystrokes to actions.
+* {@link module:core/editor/standardeditor~StandardEditor#keystrokes} &ndash; The keystroke handler. It allows to bind keystrokes to actions.
 
 Besides that, the editor exposes a few of methods:
 
@@ -383,7 +383,7 @@ class SampleInputView extends View {
 			placeholder: ''
 		} );
 
-		this.template = new Template( {
+		this.setTemplate( {
 			tag: 'input',
 			attributes: {
 				class: [
@@ -422,7 +422,7 @@ class ParentView extends View {
 		const childA = new SampleInputView( locale );
 		const childB = new SampleInputView( locale );
 
-		this.template = new Template( {
+		this.setTemplate( {
 			tag: 'div',
 			children: [
 				childA
@@ -434,18 +434,18 @@ class ParentView extends View {
 
 const parent = new ParentView( locale );
 
-parent.init();
+parent.render();
 
 // Will insert <div><input .. /><input .. /></div>.
 document.body.appendChild( parent.element );
 ```
 
-It is also possible to create standalone views that do not belong to any collection. They must be {@link module:ui/view~View#init initialized} before  injection into DOM:
+It is also possible to create standalone views that do not belong to any collection. They must be {@link module:ui/view~View#render rendered} before  injection into DOM:
 
 ```js
 const view = new SampleInputView( locale );
 
-view.init();
+view.render();
 
 // Will insert <input class="foo" type="text" placeholder="" />
 document.body.appendChild( view.element );
@@ -625,7 +625,7 @@ toolbar.items.add( buttonBar );
 The toolbar can now join the [UI tree](##View-collections-and-the-UI-tree) or it can be injected straight into DOM. To keep the example simple, proceed with the latter scenario:
 
 ```js
-toolbar.init();
+toolbar.render();
 
 document.body.appendChild( toolbar.element );
 ```

+ 10 - 10
docs/framework/guides/contributing/git-commit-message-convention.md

@@ -10,7 +10,7 @@ Every commit made *directly* to the `master` branch must follow the below conven
 <info-box>
 	Commits in the ticket branches are not analyzed for the changelog and do not have to follow any specific convention (other than finishing sentences with periods). In case of ticket branches, **only merge commits are analyzed**.
 
-	Therefore, this guide is mainly targeted to core team members. However, it may help you to understand how to write a suggested commit message when creating a PR for CKEditor 5.
+	Therefore, this guide is mainly targeted at core team members. However, it may help you understand how to write a suggested commit message when creating a pull request for CKEditor 5.
 </info-box>
 
 ## Convention
@@ -34,7 +34,7 @@ BREAKING CHANGE: Another breaking change if needed. Closes #YYY.
 | --- | --- | --- | --- |
 | Feature | `minor` | A new feature. | Visible |
 | Fix | `patch` | A bug fix. Should also be used for enhancements if they do not introduce new features at the same time. | Visible |
-| Other | `patch` | An enhancement – when it is neither a bug fix nor a feature. For example – public API refactoring. Use it also if you do not want to admit that it was a bug ;). | Visible |
+| Other | `patch` | An enhancement &mdash; when it is neither a bug fix nor a feature. Example: public API refactoring. Use it also if you do not want to admit that it was a bug ;). | Visible |
 | Code style | `patch` | Our beloved code style improvements (used in the broad meaning of general code quality). | Hidden |
 | Docs | `patch` | Updated documentation. | Hidden |
 | Internal | `patch` | Other kinds of internal changes. | Hidden |
@@ -69,27 +69,27 @@ A bug fix for an existing feature (closes two tickets):
 Fix: The editor will be great again. Closes #3. Closes #4.
 ```
 
-Commit with updated the documentation:
+Commit with updated documentation:
 
 ```
 Docs: Updated the README.
 ```
 
-Commit which provides / changes the tests:
+Commit which provides or changes the tests:
 
 ```
 Tests: Introduced missing tests. Closes #5.
 ```
 
-An enhancement which is not backward compatible. Public API has been changed:
+An enhancement which is not backward compatible. Public API was changed:
 
 ```
 Other: Extracted `utils.moo()` to a separate package. Closes #9.
 
-BREAKING CHANGE: The `util.moo()` method is now available in the `moo` packages. See #9.
+BREAKING CHANGE: The `util.moo()` method is now available in the `moo` package. See #9.
 ```
 
-For the commits above the changelog will look like this:
+For the commits shown above the changelog will look like this:
 
 ```md
 Changelog
@@ -113,7 +113,7 @@ Changelog
 
 ### BREAKING CHANGES
 
-* The `util.moo()` method is now available in the `moo` packages. See [#9](https://github.com/ckeditor/ckeditor5-dev/issue/9).
+* The `util.moo()` method is now available in the `moo` package. See [#9](https://github.com/ckeditor/ckeditor5-dev/issue/9).
 
 ### NOTE
 
@@ -136,7 +136,7 @@ Things like:
 
 should be checked and added if missing.
 
-As a reviewer, remember that the message will end up in the changelog and must be understandable in a broad context of the entire editor. It is not for you  it is for other developers.
+As a reviewer, remember that the message will end up in the changelog and must be understandable in a broad context of the entire editor. It is not for you &mdash; it is for other developers.
 
 When closing a PR remember to copy the source of the message to the textarea with the merge commit message:
 
@@ -144,7 +144,7 @@ When closing a PR remember to copy the source of the message to the textarea wit
 
 ### Giving credit
 
-When closing a non-core contributor's PR make sure to add an information about the contributor to the commit message. For example:
+When closing a non-core contributor's PR make sure to add information about the contributor to the commit message. For example:
 
 ```
 Feature: Added support for RTL languages. Closes #1.

+ 1 - 1
docs/index.md

@@ -7,7 +7,7 @@ sitenav: false
 
 <dl><dt>{@link builds/guides/overview CKEditor 5 Builds documentation}</dt><dd>Learn how to install, integrate and configure CKEditor 5 Builds. More complex aspects, like creating custom builds, are explained here, too.</dd>
 <dt>{@link framework/guides/overview CKEditor 5 Framework documentation}</dt><dd>Learn how to work with CKEditor 5 Framework, customize it, create your own plugins and custom editors, change the UI or even bring your own UI to the editor.</dd>
-<dt>{@link examples/index CKEditor 5 Examples}<dt><dd>Try out all CKEditor 5 Builds. See some of the possible customizations of CKEditor.</dd>
+<dt>{@link examples/index CKEditor 5 Examples}</dt><dd>Try out all CKEditor 5 Builds. See some of the possible customizations of CKEditor.</dd>
 <dt>{@link features/index CKEditor 5 Features}</dt><dd>Learn about selected features included in CKEditor 5 Builds.</dd>
 <dt>{@link api/index CKEditor 5 API Reference}</dt><dd>A complete API documentation.</dd></dl>
 

+ 29 - 4
docs/umberto.json

@@ -11,10 +11,35 @@
 	"docsearch": {
 		"apiKey": "fc463c26455365ad403d5ec51796cd73",
 		"indexName": "ckeditor_nightly",
-		"importants": [
-			"module:editor-balloon/ballooneditor~BalloonEditor.create",
-			"module:editor-classic/classiceditor~ClassicEditor.create",
-			"module:editor-inline/inlineeditor~InlineEditor.create"
+		"customRanking": [
+			{
+				"url": "api/module_core_editor_editorconfig-EditorConfig.html",
+				"rank": 10
+			},
+			{
+				"url": "api/module_heading_heading-HeadingConfig.html",
+				"rank": 7
+			},
+			{
+				"url": "api/module_image_image-ImageConfig.html",
+				"rank": 7
+			},
+			{
+				"url": "api/module_editor-classic_classiceditor-ClassicEditor.html",
+				"rank": 5
+			},
+			{
+				"url": "api/module_editor-balloon_ballooneditor-BalloonEditor.html",
+				"rank": 5
+			},
+			{
+				"url": "api/module_editor-inline_inlineeditor-InlineEditor.html",
+				"rank": 5
+			},
+			{
+				"url": "api/module_utils_config.html",
+				"rank": -5
+			}
 		]
 	},
 	"googleanalytics": {

+ 163 - 0
gulpfile.js

@@ -0,0 +1,163 @@
+/**
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* eslint-env node */
+
+'use strict';
+
+const path = require( 'path' );
+const gulp = require( 'gulp' );
+
+// Tests. ---------------------------------------------------------------------
+
+gulp.task( 'test', () => {
+	return require( '@ckeditor/ckeditor5-dev-tests' )
+		.runAutomatedTests( getTestOptions() );
+} );
+
+gulp.task( 'test:manual', () => {
+	return require( '@ckeditor/ckeditor5-dev-tests' )
+		.runManualTests( getTestOptions() );
+} );
+
+function getTestOptions() {
+	return require( '@ckeditor/ckeditor5-dev-tests' )
+		.parseArguments( process.argv.slice( 2 ) );
+}
+
+// Documentation. -------------------------------------------------------------
+
+gulp.task( 'docs', () => {
+	const skipLiveSnippets = process.argv.includes( '--skip-snippets' );
+	const skipApi = process.argv.includes( '--skip-api' );
+	const production = process.argv.includes( '--production' );
+
+	if ( skipApi ) {
+		const fs = require( 'fs' );
+		const apiJsonPath = './docs/api/output.json';
+
+		if ( fs.existsSync( apiJsonPath ) ) {
+			fs.unlinkSync( apiJsonPath );
+		}
+
+		return runUmberto( {
+			skipLiveSnippets,
+			skipApi,
+			production
+		} );
+	}
+
+	// Simple way to reuse existing api/output.json:
+	// return Promise.resolve()
+	return buildApiDocs()
+		.then( () => {
+			return runUmberto( {
+				skipLiveSnippets,
+				production
+			} );
+		} );
+} );
+
+gulp.task( 'docs:api', buildApiDocs );
+
+function buildApiDocs() {
+	assertIsInstalled( '@ckeditor/ckeditor5-dev-docs' );
+
+	const ckeditor5Docs = require( '@ckeditor/ckeditor5-dev-docs' );
+
+	return ckeditor5Docs
+		.build( {
+			readmePath: path.join( process.cwd(), 'README.md' ),
+			sourceFiles: [
+				process.cwd() + '/packages/ckeditor5-*/src/**/*.@(js|jsdoc)',
+				'!' + process.cwd() + '/packages/ckeditor5-*/src/lib/**/*.js',
+				'!' + process.cwd() + '/packages/ckeditor5-build-*/src/**/*.js'
+			],
+			validateOnly: process.argv[ 3 ] == '--validate-only'
+		} );
+}
+
+function runUmberto( options ) {
+	assertIsInstalled( 'umberto' );
+	const umberto = require( 'umberto' );
+
+	return umberto.buildSingleProject( {
+		configDir: 'docs',
+		clean: true,
+		skipLiveSnippets: options.skipLiveSnippets,
+		snippetOptions: {
+			production: options.production
+		},
+		skipApi: options.skipApi
+	} );
+}
+
+// Translations. --------------------------------------------------------------
+
+gulp.task( 'translations:collect', () => {
+	assertIsInstalled( '@ckeditor/ckeditor5-dev-env' );
+
+	return require( '@ckeditor/ckeditor5-dev-env' ).collectTranslations();
+} );
+
+gulp.task( 'translations:upload', () => {
+	assertIsInstalled( '@ckeditor/ckeditor5-dev-env' );
+
+	return require( '@ckeditor/ckeditor5-dev-env' ).uploadTranslations();
+} );
+
+gulp.task( 'translations:download', () => {
+	assertIsInstalled( '@ckeditor/ckeditor5-dev-env' );
+
+	return require( '@ckeditor/ckeditor5-dev-env' ).downloadTranslations();
+} );
+
+// Releasing. -----------------------------------------------------------------
+
+gulp.task( 'changelog', () => {
+	assertIsInstalled( '@ckeditor/ckeditor5-dev-env' );
+
+	const devEnv = require( '@ckeditor/ckeditor5-dev-env' );
+	const commonOptions = {
+		cwd: process.cwd(),
+		packages: 'packages'
+	};
+	const editorBuildsGlob = '@ckeditor/ckeditor5-build-*';
+
+	const optionsForDependencies = Object.assign( {}, commonOptions, {
+		skipPackages: editorBuildsGlob
+	} );
+	const optionsForBuilds = Object.assign( {}, commonOptions, {
+		scope: editorBuildsGlob
+	} );
+
+	return Promise.resolve()
+		.then( () => devEnv.generateChangelogForSubRepositories( optionsForDependencies ) )
+		.then( () => devEnv.generateSummaryChangelog( optionsForBuilds ) );
+} );
+
+gulp.task( 'release:dependencies', () => {
+	assertIsInstalled( '@ckeditor/ckeditor5-dev-env' );
+
+	return require( '@ckeditor/ckeditor5-dev-env' )
+		.releaseSubRepositories( {
+			cwd: process.cwd(),
+			packages: 'packages'
+		} );
+} );
+
+// Utils. ---------------------------------------------------------------------
+
+function assertIsInstalled( packageName ) {
+	try {
+		require( packageName + '/package.json' );
+	} catch ( err ) {
+		console.error( `Error: Cannot find package '${ packageName }'.\n` );
+		console.error( 'You need to install optional dependencies.' );
+		console.error( 'Run: \'npm run install-optional-dependencies\'.' );
+
+		process.exit( 1 );
+	}
+}

+ 1 - 0
mgit.json

@@ -10,6 +10,7 @@
     "@ckeditor/ckeditor5-build-classic": "ckeditor/ckeditor5-build-classic",
     "@ckeditor/ckeditor5-build-inline": "ckeditor/ckeditor5-build-inline",
     "@ckeditor/ckeditor5-clipboard": "ckeditor/ckeditor5-clipboard",
+    "@ckeditor/ckeditor5-cloudeservices": "ckeditor/ckeditor5-cloudservices",
     "@ckeditor/ckeditor5-core": "ckeditor/ckeditor5-core",
     "@ckeditor/ckeditor5-easy-image": "ckeditor/ckeditor5-easy-image",
     "@ckeditor/ckeditor5-editor-balloon": "ckeditor/ckeditor5-editor-balloon",

+ 4 - 3
package.json

@@ -21,6 +21,7 @@
     "@ckeditor/ckeditor5-build-classic": "^1.0.0-alpha.1",
     "@ckeditor/ckeditor5-build-inline": "^1.0.0-alpha.1",
     "@ckeditor/ckeditor5-clipboard": "^1.0.0-alpha.1",
+    "@ckeditor/ckeditor5-cloudeservices": "ckeditor/ckeditor5-cloudservices",
     "@ckeditor/ckeditor5-core": "^1.0.0-alpha.1",
     "@ckeditor/ckeditor5-easy-image": "^1.0.0-alpha.1",
     "@ckeditor/ckeditor5-editor-balloon": "^1.0.0-alpha.1",
@@ -44,8 +45,8 @@
     "@ckeditor/ckeditor5-widget": "^1.0.0-alpha.1"
   },
   "devDependencies": {
-    "@ckeditor/ckeditor5-dev-docs": "^7.4.1",
-    "@ckeditor/ckeditor5-dev-tests": "^8.2.2",
+    "@ckeditor/ckeditor5-dev-docs": "^7.5.1",
+    "@ckeditor/ckeditor5-dev-tests": "^8.2.5",
     "eslint": "^4.8.0",
     "eslint-config-ckeditor5": "^1.0.6",
     "husky": "^0.14.3",
@@ -75,7 +76,7 @@
     "translations:collect": "ckeditor5-dev-env-translations collect",
     "translations:download": "ckeditor5-dev-env-translations download",
     "translations:upload": "ckeditor5-dev-env-translations upload",
-    "changelog:dependencies": "node ./scripts/release/changelog-dependencies.js",
+    "changelog": "node ./scripts/release/changelog.js",
     "release:dependencies": "node ./scripts/release/release-dependencies.js",
     "install-optional-dependencies": "sh ./scripts/install-optional-dependencies.sh",
     "switch-to-dev-dev": "sh ./scripts/switch-to-dev-dev.sh",

+ 0 - 20
scripts/release/changelog-dependencies.js

@@ -1,20 +0,0 @@
-#!/usr/bin/env node
-
-/**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-/* eslint-env node */
-
-'use strict';
-
-const assertIsInstalled = require( './../utils/assertisinstalled' );
-
-assertIsInstalled( '@ckeditor/ckeditor5-dev-env' );
-
-require( '@ckeditor/ckeditor5-dev-env' )
-	.generateChangelogForSubRepositories( {
-		cwd: process.cwd(),
-		packages: 'packages'
-	} );

+ 38 - 0
scripts/release/changelog.js

@@ -0,0 +1,38 @@
+#!/usr/bin/env node
+
+/**
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* eslint-env node */
+
+'use strict';
+
+const assertIsInstalled = require( './../utils/assertisinstalled' );
+
+assertIsInstalled( '@ckeditor/ckeditor5-dev-env' );
+
+const devEnv = require( '@ckeditor/ckeditor5-dev-env' );
+const commonOptions = {
+	cwd: process.cwd(),
+	packages: 'packages'
+};
+const editorBuildsGlob = '@ckeditor/ckeditor5-build-*';
+
+const optionsForDependencies = Object.assign( {}, commonOptions, {
+	skipPackages: editorBuildsGlob
+} );
+const optionsForBuilds = Object.assign( {}, commonOptions, {
+	scope: editorBuildsGlob
+} );
+
+Promise.resolve()
+	.then( () => devEnv.generateChangelogForSubRepositories( optionsForDependencies ) )
+	.then( () => devEnv.generateSummaryChangelog( optionsForBuilds ) )
+	.then( () => {
+		console.log( 'Done!' );
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );