Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Parser: Parse superfluous classes as custom classes #7538
This pull request seeks to enable a block which supports
This adds a new filter on the parsed block attributes, determining if there is a difference between how classes were parsed and what was received as original markup of the block.
Noting that there is some relation between this and aduth/hpq#2 , particularly in how we retrieve the class attribute from the root element of the markup. Currently this requires adding a dummy wrapper node. The changes proposed in aduth/hpq#2 may still be in our interest to explore, but would be a significant breaking change affecting a large number of existing blocks. At this point, we may just want to be content with the current behavior, despite its drawbacks.
Verify that adding a class to a block which supports custom class names (e.g. paragraph) via the block menu's Edit as HTML view does not invalidate the block, is persisted between editor sessions, and is displayed in its Additional CSS Class advanced inspector field.
Correct if I'm wrong but we're still persisting the custom className in the comment of blocks. I wonder if it's possible to drop it entirely from there with this new filter. I'm thinking of this extra filter as a way to define custom "source" in the block parser.
It may be possible, yes, though I'm actually motivated to not allow for custom sources, particularly with how it impacts the viability of ever being able to parse blocks from the server. The current set of supported sources could be recreated on the server; if we allow for custom sources, not so much.
referenced this pull request
Jun 27, 2018
I think I'd prefered to drop the className comment attribute entirely but I'm fine with this too.