-
Notifications
You must be signed in to change notification settings - Fork 156
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
Feature/block filters #432
base: develop
Are you sure you want to change the base?
Conversation
…ibutes before pushing to the remote site
…ould cause the block to show up as a classic block
very interesting! I was going to suggest considering core's block parser however you rightly pointed out that it doesn't support a way to reverse the parse process once you modify the attributes. Apparently that is handled entirely in JavaScript. |
Yep.. I initially looked at using the core parser to parse them and then reassembling that data myself, but as far as I could tell, there wasn't any way to figure out where within the markup we should put back innerBlocks, etc. Annnnd thats how I ended up with the current approach :) |
@cmmarslender @adamsilverstein I wanted to check in to see if either of you had plans to put further work into this draft PR? Either way, happy new year and I hope you both have a safe, happy, and prosperous 2020... cheers! |
👋 Hey @jeffpaul - thanks for the ping. I doubt I will have time to revisit this in the near future - probably best tackled by someone working more closely on Distributor. |
I've taken over the project this CR originally came from and ran into a bug where there was an incorrect space being added to the Block, preventing it from being read correctly on the Distributed site. Submitted a patch here: 62c2ae5 |
@jeffpaul - I've added the check for |
I'm seeing other PRs will the same issue, so maybe its a problem with the test itself? |
@gthayer aside from the tests, are there any further enhancements/fixes you have pending on this PR or is it otherwise ready for review? |
No further updates planned.
Gary Thayer
… On Mar 6, 2020, at 4:22 PM, Jeffrey Paul ***@***.***> wrote:
@gthayer aside from the tests, are there any further enhancements/fixes you have pending on this PR or is it otherwise ready for review?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@gthayer wonderful, thanks! @dinhtungdu are the failing tests here the same that you're helping to triage or something else that should give us concern in reviewing/merging this PR? |
@jeffpaul Yes, the failing one is author test, which is not |
@dinhtungdu nope, we're fine how it is then. |
There's still a good amount we need to discuss on this and it relates to work we want to tackle in |
Unassigning reviewers here while we focus on the v2 refactoring and can then reassess how best to handle the root issue here. |
@cmmarslender thanks for the PR! Could you please rebase your PR on top of the latest changes in the base branch? |
Description of the Change
On distribution, converts block comments to a DOMDocument-friendly format, then parses the html and iterates, firing a filter on each block that is then encountered. After all filters are run, it is converted back to normal gutenberg comments and then saved.
Alternate Designs
Could possibly try to just parse the gutenberg "markup" without DOMDocument, but probably safer to use a library that is designed for this, since its relatively easy to convert the gutenberg comments into something that looks like html that DOMDocument will parse
Benefits
Allows filtering block attributes before the post is distributed.
Possible Drawbacks
Verification Process
Tested the output of the conversion functions and am using this filter on a current project to ensure media + taxonomy IDs are translated as part of pushing content to another site
Checklist:
TODO:
mb_convert_encoding
requires mbstring module. Should ensure this is available before using the functionApplicable Issues
#430