All checks were successful
Deploy Development / deploy (push) Successful in 34s
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 30s
- Incremented application version to 0.8.63 and updated changelog with new features. - Enhanced inline media handling in the Rich Text Editor, including support for captions. - Introduced new CSS styles for improved media display and layout in the editor. - Replaced `ExerciseMediaEmbed` with `ExerciseAttachmentMediaStrip` for better media management in exercise content.
18 lines
476 B
JavaScript
18 lines
476 B
JavaScript
const MAX_CAPTION = 120
|
|
|
|
/**
|
|
* Für data-shinkan-exercise-media-caption: kurz, ohne Anführungszeichen/HTML.
|
|
* @param {string|null|undefined} raw
|
|
* @returns {string}
|
|
*/
|
|
export function sanitizeInlineMediaCaption(raw) {
|
|
if (raw == null || typeof raw !== 'string') return ''
|
|
let s = raw
|
|
.replace(/[\u0000-\u001F\u007F]/g, ' ')
|
|
.replace(/["'`<>]/g, ' ')
|
|
.replace(/\s+/g, ' ')
|
|
.trim()
|
|
if (s.length > MAX_CAPTION) s = s.slice(0, MAX_CAPTION)
|
|
return s
|
|
}
|