@atlaskit/editor-plugin-guideline 0.3.0 → 0.3.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,12 @@
1
1
  # @atlaskit/editor-plugin-guideline
2
2
 
3
+ ## 0.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`7cd4abcdc0d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7cd4abcdc0d) - Fix workaround in `editor-plugin-width`. This involved removing `WidthEmitter` in `editor-core`, removing `containerWidth` from `WidthPluginState`. This change also introduces `usePluginHook` for an `EditorPlugin` - this enables a react hook to be mounted for plugins (in all appearances).
8
+ - Updated dependencies
9
+
3
10
  ## 0.3.0
4
11
 
5
12
  ### Minor Changes
@@ -59,7 +59,7 @@ var ContentComponent = function ContentComponent(_ref) {
59
59
  var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['width', 'guideline']),
60
60
  widthState = _useSharedPluginState.widthState,
61
61
  guidelineState = _useSharedPluginState.guidelineState;
62
- if (!widthState || !widthState.containerWidth || !widthState.lineLength || !guidelineState || !guidelineState.guidelines || guidelineState.guidelines.length === 0) {
62
+ if (!widthState || !widthState.width || !widthState.lineLength || !guidelineState || !guidelineState.guidelines || guidelineState.guidelines.length === 0) {
63
63
  return null;
64
64
  }
65
65
  return (0, _react.jsx)("div", {
@@ -68,7 +68,7 @@ var ContentComponent = function ContentComponent(_ref) {
68
68
  guidelines: guidelineState.guidelines,
69
69
  height: editorView.dom.scrollHeight,
70
70
  centerOffset: (0, _utils.getEditorCenterX)(editorView),
71
- containerWidth: widthState.containerWidth,
71
+ width: widthState.width,
72
72
  editorWidth: widthState.lineLength
73
73
  }));
74
74
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-guideline",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "sideEffects": false
5
5
  }
