[Bug] Video boolean attributes breaks on import
Question
Explanation Using https://grapesjs.com/demo.html v0.15.8 on Chrome 77.0.3~ Windows 10 Pro Build 18362 Importing a Video component with any Boolean attribute (controls, loop, autoplay) using the import modal will break all boolean attributes on the component until the component is deleted.
Reproduction Steps
- Navigate to https://grapesjs.com/demo.html
- Clear the canvas
- Drag in a 'Video' Block
- Ensure the 'Controls' boolean attribute is checked (should be by default)
- Open the import code modal
- Click import
- Boolean attribute traits no longer work on the component
- Also can't re-import the video with the boolean attribute removed
Screencast
Screencast showing video working as expected, and then the bug.

Answers (1)
At first look the issue might be here: https://github.com/artf/grapesjs/blob/a850a305b80b8f86c0e7e4fb92b6492c2e5a1957/src/dom_components/model/ComponentVideo.js#L115-L117
indeed in the export/import I'd expect just ... controls> and not ... controls="controls">. The HTML code generator should use single attributes when encounters Boolean true values, so the first try might be
if (this.get('loop')) attr.loop = true;
...
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3866
BUG: SVG Not rendering when inside any HTML Element
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Version 94.0.4606.81 (Official Build) (64-bi...
Issue #1563
[Bug] Trait - Change Video Provider issue
Version: 0.14.40 Bug: When you change "Provider" field -> all settings gone. It happens in Chrome, Safari and Firefox, last versions. How t...
Issue #4208
BUG: Style click state bug in every element
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Brave Last, tested on chrome last and Safa...
Issue #5355
BUG: On move layer
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome 116 Reproducible demo link https://...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.