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

Conversion utilities: better handling for classes and styles in downcast #4272

Closed
scofalik opened this issue Feb 9, 2018 · 1 comment · Fixed by ckeditor/ckeditor5-engine#1302
Assignees
Labels
package:engine type:improvement This issue reports a possible enhancement of an existing feature.
Milestone

Comments

@scofalik
Copy link
Contributor

scofalik commented Feb 9, 2018

Follow-up to ckeditor/ckeditor5-engine#1274.

Right now there is no way to properly and easily handle setting and removing classes and styles during downcasting.

You can of course use the utilities and (un)set class attribute but this will overwrite already set classes.

@scofalik
Copy link
Contributor Author

I wonder how configuration should look like for those cases. This concerns only downcastAttributeToAttribute (and also attributeToAttribute two-way-converter).

downcastAttributeToAttribute( {
	model: ...,
	view: {
		key: 'class',
		value: 'myClass' | [ 'myClassA', 'myClassB' ]
	}
} );

downcastAttributeToAttribute( {
	model: ...,
	view: {
		key: 'style',
		value: {
			'font-size': '10px',
			'font-family': 'Arial'
		}
	}
} );

Both of these are compatible with view.ElementDefinition (after slight normalization :)) so can be used in two-way converters. Two small things to note are:

  • we are letting to set multiple things (although still one attribute),
  • we need to document this (until now it was just String in value).

@scofalik scofalik self-assigned this Feb 14, 2018
pjasiun referenced this issue in ckeditor/ckeditor5-engine Feb 19, 2018
Other: Introduced several improvements to conversion helpers. Closes #1295. Closes #1293. Closes #1292. Closes #1291. Closes #1290. Closes #1305.
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-engine Oct 9, 2019
@mlewand mlewand added this to the iteration 14 milestone Oct 9, 2019
@mlewand mlewand added module:conversion type:improvement This issue reports a possible enhancement of an existing feature. 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:improvement This issue reports a possible enhancement of an existing feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants