Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

Renaming files and tidying up a bit

Matt Roberts74cc6979e3b9
diff --git a/public/components/common/form/SlateEditor.scss b/public/components/common/form/CommentEditor.scss
similarity index 100%
rename from public/components/common/form/SlateEditor.scss
rename to public/components/common/form/CommentEditor.scss
diff --git a/public/components/common/form/SlateEditor2.tsx b/public/components/common/form/CommentEditor.tsx
similarity index 99%
rename from public/components/common/form/SlateEditor2.tsx
rename to public/components/common/form/CommentEditor.tsx
index ba99a6c0b..c41e3503b 100644
--- a/public/components/common/form/SlateEditor2.tsx
+++ b/public/components/common/form/CommentEditor.tsx
@@ -9,7 +9,7 @@ import ReactDOM from "react-dom"
import { UserNames } from "@fider/models"
import { actions } from "@fider/services"
-import "./SlateEditor.scss"
+import "./CommentEditor.scss"
export type TextType = { text: string }
@@ -155,8 +155,6 @@ export const CommentEditor: React.FunctionComponent<CommentEditorProps> = (props
const initialValue = props.initialValue ? deserialize(props.initialValue) : emptyValue
- console.log(JSON.stringify(initialValue))
-
return (
<Slate
editor={editor}
diff --git a/public/components/common/form/SlateEditor.tsx b/public/components/common/form/SlateEditor.tsx
deleted file mode 100644
index 4789413cf..000000000
--- a/public/components/common/form/SlateEditor.tsx
+++ /dev/null
@@ -1,59 +0,0 @@
-// import React, { useState } from "react"
-// import { createEditor } from "slate"
-// // Import the Slate components and React plugin.
-// import { Slate, Editable, withReact } from "slate-react"
-// //
-// // TypeScript users only add this code
-// import { BaseEditor, Descendant, Node } from "slate"
-// import { ReactEditor } from "slate-react"
-// import "./SlateEditor.scss"
-
-// export type Paragraph = { type: "paragraph"; children: Text[] }
-// export type Text = { text: string }
-
-// declare module "slate2" {
-// interface CustomTypes {
-// Editor: BaseEditor & ReactEditor
-// Element: Paragraph
-// Text: Text
-// }
-// }
-
-// const emptyValue: Descendant[] = [
-// {
-// type: "paragraph",
-// children: [{ text: "" }],
-// },
-// ]
-
-// interface SlateEditorProps {
-// initialValue?: Descendant[]
-// disabled?: boolean
-// placeholder?: string
-// onChange?: (value: Descendant[]) => void
-// onFocus?: React.FocusEventHandler<HTMLDivElement>
-// className?: string
-// }
-
-// export const SlateEditor: React.FunctionComponent<SlateEditorProps> = (props) => {
-// const [editor] = useState(() => withReact(createEditor()))
-// console.log(props.initialValue)
-
-// return (
-// <Slate editor={editor} initialValue={props.initialValue || emptyValue} onChange={props.onChange}>
-// <Editable className="slate-editor" onFocus={props.onFocus} placeholder={props.placeholder} readOnly={props.disabled} />
-// </Slate>
-// )
-// }
-
-// export const Serialize = (nodes: Descendant[]): string => {
-// return nodes.map((n) => Node.string(n)).join("\n")
-// }
-
-// export const Deserialize = (value: string): Descendant[] => {
-// return value.split("\n").map((line) => {
-// return {
-// children: [{ text: line }],
-// } as Descendant
-// })
-// }
diff --git a/public/components/common/index.tsx b/public/components/common/index.tsx
index 6908a513f..8c1551867 100644
--- a/public/components/common/index.tsx
+++ b/public/components/common/index.tsx
@@ -9,7 +9,7 @@ export * from "./form/DisplayError"
export * from "./form/Select"
export * from "./form/Field"
export * from "./form/Checkbox"
-export * from "./form/SlateEditor2"
+export * from "./form/CommentEditor"
export * from "./form/ImageViewer"
export * from "./Markdown"
export * from "./DevBanner"
diff --git a/public/pages/ShowPost/components/ShowComment.tsx b/public/pages/ShowPost/components/ShowComment.tsx
index 111eddbd5..1a7fbc790 100644
--- a/public/pages/ShowPost/components/ShowComment.tsx
+++ b/public/pages/ShowPost/components/ShowComment.tsx
@@ -20,7 +20,6 @@ import { formatDate, Failure, actions, notify, copyToClipboard, classSet, clearU
import { useFider } from "@fider/hooks"
import IconDotsHorizontal from "@fider/assets/images/heroicons-dots-horizontal.svg"
import { t, Trans } from "@lingui/macro"
-// import { Deserialize, Serialize} from "@fider/components/common/form/SlateEditor"
interface ShowCommentProps {
post: Post