// คลาสของเนื้อหาใน editor — ไม่พึ่ง @tailwindcss/typography (`prose`) แอปไม่ต้องติดตั้ง plugin export const theme = { ltr: "ltr", rtl: "rtl", placeholder: "editor-placeholder", paragraph: "mb-2", quote: "border-l-4 border-border pl-4 italic text-muted-foreground", heading: { h1: "text-3xl font-bold mb-4", h2: "text-2xl font-bold mb-3", h3: "text-xl font-bold mb-2", h4: "text-lg font-bold mb-1", }, list: { nested: { listitem: "editor-nested-li list-none p-0 m-0", }, ol: "editor-ol list-decimal ps-6 mb-2", ul: "editor-ul list-disc ps-6 mb-2", listitem: "editor-li mb-1", }, link: "text-primary underline underline-offset-2 cursor-pointer", text: { bold: "font-bold", italic: "italic", underline: "underline", strikethrough: "line-through", }, hr: "my-4 border-border", table: "lexical-table border-collapse border border-border w-full my-4", tableRow: "border-b border-border", tableCell: "lexical-table-cell border border-border px-2 py-1 min-w-12 align-middle text-left overflow-hidden", tableCellSelected: "lexical-table-cell-selected", tableSelection: "lexical-table-selection", tableCellHeader: "lexical-table-cell bg-muted font-bold border border-border px-2 py-1 min-w-12 align-middle text-left text-muted-foreground overflow-hidden", }; // สีจาก token ของธีม (สลับ dark ให้เอง) — ไม่ใช้ค่า rgba คงที่ export const customStyles = ` .editor-ol { counter-reset: editor-list-counter; } .editor-ol > .editor-li:not(.editor-nested-li) { counter-increment: editor-list-counter; } .editor-ol > .editor-li:not(.editor-nested-li)::marker { content: counters(editor-list-counter, ".") ". "; } .lexical-variable { background-color: color-mix(in oklab, var(--primary) 12%, transparent); border-radius: 4px; padding: 0 4px; cursor: pointer; box-decoration-break: clone; } .lexical-table { table-layout: fixed; width: 100%; max-width: 100%; } .lexical-table-cell { position: relative; word-break: break-word; white-space: normal; } .lexical-table-selection { user-select: none; } .lexical-table-cell-selected { /* !important: ทับสีพื้นช่องที่ตั้งเป็น style ในตัว (setBackgroundColor) */ background-color: color-mix(in oklab, var(--primary) 20%, transparent) !important; outline: 2px solid var(--ring); outline-offset: -2px; } .lexical-table-cell > p { margin-top: 0; margin-bottom: 0; } .lexical-table-cell > p:not(:last-child) { margin-bottom: 0.5rem; } `;