@ckeditor/ckeditor5-core
Advanced tools
Comparing version 0.9.0 to 1.0.0-alpha.1
Changelog | ||
========= | ||
## [1.0.0-alpha.1](https://github.com/ckeditor/ckeditor5-core/compare/v0.9.0...v1.0.0-alpha.1) (2017-10-03) | ||
### Features | ||
* The `StandardEditor` should automatically update the contents of its source textarea upon submission of the form. Closes https://github.com/ckeditor/ckeditor5/issues/544. ([ce46fde](https://github.com/ckeditor/ckeditor5-core/commit/ce46fde)) | ||
## [0.9.0](https://github.com/ckeditor/ckeditor5-core/compare/v0.8.1...v0.9.0) (2017-09-03) | ||
@@ -5,0 +12,0 @@ |
{ | ||
"name": "@ckeditor/ckeditor5-core", | ||
"version": "0.9.0", | ||
"description": "", | ||
"keywords": [], | ||
"version": "1.0.0-alpha.1", | ||
"description": "CKEditor 5 core editor architecture.", | ||
"keywords": [ | ||
"ckeditor5", | ||
"ckeditor5-lib" | ||
], | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-engine": "^0.11.0", | ||
"@ckeditor/ckeditor5-utils": "^0.10.0" | ||
"@ckeditor/ckeditor5-engine": "^1.0.0-alpha.1", | ||
"@ckeditor/ckeditor5-utils": "^1.0.0-alpha.1" | ||
}, | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-dev-lint": "^3.1.0", | ||
"@ckeditor/ckeditor5-ui": "^0.10.0", | ||
"eslint-config-ckeditor5": "^1.0.5", | ||
"@ckeditor/ckeditor5-autoformat": "^1.0.0-alpha.1", | ||
"@ckeditor/ckeditor5-basic-styles": "^1.0.0-alpha.1", | ||
"@ckeditor/ckeditor5-block-quote": "^1.0.0-alpha.1", | ||
"@ckeditor/ckeditor5-editor-classic": "^1.0.0-alpha.1", | ||
"@ckeditor/ckeditor5-dev-lint": "^3.1.4", | ||
"@ckeditor/ckeditor5-heading": "^1.0.0-alpha.1", | ||
"@ckeditor/ckeditor5-image": "^1.0.0-alpha.1", | ||
"@ckeditor/ckeditor5-link": "^1.0.0-alpha.1", | ||
"@ckeditor/ckeditor5-list": "^1.0.0-alpha.1", | ||
"@ckeditor/ckeditor5-paragraph": "^1.0.0-alpha.1", | ||
"@ckeditor/ckeditor5-essentials": "^1.0.0-alpha.1", | ||
"@ckeditor/ckeditor5-ui": "^1.0.0-alpha.1", | ||
"eslint-config-ckeditor5": "^1.0.6", | ||
"gulp": "^3.9.1", | ||
@@ -28,3 +41,8 @@ "guppy-pre-commit": "^0.4.0" | ||
"url": "https://github.com/ckeditor/ckeditor5-core.git" | ||
} | ||
}, | ||
"files": [ | ||
"lang", | ||
"src", | ||
"theme" | ||
] | ||
} |
@@ -11,6 +11,10 @@ CKEditor 5 core editor architecture | ||
More information about the project can be found at the following URL: <https://github.com/ckeditor/ckeditor5-core>. | ||
This package implements CKEditor 5's core editor architecture — a set of classes and interfaces which glue everything together. | ||
## Documentation | ||
See the [`@ckeditor/ckeditor5-core` package](https://ckeditor5.github.io/docs/nightly/ckeditor5/latest/api/core.html) page in [CKEditor 5 documentation](https://ckeditor5.github.io/docs/nightly/ckeditor5/latest/). | ||
## License | ||
Licensed under the GPL, LGPL and MPL licenses, at your choice. For full details about the license, please check the `LICENSE.md` file. |
@@ -50,3 +50,3 @@ /** | ||
* @readonly | ||
* @member {module:core/plugin~PluginCollection} | ||
* @member {module:core/plugincollection~PluginCollection} | ||
*/ | ||
@@ -53,0 +53,0 @@ this.plugins = new PluginCollection( this, availablePlugins ); |
@@ -13,2 +13,3 @@ /** | ||
import EditingController from '@ckeditor/ckeditor5-engine/src/controller/editingcontroller'; | ||
import isFunction from '@ckeditor/ckeditor5-utils/src/lib/lodash/isFunction'; | ||
@@ -21,2 +22,4 @@ import getDataFromElement from '@ckeditor/ckeditor5-utils/src/dom/getdatafromelement'; | ||
* uses {@link module:engine/controller/editingcontroller~EditingController}. | ||
* | ||
* @extends module:core/editor/editor~Editor | ||
*/ | ||
@@ -66,2 +69,4 @@ export default class StandardEditor extends Editor { | ||
this.keystrokes.listenTo( this.editing.view ); | ||
this._attachToForm(); | ||
} | ||
@@ -110,2 +115,43 @@ | ||
/** | ||
* Checks if editor is initialized on textarea element that belongs to a form. If yes - updates editor's element | ||
* contents before submitting the form. | ||
* | ||
* @private | ||
*/ | ||
_attachToForm() { | ||
const element = this.element; | ||
// Only when replacing a textarea which is inside of a form element. | ||
if ( element && element.tagName.toLowerCase() === 'textarea' && element.form ) { | ||
let originalSubmit; | ||
const form = element.form; | ||
const onSubmit = () => this.updateEditorElement(); | ||
// Replace the original form#submit() to call a custom submit function first. | ||
// Check if #submit is a function because the form might have an input named "submit". | ||
if ( isFunction( form.submit ) ) { | ||
originalSubmit = form.submit; | ||
form.submit = () => { | ||
onSubmit(); | ||
originalSubmit.apply( form ); | ||
}; | ||
} | ||
// Update the replaced textarea with data before each form#submit event. | ||
form.addEventListener( 'submit', onSubmit ); | ||
// Remove the submit listener and revert the original submit method on | ||
// editor#destroy. | ||
this.on( 'destroy', () => { | ||
form.removeEventListener( 'submit', onSubmit ); | ||
if ( originalSubmit ) { | ||
form.submit = originalSubmit; | ||
} | ||
} ); | ||
} | ||
} | ||
/** | ||
* Creates a standard editor instance. | ||
@@ -112,0 +158,0 @@ * |
@@ -124,2 +124,5 @@ /** | ||
* | ||
* Naming a plugin is necessary to enable removing it through the | ||
* {@link module:core/editor/editorconfig~EditorConfig#removePlugins `config.removePlugins`} option. | ||
* | ||
* @static | ||
@@ -126,0 +129,0 @@ * @readonly |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
20
74579
15
62
1040
1
+ Added@ckeditor/ckeditor5-engine@1.0.0-beta.4(transitive)
+ Added@ckeditor/ckeditor5-utils@1.0.0-beta.4(transitive)
- Removed@ckeditor/ckeditor5-engine@0.11.0(transitive)
- Removed@ckeditor/ckeditor5-utils@0.10.0(transitive)