-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
2,255 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "editor", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "src/index.ts", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@lexical/clipboard": "^0.6.5", | ||
"@lexical/code": "^0.6.5", | ||
"@lexical/link": "^0.6.5", | ||
"@lexical/list": "^0.6.5", | ||
"@lexical/markdown": "^0.6.5", | ||
"@lexical/react": "^0.6.5", | ||
"@lexical/rich-text": "^0.6.5", | ||
"@lexical/selection": "^0.6.5", | ||
"@lexical/table": "^0.6.5", | ||
"@lexical/utils": "^0.6.5", | ||
"lexical": "^0.6.5", | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0", | ||
"yjs": "^13.5.43" | ||
}, | ||
"devDependencies": { | ||
"typescript": "4.9.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import Theme from "./themes/Theme"; | ||
import { | ||
InitialConfigType, | ||
LexicalComposer, | ||
} from "@lexical/react/LexicalComposer"; | ||
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin"; | ||
import { ContentEditable } from "@lexical/react/LexicalContentEditable"; | ||
import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin"; | ||
import { AutoFocusPlugin } from "@lexical/react/LexicalAutoFocusPlugin"; | ||
import LexicalErrorBoundary from "@lexical/react/LexicalErrorBoundary"; | ||
import ToolbarPlugin from "./plugins/ToolbarPlugin"; | ||
import { HeadingNode, QuoteNode } from "@lexical/rich-text"; | ||
import { TableCellNode, TableNode, TableRowNode } from "@lexical/table"; | ||
import { ListItemNode, ListNode } from "@lexical/list"; | ||
import { CodeHighlightNode, CodeNode } from "@lexical/code"; | ||
import { AutoLinkNode, LinkNode } from "@lexical/link"; | ||
import { LinkPlugin } from "@lexical/react/LexicalLinkPlugin"; | ||
import { ListPlugin } from "@lexical/react/LexicalListPlugin"; | ||
import { MarkdownShortcutPlugin } from "@lexical/react/LexicalMarkdownShortcutPlugin"; | ||
import { TRANSFORMERS } from "@lexical/markdown"; | ||
import React, { useMemo } from "react"; | ||
import { | ||
LexicalComposerContext, | ||
useLexicalComposerContext, | ||
} from "@lexical/react/LexicalComposerContext"; | ||
import { SaveAndLoadPlugin } from "./plugins/SaveAndLoadPlugin"; | ||
|
||
function Placeholder() { | ||
return <div className="editor-placeholder">Enter some rich text...</div>; | ||
} | ||
|
||
type Props = { | ||
initialValue?: string; | ||
onChange?: (value: string) => void; | ||
}; | ||
|
||
export function Editor({ initialValue, onChange }: Props) { | ||
const editorConfig: InitialConfigType = useMemo(() => { | ||
return { | ||
// The editor theme | ||
theme: Theme, | ||
// Handling of errors during update | ||
onError(error: any) { | ||
throw error; | ||
}, | ||
namespace: "editor", | ||
// Any custom nodes go here | ||
nodes: [ | ||
HeadingNode, | ||
ListNode, | ||
ListItemNode, | ||
QuoteNode, | ||
CodeNode, | ||
CodeHighlightNode, | ||
TableNode, | ||
TableCellNode, | ||
TableRowNode, | ||
AutoLinkNode, | ||
LinkNode, | ||
], | ||
}; | ||
}, [initialValue]); | ||
|
||
return ( | ||
<LexicalComposer initialConfig={editorConfig}> | ||
<div className="editor-container"> | ||
<ToolbarPlugin /> | ||
<div className="editor-inner"> | ||
<RichTextPlugin | ||
contentEditable={<ContentEditable className="editor-input" />} | ||
placeholder={<Placeholder />} | ||
ErrorBoundary={LexicalErrorBoundary} | ||
/> | ||
<HistoryPlugin /> | ||
<AutoFocusPlugin /> | ||
<ListPlugin /> | ||
<LinkPlugin /> | ||
<MarkdownShortcutPlugin transformers={TRANSFORMERS} /> | ||
<SaveAndLoadPlugin | ||
value={initialValue} | ||
onChange={(value) => { | ||
if (onChange) { | ||
onChange(value); | ||
} | ||
}} | ||
/> | ||
</div> | ||
</div> | ||
</LexicalComposer> | ||
); | ||
} | ||
|
||
export default Editor; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
OpenMoji | ||
https://openmoji.org | ||
|
||
Licensed under Attribution-ShareAlike 4.0 International | ||
https://creativecommons.org/licenses/by-sa/4.0/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Bootstrap Icons | ||
https://icons.getbootstrap.com | ||
|
||
Licensed under MIT license | ||
https://github.com/twbs/icons/blob/main/LICENSE.md |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { Editor } from "./Editor"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// @flow | ||
import * as React from "react"; | ||
import { OnChangePlugin } from "@lexical/react/LexicalOnChangePlugin"; | ||
import { useEffect } from "react"; | ||
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext"; | ||
|
||
type Props = { | ||
value?: string; | ||
onChange: (value: string) => void; | ||
}; | ||
|
||
export function SaveAndLoadPlugin(props: Props) { | ||
const [editor] = useLexicalComposerContext(); | ||
|
||
useEffect(() => { | ||
if (props.value) { | ||
const state = editor.parseEditorState(props.value); | ||
editor.setEditorState(state); | ||
} | ||
}, [editor]); | ||
|
||
return ( | ||
<OnChangePlugin | ||
onChange={(editorState, editor) => { | ||
props.onChange(JSON.stringify(editorState)); | ||
}} | ||
/> | ||
); | ||
} |
Oops, something went wrong.
e2b07d1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
video-trading – ./
video-trading-git-main-etherdata-blockchain.vercel.app
video-trading-etherdata-blockchain.vercel.app
video-trading.vercel.app
video2.trade
www.video2.trade