Skip to content

Fully autonomous AI Agents system capable of performing complex penetration testing tasks

feat(knowledge): rich tiptap editor for content with per-panel scrolling

Sergey Kozyrenko95893bf5024b
diff --git a/frontend/package.json b/frontend/package.json
index 0d2ff692..fc31b55b 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -43,6 +43,11 @@
"@radix-ui/react-tooltip": "^1.1.3",
"@react-pdf/renderer": "^4.3.2",
"@tanstack/react-table": "^8.21.3",
+ "@tiptap/core": "^3.22.5",
+ "@tiptap/extensions": "^3.22.5",
+ "@tiptap/pm": "^3.22.5",
+ "@tiptap/react": "^3.22.5",
+ "@tiptap/starter-kit": "^3.22.5",
"@xterm/addon-fit": "^0.11.0",
"@xterm/addon-search": "^0.16.0",
"@xterm/addon-unicode11": "^0.9.0",
@@ -83,6 +88,7 @@
"remark-gfm": "^4.0.1",
"sonner": "^2.0.7",
"tailwind-merge": "^3.0.0",
+ "tiptap-markdown": "^0.9.0",
"tw-animate-css": "^1.4.0",
"vaul": "^1.1.2",
"zod": "^3.25.32"
diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml
index d92302e8..8f9d8a59 100644
--- a/frontend/pnpm-lock.yaml
+++ b/frontend/pnpm-lock.yaml
@@ -83,6 +83,21 @@ importers:
'@tanstack/react-table':
specifier: ^8.21.3
+ '@tiptap/core':
+ specifier: ^3.22.5
+ version: 3.22.5(@tiptap/[email protected])
+ '@tiptap/extensions':
+ specifier: ^3.22.5
+ version: 3.22.5(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+ '@tiptap/pm':
+ specifier: ^3.22.5
+ version: 3.22.5
+ '@tiptap/react':
+ specifier: ^3.22.5
+ '@tiptap/starter-kit':
+ specifier: ^3.22.5
+ version: 3.22.5
'@xterm/addon-fit':
specifier: ^0.11.0
version: 0.11.0
@@ -203,6 +218,9 @@ importers:
tailwind-merge:
specifier: ^3.0.0
version: 3.5.0
+ tiptap-markdown:
+ specifier: ^0.9.0
+ version: 0.9.0(@tiptap/[email protected](@tiptap/[email protected]))
tw-animate-css:
specifier: ^1.4.0
version: 1.4.0
@@ -2234,6 +2252,155 @@ packages:
resolution: {integrity: sha512-ldZXEhOBb8Is7xLs01fR3YEc3DERiz5silj8tnGkFZytt1abEvl/GhUmCE0PMLaMPTa3Jk4HbKmRlHmu+gCftg==}
engines: {node: '>=12'}
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-L1lhWz6ujGny8LduTJ7MBWYhzigwOvfUJUrJ7IzOJSuy3+OAzisdGDD1GV7LEO/hU0Hr2Mkm1wajRIHExvS9HQ==}
+ peerDependencies:
+ '@tiptap/pm': 3.22.5
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-ajyP5W8fG5Hrru47T/eF3xMKOpNvWofgNJqBTeNuGl02sYxsy9a4EunyFxudsaZP9WW3VOD4SaIWr5+MqpbnOQ==}
+ peerDependencies:
+ '@tiptap/core': 3.22.5
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-l/uDtpJISiFFyfctvnODNWBN/XPZI1jVZRacTRDDnSn8+x6KQ7G2qgFYueU7KvVJGDFVT39Iio56mcFRG/Pozg==}
+ peerDependencies:
+ '@tiptap/core': 3.22.5
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-yrNlFQQJY5MmhBpmD8tnmaSmyUQrEvgyPKa3bzVeWEhDSG1CW4A0ZSMx3hrA9yFO0HWfw3IJmvSCycEZQBalpQ==}
+ peerDependencies:
+ '@tiptap/core': 3.22.5
+ '@tiptap/pm': 3.22.5
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-cf54fG9AybU8NgPMv1TOcoqAkELeRc/VpnSCt/rIJZphWQx9nsFmrtkrlCatrIcCaGtNZYwlHlMnC5LVVMu0uA==}
+ peerDependencies:
+ '@tiptap/extension-list': 3.22.5
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-d123kCfLdJTi4fue1m0+TNFztDkmIRSZGZmGu6H9KqwG5Q7IzjT9o8lzRsz+pXxYqHvqgYmXoEpM6srbzXx/Ag==}
+ peerDependencies:
+ '@tiptap/core': 3.22.5
+ '@tiptap/pm': 3.22.5
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-mwDNOJC9rYbDu/JcqrN4dbUQRklJU8Fuk2raxD/IvFw9qUIcPCmxQ2XT9UTKmZz/Ju7Kdy72fss6XpgWv6gLAQ==}
+ peerDependencies:
+ '@tiptap/core': 3.22.5
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-8NJERd+pCtvSuEP4C4WMGYmRRCV12ePZL7bC+QUdFlbdXg+kNZS0zZ7hh879tYA0Kidbi8rWWD1Tx+H2ezkmMw==}
+ peerDependencies:
+ '@tiptap/core': 3.22.5
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-Mp40DaFrY3sEUVtFqmxrR0BmU4G3k8GCYYNGqNa9OqWv7BrcFDC03V2n3okESDKt4MKkzhQQmypq+ouLy8dLfA==}
+ peerDependencies:
+ '@tiptap/extensions': 3.22.5
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-dhem4sTPhyQgQ+pFp2Oud4k4FSQz9PVMgeQAC9288SmGwxBkJNveDAw6sKTMrumqDvwkJrtslXIupq9TZYQnzg==}
+ peerDependencies:
+ '@floating-ui/dom': ^1.0.0
+ '@tiptap/core': 3.22.5
+ '@tiptap/pm': 3.22.5
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-4WkMu7qqjbsm8hCQS+8X+la1wjriN0SKoRdvpfKH33qM50MB34tYJuGLAO+y7TTh4MMMco3AZCKPBL5JVMqNIg==}
+ peerDependencies:
+ '@tiptap/extensions': 3.22.5
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-n0R2mUVYZU2AVbJhg/WcY9+zx690wVwvsItHJf0DrYbf1tCYHx+PRHUt/AoXk6u8BSmnkb8/FDziS8m3mjfpSg==}
+ peerDependencies:
+ '@tiptap/core': 3.22.5
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-hjyEG4947PAhMBfP1G6B0QAh6+y9mp2C5BQmNjprA05/lQzDAT7KFZzNh8ZVp3ol6aICKq/N1gFOW9Dc/9FUOw==}
+ peerDependencies:
+ '@tiptap/core': 3.22.5
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-vUV0/ugIbXOc8SJib0h8UMhgcqZXWu/dkEhlswZN4VVven1o5enkfxEiDw+OyIJHi5rUkrdhsQ/KTxG/Xb7X8A==}
+ peerDependencies:
+ '@tiptap/core': 3.22.5
+ '@tiptap/pm': 3.22.5
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-4T8baSiLkeIymTgEwirxDFt5YgYofkP3m1+MGYdGy2HKcOK+1vpvlPhEO1X5qtZngtJW5S4+njKjinRg52A4PA==}
+ peerDependencies:
+ '@tiptap/core': 3.22.5
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-d671MvF3GPKoS2OVxjIlQ7hIE7MS3hREdR+d4cvnnoiLLD+ZJ6KgDnxmWqF0a1s4qxLWK2KxKRSOIfYGE31QWQ==}
+ peerDependencies:
+ '@tiptap/core': 3.22.5
+ '@tiptap/pm': 3.22.5
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-W7uTmyKLhlsvuTPLv+8WwnsY+mlikBFIoLSvVcBaFt4MwpsZ+DeB6KQg02Y7tbtaAnG7rXu9Fvw2QORh2P728A==}
+ peerDependencies:
+ '@tiptap/extension-list': 3.22.5
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-cGUnxJ0y515e1bVHNjUmbx7oWHoEon59w6BA5N2KwV9iW2mZZchlTX4yxJSOX+ixeVRChsa7YwC3Z1jUZ6AMEg==}
+ peerDependencies:
+ '@tiptap/extension-list': 3.22.5
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-cVO3ZHCgxAWZ4zrFSs81FO2nyCk1wb2EHkpLpW98FzbJLkN9rDkazhW99P3HRWy/CvUldOT+8ecI1YrQtBojMg==}
+ peerDependencies:
+ '@tiptap/core': 3.22.5
+ '@tiptap/pm': 3.22.5
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-OXdh4k4CNrukwiSdWdEQ49uvgnqvR0Z9aNSP4HI5/kZQ/Te1NtRtYCpUrzWyO/7CtjcCisXHti0o9C/TV8YMbQ==}
+ peerDependencies:
+ '@tiptap/extension-list': 3.22.5
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-52KCto4+XKpnBWpIufspWLyq4UWxAWC72ANPdGuIhbi72NRTabiTbTVN40uwGSPkyakeESG0/vKdWJCVvB4f0g==}
+ peerDependencies:
+ '@tiptap/core': 3.22.5
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-42WrrFK5gOom/0znH85x12Mw5IQ/6O6DWdyUWoRIrNA/qJpuHtU8oVU+bIgU2tuomMGHruRjIzgBQv5sBjEtww==}
+ peerDependencies:
+ '@tiptap/core': 3.22.5
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-bzpDOdAEo1JeoVZDIyV0oY0jGXkEG+AzF70SzHoRSjOvFDtKWunyXf9eO1OnOr2/fmMcckT2qwUBNBMQplWBzw==}
+ peerDependencies:
+ '@tiptap/core': 3.22.5
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-9ut09rJD0iEbS6sk7yd2j6IwuFDLTNmDEGTDLodvqAfi+bq7ddsTDv0YviXoZaA9sdHAdTEVr2ITy2m6WK5jpA==}
+ peerDependencies:
+ '@tiptap/core': 3.22.5
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-Ifg4MzKCj3uRqe3ieTwYnomu2y4p7EXr2avVSKZYfh12i2dyWe2Gkn1KuZDREANVE+gHqFlQjJRYzhJFwzSCrg==}
+ peerDependencies:
+ '@tiptap/core': 3.22.5
+ '@tiptap/pm': 3.22.5
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-Cr9Mv4igxvI2tKMiahw48sZxva3PfDzypErH8IB82N+9qa9n9ygVMt0BOaDg53hLKxEEVeYr2S/wCcJIVFgBTw==}
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-36WHEs+vPmB//V1ff7Ujcnpz7Ey5g8lhpI/0+hoanSbdiPMTQ7qZVWwMovIkMKDlqWVp2fxBgeYM1861jyFzTw==}
+ peerDependencies:
+ '@tiptap/core': 3.22.5
+ '@tiptap/pm': 3.22.5
+ '@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0
+ '@types/react-dom': ^17.0.0 || ^18.0.0 || ^19.0.0
+ react: ^17.0.0 || ^18.0.0 || ^19.0.0
+ react-dom: ^17.0.0 || ^18.0.0 || ^19.0.0
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-LZ/LYbwH6rnDi5DnRyagkuNsYAVyhM+yJvvz+ZuYA0JkPiTXJV86J5PWSKew8M0gVfMHcNVtKjfQCvViFCeIgw==}
+
resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==}
@@ -2285,12 +2452,30 @@ packages:
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-yg6E+u0/+Zjva+buc3EIb+29XEg4wltq7cSmd4Uc2EE/1nUVmxyzpX6gUXD0V8jIrG0r7YeOGVIbYRkxeooCtw==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==}
+
resolution: {integrity: sha512-gIW7lQLZbue7lRSWEFql49QJJWThrTFFeIMJdp3eH4tKoxm1OvEPg02rm4wCCSHS0cL3/Fizimb35b7k8atwsQ==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-1XPwR0+MgXLWfTn9gCsZ55AHOKW1WN+P9vr0PaQh5aerR9LLQXUbjfEAFhjmEmyoYFWAyuN2Mqkn40MZ4ukjBw==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==}
+
resolution: {integrity: sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-6L6VymKTzYSrEf4Nev4Xa1LCHKrlTlYCBMTlQKFuddo1CvQcE52I0mwfOJayueUC7MJuXOeHTcIU683lzd0cUA==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==}
+
resolution: {integrity: sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==}
@@ -3124,6 +3309,10 @@ packages:
resolution: {integrity: sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==}
+ resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==}
+ engines: {node: '>=0.12'}
+
resolution: {integrity: sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==}
engines: {node: '>=0.12'}
@@ -3296,6 +3485,10 @@ packages:
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
+ resolution: {integrity: sha512-jt2DW/aNFNwke7AUd+Z+e6pz39KO5rzdbbFCg2sGafS4mk13MI7Z8O5z9cADNn5lhGODIgLwug6TZO2ctf7kcw==}
+ engines: {node: '>=6.0.0'}
+
resolution: {integrity: sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==}
engines: {node: '>=8.6.0'}
@@ -4039,6 +4232,12 @@ packages:
resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==}
+ resolution: {integrity: sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==}
+
+ resolution: {integrity: sha512-NT1CJtq3hHIreOianA8aSXn6Cw0JzYOuDQbOrSPe7gqFnCpKP++MQe3ODgO3oh2GJFORkAAdqredOa60z63GbA==}
+
resolution: {integrity: sha512-lBWt8hujh/Cjysw5GYVmZpFHXDCgZzhrOm8vbcUdobADZNOK/bRshr2kM3DfgrrtR1DQhfupW9gnIXOfiFi+bw==}
engines: {node: '>=20.17'}
@@ -4129,6 +4328,13 @@ packages:
resolution: {integrity: sha512-8y/eV9QQZCiyn1SprXSrCmqJN0yNRATe+PO8ztwqrvrbdRLA3eYJF0yaR0YayLWkMbsQSKWS9N2gPcGEc4UsZg==}
engines: {node: '>=0.10.0'}
+ resolution: {integrity: sha512-TxFAc76Jnhb2OUu+n3yz9RMu4CwGfaT788br6HhEDlvWfdeJcLUsxk1Hgw2yJio0OXsxv7pyIPmvECY7bMbluA==}
+
+ resolution: {integrity: sha512-BuU2qnTti9YKgK5N+IeMubp14ZUKUUw7yeJbkjtosvHiP0AZ5c8IAgEMk79D0eC8F23r4Ac/q8cAIFdm2FtyoA==}
+ hasBin: true
+
resolution: {integrity: sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==}
@@ -4191,6 +4397,9 @@ packages:
resolution: {integrity: sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==}
+ resolution: {integrity: sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==}
+
resolution: {integrity: sha512-aa5tG6sDoK+k70B9iEX1NeyfT8ObCKhNDs6lJVpwF6r8vhUfuKMslIcirq6HIUYuuUYLefcEQOn9bSBOvawtwg==}
@@ -4424,6 +4633,9 @@ packages:
resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==}
engines: {node: '>= 0.8.0'}
+ resolution: {integrity: sha512-TvAWxi0nDe1j/rtMcWcIj94+Ffe6n7zhow33h40SKxmsmozs6dz/e+EajymfoFcHd7sxNn8yHM8839uixMOV6g==}
+
resolution: {integrity: sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==}
engines: {node: '>= 0.4'}
@@ -4603,10 +4815,53 @@ packages:
resolution: {integrity: sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==}
+ resolution: {integrity: sha512-96WBLhOaYhJ+kPhLg3uW359Tz6I/MfcrQfL4EGv4SrcqKEMC1gmoGrXHecPE8eOwTVCJ4IwgfzM8fFad25wNfw==}
+
+ resolution: {integrity: sha512-rT7qZnQtx5c0/y/KlYaGvtG411S97UaL6gdp6RIZ23DLHanMYLyfGBV5DtSnZdthQql7W+lEVbpSfwtO8T+L2w==}
+
+ resolution: {integrity: sha512-CCk6Gyx9+Tt2sbYk5NK0nB1ukHi2ryaRgadV/LvyNuO3ena1payM2z6Cg0vO1ebK8cxbzo41ku2DE5Axj1Zuiw==}
+
+ resolution: {integrity: sha512-pMdYaEnjNMSwl11yjEGtgTmLkR08m/Vl+Jj443167p9eB3HVQKhYCc4gmHVDsLPODfZfjr/MmirsdyZziXbQKw==}
+
+ resolution: {integrity: sha512-zlzTiH01eKA55UAf1MEjtssJeHnGxO0j4K4Dpx+gnmX9n+SHNlDqI2oO1Kv1iPN5B1dm5fsljCfqKF9nFL6HRg==}
+
+ resolution: {integrity: sha512-4HucRlpiLd1IPQQXNqeo81BGtkY8Ai5smHhKW9jjPKRc2wQIxksg7Hl1tTI2IfT2B/LgX6bfYvXxEpJl7aKYKw==}
+
+ resolution: {integrity: sha512-D98dm4cQ3Hs6EmjK500TdAOew4Z03EV71ajEFiWra3Upr7diytJsjF4mPV2dW+eK5uNectiRj0xFxYI9NLXDbw==}
+
+ resolution: {integrity: sha512-PIM7E43PBxKce8OQeezAs9j4TP+5yDpZVbuurd1h5phUxEKIu+G2a+EUZzIC5nS1mJktDJWzbqS23n1tsAf5QA==}
+
+ resolution: {integrity: sha512-927lFx/uwyQaGwJxLWCZRkjXG0p48KpMj6ueoYiu4JX05GGuGcgzAy62dfiV8eFZftgyBUvLx76RsMe20fJl+Q==}
+
+ resolution: {integrity: sha512-6jiYHH2CIGbCfnxdHbXZ12gySFY/fz/ulZE333G6bPqIZ4F+TXo9ifiR86nAHpWnfoNjOb3o5ESi7J8Uz1jXHw==}
+
+ resolution: {integrity: sha512-V/0cDCsHKHe/tfWkeCmthNUcEp1IVO3p6vwN8XtwE9PZQLAZJigbw3QoraAdfJPir4NKJtNvOB8oYGKRl+t0Dw==}
+
+ resolution: {integrity: sha512-GxboyN4AMIsoHNtz5uf2r2Ru551i5hWeCMD6E2Ib4Eogqoub0NflniaBPVQ4MrGE5yZ8JV9tUHg9qcZTTrcN4w==}
+
+ resolution: {integrity: sha512-TnKDdohEatgyZNGCDWIdccOHXhYloJwbwU+phw/a23KBvJIR9lWQWW7WHHK3vBdOLDNuF7TaX98GObUZOWkOnA==}
+
resolution: {integrity: sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA==}
engines: {node: '>=10'}
+ resolution: {integrity: sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==}
+ engines: {node: '>=6'}
+
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
engines: {node: '>=6'}
@@ -4858,6 +5113,9 @@ packages:
engines: {node: '>=18.0.0', npm: '>=8.0.0'}
hasBin: true
+ resolution: {integrity: sha512-UT5EDe2cu2E/6O4igUr5PSFs23nvvukicWHx6GnOPlHAiiYbzNuCRQCuiUdHJQcqKalLKlrYJnjY0ySGsXNQXQ==}
+
resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==}
@@ -5151,6 +5409,11 @@ packages:
resolution: {integrity: sha512-Bf+ILmBgretUrdJxzXM0SgXLZ3XfiaUuOj/IKQHuTXip+05Xn+uyEYdVg0kYDipTBcLrCVyUzAPz7QmArb0mmw==}
engines: {node: '>=14.0.0'}
+ resolution: {integrity: sha512-dKLQ9iiuGNgrlGVjrNauF/UBzWu4LYOx5pkD0jNkmQt/GOwfCJsBuzZTsf1jZ204ANHOm572mZ9PYvGh1S7tpQ==}
+ peerDependencies:
+ '@tiptap/core': ^3.0.1
+
resolution: {integrity: sha512-e1zGYRvbffpcHIrnuqT0Dh+gEJtDaxDSoG4JAIpq4oDFyooziLBIiYQv0GBT4FUAnUop5uZ1hiIAj7oAF6sOCA==}
@@ -5226,6 +5489,9 @@ packages:
engines: {node: '>=14.17'}
hasBin: true
+ resolution: {integrity: sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==}
+
resolution: {integrity: sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==}
engines: {node: '>= 0.4'}
@@ -5464,6 +5730,9 @@ packages:
jsdom:
optional: true
+ resolution: {integrity: sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==}
+
resolution: {integrity: sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==}
@@ -7611,6 +7880,177 @@ snapshots:
'@tanstack/[email protected]': {}
+ dependencies:
+ '@tiptap/pm': 3.22.5
+
+ dependencies:
+ '@tiptap/core': 3.22.5(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.5(@tiptap/[email protected])
+
+ dependencies:
+ '@floating-ui/dom': 1.7.6
+ '@tiptap/core': 3.22.5(@tiptap/[email protected])
+ '@tiptap/pm': 3.22.5
+ optional: true
+
+ dependencies:
+ '@tiptap/extension-list': 3.22.5(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.5(@tiptap/[email protected])
+ '@tiptap/pm': 3.22.5
+
+ dependencies:
+ '@tiptap/core': 3.22.5(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.5(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/extensions': 3.22.5(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+
+ dependencies:
+ '@floating-ui/dom': 1.7.6
+ '@tiptap/core': 3.22.5(@tiptap/[email protected])
+ '@tiptap/pm': 3.22.5
+ optional: true
+
+ dependencies:
+ '@tiptap/extensions': 3.22.5(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.5(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.5(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.5(@tiptap/[email protected])
+ '@tiptap/pm': 3.22.5
+
+ dependencies:
+ '@tiptap/core': 3.22.5(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.5(@tiptap/[email protected])
+ '@tiptap/pm': 3.22.5
+ linkifyjs: 4.3.2
+
+ dependencies:
+ '@tiptap/extension-list': 3.22.5(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/extension-list': 3.22.5(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.5(@tiptap/[email protected])
+ '@tiptap/pm': 3.22.5
+
+ dependencies:
+ '@tiptap/extension-list': 3.22.5(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.5(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.5(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.5(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.5(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.5(@tiptap/[email protected])
+ '@tiptap/pm': 3.22.5
+
+ '@tiptap/[email protected]':
+ dependencies:
+ prosemirror-changeset: 2.4.1
+ prosemirror-commands: 1.7.1
+ prosemirror-dropcursor: 1.8.2
+ prosemirror-gapcursor: 1.4.1
+ prosemirror-history: 1.5.0
+ prosemirror-keymap: 1.2.3
+ prosemirror-model: 1.25.4
+ prosemirror-schema-list: 1.5.1
+ prosemirror-state: 1.4.4
+ prosemirror-tables: 1.8.5
+ prosemirror-transform: 1.12.0
+ prosemirror-view: 1.41.8
+
+ dependencies:
+ '@tiptap/core': 3.22.5(@tiptap/[email protected])
+ '@tiptap/pm': 3.22.5
+ '@types/react': 19.2.14
+ '@types/react-dom': 19.2.3(@types/[email protected])
+ '@types/use-sync-external-store': 0.0.6
+ fast-equals: 5.4.0
+ react: 19.2.5
+ react-dom: 19.2.5([email protected])
+ use-sync-external-store: 1.6.0([email protected])
+ optionalDependencies:
+ '@tiptap/extension-bubble-menu': 3.22.5(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+ '@tiptap/extension-floating-menu': 3.22.5(@floating-ui/[email protected])(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+ transitivePeerDependencies:
+ - '@floating-ui/dom'
+
+ '@tiptap/[email protected]':
+ dependencies:
+ '@tiptap/core': 3.22.5(@tiptap/[email protected])
+ '@tiptap/extension-blockquote': 3.22.5(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/extension-bold': 3.22.5(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/extension-bullet-list': 3.22.5(@tiptap/[email protected](@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected]))
+ '@tiptap/extension-code': 3.22.5(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/extension-code-block': 3.22.5(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+ '@tiptap/extension-document': 3.22.5(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/extension-dropcursor': 3.22.5(@tiptap/[email protected](@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected]))
+ '@tiptap/extension-gapcursor': 3.22.5(@tiptap/[email protected](@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected]))
+ '@tiptap/extension-hard-break': 3.22.5(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/extension-heading': 3.22.5(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/extension-horizontal-rule': 3.22.5(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+ '@tiptap/extension-italic': 3.22.5(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/extension-link': 3.22.5(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+ '@tiptap/extension-list': 3.22.5(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+ '@tiptap/extension-list-item': 3.22.5(@tiptap/[email protected](@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected]))
+ '@tiptap/extension-list-keymap': 3.22.5(@tiptap/[email protected](@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected]))
+ '@tiptap/extension-ordered-list': 3.22.5(@tiptap/[email protected](@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected]))
+ '@tiptap/extension-paragraph': 3.22.5(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/extension-strike': 3.22.5(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/extension-text': 3.22.5(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/extension-underline': 3.22.5(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/extensions': 3.22.5(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+ '@tiptap/pm': 3.22.5
+
dependencies:
'@types/deep-eql': 4.0.2
@@ -7660,12 +8100,30 @@ snapshots:
'@types/[email protected]': {}
+ '@types/[email protected]': {}
+
+ '@types/[email protected]': {}
+
'@types/[email protected]': {}
+ '@types/[email protected]':
+ dependencies:
+ '@types/linkify-it': 3.0.5
+ '@types/mdurl': 1.0.5
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/linkify-it': 5.0.0
+ '@types/mdurl': 2.0.0
+
dependencies:
'@types/unist': 3.0.3
+ '@types/[email protected]': {}
+
+ '@types/[email protected]': {}
+
'@types/[email protected]': {}
@@ -8562,6 +9020,8 @@ snapshots:
+
@@ -8866,6 +9326,8 @@ snapshots:
+
dependencies:
'@nodelib/fs.stat': 2.0.5
@@ -9641,6 +10103,12 @@ snapshots:
+ dependencies:
+ uc.micro: 2.1.0
+
+
dependencies:
commander: 14.0.3
@@ -9740,6 +10208,17 @@ snapshots:
+
+ dependencies:
+ argparse: 2.0.1
+ entities: 4.5.0
+ linkify-it: 5.0.0
+ mdurl: 2.0.0
+ punycode.js: 2.3.1
+ uc.micro: 2.1.0
+
@@ -9901,6 +10380,8 @@ snapshots:
dependencies:
'@types/mdast': 4.0.4
+
@@ -10243,6 +10724,8 @@ snapshots:
type-check: 0.4.0
word-wrap: 1.2.5
+
dependencies:
get-intrinsic: 1.3.0
@@ -10369,8 +10852,85 @@ snapshots:
+ dependencies:
+ prosemirror-transform: 1.12.0
+
+ dependencies:
+ prosemirror-model: 1.25.4
+ prosemirror-state: 1.4.4
+ prosemirror-transform: 1.12.0
+
+ dependencies:
+ prosemirror-state: 1.4.4
+ prosemirror-transform: 1.12.0
+ prosemirror-view: 1.41.8
+
+ dependencies:
+ prosemirror-keymap: 1.2.3
+ prosemirror-model: 1.25.4
+ prosemirror-state: 1.4.4
+ prosemirror-view: 1.41.8
+
+ dependencies:
+ prosemirror-state: 1.4.4
+ prosemirror-transform: 1.12.0
+ prosemirror-view: 1.41.8
+ rope-sequence: 1.3.4
+
+ dependencies:
+ prosemirror-state: 1.4.4
+ w3c-keyname: 2.2.8
+
+ dependencies:
+ '@types/markdown-it': 14.1.2
+ markdown-it: 14.1.1
+ prosemirror-model: 1.25.4
+
+ dependencies:
+ orderedmap: 2.1.1
+
+ dependencies:
+ prosemirror-model: 1.25.4
+ prosemirror-state: 1.4.4
+ prosemirror-transform: 1.12.0
+
+ dependencies:
+ prosemirror-model: 1.25.4
+ prosemirror-transform: 1.12.0
+ prosemirror-view: 1.41.8
+
+ dependencies:
+ prosemirror-keymap: 1.2.3
+ prosemirror-model: 1.25.4
+ prosemirror-state: 1.4.4
+ prosemirror-transform: 1.12.0
+ prosemirror-view: 1.41.8
+
+ dependencies:
+ prosemirror-model: 1.25.4
+
+ dependencies:
+ prosemirror-model: 1.25.4
+ prosemirror-state: 1.4.4
+ prosemirror-transform: 1.12.0
+
+
@@ -10694,6 +11254,8 @@ snapshots:
'@rollup/rollup-win32-x64-msvc': 4.60.1
fsevents: 2.3.3
+
dependencies:
queue-microtask: 1.2.3
@@ -11015,6 +11577,14 @@ snapshots:
+ dependencies:
+ '@tiptap/core': 3.22.5(@tiptap/[email protected])
+ '@types/markdown-it': 13.0.9
+ markdown-it: 14.1.1
+ markdown-it-task-lists: 2.1.1
+ prosemirror-markdown: 1.13.4
+
dependencies:
tslib: 2.8.1
@@ -11093,6 +11663,8 @@ snapshots:
+
dependencies:
call-bound: 1.0.4
@@ -11341,6 +11913,8 @@ snapshots:
transitivePeerDependencies:
- msw
+
diff --git a/frontend/src/components/shared/markdown-editor.tsx b/frontend/src/components/shared/markdown-editor.tsx
new file mode 100644
index 00000000..5706f17d
--- /dev/null
+++ b/frontend/src/components/shared/markdown-editor.tsx
@@ -0,0 +1,363 @@
+import type { Editor } from '@tiptap/react';
+
+import { Placeholder } from '@tiptap/extensions';
+import { EditorContent, useEditor } from '@tiptap/react';
+import StarterKit from '@tiptap/starter-kit';
+import {
+ Bold,
+ Code,
+ Code2,
+ Heading1,
+ Heading2,
+ Heading3,
+ Italic,
+ Link as LinkIcon,
+ List,
+ ListOrdered,
+ Minus,
+ Quote,
+ Redo,
+ Strikethrough,
+ Undo,
+} from 'lucide-react';
+import { forwardRef, useCallback, useEffect, useImperativeHandle, useRef } from 'react';
+import { Markdown } from 'tiptap-markdown';
+
+import { Separator } from '@/components/ui/separator';
+import { Toggle } from '@/components/ui/toggle';
+import { cn } from '@/lib/utils';
+
+export interface MarkdownEditorHandle {
+ focus: () => void;
+ getEditor: () => Editor | null;
+}
+
+export interface MarkdownEditorProps {
+ autoFocus?: boolean;
+ className?: string;
+ contentClassName?: string;
+ disabled?: boolean;
+ onBlur?: () => void;
+ onChange: (value: string) => void;
+ placeholder?: string;
+ showToolbar?: boolean;
+ value: string;
+}
+
+const MarkdownEditor = forwardRef<MarkdownEditorHandle, MarkdownEditorProps>(
+ (
+ {
+ autoFocus,
+ className,
+ contentClassName,
+ disabled,
+ onBlur,
+ onChange,
+ placeholder = 'Write something…',
+ showToolbar = true,
+ value,
+ },
+ ref,
+ ) => {
+ const onChangeRef = useRef(onChange);
+ const onBlurRef = useRef(onBlur);
+
+ useEffect(() => {
+ onChangeRef.current = onChange;
+ onBlurRef.current = onBlur;
+ }, [onChange, onBlur]);
+
+ const editor = useEditor({
+ content: value,
+ editable: !disabled,
+ extensions: [
+ StarterKit.configure({
+ codeBlock: { HTMLAttributes: { class: 'hljs' } },
+ }),
+ Placeholder.configure({
+ emptyEditorClass: 'is-editor-empty',
+ placeholder,
+ }),
+ Markdown.configure({
+ breaks: true,
+ html: false,
+ linkify: true,
+ tightLists: true,
+ transformCopiedText: true,
+ transformPastedText: true,
+ }),
+ ],
+ immediatelyRender: false,
+ onBlur: () => onBlurRef.current?.(),
+ onUpdate: ({ editor: instance }) => {
+ onChangeRef.current?.(instance.storage.markdown.getMarkdown());
+ },
+ });
+
+ useImperativeHandle(
+ ref,
+ () => ({
+ focus: () => editor?.commands.focus(),
+ getEditor: () => editor,
+ }),
+ [editor],
+ );
+
+ // Keep external value in sync (e.g. on form reset). Avoid resetting if
+ // the editor already reflects the same markdown to keep cursor stable.
+ useEffect(() => {
+ if (!editor) {
+ return;
+ }
+
+ const current = editor.storage.markdown.getMarkdown();
+
+ if (current !== value) {
+ editor.commands.setContent(value, { emitUpdate: false });
+ }
+ }, [editor, value]);
+
+ useEffect(() => {
+ if (!editor) {
+ return;
+ }
+
+ editor.setEditable(!disabled);
+ }, [editor, disabled]);
+
+ useEffect(() => {
+ if (autoFocus && editor) {
+ editor.commands.focus('end');
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [editor]);
+
+ if (!editor) {
+ return null;
+ }
+
+ return (
+ <div
+ className={cn(
+ 'border-input dark:bg-input/30 group/markdown-editor flex w-full flex-col overflow-hidden rounded-md border shadow-2xs outline-hidden transition-[color,box-shadow]',
+ 'focus-within:ring-ring focus-within:ring-1',
+ disabled && 'pointer-events-none opacity-60',
+ className,
+ )}
+ data-slot="markdown-editor"
+ >
+ {showToolbar ? (
+ <MarkdownEditorToolbar
+ disabled={disabled}
+ editor={editor}
+ />
+ ) : null}
+ <EditorContent
+ className={cn(
+ 'prose prose-sm dark:prose-invert tiptap-content min-w-0 max-w-none flex-1 overflow-auto px-3 py-2',
+ '[&_.ProseMirror]:min-h-full [&_.ProseMirror]:outline-none',
+ contentClassName,
+ )}
+ editor={editor}
+ />
+ </div>
+ );
+ },
+);
+
+MarkdownEditor.displayName = 'MarkdownEditor';
+
+interface MarkdownEditorToolbarProps {
+ disabled?: boolean;
+ editor: Editor;
+}
+
+const MarkdownEditorToolbar = ({ disabled, editor }: MarkdownEditorToolbarProps) => {
+ const handleSetLink = useCallback(() => {
+ const previousUrl = editor.getAttributes('link').href as string | undefined;
+ const url = window.prompt('URL', previousUrl ?? '');
+
+ if (url === null) {
+ return;
+ }
+
+ if (url === '') {
+ editor.chain().focus().extendMarkRange('link').unsetLink().run();
+
+ return;
+ }
+
+ editor.chain().focus().extendMarkRange('link').setLink({ href: url }).run();
+ }, [editor]);
+
+ return (
+ <div
+ className={cn(
+ 'bg-muted/40 flex flex-wrap items-center gap-0.5 border-b px-1 py-1',
+ disabled && 'pointer-events-none opacity-60',
+ )}
+ data-slot="markdown-editor-toolbar"
+ >
+ <Toggle
+ aria-label="Bold"
+ onPressedChange={() => editor.chain().focus().toggleBold().run()}
+ pressed={editor.isActive('bold')}
+ size="sm"
+ title="Bold (Ctrl+B)"
+ >
+ <Bold />
+ </Toggle>
+ <Toggle
+ aria-label="Italic"
+ onPressedChange={() => editor.chain().focus().toggleItalic().run()}
+ pressed={editor.isActive('italic')}
+ size="sm"
+ title="Italic (Ctrl+I)"
+ >
+ <Italic />
+ </Toggle>
+ <Toggle
+ aria-label="Strikethrough"
+ onPressedChange={() => editor.chain().focus().toggleStrike().run()}
+ pressed={editor.isActive('strike')}
+ size="sm"
+ title="Strikethrough"
+ >
+ <Strikethrough />
+ </Toggle>
+ <Toggle
+ aria-label="Inline code"
+ onPressedChange={() => editor.chain().focus().toggleCode().run()}
+ pressed={editor.isActive('code')}
+ size="sm"
+ title="Inline code"
+ >
+ <Code />
+ </Toggle>
+
+ <Separator
+ className="mx-1 h-5"
+ orientation="vertical"
+ />
+
+ <Toggle
+ aria-label="Heading 1"
+ onPressedChange={() => editor.chain().focus().toggleHeading({ level: 1 }).run()}
+ pressed={editor.isActive('heading', { level: 1 })}
+ size="sm"
+ title="Heading 1"
+ >
+ <Heading1 />
+ </Toggle>
+ <Toggle
+ aria-label="Heading 2"
+ onPressedChange={() => editor.chain().focus().toggleHeading({ level: 2 }).run()}
+ pressed={editor.isActive('heading', { level: 2 })}
+ size="sm"
+ title="Heading 2"
+ >
+ <Heading2 />
+ </Toggle>
+ <Toggle
+ aria-label="Heading 3"
+ onPressedChange={() => editor.chain().focus().toggleHeading({ level: 3 }).run()}
+ pressed={editor.isActive('heading', { level: 3 })}
+ size="sm"
+ title="Heading 3"
+ >
+ <Heading3 />
+ </Toggle>
+
+ <Separator
+ className="mx-1 h-5"
+ orientation="vertical"
+ />
+
+ <Toggle
+ aria-label="Bullet list"
+ onPressedChange={() => editor.chain().focus().toggleBulletList().run()}
+ pressed={editor.isActive('bulletList')}
+ size="sm"
+ title="Bullet list"
+ >
+ <List />
+ </Toggle>
+ <Toggle
+ aria-label="Ordered list"
+ onPressedChange={() => editor.chain().focus().toggleOrderedList().run()}
+ pressed={editor.isActive('orderedList')}
+ size="sm"
+ title="Ordered list"
+ >
+ <ListOrdered />
+ </Toggle>
+
+ <Separator
+ className="mx-1 h-5"
+ orientation="vertical"
+ />
+
+ <Toggle
+ aria-label="Blockquote"
+ onPressedChange={() => editor.chain().focus().toggleBlockquote().run()}
+ pressed={editor.isActive('blockquote')}
+ size="sm"
+ title="Blockquote"
+ >
+ <Quote />
+ </Toggle>
+ <Toggle
+ aria-label="Code block"
+ onPressedChange={() => editor.chain().focus().toggleCodeBlock().run()}
+ pressed={editor.isActive('codeBlock')}
+ size="sm"
+ title="Code block"
+ >
+ <Code2 />
+ </Toggle>
+ <Toggle
+ aria-label="Link"
+ onPressedChange={handleSetLink}
+ pressed={editor.isActive('link')}
+ size="sm"
+ title="Insert link"
+ >
+ <LinkIcon />
+ </Toggle>
+ <Toggle
+ aria-label="Horizontal rule"
+ onPressedChange={() => editor.chain().focus().setHorizontalRule().run()}
+ pressed={false}
+ size="sm"
+ title="Horizontal rule"
+ >
+ <Minus />
+ </Toggle>
+
+ <div className="ml-auto flex items-center gap-0.5">
+ <Toggle
+ aria-label="Undo"
+ disabled={!editor.can().undo()}
+ onPressedChange={() => editor.chain().focus().undo().run()}
+ pressed={false}
+ size="sm"
+ title="Undo (Ctrl+Z)"
+ >
+ <Undo />
+ </Toggle>
+ <Toggle
+ aria-label="Redo"
+ disabled={!editor.can().redo()}
+ onPressedChange={() => editor.chain().focus().redo().run()}
+ pressed={false}
+ size="sm"
+ title="Redo (Ctrl+Shift+Z)"
+ >
+ <Redo />
+ </Toggle>
+ </div>
+ </div>
+ );
+};
+
+export { MarkdownEditor };
diff --git a/frontend/src/pages/knowledges/knowledge.tsx b/frontend/src/pages/knowledges/knowledge.tsx
index 7be881a4..15586aae 100644
--- a/frontend/src/pages/knowledges/knowledge.tsx
+++ b/frontend/src/pages/knowledges/knowledge.tsx
@@ -13,19 +13,14 @@ import type {
UpdateKnowledgeDocumentInput,
} from '@/graphql/types';
+import { MarkdownEditor } from '@/components/shared/markdown-editor';
import { Badge } from '@/components/ui/badge';
import { Breadcrumb, BreadcrumbItem, BreadcrumbList, BreadcrumbPage } from '@/components/ui/breadcrumb';
import { Button } from '@/components/ui/button';
import { Card, CardContent } from '@/components/ui/card';
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from '@/components/ui/form';
import { Input } from '@/components/ui/input';
-import {
- InputGroup,
- InputGroupAddon,
- InputGroupButton,
- InputGroupTextarea,
- InputGroupTextareaAutosize,
-} from '@/components/ui/input-group';
+import { InputGroup, InputGroupTextareaAutosize } from '@/components/ui/input-group';
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from '@/components/ui/resizable';
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
import { Separator } from '@/components/ui/separator';
@@ -97,14 +92,15 @@ const documentToFormValues = (k: KnowledgeDocumentFragmentFragment): FormValues
question: k.question,
});
-interface KnowledgeFormCardProps {
+interface KnowledgeFormViewProps {
initialValues: FormValues;
isNew: boolean;
knowledge?: KnowledgeDocumentFragmentFragment | null;
+ knowledgeName: null | string;
onSubmit: (values: FormValues) => Promise<void>;
}
-const KnowledgeFormCard = ({ initialValues, isNew, knowledge, onSubmit }: KnowledgeFormCardProps) => {
+const KnowledgeFormView = ({ initialValues, isNew, knowledge, knowledgeName, onSubmit }: KnowledgeFormViewProps) => {
const { isDesktop } = useBreakpoint();
const [isSaving, setIsSaving] = useState(false);
@@ -118,6 +114,7 @@ const KnowledgeFormCard = ({ initialValues, isNew, knowledge, onSubmit }: Knowle
const docType = watch('docType');
const hasUnsavedChanges = formState.isDirty;
+ const canSubmit = !isSaving && formState.isValid && (isNew || hasUnsavedChanges);
const onSubmitWithGuard = async (values: FormValues) => {
if (isSaving) {
@@ -130,7 +127,6 @@ const KnowledgeFormCard = ({ initialValues, isNew, knowledge, onSubmit }: Knowle
await onSubmit(values);
if (!isNew) {
- // Successful update — make form pristine with new values as the new defaults
reset(values, { keepDefaultValues: false });
}
} catch {
@@ -140,7 +136,7 @@ const KnowledgeFormCard = ({ initialValues, isNew, knowledge, onSubmit }: Knowle
}
};
- const headerSection = (
+ const introBlock = (
<div className="flex flex-col gap-4">
<div className="text-center">
<h1 className="text-2xl font-semibold">
@@ -349,35 +345,21 @@ const KnowledgeFormCard = ({ initialValues, isNew, knowledge, onSubmit }: Knowle
</div>
);
- const submitButton = (
- <InputGroupButton
- className="ml-auto"
- disabled={isSaving || !formState.isValid || (!isNew && !hasUnsavedChanges)}
- size="icon-xs"
- type="submit"
- variant="default"
- >
- {isSaving ? <Spinner variant="circle" /> : <Save />}
- </InputGroupButton>
- );
-
- const contentFieldFill = (
+ const contentField = (
<FormField
control={control}
name="content"
render={({ field }) => (
<FormItem className="flex min-h-0 flex-1 flex-col">
- <FormLabel>Content</FormLabel>
<FormControl>
- <InputGroup className="flex h-full min-h-0 flex-1 flex-col items-stretch !rounded-md">
- <InputGroupTextarea
- {...field}
- className="min-h-0 flex-1"
- disabled={isSaving}
- placeholder="Knowledge content (will be embedded into the vector store)"
- />
- <InputGroupAddon align="block-end">{submitButton}</InputGroupAddon>
- </InputGroup>
+ <MarkdownEditor
+ className="min-h-0 flex-1"
+ disabled={isSaving}
+ onBlur={field.onBlur}
+ onChange={field.onChange}
+ placeholder="Knowledge content (will be embedded into the vector store)"
+ value={field.value}
+ />
</FormControl>
<FormMessage />
</FormItem>
@@ -385,7 +367,7 @@ const KnowledgeFormCard = ({ initialValues, isNew, knowledge, onSubmit }: Knowle
/>
);
- const contentFieldAutosize = (
+ const contentFieldStandalone = (
<FormField
control={control}
name="content"
@@ -393,17 +375,15 @@ const KnowledgeFormCard = ({ initialValues, isNew, knowledge, onSubmit }: Knowle
<FormItem>
<FormLabel>Content</FormLabel>
<FormControl>
- <InputGroup className="block">
- <InputGroupTextareaAutosize
- {...field}
- className="min-h-0"
- disabled={isSaving}
- maxRows={24}
- minRows={6}
- placeholder="Knowledge content (will be embedded into the vector store)"
- />
- <InputGroupAddon align="block-end">{submitButton}</InputGroupAddon>
- </InputGroup>
+ <MarkdownEditor
+ className="min-h-[280px]"
+ contentClassName="min-h-[240px]"
+ disabled={isSaving}
+ onBlur={field.onBlur}
+ onChange={field.onChange}
+ placeholder="Knowledge content (will be embedded into the vector store)"
+ value={field.value}
+ />
</FormControl>
<FormMessage />
</FormItem>
@@ -411,46 +391,75 @@ const KnowledgeFormCard = ({ initialValues, isNew, knowledge, onSubmit }: Knowle
/>
);
+ const pageHeader = (
+ <header className="bg-background sticky top-0 z-10 flex h-12 shrink-0 items-center gap-2 border-b px-4">
+ <SidebarTrigger className="-ml-1" />
+ <Separator
+ className="mr-2 h-4"
+ orientation="vertical"
+ />
+ <Breadcrumb>
+ <BreadcrumbList>
+ <BreadcrumbItem>
+ <LibraryBig className="size-4 shrink-0" />
+ <BreadcrumbPage className="max-w-[240px] truncate">
+ {isNew ? 'New knowledge' : (knowledgeName ?? 'Knowledge')}
+ </BreadcrumbPage>
+ </BreadcrumbItem>
+ </BreadcrumbList>
+ </Breadcrumb>
+ <div className="ml-auto flex items-center gap-2">
+ <Button
+ disabled={!canSubmit}
+ size="sm"
+ type="submit"
+ >
+ {isSaving ? <Spinner variant="circle" /> : <Save />}
+ {isNew ? 'Create' : 'Save'}
+ </Button>
+ </div>
+ </header>
+ );
+
if (isDesktop) {
return (
<Form {...form}>
<form
- className="flex h-full min-h-0 w-full flex-1"
+ className="flex h-full min-h-0 w-full flex-1 flex-col"
onSubmit={handleSubmit(onSubmitWithGuard)}
>
- <ResizablePanelGroup
- className="w-full"
- direction="horizontal"
- >
- <ResizablePanel
- defaultSize={45}
- minSize={30}
- >
- <div className="h-full overflow-auto">
- <Card className="mx-auto size-full max-w-2xl rounded-none border-0">
- <CardContent className="flex flex-col gap-6 pt-6">
- {headerSection}
- {metaFields}
- </CardContent>
- </Card>
- </div>
- </ResizablePanel>
- <ResizableHandle withHandle>
- <GripVertical className="size-4" />
- </ResizableHandle>
- <ResizablePanel
- defaultSize={55}
- minSize={30}
+ {pageHeader}
+ <div className="flex h-[calc(100dvh-3rem)] min-h-0 w-full max-w-full flex-1 overflow-hidden">
+ <ResizablePanelGroup
+ className="w-full"
+ direction="horizontal"
>
- <div className="flex h-full flex-col p-4">
- <Card className="flex min-h-0 flex-1 flex-col">
- <CardContent className="flex min-h-0 flex-1 flex-col pt-6">
- {contentFieldFill}
- </CardContent>
- </Card>
- </div>
- </ResizablePanel>
- </ResizablePanelGroup>
+ <ResizablePanel
+ className="h-[calc(100dvh-3rem)] min-h-0"
+ defaultSize={45}
+ minSize={30}
+ >
+ <div className="h-full min-h-0 overflow-y-auto">
+ <Card className="mx-auto min-h-full w-full max-w-2xl rounded-none border-0">
+ <CardContent className="flex flex-col gap-6 py-6">
+ {introBlock}
+ {metaFields}
+ </CardContent>
+ </Card>
+ </div>
+ </ResizablePanel>
+ <ResizableHandle withHandle>
+ <GripVertical className="size-4" />
+ </ResizableHandle>
+ <ResizablePanel
+ className="h-[calc(100dvh-3rem)] min-h-0"
+ defaultSize={55}
+ minSize={30}
+ >
+ <div className="flex h-full min-h-0 flex-col overflow-hidden p-4">{contentField}</div>
+ </ResizablePanel>
+ </ResizablePanelGroup>
+ </div>
</form>
</Form>
);
@@ -459,16 +468,19 @@ const KnowledgeFormCard = ({ initialValues, isNew, knowledge, onSubmit }: Knowle
return (
<Form {...form}>
<form
- className="flex min-w-0 flex-1 items-start justify-center p-4"
+ className="flex min-h-[100dvh] flex-col"
onSubmit={handleSubmit(onSubmitWithGuard)}
>
- <Card className="w-full max-w-3xl">
- <CardContent className="flex flex-col gap-6 pt-6">
- {headerSection}
- {metaFields}
- {contentFieldAutosize}
- </CardContent>
- </Card>
+ {pageHeader}
+ <div className="flex min-w-0 flex-1 items-start justify-center p-4">
+ <Card className="w-full max-w-3xl">
+ <CardContent className="flex flex-col gap-6 pt-6">
+ {introBlock}
+ {metaFields}
+ {contentFieldStandalone}
+ </CardContent>
+ </Card>
+ </div>
</form>
</Form>
);
@@ -528,7 +540,7 @@ const Knowledge = () => {
await updateKnowledge(knowledgeId, input);
};
- const pageHeader = (
+ const placeholderHeader = (
<header className="bg-background sticky top-0 z-10 flex h-12 shrink-0 items-center gap-2 border-b px-4">
<SidebarTrigger className="-ml-1" />
<Separator
@@ -551,7 +563,7 @@ const Knowledge = () => {
if (!isNew && isLoadingKnowledge) {
return (
<>
- {pageHeader}
+ {placeholderHeader}
<div className="flex min-h-[calc(100dvh-3rem)] items-center justify-center">
<Spinner variant="circle" />
</div>
@@ -562,7 +574,7 @@ const Knowledge = () => {
if (!isNew && !knowledge) {
return (
<>
- {pageHeader}
+ {placeholderHeader}
<div className="flex min-h-[calc(100dvh-3rem)] items-center justify-center p-4">
<Card className="w-full max-w-2xl">
<CardContent className="flex flex-col items-center gap-4 pt-6 text-center">
@@ -579,18 +591,14 @@ const Knowledge = () => {
}
return (
- <>
- {pageHeader}
- <div className="flex h-[calc(100dvh-3rem)] w-full max-w-full flex-1">
- <KnowledgeFormCard
- initialValues={initialValues}
- isNew={isNew}
- key={knowledgeId ?? 'new'}
- knowledge={knowledge}
- onSubmit={handleSubmit}
- />
- </div>
- </>
+ <KnowledgeFormView
+ initialValues={initialValues}
+ isNew={isNew}
+ key={knowledgeId ?? 'new'}
+ knowledge={knowledge}
+ knowledgeName={knowledgeName}
+ onSubmit={handleSubmit}
+ />
);
};
diff --git a/frontend/src/styles/index.css b/frontend/src/styles/index.css
index 516de024..02d714c4 100644
--- a/frontend/src/styles/index.css
+++ b/frontend/src/styles/index.css
@@ -566,3 +566,69 @@
.recharts-wrapper * {
outline: none !important;
}
+
+/* Tiptap editor */
+.tiptap-content .ProseMirror {
+ outline: none;
+ min-height: 100%;
+}
+
+.tiptap-content .ProseMirror p.is-editor-empty:first-child::before {
+ color: var(--muted-foreground);
+ opacity: 0.6;
+ content: attr(data-placeholder);
+ float: left;
+ height: 0;
+ pointer-events: none;
+}
+
+.tiptap-content .ProseMirror > :first-child {
+ margin-top: 0;
+}
+
+.tiptap-content .ProseMirror > :last-child {
+ margin-bottom: 0;
+}
+
+.tiptap-content .ProseMirror p.is-empty::before {
+ content: '';
+}
+
+.tiptap-content .ProseMirror code:not(pre code) {
+ background-color: var(--muted);
+ padding: 0.125rem 0.25rem;
+ border-radius: calc(var(--radius) - 4px);
+ font-size: 0.875em;
+}
+
+.tiptap-content .ProseMirror pre {
+ background-color: var(--muted);
+ color: var(--foreground);
+ padding: 0.75rem 1rem;
+ border-radius: calc(var(--radius) - 2px);
+ overflow-x: auto;
+}
+
+.tiptap-content .ProseMirror pre code {
+ background: transparent;
+ padding: 0;
+ font-size: 0.875em;
+}
+
+.tiptap-content .ProseMirror blockquote {
+ border-left: 3px solid var(--border);
+ padding-left: 1rem;
+ color: var(--muted-foreground);
+}
+
+.tiptap-content .ProseMirror a {
+ color: var(--primary);
+ text-decoration: underline;
+ text-underline-offset: 2px;
+}
+
+.tiptap-content .ProseMirror hr {
+ border: 0;
+ border-top: 1px solid var(--border);
+ margin: 1.5rem 0;
+}
diff --git a/frontend/types/tiptap.d.ts b/frontend/types/tiptap.d.ts
new file mode 100644
index 00000000..a73d2a87
--- /dev/null
+++ b/frontend/types/tiptap.d.ts
@@ -0,0 +1,7 @@
+import type { MarkdownStorage } from 'tiptap-markdown';
+
+declare module '@tiptap/core' {
+ interface Storage {
+ markdown: MarkdownStorage;
+ }
+}