canner-slate-editor icon indicating copy to clipboard operation
canner-slate-editor copied to clipboard

Nextjs

Open markolofsen opened this issue 6 years ago • 1 comments

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 avatar Oct 27 '18 16:10 markolofsen

@markolofsen Hi, have you solved this problem? Any help would be appreciated!

sukechris avatar Dec 24 '18 18:12 sukechris