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

Update for WordPress 5.8 compatibility #4

Closed
8 tasks done
bobbingwide opened this issue Jul 26, 2021 · 5 comments
Closed
8 tasks done

Update for WordPress 5.8 compatibility #4

bobbingwide opened this issue Jul 26, 2021 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@bobbingwide
Copy link
Owner

bobbingwide commented Jul 26, 2021

The oik-magnetic-poetry plugin was originally built using webpack.

When used in WordPress 5.8 the Widget block editor produces a "doing it wrong" message due to the enqueueing of wp-editor.
It seems the best solution is to rework the code to build it using wp-scripts which will enable use of

import ServerSideRender from '@wordpress/server-side-render';

See bobbingwide/bobbingwide#30 (comment)

Requirements

  • Ability to use the Widget block editor without getting messages regarding wp-editor.
  • Which means changing the build to allow the import above.
  • Build using wp-scripts
  • Register the block using block.json
  • Ensure the block can be selected
  • Add some color and typography settings similar to UK tides
  • Add text align capability

Proposed solution

  • Copy and cobble the solution developed for UK-tides v3.0.0, as this is now ahead of sb-starting-block
  • Remove unnecessary files: webpack.config.js and .babelrc
  • Change package.json and block.json for oik-mp/magnetic-poetry
  • Change oik-magnetic-poetry/index.js to register the block from block.json
  • Change oik-magnetic-poetry/index.js to add logic for text align
  • Change oik-magnetic-poetry.php to register the block from block.json
  • Change oik-magnetic-poetry.php to use get_block_wrapper_attributes()
  • Update node_modules and rebuild

Process for updating node_modules

  1. Remove the existing node_modules folder
  2. npm install
  3. npm install @wordpress/scripts --save-dev

See https://developer.wordpress.org/block-editor/reference-guides/packages/packages-scripts/

This worked first time! In the next plugin just 1. and 2. or 1. and 3. and see if the build works

@bobbingwide bobbingwide added the enhancement New feature or request label Jul 26, 2021
@bobbingwide bobbingwide self-assigned this Jul 26, 2021
@bobbingwide
Copy link
Owner Author

image

bobbingwide added a commit that referenced this issue Jul 28, 2021
@bobbingwide
Copy link
Owner Author

The block's now been refactored. Before closing the issue I need to dot the i's and cross the t's... delivering the new version on oik-plugins and updating the documentation.

@bobbingwide
Copy link
Owner Author

Oops. the transform from Verse doesn't work since createBlock's not being imported.

@bobbingwide
Copy link
Owner Author

bobbingwide commented Sep 11, 2021

I should also complete the internationalization and localization.
See bobbingwide/sb-post-edit-block#5 (comment)

bobbingwide added a commit that referenced this issue Sep 11, 2021
bobbingwide added a commit that referenced this issue Sep 11, 2021
bobbingwide added a commit that referenced this issue Sep 11, 2021
@bobbingwide
Copy link
Owner Author

oik-magnetic-poetry v0.2.2 is now available from oik-plugins.com.
Closing therefore.

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

No branches or pull requests

1 participant