@atlaskit/editor-plugin-guideline 0.3.13 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-plugin-guideline
2
2
 
3
+ ## 0.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`24e27147cbd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/24e27147cbd) - Added atlaskit docs to all existing plugins.
8
+
9
+ ## 0.4.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`7f45581d141`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7f45581d141) - ED-19630 fixed guideline alignment issue.
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+
3
19
  ## 0.3.13
4
20
 
5
21
  ### Patch Changes
@@ -29,8 +29,7 @@ var GuidelineContainer = function GuidelineContainer(props) {
29
29
  var _style;
30
30
  var guidelines = props.guidelines,
31
31
  height = props.height,
32
- editorWidth = props.editorWidth,
33
- centerOffset = props.centerOffset;
32
+ updateRect = props.updateRect;
34
33
  var _useState = (0, _react.useState)(0),
35
34
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
36
35
  offset = _useState2[0],
@@ -40,10 +39,18 @@ var GuidelineContainer = function GuidelineContainer(props) {
40
39
  var _ref$current;
41
40
  var rect = ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.getBoundingClientRect();
42
41
  if (rect) {
42
+ var centerOffset = rect.width / 2 - 0.5;
43
+
43
44
  // X pixels from guideline container left to editor center.
44
- setOffset(centerOffset - rect.x);
45
+ if (offset !== centerOffset) {
46
+ setOffset(centerOffset);
47
+ }
48
+ updateRect({
49
+ top: rect.top,
50
+ left: rect.left
51
+ });
45
52
  }
46
- }, [centerOffset, guidelines, editorWidth]);
53
+ }, [updateRect, offset]);
47
54
  var style = (_style = {}, (0, _defineProperty2.default)(_style, _constants.VAR_POSITION_OFFSET_X, "".concat(offset, "px")), (0, _defineProperty2.default)(_style, _constants.VAR_POSITION_OFFSET_Y, "0px"), (0, _defineProperty2.default)(_style, "height", height), _style);
