feat(exercises): enhance inline media functionality and update styles
Deploy Development / deploy (push) Successful in 33s
Test Suite / pytest-backend (push) Successful in 24s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 7s
Test Suite / playwright-tests (push) Successful in 27s
Deploy Development / deploy (push) Successful in 33s
Test Suite / pytest-backend (push) Successful in 24s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 7s
Test Suite / playwright-tests (push) Successful in 27s
- Updated inline media markup to include a new data attribute for media size. - Enhanced the Rich Text Editor to support media size selection when inserting inline media. - Improved CSS styles for inline media display, accommodating different sizes (small, medium, full). - Bumped version to 0.8.62 and updated changelog to reflect these changes.
This commit is contained in:
1 parent
979e328cef
commit
311a106d93
14 files changed
+703
-113
No files matched your search
@@ -180,7 +180,7 @@ function ExerciseDetailPage() {
|
||||
</p>
|
||||
)}
|
||||
{m.description && <p style={{ color: 'var(--text2)', fontSize: '0.9rem' }}>{m.description}</p>}
|
||||
<ExerciseMediaEmbed media={m} exerciseId={exercise.id} />
|
||||
<ExerciseMediaEmbed media={m} exerciseId={exercise.id} layoutSize="full" />
|
||||
</div>
|
||||
))}
|
||||
</section>
|
||||
|
||||
@@ -169,7 +169,14 @@ function buildVariantPayloadFromRow(row) {
|
||||
}
|
||||
|
||||
/** Gemeinsame Felder für „Variante bearbeiten“ und „Neue Variante“. */
|
||||
function ExerciseVariantFields({ row, onPatch, prerequisiteOthers, rteMinHeight = '110px', exerciseMediaInsertSlots }) {
|
||||
function ExerciseVariantFields({
|
||||
row,
|
||||
onPatch,
|
||||
prerequisiteOthers,
|
||||
rteMinHeight = '110px',
|
||||
inlineExerciseId,
|
||||
onExerciseMediaListChanged,
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<div className="form-row">
|
||||
@@ -198,7 +205,8 @@ function ExerciseVariantFields({ row, onPatch, prerequisiteOthers, rteMinHeight
|
||||
onChange={(html) => onPatch({ execution_changes: html })}
|
||||
placeholder="Was unterscheidet diese Variante? (Listen über Symbolleiste)"
|
||||
minHeight={rteMinHeight}
|
||||
insertExerciseMediaSlots={exerciseMediaInsertSlots}
|
||||
inlineExerciseId={inlineExerciseId}
|
||||
onExerciseMediaListChanged={onExerciseMediaListChanged}
|
||||
/>
|
||||
</div>
|
||||
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '10px' }}>
|
||||
@@ -460,16 +468,6 @@ function ExerciseFormPage() {
|
||||
const [archiveError, setArchiveError] = useState(null)
|
||||
const [mediaPreview, setMediaPreview] = useState(null)
|
||||
|
||||
const exerciseMediaInsertSlots = useMemo(() => {
|
||||
if (!isEdit) return []
|
||||
return (mediaList || [])
|
||||
.filter((m) => m?.id != null)
|
||||
.map((m) => ({
|
||||
id: m.id,
|
||||
label: (m.title && String(m.title).trim()) || m.original_filename || `Medium #${m.id}`,
|
||||
}))
|
||||
}, [isEdit, mediaList])
|
||||
|
||||
useEffect(() => {
|
||||
const next = {}
|
||||
for (const m of mediaList) {
|
||||
@@ -1051,7 +1049,8 @@ function ExerciseFormPage() {
|
||||
onChange={(html) => updateFormField('summary', html)}
|
||||
placeholder="Kurzbeschreibung (optional)"
|
||||
minHeight="80px"
|
||||
insertExerciseMediaSlots={exerciseMediaInsertSlots}
|
||||
inlineExerciseId={isEdit ? exerciseId : null}
|
||||
onExerciseMediaListChanged={refreshMedia}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -1062,7 +1061,8 @@ function ExerciseFormPage() {
|
||||
onChange={(html) => updateFormField('goal', html)}
|
||||
placeholder="Trainingsziel"
|
||||
minHeight="120px"
|
||||
insertExerciseMediaSlots={exerciseMediaInsertSlots}
|
||||
inlineExerciseId={isEdit ? exerciseId : null}
|
||||
onExerciseMediaListChanged={refreshMedia}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -1073,7 +1073,8 @@ function ExerciseFormPage() {
|
||||
onChange={(html) => updateFormField('execution', html)}
|
||||
placeholder="Ablauf Schritt für Schritt"
|
||||
minHeight="180px"
|
||||
insertExerciseMediaSlots={exerciseMediaInsertSlots}
|
||||
inlineExerciseId={isEdit ? exerciseId : null}
|
||||
onExerciseMediaListChanged={refreshMedia}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -1084,7 +1085,8 @@ function ExerciseFormPage() {
|
||||
onChange={(html) => updateFormField('preparation', html)}
|
||||
placeholder="Matten, Raum, …"
|
||||
minHeight="100px"
|
||||
insertExerciseMediaSlots={exerciseMediaInsertSlots}
|
||||
inlineExerciseId={isEdit ? exerciseId : null}
|
||||
onExerciseMediaListChanged={refreshMedia}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -1095,7 +1097,8 @@ function ExerciseFormPage() {
|
||||
onChange={(html) => updateFormField('trainer_notes', html)}
|
||||
placeholder="Sicherheit, Varianten-Hinweise, …"
|
||||
minHeight="100px"
|
||||
insertExerciseMediaSlots={exerciseMediaInsertSlots}
|
||||
inlineExerciseId={isEdit ? exerciseId : null}
|
||||
onExerciseMediaListChanged={refreshMedia}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -1390,7 +1393,8 @@ function ExerciseFormPage() {
|
||||
onPatch={(patch) => setVariantDraft((d) => ({ ...d, ...patch }))}
|
||||
prerequisiteOthers={variants}
|
||||
rteMinHeight="110px"
|
||||
exerciseMediaInsertSlots={exerciseMediaInsertSlots}
|
||||
inlineExerciseId={isEdit ? exerciseId : null}
|
||||
onExerciseMediaListChanged={refreshMedia}
|
||||
/>
|
||||
<button type="submit" className="btn btn-primary" style={{ marginTop: '10px' }} disabled={variantBusy}>
|
||||
{variantBusy ? 'Anlegen…' : 'Variante anlegen'}
|
||||
@@ -1457,7 +1461,8 @@ function ExerciseFormPage() {
|
||||
onPatch={(patch) => updateVariantField(selectedVariantForEdit.id, patch)}
|
||||
prerequisiteOthers={variants.filter((o) => o.id !== selectedVariantForEdit.id)}
|
||||
rteMinHeight="110px"
|
||||
exerciseMediaInsertSlots={exerciseMediaInsertSlots}
|
||||
inlineExerciseId={isEdit ? exerciseId : null}
|
||||
onExerciseMediaListChanged={refreshMedia}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user