This repository has been archived by the owner on Jun 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1665 from ckeditor/1640
Other: Change `Conversion` class API. Closes #1640. BREAKING CHANGE: The `Conversion#register()` method was removed from the public API. Use constructor parameters to pass dispatchers and `Conversion#addAlias()` to register an alternative conversion group for registered upcast or downcast dispatchers.
- Loading branch information
Showing
10 changed files
with
206 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md. | ||
*/ | ||
|
||
/** | ||
* @module engine/conversion/conversionhelpers | ||
*/ | ||
|
||
/** | ||
* Base class for conversion helpers. | ||
*/ | ||
export default class ConversionHelpers { | ||
/** | ||
* Creates a conversion helpers instance. | ||
* | ||
* @param {Array.<module:engine/conversion/downcastdispatcher~DowncastDispatcher| | ||
* module:engine/conversion/upcastdispatcher~UpcastDispatcher>} dispatchers | ||
*/ | ||
constructor( dispatchers ) { | ||
this._dispatchers = dispatchers; | ||
} | ||
|
||
/** | ||
* Registers a conversion helper. | ||
* | ||
* **Note**: See full usage example in the `{@link module:engine/conversion/conversion~Conversion#for conversion.for()}` | ||
* method description. | ||
* | ||
* @param {Function} conversionHelper The function to be called on event. | ||
* @returns {module:engine/conversion/downcasthelpers~DowncastHelpers|module:engine/conversion/upcasthelpers~UpcastHelpers} | ||
*/ | ||
add( conversionHelper ) { | ||
for ( const dispatcher of this._dispatchers ) { | ||
conversionHelper( dispatcher ); | ||
} | ||
|
||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.