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

[reports] Refactor block component design for easier editor management #1334

Open
4 of 6 tasks
greenrhyno opened this issue Jan 12, 2022 · 0 comments · Fixed by #1337
Open
4 of 6 tasks

[reports] Refactor block component design for easier editor management #1334

greenrhyno opened this issue Jan 12, 2022 · 0 comments · Fixed by #1337

Comments

@greenrhyno
Copy link
Contributor

greenrhyno commented Jan 12, 2022

Currently, Block.jsx creates a number of state-editing callbacks and various types of editors that use these callbacks, then passes these components as props to its child container component BlockEditor.jsx. This clutters Block.jsx and makes it instantiate many things that are not needed for the current state of the Block Editor. It also confuses the control flow of data.

Task: Make Block.jsx only responsible for the maintaining of local blockState (a working copy of what is saved in the database) then make BlockEditor handle the creation of BlockType-specific editors and their methods needed for updating blockState. Then, have its children editors (whether code editors or "simple" UI editors) implement the BlockType-specific logic for updating the blockState. Also add a consistent, general way for specific block editors to validate their changes.

To do:

  • Move all blockState-editing methods to BlockEditor
  • Make the getting of block variables (useVariables) consistent
  • Make RichTextEditor a type of SimpleUI-type component rather than a separate thing
  • Have BlockElement handle isValidWorkingState state
  • Pass setIsValidWorkingState() down to BlockEditor
  • Wrap state-editing methods created in BlockEditor so that they automatically update isModified and isValidWorkingState variables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant