@atlaskit/editor-common
Version:
A package that contains common classes and components for editor and renderer
12 lines • 384 B
JavaScript
export const snapTo = (target, points) => {
return points.length === 0 ?
// extreme last case if there are no points somehow
target : points.reduce((point, closest) => {
return Math.abs(closest - target) < Math.abs(point - target) ? closest : point;
});
};
export const handleSides = ['left', 'right'];
export const imageAlignmentMap = {
left: 'start',
right: 'end'
};