feat: editor improvements and architectural grid prototype
Multiple feature additions and improvements across the application: - NextGen Editor: drag handles, smart paste, block actions - Structured views: Kanban and table layouts for notes - Architectural Grid: new brainstorming/agent interface prototype - Flashcards: SM-2 revision algorithm with AI generation - MCP server: robustness improvements - Graph/PDF chat: fix click propagation and copy behavior - Various UI/UX enhancements and bug fixes Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,12 +2,7 @@ import { cookies } from 'next/headers'
|
||||
import { getAllNotes } from '@/app/actions/notes'
|
||||
import { getAISettings } from '@/app/actions/ai-settings'
|
||||
import { HomeClient } from '@/components/home-client'
|
||||
import {
|
||||
NOTES_LAYOUT_COOKIE,
|
||||
NOTES_VIEW_TYPE_COOKIE,
|
||||
parseNotesLayoutMode,
|
||||
parseNotesViewType,
|
||||
} from '@/lib/notes-view-preference'
|
||||
import { NOTES_LAYOUT_COOKIE, parseNotesLayoutMode } from '@/lib/notes-view-preference'
|
||||
|
||||
export default async function HomePage() {
|
||||
const [allNotes, settings, cookieStore] = await Promise.all([
|
||||
@@ -17,13 +12,11 @@ export default async function HomePage() {
|
||||
])
|
||||
|
||||
const initialLayoutMode = parseNotesLayoutMode(cookieStore.get(NOTES_LAYOUT_COOKIE)?.value)
|
||||
const initialViewType = parseNotesViewType(cookieStore.get(NOTES_VIEW_TYPE_COOKIE)?.value)
|
||||
|
||||
return (
|
||||
<HomeClient
|
||||
initialNotes={allNotes}
|
||||
initialLayoutMode={initialLayoutMode}
|
||||
initialViewType={initialViewType}
|
||||
initialSettings={{
|
||||
showRecentNotes: settings?.showRecentNotes !== false,
|
||||
noteHistory: settings?.noteHistory === true,
|
||||
|
||||
@@ -1,16 +1,7 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { auth } from '@/auth'
|
||||
|
||||
function extractBlockContent(html: string, blockId: string): string | null {
|
||||
const regex = new RegExp(
|
||||
`<(?:p|h[1-6]|blockquote)[^>]*data-id="${blockId}"[^>]*>([\\s\\S]*?)<\\/(?:p|h[1-6]|blockquote)>`,
|
||||
'i'
|
||||
)
|
||||
const match = regex.exec(html)
|
||||
if (!match) return null
|
||||
return match[1].replace(/<[^>]+>/g, '').trim()
|
||||
}
|
||||
import { extractBlockContentById } from '@/lib/blocks/extract-blocks'
|
||||
|
||||
// GET /api/blocks/[blockId]/status?sourceNoteId=xxx
|
||||
export async function GET(
|
||||
@@ -38,7 +29,7 @@ export async function GET(
|
||||
return NextResponse.json({ exists: false, content: '', sourceNoteTitle: '' })
|
||||
}
|
||||
|
||||
const content = extractBlockContent(note.content, blockId)
|
||||
const content = extractBlockContentById(note.content, blockId)
|
||||
|
||||
if (content === null) {
|
||||
return NextResponse.json({ exists: false, content: '', sourceNoteTitle: note.title || '' })
|
||||
|
||||
@@ -1035,106 +1035,59 @@ html.font-system * {
|
||||
/* --- Editor Wrapper --- */
|
||||
.notion-editor-wrapper {
|
||||
position: relative;
|
||||
padding-left: 36px; /* Espace gutter pour la poignée */
|
||||
}
|
||||
|
||||
/* --- Drag Handle Gutter --- */
|
||||
.notion-drag-handle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 24px;
|
||||
height: 28px; /* Légèrement plus grand pour faciliter la sélection */
|
||||
border-radius: 6px;
|
||||
color: var(--muted-foreground);
|
||||
/* Animation de glissement fluide (top) et d'échelle au clic */
|
||||
transition: opacity 0.2s ease,
|
||||
top 0.12s cubic-bezier(0.25, 1, 0.5, 1),
|
||||
background-color 0.15s ease,
|
||||
color 0.15s ease,
|
||||
transform 0.15s ease;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.notion-drag-handle:hover {
|
||||
background-color: rgba(59, 130, 246, 0.15); /* blue-500 @ 15% */
|
||||
color: #3b82f6; /* blue-500 */
|
||||
}
|
||||
|
||||
.dark .notion-drag-handle:hover {
|
||||
background-color: rgba(59, 130, 246, 0.25);
|
||||
color: #60a5fa; /* blue-400 */
|
||||
}
|
||||
|
||||
.notion-drag-handle:active {
|
||||
transform: scale(0.9);
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
.notion-drag-handle-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: none;
|
||||
border: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
cursor: pointer;
|
||||
color: inherit;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* --- Styles pour l'extension officielle Tiptap DragHandle --- */
|
||||
/* --- Drag Handle (Novel / global-drag-handle) --- */
|
||||
.drag-handle {
|
||||
position: absolute;
|
||||
z-index: 50;
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
justify-content: center;
|
||||
user-select: none;
|
||||
cursor: grab;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity 0.15s ease, transform 0.12s ease;
|
||||
transform: translateX(0);
|
||||
}
|
||||
|
||||
.drag-handle.visible {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.drag-handle[data-dragging="true"] {
|
||||
cursor: grabbing;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/* Inner content wrapper - positioned in gutter */
|
||||
.drag-handle > .notion-drag-handle {
|
||||
position: fixed;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 24px;
|
||||
min-height: 28px;
|
||||
border-radius: 6px;
|
||||
width: 1.25rem;
|
||||
height: 1.5rem;
|
||||
border-radius: 4px;
|
||||
color: var(--muted-foreground);
|
||||
background: transparent;
|
||||
transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
|
||||
flex-shrink: 0;
|
||||
opacity: 1;
|
||||
z-index: 50;
|
||||
cursor: grab;
|
||||
user-select: none;
|
||||
transition: opacity 0.15s ease, background-color 0.15s ease;
|
||||
}
|
||||
|
||||
.drag-handle.visible > .notion-drag-handle:hover {
|
||||
background-color: rgba(59, 130, 246, 0.15);
|
||||
.drag-handle:hover {
|
||||
background-color: rgba(59, 130, 246, 0.12);
|
||||
color: #3b82f6;
|
||||
}
|
||||
|
||||
.dark .drag-handle.visible > .notion-drag-handle:hover {
|
||||
background-color: rgba(59, 130, 246, 0.25);
|
||||
.dark .drag-handle:hover {
|
||||
background-color: rgba(59, 130, 246, 0.22);
|
||||
color: #60a5fa;
|
||||
}
|
||||
|
||||
.drag-handle:active > .notion-drag-handle {
|
||||
transform: scale(0.9);
|
||||
.drag-handle:active {
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
.drag-handle.hide {
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@media (pointer: coarse) {
|
||||
.drag-handle {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Curseur pendant le drag de bloc */
|
||||
.notion-editor-wrapper .ProseMirror.dragging {
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
/* Pas de surbrillance node pendant le drag (Novel) */
|
||||
.notion-editor-wrapper .ProseMirror:not(.dragging) .ProseMirror-selectednode,
|
||||
.notion-editor-wrapper .ProseMirror:not(.dragging) .ProseMirror-selectednoderange {
|
||||
outline: none !important;
|
||||
}
|
||||
|
||||
/* --- Block Action Menu (glassmorphism dropdown) --- */
|
||||
@@ -1197,6 +1150,30 @@ html.font-system * {
|
||||
color: #f87171;
|
||||
}
|
||||
|
||||
.smart-paste-menu {
|
||||
min-width: 240px;
|
||||
padding: 8px 4px 4px;
|
||||
}
|
||||
|
||||
.smart-paste-menu__hint {
|
||||
margin: 0 12px 4px;
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.02em;
|
||||
text-transform: uppercase;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
.smart-paste-menu__source {
|
||||
margin: 0 12px 8px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
line-height: 1.3;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.block-action-separator {
|
||||
height: 1px;
|
||||
margin: 4px 8px;
|
||||
@@ -1233,6 +1210,296 @@ html.font-system * {
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
/* --- Inline Database Block (US-NEXTGEN-EDITOR) --- */
|
||||
.database-block-wrapper {
|
||||
margin: 0.75rem 0;
|
||||
}
|
||||
|
||||
.database-block__inner {
|
||||
border: 1px solid #e8e6e3;
|
||||
border-radius: 12px;
|
||||
background: rgba(255, 255, 255, 0.6);
|
||||
padding: 1rem 1.1rem;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.dark .database-block__inner {
|
||||
border-color: rgba(255, 255, 255, 0.08);
|
||||
background: rgba(24, 24, 27, 0.5);
|
||||
}
|
||||
|
||||
.database-block__header {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.75rem;
|
||||
margin-bottom: 0.35rem;
|
||||
}
|
||||
|
||||
.database-block__title {
|
||||
display: block;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 700;
|
||||
color: var(--color-ink, #1a1a1a);
|
||||
}
|
||||
|
||||
.database-block__id {
|
||||
display: block;
|
||||
font-size: 0.65rem;
|
||||
font-family: ui-monospace, monospace;
|
||||
opacity: 0.45;
|
||||
margin-top: 0.1rem;
|
||||
}
|
||||
|
||||
.database-block__hint {
|
||||
font-size: 0.72rem;
|
||||
opacity: 0.55;
|
||||
margin: 0 0 0.85rem;
|
||||
}
|
||||
|
||||
.database-block__view-toggle {
|
||||
display: inline-flex;
|
||||
padding: 2px;
|
||||
border-radius: 8px;
|
||||
background: rgba(0, 0, 0, 0.04);
|
||||
border: 1px solid rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
.dark .database-block__view-toggle {
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
border-color: rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
|
||||
.database-block__view-toggle button {
|
||||
border: none;
|
||||
background: transparent;
|
||||
font-size: 0.68rem;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
padding: 0.35rem 0.65rem;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
opacity: 0.65;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.database-block__view-toggle button.is-active {
|
||||
background: white;
|
||||
opacity: 1;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.dark .database-block__view-toggle button.is-active {
|
||||
background: rgba(255, 255, 255, 0.12);
|
||||
}
|
||||
|
||||
.database-block__table-wrap {
|
||||
overflow-x: auto;
|
||||
border-radius: 8px;
|
||||
border: 1px solid rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
.dark .database-block__table-wrap {
|
||||
border-color: rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
|
||||
.database-block__table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.database-block__table th {
|
||||
text-align: left;
|
||||
padding: 0.5rem 0.75rem;
|
||||
font-size: 0.65rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
opacity: 0.55;
|
||||
background: rgba(0, 0, 0, 0.02);
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
.database-block__table td {
|
||||
padding: 0.55rem 0.75rem;
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.04);
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.database-block__works-cell {
|
||||
max-width: 220px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.database-block__rollup {
|
||||
text-align: right;
|
||||
font-weight: 700;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.database-block__delete-btn {
|
||||
border: none;
|
||||
background: transparent;
|
||||
font-size: 0.65rem;
|
||||
opacity: 0.45;
|
||||
cursor: pointer;
|
||||
color: #ef4444;
|
||||
}
|
||||
|
||||
.database-block__delete-btn:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.database-block__inline-form,
|
||||
.database-block__book-form {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
margin-top: 0.75rem;
|
||||
padding-top: 0.75rem;
|
||||
border-top: 1px dashed rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.database-block__book-form {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.database-block__form-label,
|
||||
.database-block__form-heading {
|
||||
font-size: 0.68rem;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
opacity: 0.55;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.database-block__input {
|
||||
font-size: 0.8rem;
|
||||
padding: 0.45rem 0.65rem;
|
||||
border-radius: 8px;
|
||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
||||
background: white;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.dark .database-block__input {
|
||||
background: rgba(0, 0, 0, 0.25);
|
||||
border-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.database-block__primary-btn,
|
||||
.database-block__submit {
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
background: #3b82f6;
|
||||
color: white;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
padding: 0.45rem 0.85rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.database-block__primary-btn:hover,
|
||||
.database-block__submit:hover {
|
||||
background: #2563eb;
|
||||
}
|
||||
|
||||
.database-block__card {
|
||||
position: relative;
|
||||
border-radius: 10px;
|
||||
overflow: hidden;
|
||||
border: 1px solid rgba(0, 0, 0, 0.08);
|
||||
background: white;
|
||||
}
|
||||
|
||||
.dark .database-block__card {
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
border-color: rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
|
||||
.database-block__card-delete {
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
right: 6px;
|
||||
z-index: 2;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
padding: 4px;
|
||||
background: rgba(0, 0, 0, 0.45);
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
transition: opacity 0.15s;
|
||||
}
|
||||
|
||||
.database-block__card:hover .database-block__card-delete {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.database-block__card-cover {
|
||||
aspect-ratio: 4 / 3;
|
||||
overflow: hidden;
|
||||
background: #f4f4f5;
|
||||
}
|
||||
|
||||
.database-block__card-cover img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.database-block__card-body {
|
||||
padding: 0.55rem 0.65rem 0.65rem;
|
||||
}
|
||||
|
||||
.database-block__card-title {
|
||||
font-size: 0.78rem;
|
||||
font-weight: 700;
|
||||
line-height: 1.3;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.database-block__tag {
|
||||
font-size: 0.62rem;
|
||||
font-weight: 600;
|
||||
padding: 0.15rem 0.4rem;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.database-block__tag--author {
|
||||
background: rgba(59, 130, 246, 0.12);
|
||||
color: #2563eb;
|
||||
}
|
||||
|
||||
.database-block__tag--genre {
|
||||
background: rgba(0, 0, 0, 0.06);
|
||||
opacity: 0.75;
|
||||
}
|
||||
|
||||
.database-block__card-placeholder {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 140px;
|
||||
border-radius: 10px;
|
||||
border: 2px dashed rgba(0, 0, 0, 0.08);
|
||||
opacity: 0.5;
|
||||
text-align: center;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
/* --- Drop Indicator Line --- */
|
||||
.notion-drop-indicator {
|
||||
position: absolute;
|
||||
@@ -1254,17 +1521,30 @@ html.font-system * {
|
||||
}
|
||||
|
||||
/* --- Selected Node Visual Highlight during Drag --- */
|
||||
.notion-editor-wrapper .ProseMirror-selectednode {
|
||||
.notion-editor-wrapper .ProseMirror-selectednode,
|
||||
.notion-editor-wrapper .ProseMirror-selectednoderange {
|
||||
position: relative;
|
||||
outline: none !important;
|
||||
background-color: rgba(59, 130, 246, 0.08) !important;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4) !important;
|
||||
transition: background-color 0.2s ease, box-shadow 0.2s ease;
|
||||
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35) !important;
|
||||
}
|
||||
|
||||
.dark .notion-editor-wrapper .ProseMirror-selectednode {
|
||||
background-color: rgba(96, 165, 250, 0.15) !important;
|
||||
box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.5) !important;
|
||||
.notion-editor-wrapper .ProseMirror-selectednode::before,
|
||||
.notion-editor-wrapper .ProseMirror-selectednoderange::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: -0.25rem;
|
||||
background-color: rgba(59, 130, 246, 0.08);
|
||||
border-radius: 0.2rem;
|
||||
pointer-events: none;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.dark .notion-editor-wrapper .ProseMirror-selectednode,
|
||||
.dark .notion-editor-wrapper .ProseMirror-selectednoderange {
|
||||
background-color: rgba(96, 165, 250, 0.12) !important;
|
||||
box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.45) !important;
|
||||
}
|
||||
|
||||
/* --- Premium Drag Target Line (Dropcursor) --- */
|
||||
@@ -1287,10 +1567,13 @@ html.font-system * {
|
||||
.notion-editor-wrapper .ProseMirror {
|
||||
outline: none;
|
||||
min-height: 120px;
|
||||
padding: 4px 0;
|
||||
/* Gutter à gauche pour la poignée globale (Novel) */
|
||||
padding: 4px 0 4px 3rem;
|
||||
font-size: 0.9375rem;
|
||||
line-height: 1.7;
|
||||
caret-color: var(--primary);
|
||||
user-select: text;
|
||||
-webkit-user-select: text;
|
||||
}
|
||||
|
||||
.notion-editor-wrapper .ProseMirror>*:first-child {
|
||||
@@ -1341,18 +1624,21 @@ html.font-system * {
|
||||
/* --- Lists --- */
|
||||
.notion-editor-wrapper .ProseMirror ul {
|
||||
list-style-type: disc;
|
||||
padding-inline-start: 1.5rem;
|
||||
list-style-position: inside;
|
||||
padding-inline-start: 0;
|
||||
margin: 0.25em 0;
|
||||
}
|
||||
|
||||
.notion-editor-wrapper .ProseMirror ol {
|
||||
list-style-type: decimal;
|
||||
padding-inline-start: 1.5rem;
|
||||
list-style-position: inside;
|
||||
padding-inline-start: 0;
|
||||
margin: 0.25em 0;
|
||||
}
|
||||
|
||||
.notion-editor-wrapper .ProseMirror li>p {
|
||||
margin: 0.1em 0;
|
||||
padding-inline-start: 0.25rem;
|
||||
}
|
||||
|
||||
.notion-editor-wrapper .ProseMirror li>ul,
|
||||
@@ -2262,6 +2548,7 @@ html.font-system * {
|
||||
line-height: 1.875;
|
||||
color: var(--foreground);
|
||||
outline: none;
|
||||
padding-inline-start: 0;
|
||||
}
|
||||
|
||||
.fullpage-editor .ProseMirror p {
|
||||
|
||||
Reference in New Issue
Block a user