diff --git a/js/app.js b/js/app.js index 8a374ee..24139fd 100644 --- a/js/app.js +++ b/js/app.js @@ -3,7 +3,7 @@ * * HTML 方針: * - マークアップを描画する箇所は x-html="safeHtml(...)" のみ。 - * - タグを出さない一行表示には plainText(...)(サニタイズ後に textContent 化)。 + * - タグを出さない一行が必要なら、サニタイズ済み文字列を一時 DOM に載せて textContent を取る等(テンプレ用ヘルパーは必要時に追加)。 * - 状態に保持する解説文字列は保存時に sanitizeStoredHtml で正規化。 */ import { DRILLS } from './data/drills.js'; @@ -28,22 +28,11 @@ function sanitizeStoredHtml(html) { return sanitizeTrustedHtml(html); } -/** サニタイズ済み HTML からプレーン文字列(x-text 向け) */ -function plainTextFromSanitizedHtml(html) { - if (html == null || html === '') return ''; - const d = document.createElement('div'); - d.innerHTML = sanitizeTrustedHtml(String(html)); - return (d.textContent || '').replace(/\s+/g, ' ').trim(); -} - document.addEventListener('alpine:init', () => { Alpine.data('bokiApp', () => ({ safeHtml(s) { return sanitizeTrustedHtml(s); }, - plainText(s) { - return plainTextFromSanitizedHtml(s); - }, categories:[], currentUnit:null, quizState:{}, diff --git a/sw.js b/sw.js index e3bca0b..0007699 100644 --- a/sw.js +++ b/sw.js @@ -1,5 +1,5 @@ // posimai-boki SW — stale-while-revalidate + skipWaiting -const CACHE = 'posimai-boki-v17'; +const CACHE = 'posimai-boki-v18'; const STATIC = ['/', '/index.html', '/manifest.json', '/logo.png', '/js/app.js', '/js/data/drills.js', '/js/data/categories.js']; self.addEventListener('install', e => {