@@ -53,7 +53,7 @@ const ContentComponent = ({
53
53
  widthState,
54
54
  guidelineState
55
55
  } = useSharedPluginState(api, ['width', 'guideline']);
56
- if (!widthState || !widthState.containerWidth || !widthState.lineLength || !guidelineState || !guidelineState.guidelines || guidelineState.guidelines.length === 0) {
56
+ if (!widthState || !widthState.width || !widthState.lineLength || !guidelineState || !guidelineState.guidelines || guidelineState.guidelines.length === 0) {
57
57
  return null;
58
58
  }
59
59
  return jsx("div", {
@@ -62,7 +62,7 @@ const ContentComponent = ({
62
62
  guidelines: guidelineState.guidelines,
63
63
  height: editorView.dom.scrollHeight,
64
64
  centerOffset: getEditorCenterX(editorView),
65
- containerWidth: widthState.containerWidth,
65
+ width: widthState.width,
66
66
  editorWidth: widthState.lineLength
67
67
  }));
68
68
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-guideline",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "sideEffects": false
5
5
  }
@@ -51,7 +51,7 @@ var ContentComponent = function ContentComponent(_ref) {
51
51
  var _useSharedPluginState = useSharedPluginState(api, ['width', 'guideline']),
52
52
  widthState = _useSharedPluginState.widthState,
53
53
  guidelineState = _useSharedPluginState.guidelineState;
54
- if (!widthState || !widthState.containerWidth || !widthState.lineLength || !guidelineState || !guidelineState.guidelines || guidelineState.guidelines.length === 0) {
54
+ if (!widthState || !widthState.width || !widthState.lineLength || !guidelineState || !guidelineState.guidelines || guidelineState.guidelines.length === 0) {
55
55
  return null;
56
56
  }
57
57
  return jsx("div", {
@@ -60,7 +60,7 @@ var ContentComponent = function ContentComponent(_ref) {
60
60
  guidelines: guidelineState.guidelines,
61
61
  height: editorView.dom.scrollHeight,
62
62
  centerOffset: getEditorCenterX(editorView),
63
- containerWidth: widthState.containerWidth,
63
+ width: widthState.width,
64
64
  editorWidth: widthState.lineLength
65
65
  }));
66
66
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-guideline",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "sideEffects": false
5
5
  }
@@ -4,7 +4,7 @@ type ContainerProps = {
4
4
  guidelines: GuidelineConfig[];
5
5
  height: number;
6
6
  centerOffset: number;
7
- containerWidth: number;
7
+ width: number;
8
8
  editorWidth: number;
9
9
  };
10
10
  export declare const GuidelineContainer: (props: ContainerProps) => jsx.JSX.Element;
@@ -4,7 +4,7 @@ type ContainerProps = {
4
4
  guidelines: GuidelineConfig[];
5
5
  height: number;
6
6
  centerOffset: number;
7
- containerWidth: number;
7
+ width: number;
8
8
  editorWidth: number;
9
9
  };
10
10
  export declare const GuidelineContainer: (props: ContainerProps) => jsx.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-guideline",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "guideline plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "atlassian": {
11
11
  "team": "Editor",
12
- "releaseModel": "scheduled"
12
+ "releaseModel": "continuous"
13
13
  },
14
14
  "repository": "https://bitbucket.org/atlassian/atlassian-frontend",
15
15
  "main": "dist/cjs/index.js",
@@ -22,8 +22,8 @@
22
22
  ".": "./src/index.ts"
23
23
  },
24
24
  "dependencies": {
25
- "@atlaskit/editor-common": "^74.4.0",
26
- "@atlaskit/editor-plugin-width": "^0.0.1",
25
+ "@atlaskit/editor-common": "^74.5.0",
26
+ "@atlaskit/editor-plugin-width": "^0.1.0",
27
27
  "@atlaskit/editor-shared-styles": "^2.4.0",
28
28
  "@atlaskit/theme": "^12.5.0",
29
29
  "@atlaskit/tokens": "^1.4.2",
package/report.api.md CHANGED
@@ -28,23 +28,13 @@ type DisplayGuideline = (view: EditorView) => DisplayGrid;
28
28
  // @public (undocumented)
29
29
  export type GuidelineConfig = {
30
30
  key: string;
31
- position: GuidelinePosition;
31
+ position: Position;
32
32
  active?: boolean;
33
33
  show?: boolean;
34
34
  style?: 'dashed' | 'solid';
35
35
  color?: string;
36
36
  };
37
37
 
38
- // @public (undocumented)
39
- enum GuidelineContainerArea {
40
- // (undocumented)
41
- EditorContent = 'editorContent',
42
- // (undocumented)
43
- EditorLeftMargin = 'editorLeftMargin',
44
- // (undocumented)
45
- EditorRightMargin = 'editorRightMargin',
46
- }
47
-
48
38
  // @public (undocumented)
49
39
  export const guidelinePlugin: NextEditorPlugin<
50
40
  'guideline',
@@ -63,23 +53,9 @@ type GuidelinePluginState = {
63
53
  };
64
54
 
65
55
  // @public (undocumented)
66
- type GuidelinePosition = {
67
- containerArea?: GuidelineContainerArea;
68
- } & PositionSide;
69
-
70
- // @public (undocumented)
71
- type PositionSide =
72
- | {
73
- left: PositionValue;
74
- right?: never;
75
- }
76
- | {
77
- right: PositionValue;
78
- left?: never;
79
- };
80
-
81
- // @public (undocumented)
82
- type PositionValue = 0 | `${number}%` | `${number}px`;
56
+ type Position = {
57
+ x: number;
58
+ };
83
59
 
84
60
  // (No @packageDocumentation comment for this package)
85
61
  ```
@@ -0,0 +1,48 @@
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 { EditorView } from 'prosemirror-view';
8
+ import { NextEditorPlugin } from '@atlaskit/editor-common/types';
9
+ import type { widthPlugin } from '@atlaskit/editor-plugin-width';
10
+
11
+ // @public (undocumented)
12
+ type DisplayGrid = (props: Required<GuidelinePluginState>) => boolean;
13
+
14
+ // @public (undocumented)
15
+ type DisplayGuideline = (view: EditorView) => DisplayGrid;
16
+
17
+ // @public (undocumented)
18
+ export type GuidelineConfig = {
19
+ key: string;
20
+ position: Position;
21
+ active?: boolean;
22
+ show?: boolean;
23
+ style?: 'dashed' | 'solid';
24
+ color?: string;
25
+ };
26
+
27
+ // @public (undocumented)
28
+ export const guidelinePlugin: NextEditorPlugin<'guideline', {
29
+ dependencies: [typeof widthPlugin];
30
+ sharedState: GuidelinePluginState | null;
31
+ actions: {
32
+ displayGuideline: DisplayGuideline;
33
+ };
34
+ }>;
35
+
36
+ // @public (undocumented)
37
+ type GuidelinePluginState = {
38
+ guidelines: GuidelineConfig[];
39
+ };
40
+
41
+ // @public (undocumented)
42
+ type Position = {
43
+ x: number;
44
+ };
45
+
46
+ // (No @packageDocumentation comment for this package)
47
+
48
+ ```