feat(exercises): bump version to 0.8.64 and enhance media handling
Deploy Development / deploy (push) Successful in 36s
Test Suite / pytest-backend (push) Successful in 25s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 7s
Test Suite / playwright-tests (push) Successful in 23s
Test Suite / pytest-backend (pull_request) Successful in 23s
Test Suite / lint-backend (pull_request) Successful in 0s
Test Suite / build-frontend (pull_request) Successful in 7s
Test Suite / playwright-tests (pull_request) Successful in 23s
Deploy Development / deploy (push) Successful in 36s
Test Suite / pytest-backend (push) Successful in 25s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 7s
Test Suite / playwright-tests (push) Successful in 23s
Test Suite / pytest-backend (pull_request) Successful in 23s
Test Suite / lint-backend (pull_request) Successful in 0s
Test Suite / build-frontend (pull_request) Successful in 7s
Test Suite / playwright-tests (pull_request) Successful in 23s
- Incremented application version to 0.8.64 and updated changelog with new features. - Improved media handling in the Rich Text Editor with auto-scrolling during drag-and-drop. - Added new CSS styles for video thumbnails and enhanced layout for media items. - Removed deprecated `ExerciseAttachmentMediaStrip` from the ExerciseFullContent component. - Updated ExerciseFormPage to manage form dirty state and prevent data loss on navigation.
This commit is contained in:
1 parent
337f29401b
commit
5cf775c920
8 files changed
+185
-65
No files matched your search
@@ -11,6 +11,41 @@ import {
|
||||
} from '../constants/inlineExerciseMedia'
|
||||
import { sanitizeInlineMediaCaption } from '../utils/inlineMediaCaption'
|
||||
|
||||
function RtePickerAssetThumb({ asset }) {
|
||||
const id = asset.id
|
||||
const src = resolveMediaAssetFileUrl(id)
|
||||
const mt = (asset.mime_type || '').toLowerCase()
|
||||
if (mt.startsWith('image/') && src) {
|
||||
return <img alt="" src={src} className="rte-inline-asset-tile__thumb-img" />
|
||||
}
|
||||
if (mt.startsWith('video/') && src) {
|
||||
return (
|
||||
<video
|
||||
key={`v-${id}`}
|
||||
className="rte-inline-asset-tile__thumb-video"
|
||||
src={src}
|
||||
muted
|
||||
playsInline
|
||||
preload="metadata"
|
||||
onLoadedMetadata={(e) => {
|
||||
try {
|
||||
const el = e.currentTarget
|
||||
const d = el.duration
|
||||
el.currentTime = Number.isFinite(d) && d > 0 ? Math.min(0.05, d * 0.01) : 0.05
|
||||
} catch (_) {
|
||||
/* ignore */
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
const nameLow = String(asset.original_filename || '').toLowerCase()
|
||||
if (mt.includes('pdf') || nameLow.endsWith('.pdf')) {
|
||||
return <span className="rte-inline-asset-tile__thumb-fallback">PDF</span>
|
||||
}
|
||||
return <span className="rte-inline-asset-tile__thumb-fallback">Datei</span>
|
||||
}
|
||||
|
||||
/** MIME/Dateiname → Übungs-media_type */
|
||||
function inferExerciseMediaType(file) {
|
||||
if (!file) return 'image'
|
||||
@@ -263,9 +298,6 @@ export default function ExerciseInlineFileMediaModal({
|
||||
const selected = selectedAssetId === id
|
||||
const label = it.original_filename || it.copyright_notice || `Archiv #${id}`
|
||||
const linked = assetToExerciseMedia.has(Number(id))
|
||||
const src = resolveMediaAssetFileUrl(id)
|
||||
const isImg = (it.mime_type || '').startsWith('image/')
|
||||
const isVid = (it.mime_type || '').startsWith('video/')
|
||||
return (
|
||||
<button
|
||||
key={id}
|
||||
@@ -275,13 +307,7 @@ export default function ExerciseInlineFileMediaModal({
|
||||
disabled={busy}
|
||||
>
|
||||
<div className="rte-inline-asset-tile__thumb" aria-hidden>
|
||||
{isImg && src ? (
|
||||
<img alt="" src={src} className="rte-inline-asset-tile__thumb-img" />
|
||||
) : isVid ? (
|
||||
<span className="rte-inline-asset-tile__thumb-fallback">▶ Video</span>
|
||||
) : (
|
||||
<span className="rte-inline-asset-tile__thumb-fallback">PDF / Datei</span>
|
||||
)}
|
||||
<RtePickerAssetThumb asset={it} />
|
||||
</div>
|
||||
{linked ? (
|
||||
<span className="rte-inline-asset-tile__badge">Bereits verknüpft</span>
|
||||
|
||||
Reference in new issue
Block a user