Skip to content

Commit

Permalink
Hide badge if component.badgable is false. Fixes GrapesJS#5340
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed Aug 30, 2023
1 parent 945156a commit 0315af8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/commands/view/SelectComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,13 @@ export default {
updateBadge(el: HTMLElement, pos: any, opts: any = {}) {
const { canvas } = this;
const model = getComponentModel(el);
if (!model || !model.get('badgable')) return;
const badge = this.getBadge(opts);
const bStyle = badge.style;

if (!model || !model.get('badgable')) {
bStyle.display = 'none';
return;
}

if (!opts.posOnly) {
const config = this.canvas.getConfig();
Expand All @@ -347,7 +352,6 @@ export default {
}

const un = 'px';
const bStyle = badge.style;
bStyle.display = 'block';

const targetToElem = canvas.getTargetToElementFixed(el, badge, {
Expand Down

0 comments on commit 0315af8

Please sign in to comment.