@atlaskit/editor-core 188.11.4 → 188.12.0
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 +10 -0
- package/dist/cjs/labs/next/presets/universal.js +3 -2
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/plugins/undo-redo/index.js +7 -16
- package/dist/cjs/plugins/undo-redo/ui/ToolbarUndoRedo/index.js +59 -75
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/labs/next/presets/universal.js +2 -1
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/undo-redo/index.js +6 -17
- package/dist/es2019/plugins/undo-redo/ui/ToolbarUndoRedo/index.js +60 -61
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/labs/next/presets/universal.js +2 -1
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/undo-redo/index.js +6 -16
- package/dist/esm/plugins/undo-redo/ui/ToolbarUndoRedo/index.js +56 -74
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/undo-redo/types.d.ts +2 -1
- package/dist/types/plugins/undo-redo/ui/ToolbarUndoRedo/index.d.ts +2 -6
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/undo-redo/types.d.ts +3 -1
- package/dist/types-ts4.5/plugins/undo-redo/ui/ToolbarUndoRedo/index.d.ts +2 -6
- package/package.json +4 -3
- package/dist/cjs/plugins/history/actions.js +0 -10
- package/dist/cjs/plugins/history/index.js +0 -75
- package/dist/cjs/plugins/history/pm-history-types.js +0 -5
- package/dist/cjs/plugins/history/reducer.js +0 -18
- package/dist/cjs/plugins/history/types.js +0 -5
- package/dist/cjs/plugins/history/utils.js +0 -19
- package/dist/es2019/plugins/history/actions.js +0 -4
- package/dist/es2019/plugins/history/index.js +0 -61
- package/dist/es2019/plugins/history/pm-history-types.js +0 -1
- package/dist/es2019/plugins/history/reducer.js +0 -12
- package/dist/es2019/plugins/history/types.js +0 -1
- package/dist/es2019/plugins/history/utils.js +0 -11
- package/dist/esm/plugins/history/actions.js +0 -4
- package/dist/esm/plugins/history/index.js +0 -68
- package/dist/esm/plugins/history/pm-history-types.js +0 -1
- package/dist/esm/plugins/history/reducer.js +0 -12
- package/dist/esm/plugins/history/types.js +0 -1
- package/dist/esm/plugins/history/utils.js +0 -13
- package/dist/types/plugins/history/actions.d.ts +0 -8
- package/dist/types/plugins/history/index.d.ts +0 -13
- package/dist/types/plugins/history/pm-history-types.d.ts +0 -17
- package/dist/types/plugins/history/reducer.d.ts +0 -4
- package/dist/types/plugins/history/types.d.ts +0 -4
- package/dist/types/plugins/history/utils.d.ts +0 -4
- package/dist/types-ts4.5/plugins/history/actions.d.ts +0 -8
- package/dist/types-ts4.5/plugins/history/index.d.ts +0 -13
- package/dist/types-ts4.5/plugins/history/pm-history-types.d.ts +0 -17
- package/dist/types-ts4.5/plugins/history/reducer.d.ts +0 -4
- package/dist/types-ts4.5/plugins/history/types.d.ts +0 -4
- package/dist/types-ts4.5/plugins/history/utils.d.ts +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 188.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#41770](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41770) [`0d7961fbb3b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0d7961fbb3b) - Extract History Plugin
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 188.11.4
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -8,6 +8,7 @@ exports.default = createUniversalPreset;
|
|
|
8
8
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _plugins = require("../../../plugins");
|
|
11
|
+
var _editorPluginHistory = require("@atlaskit/editor-plugin-history");
|
|
11
12
|
var _editorPluginStatus = require("@atlaskit/editor-plugin-status");
|
|
12
13
|
var _editorPluginDate = require("@atlaskit/editor-plugin-date");
|
|
13
14
|
var _editorPluginCaption = require("@atlaskit/editor-plugin-caption");
|
|
@@ -334,9 +335,9 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
|
|
|
334
335
|
return builder.add(_editorPluginScrollIntoView.scrollIntoViewPlugin);
|
|
335
336
|
}
|
|
336
337
|
return builder;
|
|
337
|
-
}).maybeAdd(
|
|
338
|
+
}).maybeAdd(_editorPluginHistory.historyPlugin, function (plugin, builder) {
|
|
338
339
|
if (isMobile || props.allowUndoRedoButtons) {
|
|
339
|
-
return builder.add(
|
|
340
|
+
return builder.add(_editorPluginHistory.historyPlugin);
|
|
340
341
|
}
|
|
341
342
|
return builder;
|
|
342
343
|
}).maybeAdd(_plugins.mobileDimensionsPlugin, function (plugin, builder) {
|
|
@@ -113,12 +113,6 @@ Object.defineProperty(exports, "fragmentMarkPlugin", {
|
|
|
113
113
|
return _fragment.default;
|
|
114
114
|
}
|
|
115
115
|
});
|
|
116
|
-
Object.defineProperty(exports, "historyPlugin", {
|
|
117
|
-
enumerable: true,
|
|
118
|
-
get: function get() {
|
|
119
|
-
return _history.default;
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
116
|
Object.defineProperty(exports, "indentationPlugin", {
|
|
123
117
|
enumerable: true,
|
|
124
118
|
get: function get() {
|
|
@@ -253,7 +247,6 @@ var _annotation = _interopRequireDefault(require("./annotation"));
|
|
|
253
247
|
var _analytics = _interopRequireDefault(require("./analytics"));
|
|
254
248
|
var _customAutoformat = _interopRequireDefault(require("./custom-autoformat"));
|
|
255
249
|
var _feedbackDialog = _interopRequireDefault(require("./feedback-dialog"));
|
|
256
|
-
var _history = _interopRequireDefault(require("./history"));
|
|
257
250
|
var _expand = _interopRequireWildcard(require("./expand"));
|
|
258
251
|
var _mobileDimensions = _interopRequireDefault(require("./mobile-dimensions"));
|
|
259
252
|
var _findReplace = _interopRequireDefault(require("./find-replace"));
|
|
@@ -8,9 +8,9 @@ exports.default = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _keymaps = require("./pm-plugins/keymaps");
|
|
10
10
|
var _main = require("./pm-plugins/main");
|
|
11
|
-
var _history = require("../history");
|
|
12
11
|
var _ToolbarUndoRedo = _interopRequireDefault(require("./ui/ToolbarUndoRedo"));
|
|
13
|
-
|
|
12
|
+
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
13
|
+
|
|
14
14
|
var undoRedoPlugin = function undoRedoPlugin(_ref) {
|
|
15
15
|
var api = _ref.api;
|
|
16
16
|
return {
|
|
@@ -32,20 +32,11 @@ var undoRedoPlugin = function undoRedoPlugin(_ref) {
|
|
|
32
32
|
var editorView = _ref2.editorView,
|
|
33
33
|
disabled = _ref2.disabled,
|
|
34
34
|
isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing;
|
|
35
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
var historyState = _ref3.historyState;
|
|
41
|
-
return /*#__PURE__*/_react.default.createElement(_ToolbarUndoRedo.default, {
|
|
42
|
-
isReducedSpacing: isToolbarReducedSpacing,
|
|
43
|
-
disabled: disabled,
|
|
44
|
-
historyState: historyState,
|
|
45
|
-
editorView: editorView,
|
|
46
|
-
api: api
|
|
47
|
-
});
|
|
48
|
-
}
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement(_ToolbarUndoRedo.default, {
|
|
36
|
+
isReducedSpacing: isToolbarReducedSpacing,
|
|
37
|
+
disabled: disabled,
|
|
38
|
+
editorView: editorView,
|
|
39
|
+
api: api
|
|
49
40
|
});
|
|
50
41
|
}
|
|
51
42
|
};
|
|
@@ -6,16 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = exports.ToolbarUndoRedo = void 0;
|
|
9
|
-
var
|
|
10
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
-
var _react = require("react");
|
|
15
|
-
var _react2 = require("@emotion/react");
|
|
9
|
+
var _react = require("@emotion/react");
|
|
16
10
|
var _reactIntlNext = require("react-intl-next");
|
|
17
11
|
var _undo = _interopRequireDefault(require("@atlaskit/icon/glyph/undo"));
|
|
18
12
|
var _redo = _interopRequireDefault(require("@atlaskit/icon/glyph/redo"));
|
|
13
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
19
14
|
var _keymaps = require("../../../../keymaps");
|
|
20
15
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
21
16
|
var _ToolbarButton = _interopRequireWildcard(require("../../../../ui/ToolbarButton"));
|
|
@@ -24,8 +19,8 @@ var _commands = require("../../commands");
|
|
|
24
19
|
var _keymaps2 = require("@atlaskit/editor-common/keymaps");
|
|
25
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
26
21
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
/** @jsx jsx */
|
|
23
|
+
|
|
29
24
|
var closeTypeAheadAndRunCommand = function closeTypeAheadAndRunCommand(editorView, api) {
|
|
30
25
|
return function (command) {
|
|
31
26
|
var _api$typeAhead;
|
|
@@ -51,70 +46,59 @@ var forceFocus = function forceFocus(editorView, api) {
|
|
|
51
46
|
}
|
|
52
47
|
};
|
|
53
48
|
};
|
|
54
|
-
var ToolbarUndoRedo = exports.ToolbarUndoRedo =
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}),
|
|
110
|
-
testId: "ak-editor-toolbar-button-redo",
|
|
111
|
-
"aria-label": (0, _keymaps.tooltip)(_keymaps.redo, labelRedo),
|
|
112
|
-
"aria-keyshortcuts": (0, _keymaps2.getAriaKeyshortcuts)(_keymaps.redo)
|
|
113
|
-
}), (0, _react2.jsx)("span", {
|
|
114
|
-
css: _styles.separatorStyles
|
|
115
|
-
}));
|
|
116
|
-
}
|
|
117
|
-
}]);
|
|
118
|
-
return ToolbarUndoRedo;
|
|
119
|
-
}(_react.PureComponent);
|
|
49
|
+
var ToolbarUndoRedo = exports.ToolbarUndoRedo = function ToolbarUndoRedo(_ref) {
|
|
50
|
+
var disabled = _ref.disabled,
|
|
51
|
+
isReducedSpacing = _ref.isReducedSpacing,
|
|
52
|
+
editorView = _ref.editorView,
|
|
53
|
+
api = _ref.api,
|
|
54
|
+
formatMessage = _ref.intl.formatMessage;
|
|
55
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['history']),
|
|
56
|
+
historyState = _useSharedPluginState.historyState;
|
|
57
|
+
var handleUndo = function handleUndo() {
|
|
58
|
+
forceFocus(editorView, api)(_commands.undoFromToolbar);
|
|
59
|
+
};
|
|
60
|
+
var handleRedo = function handleRedo() {
|
|
61
|
+
forceFocus(editorView, api)(_commands.redoFromToolbar);
|
|
62
|
+
};
|
|
63
|
+
var labelUndo = formatMessage(_messages.undoRedoMessages.undo);
|
|
64
|
+
var labelRedo = formatMessage(_messages.undoRedoMessages.redo);
|
|
65
|
+
var _ref2 = historyState !== null && historyState !== void 0 ? historyState : {},
|
|
66
|
+
canUndo = _ref2.canUndo,
|
|
67
|
+
canRedo = _ref2.canRedo;
|
|
68
|
+
return (0, _react.jsx)("span", {
|
|
69
|
+
css: _styles.buttonGroupStyle
|
|
70
|
+
}, (0, _react.jsx)(_ToolbarButton.default, {
|
|
71
|
+
buttonId: _ToolbarButton.TOOLBAR_BUTTON.UNDO,
|
|
72
|
+
spacing: isReducedSpacing ? 'none' : 'default',
|
|
73
|
+
onClick: handleUndo,
|
|
74
|
+
disabled: !canUndo || disabled,
|
|
75
|
+
"aria-label": (0, _keymaps.tooltip)(_keymaps.undo, labelUndo),
|
|
76
|
+
"aria-keyshortcuts": (0, _keymaps2.getAriaKeyshortcuts)(_keymaps.undo),
|
|
77
|
+
title: (0, _react.jsx)(_keymaps.ToolTipContent, {
|
|
78
|
+
description: labelUndo,
|
|
79
|
+
keymap: _keymaps.undo
|
|
80
|
+
}),
|
|
81
|
+
iconBefore: (0, _react.jsx)(_undo.default, {
|
|
82
|
+
label: ""
|
|
83
|
+
}),
|
|
84
|
+
testId: "ak-editor-toolbar-button-undo"
|
|
85
|
+
}), (0, _react.jsx)(_ToolbarButton.default, {
|
|
86
|
+
spacing: isReducedSpacing ? 'none' : 'default',
|
|
87
|
+
buttonId: _ToolbarButton.TOOLBAR_BUTTON.REDO,
|
|
88
|
+
onClick: handleRedo,
|
|
89
|
+
disabled: !canRedo || disabled,
|
|
90
|
+
title: (0, _react.jsx)(_keymaps.ToolTipContent, {
|
|
91
|
+
description: labelRedo,
|
|
92
|
+
keymap: _keymaps.redo
|
|
93
|
+
}),
|
|
94
|
+
iconBefore: (0, _react.jsx)(_redo.default, {
|
|
95
|
+
label: ""
|
|
96
|
+
}),
|
|
97
|
+
testId: "ak-editor-toolbar-button-redo",
|
|
98
|
+
"aria-label": (0, _keymaps.tooltip)(_keymaps.redo, labelRedo),
|
|
99
|
+
"aria-keyshortcuts": (0, _keymaps2.getAriaKeyshortcuts)(_keymaps.redo)
|
|
100
|
+
}), (0, _react.jsx)("span", {
|
|
101
|
+
css: _styles.separatorStyles
|
|
102
|
+
}));
|
|
103
|
+
};
|
|
120
104
|
var _default = exports.default = (0, _reactIntlNext.injectIntl)(ToolbarUndoRedo);
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = exports.name = "@atlaskit/editor-core";
|
|
8
|
-
var version = exports.version = "188.
|
|
8
|
+
var version = exports.version = "188.12.0";
|
|
9
9
|
var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
|
|
10
10
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
11
11
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, fragmentMarkPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, panelPlugin, placeholderTextPlugin, tasksAndDecisionsPlugin, textColorPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin,
|
|
1
|
+
import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, fragmentMarkPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, panelPlugin, placeholderTextPlugin, tasksAndDecisionsPlugin, textColorPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, expandPlugin, isExpandInsertionEnabled, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../../../plugins';
|
|
2
|
+
import { historyPlugin } from '@atlaskit/editor-plugin-history';
|
|
2
3
|
import { statusPlugin } from '@atlaskit/editor-plugin-status';
|
|
3
4
|
import { datePlugin } from '@atlaskit/editor-plugin-date';
|
|
4
5
|
import { captionPlugin } from '@atlaskit/editor-plugin-caption';
|
|
@@ -24,7 +24,6 @@ export { default as annotationPlugin } from './annotation';
|
|
|
24
24
|
export { default as analyticsPlugin } from './analytics';
|
|
25
25
|
export { default as customAutoformatPlugin } from './custom-autoformat';
|
|
26
26
|
export { default as feedbackDialogPlugin } from './feedback-dialog';
|
|
27
|
-
export { default as historyPlugin } from './history';
|
|
28
27
|
export { default as expandPlugin, isExpandInsertionEnabled } from './expand';
|
|
29
28
|
export { default as mobileDimensionsPlugin } from './mobile-dimensions';
|
|
30
29
|
export { default as findReplacePlugin } from './find-replace';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { keymapPlugin } from './pm-plugins/keymaps';
|
|
3
3
|
import { createPlugin } from './pm-plugins/main';
|
|
4
|
-
|
|
4
|
+
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
5
5
|
import ToolbarUndoRedo from './ui/ToolbarUndoRedo';
|
|
6
|
-
import WithPluginState from '../../ui/WithPluginState';
|
|
7
6
|
const undoRedoPlugin = ({
|
|
8
7
|
api
|
|
9
8
|
}) => ({
|
|
@@ -22,21 +21,11 @@ const undoRedoPlugin = ({
|
|
|
22
21
|
disabled,
|
|
23
22
|
isToolbarReducedSpacing
|
|
24
23
|
}) {
|
|
25
|
-
return /*#__PURE__*/React.createElement(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
historyState
|
|
31
|
-
}) => {
|
|
32
|
-
return /*#__PURE__*/React.createElement(ToolbarUndoRedo, {
|
|
33
|
-
isReducedSpacing: isToolbarReducedSpacing,
|
|
34
|
-
disabled: disabled,
|
|
35
|
-
historyState: historyState,
|
|
36
|
-
editorView: editorView,
|
|
37
|
-
api: api
|
|
38
|
-
});
|
|
39
|
-
}
|
|
24
|
+
return /*#__PURE__*/React.createElement(ToolbarUndoRedo, {
|
|
25
|
+
isReducedSpacing: isToolbarReducedSpacing,
|
|
26
|
+
disabled: disabled,
|
|
27
|
+
editorView: editorView,
|
|
28
|
+
api: api
|
|
40
29
|
});
|
|
41
30
|
}
|
|
42
31
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { PureComponent } from 'react';
|
|
3
2
|
import { jsx } from '@emotion/react';
|
|
4
3
|
import { injectIntl } from 'react-intl-next';
|
|
5
4
|
import UndoIcon from '@atlaskit/icon/glyph/undo';
|
|
6
5
|
import RedoIcon from '@atlaskit/icon/glyph/redo';
|
|
6
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
7
7
|
import { undo as undoKeymap, redo as redoKeymap, ToolTipContent, tooltip } from '../../../../keymaps';
|
|
8
8
|
import { separatorStyles, buttonGroupStyle } from '@atlaskit/editor-common/styles';
|
|
9
9
|
import ToolbarButton, { TOOLBAR_BUTTON } from '../../../../ui/ToolbarButton';
|
|
@@ -31,65 +31,64 @@ const forceFocus = (editorView, api) => command => {
|
|
|
31
31
|
editorView.focus();
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
-
export
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
api,
|
|
42
|
-
intl: {
|
|
43
|
-
formatMessage
|
|
44
|
-
}
|
|
45
|
-
} = this.props;
|
|
46
|
-
const handleUndo = () => {
|
|
47
|
-
forceFocus(editorView, api)(undoFromToolbar);
|
|
48
|
-
};
|
|
49
|
-
const handleRedo = () => {
|
|
50
|
-
forceFocus(editorView, api)(redoFromToolbar);
|
|
51
|
-
};
|
|
52
|
-
const labelUndo = formatMessage(undoRedoMessages.undo);
|
|
53
|
-
const labelRedo = formatMessage(undoRedoMessages.redo);
|
|
54
|
-
const {
|
|
55
|
-
canUndo,
|
|
56
|
-
canRedo
|
|
57
|
-
} = historyState;
|
|
58
|
-
return jsx("span", {
|
|
59
|
-
css: buttonGroupStyle
|
|
60
|
-
}, jsx(ToolbarButton, {
|
|
61
|
-
buttonId: TOOLBAR_BUTTON.UNDO,
|
|
62
|
-
spacing: isReducedSpacing ? 'none' : 'default',
|
|
63
|
-
onClick: handleUndo,
|
|
64
|
-
disabled: !canUndo || disabled,
|
|
65
|
-
"aria-label": tooltip(undoKeymap, labelUndo),
|
|
66
|
-
"aria-keyshortcuts": getAriaKeyshortcuts(undoKeymap),
|
|
67
|
-
title: jsx(ToolTipContent, {
|
|
68
|
-
description: labelUndo,
|
|
69
|
-
keymap: undoKeymap
|
|
70
|
-
}),
|
|
71
|
-
iconBefore: jsx(UndoIcon, {
|
|
72
|
-
label: ""
|
|
73
|
-
}),
|
|
74
|
-
testId: "ak-editor-toolbar-button-undo"
|
|
75
|
-
}), jsx(ToolbarButton, {
|
|
76
|
-
spacing: isReducedSpacing ? 'none' : 'default',
|
|
77
|
-
buttonId: TOOLBAR_BUTTON.REDO,
|
|
78
|
-
onClick: handleRedo,
|
|
79
|
-
disabled: !canRedo || disabled,
|
|
80
|
-
title: jsx(ToolTipContent, {
|
|
81
|
-
description: labelRedo,
|
|
82
|
-
keymap: redoKeymap
|
|
83
|
-
}),
|
|
84
|
-
iconBefore: jsx(RedoIcon, {
|
|
85
|
-
label: ""
|
|
86
|
-
}),
|
|
87
|
-
testId: "ak-editor-toolbar-button-redo",
|
|
88
|
-
"aria-label": tooltip(redoKeymap, labelRedo),
|
|
89
|
-
"aria-keyshortcuts": getAriaKeyshortcuts(redoKeymap)
|
|
90
|
-
}), jsx("span", {
|
|
91
|
-
css: separatorStyles
|
|
92
|
-
}));
|
|
34
|
+
export const ToolbarUndoRedo = ({
|
|
35
|
+
disabled,
|
|
36
|
+
isReducedSpacing,
|
|
37
|
+
editorView,
|
|
38
|
+
api,
|
|
39
|
+
intl: {
|
|
40
|
+
formatMessage
|
|
93
41
|
}
|
|
94
|
-
}
|
|
42
|
+
}) => {
|
|
43
|
+
const {
|
|
44
|
+
historyState
|
|
45
|
+
} = useSharedPluginState(api, ['history']);
|
|
46
|
+
const handleUndo = () => {
|
|
47
|
+
forceFocus(editorView, api)(undoFromToolbar);
|
|
48
|
+
};
|
|
49
|
+
const handleRedo = () => {
|
|
50
|
+
forceFocus(editorView, api)(redoFromToolbar);
|
|
51
|
+
};
|
|
52
|
+
const labelUndo = formatMessage(undoRedoMessages.undo);
|
|
53
|
+
const labelRedo = formatMessage(undoRedoMessages.redo);
|
|
54
|
+
const {
|
|
55
|
+
canUndo,
|
|
56
|
+
canRedo
|
|
57
|
+
} = historyState !== null && historyState !== void 0 ? historyState : {};
|
|
58
|
+
return jsx("span", {
|
|
59
|
+
css: buttonGroupStyle
|
|
60
|
+
}, jsx(ToolbarButton, {
|
|
61
|
+
buttonId: TOOLBAR_BUTTON.UNDO,
|
|
62
|
+
spacing: isReducedSpacing ? 'none' : 'default',
|
|
63
|
+
onClick: handleUndo,
|
|
64
|
+
disabled: !canUndo || disabled,
|
|
65
|
+
"aria-label": tooltip(undoKeymap, labelUndo),
|
|
66
|
+
"aria-keyshortcuts": getAriaKeyshortcuts(undoKeymap),
|
|
67
|
+
title: jsx(ToolTipContent, {
|
|
68
|
+
description: labelUndo,
|
|
69
|
+
keymap: undoKeymap
|
|
70
|
+
}),
|
|
71
|
+
iconBefore: jsx(UndoIcon, {
|
|
72
|
+
label: ""
|
|
73
|
+
}),
|
|
74
|
+
testId: "ak-editor-toolbar-button-undo"
|
|
75
|
+
}), jsx(ToolbarButton, {
|
|
76
|
+
spacing: isReducedSpacing ? 'none' : 'default',
|
|
77
|
+
buttonId: TOOLBAR_BUTTON.REDO,
|
|
78
|
+
onClick: handleRedo,
|
|
79
|
+
disabled: !canRedo || disabled,
|
|
80
|
+
title: jsx(ToolTipContent, {
|
|
81
|
+
description: labelRedo,
|
|
82
|
+
keymap: redoKeymap
|
|
83
|
+
}),
|
|
84
|
+
iconBefore: jsx(RedoIcon, {
|
|
85
|
+
label: ""
|
|
86
|
+
}),
|
|
87
|
+
testId: "ak-editor-toolbar-button-redo",
|
|
88
|
+
"aria-label": tooltip(redoKeymap, labelRedo),
|
|
89
|
+
"aria-keyshortcuts": getAriaKeyshortcuts(redoKeymap)
|
|
90
|
+
}), jsx("span", {
|
|
91
|
+
css: separatorStyles
|
|
92
|
+
}));
|
|
93
|
+
};
|
|
95
94
|
export default injectIntl(ToolbarUndoRedo);
|
|
@@ -2,7 +2,8 @@ import _typeof from "@babel/runtime/helpers/typeof";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
-
import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, fragmentMarkPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, panelPlugin, placeholderTextPlugin, tasksAndDecisionsPlugin, textColorPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin,
|
|
5
|
+
import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, fragmentMarkPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, panelPlugin, placeholderTextPlugin, tasksAndDecisionsPlugin, textColorPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, expandPlugin, isExpandInsertionEnabled, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../../../plugins';
|
|
6
|
+
import { historyPlugin } from '@atlaskit/editor-plugin-history';
|
|
6
7
|
import { statusPlugin } from '@atlaskit/editor-plugin-status';
|
|
7
8
|
import { datePlugin } from '@atlaskit/editor-plugin-date';
|
|
8
9
|
import { captionPlugin } from '@atlaskit/editor-plugin-caption';
|
|
@@ -24,7 +24,6 @@ export { default as annotationPlugin } from './annotation';
|
|
|
24
24
|
export { default as analyticsPlugin } from './analytics';
|
|
25
25
|
export { default as customAutoformatPlugin } from './custom-autoformat';
|
|
26
26
|
export { default as feedbackDialogPlugin } from './feedback-dialog';
|
|
27
|
-
export { default as historyPlugin } from './history';
|
|
28
27
|
export { default as expandPlugin, isExpandInsertionEnabled } from './expand';
|
|
29
28
|
export { default as mobileDimensionsPlugin } from './mobile-dimensions';
|
|
30
29
|
export { default as findReplacePlugin } from './find-replace';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { keymapPlugin } from './pm-plugins/keymaps';
|
|
3
3
|
import { createPlugin } from './pm-plugins/main';
|
|
4
|
-
|
|
4
|
+
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
5
5
|
import ToolbarUndoRedo from './ui/ToolbarUndoRedo';
|
|
6
|
-
import WithPluginState from '../../ui/WithPluginState';
|
|
7
6
|
var undoRedoPlugin = function undoRedoPlugin(_ref) {
|
|
8
7
|
var api = _ref.api;
|
|
9
8
|
return {
|
|
@@ -25,20 +24,11 @@ var undoRedoPlugin = function undoRedoPlugin(_ref) {
|
|
|
25
24
|
var editorView = _ref2.editorView,
|
|
26
25
|
disabled = _ref2.disabled,
|
|
27
26
|
isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing;
|
|
28
|
-
return /*#__PURE__*/React.createElement(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var historyState = _ref3.historyState;
|
|
34
|
-
return /*#__PURE__*/React.createElement(ToolbarUndoRedo, {
|
|
35
|
-
isReducedSpacing: isToolbarReducedSpacing,
|
|
36
|
-
disabled: disabled,
|
|
37
|
-
historyState: historyState,
|
|
38
|
-
editorView: editorView,
|
|
39
|
-
api: api
|
|
40
|
-
});
|
|
41
|
-
}
|
|
27
|
+
return /*#__PURE__*/React.createElement(ToolbarUndoRedo, {
|
|
28
|
+
isReducedSpacing: isToolbarReducedSpacing,
|
|
29
|
+
disabled: disabled,
|
|
30
|
+
editorView: editorView,
|
|
31
|
+
api: api
|
|
42
32
|
});
|
|
43
33
|
}
|
|
44
34
|
};
|