Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema.checkAttributeInSelection() ignores current text node's attributes #4421

Closed
Reinmar opened this issue Sep 14, 2018 · 2 comments · Fixed by ckeditor/ckeditor5-engine#1550
Assignees
Labels
package:engine type:bug This issue reports a buggy (incorrect) behavior.
Milestone

Comments

@Reinmar
Copy link
Member

Reinmar commented Sep 14, 2018

It does this now:

checkAttributeInSelection( selection, attribute ) {
	if ( selection.isCollapsed ) {
		// Check whether schema allows for a text with the attribute in the selection.
		return this.checkAttribute( [ ...selection.getFirstPosition().getAncestors(), '$text' ], attribute );
	} else {

So, it passes element, element, element, '$text' to checkAttribute(). Instead, it should pass the actual text node instead of a '$text' string to checkAttribute() so it works on as realistic context as possible.

@Reinmar
Copy link
Member Author

Reinmar commented Sep 14, 2018

@pomek
Copy link
Member

pomek commented Sep 17, 2018

It resolves https://github.com/ckeditor/ckeditor5-basic-styles/issues/77.

I'm going to prepare a PR.

Reinmar referenced this issue in ckeditor/ckeditor5-engine Sep 21, 2018
Fix: `Schema#schema.checkAttributeInSelection()` will include selection's attributes in the context of the check. Closes #1546.
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-engine Oct 9, 2019
@mlewand mlewand added this to the iteration 20 milestone Oct 9, 2019
@mlewand mlewand added status:confirmed type:bug This issue reports a buggy (incorrect) behavior. package:engine labels Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:engine type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants