question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: gjs-selected Style is Hardcoded

See original GitHub issue

This definition:

https://github.com/artf/grapesjs/blob/88249c38577852dc3c42047356a70a12066ee6ca/src/canvas/view/FrameView.js#L303-L306

is always appended to the frame. It contains the color definition for selected elements (that blue outline). This color cannot be changed, because there’s an !important here. Since this is appended to the body, adding a stylesheet in the header does not override it, even when I use !important there as well.

For my use case, the critical issue is that I want to be able to print the document created in grapesjs, but printouts should not contain the selection outline. I can write @media print { .gjs-selected { outline: none !important; } }, but that won’t do anything since it’s overridden by this hardcoded css definition.

Also, being able to change the color to fit the page’s corporate identity would be good.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
artfcommented, Jun 21, 2021

Hi @anlumo you’re right, unfortunately, component status styles are rendered inside iframes. I’ve tried to put them outside by introducing this option but that doesn’t handle multiple selections yet. So, at the moment, the only way to handle them properly is to use this option:

grapesjs.init({
  // ...
  canvasCss: `
        .gjs-selected {
          outline: 3px solid red !important;
        }
   `,
})
2reactions
filipecheverryacommented, Mar 10, 2022

Hi @mingxin-yang i belive that you have to follow the same rule that @artf said. But using the corresponding classes

grapesjs.init({
  // ...
  canvasCss: `
    .gjs-tools .gjs-badge { /* for the label */
      background-color: red;
    }
    .gjs-toolbar { /* for the toolbar */
      background-color: red;
    }
  `,
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

Hard coding - Wikipedia
Hard coding is the software development practice of embedding data directly into the source ... Hard-coded data typically can only be modified by...
Read more >
hard-code, hard-coded, hard-coding - Microsoft Style Guide
Describes how to use the terms "hard-code", "hard-coded", and "hard-coding" in Microsoft content.
Read more >
Hard Code, Hard-Coded, Hard Coding - Salesforce Developers
Hard coding refers to the software development practice of embedding output or configuration data directly into the source code of a program. For...
Read more >
Atlassian Confluence Hardcoded Credentials Bug Actively ...
An Atlassian critical Confluence hardcoded credentials vulnerability that was fixed last week is now under active exploitation.
Read more >
Java static code analysis: URIs should not be hardcoded
Java static code analysis. Unique rules to find Bugs, Vulnerabilities, Security Hotspots, and Code Smells in your JAVA code. All rules 649 ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found