Skip to content

Instantly share code, notes, and snippets.

View Sparragus's full-sized avatar
🛠️
Follow me on twitter: https://twitter.com/sparragus

Richard B. Kaufman-López Sparragus

🛠️
Follow me on twitter: https://twitter.com/sparragus
View GitHub Profile
@Sparragus
Sparragus / readme.md
Created April 18, 2019 16:49 — forked from FrikkieSnyman/readme.md
GrapesJS - attributes, classes, and scripts

GrapesJS - attributes, classes, and scripts

Attributes

In order to add custom attributes to an HTML element that is generated by GrapesJS, one can simply make use of traits. For example, if you wish to produce an HTML element which contains the tag data-noout, a trait with the name data-noout can be added to a custom component.

    var domComps = editor.DomComponents;
    var dType = domComps.getType('default');
 var dModel = dType.model;