• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mizchi / next-editor / 1409

pending completion
1409

Pull #349

circleci

web-flow
chore(deps): update babel monorepo
Pull Request #349: chore(deps): update babel monorepo

95 of 450 branches covered (21.11%)

Branch coverage included in aggregate %.

967 of 2058 relevant lines covered (46.99%)

1.93 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/editors/WysiwygEditor.tsx
1
import React from "react"
×
2
import RichTextEditor from "react-rte"
×
3
import { EditorInterface } from "./EditorInterface"
4

5
type Props = EditorInterface
6

7
export class WysiwygEditor extends React.Component<
×
8
  Props,
9
  {
10
    value: any
11
  }
12
> {
13
  toolbarConfig = {
×
14
    // Optionally specify the groups to display (displayed in the order listed).
15
    display: [
16
      "INLINE_STYLE_BUTTONS",
17
      "BLOCK_TYPE_BUTTONS",
18
      "LINK_BUTTONS",
19
      "BLOCK_TYPE_DROPDOWN"
20
      // "HISTORY_BUTTONS"
21
    ],
22
    INLINE_STYLE_BUTTONS: [
23
      { label: "Bold", style: "BOLD", className: "custom-css-class" },
24
      { label: "Italic", style: "ITALIC" },
25
      { label: "Underline", style: "UNDERLINE" }
26
    ],
27
    BLOCK_TYPE_DROPDOWN: [
28
      { label: "--", style: "unstyled" },
29
      { label: "H1", style: "header-one" },
30
      { label: "H2", style: "header-two" },
31
      { label: "H3", style: "header-three" }
32
    ],
33
    BLOCK_TYPE_BUTTONS: [
34
      { label: "UL", style: "unordered-list-item" },
35
      { label: "OL", style: "ordered-list-item" }
36
    ]
37
  }
38

39
  constructor(props: any) {
40
    super(props)
×
41
    this.state = {
×
42
      value: RichTextEditor.createValueFromString(
43
        props.initialValue || "",
×
44
        "markdown"
45
      )
46
    }
47
  }
48

49
  render() {
50
    return (
×
51
      <RichTextEditor
52
        spellCheck={false}
53
        toolbarConfig={this.toolbarConfig}
54
        value={this.state.value}
55
        onChange={(value: any) => {
56
          this.setState({ value })
×
57
          this.props.onChange(value.toString("markdown"))
×
58
        }}
59
        rootStyle={{
60
          height: "99%",
61
          overflow: "auto",
62
          backgroundColor: "rgb(252, 252, 252)",
63
          color: "#111"
64
        }}
65
      />
66
    )
67
  }
68
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc