Grapesjs: Toolbar on hover

Created on 17 Sep 2018  路  3Comments  路  Source: artf/grapesjs

@artf how can we show toolbar on hover. Currently toolbar is open when we select any element but I want to show it on hover. Any help would be appreciated.
toolbarpostion

Most helpful comment

@sakshigarg9 ,

editor.Commands.extend('select-comp', {
        onHovered(em, component) {
          const trg = component && component.getEl();
          if (trg) {
            const pos = this.getElementPos(trg);
            this.updateBadge(trg, pos);
            this.updateToolbar(component); // show toolbar
            this.updateHighlighter(trg, pos);
            this.showElementOffset(trg, pos);
          }
        },
      });

All 3 comments

The only way I can help you here is to tell you to check this command https://github.com/artf/grapesjs/blob/dev/src/commands/view/SelectComponent.js (id of the command: select-comp) which is responsible for showing the toolbar. So you can try to use Commands API to extend it

@YashPrince Hi, were you able to solve this? I need a similar implementation

@sakshigarg9 ,

editor.Commands.extend('select-comp', {
        onHovered(em, component) {
          const trg = component && component.getEl();
          if (trg) {
            const pos = this.getElementPos(trg);
            this.updateBadge(trg, pos);
            this.updateToolbar(component); // show toolbar
            this.updateHighlighter(trg, pos);
            this.showElementOffset(trg, pos);
          }
        },
      });
Was this page helpful?
0 / 5 - 0 ratings

Related issues

FlashPapa picture FlashPapa  路  3Comments

applibs picture applibs  路  3Comments

faizansaiyed picture faizansaiyed  路  3Comments

krunal039 picture krunal039  路  3Comments

crazyxhz picture crazyxhz  路  3Comments