Files
drawio-desktop-mirror/build/quicklook-preview.html
2026-04-25 08:06:05 +02:00

71 lines
1.7 KiB
HTML

<!DOCTYPE html>
<!--
Quick Look preview for .drawio files.
Loaded by the PreviewExtension.appex via quicklookjs.
Uses viewer-static.min.js (with embedded shapes) to render diagrams
without network access.
-->
<html>
<head>
<meta charset="utf-8">
<style>
html, body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
overflow: hidden;
background: white;
}
.mxgraph {
width: 100%;
height: 100%;
}
#error {
display: none;
padding: 2em;
font-family: system-ui, -apple-system, sans-serif;
color: #666;
text-align: center;
}
</style>
</head>
<body>
<div id="diagram" class="mxgraph"></div>
<div id="error"></div>
<script>
window.onDrawioViewerLoad = async function()
{
try
{
var result = await quicklook.getPreviewedFile();
var xml = await result.file.text();
var div = document.getElementById('diagram');
div.setAttribute('data-mxgraph', JSON.stringify({
xml: xml,
highlight: 'none',
lightbox: false,
nav: false,
'auto-fit': true,
resize: true,
center: true
}));
GraphViewer.processElements();
}
catch (e)
{
var errDiv = document.getElementById('error');
errDiv.style.display = 'block';
errDiv.innerText = 'Cannot preview diagram: ' + e.message;
document.getElementById('diagram').style.display = 'none';
}
await quicklook.finishedLoading();
};
</script>
<script src="viewer-static.min.js"></script>
</body>
</html>