48
55
  return (0, _react2.jsx)("div", {
49
56
  ref: ref,
@@ -1,18 +1,19 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.guidelinePlugin = exports.EMPTY_STATE = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
7
9
  var _react = require("@emotion/react");
8
10
  var _hooks = require("@atlaskit/editor-common/hooks");
9
11
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
10
12
  var _state = require("@atlaskit/editor-prosemirror/state");
11
13
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
12
14
  var _guidelineContainer = require("./guidelineContainer");
13
- var _utils = require("./utils");
14
- /** @jsx jsx */
15
-
15
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
16
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } /** @jsx jsx */
16
17
  var guidelineStyles = (0, _react.css)({
17
18
  position: 'absolute',
18
19
  width: '100%',
@@ -46,7 +47,7 @@ var guidelinePMPlugin = new _safePlugin.SafePlugin({
46
47
  apply: function apply(tr, currentPluginState) {
47
48
  var nextPluginState = tr.getMeta(key);
48
49
  if (nextPluginState) {
49
- return nextPluginState;
50
+ return _objectSpread(_objectSpread({}, currentPluginState), nextPluginState);
50
51
  }
51
52
  return currentPluginState;
52
53
  }
@@ -62,14 +63,33 @@ var ContentComponent = function ContentComponent(_ref) {
62
63
  if (!widthState || !widthState.width || !widthState.lineLength || !guidelineState || !guidelineState.guidelines || guidelineState.guidelines.length === 0) {
63
64
  return null;
64
65
  }
66
+ var updateRect = function updateRect(_ref2) {
67
+ var top = _ref2.top,
68
+ left = _ref2.left;
69
+ var dispatch = editorView.dispatch,
70
+ state = editorView.state;
71
+ var _ref3 = guidelineState.rect || {},
72
+ prevTop = _ref3.top,
73
+ prevLeft = _ref3.left;
74
+ if (prevTop !== top || prevLeft !== left) {
75
+ var tr = state.tr.setMeta(key, {
76
+ rect: {
77
+ top: top,
78
+ left: left
79
+ }
80
+ });
81
+ dispatch(tr);
82
+ return true;
83
+ }
84
+ };
65
85
  return (0, _react.jsx)("div", {
66
86
  css: guidelineStyles
67
87
  }, (0, _react.jsx)(_guidelineContainer.GuidelineContainer, {
68
88
  guidelines: guidelineState.guidelines,
69
89
  height: editorView.dom.scrollHeight,
70
- centerOffset: (0, _utils.getEditorCenterX)(editorView),
71
90
  width: widthState.width,
72
- editorWidth: widthState.lineLength
91
+ editorWidth: widthState.lineLength,
92
+ updateRect: updateRect
73
93
  }));
74
94
  };
75
95
  var guidelinePlugin = function guidelinePlugin(options, api) {
@@ -92,8 +112,8 @@ var guidelinePlugin = function guidelinePlugin(options, api) {
92
112
  }
93
113
  }];
94
114
  },
95
- contentComponent: function contentComponent(_ref2) {
96
- var editorView = _ref2.editorView;
115
+ contentComponent: function contentComponent(_ref4) {
116
+ var editorView = _ref4.editorView;
97
117
  return (0, _react.jsx)(ContentComponent, {
98
118
  editorView: editorView,
99
119
  options: options,
package/dist/cjs/utils.js CHANGED
@@ -4,20 +4,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.innerGuidelines = exports.getEditorCenterX = void 0;
7
+ exports.innerGuidelines = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
9
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
10
- /**
11
- * This function calculates the Editor's x axis of the center point
12
- * in relation to the viewport
13
- * @param editorView
14
- * @returns x axis in number
15
- */
16
- var getEditorCenterX = function getEditorCenterX(editorView) {
17
- var editorRect = editorView.dom.getBoundingClientRect();
18
- return editorRect.width / 2 + editorRect.x - 0.5;
19
- };
20
- exports.getEditorCenterX = getEditorCenterX;
21
10
  var defaultGrids = [-6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6];
22
11
  var innerGuidelines = function innerGuidelines(editorContainerWidth) {
23
12
  var editorWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _editorSharedStyles.akEditorDefaultLayoutWidth;
@@ -18,8 +18,7 @@ export const GuidelineContainer = props => {
18
18
  const {
19
19
  guidelines,
20
20
  height,
21
- editorWidth,
22
- centerOffset
21
+ updateRect
23
22
  } = props;
24
23
  const [offset, setOffset] = useState(0);
25
24
  const ref = useRef(null);
@@ -27,10 +26,18 @@ export const GuidelineContainer = props => {
27
26
  var _ref$current;
28
27
  const rect = ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.getBoundingClientRect();
29
28
  if (rect) {
29
+ const centerOffset = rect.width / 2 - 0.5;
30
+
30
31
  // X pixels from guideline container left to editor center.
31
- setOffset(centerOffset - rect.x);
32
+ if (offset !== centerOffset) {
33
+ setOffset(centerOffset);
34
+ }
35
+ updateRect({
36
+ top: rect.top,
37
+ left: rect.left
38
+ });
32
39
  }
33
- }, [centerOffset, guidelines, editorWidth]);
40
+ }, [updateRect, offset]);
34
41
  const style = {
35
42
  [VAR_POSITION_OFFSET_X]: `${offset}px`,
36
43
  [VAR_POSITION_OFFSET_Y]: `0px`,
@@ -5,7 +5,6 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
5
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
6
  import { akEditorGridLineZIndex } from '@atlaskit/editor-shared-styles';
7
7
  import { GuidelineContainer } from './guidelineContainer';
8
- import { getEditorCenterX } from './utils';
9
8
  const guidelineStyles = css({
10
9
  position: 'absolute',
11
10
  width: '100%',
@@ -38,7 +37,10 @@ const guidelinePMPlugin = new SafePlugin({
38
37
  apply(tr, currentPluginState) {
39
38
  const nextPluginState = tr.getMeta(key);
40
39
  if (nextPluginState) {
41
- return nextPluginState;
40
+ return {
41
+ ...currentPluginState,
42
+ ...nextPluginState
43
+ };
42
44
  }
43
45
  return currentPluginState;
44
46
  }
@@ -56,14 +58,37 @@ const ContentComponent = ({
56
58
  if (!widthState || !widthState.width || !widthState.lineLength || !guidelineState || !guidelineState.guidelines || guidelineState.guidelines.length === 0) {
57
59
  return null;
58
60
  }
61
+ const updateRect = ({
62
+ top,
63
+ left
64
+ }) => {
65
+ const {
66
+ dispatch,
67
+ state
68
+ } = editorView;
69
+ const {
70
+ top: prevTop,
71
+ left: prevLeft
72
+ } = guidelineState.rect || {};
73
+ if (prevTop !== top || prevLeft !== left) {
74
+ const tr = state.tr.setMeta(key, {
75
+ rect: {
76
+ top,
77
+ left
78
+ }
79
+ });
80
+ dispatch(tr);
81
+ return true;
82
+ }
83
+ };
59
84
  return jsx("div", {
60
85
  css: guidelineStyles
61
86
  }, jsx(GuidelineContainer, {
62
87
  guidelines: guidelineState.guidelines,
63
88
  height: editorView.dom.scrollHeight,
64
- centerOffset: getEditorCenterX(editorView),
65
89
  width: widthState.width,
66
- editorWidth: widthState.lineLength
90
+ editorWidth: widthState.lineLength,
91
+ updateRect: updateRect
67
92
  }));
68
93
  };
69
94
  export const guidelinePlugin = (options, api) => ({
@@ -1,14 +1,4 @@
1
1
  import { akEditorBreakoutPadding, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, breakoutWideScaleRatio } from '@atlaskit/editor-shared-styles';
2
- /**
3
- * This function calculates the Editor's x axis of the center point
4
- * in relation to the viewport
5
- * @param editorView
6
- * @returns x axis in number
7
- */
8
- export const getEditorCenterX = editorView => {
9
- const editorRect = editorView.dom.getBoundingClientRect();
10
- return editorRect.width / 2 + editorRect.x - 0.5;
11
- };
12
2
  const defaultGrids = [-6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6];
13
3
  export const innerGuidelines = (editorContainerWidth, editorWidth = akEditorDefaultLayoutWidth) => {
14
4
  const wideSpacing = editorWidth * breakoutWideScaleRatio / 2;
@@ -22,8 +22,7 @@ export var GuidelineContainer = function GuidelineContainer(props) {
22
22
  var _style;
23
23
  var guidelines = props.guidelines,
24
24
  height = props.height,
25
- editorWidth = props.editorWidth,
26
- centerOffset = props.centerOffset;
25
+ updateRect = props.updateRect;
27
26
  var _useState = useState(0),
28
27
  _useState2 = _slicedToArray(_useState, 2),
29
28
  offset = _useState2[0],
@@ -33,10 +32,18 @@ export var GuidelineContainer = function GuidelineContainer(props) {
33
32
  var _ref$current;
34
33
  var rect = ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.getBoundingClientRect();
35
34
  if (rect) {
35
+ var centerOffset = rect.width / 2 - 0.5;
36
+
36
37
  // X pixels from guideline container left to editor center.
37
- setOffset(centerOffset - rect.x);
38
+ if (offset !== centerOffset) {
39
+ setOffset(centerOffset);
40
+ }
41
+ updateRect({
42
+ top: rect.top,
43
+ left: rect.left
44
+ });
38
45
  }
39
- }, [centerOffset, guidelines, editorWidth]);
46
+ }, [updateRect, offset]);
40
47
  var style = (_style = {}, _defineProperty(_style, VAR_POSITION_OFFSET_X, "".concat(offset, "px")), _defineProperty(_style, VAR_POSITION_OFFSET_Y, "0px"), _defineProperty(_style, "height", height), _style);
41
48
  return jsx("div", {
42
49
  ref: ref,
@@ -1,3 +1,6 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1
4
  /** @jsx jsx */
2
5
  import { css, jsx } from '@emotion/react';
3
6
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
@@ -5,7 +8,6 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
8
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
9
  import { akEditorGridLineZIndex } from '@atlaskit/editor-shared-styles';
7
10
  import { GuidelineContainer } from './guidelineContainer';
8
- import { getEditorCenterX } from './utils';
9
11
  var guidelineStyles = css({
10
12
  position: 'absolute',
11
13
  width: '100%',
@@ -38,7 +40,7 @@ var guidelinePMPlugin = new SafePlugin({
38
40
  apply: function apply(tr, currentPluginState) {
39
41
  var nextPluginState = tr.getMeta(key);
40
42
  if (nextPluginState) {
41
- return nextPluginState;
43
+ return _objectSpread(_objectSpread({}, currentPluginState), nextPluginState);
42
44
  }
43
45
  return currentPluginState;
44
46
  }
@@ -54,14 +56,33 @@ var ContentComponent = function ContentComponent(_ref) {
54
56
  if (!widthState || !widthState.width || !widthState.lineLength || !guidelineState || !guidelineState.guidelines || guidelineState.guidelines.length === 0) {
55
57
  return null;
56
58
  }
59
+ var updateRect = function updateRect(_ref2) {
60
+ var top = _ref2.top,
61
+ left = _ref2.left;
62
+ var dispatch = editorView.dispatch,
63
+ state = editorView.state;
64
+ var _ref3 = guidelineState.rect || {},
65
+ prevTop = _ref3.top,
66
+ prevLeft = _ref3.left;
67
+ if (prevTop !== top || prevLeft !== left) {
68
+ var tr = state.tr.setMeta(key, {
69
+ rect: {
70
+ top: top,
71
+ left: left
72
+ }
73
+ });
74
+ dispatch(tr);
75
+ return true;
76
+ }
77
+ };
57
78
  return jsx("div", {
58
79
  css: guidelineStyles
59
80
  }, jsx(GuidelineContainer, {
60
81
  guidelines: guidelineState.guidelines,
61
82
  height: editorView.dom.scrollHeight,
62
- centerOffset: getEditorCenterX(editorView),
63
83
  width: widthState.width,
64
- editorWidth: widthState.lineLength
84
+ editorWidth: widthState.lineLength,
85
+ updateRect: updateRect
65
86
  }));
66
87
  };
67
88
  export var guidelinePlugin = function guidelinePlugin(options, api) {
@@ -84,8 +105,8 @@ export var guidelinePlugin = function guidelinePlugin(options, api) {
84
105
  }
85
106
  }];
86
107
  },
87
- contentComponent: function contentComponent(_ref2) {
88
- var editorView = _ref2.editorView;
108
+ contentComponent: function contentComponent(_ref4) {
109
+ var editorView = _ref4.editorView;
89
110
  return jsx(ContentComponent, {
90
111
  editorView: editorView,
91
112
  options: options,
package/dist/esm/utils.js CHANGED
@@ -1,15 +1,5 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import { akEditorBreakoutPadding, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, breakoutWideScaleRatio } from '@atlaskit/editor-shared-styles';
3
- /**
4
- * This function calculates the Editor's x axis of the center point
5
- * in relation to the viewport
6
- * @param editorView
7
- * @returns x axis in number
8
- */
9
- export var getEditorCenterX = function getEditorCenterX(editorView) {
10
- var editorRect = editorView.dom.getBoundingClientRect();
11
- return editorRect.width / 2 + editorRect.x - 0.5;
12
- };
13
3
  var defaultGrids = [-6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6];
14
4
  export var innerGuidelines = function innerGuidelines(editorContainerWidth) {
15
5
  var editorWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : akEditorDefaultLayoutWidth;
@@ -1,11 +1,11 @@
1
1
  import { jsx } from '@emotion/react';
2
- import { GuidelineConfig } from './types';
2
+ import type { GuidelineConfig, GuidelineContainerRect } from './types';
3
3
  type ContainerProps = {
4
4
  guidelines: GuidelineConfig[];
5
5
  height: number;
6
- centerOffset: number;
7
6
  width: number;
8
7
  editorWidth: number;
8
+ updateRect: (rect: GuidelineContainerRect) => void;
9
9
  };
10
10
  export declare const GuidelineContainer: (props: ContainerProps) => jsx.JSX.Element;
11
11
  export {};
@@ -1 +1,2 @@
1
1
  export { guidelinePlugin } from './plugin';
2
+ export type { GuidelinePlugin } from './plugin';
@@ -1,11 +1,12 @@
1
- import { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
- import type { widthPlugin } from '@atlaskit/editor-plugin-width';
3
- import { DisplayGuideline, GuidelinePluginState } from './types';
1
+ import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
+ import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
3
+ import type { DisplayGuideline, GuidelinePluginState } from './types';
4
4
  export declare const EMPTY_STATE: GuidelinePluginState;
5
- export declare const guidelinePlugin: NextEditorPlugin<'guideline', {
6
- dependencies: [typeof widthPlugin];
5
+ export type GuidelinePlugin = NextEditorPlugin<'guideline', {
6
+ dependencies: [WidthPlugin];
7
7
  sharedState: GuidelinePluginState | null;
8
8
  actions: {
9
9
  displayGuideline: DisplayGuideline;
10
10
  };
11
11
  }>;
12
+ export declare const guidelinePlugin: GuidelinePlugin;
@@ -1 +1 @@
1
- export type { WidthTypes, Position, VerticalPosition, HorizontalPosition, GuidelineConfig, GuidelinePluginState, GuidelinePluginOptions, DisplayGuideline, DisplayGrid, } from '@atlaskit/editor-common/guideline';
1
+ export type { WidthTypes, Position, VerticalPosition, HorizontalPosition, GuidelineConfig, GuidelineContainerRect, GuidelinePluginState, GuidelinePluginOptions, DisplayGuideline, DisplayGrid, } from '@atlaskit/editor-common/guideline';
@@ -1,10 +1,2 @@
1
- import { EditorView } from '@atlaskit/editor-prosemirror/view';
2
- import { GuidelineConfig } from './types';
3
- /**
4
- * This function calculates the Editor's x axis of the center point
5
- * in relation to the viewport
6
- * @param editorView
7
- * @returns x axis in number
8
- */
9
- export declare const getEditorCenterX: (editorView: EditorView) => number;
1
+ import type { GuidelineConfig } from './types';
10
2
  export declare const innerGuidelines: (editorContainerWidth: number, editorWidth?: number) => GuidelineConfig[];
@@ -1,11 +1,11 @@
1
1
  import { jsx } from '@emotion/react';
2
- import { GuidelineConfig } from './types';
2
+ import type { GuidelineConfig, GuidelineContainerRect } from './types';
3
3
  type ContainerProps = {
4
4
  guidelines: GuidelineConfig[];
5
5
  height: number;
6
- centerOffset: number;
7
6
  width: number;
8
7
  editorWidth: number;
8
+ updateRect: (rect: GuidelineContainerRect) => void;
9
9
  };
10
10
  export declare const GuidelineContainer: (props: ContainerProps) => jsx.JSX.Element;
11
11
  export {};
@@ -1 +1,2 @@
1
1
  export { guidelinePlugin } from './plugin';
2
+ export type { GuidelinePlugin } from './plugin';
@@ -1,13 +1,14 @@
1
- import { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
- import type { widthPlugin } from '@atlaskit/editor-plugin-width';
3
- import { DisplayGuideline, GuidelinePluginState } from './types';
1
+ import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
+ import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
3
+ import type { DisplayGuideline, GuidelinePluginState } from './types';
4
4
  export declare const EMPTY_STATE: GuidelinePluginState;
5
- export declare const guidelinePlugin: NextEditorPlugin<'guideline', {
5
+ export type GuidelinePlugin = NextEditorPlugin<'guideline', {
6
6
  dependencies: [
7
- typeof widthPlugin
7
+ WidthPlugin
8
8
  ];
9
9
  sharedState: GuidelinePluginState | null;
10
10
  actions: {
11
11
  displayGuideline: DisplayGuideline;
12
12
  };
13
13
  }>;
14
+ export declare const guidelinePlugin: GuidelinePlugin;
@@ -1 +1 @@
1
- export type { WidthTypes, Position, VerticalPosition, HorizontalPosition, GuidelineConfig, GuidelinePluginState, GuidelinePluginOptions, DisplayGuideline, DisplayGrid, } from '@atlaskit/editor-common/guideline';
1
+ export type { WidthTypes, Position, VerticalPosition, HorizontalPosition, GuidelineConfig, GuidelineContainerRect, GuidelinePluginState, GuidelinePluginOptions, DisplayGuideline, DisplayGrid, } from '@atlaskit/editor-common/guideline';
@@ -1,10 +1,2 @@
1
- import { EditorView } from '@atlaskit/editor-prosemirror/view';
2
- import { GuidelineConfig } from './types';
3
- /**
4
- * This function calculates the Editor's x axis of the center point
5
- * in relation to the viewport
6
- * @param editorView
7
- * @returns x axis in number
8
- */
9
- export declare const getEditorCenterX: (editorView: EditorView) => number;
1
+ import type { GuidelineConfig } from './types';
10
2
  export declare const innerGuidelines: (editorContainerWidth: number, editorWidth?: number) => GuidelineConfig[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-guideline",
3
- "version": "0.3.13",
3
+ "version": "0.4.1",
4
4
  "description": "guideline plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -23,12 +23,12 @@
23
23
  ".": "./src/index.ts"
24
24
  },
25
25
  "dependencies": {
26
- "@atlaskit/editor-common": "^74.46.0",
26
+ "@atlaskit/editor-common": "^74.52.0",
27
27
  "@atlaskit/editor-plugin-width": "^0.1.0",
28
28
  "@atlaskit/editor-prosemirror": "1.1.0",
29
29
  "@atlaskit/editor-shared-styles": "^2.6.0",
30
30
  "@atlaskit/theme": "^12.5.0",
31
- "@atlaskit/tokens": "^1.14.0",
31
+ "@atlaskit/tokens": "^1.16.0",
32
32
  "@babel/runtime": "^7.0.0",
33
33
  "@emotion/react": "^11.7.1"
34
34
  },
package/report.api.md CHANGED
@@ -17,14 +17,14 @@
17
17
  ```ts
18
18
  import { DisplayGuideline } from '@atlaskit/editor-common/guideline';
19
19
  import { GuidelinePluginState } from '@atlaskit/editor-common/guideline';
20
- import { NextEditorPlugin } from '@atlaskit/editor-common/types';
21
- import type { widthPlugin } from '@atlaskit/editor-plugin-width';
20
+ import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
21
+ import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
22
22
 
23
23
  // @public (undocumented)
24
- export const guidelinePlugin: NextEditorPlugin<
24
+ export type GuidelinePlugin = NextEditorPlugin<
25
25
  'guideline',
26
26
  {
27
- dependencies: [typeof widthPlugin];
27
+ dependencies: [WidthPlugin];
28
28
  sharedState: GuidelinePluginState | null;
29
29
  actions: {
30
30
  displayGuideline: DisplayGuideline;
@@ -32,6 +32,9 @@ export const guidelinePlugin: NextEditorPlugin<
32
32
  }
33
33
  >;
34
34
 
35
+ // @public (undocumented)
36
+ export const guidelinePlugin: GuidelinePlugin;
37
+
35
38
  // (No @packageDocumentation comment for this package)
36
39
  ```
37
40
 
@@ -1,23 +0,0 @@
1
- ## API Report File for "@atlaskit/editor-plugin-guideline"
2
-
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
-
5
- ```ts
6
-
7
- import { DisplayGuideline } from '@atlaskit/editor-common/guideline';
8
- import { GuidelinePluginState } from '@atlaskit/editor-common/guideline';
9
- import { NextEditorPlugin } from '@atlaskit/editor-common/types';
10
- import type { widthPlugin } from '@atlaskit/editor-plugin-width';
11
-
12
- // @public (undocumented)
13
- export const guidelinePlugin: NextEditorPlugin<'guideline', {
14
- dependencies: [typeof widthPlugin];
15
- sharedState: GuidelinePluginState | null;
16
- actions: {
17
- displayGuideline: DisplayGuideline;
18
- };
19
- }>;
20
-
21
- // (No @packageDocumentation comment for this package)
22
-
23
- ```