refactor: migrate the Wrapping story to TypeScript by tbouffard · Pull Request #720 · maxGraph/maxGraph · GitHub
Skip to content

refactor: migrate the Wrapping story to TypeScript#720

Merged
tbouffard merged 1 commit into
mainfrom
refactor/story_wrapping_migrate_to_ts
Mar 19, 2025
Merged

refactor: migrate the Wrapping story to TypeScript#720
tbouffard merged 1 commit into
mainfrom
refactor/story_wrapping_migrate_to_ts

Conversation

@tbouffard

@tbouffard tbouffard commented Mar 18, 2025

Copy link
Copy Markdown
Member

This facilitates maintenance and enables errors to be detected earlier.
Also

  • add a Storybook argument to disable Graph.htmlLabels to show its impact on wrapping and rendering of HTML markup
  • display a description at the top of the Graph to help understand what the story is doing.

Summary by CodeRabbit

  • New Features
    • Introduced a control to toggle HTML labels in graphs, enabling users to choose between HTML-rendered labels and plain text.
    • Enhanced label presentation with improved formatting, including bold text support and better word-wrapping for clearer visualization.

This facilitates maintenance and enables errors to be detected earlier.
Also
  - add a Storybook argument to disable `Graph.htmlLabels` to show its impact on wrapping and rendering of HTML markup
  - display a description at the top of the Graph to help understand what the story is doing.
@tbouffard tbouffard added the refactor Code refactoring label Mar 18, 2025
@coderabbitai

coderabbitai Bot commented Mar 18, 2025

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

@tbouffard tbouffard marked this pull request as ready for review March 18, 2025 18:15

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0739244 and fd7e8d0.

📒 Files selected for processing (1)
  • packages/html/stories/Wrapping.stories.ts (2 hunks)
🔇 Additional comments (10)
packages/html/stories/Wrapping.stories.ts (10)

20-20: Import addition looks good.

Adding the createMainDiv import makes sense as it's used to create the descriptive container for the story.


26-29: Good addition of useHtmlLabels control.

Adding this boolean argument allows users to toggle HTML labels support in the story, which aligns with the PR objectives.


33-33: Default argument value is consistent.

Setting the default to true maintains the existing behavior while allowing it to be toggled off.


38-44: Great addition of descriptive content.

The addition of explanatory text at the top of the story helps users understand its purpose and how to use the controls. This improves the documentation aspect of the story.


47-47: Correct DOM structure update.

Appending the container to the new div maintains the proper hierarchy with the added description.


53-53: Dynamic HTML labels configuration implemented correctly.

Using the argument value to control the HTML labels feature works correctly, though the Boolean() conversion could be avoided with proper typing in the function signature.


82-84: Good example of HTML markup in edge label.

Adding the bold text element to the edge label provides a clear demonstration of HTML formatting in labels, which aligns with the story's purpose.


86-89: Style properties properly defined.

Explicitly setting the fontColor to 'black' ensures consistent rendering across different themes or environments.


91-91: TypeScript non-null assertion used appropriately.

The non-null assertion operator (!) is used correctly here since the geometry object should always exist after edge insertion.


94-94: Return value properly updated.

Returning the main div instead of just the container ensures the descriptive content is included in the story output.

Comment thread packages/html/stories/Wrapping.stories.ts
@tbouffard tbouffard merged commit 15c50d0 into main Mar 19, 2025
@tbouffard tbouffard deleted the refactor/story_wrapping_migrate_to_ts branch March 19, 2025 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Code refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant