canner-slate-editor
canner-slate-editor copied to clipboard
Nextjs
Can you show example your slate with Next.js? Markdown with Toolbar and serialize/deserializer into Markdown (or HTML) format
My sample doesn't work:
// @flow
import React from "react";
import ReactDOM from "react-dom";
import { Value } from "slate";
import Editor from "slate-md-editor";
const initialValue = Value.fromJSON({
document: {
nodes: [
{
object: "block",
type: "paragraph",
nodes: [
{
object: "text",
leaves: [
{
text: "A line of text in a paragraph."
}
]
}
]
}
]
}
});
class DemoEditor extends React.Component {
// Set the initial state when the app is first constructed.
state = {
value: initialValue
};
render() {
const { value } = this.state;
const onChange = ({ value }) => this.setState({ value });
return (
<div style={{ margin: "20px" }}>
<Editor value={value} onChange={this.onChange} />;
</div>
);
}
}
export default DemoEditor
@markolofsen Hi, have you solved this problem? Any help would be appreciated!