feat: views added to cycles, fix: overflowing issues
This commit is contained in:
commit
9c18f6fc71
94 changed files with 5316 additions and 2277 deletions
|
|
@ -27,7 +27,7 @@ import { getValidatedValue } from "./helpers/editor";
|
|||
import LexicalErrorBoundary from "@lexical/react/LexicalErrorBoundary";
|
||||
|
||||
export interface RichTextEditorProps {
|
||||
onChange: (state: SerializedEditorState) => void;
|
||||
onChange: (state: string) => void;
|
||||
id: string;
|
||||
value: string;
|
||||
placeholder?: string;
|
||||
|
|
@ -41,8 +41,7 @@ const RichTextEditor: React.FC<RichTextEditorProps> = ({
|
|||
}) => {
|
||||
const handleChange = (editorState: EditorState) => {
|
||||
editorState.read(() => {
|
||||
let editorData = editorState.toJSON();
|
||||
if (onChange) onChange(editorData);
|
||||
onChange(JSON.stringify(editorState.toJSON()));
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -18,10 +18,12 @@ export const getValidatedValue = (value: string) => {
|
|||
const defaultValue =
|
||||
'{"root":{"children":[{"children":[],"direction":null,"format":"","indent":0,"type":"paragraph","version":1}],"direction":null,"format":"","indent":0,"type":"root","version":1}}';
|
||||
|
||||
console.log("Value: ", value);
|
||||
|
||||
if (value) {
|
||||
try {
|
||||
console.log(value);
|
||||
return value;
|
||||
const data = JSON.parse(value);
|
||||
return JSON.stringify(data);
|
||||
} catch (e) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue