Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed Jun 15, 2017
1 parent 2fa15fb commit d717f38
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 19 deletions.
25 changes: 25 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Copyright (c) 2017, Artur Arseniev
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

- Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
- Neither the name "GrapesJS" nor the names of its contributors may be
used to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
115 changes: 115 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# GrapesJS Forms

This plugin adds some basic form components and blocks to help working with forms easier

[Demo](http://grapesjs.com/demo.html)
<br/>

New components:
`form`
`input`
`textarea`
`select`
`checkbox`
`radio`
`button`
`label`



## Options

* `blocks` Which blocks to add, default: `['form', 'input', 'textarea', 'select', 'button', 'label', 'checkbox', 'radio']` (all),
* `labelTraitMethod` Method trait label, default: 'Method',
* `labelTraitAction` Action trait label, default: 'Action',
* `labelTraitState` State trait label, default: 'State',
* `labelTraitId` ID trait label, default: 'ID',
* `labelTraitFor` For trait label, default: 'For',
* `labelInputName` Input name label, default: 'Input',
* `labelTextareaName` Textarea name label, default: 'Textarea',
* `labelSelectName` Select name label, default: 'Select',
* `labelCheckboxName` Checkbox name label, default: 'Checkbox',
* `labelRadioName` Radio name label, default: 'Radio',
* `labelButtonName` Button name label, default: 'Button',
* `labelTraitName` Name trait label, default: 'Name',
* `labelTraitPlaceholder` Placeholder trait label, default: 'Placeholder',
* `labelTraitValue` Value trait label, default: 'Value',
* `labelTraitRequired` Required trait label, default: 'Required',
* `labelTraitType` Type trait label, default: 'Type',
* `labelTraitOptions` Options trait label, default: 'Options',
* `labelTraitChecked` Checked trait label, default: 'Checked',
* `labelTypeText` Text type label, default: 'Text',
* `labelTypeEmail` Email type label, default: 'Email',
* `labelTypePassword` Password type label, default: 'Password',
* `labelTypeNumber` Number type label, default: 'Number',
* `labelTypeSubmit` Submit type label, default: 'Submit',
* `labelTypeReset` Reset type label, default: 'Reset',
* `labelTypeButton` Button type label, default: 'Button',
* `labelNameLabel` Label type label, default: 'Label',
* `labelForm` Form type label, default: 'Form',
* `labelSelectOption` Select option type label, default: '- Select option -',
* `labelOption` Option label, default: 'Option'



## Download

* `npm i grapesjs-mjml` or `yarn add grapesjs-mjml`



## Usage

```html
<link href="path/to/grapes.min.css" rel="stylesheet"/>
<script src="path/to/grapes.min.js"></script>
<script src="path/to/grapesjs-plugin-forms.min.js"></script>

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

<script type="text/javascript">
var editor = grapesjs.init({
fromElement: 1,
container : '#gjs',
plugins: ['gjs-plugin-forms'],
pluginsOpts: {
'gjs-plugin-forms': {/* ...options */}
}
});
</script>
```



## Development

Clone the repository

```sh
$ git clone https://github.com/artf/grapesjs-plugin-forms.git
$ cd grapesjs-plugin-forms
```

Install it

```sh
$ npm i
```

Start the dev server

```sh
$ npm start
```

Build before the commit. This will also increase the patch level version of the package

```sh
$ npm run build
```



## License

BSD 3-Clause
21 changes: 3 additions & 18 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@
<form action="index.html" method="post" style="padding: 50px;">
<input type="hidden" name="hidden-input" value="someval">
<div class="row">
<label>Name</label>
<input type="text" name="text-input" value="">
</div>
<div class="row">
<label>Messagge</label>
<textarea name="textarea-input"></textarea>
</div>
<div class="row">
<label>Options</label>
<select name="select-input">
<option value="">- Select -</option>
<option value="1">Value 1</option>
Expand All @@ -51,24 +54,6 @@
<input type="radio" name="radio-input" value="3"> 3
</div>
<button type="button" name="button-name">Send</button>

<!-- switch -->
<div class="switch" data-gjs-custom-name="Switch">
<input type="hidden" name="swt-name" value="0" class="switch-hidden">
<input type="checkbox" name="swt-name" class="switch-input" value="1" style="display:none">
<i class="switch-track" data-gjs-custom-name="Switch track" data-gjs-droppable="false">
<i class="switch-thumb" data-gjs-custom-name="Switch thumb" data-gjs-removable="false" data-gjs-copyable="false" data-gjs-draggable="false"></i>
</i>
<span class="switch-label">Label switch</span>
</div>

<div class="checkbox">
<input type="checkbox" class="checkbox-input" value="5" style="display:none">
<i class="checkbox-box" data-gjs-droppable="false">
<i class="checkbox-tick" data-gjs-custom-name="Tick" data-gjs-removable="false" data-gjs-copyable="false" data-gjs-draggable="false"></i>
</i>
<span class="checkbox-label">Label checkbox</span>
</div>
</form>
<style>
</style>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "grapesjs-plugin-forms",
"version": "0.2.2",
"private": true,
"description": "GrapesJS set of components and blocks to work with forms",
"description": "Set of forms components and blocks for GrapesJS editor",
"main": "dist/grapesjs-plugin-forms.min.js",
"scripts": {
"lint": "eslint src",
Expand Down

0 comments on commit d717f38

Please sign in to comment.