@atlaskit/editor-plugin-guideline 8.0.2 → 8.0.4

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +65 -52
  3. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-plugin-guideline
2
2
 
3
+ ## 8.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`3da5fc5ff18bc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3da5fc5ff18bc) -
8
+ Update README.md and 0-intro.tsx
9
+ - Updated dependencies
10
+
11
+ ## 8.0.3
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 8.0.2
4
18
 
5
19
  ### Patch Changes
package/README.md CHANGED
@@ -1,52 +1,68 @@
1
- # EditorPluginGuideline
1
+ # Editor Plugin Guideline
2
2
 
3
- guideline plugin for @atlaskit/editor-core
3
+ Guideline plugin for @atlaskit/editor-core
4
4
 
5
- ## Usage
5
+ ## Overview
6
+
7
+ The Guideline plugin provides the ability to display vertical guidelines in the editor. Guidelines are rendered as vertical lines at specified positions and can be customized with different styles and states. This plugin was designed to contain only basic logic to render guidelines. Commonly used configurations and utilities reside in the `editor-common` package.
8
+
9
+ ## Key features
6
10
 
7
- See `packages/editor/editor-plugin-guideline/src/types.ts` for detailed guideline config interface.
11
+ - **Display guidelines** - Render vertical guidelines at specified positions within the editor
12
+ - **Flexible positioning** - Position guidelines using coordinate values relative to the editor center
13
+ - **Customizable styles** - Configure line style (solid/dashed), color, and cap style
14
+ - **State management** - Control visibility and active states of individual guidelines
15
+ - **Plugin integration** - Works with the width plugin to calculate correct positioning
8
16
 
9
- Example usage:
17
+ ## Install
10
18
 
11
19
  ```
20
+ yarn add @atlaskit/editor-plugin-guideline
21
+ ```
22
+
23
+ - **npm** - [@atlaskit/editor-plugin-guideline](https://www.npmjs.com/package/@atlaskit/editor-plugin-guideline)
24
+ - **Source** - [Bitbucket](https://bitbucket.org/atlassian/atlassian-frontend/src/master/packages/editor/editor-plugin-guideline)
25
+
26
+ ## Usage
27
+
28
+ ### Basic Example
29
+
30
+ ```typescript
12
31
  pluginInjectionApi?.dependencies?.guideline?.actions?.displayGuideline(view)({
13
32
  guidelines: [{
14
- key: "guideline_01"
33
+ key: "guideline_01",
15
34
  position: {
16
35
  x: -100
17
- }; // The position of the guideline
36
+ },
18
37
  active: true,
19
38
  style: "dashed",
20
39
  color: "rgba(0, 0, 0, 0.2)"
21
40
  },
22
41
  {
23
- key: "guideline_02"
42
+ key: "guideline_02",
24
43
  position: {
25
44
  x: 300
26
- };
27
- show: false,
45
+ },
46
+ show: false
28
47
  }]
29
48
  });
30
- ```
31
-
32
- A guideline config consists of three parts:
33
- - A unique key (required)
34
- - Position (required)
35
- - State/Style (optional)
36
-
37
- This plugin was designed to be "dumb". Meaning that it only contains very basic logics to render the guidelines. Commonly used configurations and utils will be reside in the `editor-common` package.
49
+ ```
38
50
 
51
+ ### Guideline Configuration
39
52
 
53
+ A guideline config consists of three parts:
40
54
 
41
- ## Position:
55
+ - **Key** (required) - A unique identifier for the guideline
56
+ - **Position** (required) - The x-coordinate position of the guideline
57
+ - **State/Style** (optional) - Display state and styling options
42
58
 
43
- The following diagram shows:
44
- - The layout of the guideline display area
45
- - The position of a guideline for a given X value.
46
- <pre>
59
+ ### Position
47
60
 
61
+ The position value is defined as: `type Position = { x: number };`
48
62
 
63
+ Position diagram:
49
64
 
65
+ ```
50
66
  │ editor width │
51
67
  │------------------- max 1800px --------------------│
52
68
  │ │
@@ -66,43 +82,40 @@ The following diagram shows:
66
82
  │ editor content │
67
83
  │-------- max 760px ------│
68
84
  │---------- or 1800px in full-width mode ----------│
69
-
70
- </pre>
85
+ ```
71
86
 
72
- The position value is defined as follow:
73
- `type Position = { x: number };`
74
- * When x is 0, a vertical line is displayed at the center of the editor (see the diagram above).
75
- * A negative value will move the line to the left, up to minus half of the editor width.
76
- * A positive value will move the line to the right, up to half of the editor width.
77
- * If a `x` value is outside of the visible range, if will be ignored. (See the todo section)
87
+ - When `x` is 0, a vertical line is displayed at the center of the editor
88
+ - Negative values move the line left (up to minus half of the editor width)
89
+ - Positive values move the line right (up to half of the editor width)
90
+ - Guidelines outside the visible range are ignored
78
91
 
92
+ ### State and Style
79
93
 
80
- ## State/Style
94
+ Configure guidelines with the following state and style options:
81
95
 
82
- We have the follow state/style configurations
83
- ```
96
+ ```typescript
84
97
  type GuidelineConfig = {
85
- ...
86
- active?: boolean;
87
- show?: boolean;
88
- styles: {
89
- lineStyle?: 'dashed' | 'solid'; // default solid
90
- color?: CSSToken;
91
- capStyle?: 'line'
98
+ // ...
99
+ active?: boolean; // default false
100
+ show?: boolean; // default true
101
+ styles?: {
102
+ lineStyle?: 'dashed' | 'solid'; // default 'solid'
103
+ color?: CSSToken; // default undefined
104
+ capStyle?: 'line' // default undefined
92
105
  }
93
106
  };
94
107
  ```
95
108
 
96
- - `active` default `false`, equivalent to the `highlight` state in the `grid` plugin.
97
- - `show` default `true` and you can also hide a guideline, could be useful when you need animations.
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`
109
+ - `active` - Equivalent to the highlight state in the grid plugin
110
+ - `show` - Hide a guideline (useful for animations)
111
+ - `styles.color` - Override the guideline color with a valid CSS color
112
+ - `styles.lineStyle` - Line style can be 'solid' or 'dashed'
113
+ - `styles.capStyle` - Line cap style, supports 'line'
114
+
115
+ ## Support
116
+
117
+ For internal Atlassian, visit the slack channel [#help-editor](https://atlassian.slack.com/archives/CFG3PSQ9E) for support or visit [go/editor-help](https://go/editor-help) to submit a bug.
101
118
 
102
- ## TODO
103
- - [ ] Add unit/vr tests
104
- - [ ] Handle guidelines which are outside of visitable range.
105
- - [ ] Implement the Grid plug option, `shouldCalcBreakoutGridLines?: boolean;`
106
- - [ ] Retire the exist Grid plugin. and replace it with this plugin. Plugins currently use the grid plugin: media, table and card.
107
- - [ ] Investigate a better way to handle the `color` attribute, to avoid a fragmented experiences in the Editor.
119
+ ## License
108
120
 
121
+ Please see [Atlassian Frontend - License](https://hello.atlassian.net/wiki/spaces/AF/pages/2589099144/Documentation#License) for more licensing information.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-guideline",
3
- "version": "8.0.2",
3
+ "version": "8.0.4",
4
4
  "description": "guideline plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -24,12 +24,12 @@
24
24
  "@atlaskit/editor-plugin-width": "^9.0.0",
25
25
  "@atlaskit/editor-prosemirror": "^7.3.0",
26
26
  "@atlaskit/editor-shared-styles": "^3.10.0",
27
- "@atlaskit/tokens": "^12.0.0",
27
+ "@atlaskit/tokens": "^13.0.0",
28
28
  "@babel/runtime": "^7.0.0",
29
29
  "@emotion/react": "^11.7.1"
30
30
  },
31
31
  "peerDependencies": {
32
- "@atlaskit/editor-common": "^112.18.0",
32
+ "@atlaskit/editor-common": "^112.20.0",
33
33
  "react": "^18.2.0",
34
34
  "react-dom": "^18.2.0"
35
35
  },