mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-05 21:39:54 +02:00
* feat(editor): support markdown checkbox task lists (#3593) Render `- [ ]` / `- [x]` as interactive checkboxes in the issue content editor, matching GitHub / Notion. - Register TaskList + a patched TaskItem in the shared extension factory. Both ship their own markdown tokenizer / renderMarkdown, input rules, and a checkbox NodeView; the taskList tokenizer is consulted before marked's built-in list tokenizer, so `- [ ]` becomes a task while a plain `- ` still falls through to the bullet list. - Patch TaskItem's keymap to share PatchedListItem's split -> lift Enter chain (double-Enter on an empty item exits the list); nested: true enables sub-tasks and nested round-trips. - Add a "Task list" entry to the bubble-menu list dropdown (+ i18n for en / zh-Hans / ja / ko). - Style task lists in prose.css for both the editor ([data-type="taskList"]) and the readonly remark-gfm output (.contains-task-list); completed items render muted. Readonly already rendered task lists via remark-gfm; this brings the editable view to parity. Adds markdown round-trip and readonly checked-state tests. MUL-2926 Co-authored-by: multica-agent <github@multica.ai> * fix(editor): keep readonly nested task lists block-laid-out (#3593) The shared `display: flex` rule on task-list items broke nested task lists in the readonly view. remark-gfm renders a task item as `<li><input> text <ul>…</ul></li>` — no body wrapper — so a nested list is a direct sibling of the checkbox and text, and flex pulled it onto the same row. The editor's Tiptap NodeView wraps the body in a `<div>`, so it was unaffected. Split the task-list CSS into separate editor and readonly blocks: the editor keeps the flex row; readonly stays a block list item with an inline checkbox so a nested `<ul>` drops below and indents under its parent. Adds a readonly test that pins the nested DOM shape (nested `<ul>` inside the parent `<li>`), so a future remark-gfm change that wraps the body fails loudly. MUL-2926 Co-authored-by: multica-agent <github@multica.ai> * feat(editor): convert `- [ ] ` typing into a task list (#3593) TaskItem's built-in input rule only converts `[ ] ` / `[x] ` typed at the start of a plain paragraph. When the user types the GitHub-style `- [ ] ` the leading `- ` first turns the line into a bullet, and the built-in rule no longer fires — so `[ ]` stayed as literal text and nothing became a checkbox. Add an input rule on PatchedTaskItem that catches the checkbox token when it is the entire content of a freshly-typed list item (bullet or ordered) and converts just that item into a task item (deleteRange → liftListItem → toggleList). The anchored regex means it only fires on an item whose whole content is `[ ] ` / `[x] `, so sibling items in the same list are left untouched. Adds typing-level tests (real input-rule simulation) covering `[ ] `, `[x] `, `- [ ] `, `- [x] `, the mixed-list split case, and the plain-bullet no-op. MUL-2926 Co-authored-by: multica-agent <github@multica.ai> --------- Co-authored-by: J <j@multica.ai> Co-authored-by: multica-agent <github@multica.ai>
403 lines
9.7 KiB
CSS
403 lines
9.7 KiB
CSS
/*
|
|
* Rich text prose typography.
|
|
*
|
|
* Design tier: "Compact" (same tier as Linear, Slack). Optimized for
|
|
* short-form content (issue descriptions, comments) that users scan, not
|
|
* long-form reading.
|
|
*
|
|
* Typography values benchmarked against (April 2026):
|
|
* - github-markdown-css (GitHub's markdown renderer)
|
|
* - @tailwindcss/typography prose-sm preset
|
|
* - Linear's editor (Tiptap-based, 14px body)
|
|
*
|
|
* Key decisions:
|
|
* Body: 14px (text-sm), line-height 1.625 (between GitHub 1.5 and Tailwind 1.714)
|
|
* Headings: h1=22px (1.57x), h2=18px (1.29x), h3=15px (1.07x) — compact but
|
|
* with clear hierarchy. Previous h3 was 14px (same as body = no differentiation).
|
|
* Paragraph spacing: 10px (was 8px; GitHub uses 10px, Tailwind prose-sm uses 16px)
|
|
* List indent: 20px for ul (was 16px; standard is 22-32px)
|
|
* Code block margin: 12px (was 8px; gives breathing room between code and prose)
|
|
* Blockquote border: 3px (was 2px; GitHub/Tailwind both use 4px)
|
|
* Links: var(--brand) blue with 40% opacity underline (was var(--primary) near-black)
|
|
*
|
|
* Inline elements (mention cards, inline code) that exceed line-height:
|
|
* The browser auto-expands the line box for lines containing taller inline
|
|
* elements. Controlled via vertical-align on [data-node-view-wrapper] and
|
|
* box-decoration-break: clone on inline code.
|
|
*/
|
|
|
|
/* Headings — compact but with clear visual hierarchy */
|
|
.rich-text-editor h1 {
|
|
font-size: 1.375rem;
|
|
font-weight: 700;
|
|
margin-top: 1.5rem;
|
|
margin-bottom: 0.5rem;
|
|
line-height: 1.3;
|
|
letter-spacing: -0.01em;
|
|
}
|
|
|
|
.rich-text-editor h2 {
|
|
font-size: 1.125rem;
|
|
font-weight: 600;
|
|
margin-top: 1.5rem;
|
|
margin-bottom: 0.5rem;
|
|
line-height: 1.35;
|
|
}
|
|
|
|
.rich-text-editor h3 {
|
|
font-size: 0.9375rem;
|
|
font-weight: 600;
|
|
margin-top: 1rem;
|
|
margin-bottom: 0.5rem;
|
|
line-height: 1.4;
|
|
}
|
|
|
|
/* Paragraphs */
|
|
.rich-text-editor p {
|
|
margin-top: 0.625rem;
|
|
margin-bottom: 0.625rem;
|
|
line-height: 1.625;
|
|
}
|
|
|
|
/* First child should not have top margin */
|
|
.rich-text-editor > *:first-child {
|
|
margin-top: 0;
|
|
}
|
|
|
|
/* Last child should not have bottom margin */
|
|
.rich-text-editor > *:last-child {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
/* Lists */
|
|
.rich-text-editor ul {
|
|
list-style-type: disc;
|
|
padding-inline-start: 1.25rem;
|
|
padding-inline-end: 0.5rem;
|
|
margin: 0.5rem 0;
|
|
}
|
|
|
|
.rich-text-editor ol {
|
|
list-style-type: decimal;
|
|
padding-inline-start: 1.5rem;
|
|
margin: 0.5rem 0;
|
|
}
|
|
|
|
.rich-text-editor li {
|
|
margin: 0.25rem 0;
|
|
line-height: 1.625;
|
|
}
|
|
|
|
.rich-text-editor li + li {
|
|
margin-top: 0.25rem;
|
|
}
|
|
|
|
.rich-text-editor li::marker {
|
|
color: var(--muted-foreground);
|
|
}
|
|
|
|
/* Remove paragraph margins inside list items (Tiptap wraps li content in <p>) */
|
|
.rich-text-editor li > p {
|
|
margin: 0;
|
|
}
|
|
|
|
.rich-text-editor li > p + p {
|
|
margin-top: 0.25rem;
|
|
}
|
|
|
|
.rich-text-editor .math-node {
|
|
display: inline-flex;
|
|
max-width: 100%;
|
|
vertical-align: middle;
|
|
}
|
|
|
|
.rich-text-editor .math-node.inline {
|
|
align-items: center;
|
|
}
|
|
|
|
.rich-text-editor .math-node.block {
|
|
display: block;
|
|
margin: 0.75rem 0;
|
|
overflow-x: auto;
|
|
overflow-y: hidden;
|
|
}
|
|
|
|
.rich-text-editor .math-node.block .katex-display {
|
|
margin: 0;
|
|
}
|
|
|
|
.rich-text-editor .math-node .katex {
|
|
max-width: 100%;
|
|
}
|
|
|
|
/* Nested lists — bullet style progression and tighter spacing */
|
|
.rich-text-editor ul ul {
|
|
list-style-type: circle;
|
|
margin: 0.25rem 0;
|
|
}
|
|
|
|
.rich-text-editor ul ul ul {
|
|
list-style-type: square;
|
|
}
|
|
|
|
.rich-text-editor ol ol {
|
|
list-style-type: lower-alpha;
|
|
margin: 0.25rem 0;
|
|
}
|
|
|
|
.rich-text-editor ol ol ol {
|
|
list-style-type: lower-roman;
|
|
}
|
|
|
|
/*
|
|
* Task lists (checkboxes) — `- [ ]` / `- [x]`.
|
|
*
|
|
* The editor and readonly views emit DIFFERENT DOM, so they are styled
|
|
* separately rather than sharing a flex rule:
|
|
*
|
|
* - Editor (Tiptap NodeView):
|
|
* ul[data-type="taskList"] > li[data-checked]
|
|
* > label(contenteditable) > input + span
|
|
* > div(content) > p, [nested ul]
|
|
* The item body is wrapped in a <div>, so the row is a flex layout and a
|
|
* nested task list inside that <div> still stacks below the text.
|
|
*
|
|
* - Readonly (remark-gfm):
|
|
* ul.contains-task-list > li.task-list-item
|
|
* > input[disabled] + text [ + nested ul ]
|
|
* There is NO body wrapper — a nested <ul> is a direct sibling of the
|
|
* checkbox and text. Flex here would pull the nested list onto the same
|
|
* row, so the item stays a block and the checkbox is positioned inline.
|
|
*/
|
|
|
|
/* Shared: checkbox appearance. */
|
|
.rich-text-editor input[type="checkbox"] {
|
|
width: 0.95rem;
|
|
height: 0.95rem;
|
|
accent-color: var(--brand);
|
|
cursor: pointer;
|
|
}
|
|
|
|
/* --- Editor (Tiptap) --- */
|
|
.rich-text-editor ul[data-type="taskList"] {
|
|
list-style: none;
|
|
padding-inline: 0;
|
|
margin: 0.5rem 0;
|
|
}
|
|
|
|
/* Child combinators keep these rules off nested plain bullet/ordered lists. */
|
|
.rich-text-editor ul[data-type="taskList"] > li {
|
|
display: flex;
|
|
align-items: flex-start;
|
|
gap: 0.5rem;
|
|
padding: 0;
|
|
}
|
|
|
|
/* Checkbox column. The top margin nudges the box onto the first text line
|
|
(line-height 1.625). */
|
|
.rich-text-editor ul[data-type="taskList"] > li > label {
|
|
flex: 0 0 auto;
|
|
margin: 0.28rem 0 0;
|
|
user-select: none;
|
|
}
|
|
|
|
/* Content column fills the remaining width and may wrap/scroll. */
|
|
.rich-text-editor ul[data-type="taskList"] > li > div {
|
|
flex: 1 1 auto;
|
|
min-width: 0;
|
|
}
|
|
|
|
.rich-text-editor ul[data-type="taskList"] > li > div > p {
|
|
margin: 0;
|
|
}
|
|
|
|
/* Completed editor item: muted text (no strikethrough), matching Linear. The
|
|
NodeView keeps `data-checked` on the <li> (but not data-type). */
|
|
.rich-text-editor ul[data-type="taskList"] > li[data-checked="true"] > div {
|
|
color: var(--muted-foreground);
|
|
}
|
|
|
|
/* --- Readonly (remark-gfm) --- */
|
|
.rich-text-editor ul.contains-task-list {
|
|
list-style: none;
|
|
padding-inline: 0;
|
|
margin: 0.5rem 0;
|
|
}
|
|
|
|
.rich-text-editor li.task-list-item {
|
|
padding-inline: 0;
|
|
}
|
|
|
|
/* Inline checkbox on the first text line; a nested <ul> stays block and drops
|
|
below the item instead of sharing the row. */
|
|
.rich-text-editor li.task-list-item > input[type="checkbox"] {
|
|
margin: 0 0.5rem 0 0;
|
|
vertical-align: -0.1em;
|
|
}
|
|
|
|
/* Indent nested readonly task lists under their parent item. */
|
|
.rich-text-editor li.task-list-item .contains-task-list {
|
|
padding-inline-start: 1.45rem;
|
|
margin: 0.25rem 0;
|
|
}
|
|
|
|
/* Completed readonly item: muted text, matched via :has(input:checked). The
|
|
reset keeps a completed parent from bleeding its muted color into the
|
|
(independently evaluated) nested items below it. */
|
|
.rich-text-editor li.task-list-item:has(> input:checked) {
|
|
color: var(--muted-foreground);
|
|
}
|
|
|
|
.rich-text-editor li.task-list-item:has(> input:checked) .contains-task-list {
|
|
color: var(--foreground);
|
|
}
|
|
|
|
/* Tables */
|
|
.rich-text-editor .tableWrapper {
|
|
overflow-x: auto;
|
|
margin: 1rem 0;
|
|
border: 1px solid var(--border);
|
|
border-radius: var(--radius);
|
|
}
|
|
|
|
.rich-text-editor table {
|
|
min-width: 100%;
|
|
border-collapse: collapse;
|
|
}
|
|
|
|
.rich-text-editor colgroup {
|
|
display: none;
|
|
}
|
|
|
|
.rich-text-editor thead {
|
|
background: color-mix(in srgb, var(--muted) 50%, transparent);
|
|
}
|
|
|
|
.rich-text-editor tbody tr {
|
|
border-top: 1px solid var(--border);
|
|
}
|
|
|
|
.rich-text-editor tr:hover td {
|
|
background: color-mix(in srgb, var(--muted) 30%, transparent);
|
|
transition: background 0.15s;
|
|
}
|
|
|
|
.rich-text-editor th,
|
|
.rich-text-editor td {
|
|
text-align: left;
|
|
padding: 0.625rem 1rem;
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
.rich-text-editor th {
|
|
font-weight: 600;
|
|
}
|
|
|
|
/* Remove paragraph margin inside table cells */
|
|
.rich-text-editor th p,
|
|
.rich-text-editor td p {
|
|
margin: 0;
|
|
}
|
|
|
|
/* Blockquotes */
|
|
.rich-text-editor blockquote {
|
|
border-left: 3px solid color-mix(in srgb, var(--muted-foreground) 30%, transparent);
|
|
padding-left: 0.75rem;
|
|
margin: 0.625rem 0;
|
|
color: var(--muted-foreground);
|
|
font-style: italic;
|
|
}
|
|
|
|
.rich-text-editor blockquote p {
|
|
margin-top: 0.25rem;
|
|
margin-bottom: 0.25rem;
|
|
}
|
|
|
|
.rich-text-editor blockquote > *:first-child {
|
|
margin-top: 0;
|
|
}
|
|
|
|
.rich-text-editor blockquote > *:last-child {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.rich-text-editor blockquote blockquote {
|
|
margin-top: 0.25rem;
|
|
margin-bottom: 0.25rem;
|
|
border-left-color: color-mix(in srgb, var(--muted-foreground) 15%, transparent);
|
|
}
|
|
|
|
/* Horizontal rules */
|
|
.rich-text-editor hr {
|
|
border: none;
|
|
border-top: 1px solid var(--border);
|
|
margin: 1rem 0;
|
|
}
|
|
|
|
/* Links */
|
|
.rich-text-editor a {
|
|
color: var(--brand);
|
|
text-decoration: underline;
|
|
text-decoration-color: color-mix(in srgb, var(--brand) 40%, transparent);
|
|
text-underline-offset: 2px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.rich-text-editor a:hover {
|
|
text-decoration-color: var(--brand);
|
|
}
|
|
|
|
/* Issue mention cards — inline cards that sit within text flow */
|
|
.rich-text-editor a.issue-mention {
|
|
color: inherit;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.rich-text-editor a.issue-mention:hover {
|
|
text-decoration: none;
|
|
}
|
|
|
|
/* Mentions */
|
|
.rich-text-editor .mention {
|
|
color: var(--primary);
|
|
font-weight: 600;
|
|
text-decoration: none;
|
|
margin: 0 0.125rem;
|
|
}
|
|
|
|
/* Slash command pills */
|
|
.rich-text-editor .slash-command {
|
|
color: var(--primary);
|
|
font-weight: 600;
|
|
text-decoration: none;
|
|
margin: 0 0.125rem;
|
|
}
|
|
|
|
/* Strong / emphasis */
|
|
.rich-text-editor strong {
|
|
font-weight: 600;
|
|
}
|
|
|
|
.rich-text-editor em {
|
|
font-style: italic;
|
|
}
|
|
|
|
.rich-text-editor s,
|
|
.rich-text-editor del {
|
|
text-decoration: line-through;
|
|
color: var(--muted-foreground);
|
|
}
|
|
|
|
/* Text highlight (`==text==` → <mark>). Single yellow tint that stays legible
|
|
in both light and dark themes; `color: inherit` keeps the underlying text
|
|
color so highlighted links/code remain readable. box-decoration-break clones
|
|
the background across wrapped lines (same approach as inline code above). */
|
|
.rich-text-editor mark {
|
|
background-color: color-mix(in srgb, #facc15 45%, transparent);
|
|
color: inherit;
|
|
border-radius: 0.2em;
|
|
padding: 0 0.15em;
|
|
box-decoration-break: clone;
|
|
-webkit-box-decoration-break: clone;
|
|
}
|