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

Text unexpectefly overflows inside of div elements #501

Open
nabil-rady opened this issue Feb 19, 2025 · 1 comment
Open

Text unexpectefly overflows inside of div elements #501

nabil-rady opened this issue Feb 19, 2025 · 1 comment
Labels

Comments

@nabil-rady
Copy link

Expected Behavior

Div should be rendered with text inside
Image

Current Behavior

Text is rendered incorrectly as shown in this image
Image

Possible Solution

I tried adding width: fit but that didn't seem to fix anything.

Steps To Reproduce

I am trying to render this custom node in react-flow

import { Handle, Node, NodeProps, Position } from '@xyflow/react';

function MindMapNode({
  data,
}: NodeProps<Node<{ label: string; className: string }>>) {
  return (
    <>
      <Handle type="target" id="tt" position={Position.Top} />
      <Handle type="target" id="tb" position={Position.Bottom} />
      <Handle type="source" id="st" position={Position.Top} />
      <Handle type="source" id="sb" position={Position.Bottom} />

      <div className={data.className}>{data.label}</div>
    </>
  );
}

export default MindMapNode;
function downloadImage(dataUrl: string) {
  const a = document.createElement('a');

  a.setAttribute('download', 'reactflow.png');
  a.setAttribute('href', dataUrl);
  a.click();
}

toPng(document.querySelector<HTMLElement>('.react-flow__viewport')!, {
      skipFonts: true,
    }).then(downloadImage);
Error Message & Stack Trace

<!-- Provide a log message if relevant -->

Your Environment

  • html-to-image: 1.11.13
  • OS: Linux 6.13 Arch
  • Browser: Mozilla 135.0
@nabil-rady nabil-rady added the bug label Feb 19, 2025
@biiibooo
Copy link
Contributor

biiibooo bot commented Feb 19, 2025

👋 @nabil-rady

Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.

We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant