Skip to content

Update RichText in tutorial and use macro processors #690 #692

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

Merged
merged 1 commit into from
Jul 16, 2025

Conversation

pmi
Copy link
Member

@pmi pmi commented Jul 11, 2025

No description provided.

@pmi pmi linked an issue Jul 11, 2025 that may be closed by this pull request
@pmi pmi marked this pull request as ready for review July 14, 2025 12:13
@pmi pmi requested review from Copilot, skjulestad and sigdestad July 14, 2025 12:13
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for a new factbox macro, updates existing content components to use the new RichText API, and bumps React component library versions.

  • Registers and implements a factbox macro processor
  • Refactors FactBox, Person, and Article components to consume RichText via component, meta, and common props
  • Updates dependencies @enonic/react-components and @enonic-types/lib-react4xp to RC4

Reviewed Changes

Copilot reviewed 8 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/main/resources/react4xp/dataFetcher.ts Imported factboxProcessor, added addMacro call
src/main/resources/react4xp/components/macro/FactboxProcessor.ts New macro processor for factbox
src/main/resources/react4xp/components/macro/FactBox.tsx Renamed config prop to data and updated usage in component
src/main/resources/react4xp/components/content/PersonProcessor.ts Passed dataFetcher and component into processHtml
src/main/resources/react4xp/components/content/Person.tsx Updated RichText calls to use meta, common, component
src/main/resources/react4xp/components/content/ArticleProcessor.ts Added dataFetcher and component parameters to processHtml
src/main/resources/react4xp/components/content/Article.tsx Switched RichText usage to new prop signature
package.json Bumped @enonic/react-components and @enonic-types/lib-react4xp versions
Comments suppressed due to low confidence (2)

src/main/resources/react4xp/components/macro/FactBox.tsx:6

  • [nitpick] The filename 'FactBox.tsx' uses 'Box' with an uppercase B, but the component is named 'Factbox' (lowercase b). Consider renaming one to maintain consistent casing.
export const Factbox = ({data, children}: MacroComponentParams) => {

src/main/resources/react4xp/components/macro/FactboxProcessor.ts:1

  • There are no unit tests for the new FactboxProcessor; consider adding tests to validate behavior when macro.config['factbox'] is present, missing, or malformed.
import type {ComponentProcessor, MacroProcessorParams} from '@enonic-types/lib-react4xp/DataFetcher';

@@ -18,3 +19,5 @@ dataFetcher.addPart('com.enonic.app.hmdb:child-list', {processor: childListProce
dataFetcher.addContentType('com.enonic.app.hmdb:playlist', {processor: playlistProcessor});
dataFetcher.addContentType('com.enonic.app.hmdb:article', {processor: articleProcessor});

// @ts-ignore update type in addMacro
Copy link
Preview

Copilot AI Jul 14, 2025

Choose a reason for hiding this comment

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

Avoid using ts-ignore; consider updating the DataFetcher.addMacro type definitions to accept MacroProcessorParams so you can remove the ts-ignore directive.

Copilot uses AI. Check for mistakes.

Copy link
Contributor

@skjulestad skjulestad left a comment

Choose a reason for hiding this comment

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

I approve of this :)

@skjulestad skjulestad merged commit 8ff5cf5 into issue-77 Jul 16, 2025
1 check passed
@skjulestad skjulestad deleted the issue-690 branch July 16, 2025 10:21
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.

Update RichText in tutorial and use macro processors
2 participants