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

Rename attribute names from singular to plural #1389

Merged
merged 8 commits into from
Apr 5, 2018
Merged

Conversation

pomek
Copy link
Member

@pomek pomek commented Mar 29, 2018

Suggested merge commit message (convention)

Other: Renamed plural method names to singular and singular attribute names to plural. See ckeditor/ckeditor5#742.

BREAKING CHANGES: Properties in module:engine/view/matcher~MatcherPattern have been renamed: class to classes, style to styles, attribute to attributes.

NOTE: Keys of engine/conversion/viewconsumable~ViewElementConsumables#_consumables have been renamed from singular to plural.

NOTE: All protected _insertChildren() and _appendChildren() methods have been renamed to _insertChild() and _appendChild().


Should be merged together with:

@pomek pomek requested a review from Reinmar March 29, 2018 09:02
@coveralls
Copy link

coveralls commented Mar 29, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling 245ee42 on t/ckeditor5/742 into 3a348fd on master.

@pomek
Copy link
Member Author

pomek commented Mar 29, 2018

Changed mgit.json: ckeditor/ckeditor5@master...t/742

and its build on Travis: https://travis-ci.org/ckeditor/ckeditor5/builds/359785064.

@@ -638,7 +638,7 @@ export function removeUIElement() {
* The converter automatically consumes corresponding value from consumables list and stops the event (see
* {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher}).
*
* modelDispatcher.on( 'attribute:customAttr:myElem', changeAttribute( ( value, data ) => {
* modelDispatcher.on( 'attributes:customAttr:myElem', changeAttribute( ( value, data ) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOK

@@ -738,7 +738,7 @@ export function changeAttribute( attributeCreator ) {
* The converter automatically consumes corresponding value from consumables list, stops the event (see
* {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher}).
*
* modelDispatcher.on( 'attribute:bold', wrapItem( ( modelAttributeValue, viewWriter ) => {
* modelDispatcher.on( 'attributes:bold', wrapItem( ( modelAttributeValue, viewWriter ) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOK

@@ -21,8 +21,8 @@ import TextProxy from '../model/textproxy';
* during conversion, when given part of model item is converted (i.e. the view element has been inserted into the view,
* but without attributes), consumable value is removed from `ModelConsumable`.
*
* For model items, `ModelConsumable` stores consumable values of one of following types: `insert`, `addAttribute:<attributeKey>`,
* `changeAttribute:<attributeKey>`, `removeAttribute:<attributeKey>`.
* For model items, `ModelConsumable` stores consumable values of one of following types: `insert`, `addattributes:<attributeKey>`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOK

@@ -312,7 +312,7 @@ export default class ModelConsumable {

// Returns a normalized consumable type name from given string. A normalized consumable type name is a string that has
// at most one colon, for example: `insert` or `addMarker:highlight`. If string to normalize has more "parts" (more colons),
// the other parts are dropped, for example: `addAttribute:bold:$text` -> `addAttribute:bold`.
// the other parts are dropped, for example: `addattributes:bold:$text` -> `addattributes:bold`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOK

*
* @error viewconsumable-invalid-attribute
*/
throw new CKEditorError( 'viewconsumable-invalid-attribute: Classes and styles should be handled separately.' );
throw new CKEditorError( 'viewconsumable-invalid-attributes: Classes and styles should be handled separately.' );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOK

@@ -20,7 +20,7 @@ import compareArrays from '@ckeditor/ckeditor5-utils/src/comparearrays';
* However, it is **very important** that nodes already attached to model tree should be only changed through
* {@link module:engine/model/writer~Writer Writer API}.
*
* Changes done by `Node` methods, like {@link module:engine/model/element~Element#_insertChildren _insertChildren} or
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole section needs to be rewritten because it does not make any sense.


dispatcher.on( 'attribute:class', ( evt, data, conversionApi ) => {
conversionApi.consumable.consume( data.item, 'attribute:class' );
conversionApi.consumable.consume( data.item, 'attributes:class' );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOK

@pomek
Copy link
Member Author

pomek commented Apr 4, 2018

I reverted changes that shouldn't be committed.

URL to Travis build – https://travis-ci.org/ckeditor/ckeditor5/builds/361986154. Two tests fail but there is a ticket for it – https://github.com/ckeditor/ckeditor5-image/issues/198.

@Reinmar
Copy link
Member

Reinmar commented Apr 4, 2018

All look great! I'm waiting for final confirmation from @pjasiun and will be merging this.

@Reinmar Reinmar merged commit 9465c82 into master Apr 5, 2018
@Reinmar Reinmar deleted the t/ckeditor5/742 branch April 5, 2018 09:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants