react-newsletter
v1.1.3
Published
Edit newsletters in your React application
Downloads
6
Readme
react-newsletter
Edit newsletters in your React application
Install
npm install --save react-newsletter
Docs / API reference
Available components:
- ReactNewsletterProvider
- Injects HTML5 DnD Backend support
- TemplateComponent
- Items you will be able to drag and drop
- Based on ReactDND.DragSource
- ReactNewsletter
- The canvas contains Droppable areas and dropped items
- CardDragLayer
- Element appearence while dragging
- Based on ReactDND.DragLayer
Props:
ReactNewsletterProvider
Just wrap you root component with it
TemplateComponent
type: string
: a type of yout iteminitialValue: any
: initial valueclassName?: string
: classes pushed to the root JSX element (div) of the TemplateComponentstyle?: Object
: style pushed to the root JSX element (div) of the TemplateComponentallSelectedItems?: Array<{type: string, value: any}>
: provides an opportuinity to drag and drop several selected items
ReactNewsletter
items: Array<Item>
: dropped items- Item
id: number
value: string
type: string
staticTemplate?: boolean
:true
to forbid to an item be draggableshouldNotRenderDNDAreaBefore?: boolean
- Item
itemsOnChange: (Array<Item>) => void
: changes handlertemplates: Array<Template>
: your templates- Template:
name: string
type: string
component
: React componentinitialValue: any
getHTML: () => string
- Template:
onDroppedCallback?: () => void
: called right after an item has been dropped
CardDragLayer
component
: React componentitem: Item
moveableDragLayerStyles
: wrapper style of all items being draggeddragLayerItemStyles
: style of a single item which is being dragged
Meta
To debug locally
yarn start
here in the root- go to your project and run
npm link $PATH_TO/react-newsletter
To update and publish changes
npm version <update_type>
(semver)npm publish
Have questions?
Welcome to issues or contact @alienalein13
TODO
- Types (migrate to TS probably)
- Tests
- Implement getHTML function for the whole newsletter
License
MIT © Webscope.io