Git Product home page Git Product logo

components-forms's Introduction

Build Status Chat CDNJS npm

GrapesJS

GrapesJS is a free and open source Web Builder Framework which helps building HTML templates, faster and easily, to be delivered in sites, newsletters or mobile apps. Mainly, GrapesJS was designed to be used inside a CMS to speed up the creation of dynamic templates. To better understand this concept check the image below


GrapesJS - Style Manager


Generally any 'template system', that you'd find in various applications like CMS, is composed by the structure (HTML), style (CSS) and variables, which are then replaced with other templates and contents on server-side and rendered on client.

This demos show examples of what is possible to achieve:
Webpage Demo - http://grapesjs.com/demo.html
Newsletter Demo - http://grapesjs.com/demo-newsletter-editor.html

Table of contents

Features

Blocks Style Manager Layer Manager
GrapesJS - Block Manager GrapesJS - Style Manager GrapesJS - Layer Manager
Code Viewer Asset Manager
GrapesJS - Code Viewer GrapesJS - Asset Manager
  • Local and remote storage

  • Default built-in commands (basically for creating and managing different components)

Download

  • CDNs
    • UNPKG (resolves to the latest version)
      • https://unpkg.com/grapesjs
      • https://unpkg.com/grapesjs/dist/css/grapes.min.css
    • CDNJS (replace X.X.X with the current version)
      • https://cdnjs.cloudflare.com/ajax/libs/grapesjs/X.X.X/grapes.min.js
      • https://cdnjs.cloudflare.com/ajax/libs/grapesjs/X.X.X/css/grapes.min.css
  • NPM
    • npm i grapesjs
  • GIT
    • git clone https://github.com/GrapesJS/grapesjs.git

For the development purpose you should follow instructions below.

Usage

<link rel="stylesheet" href="path/to/grapes.min.css">
<script src="path/to/grapes.min.js"></script>

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

<script type="text/javascript">
  var editor = grapesjs.init({
      container : '#gjs',
      components: '<div class="txt-red">Hello world!</div>',
      style: '.txt-red{color: red}',
  });
</script>

For a more practical example I'd suggest looking up the code inside this demo: http://grapesjs.com/demo.html

Development

Clone the repository and install all the necessary dependencies (yarn is highly recommended)

$ git clone https://github.com/GrapesJS/grapesjs.git
$ cd grapesjs
$ yarn

Start the dev server

$ yarn start

Once the development server is started you should be able to reach the demo page (eg. http://localhost:8080)

Documentation

Check the getting started guide here: Documentation

API

API References could be found here: API-Reference

Testing

$ yarn test

Plugins

Official Plugins | Community Plugins

Wrappers

  • @grapesjs/react - GrapesJS wrapper for React that allows you to build custom and declarative UI for your editor.

Extensions

Presets

Find out more about plugins here: Creating plugins

Support

If you like the project and you wish to see it grow, please consider supporting us with a donation of your choice or become a backer/sponsor via Open Collective

PayPalMe Bitcoin


BrowserStack
Thanks to BrowserStack for providing us browser testing services

License

BSD 3-clause

components-forms's People

Contributors

artf avatar dependabot[bot] avatar iamshivammittal avatar oneko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

components-forms's Issues

Default Form Method is misleading

When dragging a form onto the canvas, it does not set the "method" attribute in the markup (which is fine). However, the default "method" for a form is "GET" according to the HTML spec.

If you select the form block that you dragged onto the canvas and look at the component settings, the UI makes it look like the user has the "POST" method selected, since it is the first element in the select.

Recommendation: make the "GET" option the first element in the select so that it matches the default form behavior.

https://github.com/artf/grapesjs-plugin-forms/blob/master/src/components.js#L76

With Select box, the options in settings is only showing value, The Option text not showing

Hi Artf,
The form is really great plugin and thanks for the great plugin.

I am getting some issues with Select box,
Could you please help me ?

The scenario is below
I dragged the Form block and dragged Select box component, I can see those options are added in the editor, but when I click on that selectbox and check the Options in Settings, I can only see
::
1::
Instead of
::-Select
1::Option 1

could you please guide me how to fix this?

https://grapesjs.com/demo.html here also I can see this issue

Screenshot 2022-01-17 at 12 19 25 AM

Stop attributes from being editable

Implemented using this plugin and have it working fine by setting a fixed value for both action and method on the form. When adding the block to the canvas I have disable showing the traits under Settings so the user cannot edit the method and action. However after saving the page and reloading those attributes are now available to be edited. How can I prevent those from showing up under Settings for the form?

I have tried to override the traits and attributes, but to no effect. In the editor.on('load') I have:

editor.DomComponents.addType('form', {
          model: {
            defaults: {
              traits: [],
              attributes: {}
            }
          }
        })

component with a script block

I am trying to create a component that will run a script on an input type:

domc.addType('myInput', {
	model: inputType.model.extend({
		defaults: {
			...inputModel.prototype.defaults,
			'custom-name': c.labelMyInputName,
			tagName: 'myInput',
			traits: [...],
			script() {
				console.log("HERE");
			},
		},
	},
	...

I'm expecting script() to execute, just like you have it on your Slider component, but it doesn't. Am I supposed to define something somewhere else so the script block will work?

Bug: Blur on trait textfield for button

Hello, I think I found an issue concerning the button component. When the button text is changed over the according trait textfield ("Text"), the field blurs after typing each letter. If you like to enter several letters, you need to click the cursor into the textfield with your mouse after each letter.

I'm using the code unchanged. It's like that even on the demo pages. Tested on Safari and Firefox.

How can this be solved?

[bug]No ID on form elements (and possible core bug with selecting labels)

Hello, I have noticed that labels do have a "for" attribute, but the elements don't have any ID attribute. Without the ID, the for doesn't do much.

On my own application, I have extended the elements to add the ID, but now there's a new issue: When I try to select a label that has been linked to an element on the canvas, the element gets selected instead (just like when clicking the label on the actual finished page). I am not sure if that issue belongs here or in Core.

Steps to reproduce:
For the first issue, you only need to look at the settings section on any Form element in the demo.

For the second issue, you need to extend the form elements with a new trait, ID.
Then set the ID on the element.
Then set the for attribute on a label to the same as the ID on the element.
Then click on the label on the canvas.

Current workaround:
Select the label using the Layers panel.

BUG: Recent Updates to GrapesJS Type Definitions break this plugin

After this commit, this plugin produces an error saying 'BlockOptions" is not a property on grapesjs

I only know about this error because I am developing with the Dev Branch of GrapesJS (for testing only, not production). This error is not caused by any official releases. I just hope this gets fixed before the next release of Grapesjs. I am using grapejs-plugin-forms v 2.0.5.

Support for "hidden" input type?

Hi,

I am considering using Grapesjs and the forms plugin for my project. Hidden inputs would be somehow important in my case, but as far as I can see it's not supported yet. Am I correct?

Many thanks, especially for these great packages!

Select Component Inherits type="text" attribute from Input Component

Components.addType(typeSelect, {
extend: typeInput,

I'm not sure what solution should be applied here. Directly extending the input component is probably not correct. Maybe there should be a common base component that input also extends with the shared attributes from all current input component children? If there isn't much shared then they probably should be separate as they don't share the same tagName.

Unable to use this plugin with gjsBlocksBasic

I get all the components when I console log block manager but when I get the from or input and set it, it does not work.
I get this issue
Target collection not found", "Component not draggable, acceptable by [form, form *]"

Plugin adds extra text to label and button elements.

I am experiencing odd behavior related to this plugin and am looking for insight and context.

When I drag a block containing a label or button tag, SOMETHING is inserting text into the tag. On label tags, "Label" gets inserted, and on button tags, Send gets inserted.

Look at screenshot:
screenshot-localhost_4200-2022 08 04-12_28_31

i've tried to duplicating the error using jsFiddle but cannot duplicate. I am hoping someone might have insight or other feedback on why this might be happening

jsFiddle: https://jsfiddle.net/fxpmgcLu/1/

Basically, if i do not include this plugin (in my instance, everything is fine and dandy. Otherwise, my label and button tags get this extra text. I suspect this "bug" is more my fault rather than a bug in the plugin. Still, it is odd that everything is ok when I take out this plug

[BUG] form elements can not be dragged

The bug

Whenever I'm trying to drag & drop a form element (button, input, select, textarea, checkbox, radio) - nothing happens. A green line suggesting to attach an element that I'm dragging should appear but it does not happen. This elements can not be used.

"form" and "label" elements work fine.

Ubunut 18.04
Chromium Version 77.0.3865.75 (Official Build) snap (64-bit)

Tested with Opera - the same issue there.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.