Skip to content

A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.

feat: toolbar for tiptap editor

dextmorgndfc958884b59
diff --git a/flowsint-app/src/renderer/src/components/analyses/analysis-editor.tsx b/flowsint-app/src/renderer/src/components/analyses/analysis-editor.tsx
index 6404a432..9d66d1e6 100644
--- a/flowsint-app/src/renderer/src/components/analyses/analysis-editor.tsx
+++ b/flowsint-app/src/renderer/src/components/analyses/analysis-editor.tsx
@@ -41,6 +41,7 @@ interface AnalysisEditorProps {
// UI customization
showHeader?: boolean
showActions?: boolean
+ showToolbar?: boolean
showAnalysisSelector?: boolean
showNavigation?: boolean
className?: string
@@ -68,7 +69,8 @@ export const AnalysisEditor = ({
className = "",
isLoading = false,
analyses = [],
- currentAnalysisId
+ currentAnalysisId,
+ showToolbar = false
}: AnalysisEditorProps) => {
const { confirm } = useConfirm()
const toggleAnalysis = useLayoutStore(s => s.toggleAnalysis)
@@ -446,6 +448,7 @@ export const AnalysisEditor = ({
output="json"
placeholder="Enter your analysis..."
autofocus={true}
+ showToolbar={showToolbar}
editable={true}
editorClassName="focus:outline-hidden"
onEditorReady={setEditor}
@@ -468,4 +471,4 @@ export const AnalysisEditor = ({
</div>
</div>
)
-}
\ No newline at end of file
+}
diff --git a/flowsint-app/src/renderer/src/components/analyses/analysis-page.tsx b/flowsint-app/src/renderer/src/components/analyses/analysis-page.tsx
index 868453c3..db341807 100644
--- a/flowsint-app/src/renderer/src/components/analyses/analysis-page.tsx
+++ b/flowsint-app/src/renderer/src/components/analyses/analysis-page.tsx
@@ -30,6 +30,7 @@ export const AnalysisPage = ({ analysis, isLoading, isError, refetch }: { analys
<div className="flex flex-col h-full w-full">
{/* Analysis Editor */}
<AnalysisEditor
+ showToolbar={true}
analysis={analysis || null}
investigationId={investigationId}
onAnalysisUpdate={handleAnalysisUpdate}
@@ -40,4 +41,4 @@ export const AnalysisPage = ({ analysis, isLoading, isError, refetch }: { analys
/>
</div>
)
-}
\ No newline at end of file
+}
diff --git a/flowsint-app/src/renderer/src/components/analyses/editor/minimal-tiptap.tsx b/flowsint-app/src/renderer/src/components/analyses/editor/minimal-tiptap.tsx
index 8980bb73..e96fcb95 100644
--- a/flowsint-app/src/renderer/src/components/analyses/editor/minimal-tiptap.tsx
+++ b/flowsint-app/src/renderer/src/components/analyses/editor/minimal-tiptap.tsx
@@ -21,15 +21,14 @@ export interface MinimalTiptapProps
className?: string
editorContentClassName?: string
onEditorReady?: (editor: Editor) => void
+ showToolbar?:boolean
}
//@ts-ignore
const Toolbar = ({ editor }: { editor: Editor }) => (
<div className="shrink-0 overflow-x-auto border-b border-border p-2">
<div className="flex w-max items-center gap-px">
<SectionOne editor={editor} activeLevels={[1, 2, 3, 4, 5, 6]} />
-
<Separator orientation="vertical" className="mx-2 h-7" />
-
<SectionTwo
editor={editor}
activeActions={[
@@ -42,21 +41,15 @@ const Toolbar = ({ editor }: { editor: Editor }) => (
]}
mainActionCount={3}
/>
-
<Separator orientation="vertical" className="mx-2 h-7" />
-
<SectionThree editor={editor} />
-
<Separator orientation="vertical" className="mx-2 h-7" />
-
<SectionFour
editor={editor}
activeActions={["orderedList", "bulletList"]}
mainActionCount={0}
/>
-
<Separator orientation="vertical" className="mx-2 h-7" />
-
<SectionFive
editor={editor}
activeActions={["codeBlock", "blockquote", "horizontalRule"]}
@@ -69,7 +62,7 @@ const Toolbar = ({ editor }: { editor: Editor }) => (
export const MinimalTiptapEditor = React.forwardRef<
HTMLDivElement,
MinimalTiptapProps
->(({ value, onChange, className, editorContentClassName, onEditorReady, ...props }, ref) => {
+>(({ value, onChange, className, editorContentClassName, onEditorReady, showToolbar=false, ...props }, ref) => {
const editor = useMinimalTiptapEditor({
value,
onUpdate: onChange,
@@ -96,7 +89,7 @@ export const MinimalTiptapEditor = React.forwardRef<
className
)}
>
- {/* <Toolbar editor={editor} /> */}
+ {showToolbar && <div className="border-t"><Toolbar editor={editor} /></div>}
<EditorContent
editor={editor}
className={cn("minimal-tiptap-editor prose dark:prose-invert p-8 w-full max-w-4xl mx-auto", editorContentClassName)}