mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-10-10 03:29:50 +08:00
- Pass themes=1 and dark=auto to the draw.io iframe, so the Extras menu offers the Theme submenu and draw.io follows the system dark mode; the header and dialogs follow it too through prefers-color-scheme - Download dialog: new Editable SVG (.drawio.svg) format through draw.io's xmlsvg export, default name diagram-YYYY-MM-DD, Enter saves and Escape closes it and the history dialog - export_diagram accepts format "drawio.svg" and detects the .drawio.svg extension - Use system fonts instead of Google Fonts, so the page works offline with a self-hosted draw.io (DRAWIO_BASE_URL)
94 lines
5.9 KiB
HTML
94 lines
5.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Next AI Draw.io</title>
|
|
<style>
|
|
{{CSS}}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="container">
|
|
<div id="header">
|
|
<div class="brand">
|
|
<div class="logo">
|
|
<svg viewBox="0 0 1536 1536" fill="#ffffff">
|
|
<g transform="translate(0,1536) scale(0.1,-0.1)">
|
|
<path d="M2765 14404 c-100 -29 -181 -58 -225 -82 -227 -125 -359 -296 -431 -560 -19 -70 -19 -108 -19 -1175 0 -1068 1 -1104 20 -1172 58 -206 159 -356 319 -474 71 -53 199 -121 226 -121 9 0 26 -5 38 -12 12 -6 62 -19 112 -29 85 -17 207 -18 2219 -19 1172 0 2133 -3 2138 -8 4 -4 7 -246 6 -538 l-3 -529 -2330 -5 c-2506 -6 -2373 -3 -2470 -54 -61 -31 -150 -113 -194 -178 -87 -128 -82 -77 -90 -1025 l-6 -838 -360 -6 c-292 -4 -368 -8 -405 -21 -194 -68 -303 -177 -373 -372 l-22 -61 1 -2887 c1 -2716 2 -2890 18 -2935 56 -153 161 -276 286 -334 126 -59 0 -54 1400 -54 1394 0 1290 -4 1410 53 95 45 198 148 242 241 62 133 58 -93 58 3026 0 2992 1 2883 -40 2990 -59 156 -183 272 -360 337 -25 9 -146 14 -440 18 l-405 5 0 540 0 540 2020 3 c1111 1 2030 0 2043 -3 l22 -5 -2 -538 -3 -537 -380 -6 c-312 -4 -388 -8 -426 -21 -195 -68 -326 -204 -383 -399 -15 -51 -16 -295 -16 -2921 0 -2778 1 -2867 19 -2920 36 -104 72 -167 134 -230 75 -78 115 -105 222 -151 l50 -22 1219 -3 c672 -1 1255 1 1300 6 109 12 217 63 298 140 73 69 107 118 144 208 l29 69 3 2880 c2 2687 1 2884 -15 2945 -48 183 -188 332 -373 398 -37 13 -114 17 -430 21 l-385 6 -3 534 c-2 421 0 536 10 543 7 4 925 8 2039 8 1718 0 2028 -2 2038 -14 8 -10 11 -154 11 -531 -1 -284 -4 -523 -7 -531 -4 -12 -69 -14 -392 -14 -354 0 -391 -2 -448 -20 -168 -52 -282 -148 -353 -295 -22 -45 -40 -91 -40 -103 0 -11 -5 -33 -10 -47 -7 -18 -10 -988 -10 -2875 0 -2393 2 -2858 14 -2902 43 -167 148 -298 293 -369 57 -27 107 -44 151 -50 88 -11 2429 -11 2508 0 210 31 416 238 445 450 6 39 8 1245 7 2926 -3 2713 -4 2862 -21 2900 -41 93 -74 150 -110 191 -46 52 -149 134 -169 134 -8 0 -19 5 -24 10 -6 6 -42 19 -80 30 -63 18 -100 20 -415 20 -307 0 -348 2 -353 16 -3 9 -6 390 -6 848 0 797 -1 834 -19 886 -31 87 -50 118 -111 183 -66 70 -141 119 -221 144 -50 16 -228 18 -2389 23 l-2335 5 0 535 0 535 2165 5 c1191 3 2170 8 2176 12 6 4 35 12 65 17 201 35 435 198 539 376 55 93 82 153 110 245 19 63 20 94 20 1167 0 1047 -1 1106 -19 1180 -70 290 -275 523 -539 613 -160 54 232 50 -5028 49 -4182 0 -4856 -2 -4899 -15z"/>
|
|
</g>
|
|
</svg>
|
|
</div>
|
|
<span class="title">Next AI Draw.io</span>
|
|
{{SESSION_BADGE}}
|
|
</div>
|
|
<div class="right">
|
|
<button id="history-btn" title="History" {{DISABLED}}>
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
<circle cx="12" cy="12" r="10"></circle>
|
|
<polyline points="12 6 12 12 16 14"></polyline>
|
|
</svg>
|
|
History
|
|
</button>
|
|
<button id="save-btn" {{DISABLED}}>
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
|
|
<polyline points="7 10 12 15 17 10"></polyline>
|
|
<line x1="12" y1="15" x2="12" y2="3"></line>
|
|
</svg>
|
|
Download
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<iframe id="drawio" src="{{DRAWIO_URL}}/?embed=1&proto=json&spin=1&libraries=1&noSaveBtn=1&noExitBtn=1&saveAndExit=0&themes=1&dark=auto" title="draw.io editor"></iframe>
|
|
</div>
|
|
<div id="notice" role="status"></div>
|
|
<div id="history-modal">
|
|
<div class="modal-content">
|
|
<div class="modal-header"><h2>History</h2></div>
|
|
<div class="modal-body">
|
|
<div id="history-grid" class="history-grid"></div>
|
|
<div id="history-empty" class="empty" style="display:none;">No history yet</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button class="btn btn-secondary" id="cancel-btn">Cancel</button>
|
|
<button class="btn btn-primary" id="restore-btn" disabled>Restore</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="save-modal">
|
|
<div class="modal-content">
|
|
<div class="modal-header"><h2>Download Diagram</h2></div>
|
|
<div class="modal-body">
|
|
<div class="form-group">
|
|
<label>Format</label>
|
|
<select id="save-format">
|
|
<option value="drawio">Draw.io (.drawio)</option>
|
|
<option value="png">PNG Image (.png)</option>
|
|
<option value="svg">SVG Vector (.svg)</option>
|
|
<option value="xmlsvg">Editable SVG (.drawio.svg)</option>
|
|
</select>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Filename</label>
|
|
<div class="filename-group">
|
|
<input type="text" id="save-filename" value="diagram" placeholder="Enter filename" autocomplete="off">
|
|
<span class="ext" id="save-ext">.drawio</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button class="btn btn-secondary" id="save-cancel-btn">Cancel</button>
|
|
<button class="btn btn-primary" id="save-confirm-btn">Save</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
const sessionId = {{SESSION_JSON}};
|
|
const DRAWIO_ORIGIN = {{ORIGIN_JSON}};
|
|
</script>
|
|
<script>
|
|
{{SCRIPT}}
|
|
</script>
|
|
</body>
|
|
</html> |