0.2.3 • Published 4 years ago

grapesjs-blocks-bootstrap4 v0.2.3

Weekly downloads
357
License
BSD-3-Clause
Repository
github
Last release
4 years ago

GrapesJS Bootstrap v4 Blocks Plugin

npm

Summary

  • Plugin name: grapesjs-blocks-bootstrap4
  • Components (see Options for list of Blocks)
    • Layout
      • container
      • row
      • column
      • column_break
      • media_object
      • media_body
    • Components
      • alert
      • tabs
      • badge
      • card
      • card_container
      • collapse
      • dropdown
      • dropdown_menu
    • Typography
      • text
      • header
      • paragraph
    • Media
      • image
      • video
    • Forms
      • form
      • button
      • button_group
      • button_toolbar
      • input
      • input_group
      • form_group_input
      • textarea
      • checkbox
      • radio

Options

{
  blocks: {
    ...
  }
  blockCategories: {
    ...
  }
  labels: {
    ...
  }
  formPredefinedActions: null,
  optionsStringSeparator: '::'
}

Blocks

OptionDescriptionDefault
defaultRebuild default component with utility settingstrue
textRebuild text component to re-inherit from defaulttrue
linkRebuild link component to re-inherit from default and give toggle settingtrue
imageRebuild image component to re-inherit from defaulttrue
videoRebuild video component to re-inherit from defaulttrue
containerContainer (fixed/fluid)true
rowRowtrue
columnColumns of all sizestrue
column_breakColumn-break (div.w-100)true
media_objectMedia objecttrue
alerttrue
tabstrue
badgetrue
cardCard with settings for images, image overlay, header, body, & footer componentstrue
card_containerLayouts: group, deck, columnstrue
collapseCollapse component that can be toggled via link componenttrue
dropdownDropdowntrue
headerH1-H6true
paragraphP tag with "lead" settingtrue
formtrue
buttontrue
button_grouptrue
button_toolbartrue
inputtrue
input_grouptrue
form_group_inputtrue
textareatrue
checkboxtrue
radiotrue

Block Categories

These are the different categories of blocks as they are grouped in the Blocks sidebar panel. Set a value to false exclude entire groups of blocks (as well as the associated components).

OptionDescriptionDefault
layoutContainer, row, col, col-break, media objecttrue
componentsBootstrap's Components--alert, button, card, etc.true
typographyText, header, paragraph, etc.true
basicLink, image, etc.true
formsForm, input, textarea, etc.true

Labels

Same keys as Blocks, but value is the label for the block.

OptionDescriptionDefault
text'Text'
header'Header'

etc.

Other

OptionDescriptionDefault
gridDevicesAdd devices based on BS grid breakpointstrue
gridDevicesPanelBuild a panel in the top-left corner with device buttons (use with editor showDevices=false)false
formPredefinedActionsPass a list of predefined form actions to generate a select menu: {name: 'Contact', value: '/contact'}, ..., if no list is passed an input box to add the action is shownnull
optionsStringSeparatorPass a string to identify the separator of values and labels of the select options: optionValue::optionLabel. This setting WILL BE overridden by the gjs-preset-webpage plugin if enabled'::'

Download

  • NPM
    • npm i grapesjs-blocks-bootstrap4
  • GIT
    • git clone https://github.com/kaoz70/grapesjs-blocks-bootstrap4.git

Usage

<link href="https://unpkg.com/grapesjs/dist/css/grapes.min.css" rel="stylesheet"/>
<script src="https://unpkg.com/grapesjs"></script>
<script src="path/to/grapesjs-blocks-bootstrap4.min.js"></script>

<div id="gjs"></div>

<script type="text/javascript">
  var editor = grapesjs.init({
      container : '#gjs',
      ...
      plugins: ['grapesjs-blocks-bootstrap4'],
      pluginsOpts: {
        'grapesjs-blocks-bootstrap4': {
          blocks: {
            // ...
          },
          blockCategories: {
            // ...
          },
          labels: {
            // ...
          },
          // ...
        }
      },
      canvas: {
        styles: [
          'https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css'
        ],
        scripts: [
          'https://code.jquery.com/jquery-3.3.1.slim.min.js',
          'https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js',
          'https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js'
        ],
      }
  });
</script>

Development

Clone the repository

$ git clone https://github.com/kaoz70/grapesjs-blocks-bootstrap4.git
$ cd grapesjs-blocks-bootstrap4

Install dependencies

$ npm i

The plugin relies on GrapesJS via peerDependencies so you have to install it manually (without adding it to package.json)

$ npm i grapesjs --no-save

Start the dev server

$ npm start

License

BSD 3-Clause

0.2.3

4 years ago

0.2.2

4 years ago

0.2.0

4 years ago

0.1.22

4 years ago

0.1.21

4 years ago

0.1.20

4 years ago

0.1.19

4 years ago

0.1.17

4 years ago

0.1.16

5 years ago

0.1.15

5 years ago

0.1.14

5 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago