Skip to content

Commit 54212fe

Browse files
authored
Merge branch 'kennethkutyn:main' into main
2 parents 0d43256 + 7b7134f commit 54212fe

File tree

4 files changed

+18
-16
lines changed

4 files changed

+18
-16
lines changed

app.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ const setupLastEdited = () => {
6868
};
6969

7070
titleEl.addEventListener('input', handleTitleChange);
71+
titleEl.addEventListener('keydown', (event) => {
72+
if (event.key === 'Enter') {
73+
event.preventDefault();
74+
titleEl.blur();
75+
}
76+
});
7177
titleEl.addEventListener('blur', handleTitleChange);
7278
};
7379

index.html

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,8 @@
104104
</button>
105105
<button class="toolbar-btn ai-btn" id="ai-btn" aria-label="AI assist" title="AI assist">
106106
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
107-
<path d="M12 3v2"></path>
108-
<path d="M12 19v2"></path>
109-
<path d="M5.64 5.64l1.41 1.41"></path>
110-
<path d="M16.95 16.95l1.41 1.41"></path>
111-
<path d="M3 12h2"></path>
112-
<path d="M19 12h2"></path>
113-
<path d="M5.64 18.36l1.41-1.41"></path>
114-
<path d="M16.95 7.05l1.41-1.41"></path>
115-
<circle cx="12" cy="12" r="3"></circle>
107+
<path d="M12 3 13.4 7.2H18l-3.5 2.6 1.3 4.1L12 11.6 8.2 13.9 9.5 9.8 6 7.2h4.6Z"></path>
108+
<path d="M6.5 14.5 7.3 16.8H9.7L7.8 18.2l.7 2.3-2-1.4-2 1.4.7-2.3-1.9-1.4h2.4Z"></path>
116109
</svg>
117110
<span>AI</span>
118111
</button>

js/nodes.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,24 +116,26 @@ export async function initExportButton() {
116116
trackExportButtonClick();
117117
try {
118118
const exportContainer = document.querySelector('.canvas-container');
119-
if (!exportContainer) return;
119+
const captureTarget = document.querySelector('.canvas');
120+
if (!exportContainer || !captureTarget) return;
120121
await loadHtml2Canvas();
121122
exportBtn.disabled = true;
122123
exportBtn.setAttribute('aria-label', 'Exporting diagram');
123124
exportContainer.classList.add('is-exporting');
125+
const scale = Math.max(window.devicePixelRatio || 1, 2);
124126
const options = {
125127
backgroundColor: '#FFFFFF',
126-
scale: Math.max(window.devicePixelRatio || 1, 2),
128+
scale,
127129
scrollX: 0,
128130
scrollY: 0,
129131
useCORS: true,
130-
width: exportContainer.scrollWidth,
131-
height: exportContainer.scrollHeight,
132-
windowWidth: exportContainer.scrollWidth,
133-
windowHeight: exportContainer.scrollHeight
132+
width: captureTarget.scrollWidth,
133+
height: captureTarget.scrollHeight,
134+
windowWidth: captureTarget.scrollWidth,
135+
windowHeight: captureTarget.scrollHeight
134136
};
135137

136-
const canvas = await window.html2canvas(exportContainer, options);
138+
const canvas = await window.html2canvas(captureTarget, options);
137139
const blob = await new Promise(resolve => canvas.toBlob(resolve, 'image/png'));
138140
if (!blob) return;
139141
const clipboardItem = new ClipboardItem({ 'image/png': blob });

styles.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ body {
453453
outline: none;
454454
min-width: 0;
455455
flex: 1;
456+
white-space: pre-wrap;
456457
}
457458

458459
.diagram-title:focus {

0 commit comments

Comments
 (0)