<commit_before>/* eslint-disable react/no-unused-prop-types */
import {
  useImperativeHandle,
  forwardRef,
  useState,
  Fragment,
  useCallback
} from "react"
import {OutputData} from "@editorjs/editorjs"

import type EditorJS from "@editorjs/editorjs"
import dynamic from "next/dynamic"
import Head from "next/head"

import {TitleEditor} from "./Title"
import type {ContentProps, OnContentEditorReadyHandler} from "./Content"
import type {TitleEditorOnChangeHandler} from "./Title"

const ContentEditor = dynamic<ContentProps>(

  () => import("component/Editor/Content").then(mod => mod.ContentEditor),

  {
    ssr: false
  }
)

interface EditorData {
  title: string
  content: OutputData
}

export interface EditorRef {
  save(): Promise<EditorData>
  clear(): void
}

type Ref = EditorRef | undefined

interface Props {
  title?: string
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
export const Editor = forwardRef<Ref, Props>((p, ref) => {
  const [title, setTitle] = useState(p.title || "")
  const [instance, setInstance] = useState<EditorJS>()

  useImperativeHandle(ref, () => ({
    save: () => instance!.save().then(content => ({title, content})),

    clear: () => instance!.clear()
  }))

  const onTitleChange: TitleEditorOnChangeHandler = text => setTitle(text)<commit_msg>Remove unnecessary comments<commit_after>/* eslint-disable react/no-unused-prop-types */
import {
  useImperativeHandle,
  forwardRef,
  useState,
  Fragment,
  useCallback
} from "react"
import {OutputData} from "@editorjs/editorjs"

import type EditorJS from "@editorjs/editorjs"
import dynamic from "next/dynamic"
import Head from "next/head"

import {TitleEditor} from "./Title"
import type {ContentProps, OnContentEditorReadyHandler} from "./Content"
import type {TitleEditorOnChangeHandler} from "./Title"

const ContentEditor = dynamic<ContentProps>(

  () => import("component/Editor/Content").then(mod => mod.ContentEditor),

  {
    ssr: false
  }
)

interface EditorData {
  title: string
  content: OutputData
}

export interface EditorRef {
  save(): Promise<EditorData>
  clear(): void
}

type Ref = EditorRef | undefined

interface Props {
  title?: string
}

export const Editor = forwardRef<Ref, Props>((p, ref) => {
  const [title, setTitle] = useState(p.title || "")
  const [instance, setInstance] = useState<EditorJS>()

  useImperativeHandle(ref, () => ({
    save: () => instance!.save().then(content => ({title, content})),

    clear: () => instance!.clear()
  }))

  const onTitleChange: TitleEditorOnChangeHandler = text => setTitle(text)
{'fraction_non_alphanumeric': 0.14070932922127988, 'fraction_numerical': 0.0, 'mean_word_length': 4.715859030837004, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1984570', 'n_tokens_mistral': 797, 'n_tokens_neox': 787, 'n_words': 198}