dist/buttons/buttonApply.js
/**
   * Add the save button before the close button
   */
Add the save button before the close button
Add the save button before the close button
addButton() {
    const mode = ContentService.getMode(this.editor);
    let title = Mautic.translate('grapesjsbuilder.panelsViewsButtonsApplyTitle');
    let disable = false;
    let command = ButtonApply.getCommand();
    if (mode === ContentService.modeEmailHtml || mode === ContentService.modeEmailMjml) {
      const emailFormList = ButtonsService.getFormItemById('emailform_lists');
      const emailType = ButtonsService.getFormItemById('emailform_emailType');
      const emailTypeSegment = 'list';
      if (emailType.value === emailTypeSegment && !emailFormList.value.length) {
        title = Mautic.translate('grapesjsbuilder.panelsViewsButtonsApplyTitleError');
        disable = true;
        command = '';
      }
    }
    this.editor.Panels.addButton('views', [{
      id: 'views-apply',
      className: `fa fa-check`,
      active: false,
      disable,
      attributes: {
        id: 'btn-views-apply',
        title
      },
      command,
      context: 'views-apply'
    }]);
  }
addButton ( ) { const mode = ContentService . getMode ( this . editor ) ; let title = Mautic . translate ( 'grapesjsbuilder.panelsViewsButtonsApplyTitle' ) ; let disable = false ; let command = ButtonApply . getCommand ( ) ; if ( mode === ContentService . modeEmailHtml || mode === ContentService . modeEmailMjml ) { const emailFormList = ButtonsService . getFormItemById ( 'emailform_lists' ) ; const emailType = ButtonsService . getFormItemById ( 'emailform_emailType' ) ; const emailTypeSegment = 'list' ; if ( emailType . value === emailTypeSegment && ! emailFormList . value . length ) { title = Mautic . translate ( 'grapesjsbuilder.panelsViewsButtonsApplyTitleError' ) ; disable = true ; command = '' ; } } this . editor . Panels . addButton ( 'views' , [ { id : 'views-apply' , className : ` ` , active : false , disable , attributes : { id : 'btn-views-apply' , title } , command , context : 'views-apply' } ] ) ; }
Add the save button before the close button
Add the save button before the close button