-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
fix: exporting labelled arrows via export utils #6443
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
The proposed solution isn't type-safe. And what about all the other applicable helpers that are either currently using or will potentially use So either remove I was already thinking about the former a bit. We should have pure helpers that can be used anywhere, and we should have the editor instance curry those helpers for "everyday" and public API use. The problem is that the |
Yeah I thought about the same, I agree we should have pure helpers but thinking about the time complexity, I added an optional param which will gain more preference if passed. For utilities at least we need it to be pure functions. |
We shouldn't use optional params like this, but I wouldn't even make it non-optional because it's unclear when and when not we should pass it. By not clear I mean it requires knowledge of the implementation details, which may also change any moment, so it's very unsafe. If we're to hack this, which in the context of this PR it seems we'll do either way, then I suggest we prepopulate the There are a few caveats to this though:
I'm not happy with the above suggestion either. We might wanna think on how to solve this properly. |
This doesn't sound like a good approach :(. Instead I would prefer to add the logic of extracting the container/bound element in those specific utilities instead of calling the helper functions and also decouple the masking part so it can be used independently if we don't agree on optional param. But that would be more code change / effort which would be removed soon. |
No, because 1) it's not a full fix (it just randomly fixes a few cases) and is unsafe, and 2) it adds complexity and technical debt.
If you're suggesting factoring out the container retrieval outside of the helpers, then it makes sense only for functions that deal with a single element. E.g. while rendering, we'd still have to retrieve the container from somewhere, and we need it to be |
3fddebe
to
7312ed3
Compare
Hi, I am using your npm package and on version 14 I can draw an arrow with text element on it with no issue and export to svg with no issues, after upgrading to version 15 I can no longer open svg files created by version 14 where there is an arrow with text element in the svg. also when drawing arrow with text element on it and try to export to svg , excalidraw component crashes my application. the only change I made to my application is upgrading excalidraw from v14 to v15. could you please help me understand what's going wrong? If is this a known bug, do you have a timeline to fix it? Thanks for your help. |
fixes #6419
Approach 1
The issue was since export utilities are pure JS functions hence trying to extract bound text elements/text containers via
Scene
will not work. So I have added an optional paramsceneElements
to the methodsgetBoundTextElement
andgetContainerElement
which if passed will use these elements instead of scene.The
sceneElements
will be passed only in case ofexport
Approach 2
I am initialising the scene in the utils instead so its available to the helper methods and wherever its called from outside
Export-labels.mp4
TODOS