Enhanced diagrams.net export functionality#4805
Enhanced diagrams.net export functionality#4805cody0704 wants to merge 1 commit intoBookStackApp:developmentfrom
Conversation
Added a new public event 'editor-drawio::export' to enable dynamic adjustment of export parameters for diagrams.net integration. This allows for on-the-fly modifications to the export settings like scale, improving flexibility and customization.
|
Thanks for offering this @cody0704. I ask because I'm not sure how altering any of the export options would be useful, without needing to make further changes to the BookStack source to alter how the exports are then managed. If it is for scaling, then I'm also not 100% sure if we should add specific events as workarounds (with side affects) for issues that are open (#3743) as something we'd probably want to address in the future. |
|
I'm delighted to have the opportunity to discuss this with @ssddanbrown
I indeed utilize this feature to resolve the issue of blurriness in diagrams saved in BookStack, specifically when created with draw.io. The default scale often results in unclear images, particularly for text-rich diagrams. Allowing the export parameters to be adjustable can significantly enhance the clarity of saved images. This enhancement is particularly beneficial for intricate diagrams where zooming into specific sections is common, potentially leading to blurriness. Hence, I recommend enabling user-defined adjustments, as the necessity for clarity varies based on the complexity and content of the diagrams drawn.
After implementing this functionality, I have been actively using it, setting the scale to 3. My primary use case involves creating flowcharts, which can become quite intricate. When zoomed in, the content tends to get blurry. Adjusting the scale to 3 significantly enhances the clarity of the content. Below is an example for your reference. Drawio - AWS18scale: default value (1) - chrome zoom 500%scale: 3 - chrome zoom 500%This might not be a great example, but what I want to convey is that after saving in drawio, there will be more pixels, resulting in clearer images. This also relates to whether the patterns in the drawio libraries support scaling. However, at the very least, the text does support scaling |
Should I respond to this question here or would it be better to reply in #3743?
I'm not certain about the exact problems users are facing. However, in my setup, which includes a MacBook Pro 13" 2019 with a Retina display, I addressed the issue using the viewerjs library. This JS library enables image scaling, which, when used in conjunction with the increased export scale of draw.io images(resulting in higher pixel clarity as per the official draw.io documentation at https://www.drawio.com/doc/faq/export-higher-resolution which states that a higher scale results in higher DPI), significantly improves the display quality. The effectiveness of this approach is evident in the attached image.
The first image appears quite small. Clicking on it allows for enlargement to focus on specific sections. |





Description
This Pull Request introduces the editor-drawio::export event to the BookStack platform, following the discussion in issue #4156. The primary goal of this enhancement is to provide additional flexibility and customization for the export settings of the diagrams.net integration within BookStack.
New Public Event - editor-drawio::export
Testing and Validation:
How to Test:
To test this feature, you can add the following script to the 'Custom HTML Head Content' section in BookStack:
This script will dynamically adjust the export scale of diagrams.net drawings.