Issue #2036Opened May 24, 2019by Gummibeer1 reactions

[QUESTION] documentation of stored object structure

Question

Hey, I would like to incorporate this package with my existing element based backend. To do so I would need to map the data posted to the remote storage server into my own data structure and during load also back to grapesjs structure. So for a super basic example I've took the simple heading element <h1> which is also used in the package documentation.

<h1>Hello World Component!</h1>

In my app this would be a twig template with a single placeholder:

<h1>{{ headline}}</h1>

The datastructure would be the following, I use JSON no DB but the idea should be clear:

[
  {
    "type": "h1",
    "data": {
      "headline": "Hello World Component!"
    }
  }
]

And this is what I can dump from the simple-storage manager (also from documentation) using the following console.log(). Could you add a documentation page related to the object created for a component in the storage? Primary to know what's required to pass and what's optional?

console.log(JSON.parse(data['gjs-components']));
[
    {
        "tagName":"h1",
        "type":"text",
        "name":"",
        "removable":true,
        "draggable":true,
        "droppable":false,
        "badgable":true,
        "stylable":true,
        "stylable-require":"",
        "style-signature":"",
        "unstylable":"",
        "highlightable":true,
        "copyable":true,
        "resizable":false,
        "editable":true,
        "layerable":true,
        "selectable":true,
        "hoverable":true,
        "void":false,
        "state":"",
        "status":"",
        "content":"Hello World Component!",
        "icon":"",
        "style":"",
        "classes":[

        ],
        "script":"",
        "attributes":{

        },
        "traits":[
            {
                "type":"text",
                "label":"",
                "name":"id",
                "min":"",
                "max":"",
                "unit":"",
                "step":1,
                "target":"",
                "default":"",
                "placeholder":"eg. Text here",
                "changeProp":0,
                "options":[

                ]
            },
            {
                "type":"text",
                "label":"",
                "name":"title",
                "min":"",
                "max":"",
                "unit":"",
                "step":1,
                "target":"",
                "default":"",
                "placeholder":"eg. Text here",
                "changeProp":0,
                "options":[

                ]
            }
        ],
        "propagate":"",
        "dmode":"",
        "components":[

        ],
        "view":""
    }
]

Answers (1)

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.