GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Build the image URLs of the stories from the configured image base path · Issue #1332 · maxGraph/maxGraph

Build the image URLs of the stories from the configured image base path #1332

New issue
Copy link
New issue
Copy link
Open
Task
#1337
Open
Build the image URLs of the stories from the configured image base path#1332
Task
#1337
Copy link
Assignees
Mittalnew
Milestone
0.26.0

Description

@redfish4ktc
redfish4ktc
opened on Nov 18, 2026
Issue body actions

Is your technical request related to a problem? Please describe.

The Storybook stories build the URLs of their images in two different ways:

  • 8 stories derive them from the configured base path, such as `${Client.imageBasePath}/connector.gif`: ContextIcons, DynamicToolbar, Events, HoverIcons, Permissions, SwimLanes, Toolbar, Tree.
  • 19 stories hard-code a page-relative path, 'images/...' or './images/...': AutoLayout, Collapse, Control, DragSource, DynamicToolbar, FixedIcons, Grid, HoverIcons, ImageBundle, Images, LabelPosition, MenuStyle, OrgChart, Overlays, PortRefs, Scrollbars, SegmentConnectorZoom, Toolbar, Wires. OrgChart alone has 17 of them. DynamicToolbar, HoverIcons and Toolbar mix both forms in the same file.

Everything works today, because the demo sets Client.setImageBasePath('./images') and the literal paths resolve to the same folder. But the literal paths silently ignore the setting, so a reader who copies a story into an application with another image location has to find and fix each of them, while the stories using Client.imageBasePath follow the configuration.

The mix is inherited from the mxGraph examples, which mostly used literal images/... paths (30 example files) and only rarely mxClient.imageBasePath (3 files).

Describe the solution you'd like

Build every image URL of the stories from Client.imageBasePath, for the images passed to the maxGraph API: ImageBox, style.image, CellOverlay, popup menu and toolbar items, domUtils.createImage, and the <img> tags written in HTML labels. The demo then has a single place deciding where the images are, and every story shows the pattern an application should follow.

CSS backgrounds set on the containers, such as url(./images/grid.gif) in shared/configure.js, Grid, Scrollbars, SegmentConnectorZoom and Wires, are not configured through maxGraph and can stay literal.

[UPDATE 2026-11-20] changed, based on feedback of #1337 (review): CSS backgrounds built in JavaScript or in HTML template strings, such as url(./images/grid.gif) in shared/configure.js, Grid, Scrollbars, SegmentConnectorZoom and Wires, also build their URL from the configured image base path, through string interpolation: `url(${Client.imageBasePath}/grid.gif)`. Only static .css files, which cannot read Client.imageBasePath, keep literal paths.

Describe alternatives you've considered

Implementation variant: instead of writing `${Client.imageBasePath}/...` at each call site, add a function to stories/shared, for instance getImagePath('icons48/keys.png'), which receives the path of the image relative to the images folder and returns the full path built from Client.imageBasePath. The call sites get shorter, the way the full path is built lives in a single place, and a story still shows that the path depends on a configuration. The drawback is that a reader copying a story also has to copy the function, or replace its calls with the Client.imageBasePath expression, since it is not part of the maxGraph API.

Keep the literal paths and document that the stories expect the images under ./images. This costs nothing, but leaves the stories inconsistent with each other and with the configuration they rely on.

Additional context

Found while reviewing the change that sets the image base path once for all stories in packages/html/.storybook/preview.ts, instead of in each story. The other default image of maxGraph that ignores the base path is tracked in #1331.

Activity

  1. redfish4ktc
    added the
    Task
    issue type on Nov 18, 2026
  2. redfish4ktc
    added a parent issue on Nov 18, 2026
    • Ensure that the stories work as the mxGraph examples #505
  3. Mittalnew commented on Nov 18, 2026

    @Mittalnew
    Mittalnew
    on Nov 18, 2026
    More actions

    I'd like to take this one. I'd build the URLs of all the images passed to the maxGraph API (ImageBox, style.image, CellOverlay, popup menu/toolbar items, domUtils.createImage and <img> in HTML labels) from Client.imageBasePath in the 19 stories you listed, OrgChart included, and leave the CSS url(./images/...) backgrounds as literals as you suggested. I'd use ${Client.imageBasePath}/... inline at each call site so every story stays copy-paste friendly, unless you'd rather have a shared getImagePath() helper in stories/shared. I'll check every story in Storybook afterwards. Could you assign it to me?

  4. redfish4ktc commented on Nov 18, 2026

    @redfish4ktc
    redfish4ktc
    on Nov 18, 2026
    MemberAuthor
    More actions

    Hi, and thanks for offering to help with this!

    I've assigned the issue to you.

    I would prefer using the shared getImagePath function. This keeps the logic centralized and makes future changes easier.

    In particular, we will probably refactor the Client class in 2027 to align it with the configuration objects such as GlobalConfig and HandleConfig.

    Using getImagePath should make this future refactoring easier.

    Would that work for you?

  5. redfish4ktc
    assigned
    Mittalnew
    on Nov 18, 2026
  6. redfish4ktc
    added this to the 0.25.2 milestone on Nov 18, 2026
  7. Mittalnew commented on Nov 18, 2026

    @Mittalnew
    Mittalnew
    on Nov 18, 2026
    More actions

    Yes, that works for me. I'll use the shared getImagePath helper from stories/shared in all 19 stories so the logic stays in one place for the 2027 Client refactor. Thanks for assigning it!

  8. redfish4ktc
    modified the milestones: 0.25.2, 0.26.0 on Nov 20, 2026
  9. Mittalnew
    added a commit that references this issue on Nov 24, 2026

    refactor(stories): build CSS background URLs with getImagePath

    a6312e4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @Mittalnew
    Mittalnew

Labels

No labels
No labels

Type

Task

Projects

No projects

    Milestone

    • 0.26.0No due date

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.