+
${escapeHtml(name)}${folder ? `${escapeHtml(folder)}` : ''} ${formatFileSize(e.size)}
${PREVIEWABLE.includes(e.format) && e.format !== 'mtl' ? `` : ''}
@@ -1207,6 +1208,13 @@ function handoffItem(kind, id, archiveId) {
function renderSlicerBar() {
const item = detailItems.find((i) => itemKey(i) === activeItemKey);
+ const handle = document.getElementById('dragOutBtn');
+ handle.hidden = !(item && CAN_DRAG_OUT);
+ if (item) {
+ handle.dataset.dragUrl = rawUrlFor(item);
+ handle.dataset.dragName = item.name;
+ handle.title = `Drag ${item.name} onto your desktop or a folder to save it`;
+ }
const bar = document.getElementById('slicerBar');
bar.hidden = !(item && SLICEABLE.includes(item.format));
const slicer = SLICERS[prefs.slicer];
@@ -1355,6 +1363,13 @@ function handleSaveSlicer(e) {
// ---------------------------------------------------------------- drag-out
// Chromium browsers save a dragged element as a file when it carries DownloadURL
// ("type:name:url"); the download goes through the browser, session included.
+// Safari and Firefox have no equivalent. Only Chromium has navigator.userAgentData.
+const CAN_DRAG_OUT = 'userAgentData' in navigator;
+
+// draggable + data for anything that drags out as a file.
+function dragAttrs(url, name) {
+ return CAN_DRAG_OUT ? ` draggable="true" data-drag-url="${escapeHtml(url)}" data-drag-name="${escapeHtml(name)}"` : '';
+}
function setDragOut(dataTransfer, { url, name }) {
dataTransfer.effectAllowed = 'copy';
dataTransfer.setData('DownloadURL', `application/octet-stream:${String(name).replace(/[:\\/]/g, '-')}:${new URL(url, window.location.origin).href}`);
@@ -1519,12 +1534,12 @@ function renderProjectPanels(item) {
} else {
platesEl.hidden = false;
platesEl.innerHTML = project.plates.map((p) => `
- `).join('')
- + ``;
+ + ``;
}
const filaments = ((project && project.filaments) || [])
diff --git a/public/index.html b/public/index.html
index b2f7d25..3ec8380 100644
--- a/public/index.html
+++ b/public/index.html
@@ -425,6 +425,7 @@
+
diff --git a/public/styles.css b/public/styles.css
index 8cc7cef..6f62190 100644
--- a/public/styles.css
+++ b/public/styles.css
@@ -256,7 +256,8 @@ label { display: block; font-size: 13px; font-weight: 500; color: var(--text-mut
.file-row:last-child { border-bottom: none; }
.file-row em { color: var(--text-dim); font-style: normal; font-family: var(--mono); font-size: 12px; }
.file-row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
-.file-row[draggable="true"], .entry-row[draggable="true"] { cursor: grab; }
+.file-row[draggable="true"], .entry-row[draggable="true"], .drag-out-btn { cursor: grab; }
+.drag-out-btn:active { cursor: grabbing; }
/* ---- slicer hand-off ---- */
.preview-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }