BookStackApp / BookStack

A platform to create documentation/wiki content built with PHP & Laravel
https://www.bookstackapp.com/
MIT License
14.28k stars 1.8k forks source link

Draw.io using SVG to support links within diagram #1170

Open mark-james opened 5 years ago

mark-james commented 5 years ago

Describe the feature you'd like If the draw.io integration saved the diagram as SVG rather than png then links created within the diagram could also be followed directly from the bookstack page

Describe the benefits this feature would bring to BookStack users Diagrams elements can be used as shortcuts to access other pages within bookstack.

Often more visual representations are easier to understand. So a diagram could replace a table of contents.

This provides another form of interlinking between pages within bookstack.

Additional context With E11 support for bookstack disappearing anyway, is there a reason not to use SVG instead?

ssddanbrown commented 5 years ago

Thanks for the suggestion @mark-james, I had not thought about links within drawings.

Would somewhat rely on #1103 in addition to many other changes.

is there a reason not to use SVG instead?

Yeah, SVG's are harder to deal with, There's a lot more to them (From an editor/display point of view) whereas with a PNG everything is effectively encapsulated within a single unit.

mark-james commented 5 years ago

Ok. Thanks @ssddanbrown .

I'm happy to contribute a pull request if you could point me in the right direction as far as changes that need to be made? (Or at least things I need to consider)

This is a fairly important change to me as I'm going to start moving a knowledge base onto bookstack soon. The existing solution while inferior in many ways unfortunately does allow for links within diagrams. So it's going to cause me some conflict if I can't provide users this feature.

ssddanbrown commented 5 years ago

Considerations

mark-james commented 5 years ago

Thanks @ssddanbrown. Lots to consider! I'll begin looking at this early next week.

simchanu29 commented 4 years ago

Draw.io can generate embeded html. Would integrating this functionnality as html code be easier ?

ssddanbrown commented 4 years ago

@simchanu29 Unfortunately not really. Some considerations above would be lesser, but some new considerations would be introduced.

bakkertjebrood commented 3 years ago

Is there any update on this issue? Would be really nice to have links within the created diagrams.

ssddanbrown commented 3 years ago

@bakkertjebrood No, No update.

passchn commented 2 years ago

Are there any updates on this or do you plan to support SVG/HTML embeds in the future?

ssddanbrown commented 2 years ago

No, no further update on this. Would likely be activity here if anything was in progress.

ssddanbrown commented 2 years ago

Have attempted to solve this within #3452. Unfortunately, the complexity and lack of portability of drawings as SVGs have proved to cause issue. Draw.io diagrams rely on web-rendering, not just SVG compliance, and are too complex for our default PDF renderer and reflects poorly on content portability in general when in SVG format.

Not sure where to take this. Could export in both formats but then requires duplicate storage and format tracking/juggling, Not a mess I want to walk into. Maintaining a choice between "SVG-based drawings or working PDF exports" would also suck.

Matthew2000 commented 1 year ago

Is it possible to use Draw.io in a view only mode? https://www.diagrams.net/blog/online-diagram-viewer I don't know how exactly this works but it seems to indicate that there is a view only mode.

This might be a solution to getting links made in the diagrams to be usable and allowing viewers a better way to look at them.

fmos commented 1 year ago

Have attempted to solve this within #3452. Unfortunately, the complexity and lack of portability of drawings as SVGs have proved to cause issue. Draw.io diagrams rely on web-rendering, not just SVG compliance, and are too complex for our default PDF renderer and reflects poorly on content portability in general when in SVG format.

Not sure where to take this. Could export in both formats but then requires duplicate storage and format tracking/juggling, Not a mess I want to walk into. Maintaining a choice between "SVG-based drawings or working PDF exports" would also suck.

Thank you for your effort @ssddanbrown and for providing bookstack in the first place!

In #3452 I noticed that you checked off "Support SVG for the standard image gallery."

Would you want to consider to merge this feature, even without SVG support for embedded drawings? I guess, this would allow to create diagrams with links outside bookstack and embed them.

ssddanbrown commented 1 year ago

Would you want to consider to merge this feature, even without SVG support for embedded drawings?

@fmos No, the same issues for drawings would apply for images. The referenced checked off todo item was not in relation to full supported and accepted SVG support for image uploads, it was just in reference to adding support to the image manager functions.

vincentbernat commented 1 year ago

Alternatively, we could double the size of the PNG. This can be done by adding scale: 2 to the export action. We can apply 50% for width/height styles to get back the image in the right format. However, I don't know how to handle the transition. The scale should be stored somewhere.

ssddanbrown commented 1 year ago

@vincentbernat That wouldn't address the fundamental request here, of supporting links within drawings. I'd consider resolution/pixel-density to be a separate desire/request/issue/conversation.

at-ng commented 1 year ago

Something to consider when implementing this, with SVG another nice feature that could be added at the same time is the possibility to index diagrams. That way you could find things that are in diagrams when searching (just being able use the standard browser page search would be good as well). Sometimes you need to have very large diagrams then search would be great (zoom as well but that might be a different issue).

sarang-apps commented 11 months ago

Could a possible solution to handle this be to use a javascript canvas with the background image as a png, and links as regions with onclick events?

syh7 commented 3 weeks ago

Just bumping this to show there is still interest in allowing links in diagrams

Bert-Proesmans commented 2 weeks ago

I've been following this thread for a while and wanted to make the same suggestion as simchanu29 again, and i'm actually not sure if his suggestion was interpreted correctly as using draw.io lightbox mode instead of exporting as html. Don't export the diagram as HTML.

A purely additive feature would be to keep the PNG render as main and printable content, but while in read mode add an onclick handler to the PNG that opens a css lightbox² displaying drawio in lightbox mode (\<diagram-url>/?lightbox=1#\<diagram-data>).

This does not allow for indexing the diagram contents since the diagram is still considered an opaque blob, just like today. BUT it does allow for diagram text to be selectable, diagram links to be clickable, diagrams to be interactive (if using draw.io plugins). And the best part is that we skip the headache that is purifying the SVG data itself because of cross-site scripting risk.

To directly answer on the first post, this approach allows ✔️ Diagrams elements can be used as shortcuts to access other pages within bookstack.

❓ Often more visual representations are easier to understand. So a diagram could replace a table of contents. => Opening draw.io in lightbox mode will happen through an iframe which is a css block element and difficult to precisely position into text content. But not impossible to do, with/without custom styling. ❗ Embedded SVG's would be better since text can flow around and through the diagram. ❗ I'm interested to see examples of more closely related diagrams to text for functional purposes. In my opinion this leads to a bad content state, but it's not my intention to judge.

✔️ This provides another form of interlinking between pages within bookstack.

The implementation would be similar to clicking on the PNG from article edit mode, it only uses a different diagrams 'launch mode'. ²The css lightbox is just fancy, clicking the image might as well open drawio spanning the entire viewport. If the css lightbox could be stylable after a few iterations on the code, each user can decide for themselves if they want to open the diagram in fullscreen or some other way. Fullscreen will probably be enough for most people.

carlossierra311 commented 2 weeks ago

We were just creating some navigation maps for our end users and found out that all the links included on the diagram didn´t work. We would really appreciate this capability as well if it could find its way into BookStack.

Ps. No matter the outcome of this thread/request, I'd like to take the opportunity to thank you, @ssddanbrown for all the splendid work you do to bring us such a useful tool. Thanks!!!