2. 사이드바 하단 컴포넌트 삽입
<div id="ps-sidebar-bottom"></div>
document.getElementById('ps-sidebar-bottom').innerHTML =
PuzzleShell.sidebarBottomHtml({
pageQtyId: 'ps-pages',
modalId: 'mypuzzle-pm',
genBtnLabel: '🎲 새 문제 생성',
genBtnId: 'gen-btn',
pageQtyHint: '서로 다른 문제 N페이지 인쇄'
});
3. 인쇄 모달 삽입 + 콜백 (v2.0 패턴)
<div id="xx-pm-modal-container"></div>
document.getElementById('xx-pm-modal-container').innerHTML =
PuzzleShell.PrintModal.html({
id: 'xx-pm',
puzzleName: '내 퍼즐',
recommend: { easy:4, normal:2, hard:1 },
hasAnswer: true,
layouts: [1, 2, 4],
pageQtyId: 'xx-pages'
});
PuzzleShell.PrintModal.onPrint('xx-pm', function(o) {
executePrint(o);
}, 'xx-pages');
function openPrintModal() {
if (!puzzle) { alert('먼저 문제를 생성해주세요.'); return; }
PuzzleShell.PrintModal.open('xx-pm',
PuzzleShell.PageQty.get('xx-pages'),
currentDiff
);
}
async function executePrint(o) {
PuzzleShell.PrintModal.close('xx-pm');
const pages = o?.pageCount || 1;
const layout = o?.layout || 4;
const inclAns = o?.output === 'both';
}
4. 빈 첫화면 (emptyStateHtml)
<main id="main">
<div id="xx-empty-area"></div>
<div id="grid-wrap" style="display:none"> ... </div>
</main>
document.getElementById('xx-empty-area').innerHTML =
PuzzleShell.emptyStateHtml({
icon: '🧩',
title: '퍼즐 생성기 이름',
desc: '퍼즐 설명 한 줄',
ctaLabel: '첫 문제 생성하기',
ctaOnClick: 'newPuzzle()'
});
function applyPuzzle(result) {
document.getElementById('xx-empty-area').style.display = 'none';
document.getElementById('grid-wrap').style.display = '';
}
5. 화면용 QR 렌더링
<div class="ps-qr-section">
<div class="ps-qr-box" id="qr-puzzle-A3F1B2"></div>
<div class="ps-qr-info">
<b>앱에서 이어 풀기</b><br>
<span class="ps-qr-label">QR 스캔 → 같은 문제 이어 풀기</span>
</div>
</div>
PuzzleShell.QR.renderToBox('qr-puzzle-A3F1B2', editorUrl);