import React, { useState } from "react";
import { storiesOf } from "@storybook/react";
import { action } from "@storybook/addon-actions";
import { withInfo } from "@storybook/addon-info";
import { withKnobs, number, boolean, select } from "@storybook/addon-knobs";
import { addReadme } from "storybook-readme";
import { BarftEditorPage } from "@components/Editor/BraftEditor";
import { ContentUtils } from "braft-utils";
import EditorData from "./data/articleData.json";
import { Divider, Popover } from "antd";
import BraftEditor from "braft-editor";
const stories = storiesOf("Editor", module);
stories.addDecorator(storyFn => (
{storyFn()}
));
stories.addDecorator(withKnobs);
stories.addDecorator(withInfo);
stories.addDecorator(addReadme);
stories.add(
"BraftEditor",
() => {
return ;
},
{
info: {
inline: true
},
notes: "A very simple example of addon notes"
}
);
stories.add(
"BraftEditorCommon",
() => {
const [editorState, setEditorState] = useState(
BraftEditor.createEditorState("Hello World!
")
);
return (
<>
非受控组件
受控组件
{
const IconWrapStyle = {
cursor: "pointer",
textAlign: "center" as const,
width: "42px"
};
const IconStyle = { fontSize: "21px" };
return (
<>
{
setEditorState(
ContentUtils.insertText(editorState, "Hello World")
);
}}
>
>
);
}}
/>
>
);
},
{
info: {
inline: true
},
notes: "A very simple example of addon notes"
}
);