eCourt-Doc-Edit/web/nuxt.config.ts
Suphonchai Phoonsawat 4f54af4e24 v9.2.1: re-enable ms-word on all platforms + real filenames in URLs
User clarified: with the new open-link URLs (https + no query string +
ending .docx), pressing the button DID open the file in Word 16.101+
on their Mac — only the OLD URL forms (http, query strings) were
ignored. The previous disable-on-Mac was based on terminal tests that
hit the old forms / cold-start races, so it removed working behavior.

- useVersionOpen: fireWordScheme = openInWord !== 'off' (default ''
  and 'on' fire on ALL platforms; only explicit 'off' is download-only)
- Notice updated: "กำลังเปิดไฟล์ใน Word ให้อัตโนมัติ — หากไม่เปิด
  ไฟล์อยู่ที่โฟลเดอร์ Downloads แล้ว" (covers cold-start drop)
- Docs corrected with v9.2.1 header (old forms were the broken ones;
  new form confirmed working via real usage) + correction markers on
  the v9.2 test record + CLAUDE.md rule 13 rewritten
- web 60/60 + build; QA reviewer FAIL round 1 (5 doc/comment minors,
  all fixed) → PASS round 2

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-10 14:33:12 +07:00

61 lines
3.3 KiB
TypeScript

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
compatibilityDate: '2025-07-15',
devtools: { enabled: true },
// ⚠️ Web portal ต้องใช้ port 5173 เท่านั้น — ห้ามใช้ 3000
// (3000 ถูก add-in dev server ใช้อยู่: https://localhost:3000)
devServer: {
port: 5173,
},
modules: ['@nuxtjs/tailwindcss'],
// ต้องระบุ cssPath ชัด (alias ~/ ชี้ srcDir = app/) — default แบบ relative
// "assets/css/tailwind.css" จะ resolve ต่อ rootDir แล้ว fallback ไปไฟล์ default
// ของ tailwindcss package แบบเงียบๆ (token/component classes ทั้งหมดหายจาก build)
tailwindcss: {
cssPath: '~/assets/css/tailwind.css',
},
// config ทั้งหมดแยกเป็น env ได้ (กติกา: ห้าม hardcode) — override ด้วย env
// NUXT_PUBLIC_API_BASE_URL / NUXT_PUBLIC_KEYCLOAK_AUTHORITY / NUXT_PUBLIC_KEYCLOAK_CLIENT_ID
runtimeConfig: {
public: {
// เว็บเป็น top-level http page → เรียก backend ด้วย http ได้ (ไม่มีปัญหา mixed content แบบ task pane)
apiBaseUrl: 'http://localhost:5075',
// Keycloak dev ใช้ https:8443 (cert ของ office-addin-dev-certs — เชื่อถือได้ในเครื่อง)
keycloakAuthority: 'https://localhost:8443/realms/word-versioning',
keycloakClientId: 'word-versioning-web',
// ยิง ms-word:ofe ควบคู่กับการดาวน์โหลดหรือไม่ — '' / 'on' = ยิงทุกแพลตฟอร์ม (open-link แบบใหม่ https+ไม่มี query+จบ .docx
// ยืนยันแล้วว่าเปิดได้จริงแม้ Word 16.101+ บน Mac — v9.2.1), 'off' = ดาวน์โหลดอย่างเดียว
openInWord: '',
},
},
// ~/assets/css/tailwind.css ถูก @nuxtjs/tailwindcss pick up อัตโนมัติ
app: {
head: {
title: 'Word Versioning',
htmlAttrs: { lang: 'th' },
// ฟอนต์ไทย: Sarabun (ใกล้ Sukhumvit ที่สุดบน Google Fonts) — ต้องมี 500/600 ด้วย
// เพราะ UI ใช้ font-medium/font-semibold หนัก (โหลดแค่ 400/700 จะเกิด faux-bold)
link: [
{ rel: 'preconnect', href: 'https://fonts.googleapis.com' },
{ rel: 'preconnect', href: 'https://fonts.gstatic.com', crossorigin: '' },
{
rel: 'stylesheet',
href: 'https://fonts.googleapis.com/css2?family=Sarabun:wght@400;500;600;700&display=swap',
},
],
// กัน dark-mode flash (FOUC) ก่อน Vue hydrate — ต้องใช้คีย์/ค่าเดียวกับ useTheme.ts
script: [
{
innerHTML:
"(function(){try{var t=localStorage.getItem('theme-preference');if(!t){t=window.matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light';}if(t==='dark'){document.documentElement.classList.add('dark');}}catch(e){}})();",
},
],
},
},
})