1.0.0 • Published 1 year ago

component-editable v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Component Editable

With this Editable Wrapper you can make any React Component Editable and get rawHtml or styledHtml based on ypur need.

Usage

  • Wrap any Component in Editable wrapper and pass editable true.
  • You can get rawHtml or styledHtml whenever you need using onChange listener.
import Editable from 'component-editable';

function App() {
  return (
    <>
      // ... some other components
      <Editable
        editable  // true if inner content is editable
        onChange={(rawHtml, styledHtml) => console.log(rawHtml, styledHtml)}
      >
        <h1>Test Heading</h1>
        <p className="read-the-docs">
          This Content is placeholder
        </p>
      </Editable>
      // ... some other components
    </>
  )
}

export default App;

Props

propfunctiondefault
editableSet if content is editabletrue
onChangeListener to get rawHtml and styledHtml of Wrapeed Component() => {}
rootSelectorIt's used to get the root of the react app for styledHtml#root
linksRootit's the starting path of assets used in page for styledHtml/