@atlaskit/editor-plugin-undo-redo 2.0.14 → 2.0.16
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 +16 -0
- package/dist/cjs/pm-plugins/keymaps.js +5 -0
- package/dist/cjs/ui/ToolbarUndoRedo/index.js +19 -5
- package/dist/es2019/pm-plugins/keymaps.js +6 -0
- package/dist/es2019/ui/ToolbarUndoRedo/index.js +21 -7
- package/dist/esm/pm-plugins/keymaps.js +6 -0
- package/dist/esm/ui/ToolbarUndoRedo/index.js +20 -6
- package/dist/types/pm-plugins/commands.d.ts +1 -1
- package/dist/types/pm-plugins/keymaps.d.ts +7 -2
- package/dist/types/pm-plugins/utils.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/commands.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/keymaps.d.ts +7 -2
- package/dist/types-ts4.5/pm-plugins/utils.d.ts +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-undo-redo
|
|
2
2
|
|
|
3
|
+
## 2.0.16
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 2.0.15
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#154149](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/154149)
|
|
14
|
+
[`4b955e247c793`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4b955e247c793) -
|
|
15
|
+
[ED-27560] Migrate to useSharedPluginStateSelector for text color, toolbar lists indentation,
|
|
16
|
+
type-ahead, undo-redo plugins
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 2.0.14
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -9,6 +9,11 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
|
9
9
|
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
10
10
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
11
|
var _commands = require("./commands");
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param api
|
|
15
|
+
* @example
|
|
16
|
+
*/
|
|
12
17
|
function keymapPlugin(api) {
|
|
13
18
|
var _api$analytics, _api$analytics3;
|
|
14
19
|
var list = {};
|
|
@@ -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
|
|
@@ -3,6 +3,12 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
3
3
|
import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
5
|
import { redoFromKeyboard, redoFromKeyboardWithAnalytics, undoFromKeyboard, undoFromKeyboardWithAnalytics } from './commands';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param api
|
|
10
|
+
* @example
|
|
11
|
+
*/
|
|
6
12
|
export function keymapPlugin(api) {
|
|
7
13
|
var _api$analytics, _api$analytics3;
|
|
8
14
|
const list = {};
|
|
@@ -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
|
|
@@ -3,6 +3,12 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
3
3
|
import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
5
|
import { redoFromKeyboard, redoFromKeyboardWithAnalytics, undoFromKeyboard, undoFromKeyboardWithAnalytics } from './commands';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param api
|
|
10
|
+
* @example
|
|
11
|
+
*/
|
|
6
12
|
export function keymapPlugin(api) {
|
|
7
13
|
var _api$analytics, _api$analytics3;
|
|
8
14
|
var list = {};
|
|
@@ -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
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
1
|
+
import { type EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
export declare const undoFromKeyboard: import("@atlaskit/editor-common/types").Command;
|
|
3
3
|
export declare const redoFromKeyboard: import("@atlaskit/editor-common/types").Command;
|
|
4
4
|
export declare const undoFromToolbar: import("@atlaskit/editor-common/types").Command;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
-
import { UndoRedoPlugin } from '../undoRedoPluginType';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { UndoRedoPlugin } from '../undoRedoPluginType';
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param api
|
|
7
|
+
* @example
|
|
8
|
+
*/
|
|
4
9
|
export declare function keymapPlugin(api?: ExtractInjectionAPI<UndoRedoPlugin>): SafePlugin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Command, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
import { UndoRedoPlugin } from '../undoRedoPluginType';
|
|
3
|
+
import type { UndoRedoPlugin } from '../undoRedoPluginType';
|
|
4
4
|
export declare const closeTypeAheadAndRunCommand: (editorView: EditorView, api: ExtractInjectionAPI<UndoRedoPlugin> | undefined) => (command: Command) => boolean;
|
|
5
5
|
export declare const forceFocus: (editorView: EditorView, api: ExtractInjectionAPI<UndoRedoPlugin> | undefined) => (command: Command) => boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
1
|
+
import { type EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
export declare const undoFromKeyboard: import("@atlaskit/editor-common/types").Command;
|
|
3
3
|
export declare const redoFromKeyboard: import("@atlaskit/editor-common/types").Command;
|
|
4
4
|
export declare const undoFromToolbar: import("@atlaskit/editor-common/types").Command;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
-
import { UndoRedoPlugin } from '../undoRedoPluginType';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { UndoRedoPlugin } from '../undoRedoPluginType';
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param api
|
|
7
|
+
* @example
|
|
8
|
+
*/
|
|
4
9
|
export declare function keymapPlugin(api?: ExtractInjectionAPI<UndoRedoPlugin>): SafePlugin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Command, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
import { UndoRedoPlugin } from '../undoRedoPluginType';
|
|
3
|
+
import type { UndoRedoPlugin } from '../undoRedoPluginType';
|
|
4
4
|
export declare const closeTypeAheadAndRunCommand: (editorView: EditorView, api: ExtractInjectionAPI<UndoRedoPlugin> | undefined) => (command: Command) => boolean;
|
|
5
5
|
export declare const forceFocus: (editorView: EditorView, api: ExtractInjectionAPI<UndoRedoPlugin> | undefined) => (command: Command) => boolean;
|
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.16",
|
|
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": "^105.
|
|
36
|
+
"@atlaskit/editor-common": "^105.10.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
|
-
"@atlaskit/icon": "^26.
|
|
41
|
+
"@atlaskit/icon": "^26.3.0",
|
|
42
42
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
43
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
43
|
+
"@atlaskit/tmp-editor-statsig": "^5.0.0",
|
|
44
44
|
"@babel/runtime": "^7.0.0",
|
|
45
45
|
"@emotion/react": "^11.7.1"
|
|
46
46
|
},
|