All files index.js

53.85% Statements 7/13
0% Branches 0/3
0% Functions 0/4
53.85% Lines 7/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32            1x                   1x 1x 1x   1x       1x       1x      
import AlignCenterIcon from './alignCenter';
import AlignLeftIcon from './alignLeft';
import AlignRightIcon from './alignRight';
import {applyChange} from './alignDecorator';
import isHotkey from 'is-hotkey';
 
const plugin = function(type = 'align', hotkey, align) {
  return {
    onKeyDown(event, change) {
      if (isHotkey(hotkey, event)) {
        applyChange(change, type, align);
      }
    }
  }
}
 
export const AlignCenter = AlignCenterIcon;
export const AlignLeft = AlignLeftIcon;
export const AlignRight = AlignRightIcon;
 
export const AlignCenterPlugin = (type) => {
  return plugin(type, 'ctrl+opt+c', 'center')
}
 
export const AlignLeftPlugin = (type) => {
  return plugin(type, 'ctrl+opt+l', 'left')
}
 
export const AlignRightPlugin = (type) => {
  return plugin(type, 'ctrl+opt+r', 'right')
}