@atlaskit/editor-plugin-table
Version:
Table plugin for the @atlaskit/editor
18 lines (17 loc) • 1.19 kB
JavaScript
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
import { createFixedGuidelinesFromLengths } from '@atlaskit/editor-common/guideline';
import { calculateDefaultSnappings, calculateDefaultTablePreserveSnappings } from './snapping';
// NOTE: We have to take 1 pixel off every length due to the fact that the tbody is 1px smaller then the table container.
// If we don't do this then the guidelines will not align correctly to the edge of the table
export var defaultGuidelines = createFixedGuidelinesFromLengths([0].concat(_toConsumableArray(calculateDefaultSnappings(-1))));
export var PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET = -1;
export var defaultGuidelinesForPreserveTable = function defaultGuidelinesForPreserveTable(lengthOffset, editorContainerWidth) {
var exclude = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
innerGuidelines: false,
breakoutPoints: false
};
var lengths = calculateDefaultTablePreserveSnappings(lengthOffset,
// was hardcoded to -1 here, created PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET instead.
editorContainerWidth, exclude);
return createFixedGuidelinesFromLengths(lengths, undefined, true);
};