@atlaskit/editor-plugin-toolbar-lists-indentation 4.0.0 → 4.0.2
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 +15 -0
- package/dist/cjs/toolbarListsIndentationPlugin.js +24 -13
- package/dist/cjs/ui/FloatingToolbarComponent.js +24 -11
- package/dist/es2019/toolbarListsIndentationPlugin.js +23 -11
- package/dist/es2019/ui/FloatingToolbarComponent.js +23 -9
- package/dist/esm/toolbarListsIndentationPlugin.js +25 -14
- package/dist/esm/ui/FloatingToolbarComponent.js +25 -12
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-toolbar-lists-indentation
|
|
2
2
|
|
|
3
|
+
## 4.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#183158](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/183158)
|
|
8
|
+
[`d6096ec5c8ad9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d6096ec5c8ad9) -
|
|
9
|
+
Migrate to useSharedPluginStateWithSelector
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 4.0.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 4.0.0
|
|
4
19
|
|
|
5
20
|
### Major Changes
|
|
@@ -12,7 +12,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
12
12
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
13
13
|
var _types = require("@atlaskit/editor-common/types");
|
|
14
14
|
var _usePluginStateEffect = require("@atlaskit/editor-common/use-plugin-state-effect");
|
|
15
|
-
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
16
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
16
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
18
17
|
var _indentationButtons = require("./pm-plugins/indentation-buttons");
|
|
@@ -96,15 +95,27 @@ var toolbarListsIndentationPlugin = exports.toolbarListsIndentationPlugin = func
|
|
|
96
95
|
};
|
|
97
96
|
};
|
|
98
97
|
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
99
|
-
var
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
98
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['list', 'indentation'], function (states) {
|
|
99
|
+
var _states$listState, _states$listState2, _states$listState3, _states$listState4, _states$indentationSt, _states$indentationSt2, _states$indentationSt3, _states$listState5;
|
|
100
|
+
return {
|
|
101
|
+
bulletListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
|
|
102
|
+
bulletListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.bulletListDisabled,
|
|
103
|
+
orderedListActive: (_states$listState3 = states.listState) === null || _states$listState3 === void 0 ? void 0 : _states$listState3.orderedListActive,
|
|
104
|
+
orderedListDisabled: (_states$listState4 = states.listState) === null || _states$listState4 === void 0 ? void 0 : _states$listState4.orderedListDisabled,
|
|
105
|
+
isIndentationAllowed: (_states$indentationSt = states.indentationState) === null || _states$indentationSt === void 0 ? void 0 : _states$indentationSt.isIndentationAllowed,
|
|
106
|
+
indentDisabled: (_states$indentationSt2 = states.indentationState) === null || _states$indentationSt2 === void 0 ? void 0 : _states$indentationSt2.indentDisabled,
|
|
107
|
+
outdentDisabled: (_states$indentationSt3 = states.indentationState) === null || _states$indentationSt3 === void 0 ? void 0 : _states$indentationSt3.outdentDisabled,
|
|
108
|
+
// decorationSet is required to re-render PrimaryToolbarComponent component, so that the toolbar states updates regularly
|
|
109
|
+
decorationSet: (_states$listState5 = states.listState) === null || _states$listState5 === void 0 ? void 0 : _states$listState5.decorationSet
|
|
110
|
+
};
|
|
111
|
+
}),
|
|
112
|
+
bulletListActive = _useSharedPluginState.bulletListActive,
|
|
113
|
+
bulletListDisabled = _useSharedPluginState.bulletListDisabled,
|
|
114
|
+
orderedListActive = _useSharedPluginState.orderedListActive,
|
|
115
|
+
orderedListDisabled = _useSharedPluginState.orderedListDisabled,
|
|
116
|
+
isIndentationAllowed = _useSharedPluginState.isIndentationAllowed,
|
|
117
|
+
indentDisabled = _useSharedPluginState.indentDisabled,
|
|
118
|
+
outdentDisabled = _useSharedPluginState.outdentDisabled;
|
|
108
119
|
return {
|
|
109
120
|
bulletListActive: bulletListActive,
|
|
110
121
|
bulletListDisabled: bulletListDisabled,
|
|
@@ -115,9 +126,9 @@ var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (
|
|
|
115
126
|
outdentDisabled: outdentDisabled
|
|
116
127
|
};
|
|
117
128
|
}, function (api) {
|
|
118
|
-
var
|
|
119
|
-
listState =
|
|
120
|
-
indentationState =
|
|
129
|
+
var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['list', 'indentation']),
|
|
130
|
+
listState = _useSharedPluginState2.listState,
|
|
131
|
+
indentationState = _useSharedPluginState2.indentationState;
|
|
121
132
|
return {
|
|
122
133
|
bulletListActive: listState === null || listState === void 0 ? void 0 : listState.bulletListActive,
|
|
123
134
|
bulletListDisabled: listState === null || listState === void 0 ? void 0 : listState.bulletListDisabled,
|
|
@@ -10,7 +10,6 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
12
12
|
var _usePluginStateEffect = require("@atlaskit/editor-common/use-plugin-state-effect");
|
|
13
|
-
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
14
13
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
15
14
|
var _indentationButtons = require("../pm-plugins/indentation-buttons");
|
|
16
15
|
var _types = require("../types");
|
|
@@ -22,13 +21,27 @@ var FloatingToolbarSettings = {
|
|
|
22
21
|
isSmall: true
|
|
23
22
|
};
|
|
24
23
|
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['list', 'indentation'], function (states) {
|
|
25
|
+
var _states$listState, _states$listState2, _states$listState3, _states$listState4, _states$indentationSt, _states$indentationSt2, _states$indentationSt3, _states$listState5;
|
|
26
|
+
return {
|
|
27
|
+
bulletListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
|
|
28
|
+
bulletListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.bulletListDisabled,
|
|
29
|
+
orderedListActive: (_states$listState3 = states.listState) === null || _states$listState3 === void 0 ? void 0 : _states$listState3.orderedListActive,
|
|
30
|
+
orderedListDisabled: (_states$listState4 = states.listState) === null || _states$listState4 === void 0 ? void 0 : _states$listState4.orderedListDisabled,
|
|
31
|
+
isIndentationAllowed: (_states$indentationSt = states.indentationState) === null || _states$indentationSt === void 0 ? void 0 : _states$indentationSt.isIndentationAllowed,
|
|
32
|
+
indentDisabled: (_states$indentationSt2 = states.indentationState) === null || _states$indentationSt2 === void 0 ? void 0 : _states$indentationSt2.indentDisabled,
|
|
33
|
+
outdentDisabled: (_states$indentationSt3 = states.indentationState) === null || _states$indentationSt3 === void 0 ? void 0 : _states$indentationSt3.outdentDisabled,
|
|
34
|
+
// decorationSet is required to re-render PrimaryToolbarComponent component, so that the toolbar states updates regularly
|
|
35
|
+
decorationSet: (_states$listState5 = states.listState) === null || _states$listState5 === void 0 ? void 0 : _states$listState5.decorationSet
|
|
36
|
+
};
|
|
37
|
+
}),
|
|
38
|
+
bulletListActive = _useSharedPluginState.bulletListActive,
|
|
39
|
+
bulletListDisabled = _useSharedPluginState.bulletListDisabled,
|
|
40
|
+
orderedListActive = _useSharedPluginState.orderedListActive,
|
|
41
|
+
orderedListDisabled = _useSharedPluginState.orderedListDisabled,
|
|
42
|
+
isIndentationAllowed = _useSharedPluginState.isIndentationAllowed,
|
|
43
|
+
indentDisabled = _useSharedPluginState.indentDisabled,
|
|
44
|
+
outdentDisabled = _useSharedPluginState.outdentDisabled;
|
|
32
45
|
return {
|
|
33
46
|
bulletListActive: bulletListActive,
|
|
34
47
|
bulletListDisabled: bulletListDisabled,
|
|
@@ -39,9 +52,9 @@ var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (
|
|
|
39
52
|
outdentDisabled: outdentDisabled
|
|
40
53
|
};
|
|
41
54
|
}, function (api) {
|
|
42
|
-
var
|
|
43
|
-
listState =
|
|
44
|
-
indentationState =
|
|
55
|
+
var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['list', 'indentation']),
|
|
56
|
+
listState = _useSharedPluginState2.listState,
|
|
57
|
+
indentationState = _useSharedPluginState2.indentationState;
|
|
45
58
|
return {
|
|
46
59
|
bulletListActive: listState === null || listState === void 0 ? void 0 : listState.bulletListActive,
|
|
47
60
|
bulletListDisabled: listState === null || listState === void 0 ? void 0 : listState.bulletListDisabled,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
2
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
3
3
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
4
4
|
import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
|
|
5
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
6
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
7
|
import { getIndentationButtonsState } from './pm-plugins/indentation-buttons';
|
|
@@ -86,15 +85,28 @@ export const toolbarListsIndentationPlugin = ({
|
|
|
86
85
|
};
|
|
87
86
|
};
|
|
88
87
|
const useSharedState = sharedPluginStateHookMigratorFactory(api => {
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
88
|
+
const {
|
|
89
|
+
bulletListActive,
|
|
90
|
+
bulletListDisabled,
|
|
91
|
+
orderedListActive,
|
|
92
|
+
orderedListDisabled,
|
|
93
|
+
isIndentationAllowed,
|
|
94
|
+
indentDisabled,
|
|
95
|
+
outdentDisabled
|
|
96
|
+
} = useSharedPluginStateWithSelector(api, ['list', 'indentation'], states => {
|
|
97
|
+
var _states$listState, _states$listState2, _states$listState3, _states$listState4, _states$indentationSt, _states$indentationSt2, _states$indentationSt3, _states$listState5;
|
|
98
|
+
return {
|
|
99
|
+
bulletListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
|
|
100
|
+
bulletListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.bulletListDisabled,
|
|
101
|
+
orderedListActive: (_states$listState3 = states.listState) === null || _states$listState3 === void 0 ? void 0 : _states$listState3.orderedListActive,
|
|
102
|
+
orderedListDisabled: (_states$listState4 = states.listState) === null || _states$listState4 === void 0 ? void 0 : _states$listState4.orderedListDisabled,
|
|
103
|
+
isIndentationAllowed: (_states$indentationSt = states.indentationState) === null || _states$indentationSt === void 0 ? void 0 : _states$indentationSt.isIndentationAllowed,
|
|
104
|
+
indentDisabled: (_states$indentationSt2 = states.indentationState) === null || _states$indentationSt2 === void 0 ? void 0 : _states$indentationSt2.indentDisabled,
|
|
105
|
+
outdentDisabled: (_states$indentationSt3 = states.indentationState) === null || _states$indentationSt3 === void 0 ? void 0 : _states$indentationSt3.outdentDisabled,
|
|
106
|
+
// decorationSet is required to re-render PrimaryToolbarComponent component, so that the toolbar states updates regularly
|
|
107
|
+
decorationSet: (_states$listState5 = states.listState) === null || _states$listState5 === void 0 ? void 0 : _states$listState5.decorationSet
|
|
108
|
+
};
|
|
109
|
+
});
|
|
98
110
|
return {
|
|
99
111
|
bulletListActive,
|
|
100
112
|
bulletListDisabled,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
2
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
3
3
|
import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
|
|
4
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
5
4
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
5
|
import { getIndentationButtonsState } from '../pm-plugins/indentation-buttons';
|
|
7
6
|
import { ToolbarType } from '../types';
|
|
@@ -12,13 +11,28 @@ const FloatingToolbarSettings = {
|
|
|
12
11
|
isSmall: true
|
|
13
12
|
};
|
|
14
13
|
const useSharedState = sharedPluginStateHookMigratorFactory(api => {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
const {
|
|
15
|
+
bulletListActive,
|
|
16
|
+
bulletListDisabled,
|
|
17
|
+
orderedListActive,
|
|
18
|
+
orderedListDisabled,
|
|
19
|
+
isIndentationAllowed,
|
|
20
|
+
indentDisabled,
|
|
21
|
+
outdentDisabled
|
|
22
|
+
} = useSharedPluginStateWithSelector(api, ['list', 'indentation'], states => {
|
|
23
|
+
var _states$listState, _states$listState2, _states$listState3, _states$listState4, _states$indentationSt, _states$indentationSt2, _states$indentationSt3, _states$listState5;
|
|
24
|
+
return {
|
|
25
|
+
bulletListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
|
|
26
|
+
bulletListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.bulletListDisabled,
|
|
27
|
+
orderedListActive: (_states$listState3 = states.listState) === null || _states$listState3 === void 0 ? void 0 : _states$listState3.orderedListActive,
|
|
28
|
+
orderedListDisabled: (_states$listState4 = states.listState) === null || _states$listState4 === void 0 ? void 0 : _states$listState4.orderedListDisabled,
|
|
29
|
+
isIndentationAllowed: (_states$indentationSt = states.indentationState) === null || _states$indentationSt === void 0 ? void 0 : _states$indentationSt.isIndentationAllowed,
|
|
30
|
+
indentDisabled: (_states$indentationSt2 = states.indentationState) === null || _states$indentationSt2 === void 0 ? void 0 : _states$indentationSt2.indentDisabled,
|
|
31
|
+
outdentDisabled: (_states$indentationSt3 = states.indentationState) === null || _states$indentationSt3 === void 0 ? void 0 : _states$indentationSt3.outdentDisabled,
|
|
32
|
+
// decorationSet is required to re-render PrimaryToolbarComponent component, so that the toolbar states updates regularly
|
|
33
|
+
decorationSet: (_states$listState5 = states.listState) === null || _states$listState5 === void 0 ? void 0 : _states$listState5.decorationSet
|
|
34
|
+
};
|
|
35
|
+
});
|
|
22
36
|
return {
|
|
23
37
|
bulletListActive,
|
|
24
38
|
bulletListDisabled,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
|
-
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
3
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
5
5
|
import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
|
|
6
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
7
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
8
|
import { getIndentationButtonsState } from './pm-plugins/indentation-buttons';
|
|
@@ -86,15 +85,27 @@ export var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugi
|
|
|
86
85
|
};
|
|
87
86
|
};
|
|
88
87
|
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
89
|
-
var
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
88
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['list', 'indentation'], function (states) {
|
|
89
|
+
var _states$listState, _states$listState2, _states$listState3, _states$listState4, _states$indentationSt, _states$indentationSt2, _states$indentationSt3, _states$listState5;
|
|
90
|
+
return {
|
|
91
|
+
bulletListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
|
|
92
|
+
bulletListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.bulletListDisabled,
|
|
93
|
+
orderedListActive: (_states$listState3 = states.listState) === null || _states$listState3 === void 0 ? void 0 : _states$listState3.orderedListActive,
|
|
94
|
+
orderedListDisabled: (_states$listState4 = states.listState) === null || _states$listState4 === void 0 ? void 0 : _states$listState4.orderedListDisabled,
|
|
95
|
+
isIndentationAllowed: (_states$indentationSt = states.indentationState) === null || _states$indentationSt === void 0 ? void 0 : _states$indentationSt.isIndentationAllowed,
|
|
96
|
+
indentDisabled: (_states$indentationSt2 = states.indentationState) === null || _states$indentationSt2 === void 0 ? void 0 : _states$indentationSt2.indentDisabled,
|
|
97
|
+
outdentDisabled: (_states$indentationSt3 = states.indentationState) === null || _states$indentationSt3 === void 0 ? void 0 : _states$indentationSt3.outdentDisabled,
|
|
98
|
+
// decorationSet is required to re-render PrimaryToolbarComponent component, so that the toolbar states updates regularly
|
|
99
|
+
decorationSet: (_states$listState5 = states.listState) === null || _states$listState5 === void 0 ? void 0 : _states$listState5.decorationSet
|
|
100
|
+
};
|
|
101
|
+
}),
|
|
102
|
+
bulletListActive = _useSharedPluginState.bulletListActive,
|
|
103
|
+
bulletListDisabled = _useSharedPluginState.bulletListDisabled,
|
|
104
|
+
orderedListActive = _useSharedPluginState.orderedListActive,
|
|
105
|
+
orderedListDisabled = _useSharedPluginState.orderedListDisabled,
|
|
106
|
+
isIndentationAllowed = _useSharedPluginState.isIndentationAllowed,
|
|
107
|
+
indentDisabled = _useSharedPluginState.indentDisabled,
|
|
108
|
+
outdentDisabled = _useSharedPluginState.outdentDisabled;
|
|
98
109
|
return {
|
|
99
110
|
bulletListActive: bulletListActive,
|
|
100
111
|
bulletListDisabled: bulletListDisabled,
|
|
@@ -105,9 +116,9 @@ var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
|
105
116
|
outdentDisabled: outdentDisabled
|
|
106
117
|
};
|
|
107
118
|
}, function (api) {
|
|
108
|
-
var
|
|
109
|
-
listState =
|
|
110
|
-
indentationState =
|
|
119
|
+
var _useSharedPluginState2 = useSharedPluginState(api, ['list', 'indentation']),
|
|
120
|
+
listState = _useSharedPluginState2.listState,
|
|
121
|
+
indentationState = _useSharedPluginState2.indentationState;
|
|
111
122
|
return {
|
|
112
123
|
bulletListActive: listState === null || listState === void 0 ? void 0 : listState.bulletListActive,
|
|
113
124
|
bulletListDisabled: listState === null || listState === void 0 ? void 0 : listState.bulletListDisabled,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
|
-
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
3
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
|
|
5
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
6
5
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
6
|
import { getIndentationButtonsState } from '../pm-plugins/indentation-buttons';
|
|
8
7
|
import { ToolbarType } from '../types';
|
|
@@ -13,13 +12,27 @@ var FloatingToolbarSettings = {
|
|
|
13
12
|
isSmall: true
|
|
14
13
|
};
|
|
15
14
|
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['list', 'indentation'], function (states) {
|
|
16
|
+
var _states$listState, _states$listState2, _states$listState3, _states$listState4, _states$indentationSt, _states$indentationSt2, _states$indentationSt3, _states$listState5;
|
|
17
|
+
return {
|
|
18
|
+
bulletListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
|
|
19
|
+
bulletListDisabled: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.bulletListDisabled,
|
|
20
|
+
orderedListActive: (_states$listState3 = states.listState) === null || _states$listState3 === void 0 ? void 0 : _states$listState3.orderedListActive,
|
|
21
|
+
orderedListDisabled: (_states$listState4 = states.listState) === null || _states$listState4 === void 0 ? void 0 : _states$listState4.orderedListDisabled,
|
|
22
|
+
isIndentationAllowed: (_states$indentationSt = states.indentationState) === null || _states$indentationSt === void 0 ? void 0 : _states$indentationSt.isIndentationAllowed,
|
|
23
|
+
indentDisabled: (_states$indentationSt2 = states.indentationState) === null || _states$indentationSt2 === void 0 ? void 0 : _states$indentationSt2.indentDisabled,
|
|
24
|
+
outdentDisabled: (_states$indentationSt3 = states.indentationState) === null || _states$indentationSt3 === void 0 ? void 0 : _states$indentationSt3.outdentDisabled,
|
|
25
|
+
// decorationSet is required to re-render PrimaryToolbarComponent component, so that the toolbar states updates regularly
|
|
26
|
+
decorationSet: (_states$listState5 = states.listState) === null || _states$listState5 === void 0 ? void 0 : _states$listState5.decorationSet
|
|
27
|
+
};
|
|
28
|
+
}),
|
|
29
|
+
bulletListActive = _useSharedPluginState.bulletListActive,
|
|
30
|
+
bulletListDisabled = _useSharedPluginState.bulletListDisabled,
|
|
31
|
+
orderedListActive = _useSharedPluginState.orderedListActive,
|
|
32
|
+
orderedListDisabled = _useSharedPluginState.orderedListDisabled,
|
|
33
|
+
isIndentationAllowed = _useSharedPluginState.isIndentationAllowed,
|
|
34
|
+
indentDisabled = _useSharedPluginState.indentDisabled,
|
|
35
|
+
outdentDisabled = _useSharedPluginState.outdentDisabled;
|
|
23
36
|
return {
|
|
24
37
|
bulletListActive: bulletListActive,
|
|
25
38
|
bulletListDisabled: bulletListDisabled,
|
|
@@ -30,9 +43,9 @@ var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
|
30
43
|
outdentDisabled: outdentDisabled
|
|
31
44
|
};
|
|
32
45
|
}, function (api) {
|
|
33
|
-
var
|
|
34
|
-
listState =
|
|
35
|
-
indentationState =
|
|
46
|
+
var _useSharedPluginState2 = useSharedPluginState(api, ['list', 'indentation']),
|
|
47
|
+
listState = _useSharedPluginState2.listState,
|
|
48
|
+
indentationState = _useSharedPluginState2.indentationState;
|
|
36
49
|
return {
|
|
37
50
|
bulletListActive: listState === null || listState === void 0 ? void 0 : listState.bulletListActive,
|
|
38
51
|
bulletListDisabled: listState === null || listState === void 0 ? void 0 : listState.bulletListDisabled,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-toolbar-lists-indentation",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "Toolbar lists and indentation plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -43,14 +43,14 @@
|
|
|
43
43
|
"@atlaskit/editor-plugin-tasks-and-decisions": "^6.0.0",
|
|
44
44
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
45
45
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
46
|
-
"@atlaskit/icon": "^27.
|
|
46
|
+
"@atlaskit/icon": "^27.3.0",
|
|
47
47
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
48
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
48
|
+
"@atlaskit/tmp-editor-statsig": "^9.1.0",
|
|
49
49
|
"@atlaskit/tokens": "^5.4.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@atlaskit/editor-common": "^107.
|
|
53
|
+
"@atlaskit/editor-common": "^107.7.0",
|
|
54
54
|
"react": "^18.2.0",
|
|
55
55
|
"react-dom": "^18.2.0",
|
|
56
56
|
"react-intl-next": "npm:react-intl@^5.18.1"
|