Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Video boolean attributes breaks on import #2357

Closed
giorgiosjames opened this issue Oct 29, 2019 · 1 comment
Closed

[Bug] Video boolean attributes breaks on import #2357

giorgiosjames opened this issue Oct 29, 2019 · 1 comment
Labels

Comments

@giorgiosjames
Copy link

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.
grapesVideoBug

@artf
Copy link
Member

artf commented Oct 29, 2019

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;
...

@artf artf added the bug label Oct 29, 2019
@artf artf closed this as completed in 8893dbe Jul 27, 2023
pety-dc pushed a commit to d-code-ltd/grapesjs that referenced this issue Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants