diff --git a/apps/web/src/components/ui/report/EditorContainer.tsx b/apps/web/src/components/ui/report/EditorContainer.tsx
index 0908b887e..193de6eff 100644
--- a/apps/web/src/components/ui/report/EditorContainer.tsx
+++ b/apps/web/src/components/ui/report/EditorContainer.tsx
@@ -16,7 +16,7 @@ const editorContainerVariants = cva('relative cursor-text h-full p-4', {
comment: 'bg-background/50'
},
readonly: {
- true: 'cursor-not-allowed'
+ true: 'cursor-text'
}
},
defaultVariants: {
diff --git a/apps/web/src/components/ui/report/elements/BlockDraggable.tsx b/apps/web/src/components/ui/report/elements/BlockDraggable.tsx
index cd709773a..fac16c895 100644
--- a/apps/web/src/components/ui/report/elements/BlockDraggable.tsx
+++ b/apps/web/src/components/ui/report/elements/BlockDraggable.tsx
@@ -4,8 +4,8 @@ import * as React from 'react';
import { DndPlugin, useDraggable, useDropLine } from '@platejs/dnd';
import { BlockSelectionPlugin } from '@platejs/selection/react';
-import { GripDotsVertical } from '@/components/ui/icons';
-import { getPluginByType, isType, KEYS, type TElement } from 'platejs';
+import { GripDotsVertical, Plus } from '@/components/ui/icons';
+import { getPluginByType, isType, KEYS, type SlateRenderNodeProps, type TElement } from 'platejs';
import {
type PlateEditor,
type PlateElementProps,
@@ -109,23 +109,27 @@ function Draggable(props: PlateElementProps) {
+
+ data-plate-prevent-deselect
+ prefix={
+
+ }>
@@ -148,6 +152,59 @@ function Draggable(props: PlateElementProps) {
);
}
+
+function AddNewBlockButton({
+ style,
+ className
+}: {
+ style: React.CSSProperties;
+ className: string;
+}) {
+ const editor = useEditorRef();
+ const path = usePath();
+
+ const handleClick = (event: React.MouseEvent) => {
+ // build the insertion point based on modifier key
+ const parentPath = path.slice(0, -1);
+ const currentIndex = path[path.length - 1];
+
+ // Option/Alt key adds before, regular click adds after
+ const insertIndex = event.altKey ? currentIndex : currentIndex + 1;
+
+ editor.tf.insertNodes(
+ { type: 'p', children: [{ text: '' }] },
+ { at: [...parentPath, insertIndex] }
+ );
+
+ setTimeout(() => {
+ // Calculate the path to the start of the new paragraph's text
+ const newNodePath = [...parentPath, insertIndex];
+ const textPath = [...newNodePath, 0]; // Path to the first text node
+
+ // Set the selection to the start of the new paragraph
+ editor.tf.select({
+ anchor: { path: textPath, offset: 0 },
+ focus: { path: textPath, offset: 0 }
+ });
+
+ // Ensure the editor is focused
+ editor.tf.focus();
+ }, 25);
+ };
+
+ return (
+
+ }
+ style={style}
+ />
+
+ );
+}
+
function Gutter({ children, className, ...props }: React.ComponentProps<'div'>) {
const editor = useEditorRef();
const element = useElement();
diff --git a/apps/web/src/components/ui/report/elements/CalloutNode.tsx b/apps/web/src/components/ui/report/elements/CalloutNode.tsx
index 5f0d0c6e2..8c0eb1cdf 100644
--- a/apps/web/src/components/ui/report/elements/CalloutNode.tsx
+++ b/apps/web/src/components/ui/report/elements/CalloutNode.tsx
@@ -29,7 +29,7 @@ export function CalloutElement({
return (
- {children}
+ {children}
);
diff --git a/apps/web/src/components/ui/report/elements/CodeBlockNode.tsx b/apps/web/src/components/ui/report/elements/CodeBlockNode.tsx
index a3dd61dfa..762df7f48 100644
--- a/apps/web/src/components/ui/report/elements/CodeBlockNode.tsx
+++ b/apps/web/src/components/ui/report/elements/CodeBlockNode.tsx
@@ -33,9 +33,9 @@ export function CodeBlockElement(props: PlateElementProps) {
return (
-