1.4.2 • Published 1 year ago

cm-page-builder v1.4.2

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

CM Page Builder

A Notion inspired page builder

CM Page builder is a modern rich text component based page builder inspired from Notion. This Component allows you to compose awesome, formatted text in your web application and supports uploading files, pictures, code snippets and even embedding videos.

Demo:

CM Page Builder 📝

Download and Install CM Page Builder

Install from npm

npm install -s cm-page-builder

Load CM Page Builder as a Module

import PageBuilder from 'cm-page-builder'

Initialization and Usage

An Example of using page builder component:

<PageBuilder
	pageComponents={pageComponents}
	typeMapping={TYPE_MAP_COMPONENT}
	handleUpdate={this._updatePageComponent}
	status={this.state.status}
	requestHandler={this.requestHandler}
	options={[['Header1','Header2','Olist','Ulist']}
/>
Component Props
pageComponents
typeMapping
options
handleUpdate
status
Page components.

A list of Page components, to be initialized. They have the following structure

{
  component_attachment: { content: String, filename: String, url: String}
  component_type: String
  content: String
  position: Number
}
Status (default: Edit):

Has to be one of Edit or Read

options (default: ['Header1','Header2','Olist','Ulist','Embed','Upload', 'File','Divider','Code']):

Array of available components. For example, setting options as ['Header1'] will only render Header1 component.

handleUpdate(id, data, type, key):

A function that gets fired every time something happens with the components of a page. It receives four parameters, id, data, type, key

  • id: The ID of the component,
  • data: The data inside the component.
  • type: The kind of change that has happened with the component. It can be any of
    • "createComponent"
    • "updateComponent"
    • "deleteComponent"
  • key: undefined
typeMapping

A hash that maps snake_cased names of components with cm-page-builder components found inside the src/components folder. Available components are

  • Header1: The equivalent of a h1 tag
  • Header2: The equivalent of a h2 tag
  • OList: An ordered list. Two or more adjacent components of this type will make a group, and the position number will increase sequentially within that group
  • UList: An unordered list
  • Text: The default component, regular text. It may have HTML formatting
  • Embed: A vimeo or youtube video which is meant to be displayed as an embed file
  • Upload: A file. component_attachment will hold all relevant information. If it is an image, it should be displayed as an embedded image
  • Divider: A line divider.
  • Code: A code snippet component.

Crafted with ❤️ by Commutatus

1.4.2

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.70

4 years ago

1.2.69

4 years ago

1.2.68

4 years ago

1.2.67

4 years ago

1.2.66

5 years ago

1.2.65

5 years ago

1.2.64

5 years ago

1.2.63

5 years ago

1.2.62

5 years ago

1.2.61

5 years ago

1.2.57

5 years ago

1.2.58

5 years ago

1.2.59

5 years ago

1.2.56

5 years ago

1.2.55

5 years ago

1.2.54

5 years ago

1.2.53

5 years ago

1.2.52

5 years ago

1.2.49

5 years ago

1.2.50

5 years ago

1.2.51

5 years ago

1.2.47

5 years ago

1.2.48

5 years ago

1.2.42

5 years ago

1.2.45

5 years ago

1.2.43

5 years ago

1.2.44

5 years ago

1.2.41

5 years ago

1.2.40

5 years ago

1.2.39

5 years ago

1.2.38

5 years ago

1.2.37

5 years ago

1.2.36

5 years ago

1.2.34

5 years ago

1.2.33

5 years ago

1.2.32

5 years ago

1.2.31

5 years ago

1.2.30

5 years ago

1.2.29

5 years ago

1.2.28

5 years ago

1.2.27

5 years ago

1.2.26

5 years ago

1.2.25

5 years ago

1.2.24

5 years ago

1.2.23

5 years ago

1.2.22

5 years ago

1.2.21

5 years ago

1.2.20

5 years ago

1.2.19

5 years ago

1.2.18

5 years ago

1.2.17

5 years ago

1.2.15

5 years ago

1.2.14

5 years ago

1.2.13

5 years ago

1.2.12

5 years ago

1.2.11

5 years ago

1.2.10

5 years ago

1.2.9

5 years ago

1.2.8

5 years ago

1.2.7

5 years ago

1.2.4

5 years ago

1.2.6

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.1

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago