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.

refactor: share the editor and attachment parts between issues and initiatives (#327)

Croffb862e7f4defb
diff --git a/apps/api/src/modules/attachments/index.ts b/apps/api/src/modules/attachments/index.ts
index ab95b7cb..a464dcf6 100644
--- a/apps/api/src/modules/attachments/index.ts
+++ b/apps/api/src/modules/attachments/index.ts
@@ -3,7 +3,6 @@ import { noContent } from '#shared/http';
import { authContext } from '#shared/auth-context';
import { entityGuard } from '#shared/guards';
import { HttpError } from '#shared/lib';
-import { getObject } from '#shared/s3';
import { pinnedFetch } from '#shared/net';
import { mcpTool } from '#mcp/generate';
import { accessErrors, commonErrors, errors } from '#shared/responses';
@@ -29,9 +28,8 @@ import {
} from './service';
import {
assertAttachmentUploadAllowed,
- attachmentEtag,
attachmentObjectKey,
- attachmentResponseHeaders,
+ attachmentObjectResponse,
deleteAttachmentObject,
safeAttachmentFilename,
storeAttachmentObject,
@@ -291,38 +289,13 @@ export const attachmentRoutes = new Elysia({
async ({ params, query, request }) => {
const row = await getAttachmentByPublicId(params.publicId);
if (!row) throw new HttpError(404, 'Attachment not found');
-
- // The bytes behind a publicId can be replaced, so the response is
- // revalidated instead of cached for good. Every write stores the file
- // under a key with a fresh uuid, so a digest of the key changes with the
- // bytes. It is the digest, not the key, because this route is public and
- // the key carries the project id, the issue id and the stored filename.
- const etag = attachmentEtag(row.s3Key);
- if (request.headers.get('if-none-match') === etag) {
- return new Response(null, { status: 304, headers: { ETag: etag } });
- }
-
- let obj;
- try {
- obj = await getObject(row.s3Key);
- } catch (err) {
- throw new HttpError(404, err instanceof Error ? err.message : 'Object not found');
- }
-
- // The bytes and their content type are attacker-controlled, and this route
- // is public and same-origin as the planner UI, so serving an HTML or SVG
- // file inline would be stored XSS. Defenses: X-Content-Type-Options:nosniff
- // stops MIME sniffing, and inline rendering is allowed only for a strict
- // media allowlist (raster images, video, audio). Everything else — html,
- // svg, xml, scripts — is forced to download and cannot execute.
- const headers = attachmentResponseHeaders({
- contentType: row.contentType || obj.contentType,
+ return attachmentObjectResponse({
+ s3Key: row.s3Key,
+ contentType: row.contentType,
filename: row.filename,
- contentLength: obj.contentLength,
- etag,
+ request,
download: query.download != null,
});
- return new Response(obj.body, { headers });
},
{
params: publicIdParams,
diff --git a/apps/api/src/modules/attachments/service.ts b/apps/api/src/modules/attachments/service.ts
index c2be2a53..7048c49c 100644
--- a/apps/api/src/modules/attachments/service.ts
+++ b/apps/api/src/modules/attachments/service.ts
@@ -1,7 +1,11 @@
import { db, issue, issueAttachment, issueFieldValue } from '@repo/db';
import { and, eq, sql } from 'drizzle-orm';
import { iso, num } from '#shared/lib';
-import { assertAttachmentStorageCapacity, lockAttachmentStorage } from './storage';
+import {
+ assertAttachmentStorageCapacity,
+ lockAttachmentStorage,
+ stripAttachmentEmbeds,
+} from './storage';
// Data access for issue attachments. File bytes live in the S3-compatible object
// store (#shared/s3); these rows hold the metadata and the object key. publicId is
@@ -129,20 +133,6 @@ export async function deleteAttachmentByPublicId(publicId: string): Promise<Atta
return rows[0] ? mapAttachment(rows[0]) : null;
}
-// An embed of a deleted attachment left in markdown would 404 once the object is
-// gone. Strip any construct whose URL carries this attachment's publicId: a
-// markdown image/link, or an inline <img>/<video>. The publicId is a uuid, so a
-// URL substring match is specific to this one attachment.
-function stripEmbeds(text: string, publicId: string): string {
- const id = publicId.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
- return text
- .replace(new RegExp(`!?\\[[^\\]]*\\]\\([^)]*${id}[^)]*\\)`, 'g'), '')
- .replace(new RegExp(`<img\\b[^>]*${id}[^>]*>`, 'g'), '')
- .replace(new RegExp(`<video\\b[^>]*${id}[^>]*>(?:\\s*</video>)?`, 'g'), '')
- .replace(/\n{3,}/g, '\n\n')
- .trim();
-}
-
// Remove embeds of one attachment from the issue description and its markdown
// custom field values. Called on delete so a removed attachment leaves no broken
// image behind.
@@ -154,7 +144,7 @@ export async function removeAttachmentEmbeds(issueId: number, publicId: string):
.from(issue)
.where(eq(issue.id, issueId));
if (row) {
- const next = stripEmbeds(row.description, publicId);
+ const next = stripAttachmentEmbeds(row.description, publicId);
if (next !== row.description) {
await db.update(issue).set({ description: next }).where(eq(issue.id, issueId));
changed = true;
@@ -167,7 +157,7 @@ export async function removeAttachmentEmbeds(issueId: number, publicId: string):
.where(eq(issueFieldValue.issueId, issueId));
for (const v of values) {
if (v.valueText == null) continue;
- const next = stripEmbeds(v.valueText, publicId);
+ const next = stripAttachmentEmbeds(v.valueText, publicId);
if (next !== v.valueText) {
await db.update(issueFieldValue).set({ valueText: next }).where(eq(issueFieldValue.id, v.id));
changed = true;
diff --git a/apps/api/src/modules/attachments/storage.ts b/apps/api/src/modules/attachments/storage.ts
index 96ac70e5..48e4dc8b 100644
--- a/apps/api/src/modules/attachments/storage.ts
+++ b/apps/api/src/modules/attachments/storage.ts
@@ -228,3 +228,56 @@ export function attachmentResponseHeaders(input: {
if (!inline) headers['Content-Security-Policy'] = "default-src 'none'; sandbox";
return headers;
}
+
+// An embed of a deleted attachment left in markdown would 404 once the object is
+// gone. Strip any construct whose URL carries this attachment's publicId: a
+// markdown image/link, or an inline <img>/<video>. The publicId is a uuid, so a
+// URL substring match is specific to this one attachment.
+export function stripAttachmentEmbeds(text: string, publicId: string): string {
+ const id = publicId.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
+ return text
+ .replace(new RegExp(`!?\\[[^\\]]*\\]\\([^)]*${id}[^)]*\\)`, 'g'), '')
+ .replace(new RegExp(`<img\\b[^>]*${id}[^>]*>`, 'g'), '')
+ .replace(new RegExp(`<video\\b[^>]*${id}[^>]*>(?:\\s*</video>)?`, 'g'), '')
+ .replace(/\n{3,}/g, '\n\n')
+ .trim();
+}
+
+// The body of a public raw-download route. The bytes behind a publicId can be
+// replaced, so the response is revalidated instead of cached for good: every write
+// stores the file under a key with a fresh uuid, so a digest of the key changes
+// with the bytes. It is the digest, not the key, because these routes are public
+// and the key carries the project id, the owner id and the stored filename.
+//
+// The bytes and their content type are attacker-controlled, and the routes are
+// public and same-origin as the planner UI, so serving an HTML or SVG file inline
+// would be stored XSS. attachmentResponseHeaders is what keeps them inert.
+export async function attachmentObjectResponse(input: {
+ s3Key: string;
+ contentType: string;
+ filename: string;
+ request: Request;
+ download: boolean;
+}): Promise<Response> {
+ const etag = attachmentEtag(input.s3Key);
+ if (input.request.headers.get('if-none-match') === etag) {
+ return new Response(null, { status: 304, headers: { ETag: etag } });
+ }
+
+ let obj;
+ try {
+ obj = await getObject(input.s3Key);
+ } catch (err) {
+ throw new HttpError(404, err instanceof Error ? err.message : 'Object not found');
+ }
+
+ return new Response(obj.body, {
+ headers: attachmentResponseHeaders({
+ contentType: input.contentType || obj.contentType,
+ filename: input.filename,
+ contentLength: obj.contentLength,
+ etag,
+ download: input.download,
+ }),
+ });
+}
diff --git a/apps/api/src/modules/documents/index.ts b/apps/api/src/modules/documents/index.ts
index eca0f5dd..3ed860a0 100644
--- a/apps/api/src/modules/documents/index.ts
+++ b/apps/api/src/modules/documents/index.ts
@@ -4,16 +4,14 @@ import { assertPermission, requireUser } from '#shared/access';
import { guards } from '#shared/guards';
import { noContent } from '#shared/http';
import { HttpError } from '#shared/lib';
-import { getObject } from '#shared/s3';
import { mcpTool } from '#mcp/generate';
import { commonErrors, errors } from '#shared/responses';
import { getMembership } from '#modules/members/service';
import { rawAttachmentQuery } from '#modules/attachments/model';
import {
assertAttachmentUploadAllowed,
- attachmentEtag,
attachmentObjectKey,
- attachmentResponseHeaders,
+ attachmentObjectResponse,
deleteAttachmentObject,
safeAttachmentFilename,
storeAttachmentObject,
@@ -308,24 +306,12 @@ export const documentRoutes = new Elysia({
requireUser(user).id,
);
if (!asset) throw new HttpError(404, 'Asset not found');
- const etag = attachmentEtag(asset.s3Key);
- if (request.headers.get('if-none-match') === etag) {
- return new Response(null, { status: 304, headers: { ETag: etag } });
- }
- let object;
- try {
- object = await getObject(asset.s3Key);
- } catch (error) {
- throw new HttpError(404, error instanceof Error ? error.message : 'Asset not found');
- }
- return new Response(object.body, {
- headers: attachmentResponseHeaders({
- contentType: asset.contentType || object.contentType,
- filename: asset.filename,
- contentLength: object.contentLength,
- etag,
- download: query.download != null,
- }),
+ return attachmentObjectResponse({
+ s3Key: asset.s3Key,
+ contentType: asset.contentType,
+ filename: asset.filename,
+ request,
+ download: query.download != null,
});
},
{
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.md
index e0ecc5e5..a0201b43 100644
--- a/apps/web/AGENTS.md
+++ b/apps/web/AGENTS.md
@@ -46,9 +46,9 @@ Next.js App Router, SSR (not SPA). Tailwind v4 + shadcn/ui. See root `AGENTS.md`
packages (`api.ts`, `auth-client.ts`, `markdown.ts`, `dnd.ts`) plus shadcn's `utils.ts` (`cn`,
fixed by `components.json`); `src/utils` holds own helpers and constants with no external
package behind them. `src/context` holds shared React contexts and their `use*` readers.
-- `components/common` groups by purpose: `agent-chat/`, `editor/`, `fields/`, `inputs/`, `page/`,
- `overlay/`, `permissions/`, `hotkeys/`, `skeleton/`. A component that fits none of them stays at the
- `common/` root.
+- `components/common` groups by purpose: `agent-chat/`, `attachments/`, `chart/`, `editor/`,
+ `fields/`, `hotkeys/`, `inputs/`, `overlay/`, `page/`, `permissions/`, `share/`, `skeleton/`,
+ `timeline/`. A component that fits none of them stays at the `common/` root.
Imports of a sibling in the same folder are relative; everything else uses `@/`.
- Component files use the feature name as a PascalCase prefix, file name = exported name. Service
files carry a `.service.ts` suffix (`passkeys.service.ts`). Other non-component files use plain
diff --git a/apps/web/messages/ar/common.json b/apps/web/messages/ar/common.json
index 79818717..92a3e512 100644
--- a/apps/web/messages/ar/common.json
+++ b/apps/web/messages/ar/common.json
@@ -170,7 +170,11 @@
"tableDeleteRow": "حذف صف",
"tableAddColumn": "إضافة عمود",
"tableDeleteColumn": "حذف عمود",
- "tableDelete": "حذف الجدول"
+ "tableDelete": "حذف الجدول",
+ "insertImage": "إدراج صورة",
+ "insertNamed": "إدراج {name}",
+ "noImages": "مفيش صور مرفقة لسه. ارفع صورة من لوحة المرفقات، أو ارميها على المحرر على طول.",
+ "image": "صورة"
},
"chart": {
"download": "احفظ الرسم البياني",
diff --git a/apps/web/messages/ar/issue.json b/apps/web/messages/ar/issue.json
index ed2bbdb9..5c0322fd 100644
--- a/apps/web/messages/ar/issue.json
+++ b/apps/web/messages/ar/issue.json
@@ -239,11 +239,7 @@
"endTime": "وقت الانتهاء"
},
"editor": {
- "insertImage": "إدراج صورة",
- "insertNamed": "إدراج {name}",
- "descriptionPlaceholder": "إضافة وصف…",
- "noImages": "مفيش صور مرفقة لسه. ارفع صورة من لوحة المرفقات، أو ارميها على المحرر على طول.",
- "image": "صورة"
+ "descriptionPlaceholder": "إضافة وصف…"
},
"cycleSelect": {
"label": "الدورة",
diff --git a/apps/web/messages/en/common.json b/apps/web/messages/en/common.json
index b372142c..18e2c54b 100644
--- a/apps/web/messages/en/common.json
+++ b/apps/web/messages/en/common.json
@@ -170,7 +170,11 @@
"tableDeleteRow": "Delete row",
"tableAddColumn": "Add column",
"tableDeleteColumn": "Delete column",
- "tableDelete": "Delete table"
+ "tableDelete": "Delete table",
+ "insertImage": "Insert image",
+ "insertNamed": "Insert {name}",
+ "noImages": "No images attached yet. Upload one from the Attachments panel, or drop it straight onto the editor.",
+ "image": "Image"
},
"chart": {
"download": "Save chart",
diff --git a/apps/web/messages/en/issue.json b/apps/web/messages/en/issue.json
index f480dca0..26dfdee3 100644
--- a/apps/web/messages/en/issue.json
+++ b/apps/web/messages/en/issue.json
@@ -239,11 +239,7 @@
"endTime": "End time"
},
"editor": {
- "insertImage": "Insert image",
- "insertNamed": "Insert {name}",
- "descriptionPlaceholder": "Add description…",
- "noImages": "No images attached yet. Upload one from the Attachments panel, or drop it straight onto the editor.",
- "image": "Image"
+ "descriptionPlaceholder": "Add description…"
},
"cycleSelect": {
"label": "Cycle",
diff --git a/apps/web/messages/fr/common.json b/apps/web/messages/fr/common.json
index 2f7894d0..2fabbd8d 100644
--- a/apps/web/messages/fr/common.json
+++ b/apps/web/messages/fr/common.json
@@ -170,7 +170,11 @@
"tableDeleteRow": "Supprimer la ligne",
"tableAddColumn": "Ajouter une colonne",
"tableDeleteColumn": "Supprimer la colonne",
- "tableDelete": "Supprimer le tableau"
+ "tableDelete": "Supprimer le tableau",
+ "insertImage": "Insérer une image",
+ "insertNamed": "Insérer {name}",
+ "noImages": "Aucune image jointe pour l'instant. Envoyez-en une depuis le panneau Pièces jointes, ou déposez-la directement dans l'éditeur.",
+ "image": "Image"
},
"chart": {
"download": "Enregistrer le graphique",
diff --git a/apps/web/messages/fr/issue.json b/apps/web/messages/fr/issue.json
index 30ef4458..b0f210a5 100644
--- a/apps/web/messages/fr/issue.json
+++ b/apps/web/messages/fr/issue.json
@@ -239,11 +239,7 @@
"endTime": "Heure de fin"
},
"editor": {
- "insertImage": "Insérer une image",
- "insertNamed": "Insérer {name}",
- "descriptionPlaceholder": "Ajouter une description…",
- "noImages": "Aucune image jointe pour l'instant. Envoyez-en une depuis le panneau Pièces jointes, ou déposez-la directement dans l'éditeur.",
- "image": "Image"
+ "descriptionPlaceholder": "Ajouter une description…"
},
"cycleSelect": {
"label": "Cycle",
diff --git a/apps/web/messages/ru/common.json b/apps/web/messages/ru/common.json
index 885158c7..d413988c 100644
--- a/apps/web/messages/ru/common.json
+++ b/apps/web/messages/ru/common.json
@@ -170,7 +170,11 @@
"tableDeleteRow": "Удалить строку",
"tableAddColumn": "Добавить столбец",
"tableDeleteColumn": "Удалить столбец",
- "tableDelete": "Удалить таблицу"
+ "tableDelete": "Удалить таблицу",
+ "insertImage": "Вставить изображение",
+ "insertNamed": "Вставить {name}",
+ "noImages": "Изображений пока нет. Загрузите из панели вложений или перетащите прямо в редактор.",
+ "image": "Изображение"
},
"chart": {
"download": "Сохранить график",
diff --git a/apps/web/messages/ru/issue.json b/apps/web/messages/ru/issue.json
index 80e80126..da9db753 100644
--- a/apps/web/messages/ru/issue.json
+++ b/apps/web/messages/ru/issue.json
@@ -239,11 +239,7 @@
"endTime": "Окончание"
},
"editor": {
- "insertImage": "Вставить изображение",
- "insertNamed": "Вставить {name}",
- "descriptionPlaceholder": "Добавьте описание…",
- "noImages": "Изображений пока нет. Загрузите из панели вложений или перетащите прямо в редактор.",
- "image": "Изображение"
+ "descriptionPlaceholder": "Добавьте описание…"
},
"cycleSelect": {
"label": "Цикл",
diff --git a/apps/web/messages/uk/common.json b/apps/web/messages/uk/common.json
index 5422a4dc..2b8d1b50 100644
--- a/apps/web/messages/uk/common.json
+++ b/apps/web/messages/uk/common.json
@@ -170,7 +170,11 @@
"tableDeleteRow": "Видалити рядок",
"tableAddColumn": "Додати стовпець",
"tableDeleteColumn": "Видалити стовпець",
- "tableDelete": "Видалити таблицю"
+ "tableDelete": "Видалити таблицю",
+ "insertImage": "Вставити зображення",
+ "insertNamed": "Вставити {name}",
+ "noImages": "Зображень ще немає. Завантажте з панелі вкладень або перетягніть просто в редактор.",
+ "image": "Зображення"
},
"chart": {
"download": "Зберегти графік",
diff --git a/apps/web/messages/uk/issue.json b/apps/web/messages/uk/issue.json
index b91eda09..17797bb5 100644
--- a/apps/web/messages/uk/issue.json
+++ b/apps/web/messages/uk/issue.json
@@ -239,11 +239,7 @@
"endTime": "Завершення"
},
"editor": {
- "insertImage": "Вставити зображення",
- "insertNamed": "Вставити {name}",
- "descriptionPlaceholder": "Додайте опис…",
- "noImages": "Зображень ще немає. Завантажте з панелі вкладень або перетягніть просто в редактор.",
- "image": "Зображення"
+ "descriptionPlaceholder": "Додайте опис…"
},
"cycleSelect": {
"label": "Цикл",
diff --git a/apps/web/messages/zh-CN/common.json b/apps/web/messages/zh-CN/common.json
index 31a092dc..b588b710 100644
--- a/apps/web/messages/zh-CN/common.json
+++ b/apps/web/messages/zh-CN/common.json
@@ -170,7 +170,11 @@
"tableDeleteRow": "删除行",
"tableAddColumn": "添加列",
"tableDeleteColumn": "删除列",
- "tableDelete": "删除表格"
+ "tableDelete": "删除表格",
+ "insertImage": "插入图片",
+ "insertNamed": "插入 {name}",
+ "noImages": "暂无已附加图片。请从附件面板上传,或直接拖入编辑器。",
+ "image": "图片"
},
"chart": {
"download": "保存图表",
diff --git a/apps/web/messages/zh-CN/issue.json b/apps/web/messages/zh-CN/issue.json
index 90ab529f..36ff6c71 100644
--- a/apps/web/messages/zh-CN/issue.json
+++ b/apps/web/messages/zh-CN/issue.json
@@ -239,11 +239,7 @@
"endTime": "结束时间"
},
"editor": {
- "insertImage": "插入图片",
- "insertNamed": "插入 {name}",
- "descriptionPlaceholder": "添加描述…",
- "noImages": "暂无已附加图片。请从附件面板上传,或直接拖入编辑器。",
- "image": "图片"
+ "descriptionPlaceholder": "添加描述…"
},
"cycleSelect": {
"label": "周期",
diff --git a/apps/web/src/features/issue/components/IssueAttachmentThumb.tsx b/apps/web/src/components/common/attachments/AttachmentThumb.tsx
similarity index 82%
rename from apps/web/src/features/issue/components/IssueAttachmentThumb.tsx
rename to apps/web/src/components/common/attachments/AttachmentThumb.tsx
index 7fa53f6e..4f577d3c 100644
--- a/apps/web/src/features/issue/components/IssueAttachmentThumb.tsx
+++ b/apps/web/src/components/common/attachments/AttachmentThumb.tsx
@@ -1,10 +1,10 @@
import Image from 'next/image';
import { FileIcon } from 'lucide-react';
-import { isImage, isVideo, type Embeddable } from '../utils/attachmentEmbed';
+import { isImage, isVideo, type Embeddable } from '@/components/common/editor/attachmentEmbed';
-// An attachment card's leading thumbnail: images and videos preview themselves,
+// An attachment's leading thumbnail: images and videos preview themselves,
// every other type falls back to a generic file glyph.
-export default function IssueAttachmentThumb({
+export default function AttachmentThumb({
attachment,
sizes = '40px',
}: {
diff --git a/apps/web/src/features/issue/components/detail/IssueAttachmentViewer.tsx b/apps/web/src/components/common/attachments/AttachmentViewer.tsx
similarity index 92%
rename from apps/web/src/features/issue/components/detail/IssueAttachmentViewer.tsx
rename to apps/web/src/components/common/attachments/AttachmentViewer.tsx
index ac7f9305..052c7246 100644
--- a/apps/web/src/features/issue/components/detail/IssueAttachmentViewer.tsx
+++ b/apps/web/src/components/common/attachments/AttachmentViewer.tsx
@@ -1,12 +1,12 @@
import { useState } from 'react';
import { type Attachment } from '@/lib/api';
-import { isImage } from '../../utils/attachmentEmbed';
+import { isImage } from '@/components/common/editor/attachmentEmbed';
import Modal from '@/components/common/overlay/Modal';
import { cn } from '@/lib/utils';
// Looks at an attachment without inserting it anywhere: the image at its own
// size, a video with its controls.
-export default function IssueAttachmentViewer({
+export default function AttachmentViewer({
attachment,
onClose,
}: {
diff --git a/apps/web/src/features/issue/components/editor/EditorImagePicker.tsx b/apps/web/src/components/common/editor/EditorImagePicker.tsx
similarity index 94%
rename from apps/web/src/features/issue/components/editor/EditorImagePicker.tsx
rename to apps/web/src/components/common/editor/EditorImagePicker.tsx
index 092b7db6..2346c868 100644
--- a/apps/web/src/features/issue/components/editor/EditorImagePicker.tsx
+++ b/apps/web/src/components/common/editor/EditorImagePicker.tsx
@@ -1,6 +1,6 @@
import Image from 'next/image';
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog';
-import { type Embeddable } from '../../utils/attachmentEmbed';
+import { type Embeddable } from '@/components/common/editor/attachmentEmbed';
import { useTranslations } from 'next-intl';
// Nothing here may take focus: blurring the editor saves the description, and the
@@ -17,7 +17,7 @@ export default function EditorImagePicker({
onClose: () => void;
onPick: (image: Embeddable) => void;
}) {
- const t = useTranslations('issue.editor');
+ const t = useTranslations('common.editor');
return (
<Dialog open={open} onOpenChange={(o) => !o && onClose()}>
<DialogContent
diff --git a/apps/web/src/features/issue/components/editor/IssueMarkdownEditor.test.ts b/apps/web/src/components/common/editor/MarkdownEditor.test.ts
similarity index 92%
rename from apps/web/src/features/issue/components/editor/IssueMarkdownEditor.test.ts
rename to apps/web/src/components/common/editor/MarkdownEditor.test.ts
index 1b2cda90..64ababca 100644
--- a/apps/web/src/features/issue/components/editor/IssueMarkdownEditor.test.ts
+++ b/apps/web/src/components/common/editor/MarkdownEditor.test.ts
@@ -5,8 +5,8 @@ import Link from '@tiptap/extension-link';
import StarterKit from '@tiptap/starter-kit';
import { Markdown } from 'tiptap-markdown';
import { JSDOM } from 'jsdom';
-import { issueEditorStarterKitOptions } from './IssueMarkdownEditor';
-import { openLinkOnModifierClick } from '../../utils/modifierClickLink';
+import { editorStarterKitOptions } from './MarkdownEditor';
+import { openLinkOnModifierClick } from './modifierClickLink';
let dom: JSDOM;
let originalGlobalDescriptors: Map<string, PropertyDescriptor | undefined>;
@@ -37,11 +37,11 @@ afterEach(() => {
}
});
-describe('IssueMarkdownEditor extensions', () => {
+describe('MarkdownEditor extensions', () => {
it('registers the configured link extension once', () => {
const editor = new Editor({
extensions: [
- StarterKit.configure(issueEditorStarterKitOptions),
+ StarterKit.configure(editorStarterKitOptions),
Link.configure({ openOnClick: false, autolink: true }),
],
content: '',
@@ -106,7 +106,7 @@ describe('IssueMarkdownEditor extensions', () => {
});
});
-describe('IssueMarkdownEditor markdown round trip', () => {
+describe('MarkdownEditor markdown round trip', () => {
// The editor reports a blur only when the document changed, because reading the
// markdown back does not return the stored text. This pins the reason: drop it and
// the guard becomes dead weight, keep it and removing the guard saves on every
@@ -114,7 +114,7 @@ describe('IssueMarkdownEditor markdown round trip', () => {
it('serialises a bare url back as an autolink', () => {
const editor = new Editor({
extensions: [
- StarterKit.configure(issueEditorStarterKitOptions),
+ StarterKit.configure(editorStarterKitOptions),
Link.configure({ openOnClick: false, autolink: true }),
Markdown.configure({ html: true, linkify: true, breaks: true }),
],
diff --git a/apps/web/src/features/issue/components/editor/IssueMarkdownEditor.tsx b/apps/web/src/components/common/editor/MarkdownEditor.tsx
similarity index 89%
rename from apps/web/src/features/issue/components/editor/IssueMarkdownEditor.tsx
rename to apps/web/src/components/common/editor/MarkdownEditor.tsx
index a5839580..34977b6e 100644
--- a/apps/web/src/features/issue/components/editor/IssueMarkdownEditor.tsx
+++ b/apps/web/src/components/common/editor/MarkdownEditor.tsx
@@ -7,16 +7,16 @@ import Placeholder from '@tiptap/extension-placeholder';
import Link from '@tiptap/extension-link';
import { common, createLowlight } from 'lowlight';
import { Markdown } from 'tiptap-markdown';
-import { ResizableImage } from '@/components/common/editor/tiptap-image';
+import { ResizableImage } from './tiptap-image';
import { Mention } from '@/lib/tiptap-mention';
import { SlashCommand } from '@/lib/tiptap-slash-command';
-import { MarkdownTable } from '@/components/common/editor/tiptap-table';
-import { Video } from '../../utils/tiptap-video';
-import { attachmentHtml, type Embeddable } from '../../utils/attachmentEmbed';
-import { openLinkOnModifierClick } from '../../utils/modifierClickLink';
+import { MarkdownTable } from './tiptap-table';
+import { Video } from './tiptap-video';
+import { attachmentHtml, type Embeddable } from './attachmentEmbed';
+import { openLinkOnModifierClick } from './modifierClickLink';
import EditorImagePicker from './EditorImagePicker';
-import EditorSelectionMenu from '@/components/common/editor/EditorSelectionMenu';
-import EditorTableMenu from '@/components/common/editor/EditorTableMenu';
+import EditorSelectionMenu from './EditorSelectionMenu';
+import EditorTableMenu from './EditorTableMenu';
import { useMentionCandidates } from '@/hooks/useMentionCandidates';
import { useTranslations } from 'next-intl';
@@ -24,7 +24,7 @@ import { useTranslations } from 'next-intl';
// highlightAuto, so there is no language picker.
const lowlight = createLowlight(common);
-export const issueEditorStarterKitOptions = {
+export const editorStarterKitOptions = {
codeBlock: false,
link: false,
} as const;
@@ -33,7 +33,7 @@ export const issueEditorStarterKitOptions = {
// bubble menu on selection and a "/" command list (Linear/Notion-style). Content
// in and out is plain markdown (via tiptap-markdown), matching how descriptions
// are stored everywhere else in the pipeline.
-export default function IssueMarkdownEditor({
+export default function MarkdownEditor({
defaultValue,
onChange,
onBlur,
@@ -58,12 +58,11 @@ export default function IssueMarkdownEditor({
// When set, files dropped onto the editor are uploaded and inserted at the
// drop position (image/video inline, other files as a link).
uploadFile?: (file: File) => Promise<Embeddable>;
- // Offered in a picker, to embed an upload again. Omitted where there is no
- // issue to read them from yet (the create modal), which drops the picker.
+ // Offered in a picker, to embed an upload again. Omitted where there is nothing
+ // stored to read them from yet (a create dialog), which drops the picker.
imageAttachments?: Embeddable[];
}) {
- const t = useTranslations('issue.editor');
- const tCommon = useTranslations('common.editor');
+ const t = useTranslations('common.editor');
const editorRef = useRef<Editor | null>(null);
// Held in a ref because the extensions are built once: the "@" menu reads the
// roster through it, so a list that arrives later is still offered.
@@ -98,7 +97,7 @@ export default function IssueMarkdownEditor({
editable,
extensions: [
// Replaces StarterKit's plain code block, keeping the node name codeBlock.
- StarterKit.configure(issueEditorStarterKitOptions),
+ StarterKit.configure(editorStarterKitOptions),
CodeBlockLowlight.configure({ lowlight }),
Placeholder.configure({ placeholder }),
Link.configure({ openOnClick: false, autolink: true }),
@@ -115,8 +114,8 @@ export default function IssueMarkdownEditor({
TableKit.configure({ table: false }),
MarkdownTable.configure({ resizable: false }),
SlashCommand.configure({
- codeBlockLabel: tCommon('codeBlock'),
- tableLabel: tCommon('table'),
+ codeBlockLabel: t('codeBlock'),
+ tableLabel: t('table'),
image: imageAttachments
? { label: t('image'), onPick: () => setImagePickerOpen(true) }
: undefined,
diff --git a/apps/web/src/features/issue/utils/attachmentEmbed.ts b/apps/web/src/components/common/editor/attachmentEmbed.ts
similarity index 100%
rename from apps/web/src/features/issue/utils/attachmentEmbed.ts
rename to apps/web/src/components/common/editor/attachmentEmbed.ts
diff --git a/apps/web/src/features/issue/utils/modifierClickLink.ts b/apps/web/src/components/common/editor/modifierClickLink.ts
similarity index 100%
rename from apps/web/src/features/issue/utils/modifierClickLink.ts
rename to apps/web/src/components/common/editor/modifierClickLink.ts
diff --git a/apps/web/src/features/issue/components/editor/tiptap-markdown.d.ts b/apps/web/src/components/common/editor/tiptap-markdown.d.ts
similarity index 100%
rename from apps/web/src/features/issue/components/editor/tiptap-markdown.d.ts
rename to apps/web/src/components/common/editor/tiptap-markdown.d.ts
diff --git a/apps/web/src/features/issue/utils/tiptap-video.ts b/apps/web/src/components/common/editor/tiptap-video.ts
similarity index 95%
rename from apps/web/src/features/issue/utils/tiptap-video.ts
rename to apps/web/src/components/common/editor/tiptap-video.ts
index 85fbba93..b0e878bb 100644
--- a/apps/web/src/features/issue/utils/tiptap-video.ts
+++ b/apps/web/src/components/common/editor/tiptap-video.ts
@@ -27,7 +27,7 @@ export const Video = Node.create({
renderHTML({ HTMLAttributes }) {
return [
// max-width:50% keeps the (usually vertical) reel from dominating the
- // issue — about half the on-screen size of a full-width embed.
+ // text — about half the on-screen size of a full-width embed.
'video',
mergeAttributes(HTMLAttributes, {
controls: 'true',
diff --git a/apps/web/src/features/initiatives/components/shared/InitiativeStatusSelect.tsx b/apps/web/src/components/common/fields/InitiativeStatusSelect.tsx
similarity index 100%
rename from apps/web/src/features/initiatives/components/shared/InitiativeStatusSelect.tsx
rename to apps/web/src/components/common/fields/InitiativeStatusSelect.tsx
diff --git a/apps/web/src/features/initiatives/components/detail/InitiativeHeader.tsx b/apps/web/src/features/initiatives/components/detail/InitiativeHeader.tsx
index 08162712..103500e9 100644
--- a/apps/web/src/features/initiatives/components/detail/InitiativeHeader.tsx
+++ b/apps/web/src/features/initiatives/components/detail/InitiativeHeader.tsx
@@ -9,7 +9,7 @@ import AssigneeSelect from '@/components/common/fields/AssigneeSelect';
import DatePill from '@/components/common/fields/DatePill';
import LabelsSelect from '@/components/common/fields/LabelsSelect';
import PrioritySelect from '@/components/common/fields/PrioritySelect';
-import InitiativeStatusSelect from '../shared/InitiativeStatusSelect';
+import InitiativeStatusSelect from '@/components/common/fields/InitiativeStatusSelect';
import HealthBadge from '../shared/HealthBadge';
import HealthInfoPopover from '../shared/HealthInfoPopover';
import ProgressBar from '@/components/common/ProgressBar';
diff --git a/apps/web/src/features/issue/components/create/NewIssueAttachmentChip.tsx b/apps/web/src/features/issue/components/create/NewIssueAttachmentChip.tsx
index b1183ab3..8111b70b 100644
--- a/apps/web/src/features/issue/components/create/NewIssueAttachmentChip.tsx
+++ b/apps/web/src/features/issue/components/create/NewIssueAttachmentChip.tsx
@@ -1,10 +1,10 @@
import { useState } from 'react';
import { X } from 'lucide-react';
import { type PendingAttachment } from '../../hooks/useNewIssueAttachments';
-import { isImage, type Embeddable } from '../../utils/attachmentEmbed';
-import { formatSize } from '../../utils/fileSize';
+import { isImage, type Embeddable } from '@/components/common/editor/attachmentEmbed';
+import { formatSize } from '@/utils/fileSize';
import { baseName } from '../../utils/filename';
-import IssueAttachmentThumb from '../IssueAttachmentThumb';
+import AttachmentThumb from '@/components/common/attachments/AttachmentThumb';
import IssueImageAnnotator from '../IssueImageAnnotator';
import { Button } from '@/components/ui/button';
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
@@ -38,12 +38,12 @@ export default function NewIssueAttachmentChip({
aria-label={t('preview', { name: item.filename })}
className="relative flex size-full items-center justify-center overflow-hidden rounded-md border bg-muted hover:border-ring"
>
- <IssueAttachmentThumb attachment={item} />
+ <AttachmentThumb attachment={item} />
</button>
</PopoverTrigger>
<PopoverContent side="top" align="start" className="w-64 space-y-2 p-2">
<div className="relative flex h-40 items-center justify-center overflow-hidden rounded-md border bg-muted">
- <IssueAttachmentThumb attachment={item} sizes="240px" />
+ <AttachmentThumb attachment={item} sizes="240px" />
</div>
<div className="min-w-0">
<p className="truncate text-sm font-medium">{item.filename}</p>
diff --git a/apps/web/src/features/issue/components/create/NewIssueAttachmentStrip.tsx b/apps/web/src/features/issue/components/create/NewIssueAttachmentStrip.tsx
index 0f1dc39c..17c759e7 100644
--- a/apps/web/src/features/issue/components/create/NewIssueAttachmentStrip.tsx
+++ b/apps/web/src/features/issue/components/create/NewIssueAttachmentStrip.tsx
@@ -1,5 +1,5 @@
import { type PendingAttachment } from '../../hooks/useNewIssueAttachments';
-import { type Embeddable } from '../../utils/attachmentEmbed';
+import { type Embeddable } from '@/components/common/editor/attachmentEmbed';
import NewIssueAttachmentChip from './NewIssueAttachmentChip';
// Files waiting to be uploaded once the issue is created. They preview from
diff --git a/apps/web/src/features/issue/components/create/NewIssueBody.tsx b/apps/web/src/features/issue/components/create/NewIssueBody.tsx
index b6d9baf0..47fa4313 100644
--- a/apps/web/src/features/issue/components/create/NewIssueBody.tsx
+++ b/apps/web/src/features/issue/components/create/NewIssueBody.tsx
@@ -1,10 +1,10 @@
import { type Editor } from '@tiptap/react';
import { type Assignee, type CustomField, type IssueFieldValueInput } from '@/lib/api';
import { cn } from '@/lib/utils';
-import { type Embeddable } from '../../utils/attachmentEmbed';
+import { type Embeddable } from '@/components/common/editor/attachmentEmbed';
import { DESCRIPTION_SECTION, OTHER_SECTION, fieldSection } from '../../utils/bodySections';
import { hasFieldValue } from '../../utils/fieldValues';
-import IssueMarkdownEditor from '../editor/IssueMarkdownEditor';
+import MarkdownEditor from '@/components/common/editor/MarkdownEditor';
import NewIssueBodyFields from './NewIssueBodyFields';
import NewIssueBodySwitcher from './NewIssueBodySwitcher';
import { useTranslations } from 'next-intl';
@@ -54,7 +54,7 @@ export default function NewIssueBody({
const editorClass = cn('overflow-y-auto', fullscreen ? 'min-h-48 flex-1' : 'min-h-24');
const descriptionEditor = (
- <IssueMarkdownEditor
+ <MarkdownEditor
className={cn(bodyDefs.length === 0 && 'mt-3', editorClass)}
placeholder={tEditor('descriptionPlaceholder')}
defaultValue={description}
@@ -103,7 +103,7 @@ export default function NewIssueBody({
{markdownDefs.map((def) => (
<div key={def.id} className={sectionClass(fieldSection(def.id))}>
- <IssueMarkdownEditor
+ <MarkdownEditor
className={editorClass}
defaultValue={(fieldValues[def.id]?.value as string) ?? ''}
placeholder={tFields('empty')}
diff --git a/apps/web/src/features/issue/components/create/NewIssueModal.tsx b/apps/web/src/features/issue/components/create/NewIssueModal.tsx
index 85113516..2c88ab00 100644
--- a/apps/web/src/features/issue/components/create/NewIssueModal.tsx
+++ b/apps/web/src/features/issue/components/create/NewIssueModal.tsx
@@ -14,7 +14,7 @@ import { cn } from '@/lib/utils';
import { useSession } from '@/lib/auth-client';
import { useCreateIssue, useSetFieldValue, useUpdateIssue } from '@/services/issues.service';
import { fieldDefsForType } from '../../utils/fieldDefs';
-import { useFileDragZone } from '../../hooks/useFileDragZone';
+import { useFileDragZone } from '@/hooks/useFileDragZone';
import { useFilePaste } from '../../hooks/useFilePaste';
import { useNewIssueAttachments } from '../../hooks/useNewIssueAttachments';
import {
@@ -23,7 +23,7 @@ import {
replaceEmbed,
stripEmbed,
type Embeddable,
-} from '../../utils/attachmentEmbed';
+} from '@/components/common/editor/attachmentEmbed';
import { DESCRIPTION_SECTION, OTHER_SECTION, fieldSectionId } from '../../utils/bodySections';
import { hasFieldValue } from '../../utils/fieldValues';
import EstimatePill from '../fields/EstimatePill';
diff --git a/apps/web/src/features/issue/components/detail/ActivityLine.tsx b/apps/web/src/features/issue/components/detail/ActivityLine.tsx
index a53b31cd..59ff47b8 100644
--- a/apps/web/src/features/issue/components/detail/ActivityLine.tsx
+++ b/apps/web/src/features/issue/components/detail/ActivityLine.tsx
@@ -5,7 +5,7 @@ import { useRelativeTime } from '@/context/relativeTimeContext';
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
import { ACTION_ICON } from '../../utils/activityIcons';
import { useActivityText } from '../../hooks/useActivityText';
-import IssueMarkdownEditor from '../editor/IssueMarkdownEditor';
+import MarkdownEditor from '@/components/common/editor/MarkdownEditor';
// One change-log entry in an activity list: icon, actor, the sentence describing
// the change, and how long ago it happened. A change with a long value (a new
@@ -37,7 +37,7 @@ export default function ActivityLine({ item }: { item: FeedItem }) {
</button>
</PopoverTrigger>
<PopoverContent align="start" className="max-h-80 w-96 overflow-y-auto">
- <IssueMarkdownEditor className="text-sm" defaultValue={popover} editable={false} />
+ <MarkdownEditor className="text-sm" defaultValue={popover} editable={false} />
</PopoverContent>
</Popover>
)}
diff --git a/apps/web/src/features/issue/components/detail/CommentItem.tsx b/apps/web/src/features/issue/components/detail/CommentItem.tsx
index d44f5f66..d7247be5 100644
--- a/apps/web/src/features/issue/components/detail/CommentItem.tsx
+++ b/apps/web/src/features/issue/components/detail/CommentItem.tsx
@@ -3,7 +3,7 @@ import { type FeedItem } from '@/lib/api';
import Avatar from '@/components/common/Avatar';
import { Button } from '@/components/ui/button';
import { useRelativeTime } from '@/context/relativeTimeContext';
-import IssueMarkdownEditor from '../editor/IssueMarkdownEditor';
+import MarkdownEditor from '@/components/common/editor/MarkdownEditor';
import { useTranslations } from 'next-intl';
// One comment inside a thread card: a line of author, age and the reply button over
@@ -47,7 +47,7 @@ export default function CommentItem({
</Button>
)}
</div>
- <IssueMarkdownEditor
+ <MarkdownEditor
className="mt-1 ps-7 text-sm text-foreground/85"
defaultValue={item.body ?? ''}
editable={false}
diff --git a/apps/web/src/features/issue/components/detail/IssueAttachmentCard.tsx b/apps/web/src/features/issue/components/detail/IssueAttachmentCard.tsx
index 2bf6aebc..732e499f 100644
--- a/apps/web/src/features/issue/components/detail/IssueAttachmentCard.tsx
+++ b/apps/web/src/features/issue/components/detail/IssueAttachmentCard.tsx
@@ -1,9 +1,9 @@
import { type DragEvent } from 'react';
import { Download, PenLine, Plus, Trash2 } from 'lucide-react';
import { type Attachment } from '@/lib/api';
-import { attachmentHtml, isImage, isVideo } from '../../utils/attachmentEmbed';
-import { formatSize } from '../../utils/fileSize';
-import IssueAttachmentThumb from '../IssueAttachmentThumb';
+import { attachmentHtml, isImage, isVideo } from '@/components/common/editor/attachmentEmbed';
+import { formatSize } from '@/utils/fileSize';
+import AttachmentThumb from '@/components/common/attachments/AttachmentThumb';
import { Button } from '@/components/ui/button';
import { useTranslations } from 'next-intl';
@@ -53,7 +53,7 @@ export default function IssueAttachmentCard({
}`}
>
<div className="relative flex aspect-video items-center justify-center bg-muted [&_svg]:size-7">
- <IssueAttachmentThumb
+ <AttachmentThumb
attachment={{ ...attachment, url: thumbnailUrl }}
sizes="(min-width: 640px) 12rem, 50vw"
/>
diff --git a/apps/web/src/features/issue/components/detail/IssueAttachmentsPanel.tsx b/apps/web/src/features/issue/components/detail/IssueAttachmentsPanel.tsx
index 8fa23869..d6bd99a0 100644
--- a/apps/web/src/features/issue/components/detail/IssueAttachmentsPanel.tsx
+++ b/apps/web/src/features/issue/components/detail/IssueAttachmentsPanel.tsx
@@ -1,7 +1,7 @@
import { useRef, useState } from 'react';
import { Download, Plus } from 'lucide-react';
import { type Attachment } from '@/lib/api';
-import { useFileDragZone } from '../../hooks/useFileDragZone';
+import { useFileDragZone } from '@/hooks/useFileDragZone';
import { usePersistedOpen } from '../../hooks/usePersistedOpen';
import {
useAttachmentsQuery,
@@ -12,7 +12,7 @@ import {
import { baseName } from '../../utils/filename';
import IssueImageAnnotator from '../IssueImageAnnotator';
import IssueAttachmentCard from './IssueAttachmentCard';
-import IssueAttachmentViewer from './IssueAttachmentViewer';
+import AttachmentViewer from '@/components/common/attachments/AttachmentViewer';
import IssueSectionHeading from './IssueSectionHeading';
import { useStorageSettingsQuery } from '@/services/storage.service';
import { attachmentAccept, attachmentError, attachmentLimitHint } from '@/utils/uploadLimits';
@@ -138,7 +138,7 @@ export default function IssueAttachmentsPanel({
</div>
))}
- {viewing && <IssueAttachmentViewer attachment={viewing} onClose={() => setViewing(null)} />}
+ {viewing && <AttachmentViewer attachment={viewing} onClose={() => setViewing(null)} />}
{annotating && (
<IssueImageAnnotator
diff --git a/apps/web/src/features/issue/components/detail/IssueDetailContent.tsx b/apps/web/src/features/issue/components/detail/IssueDetailContent.tsx
index b592f83c..3aa9df89 100644
--- a/apps/web/src/features/issue/components/detail/IssueDetailContent.tsx
+++ b/apps/web/src/features/issue/components/detail/IssueDetailContent.tsx
@@ -19,7 +19,7 @@ import IssueActivityFeed from './IssueActivityFeed';
import LastCommentBubble from './LastCommentBubble';
import IssueDetailSkeleton from './IssueDetailSkeleton';
import IssueStatusTimeline from './IssueStatusTimeline';
-import IssueMarkdownEditor from '../editor/IssueMarkdownEditor';
+import MarkdownEditor from '@/components/common/editor/MarkdownEditor';
import IssueCustomFieldBody from '../fields/IssueCustomFieldBody';
import IssueProperties from './IssueProperties';
import IssueActionsBar from '../actions/IssueActionsBar';
@@ -137,7 +137,7 @@ export default function IssueDetailContent({
</div>
{(canEdit || issue.description.trim() !== '') && (
- <IssueMarkdownEditor
+ <MarkdownEditor
className="mt-4"
placeholder={tEditor('descriptionPlaceholder')}
defaultValue={issue.description}
diff --git a/apps/web/src/features/issue/components/detail/IssueProperties.tsx b/apps/web/src/features/issue/components/detail/IssueProperties.tsx
index dc6f707c..53e82987 100644
--- a/apps/web/src/features/issue/components/detail/IssueProperties.tsx
+++ b/apps/web/src/features/issue/components/detail/IssueProperties.tsx
@@ -28,7 +28,7 @@ import IssueWatchers from './IssueWatchers';
import IssueSectionHeading from './IssueSectionHeading';
import IssuePropertyRow from './IssuePropertyRow';
import IssuePropertyGroupHeading from './IssuePropertyGroupHeading';
-import { type Embeddable } from '../../utils/attachmentEmbed';
+import { type Embeddable } from '@/components/common/editor/attachmentEmbed';
import { parseDate } from '@/utils/dates';
import { cn } from '@/lib/utils';
import { useTranslations } from 'next-intl';
diff --git a/apps/web/src/features/issue/components/detail/ReadOnlyIssueDetail.tsx b/apps/web/src/features/issue/components/detail/ReadOnlyIssueDetail.tsx
index 1663c81b..d42e6b4b 100644
--- a/apps/web/src/features/issue/components/detail/ReadOnlyIssueDetail.tsx
+++ b/apps/web/src/features/issue/components/detail/ReadOnlyIssueDetail.tsx
@@ -2,7 +2,7 @@ import { type SharedIssueBundle } from '@/lib/api';
import { toPublicProjectDetail } from '@/utils/publicProject';
import { usePersistedOpen, usePersistedOpenGroups } from '../../hooks/usePersistedOpen';
import { fieldDefsForType } from '../../utils/fieldDefs';
-import IssueMarkdownEditor from '../editor/IssueMarkdownEditor';
+import MarkdownEditor from '@/components/common/editor/MarkdownEditor';
import IssueCustomFieldBody from '../fields/IssueCustomFieldBody';
import IssueProperties from './IssueProperties';
import IssueSubtasksPanel from './IssueSubtasksPanel';
@@ -56,7 +56,7 @@ export default function ReadOnlyIssueDetail({
<h1 className="mt-1 text-lg font-semibold">{issue.title}</h1>
{issue.description.trim() && (
- <IssueMarkdownEditor className="mt-4" defaultValue={issue.description} editable={false} />
+ <MarkdownEditor className="mt-4" defaultValue={issue.description} editable={false} />
)}
{fieldDefs
diff --git a/apps/web/src/features/issue/components/fields/IssueCustomFieldBody.tsx b/apps/web/src/features/issue/components/fields/IssueCustomFieldBody.tsx
index b49e4e67..28cd47fa 100644
--- a/apps/web/src/features/issue/components/fields/IssueCustomFieldBody.tsx
+++ b/apps/web/src/features/issue/components/fields/IssueCustomFieldBody.tsx
@@ -4,8 +4,8 @@ import {
type IssueFieldValue,
type IssueFieldValueInput,
} from '@/lib/api';
-import IssueMarkdownEditor from '../editor/IssueMarkdownEditor';
-import { type Embeddable } from '../../utils/attachmentEmbed';
+import MarkdownEditor from '@/components/common/editor/MarkdownEditor';
+import { type Embeddable } from '@/components/common/editor/attachmentEmbed';
import IssueCustomFieldControl from './IssueCustomFieldControl';
import { useTranslations } from 'next-intl';
@@ -39,7 +39,7 @@ export default function IssueCustomFieldBody({
{def.name}
</h3>
{def.fieldType === 'markdown' ? (
- <IssueMarkdownEditor
+ <MarkdownEditor
defaultValue={(current?.value as string) ?? ''}
key={saveKey}
placeholder={t('empty')}
diff --git a/apps/web/src/features/issue/hooks/useIssueDetail.ts b/apps/web/src/features/issue/hooks/useIssueDetail.ts
index b0615001..072cac25 100644
--- a/apps/web/src/features/issue/hooks/useIssueDetail.ts
+++ b/apps/web/src/features/issue/hooks/useIssueDetail.ts
@@ -16,7 +16,7 @@ import { qk } from '@/services/queryKeys';
import { useAccountPreferencesQuery } from '@/services/preferences.service';
import { useAttachmentsQuery, useUploadAttachment } from '../services/attachments.service';
import { useFeedQuery, useGroupedFeedQuery, useTimelineQuery } from '../services/comments.service';
-import { attachmentMarkdown, isImage } from '../utils/attachmentEmbed';
+import { attachmentMarkdown, isImage } from '@/components/common/editor/attachmentEmbed';
import { fieldDefsForType } from '../utils/fieldDefs';
// Loads one issue and exposes the edit operations for the detail surfaces.
diff --git a/apps/web/src/features/issue/hooks/useNewIssueAttachments.ts b/apps/web/src/features/issue/hooks/useNewIssueAttachments.ts
index 8b814ae3..d33941d7 100644
--- a/apps/web/src/features/issue/hooks/useNewIssueAttachments.ts
+++ b/apps/web/src/features/issue/hooks/useNewIssueAttachments.ts
@@ -2,7 +2,7 @@ import { useEffect, useRef, useState } from 'react';
import { useStorageSettingsQuery } from '@/services/storage.service';
import { attachmentError } from '@/utils/uploadLimits';
import { useUploadAttachment } from '../services/attachments.service';
-import { type Embeddable } from '../utils/attachmentEmbed';
+import { type Embeddable } from '@/components/common/editor/attachmentEmbed';
export type PendingAttachment = Embeddable & { id: number; file: File };
diff --git a/apps/web/src/features/issue/hooks/useFileDragZone.ts b/apps/web/src/hooks/useFileDragZone.ts
similarity index 100%
rename from apps/web/src/features/issue/hooks/useFileDragZone.ts
rename to apps/web/src/hooks/useFileDragZone.ts
diff --git a/apps/web/src/features/issue/utils/fileSize.ts b/apps/web/src/utils/fileSize.ts
similarity index 100%
rename from apps/web/src/features/issue/utils/fileSize.ts
rename to apps/web/src/utils/fileSize.ts