@atlaskit/editor-plugin-guideline 0.3.5 → 0.3.7

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,17 @@
1
1
  # @atlaskit/editor-plugin-guideline
2
2
 
3
+ ## 0.3.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`4e6f1bf8511`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4e6f1bf8511) - [ED-19233] Import prosemirror libraries from internal facade package
8
+
9
+ ## 0.3.6
10
+
11
+ ### Patch Changes
12
+
13
+ - [`3d065399b07`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3d065399b07) - ED-18969 refactor guideline plugin interface.
14
+
3
15
  ## 0.3.5
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -85,15 +85,19 @@ type GuidelineConfig = {
85
85
  ...
86
86
  active?: boolean;
87
87
  show?: boolean;
88
- style?: 'dashed' | 'solid'; // default solid
89
- color?: CSSToken;
88
+ styles: {
89
+ lineStyle?: 'dashed' | 'solid'; // default solid
90
+ color?: CSSToken;
91
+ capStyle?: 'line'
92
+ }
90
93
  };
91
94
  ```
92
95
 
93
96
  - `active` default `false`, equivalent to the `highlight` state in the `grid` plugin.
94
- - `style` default `solid`, and we also support `dashed`
95
97
  - `show` default `true` and you can also hide a guideline, could be useful when you need animations.
96
- - `color`: default `undefined` you can override the color of a guideline with a valid `css` color
98
+ - `styles.color`: default `undefined` you can override the color of a guideline with a valid `css` color
99
+ - `styles.lineStyle` default `solid`, and we also support `dashed`
100
+ - `styles.capStyle` default undefined, and support `line`
97
101
 
98
102
  ## TODO
99
103
  - [ ] Add unit/vr tests
@@ -75,12 +75,14 @@ var Guideline = function Guideline(props) {
75
75
  active = props.active,
76
76
  _props$show = props.show,
77
77
  show = _props$show === void 0 ? true : _props$show,
78
- style = props.style,
79
- color = props.color,
80
- styles = props.styles;
78
+ _props$styles = props.styles,
79
+ styles = _props$styles === void 0 ? {} : _props$styles;
81
80
  var isVerticalPos = (0, _guideline.isVerticalPosition)(position);
81
+ var lineStyle = styles.lineStyle,
82
+ color = styles.color,
83
+ capStyle = styles.capStyle;
82
84
  return (0, _react.jsx)("div", {
83
- css: [basicGuidelineStyles, isVerticalPos ? verticalStyles : horizontalStyles, (styles === null || styles === void 0 ? void 0 : styles.capStyle) === 'line' && (isVerticalPos ? horizontalCapStyles : verticalCapStyles), active && activeGuidelineStyles, !show && hiddenGuidelineStyles, style === 'dashed' && dashedGuidelineStyles],
85
+ css: [basicGuidelineStyles, isVerticalPos ? verticalStyles : horizontalStyles, capStyle === 'line' && (isVerticalPos ? horizontalCapStyles : verticalCapStyles), active && activeGuidelineStyles, !show && hiddenGuidelineStyles, lineStyle === 'dashed' && dashedGuidelineStyles],
84
86
  style: _objectSpread(_objectSpread({}, color && {
85
87
  borderColor: "".concat(color)
86
88
  }), (0, _positionStyles.getPositionStyles)(position)),
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.guidelinePlugin = exports.EMPTY_STATE = void 0;
7
7
  var _react = require("@emotion/react");
8
- var _prosemirrorState = require("prosemirror-state");
9
8
  var _hooks = require("@atlaskit/editor-common/hooks");
10
9
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
10
+ var _state = require("@atlaskit/editor-prosemirror/state");
11
11
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
12
12
  var _guidelineContainer = require("./guidelineContainer");
13
13
  var _utils = require("./utils");
@@ -23,7 +23,7 @@ var guidelineStyles = (0, _react.css)({
23
23
  display: 'flex',
24
24
  justifyContent: 'center'
25
25
  });
26
- var key = new _prosemirrorState.PluginKey('guidelinePlugin');
26
+ var key = new _state.PluginKey('guidelinePlugin');
27
27
  var displayGuideline = function displayGuideline(view) {
28
28
  return function (props) {
29
29
  var dispatch = view.dispatch,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-guideline",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "sideEffects": false
5
5
  }
@@ -66,13 +66,16 @@ export const Guideline = props => {
66
66
  position,
67
67
  active,
68
68
  show = true,
69
- style,
70
- color,
71
- styles
69
+ styles = {}
72
70
  } = props;
73
71
  const isVerticalPos = isVerticalPosition(position);
72
+ const {
73
+ lineStyle,
74
+ color,
75
+ capStyle
76
+ } = styles;
74
77
  return jsx("div", {
75
- css: [basicGuidelineStyles, isVerticalPos ? verticalStyles : horizontalStyles, (styles === null || styles === void 0 ? void 0 : styles.capStyle) === 'line' && (isVerticalPos ? horizontalCapStyles : verticalCapStyles), active && activeGuidelineStyles, !show && hiddenGuidelineStyles, style === 'dashed' && dashedGuidelineStyles],
78
+ css: [basicGuidelineStyles, isVerticalPos ? verticalStyles : horizontalStyles, capStyle === 'line' && (isVerticalPos ? horizontalCapStyles : verticalCapStyles), active && activeGuidelineStyles, !show && hiddenGuidelineStyles, lineStyle === 'dashed' && dashedGuidelineStyles],
76
79
  style: {
77
80
  ...(color && {
78
81
  borderColor: `${color}`
@@ -1,8 +1,8 @@
1
1
  /** @jsx jsx */
2
2
  import { css, jsx } from '@emotion/react';
3
- import { PluginKey } from 'prosemirror-state';
4
3
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
5
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
6
  import { akEditorGridLineZIndex } from '@atlaskit/editor-shared-styles';
7
7
  import { GuidelineContainer } from './guidelineContainer';
8
8
  import { getEditorCenterX } from './utils';
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-guideline",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "sideEffects": false
5
5
  }
@@ -69,12 +69,14 @@ export var Guideline = function Guideline(props) {
69
69
  active = props.active,
70
70
  _props$show = props.show,
71
71
  show = _props$show === void 0 ? true : _props$show,
72
- style = props.style,
73
- color = props.color,
74
- styles = props.styles;
72
+ _props$styles = props.styles,
73
+ styles = _props$styles === void 0 ? {} : _props$styles;
75
74
  var isVerticalPos = isVerticalPosition(position);
75
+ var lineStyle = styles.lineStyle,
76
+ color = styles.color,
77
+ capStyle = styles.capStyle;
76
78
  return jsx("div", {
77
- css: [basicGuidelineStyles, isVerticalPos ? verticalStyles : horizontalStyles, (styles === null || styles === void 0 ? void 0 : styles.capStyle) === 'line' && (isVerticalPos ? horizontalCapStyles : verticalCapStyles), active && activeGuidelineStyles, !show && hiddenGuidelineStyles, style === 'dashed' && dashedGuidelineStyles],
79
+ css: [basicGuidelineStyles, isVerticalPos ? verticalStyles : horizontalStyles, capStyle === 'line' && (isVerticalPos ? horizontalCapStyles : verticalCapStyles), active && activeGuidelineStyles, !show && hiddenGuidelineStyles, lineStyle === 'dashed' && dashedGuidelineStyles],
78
80
  style: _objectSpread(_objectSpread({}, color && {
79
81
  borderColor: "".concat(color)
80
82
  }), getPositionStyles(position)),
@@ -1,8 +1,8 @@
1
1
  /** @jsx jsx */
2
2
  import { css, jsx } from '@emotion/react';
3
- import { PluginKey } from 'prosemirror-state';
4
3
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
5
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
6
  import { akEditorGridLineZIndex } from '@atlaskit/editor-shared-styles';
7
7
  import { GuidelineContainer } from './guidelineContainer';
8
8
  import { getEditorCenterX } from './utils';
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-guideline",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "sideEffects": false
5
5
  }
@@ -1,4 +1,4 @@
1
- import { EditorView } from 'prosemirror-view';
1
+ import { EditorView } from '@atlaskit/editor-prosemirror/view';
2
2
  import { GuidelineConfig } from './types';
3
3
  /**
4
4
  * This function calculates the Editor's x axis of the center point
@@ -1,4 +1,4 @@
1
- import { EditorView } from 'prosemirror-view';
1
+ import { EditorView } from '@atlaskit/editor-prosemirror/view';
2
2
  import { GuidelineConfig } from './types';
3
3
  /**
4
4
  * This function calculates the Editor's x axis of the center point
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-guideline",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "description": "guideline plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -23,15 +23,14 @@
23
23
  ".": "./src/index.ts"
24
24
  },
25
25
  "dependencies": {
26
- "@atlaskit/editor-common": "^74.26.0",
26
+ "@atlaskit/editor-common": "^74.29.0",
27
27
  "@atlaskit/editor-plugin-width": "^0.1.0",
28
- "@atlaskit/editor-shared-styles": "^2.4.0",
28
+ "@atlaskit/editor-prosemirror": "1.0.2",
29
+ "@atlaskit/editor-shared-styles": "^2.5.0",
29
30
  "@atlaskit/theme": "^12.5.0",
30
31
  "@atlaskit/tokens": "^1.13.0",
31
32
  "@babel/runtime": "^7.0.0",
32
- "@emotion/react": "^11.7.1",
33
- "prosemirror-state": "1.3.4",
34
- "prosemirror-view": "1.23.7"
33
+ "@emotion/react": "^11.7.1"
35
34
  },
36
35
  "peerDependencies": {
37
36
  "react": "^16.8.0"