Skip to content

⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.

feat(web): add H1 and H2 buttons to the description editor menu (#143)

Croff58d304c52d97
diff --git a/apps/web/src/features/issue/components/detail/IssueDetailContent.tsx b/apps/web/src/features/issue/components/detail/IssueDetailContent.tsx
index 9e46c0fb..a9534fbd 100644
--- a/apps/web/src/features/issue/components/detail/IssueDetailContent.tsx
+++ b/apps/web/src/features/issue/components/detail/IssueDetailContent.tsx
@@ -108,7 +108,7 @@ export default function IssueDetailContent({
inviting an edit that cannot happen. */}
{(canEdit || issue.description.trim() !== '') && (
<IssueMarkdownEditor
- className="mt-2"
+ className="mt-4"
placeholder={tEditor('descriptionPlaceholder')}
defaultValue={issue.description}
key={`desc-${issue.updatedAt}-${replacements}`}
diff --git a/apps/web/src/features/issue/components/detail/ReadOnlyIssueDetail.tsx b/apps/web/src/features/issue/components/detail/ReadOnlyIssueDetail.tsx
index 9545a5d3..cfeaa9de 100644
--- a/apps/web/src/features/issue/components/detail/ReadOnlyIssueDetail.tsx
+++ b/apps/web/src/features/issue/components/detail/ReadOnlyIssueDetail.tsx
@@ -55,7 +55,7 @@ export default function ReadOnlyIssueDetail({
<h1 className="mt-1 text-lg font-semibold">{issue.title}</h1>
{issue.description.trim() && (
- <IssueMarkdownEditor className="mt-2" defaultValue={issue.description} editable={false} />
+ <IssueMarkdownEditor className="mt-4" defaultValue={issue.description} editable={false} />
)}
{fieldDefs
diff --git a/apps/web/src/features/issue/components/editor/EditorSelectionMenu.tsx b/apps/web/src/features/issue/components/editor/EditorSelectionMenu.tsx
index 1b5fb10c..58fff56a 100644
--- a/apps/web/src/features/issue/components/editor/EditorSelectionMenu.tsx
+++ b/apps/web/src/features/issue/components/editor/EditorSelectionMenu.tsx
@@ -3,6 +3,8 @@ import { BubbleMenu } from '@tiptap/react/menus';
import {
Bold,
Code,
+ Heading1,
+ Heading2,
Italic,
Link as LinkIcon,
List,
@@ -22,12 +24,25 @@ function setLink(editor: Editor, prompt: string) {
else editor.chain().focus().setLink({ href: url }).run();
}
-// `name` is the mark or node the button toggles, which is also what lights it up.
+// `name` plus `attrs` is the mark or node the button toggles, which is also what lights it up.
const ITEMS: {
name: string;
+ attrs?: { level: 1 | 2 };
icon: LucideIcon;
run: (editor: Editor, linkPrompt: string) => void;
}[] = [
+ {
+ name: 'heading',
+ attrs: { level: 1 },
+ icon: Heading1,
+ run: (editor) => editor.chain().focus().toggleHeading({ level: 1 }).run(),
+ },
+ {
+ name: 'heading',
+ attrs: { level: 2 },
+ icon: Heading2,
+ run: (editor) => editor.chain().focus().toggleHeading({ level: 2 }).run(),
+ },
{ name: 'bold', icon: Bold, run: (editor) => editor.chain().focus().toggleBold().run() },
{ name: 'italic', icon: Italic, run: (editor) => editor.chain().focus().toggleItalic().run() },
{
@@ -69,8 +84,8 @@ export default function EditorSelectionMenu({ editor }: { editor: Editor }) {
>
{ITEMS.map((item) => (
<EditorToolbarButton
- key={item.name}
- active={editor.isActive(item.name)}
+ key={`${item.name}${item.attrs?.level ?? ''}`}
+ active={editor.isActive(item.name, item.attrs)}
onClick={() => item.run(editor, t('linkUrl'))}
>
<item.icon />