Giter Site home page Giter Site logo

laingsimon / render-diagram Goto Github PK

View Code? Open in Web Editor NEW
17.0 17.0 2.0 108 KB

Render draw.io diagrams from a URL or embedded into a webpage

Home Page: https://laingsimon.github.io/render-diagram

License: Apache License 2.0

CSS 5.89% JavaScript 22.20% Java 59.37% HTML 12.54%

render-diagram's People

Contributors

laingsimon avatar sl-slaing avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

uurha philjoe12

render-diagram's Issues

Restructure readme

Content should flow better headings should be

  • Description
  • Usage
    • examples next to each usage
    • link to working examples (new page)
  • Motivation
    • other tools, mention gavizo
  • Known limitations

Support layers and pages

div.setAttribute("data-mxgraph", JSON.stringify({
		highlight: "none",
		target: "self",
		lightbox: false,
		nav: true,
		xml: "<mxfile version=\"10.6.5\"><diagram>" + diagramData + "</diagram></mxfile>"
	}));

Support modifying the above via a data attribute

options

  • highlight: colour of link highlight
  • target: where to open links
  • lightbox: whether lightbox is enabled
  • nav: whether links are enabled
  • xml: diagram data (shouldn't be modifiable)
  • toolbar: toolbar features (pages, layers, zoom, etc.)

Diagrams do not render correctly (SVG / PNG)

Draw.io offloads PDF rendering to a webservice, https://exp-pdf.draw.io/ImageExport4/export, it may be possible to re-use this - or identify how it works to achieve the same result in-house.

Reproduction steps

http://localhost:8080/?url=https://laingsimon.github.io/render-diagram/Sample%20file.xml&format=png

actual expected
image image
POST https://exp-pdf.draw.io/ImageExport4/export HTTP/1.1
Host: exp-pdf.draw.io
Content-Type: application/x-www-form-urlencoded

format=png&allPages=1&bg=none&base64=0&embedXml=0&xml=<url encoded file content>

This method works for PDF & PNG exports, but doesn't support SVG

Some drawings cannot be rendered

Error appears with message:

Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.

This is from a URL file which contains a <mxfile> element, maybe the data (element content) needs to be extracted from the response and passed along?

The samples contain a file which is returned in this format and works without issue, it could be a deflate/inflate versioning issue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.