code: function(composer, command, tagName, className, classRegExp, cssStyle, styleRegExp) {
        var that = this;
  
        if (this.state(composer, command, tagName, className, classRegExp, cssStyle, styleRegExp) &&
          composer.selection.isCollapsed() &&
          !composer.selection.caretIsLastInSelection() &&
          !composer.selection.caretIsFirstInSelection()
        ) {
          var state_element = that.state(composer, command, tagName, className, classRegExp)[0];
          composer.selection.executeAndRestoreRangy(function() {
            var parent = state_element.parentNode;
            composer.selection.selectNode(state_element, true);
            wysihtml5.commands.formatInline.exec(composer, command, tagName, className, classRegExp, cssStyle, styleRegExp, true, true);
          });
        } else {
          if (this.state(composer, command, tagName, className, classRegExp, cssStyle, styleRegExp) && !composer.selection.isCollapsed()) {
            composer.selection.executeAndRestoreRangy(function() {
              wysihtml5.commands.formatInline.exec(composer, command, tagName, className, classRegExp, cssStyle, styleRegExp, true, true);
            });
          } else {
            wysihtml5.commands.formatInline.exec(composer, command, tagName, className, classRegExp, cssStyle, styleRegExp);
          }
        }
      }
docs: Executes so that if collapsed caret is in a state and executing that state it should unformat that state It is achieved by selecting the entire state element before executing. This works on built in contenteditable inline format commands