Add inlineStyle matcher for sourcing block attributes #10074
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Allows sourcing of a block attribute from an inline style
Description
I added this as part of #9801, but thought I'd break it out into a separate PR so that it can undergo a bit more scrutiny (and to make that PR a bit smaller).
#9801 adds width and height controls for tables in a table block and I wanted to be able to source the height and width directly from the inline styles. When pasting markup, the attributes can then be sourced directly from the styles instead of the json object, as demonstrated by this gif:
I think its also advantageous to encode attributes in the markup when possible for portability. It might also be possible to use this matcher in other existing blocks (e.g. image) that also have width and height attributes that result in inline styles.
This is the first time I've touched matchers, so it'd be good to know if there are any downsides to this approach.
How has this been tested?
I tested across all supported desktop browsers and this seems to work everywhere. MS Edge has a separate bug that I discovered in testing and there's a fix for that here:
#10077
I did manage to verify that this works when the edge fix was applied to this branch.
Types of changes
New feature (non-breaking change which adds functionality)
Checklist: