feat(core): add vimeo media host and html/react components (#1667)

This commit is contained in:
Wesley Luyten
2026-06-18 09:36:31 +10:00
committed by GitHub
parent 035b509c7a
commit 1b31f3e8d7
25 changed files with 1551 additions and 77 deletions
+9
View File
@@ -0,0 +1,9 @@
export function escapeHtml(str: string): string {
return str
.replace(/&/g, '&')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;')
.replace(/`/g, '&#96;');
}
+1
View File
@@ -1,2 +1,3 @@
export * from './casing';
export * from './escape-html';
export * from './generate-id';
@@ -0,0 +1,14 @@
import { describe, expect, it } from 'vitest';
import { escapeHtml } from '../escape-html';
describe('escapeHtml', () => {
it('escapes HTML special characters', () => {
expect(escapeHtml('&<>"\'`')).toBe('&amp;&lt;&gt;&quot;&#39;&#96;');
});
it('preserves strings without HTML special characters', () => {
expect(escapeHtml('https://player.vimeo.com/video/123?autoplay=1')).toBe(
'https://player.vimeo.com/video/123?autoplay=1'
);
});
});