Skip to content

Commit

Permalink
Using opts.withProps to include component props in html
Browse files Browse the repository at this point in the history
  • Loading branch information
benjgrad committed Aug 18, 2022
1 parent 8fac0b4 commit 9e00994
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/api/editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ Returns HTML built inside canvas

* `opts.component` **Component?** Return the HTML of a specific Component
* `opts.cleanId` **[Boolean][18]** Remove unnecessary IDs (eg. those created automatically) (optional, default `false`)
* `opts.withProps` **[Boolean][18]** Include component properties as `data-gjs-*` attributes. This allows you to have re-importable HTML. (optional, default `false`)

Returns **[string][16]** HTML string

Expand Down
2 changes: 2 additions & 0 deletions src/code_manager/model/HtmlGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export default class HTMLGenerator extends Model {
};
}

htmlOpts.withProps = opts.withProps;

return model.toHTML(htmlOpts);
}
}

0 comments on commit 9e00994

Please sign in to comment.