@atlaskit/editor-plugin-undo-redo 1.1.2 → 1.2.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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-plugin-undo-redo
2
2
 
3
+ ## 1.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#101406](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101406)
8
+ [`6daffd65aec4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6daffd65aec4) -
9
+ [ED-23298] Extract primary toolbar components to editor plugin to allow for custom ordering
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 1.1.3
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
3
21
  ## 1.1.2
4
22
 
5
23
  ### Patch Changes
@@ -13,6 +13,17 @@ var _ToolbarUndoRedo = _interopRequireDefault(require("./ui/ToolbarUndoRedo"));
13
13
 
14
14
  var undoRedoPlugin = exports.undoRedoPlugin = function undoRedoPlugin(_ref) {
15
15
  var api = _ref.api;
16
+ var primaryToolbarComponent = function primaryToolbarComponent(_ref2) {
17
+ var editorView = _ref2.editorView,
18
+ disabled = _ref2.disabled,
19
+ isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing;
20
+ return /*#__PURE__*/_react.default.createElement(_ToolbarUndoRedo.default, {
21
+ isReducedSpacing: isToolbarReducedSpacing,
22
+ disabled: disabled,
23
+ editorView: editorView,
24
+ api: api
25
+ });
26
+ };
16
27
  return {
17
28
  name: 'undoRedoPlugin',
18
29
  pmPlugins: function pmPlugins() {
@@ -28,16 +39,13 @@ var undoRedoPlugin = exports.undoRedoPlugin = function undoRedoPlugin(_ref) {
28
39
  }
29
40
  }];
30
41
  },
31
- primaryToolbarComponent: function primaryToolbarComponent(_ref2) {
32
- var editorView = _ref2.editorView,
33
- disabled = _ref2.disabled,
34
- isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing;
35
- return /*#__PURE__*/_react.default.createElement(_ToolbarUndoRedo.default, {
36
- isReducedSpacing: isToolbarReducedSpacing,
37
- disabled: disabled,
38
- editorView: editorView,
39
- api: api
40
- });
41
- }
42
+ usePluginHook: function usePluginHook() {
43
+ var _api$core, _api$primaryToolbar;
44
+ api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 ? void 0 : _api$primaryToolbar.commands.registerComponent({
45
+ name: 'undoRedoPlugin',
46
+ component: primaryToolbarComponent
47
+ }));
48
+ },
49
+ primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
42
50
  };
43
51
  };
@@ -95,7 +95,8 @@ var ToolbarUndoRedo = exports.ToolbarUndoRedo = function ToolbarUndoRedo(_ref) {
95
95
  testId: "ak-editor-toolbar-button-redo",
96
96
  "aria-label": (0, _keymaps.tooltip)(_keymaps.redo, labelRedo),
97
97
  "aria-keyshortcuts": (0, _keymaps.getAriaKeyshortcuts)(_keymaps.redo)
98
- }), (0, _react.jsx)("span", {
98
+ }), !(api !== null && api !== void 0 && api.primaryToolbar) && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
99
+ (0, _react.jsx)("span", {
99
100
  css: _styles.separatorStyles
100
101
  }))
101
102
  );
@@ -6,27 +6,37 @@ import { createPlugin } from './pm-plugins/main';
6
6
  import ToolbarUndoRedo from './ui/ToolbarUndoRedo';
7
7
  export const undoRedoPlugin = ({
8
8
  api
9
- }) => ({
10
- name: 'undoRedoPlugin',
11
- pmPlugins() {
12
- return [{
13
- name: 'undoRedoKeyMap',
14
- plugin: () => keymapPlugin()
15
- }, {
16
- name: 'undoRedoPlugin',
17
- plugin: options => createPlugin(options)
18
- }];
19
- },
20
- primaryToolbarComponent({
9
+ }) => {
10
+ const primaryToolbarComponent = ({
21
11
  editorView,
22
12
  disabled,
23
13
  isToolbarReducedSpacing
24
- }) {
14
+ }) => {
25
15
  return /*#__PURE__*/React.createElement(ToolbarUndoRedo, {
26
16
  isReducedSpacing: isToolbarReducedSpacing,
27
17
  disabled: disabled,
28
18
  editorView: editorView,
29
19
  api: api
30
20
  });
31
- }
32
- });
21
+ };
22
+ return {
23
+ name: 'undoRedoPlugin',
24
+ pmPlugins() {
25
+ return [{
26
+ name: 'undoRedoKeyMap',
27
+ plugin: () => keymapPlugin()
28
+ }, {
29
+ name: 'undoRedoPlugin',
30
+ plugin: options => createPlugin(options)
31
+ }];
32
+ },
33
+ usePluginHook: () => {
34
+ var _api$core, _api$primaryToolbar;
35
+ api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 ? void 0 : (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 ? void 0 : _api$primaryToolbar.commands.registerComponent({
36
+ name: 'undoRedoPlugin',
37
+ component: primaryToolbarComponent
38
+ }));
39
+ },
40
+ primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
41
+ };
42
+ };
@@ -88,7 +88,8 @@ export const ToolbarUndoRedo = ({
88
88
  testId: "ak-editor-toolbar-button-redo",
89
89
  "aria-label": tooltip(redoKeymap, labelRedo),
90
90
  "aria-keyshortcuts": getAriaKeyshortcuts(redoKeymap)
91
- }), jsx("span", {
91
+ }), !(api !== null && api !== void 0 && api.primaryToolbar) && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
92
+ jsx("span", {
92
93
  css: separatorStyles
93
94
  }))
94
95
  );
@@ -6,6 +6,17 @@ import { createPlugin } from './pm-plugins/main';
6
6
  import ToolbarUndoRedo from './ui/ToolbarUndoRedo';
7
7
  export var undoRedoPlugin = function undoRedoPlugin(_ref) {
8
8
  var api = _ref.api;
9
+ var primaryToolbarComponent = function primaryToolbarComponent(_ref2) {
10
+ var editorView = _ref2.editorView,
11
+ disabled = _ref2.disabled,
12
+ isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing;
13
+ return /*#__PURE__*/React.createElement(ToolbarUndoRedo, {
14
+ isReducedSpacing: isToolbarReducedSpacing,
15
+ disabled: disabled,
16
+ editorView: editorView,
17
+ api: api
18
+ });
19
+ };
9
20
  return {
10
21
  name: 'undoRedoPlugin',
11
22
  pmPlugins: function pmPlugins() {
@@ -21,16 +32,13 @@ export var undoRedoPlugin = function undoRedoPlugin(_ref) {
21
32
  }
22
33
  }];
23
34
  },
24
- primaryToolbarComponent: function primaryToolbarComponent(_ref2) {
25
- var editorView = _ref2.editorView,
26
- disabled = _ref2.disabled,
27
- isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing;
28
- return /*#__PURE__*/React.createElement(ToolbarUndoRedo, {
29
- isReducedSpacing: isToolbarReducedSpacing,
30
- disabled: disabled,
31
- editorView: editorView,
32
- api: api
33
- });
34
- }
35
+ usePluginHook: function usePluginHook() {
36
+ var _api$core, _api$primaryToolbar;
37
+ api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 ? void 0 : _api$primaryToolbar.commands.registerComponent({
38
+ name: 'undoRedoPlugin',
39
+ component: primaryToolbarComponent
40
+ }));
41
+ },
42
+ primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
35
43
  };
36
44
  };
@@ -87,7 +87,8 @@ export var ToolbarUndoRedo = function ToolbarUndoRedo(_ref) {
87
87
  testId: "ak-editor-toolbar-button-redo",
88
88
  "aria-label": tooltip(redoKeymap, labelRedo),
89
89
  "aria-keyshortcuts": getAriaKeyshortcuts(redoKeymap)
90
- }), jsx("span", {
90
+ }), !(api !== null && api !== void 0 && api.primaryToolbar) && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
91
+ jsx("span", {
91
92
  css: separatorStyles
92
93
  }))
93
94
  );
@@ -1,6 +1,11 @@
1
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
1
+ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
2
  import type { HistoryPlugin } from '@atlaskit/editor-plugin-history';
3
+ import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
3
4
  import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
4
5
  export type UndoRedoPlugin = NextEditorPlugin<'undoRedoPlugin', {
5
- dependencies: [TypeAheadPlugin, HistoryPlugin];
6
+ dependencies: [
7
+ TypeAheadPlugin,
8
+ HistoryPlugin,
9
+ OptionalPlugin<PrimaryToolbarPlugin>
10
+ ];
6
11
  }>;
@@ -1,9 +1,11 @@
1
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
1
+ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
2
  import type { HistoryPlugin } from '@atlaskit/editor-plugin-history';
3
+ import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
3
4
  import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
4
5
  export type UndoRedoPlugin = NextEditorPlugin<'undoRedoPlugin', {
5
6
  dependencies: [
6
7
  TypeAheadPlugin,
7
- HistoryPlugin
8
+ HistoryPlugin,
9
+ OptionalPlugin<PrimaryToolbarPlugin>
8
10
  ];
9
11
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-undo-redo",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "Undo redo plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,11 +32,12 @@
32
32
  ".": "./src/index.ts"
33
33
  },
34
34
  "dependencies": {
35
- "@atlaskit/editor-common": "^79.1.0",
35
+ "@atlaskit/editor-common": "^81.0.0",
36
36
  "@atlaskit/editor-plugin-history": "^1.1.0",
37
- "@atlaskit/editor-plugin-type-ahead": "^1.1.0",
37
+ "@atlaskit/editor-plugin-primary-toolbar": "^1.1.0",
38
+ "@atlaskit/editor-plugin-type-ahead": "^1.2.0",
38
39
  "@atlaskit/editor-prosemirror": "4.0.1",
39
- "@atlaskit/icon": "^22.1.0",
40
+ "@atlaskit/icon": "^22.3.0",
40
41
  "@babel/runtime": "^7.0.0",
41
42
  "@emotion/react": "^11.7.1"
42
43
  },