memos/web/src/index.css
boojack 00225db922 refactor(web): share markdown element styles between viewer and editor
Extract the Tailwind classes for common markdown elements (paragraph,
blockquote, lists, inline code, link, hr, headings) into a single
markdownStyles.ts consumed by both the read-only MemoContent components
and the WYSIWYG editor, replacing the duplicated per-element strings and
the .memo-wysiwyg CSS block. Heading classes are precomputed per level so
the hot renderHTML path is a lookup, not a cn() merge.

Also require at least one character after `#` before opening the tag
suggestion menu so a bare `#` (or `# ` heading) no longer conflicts with
markdown headings.
2026-06-13 22:17:00 +08:00

79 lines
1.8 KiB
CSS

@import "tailwindcss";
@import "tw-animate-css";
@import "./themes/default.css";
@layer base {
* {
@apply border-border outline-none ring-0;
scrollbar-color: color-mix(in oklch, var(--muted-foreground) 55%, transparent) transparent;
scrollbar-width: thin;
}
*::-webkit-scrollbar {
width: 8px;
height: 8px;
}
*::-webkit-scrollbar-track {
background: transparent;
}
*::-webkit-scrollbar-thumb {
background-color: color-mix(in oklch, var(--muted-foreground) 45%, transparent);
border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover {
background-color: color-mix(in oklch, var(--muted-foreground) 65%, transparent);
}
body {
@apply bg-background text-foreground;
}
}
/* Tiptap WYSIWYG memo editor */
.memo-wysiwyg p.is-editor-empty:first-child::before {
content: attr(data-placeholder);
float: left;
height: 0;
opacity: 0.7;
pointer-events: none;
}
/* Editor-only element styles: task lists and code blocks have no shared markup
with the read-only memo view (MemoContent renders those via TaskListItem.tsx
and CodeBlock.tsx), so unlike the elements in markdownStyles.ts they stay
local to the editor here rather than in the shared style token. */
.memo-wysiwyg ul[data-type="taskList"] {
list-style: none;
padding-left: 0;
}
.memo-wysiwyg ul[data-type="taskList"] li {
display: flex;
gap: 0.5rem;
}
.memo-wysiwyg ul[data-type="taskList"] li > label {
flex: 0 0 auto;
user-select: none;
}
.memo-wysiwyg ul[data-type="taskList"] li > div {
flex: 1 1 auto;
}
.memo-wysiwyg pre {
background: var(--muted);
border-radius: 0.375rem;
padding: 0.5rem 0.75rem;
font-family: var(--font-mono, monospace);
font-size: 0.875rem;
white-space: pre-wrap;
}
.memo-wysiwyg pre code {
background: transparent;
padding: 0;
}