code: function (selection) {
          var parentNode = selection.anchorNode;
  
          if (!parentNode.tagName) {
            parentNode = selection.anchorNode.parentNode;
          }
  
          var childNode = parentNode.childNodes[0];
  
          if(childNode && childNode.tagName && childNode.tagName.toLowerCase() in generatedTags) {
            parentNode = parentNode.childNodes[0];
          }
  
          $timeout(function() {
            // get real styles of selected element
            scope.styles = window.getComputedStyle(parentNode, null);
  
            if(scope.styles.fontSize !== scope.size.label + 'px') {
              // set font size selector
              angular.forEach(scope.sizeOptions, function(size, i) {
                if(scope.styles.fontSize === (size.label + 'px')) {
                  scope.size = scope.sizeOptions[i].value;
                  return false;
                }
              });
            }
  
          });
  
        }
docs: check current selection styles and activate buttons