@atlaskit/editor-plugin-undo-redo 2.0.13 → 2.0.15
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,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-undo-redo
|
|
2
2
|
|
|
3
|
+
## 2.0.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#154149](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/154149)
|
|
8
|
+
[`4b955e247c793`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4b955e247c793) -
|
|
9
|
+
[ED-27560] Migrate to useSharedPluginStateSelector for text color, toolbar lists indentation,
|
|
10
|
+
type-ahead, undo-redo plugins
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 2.0.14
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 2.0.13
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -12,6 +12,7 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
|
12
12
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
13
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
14
14
|
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
15
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
15
16
|
var _redo = _interopRequireDefault(require("@atlaskit/icon/core/migration/redo"));
|
|
16
17
|
var _undo = _interopRequireDefault(require("@atlaskit/icon/core/migration/undo"));
|
|
17
18
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
@@ -23,14 +24,30 @@ var _utils = require("../../pm-plugins/utils");
|
|
|
23
24
|
*/
|
|
24
25
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
25
26
|
|
|
27
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
28
|
+
var canUndo = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'history.canUndo');
|
|
29
|
+
var canRedo = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'history.canRedo');
|
|
30
|
+
return {
|
|
31
|
+
canUndo: canUndo,
|
|
32
|
+
canRedo: canRedo
|
|
33
|
+
};
|
|
34
|
+
}, function (api) {
|
|
35
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['history']),
|
|
36
|
+
historyState = _useSharedPluginState.historyState;
|
|
37
|
+
return {
|
|
38
|
+
canUndo: historyState === null || historyState === void 0 ? void 0 : historyState.canUndo,
|
|
39
|
+
canRedo: historyState === null || historyState === void 0 ? void 0 : historyState.canRedo
|
|
40
|
+
};
|
|
41
|
+
});
|
|
26
42
|
var ToolbarUndoRedo = exports.ToolbarUndoRedo = function ToolbarUndoRedo(_ref) {
|
|
27
43
|
var disabled = _ref.disabled,
|
|
28
44
|
isReducedSpacing = _ref.isReducedSpacing,
|
|
29
45
|
editorView = _ref.editorView,
|
|
30
46
|
api = _ref.api,
|
|
31
47
|
formatMessage = _ref.intl.formatMessage;
|
|
32
|
-
var
|
|
33
|
-
|
|
48
|
+
var _useSharedState = useSharedState(api),
|
|
49
|
+
canUndo = _useSharedState.canUndo,
|
|
50
|
+
canRedo = _useSharedState.canRedo;
|
|
34
51
|
var handleUndo = function handleUndo() {
|
|
35
52
|
if ((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_analytics')) {
|
|
36
53
|
var _api$analytics;
|
|
@@ -49,9 +66,6 @@ var ToolbarUndoRedo = exports.ToolbarUndoRedo = function ToolbarUndoRedo(_ref) {
|
|
|
49
66
|
};
|
|
50
67
|
var labelUndo = formatMessage(_messages.undoRedoMessages.undo);
|
|
51
68
|
var labelRedo = formatMessage(_messages.undoRedoMessages.redo);
|
|
52
|
-
var _ref2 = historyState !== null && historyState !== void 0 ? historyState : {},
|
|
53
|
-
canUndo = _ref2.canUndo,
|
|
54
|
-
canRedo = _ref2.canRedo;
|
|
55
69
|
var redoKeymap = (0, _platformFeatureFlags.fg)('platform_editor_cmd_y_mac_redo_shortcut') ? _keymaps.redoAlt : _keymaps.redo;
|
|
56
70
|
return (
|
|
57
71
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
@@ -5,16 +5,33 @@
|
|
|
5
5
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
7
|
import { injectIntl } from 'react-intl-next';
|
|
8
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
8
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
9
9
|
import { getAriaKeyshortcuts, redo, redoAlt, tooltip, ToolTipContent, undo as undoKeymap } from '@atlaskit/editor-common/keymaps';
|
|
10
10
|
import { undoRedoMessages } from '@atlaskit/editor-common/messages';
|
|
11
11
|
import { buttonGroupStyle, buttonGroupStyleBeforeVisualRefresh, separatorStyles } from '@atlaskit/editor-common/styles';
|
|
12
12
|
import { TOOLBAR_BUTTON, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
13
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
13
14
|
import RedoIcon from '@atlaskit/icon/core/migration/redo';
|
|
14
15
|
import UndoIcon from '@atlaskit/icon/core/migration/undo';
|
|
15
16
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
17
|
import { redoFromToolbar, redoFromToolbarWithAnalytics, undoFromToolbar, undoFromToolbarWithAnalytics } from '../../pm-plugins/commands';
|
|
17
18
|
import { forceFocus } from '../../pm-plugins/utils';
|
|
19
|
+
const useSharedState = sharedPluginStateHookMigratorFactory(api => {
|
|
20
|
+
const canUndo = useSharedPluginStateSelector(api, 'history.canUndo');
|
|
21
|
+
const canRedo = useSharedPluginStateSelector(api, 'history.canRedo');
|
|
22
|
+
return {
|
|
23
|
+
canUndo,
|
|
24
|
+
canRedo
|
|
25
|
+
};
|
|
26
|
+
}, api => {
|
|
27
|
+
const {
|
|
28
|
+
historyState
|
|
29
|
+
} = useSharedPluginState(api, ['history']);
|
|
30
|
+
return {
|
|
31
|
+
canUndo: historyState === null || historyState === void 0 ? void 0 : historyState.canUndo,
|
|
32
|
+
canRedo: historyState === null || historyState === void 0 ? void 0 : historyState.canRedo
|
|
33
|
+
};
|
|
34
|
+
});
|
|
18
35
|
export const ToolbarUndoRedo = ({
|
|
19
36
|
disabled,
|
|
20
37
|
isReducedSpacing,
|
|
@@ -25,8 +42,9 @@ export const ToolbarUndoRedo = ({
|
|
|
25
42
|
}
|
|
26
43
|
}) => {
|
|
27
44
|
const {
|
|
28
|
-
|
|
29
|
-
|
|
45
|
+
canUndo,
|
|
46
|
+
canRedo
|
|
47
|
+
} = useSharedState(api);
|
|
30
48
|
const handleUndo = () => {
|
|
31
49
|
if (fg('platform_editor_controls_patch_analytics')) {
|
|
32
50
|
var _api$analytics;
|
|
@@ -45,10 +63,6 @@ export const ToolbarUndoRedo = ({
|
|
|
45
63
|
};
|
|
46
64
|
const labelUndo = formatMessage(undoRedoMessages.undo);
|
|
47
65
|
const labelRedo = formatMessage(undoRedoMessages.redo);
|
|
48
|
-
const {
|
|
49
|
-
canUndo,
|
|
50
|
-
canRedo
|
|
51
|
-
} = historyState !== null && historyState !== void 0 ? historyState : {};
|
|
52
66
|
const redoKeymap = fg('platform_editor_cmd_y_mac_redo_shortcut') ? redoAlt : redo;
|
|
53
67
|
return (
|
|
54
68
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
@@ -5,24 +5,41 @@
|
|
|
5
5
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
7
|
import { injectIntl } from 'react-intl-next';
|
|
8
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
8
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
9
9
|
import { getAriaKeyshortcuts, redo, redoAlt, tooltip, ToolTipContent, undo as undoKeymap } from '@atlaskit/editor-common/keymaps';
|
|
10
10
|
import { undoRedoMessages } from '@atlaskit/editor-common/messages';
|
|
11
11
|
import { buttonGroupStyle, buttonGroupStyleBeforeVisualRefresh, separatorStyles } from '@atlaskit/editor-common/styles';
|
|
12
12
|
import { TOOLBAR_BUTTON, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
13
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
13
14
|
import RedoIcon from '@atlaskit/icon/core/migration/redo';
|
|
14
15
|
import UndoIcon from '@atlaskit/icon/core/migration/undo';
|
|
15
16
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
17
|
import { redoFromToolbar, redoFromToolbarWithAnalytics, undoFromToolbar, undoFromToolbarWithAnalytics } from '../../pm-plugins/commands';
|
|
17
18
|
import { forceFocus } from '../../pm-plugins/utils';
|
|
19
|
+
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
20
|
+
var canUndo = useSharedPluginStateSelector(api, 'history.canUndo');
|
|
21
|
+
var canRedo = useSharedPluginStateSelector(api, 'history.canRedo');
|
|
22
|
+
return {
|
|
23
|
+
canUndo: canUndo,
|
|
24
|
+
canRedo: canRedo
|
|
25
|
+
};
|
|
26
|
+
}, function (api) {
|
|
27
|
+
var _useSharedPluginState = useSharedPluginState(api, ['history']),
|
|
28
|
+
historyState = _useSharedPluginState.historyState;
|
|
29
|
+
return {
|
|
30
|
+
canUndo: historyState === null || historyState === void 0 ? void 0 : historyState.canUndo,
|
|
31
|
+
canRedo: historyState === null || historyState === void 0 ? void 0 : historyState.canRedo
|
|
32
|
+
};
|
|
33
|
+
});
|
|
18
34
|
export var ToolbarUndoRedo = function ToolbarUndoRedo(_ref) {
|
|
19
35
|
var disabled = _ref.disabled,
|
|
20
36
|
isReducedSpacing = _ref.isReducedSpacing,
|
|
21
37
|
editorView = _ref.editorView,
|
|
22
38
|
api = _ref.api,
|
|
23
39
|
formatMessage = _ref.intl.formatMessage;
|
|
24
|
-
var
|
|
25
|
-
|
|
40
|
+
var _useSharedState = useSharedState(api),
|
|
41
|
+
canUndo = _useSharedState.canUndo,
|
|
42
|
+
canRedo = _useSharedState.canRedo;
|
|
26
43
|
var handleUndo = function handleUndo() {
|
|
27
44
|
if (fg('platform_editor_controls_patch_analytics')) {
|
|
28
45
|
var _api$analytics;
|
|
@@ -41,9 +58,6 @@ export var ToolbarUndoRedo = function ToolbarUndoRedo(_ref) {
|
|
|
41
58
|
};
|
|
42
59
|
var labelUndo = formatMessage(undoRedoMessages.undo);
|
|
43
60
|
var labelRedo = formatMessage(undoRedoMessages.redo);
|
|
44
|
-
var _ref2 = historyState !== null && historyState !== void 0 ? historyState : {},
|
|
45
|
-
canUndo = _ref2.canUndo,
|
|
46
|
-
canRedo = _ref2.canRedo;
|
|
47
61
|
var redoKeymap = fg('platform_editor_cmd_y_mac_redo_shortcut') ? redoAlt : redo;
|
|
48
62
|
return (
|
|
49
63
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-undo-redo",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.15",
|
|
4
4
|
"description": "Undo redo plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
".": "./src/index.ts"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@atlaskit/editor-common": "^
|
|
36
|
+
"@atlaskit/editor-common": "^105.2.0",
|
|
37
37
|
"@atlaskit/editor-plugin-history": "^2.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-primary-toolbar": "^3.2.0",
|
|
39
|
-
"@atlaskit/editor-plugin-type-ahead": "^2.
|
|
39
|
+
"@atlaskit/editor-plugin-type-ahead": "^2.7.0",
|
|
40
40
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
41
41
|
"@atlaskit/icon": "^26.0.0",
|
|
42
42
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
43
|
-
"@atlaskit/tmp-editor-statsig": "^4.
|
|
43
|
+
"@atlaskit/tmp-editor-statsig": "^4.21.0",
|
|
44
44
|
"@babel/runtime": "^7.0.0",
|
|
45
45
|
"@emotion/react": "^11.7.1"
|
|
46
46
|
},
|