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

Changed: Use EnterCommand's afterExecute event to alter it's behavior. #29

Merged
merged 6 commits into from
Sep 19, 2016

Conversation

scofalik
Copy link
Contributor

@scofalik scofalik commented Sep 13, 2016

* @param {String} [formatId] The identifier of the heading format that should be applied. It should be one of the
* {@link headings.HeadingsFormat heading formats} provided to the command constructor. If this parameter is not provided,
* the value from {@link headings.HeadingsCommand#defaultFormat defaultFormat} will be used.
* @returns {Object} data Data object, available in {@link core.Command#event:afterExecute}
* @returns {engine.model.Batch} data.batch Batch created and used by the command.
Copy link
Member

Choose a reason for hiding this comment

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

Leftover?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I fixed it.

@@ -53,6 +53,15 @@ describe( 'HeadingsCommand', () => {
expect( command.value ).to.equal( format );
} );
}

it( 'should be equal to defaultFormat if format has not been found', () => {
Copy link
Member

Choose a reason for hiding this comment

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

Why can't it be null? Why is this change needed now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is because when you focus selection inside a model element that is not in formats array, you get this error:
Uncaught TypeError: Cannot read property 'label' of undefined.

This is because no option has been found to be displayed in the dropdown.

However, as I think of it now, it should probably be done like it is in CKE4. There is "Format" option there whenever you are inside something that is not recognized by Headings feature. Right now, in CKE5, you will have "Paragraph" option displayed. Because of that you are unable to actually change to the paragraph using Headings dropdown.

I think this is worthy of seperate issue because then we have to ask ourselves what is the defaultValue -- still paragraph or maybe "format"?

Copy link
Member

Choose a reason for hiding this comment

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

OK, so I'm fine with defaulting to the default format in such a case. But next time please do not squeeze such changes without mentioning them ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am sorry, this is just the way I are.

Copy link
Member

@Reinmar Reinmar left a comment

Choose a reason for hiding this comment

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

One unclear change plus some leftovers.

@Reinmar Reinmar merged commit 2003c9b into master Sep 19, 2016
@Reinmar Reinmar deleted the t/28 branch September 19, 2016 19:07
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.

EnterCommand at the end of heading should create paragraph.
2 participants