feat: improve lecture slide viewer and bump version to 1.2.28

This commit is contained in:
2026-11-02 17:54:33 +09:00
parent eab95c51fb
commit f492f3a31d
6 changed files with 220 additions and 60 deletions
+10
View File
@@ -31,3 +31,13 @@ test('lecture controls have English translations', () => {
const en = require('../src/renderer/src/i18n/en.json');
for (const key of ['슬라이드·퀴즈 열기', '강의 닫기', '슬라이드', '퀴즈', '답안 제출', '다시 풀기']) assert.ok(en[key], key);
});
test('presentation slides render key messages, examples and legacy body as safe text', () => {
const source = fs.readFileSync(require.resolve('../src/renderer/src/features/curriculum/LectureSlideCanvas.tsx'), 'utf8');
const exports = {};
const output = ts.transpileModule(source, { compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2022, jsx: ts.JsxEmit.ReactJSX, esModuleInterop: true } }).outputText;
vm.runInNewContext(output, { exports, require: name => name === '../../i18n' ? { t: value => value } : require(name) });
const html = renderToStaticMarkup(React.createElement(exports.default, { slide: { id: 's1', type: 'content', title: '속도', subtitle: '핵심 메시지', body: '기존 본문', bullets: ['요점'], example: { label: '실습 예시', content: '<img src=x onerror=alert(1)>' } }, title: '제어 강의', index: 0, total: 4 }));
assert.match(html, /핵심 메시지/); assert.match(html, /기존 본문/); assert.match(html, /실습 예시/);
assert.doesNotMatch(html, /<img/); assert.match(html, /&lt;img/);
});