gitea icon indicating copy to clipboard operation
gitea copied to clipboard

Gitea: integration with Draw.io

Open AKopytenko opened this issue 1 year ago • 15 comments

Feature Description

Hi there!

I have an idea for integrating Gitea services and Draw.io. In my opinion, this can be a pretty useful thing!

"The user attaches the .drawio file to the messages in the issues. When clicking on the attached file, the user is redirected to the draw.io, at the same time, the contents of the file [XML in base64 or the like] are sent to the payload of the POST request. Draw.io receiving the file content and expands it into a schema. Apparently, the issue is complex and requires collaboration with the guys from Gitea. Let's try?" (с)

https://github.com/jgraph/drawio/issues/4128

Screenshots

No response

AKopytenko avatar Jan 23 '24 11:01 AKopytenko

Ideally we would render .drawio files ourselves, but as far as I can tell, the drawio renderer is not available as standalone JS.

It is possible to self-host draw.io though, so if a integration is done, it should have configurable target URL. Iframing is certainly an option.

silverwind avatar Jan 27 '24 11:01 silverwind

I wonder if this could be achieved with an external renderer via the config so nothing new needs to be added to Gitea

techknowlogick avatar Jan 27 '24 17:01 techknowlogick

I wonder if this could be achieved with an external renderer via the config so nothing new needs to be added to Gitea

I don't think it's possible to be as an external renderer. Because it needs to read/save the files. It should be more like the markdown editor of course for .drawio files but .md files.

lunny avatar Jan 31 '24 06:01 lunny

According to the statement on their README.

draw.io is not suitable as a framework for building other products from. For this try either Tldraw or Excalidraw.

Tldraw is non-commercial license. Looks like https://github.com/excalidraw/excalidraw is the only possible solution.

lunny avatar Jan 31 '24 06:01 lunny

As I understand it, the only official draw.io interface is the full-blown editor UI. What we need would be a viewer-only UI. Maybe there are third-party made renderes available somewhere.

silverwind avatar Jan 31 '24 11:01 silverwind

Seems confluence has done some integration with a viewer.min.js file from the draw.io repo, so it may be possible:

https://www.drawio.com/doc/faq/configure-javascript-viewer-drawio-confluence-server

silverwind avatar Jan 31 '24 11:01 silverwind

gitlab supports viewing, editing draw.io files. seems to work offline from draw.io some links:

  • some code in master: https://gitlab.com/gitlab-org/gitlab/-/tree/master/app/assets/javascripts/drawio?ref_type=heads
  • and merge request that looks like mvp: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/86206/diffs#7981eac67e1980a41d95e5bfc2ccea7350ce53ae

i think editing is a very nice feature.

tobhv avatar Feb 25 '24 14:02 tobhv

Seems they are embedding a iframe from https://embed.diagrams.net, not an ideal solution but could at least work with self-hosted renderer if that URL is made configurable.

silverwind avatar Feb 25 '24 16:02 silverwind

Why not just use drawio JS as lib?

lafriks avatar Feb 25 '24 19:02 lafriks

Why not just use drawio JS as lib?

There is no lib as far as I know, it's only available integrated with their backend.

silverwind avatar Feb 25 '24 23:02 silverwind