@atlaskit/editor-plugin-guideline 2.0.11 → 3.0.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 +48 -0
- package/dist/cjs/guidelinePlugin.js +9 -10
- package/dist/es2019/guidelinePlugin.js +10 -11
- package/dist/esm/guidelinePlugin.js +10 -11
- package/package.json +5 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-guideline
|
|
2
2
|
|
|
3
|
+
## 3.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#182839](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/182839)
|
|
8
|
+
[`81f1c3383bdab`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/81f1c3383bdab) -
|
|
9
|
+
refactor: use useSharedPluginStateWithSelector instead of useSharedPluginStateSelector
|
|
10
|
+
|
|
11
|
+
## 3.0.0
|
|
12
|
+
|
|
13
|
+
### Major Changes
|
|
14
|
+
|
|
15
|
+
- [#181024](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/181024)
|
|
16
|
+
[`8e80c487ca307`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8e80c487ca307) - ##
|
|
17
|
+
Make `@atlaskit/editor-common` a peer dependency
|
|
18
|
+
|
|
19
|
+
**WHAT:** `@atlaskit/editor-common` has been moved from `dependencies` to `peerDependencies` in
|
|
20
|
+
all editor plugin packages.
|
|
21
|
+
|
|
22
|
+
**WHY:** This change ensures that only a single version of `@atlaskit/editor-common` is used in
|
|
23
|
+
consuming applications, preventing issues caused by multiple versions of singleton libraries (such
|
|
24
|
+
as context mismatches or duplicated state). This is especially important for packages that rely on
|
|
25
|
+
shared context or singletons.
|
|
26
|
+
|
|
27
|
+
**HOW TO ADJUST:**
|
|
28
|
+
|
|
29
|
+
- Consumers must now explicitly install `@atlaskit/editor-common` in their own project if they use
|
|
30
|
+
any of these editor plugins.
|
|
31
|
+
- Ensure the version you install matches the version required by the plugins.
|
|
32
|
+
- You can use the
|
|
33
|
+
[`check-peer-dependencies`](https://www.npmjs.com/package/check-peer-dependencies) package to
|
|
34
|
+
verify that all required peer dependencies are installed and compatible.
|
|
35
|
+
- Example install command:
|
|
36
|
+
```
|
|
37
|
+
npm install @atlaskit/editor-common
|
|
38
|
+
```
|
|
39
|
+
or
|
|
40
|
+
```
|
|
41
|
+
yarn add @atlaskit/editor-common
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Note:** This is a breaking change. If `@atlaskit/editor-common` is not installed at the
|
|
45
|
+
application level, you may see errors or unexpected behavior.
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- Updated dependencies
|
|
50
|
+
|
|
3
51
|
## 2.0.11
|
|
4
52
|
|
|
5
53
|
### Patch Changes
|
|
@@ -9,7 +9,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
10
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
11
11
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
12
|
-
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
13
12
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
14
13
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
15
14
|
var _guidelineContainer = require("./ui/guidelineContainer");
|
|
@@ -57,17 +56,17 @@ var guidelinePMPlugin = new _safePlugin.SafePlugin({
|
|
|
57
56
|
}
|
|
58
57
|
}
|
|
59
58
|
});
|
|
60
|
-
var
|
|
61
|
-
var
|
|
62
|
-
var lineLength = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'width.lineLength');
|
|
63
|
-
var guidelines = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'guideline.guidelines');
|
|
64
|
-
var rect = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'guideline.rect');
|
|
59
|
+
var selector = function selector(states) {
|
|
60
|
+
var _states$widthState, _states$widthState2, _states$guidelineStat, _states$guidelineStat2;
|
|
65
61
|
return {
|
|
66
|
-
width: width,
|
|
67
|
-
lineLength: lineLength,
|
|
68
|
-
guidelines: guidelines,
|
|
69
|
-
rect: rect
|
|
62
|
+
width: (_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.width,
|
|
63
|
+
lineLength: (_states$widthState2 = states.widthState) === null || _states$widthState2 === void 0 ? void 0 : _states$widthState2.lineLength,
|
|
64
|
+
guidelines: (_states$guidelineStat = states.guidelineState) === null || _states$guidelineStat === void 0 ? void 0 : _states$guidelineStat.guidelines,
|
|
65
|
+
rect: (_states$guidelineStat2 = states.guidelineState) === null || _states$guidelineStat2 === void 0 ? void 0 : _states$guidelineStat2.rect
|
|
70
66
|
};
|
|
67
|
+
};
|
|
68
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
69
|
+
return (0, _hooks.useSharedPluginStateWithSelector)(api, ['width', 'guideline'], selector);
|
|
71
70
|
}, function (api) {
|
|
72
71
|
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['width', 'guideline']),
|
|
73
72
|
widthState = _useSharedPluginState.widthState,
|
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
6
|
import { css, jsx } from '@emotion/react';
|
|
7
|
-
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
7
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
8
8
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
9
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
10
9
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
11
10
|
import { akEditorGridLineZIndex } from '@atlaskit/editor-shared-styles';
|
|
12
11
|
import { GuidelineContainer } from './ui/guidelineContainer';
|
|
@@ -52,17 +51,17 @@ const guidelinePMPlugin = new SafePlugin({
|
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
53
|
});
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
const lineLength = useSharedPluginStateSelector(api, 'width.lineLength');
|
|
58
|
-
const guidelines = useSharedPluginStateSelector(api, 'guideline.guidelines');
|
|
59
|
-
const rect = useSharedPluginStateSelector(api, 'guideline.rect');
|
|
54
|
+
const selector = states => {
|
|
55
|
+
var _states$widthState, _states$widthState2, _states$guidelineStat, _states$guidelineStat2;
|
|
60
56
|
return {
|
|
61
|
-
width,
|
|
62
|
-
lineLength,
|
|
63
|
-
guidelines,
|
|
64
|
-
rect
|
|
57
|
+
width: (_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.width,
|
|
58
|
+
lineLength: (_states$widthState2 = states.widthState) === null || _states$widthState2 === void 0 ? void 0 : _states$widthState2.lineLength,
|
|
59
|
+
guidelines: (_states$guidelineStat = states.guidelineState) === null || _states$guidelineStat === void 0 ? void 0 : _states$guidelineStat.guidelines,
|
|
60
|
+
rect: (_states$guidelineStat2 = states.guidelineState) === null || _states$guidelineStat2 === void 0 ? void 0 : _states$guidelineStat2.rect
|
|
65
61
|
};
|
|
62
|
+
};
|
|
63
|
+
const useSharedState = sharedPluginStateHookMigratorFactory(api => {
|
|
64
|
+
return useSharedPluginStateWithSelector(api, ['width', 'guideline'], selector);
|
|
66
65
|
}, api => {
|
|
67
66
|
const {
|
|
68
67
|
widthState,
|
|
@@ -7,9 +7,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
*/
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
|
-
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
10
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
11
11
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
12
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
13
12
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
14
13
|
import { akEditorGridLineZIndex } from '@atlaskit/editor-shared-styles';
|
|
15
14
|
import { GuidelineContainer } from './ui/guidelineContainer';
|
|
@@ -52,17 +51,17 @@ var guidelinePMPlugin = new SafePlugin({
|
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
53
|
});
|
|
55
|
-
var
|
|
56
|
-
var
|
|
57
|
-
var lineLength = useSharedPluginStateSelector(api, 'width.lineLength');
|
|
58
|
-
var guidelines = useSharedPluginStateSelector(api, 'guideline.guidelines');
|
|
59
|
-
var rect = useSharedPluginStateSelector(api, 'guideline.rect');
|
|
54
|
+
var selector = function selector(states) {
|
|
55
|
+
var _states$widthState, _states$widthState2, _states$guidelineStat, _states$guidelineStat2;
|
|
60
56
|
return {
|
|
61
|
-
width: width,
|
|
62
|
-
lineLength: lineLength,
|
|
63
|
-
guidelines: guidelines,
|
|
64
|
-
rect: rect
|
|
57
|
+
width: (_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.width,
|
|
58
|
+
lineLength: (_states$widthState2 = states.widthState) === null || _states$widthState2 === void 0 ? void 0 : _states$widthState2.lineLength,
|
|
59
|
+
guidelines: (_states$guidelineStat = states.guidelineState) === null || _states$guidelineStat === void 0 ? void 0 : _states$guidelineStat.guidelines,
|
|
60
|
+
rect: (_states$guidelineStat2 = states.guidelineState) === null || _states$guidelineStat2 === void 0 ? void 0 : _states$guidelineStat2.rect
|
|
65
61
|
};
|
|
62
|
+
};
|
|
63
|
+
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
64
|
+
return useSharedPluginStateWithSelector(api, ['width', 'guideline'], selector);
|
|
66
65
|
}, function (api) {
|
|
67
66
|
var _useSharedPluginState = useSharedPluginState(api, ['width', 'guideline']),
|
|
68
67
|
widthState = _useSharedPluginState.widthState,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-guideline",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "guideline plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"atlassian": {
|
|
11
11
|
"team": "Editor: Jenga",
|
|
12
|
-
"singleton": true
|
|
13
|
-
"runReact18": true
|
|
12
|
+
"singleton": true
|
|
14
13
|
},
|
|
15
14
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
16
15
|
"main": "dist/cjs/index.js",
|
|
@@ -25,16 +24,16 @@
|
|
|
25
24
|
".": "./src/index.ts"
|
|
26
25
|
},
|
|
27
26
|
"dependencies": {
|
|
28
|
-
"@atlaskit/editor-
|
|
29
|
-
"@atlaskit/editor-plugin-width": "^3.0.0",
|
|
27
|
+
"@atlaskit/editor-plugin-width": "^4.0.0",
|
|
30
28
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
31
29
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
32
30
|
"@atlaskit/theme": "^18.0.0",
|
|
33
|
-
"@atlaskit/tokens": "^5.
|
|
31
|
+
"@atlaskit/tokens": "^5.4.0",
|
|
34
32
|
"@babel/runtime": "^7.0.0",
|
|
35
33
|
"@emotion/react": "^11.7.1"
|
|
36
34
|
},
|
|
37
35
|
"peerDependencies": {
|
|
36
|
+
"@atlaskit/editor-common": "^107.7.0",
|
|
38
37
|
"react": "^18.2.0",
|
|
39
38
|
"react-dom": "^18.2.0"
|
|
40
39
|
},
|