@atlaskit/editor-plugin-find-replace 1.3.10 → 1.4.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,17 @@
1
1
  # @atlaskit/editor-plugin-find-replace
2
2
 
3
+ ## 1.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#120426](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/120426)
8
+ [`1cb3869ab1a96`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1cb3869ab1a96) -
9
+ [ED-23436] Use editor primary toolbar plugin to structure the primary toolbar
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 1.3.10
4
16
 
5
17
  ### Patch Changes
@@ -13,13 +13,37 @@ var _pluginKey = require("./pm-plugins/plugin-key");
13
13
  var findReplacePlugin = exports.findReplacePlugin = function findReplacePlugin(_ref) {
14
14
  var props = _ref.config,
15
15
  api = _ref.api;
16
+ var primaryToolbarComponent = function primaryToolbarComponent(_ref2) {
17
+ var popupsBoundariesElement = _ref2.popupsBoundariesElement,
18
+ popupsMountPoint = _ref2.popupsMountPoint,
19
+ popupsScrollableElement = _ref2.popupsScrollableElement,
20
+ isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing,
21
+ editorView = _ref2.editorView,
22
+ containerElement = _ref2.containerElement,
23
+ dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent;
24
+ if (props !== null && props !== void 0 && props.twoLineEditorToolbar) {
25
+ return null;
26
+ } else {
27
+ return /*#__PURE__*/_react.default.createElement(_FindReplaceToolbarButtonWithState.default, {
28
+ popupsBoundariesElement: popupsBoundariesElement,
29
+ popupsMountPoint: popupsMountPoint,
30
+ popupsScrollableElement: popupsScrollableElement,
31
+ isToolbarReducedSpacing: isToolbarReducedSpacing,
32
+ editorView: editorView,
33
+ containerElement: containerElement,
34
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
35
+ takeFullWidth: props === null || props === void 0 ? void 0 : props.takeFullWidth,
36
+ api: api
37
+ });
38
+ }
39
+ };
16
40
  return {
17
41
  name: 'findReplace',
18
42
  pmPlugins: function pmPlugins() {
19
43
  return [{
20
44
  name: 'findReplace',
21
- plugin: function plugin(_ref2) {
22
- var dispatch = _ref2.dispatch;
45
+ plugin: function plugin(_ref3) {
46
+ var dispatch = _ref3.dispatch;
23
47
  return (0, _main.createPlugin)(dispatch);
24
48
  }
25
49
  }, {
@@ -37,14 +61,14 @@ var findReplacePlugin = exports.findReplacePlugin = function findReplacePlugin(_
37
61
  return _pluginKey.findReplacePluginKey.getState(editorState) || undefined;
38
62
  },
39
63
  actions: {
40
- getToolbarButton: function getToolbarButton(_ref3) {
41
- var popupsBoundariesElement = _ref3.popupsBoundariesElement,
42
- popupsMountPoint = _ref3.popupsMountPoint,
43
- popupsScrollableElement = _ref3.popupsScrollableElement,
44
- editorView = _ref3.editorView,
45
- containerElement = _ref3.containerElement,
46
- dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent,
47
- isToolbarReducedSpacing = _ref3.isToolbarReducedSpacing;
64
+ getToolbarButton: function getToolbarButton(_ref4) {
65
+ var popupsBoundariesElement = _ref4.popupsBoundariesElement,
66
+ popupsMountPoint = _ref4.popupsMountPoint,
67
+ popupsScrollableElement = _ref4.popupsScrollableElement,
68
+ editorView = _ref4.editorView,
69
+ containerElement = _ref4.containerElement,
70
+ dispatchAnalyticsEvent = _ref4.dispatchAnalyticsEvent,
71
+ isToolbarReducedSpacing = _ref4.isToolbarReducedSpacing;
48
72
  return /*#__PURE__*/_react.default.createElement(_FindReplaceToolbarButtonWithState.default, {
49
73
  popupsBoundariesElement: popupsBoundariesElement,
50
74
  popupsMountPoint: popupsMountPoint,
@@ -57,29 +81,13 @@ var findReplacePlugin = exports.findReplacePlugin = function findReplacePlugin(_
57
81
  });
58
82
  }
59
83
  },
60
- primaryToolbarComponent: function primaryToolbarComponent(_ref4) {
61
- var popupsBoundariesElement = _ref4.popupsBoundariesElement,
62
- popupsMountPoint = _ref4.popupsMountPoint,
63
- popupsScrollableElement = _ref4.popupsScrollableElement,
64
- isToolbarReducedSpacing = _ref4.isToolbarReducedSpacing,
65
- editorView = _ref4.editorView,
66
- containerElement = _ref4.containerElement,
67
- dispatchAnalyticsEvent = _ref4.dispatchAnalyticsEvent;
68
- if (props !== null && props !== void 0 && props.twoLineEditorToolbar) {
69
- return null;
70
- } else {
71
- return /*#__PURE__*/_react.default.createElement(_FindReplaceToolbarButtonWithState.default, {
72
- popupsBoundariesElement: popupsBoundariesElement,
73
- popupsMountPoint: popupsMountPoint,
74
- popupsScrollableElement: popupsScrollableElement,
75
- isToolbarReducedSpacing: isToolbarReducedSpacing,
76
- editorView: editorView,
77
- containerElement: containerElement,
78
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
79
- takeFullWidth: props === null || props === void 0 ? void 0 : props.takeFullWidth,
80
- api: api
81
- });
82
- }
83
- }
84
+ usePluginHook: function usePluginHook() {
85
+ var _api$core, _api$primaryToolbar;
86
+ 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({
87
+ name: 'findReplace',
88
+ component: primaryToolbarComponent
89
+ }));
90
+ },
91
+ primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
84
92
  };
85
93
  };
@@ -7,6 +7,31 @@ export const findReplacePlugin = ({
7
7
  config: props,
8
8
  api
9
9
  }) => {
10
+ const primaryToolbarComponent = ({
11
+ popupsBoundariesElement,
12
+ popupsMountPoint,
13
+ popupsScrollableElement,
14
+ isToolbarReducedSpacing,
15
+ editorView,
16
+ containerElement,
17
+ dispatchAnalyticsEvent
18
+ }) => {
19
+ if (props !== null && props !== void 0 && props.twoLineEditorToolbar) {
20
+ return null;
21
+ } else {
22
+ return /*#__PURE__*/React.createElement(FindReplaceToolbarButtonWithState, {
23
+ popupsBoundariesElement: popupsBoundariesElement,
24
+ popupsMountPoint: popupsMountPoint,
25
+ popupsScrollableElement: popupsScrollableElement,
26
+ isToolbarReducedSpacing: isToolbarReducedSpacing,
27
+ editorView: editorView,
28
+ containerElement: containerElement,
29
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
30
+ takeFullWidth: props === null || props === void 0 ? void 0 : props.takeFullWidth,
31
+ api: api
32
+ });
33
+ }
34
+ };
10
35
  return {
11
36
  name: 'findReplace',
12
37
  pmPlugins() {
@@ -51,30 +76,13 @@ export const findReplacePlugin = ({
51
76
  });
52
77
  }
53
78
  },
54
- primaryToolbarComponent({
55
- popupsBoundariesElement,
56
- popupsMountPoint,
57
- popupsScrollableElement,
58
- isToolbarReducedSpacing,
59
- editorView,
60
- containerElement,
61
- dispatchAnalyticsEvent
62
- }) {
63
- if (props !== null && props !== void 0 && props.twoLineEditorToolbar) {
64
- return null;
65
- } else {
66
- return /*#__PURE__*/React.createElement(FindReplaceToolbarButtonWithState, {
67
- popupsBoundariesElement: popupsBoundariesElement,
68
- popupsMountPoint: popupsMountPoint,
69
- popupsScrollableElement: popupsScrollableElement,
70
- isToolbarReducedSpacing: isToolbarReducedSpacing,
71
- editorView: editorView,
72
- containerElement: containerElement,
73
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
74
- takeFullWidth: props === null || props === void 0 ? void 0 : props.takeFullWidth,
75
- api: api
76
- });
77
- }
78
- }
79
+ usePluginHook: () => {
80
+ var _api$core, _api$primaryToolbar;
81
+ 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({
82
+ name: 'findReplace',
83
+ component: primaryToolbarComponent
84
+ }));
85
+ },
86
+ primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
79
87
  };
80
88
  };
@@ -6,13 +6,37 @@ import { findReplacePluginKey } from './pm-plugins/plugin-key';
6
6
  export var findReplacePlugin = function findReplacePlugin(_ref) {
7
7
  var props = _ref.config,
8
8
  api = _ref.api;
9
+ var primaryToolbarComponent = function primaryToolbarComponent(_ref2) {
10
+ var popupsBoundariesElement = _ref2.popupsBoundariesElement,
11
+ popupsMountPoint = _ref2.popupsMountPoint,
12
+ popupsScrollableElement = _ref2.popupsScrollableElement,
13
+ isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing,
14
+ editorView = _ref2.editorView,
15
+ containerElement = _ref2.containerElement,
16
+ dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent;
17
+ if (props !== null && props !== void 0 && props.twoLineEditorToolbar) {
18
+ return null;
19
+ } else {
20
+ return /*#__PURE__*/React.createElement(FindReplaceToolbarButtonWithState, {
21
+ popupsBoundariesElement: popupsBoundariesElement,
22
+ popupsMountPoint: popupsMountPoint,
23
+ popupsScrollableElement: popupsScrollableElement,
24
+ isToolbarReducedSpacing: isToolbarReducedSpacing,
25
+ editorView: editorView,
26
+ containerElement: containerElement,
27
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
28
+ takeFullWidth: props === null || props === void 0 ? void 0 : props.takeFullWidth,
29
+ api: api
30
+ });
31
+ }
32
+ };
9
33
  return {
10
34
  name: 'findReplace',
11
35
  pmPlugins: function pmPlugins() {
12
36
  return [{
13
37
  name: 'findReplace',
14
- plugin: function plugin(_ref2) {
15
- var dispatch = _ref2.dispatch;
38
+ plugin: function plugin(_ref3) {
39
+ var dispatch = _ref3.dispatch;
16
40
  return createPlugin(dispatch);
17
41
  }
18
42
  }, {
@@ -30,14 +54,14 @@ export var findReplacePlugin = function findReplacePlugin(_ref) {
30
54
  return findReplacePluginKey.getState(editorState) || undefined;
31
55
  },
32
56
  actions: {
33
- getToolbarButton: function getToolbarButton(_ref3) {
34
- var popupsBoundariesElement = _ref3.popupsBoundariesElement,
35
- popupsMountPoint = _ref3.popupsMountPoint,
36
- popupsScrollableElement = _ref3.popupsScrollableElement,
37
- editorView = _ref3.editorView,
38
- containerElement = _ref3.containerElement,
39
- dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent,
40
- isToolbarReducedSpacing = _ref3.isToolbarReducedSpacing;
57
+ getToolbarButton: function getToolbarButton(_ref4) {
58
+ var popupsBoundariesElement = _ref4.popupsBoundariesElement,
59
+ popupsMountPoint = _ref4.popupsMountPoint,
60
+ popupsScrollableElement = _ref4.popupsScrollableElement,
61
+ editorView = _ref4.editorView,
62
+ containerElement = _ref4.containerElement,
63
+ dispatchAnalyticsEvent = _ref4.dispatchAnalyticsEvent,
64
+ isToolbarReducedSpacing = _ref4.isToolbarReducedSpacing;
41
65
  return /*#__PURE__*/React.createElement(FindReplaceToolbarButtonWithState, {
42
66
  popupsBoundariesElement: popupsBoundariesElement,
43
67
  popupsMountPoint: popupsMountPoint,
@@ -50,29 +74,13 @@ export var findReplacePlugin = function findReplacePlugin(_ref) {
50
74
  });
51
75
  }
52
76
  },
53
- primaryToolbarComponent: function primaryToolbarComponent(_ref4) {
54
- var popupsBoundariesElement = _ref4.popupsBoundariesElement,
55
- popupsMountPoint = _ref4.popupsMountPoint,
56
- popupsScrollableElement = _ref4.popupsScrollableElement,
57
- isToolbarReducedSpacing = _ref4.isToolbarReducedSpacing,
58
- editorView = _ref4.editorView,
59
- containerElement = _ref4.containerElement,
60
- dispatchAnalyticsEvent = _ref4.dispatchAnalyticsEvent;
61
- if (props !== null && props !== void 0 && props.twoLineEditorToolbar) {
62
- return null;
63
- } else {
64
- return /*#__PURE__*/React.createElement(FindReplaceToolbarButtonWithState, {
65
- popupsBoundariesElement: popupsBoundariesElement,
66
- popupsMountPoint: popupsMountPoint,
67
- popupsScrollableElement: popupsScrollableElement,
68
- isToolbarReducedSpacing: isToolbarReducedSpacing,
69
- editorView: editorView,
70
- containerElement: containerElement,
71
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
72
- takeFullWidth: props === null || props === void 0 ? void 0 : props.takeFullWidth,
73
- api: api
74
- });
75
- }
76
- }
77
+ usePluginHook: function usePluginHook() {
78
+ var _api$core, _api$primaryToolbar;
79
+ 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({
80
+ name: 'findReplace',
81
+ component: primaryToolbarComponent
82
+ }));
83
+ },
84
+ primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
77
85
  };
78
86
  };
@@ -2,6 +2,7 @@
2
2
  import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
3
3
  import type { ExtractInjectionAPI, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
4
4
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
5
+ import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
5
6
  import type { DecorationSet, EditorView } from '@atlaskit/editor-prosemirror/view';
6
7
  export interface FindReplacePluginState {
7
8
  /** Whether find/replace is active, i.e. displayed */
@@ -43,7 +44,7 @@ type Config = {
43
44
  export type FindReplacePlugin = NextEditorPlugin<'findReplace', {
44
45
  pluginConfiguration: Config;
45
46
  sharedState: FindReplacePluginState | undefined;
46
- dependencies: [OptionalPlugin<AnalyticsPlugin>];
47
+ dependencies: [OptionalPlugin<AnalyticsPlugin>, OptionalPlugin<PrimaryToolbarPlugin>];
47
48
  actions: {
48
49
  getToolbarButton: (params: FindReplaceToolbarButtonActionProps) => React.ReactNode;
49
50
  };
@@ -2,6 +2,7 @@
2
2
  import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
3
3
  import type { ExtractInjectionAPI, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
4
4
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
5
+ import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
5
6
  import type { DecorationSet, EditorView } from '@atlaskit/editor-prosemirror/view';
6
7
  export interface FindReplacePluginState {
7
8
  /** Whether find/replace is active, i.e. displayed */
@@ -44,7 +45,8 @@ export type FindReplacePlugin = NextEditorPlugin<'findReplace', {
44
45
  pluginConfiguration: Config;
45
46
  sharedState: FindReplacePluginState | undefined;
46
47
  dependencies: [
47
- OptionalPlugin<AnalyticsPlugin>
48
+ OptionalPlugin<AnalyticsPlugin>,
49
+ OptionalPlugin<PrimaryToolbarPlugin>
48
50
  ];
49
51
  actions: {
50
52
  getToolbarButton: (params: FindReplaceToolbarButtonActionProps) => React.ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-find-replace",
3
- "version": "1.3.10",
3
+ "version": "1.4.0",
4
4
  "description": "find replace plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,8 +35,9 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@atlaskit/button": "^18.4.0",
38
- "@atlaskit/editor-common": "^85.0.0",
38
+ "@atlaskit/editor-common": "^85.1.0",
39
39
  "@atlaskit/editor-plugin-analytics": "^1.4.0",
40
+ "@atlaskit/editor-plugin-primary-toolbar": "^1.2.0",
40
41
  "@atlaskit/editor-prosemirror": "4.0.1",
41
42
  "@atlaskit/editor-shared-styles": "^2.13.0",
42
43
  "@atlaskit/form": "^10.4.0",