Skip to content

Instantly share code, notes, and snippets.

View FrikkieSnyman's full-sized avatar

Frikkie Snyman FrikkieSnyman

  • Relive B.V.
  • Rotterdam
View GitHub Profile
@FrikkieSnyman
FrikkieSnyman / readme.md
Last active June 24, 2023 08:06
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;