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

Refactor: remove ClassicEditor from window.givewp.form.components and use the new @givewp/form-builder-library npm package #7122

Merged
merged 29 commits into from
Jan 10, 2024

Conversation

glaubersilva
Copy link
Contributor

@glaubersilva glaubersilva commented Nov 29, 2023

Resolves GIVE-140

Description

The ClassicEditor was previously mounted in the window global object to prevent code duplication in the addons.

But it also introduces a few problems like forcing bumping the minimum Give core version in the addons, and other problems related to possible changes of the components in the core that can break functionalities in the addons.

In the future, a JS package will be released to share the components between the addon without major issues

But for now, was decided to remove this component from the global window object and fork it in each addon that needs to use it.

So, this PR removes this component from the global window object and also replaces some components with the ones shipped with the @givewp/form-builder-library npm package.

This PR also changes the OptionsPanel component used in the donations levels and name title prefixes to the version shipped with the new package.

Affects

  • The window.givewp.form.components property.
  • Email message content in the email settings of V3 forms.
  • The Agreement Text content in the Terms & Consent block of V3 forms.
  • The Donation Instructions in the Offline Donations Gateway.
  • Donation levels in the Donation Amount and Levels block.
  • Name title prefixes in the Donor Name block.

Testing Instructions

  1. Create or edit a v3 form;
  2. Go to the email settings and play around with the email message content of the email notifications.
  3. Add a Terms & Consent block, go to the Agreement Text content, and play around with the editor options.
  4. Go to the Offline Donations gateway settings and play around with the donation instructions content of the gateway.
  5. Go to the donation levels in the Donation Amount and Levels block and play around with the options/levels.
  6. Go to the name title prefixes in the Donor Name block and play around with the options/prefixes.

To test the addons that were using the ClassicEditor component mounted in the window global object, check out these two PRs:

https://github.com/impress-org/give-tributes/pull/324

https://github.com/impress-org/give-form-field-manager/pull/416

Pre-review Checklist

  • Acceptance criteria satisfied and marked in related issue
  • Relevant @unreleased tags included in DocBlocks
  • Includes unit tests
  • Reviewed by the designer (if follows a design)
  • Self Review of code and UX completed

@glaubersilva glaubersilva marked this pull request as ready for review November 29, 2023 18:29
@jonwaldstein
Copy link
Contributor

@glaubersilva is any currently released add-on using this component? technically this was released in the latest version of GiveWP so we need to be extra careful about removing it.

@glaubersilva
Copy link
Contributor Author

@jonwaldstein Only the FFM and Tributes addon was using it, but the PRs that implemented it still weren't released, so we are safe.

The other addon that uses a component with the same name is the PDF Receipts, but it also uses its own version of this component.

You can double-check it here: https://github.com/search?q=org%3Aimpress-org%20ClassicEditor&type=code

@jonwaldstein
Copy link
Contributor

@glaubersilva just to be safe, let's hold off merging this until the add-ons are not referencing this component through the window on their develop branches.

@glaubersilva glaubersilva changed the title Refactor: remove ClassicEditor from window.givewp.form.components Refactor: remove ClassicEditor from window.givewp.form.components and Use form-builder-library Dec 5, 2023
@glaubersilva glaubersilva changed the title Refactor: remove ClassicEditor from window.givewp.form.components and Use form-builder-library Refactor: remove ClassicEditor from window.givewp.form.components and use the new form-builder-library npm package Dec 5, 2023
@glaubersilva glaubersilva changed the title Refactor: remove ClassicEditor from window.givewp.form.components and use the new form-builder-library npm package Refactor: remove ClassicEditor from window.givewp.form.components and use the new @givewp/form-builder-library npm package Dec 5, 2023
@glaubersilva glaubersilva self-assigned this Dec 5, 2023
@glaubersilva
Copy link
Contributor Author

@jonwaldstein This is ready for re-review.

Copy link
Contributor

@jonwaldstein jonwaldstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful! ready for QA 🌈

Copy link
Member

@rickalday rickalday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passed manual QA tests.

@glaubersilva glaubersilva merged commit a127531 into develop Jan 10, 2024
20 checks passed
@glaubersilva glaubersilva deleted the refactor/unmount-classic-editor branch January 10, 2024 13:30
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

Successfully merging this pull request may close these issues.

3 participants