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

How does PHP code relate to Javascript code? #97

Open
conatus opened this issue Dec 10, 2021 · 0 comments
Open

How does PHP code relate to Javascript code? #97

conatus opened this issue Dec 10, 2021 · 0 comments

Comments

@conatus
Copy link

conatus commented Dec 10, 2021

Hey folks,

Thanks for putting together this plugin.

Been trying to work out what the relationship is between the PHP code in newspack-content-converter/lib/content-patcher and so on the rest of the project? I can obviously follow the code along and dig in a bit deeper, but felt I might ask to correct my assumptions and everything may be quicker.

It seems most of the conversion is done via Javascript, processing out the blocks and then using rawHandler to work things through. This is a common approach in a number of WordPress plugins to make the conversion to Gutenberg.

However, I can also see a call out to $blocks_content_patched = $this->patcher_handler->run_all_patches( $html_content, $blocks_content ); which appears to use the PHP in that folder to convert from pre-Gutenberg HTML to blocks. For example, I can see from the test we are doing this.

As far as I can guess, this code is now redudant, or is correcting inconsistencies in the Javascript conversion? Can you help give me a steer here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant