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

Commit

Permalink
Merge 589fb34 into bb4def6
Browse files Browse the repository at this point in the history
  • Loading branch information
jodator committed Jan 16, 2020
2 parents bb4def6 + 589fb34 commit d16af75
Show file tree
Hide file tree
Showing 22 changed files with 3,066 additions and 209 deletions.
2 changes: 1 addition & 1 deletion src/conversion/downcasthelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export default class DowncastHelpers extends ConversionHelpers {
* view: modelAttributeValue => ( { key: 'class', value: 'styled-' + modelAttributeValue } )
* } );
*
* *Note:* Downcasting to a style property requires providing `value` as an object:
* **Note**: Downcasting to a style property requires providing `value` as an object:
*
* editor.conversion.for( 'downcast' ).attributeToAttribute( {
* model: 'lineHeight',
Expand Down
17 changes: 17 additions & 0 deletions src/view/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import DocumentSelection from './documentselection';
import Collection from '@ckeditor/ckeditor5-utils/src/collection';
import mix from '@ckeditor/ckeditor5-utils/src/mix';
import ObservableMixin from '@ckeditor/ckeditor5-utils/src/observablemixin';
import StylesMap from './stylesmap';

// @if CK_DEBUG_ENGINE // const { logDocument } = require( '../dev-utils/utils' );

Expand Down Expand Up @@ -160,6 +161,22 @@ export default class Document {
this.stopListening();
}

/**
* Adds a style processor normalization rules.
*
* The available style processors:
*
* * background: {@link module:engine/view/styles/background~addBackgroundRules}
* * border: {@link module:engine/view/styles/border~addBorderRules}
* * margin: {@link module:engine/view/styles/margin~addMarginRules}
* * padding: {@link module:engine/view/styles/padding~addPaddingRules}
*
* @param {Function} callback
*/
addStyleProcessorRules( callback ) {
callback( StylesMap._styleProcessor );
}

/**
* Performs post-fixer loops. Executes post-fixer callbacks as long as none of them has done any changes to the model.
*
Expand Down
10 changes: 9 additions & 1 deletion src/view/downcastwriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ export default class DowncastWriter {
* position: 'fixed'
* }, element );
*
* **Note**: The passed style can be normalized if
* {@link module:engine/view/document~Document#addStyleProcessorRules a particular style processor rule is enabled}.
* See {@link module:engine/view/stylesmap~StylesMap#set `StylesMap#set()`} for details.
*
* @param {String|Object} property Property name or object with key - value pairs.
* @param {String} [value] Value to set. This parameter is ignored if object is provided as the first parameter.
* @param {module:engine/view/element~Element} element Element to set styles on.
Expand All @@ -339,9 +343,13 @@ export default class DowncastWriter {
/**
* Removes specified style from the element.
*
* writer.removeStyle( 'color', element ); // Removes 'color' style.
* writer.removeStyle( 'color', element ); // Removes 'color' style.
* writer.removeStyle( [ 'color', 'border-top' ], element ); // Removes both 'color' and 'border-top' styles.
*
* **Note**: This method can work with normalized style names if
* {@link module:engine/view/document~Document#addStyleProcessorRules a particular style processor rule is enabled}.
* See {@link module:engine/view/stylesmap~StylesMap#remove `StylesMap#remove()`} for details.
*
* @param {Array.<String>|String} property
* @param {module:engine/view/element~Element} element
*/
Expand Down
Loading

0 comments on commit d16af75

Please sign in to comment.