Webdav is the most common protocol for simple loading/saving files onto a filesystem via a web page. All major web servers support it, as well as most CMS and wiki systems.

Webdav works by allowing an authorized user to get/put a file object that's on a WebDav enabled directory. This directory needs to be accessible by the web server to be loaded from a URL or web page link.

If you take a copy of this HTML file and put it on a WebDav server, you'll get a self-contained editor and diagram in one file.

This is a screenshot, it's not actually clickable...

Navigate to the file (either by URL or list the directory the file resides in) and click the "click here" button. What then happens is the page opens draw.io in embedded mode, passing the diagram data from the HTML file via postMessage. It's important to note that although draw.io is served from the online site, the diagram data goes from your server, to your browser and then back again on save, it doesn't go externally.

After editing the diagram and clicking save, the diagram is posted back to the HTML wrapper file and the file overwrites itself with the new diagram data via a WebDav put.

You could copy the editDiagram and save JS functions into your own HTML if you wanted to add self-contained diagram adding to an existing page.