forked from GrapesJS/components-forms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
144 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters