@atlaskit/editor-plugin-paste-options-toolbar 8.2.1 → 8.2.3

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-paste-options-toolbar
2
2
 
3
+ ## 8.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`808af626ed714`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/808af626ed714) -
8
+ [ux] EDITOR-5468 Introduce new paste menu context to pass required information to paste action
9
+ buttons. Modified createOpenAIModalCommand to optionally accept start/end positions if we want to
10
+ modify non-selection content (eg. pasted content).
11
+ - Updated dependencies
12
+
13
+ ## 8.2.2
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+
3
19
  ## 8.2.1
4
20
 
5
21
  ### Patch Changes
@@ -23,10 +23,12 @@ var pasteOptionsToolbarPlugin = exports.pasteOptionsToolbarPlugin = function pas
23
23
  var api = _ref.api;
24
24
  var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
25
25
  var getSharedState = function getSharedState(editorState) {
26
- var _pluginState$isPlainT, _pluginState$plaintex, _pluginState$selected, _pluginState$showTool;
26
+ var _pluginState$isPlainT, _pluginState$pasteEnd, _pluginState$pasteSta, _pluginState$plaintex, _pluginState$selected, _pluginState$showTool;
27
27
  if (!editorState) {
28
28
  return {
29
29
  isPlainText: false,
30
+ pasteEndPos: 0,
31
+ pasteStartPos: 0,
30
32
  plaintextLength: 0,
31
33
  selectedOption: _types.ToolbarDropdownOption.None,
32
34
  showToolbar: false
@@ -35,6 +37,8 @@ var pasteOptionsToolbarPlugin = exports.pasteOptionsToolbarPlugin = function pas
35
37
  var pluginState = _types.pasteOptionsPluginKey.getState(editorState);
36
38
  return {
37
39
  isPlainText: (_pluginState$isPlainT = pluginState === null || pluginState === void 0 ? void 0 : pluginState.isPlainText) !== null && _pluginState$isPlainT !== void 0 ? _pluginState$isPlainT : false,
40
+ pasteEndPos: (_pluginState$pasteEnd = pluginState === null || pluginState === void 0 ? void 0 : pluginState.pasteEndPos) !== null && _pluginState$pasteEnd !== void 0 ? _pluginState$pasteEnd : 0,
41
+ pasteStartPos: (_pluginState$pasteSta = pluginState === null || pluginState === void 0 ? void 0 : pluginState.pasteStartPos) !== null && _pluginState$pasteSta !== void 0 ? _pluginState$pasteSta : 0,
38
42
  plaintextLength: (_pluginState$plaintex = pluginState === null || pluginState === void 0 ? void 0 : pluginState.plaintext.length) !== null && _pluginState$plaintex !== void 0 ? _pluginState$plaintex : 0,
39
43
  selectedOption: (_pluginState$selected = pluginState === null || pluginState === void 0 ? void 0 : pluginState.selectedOption) !== null && _pluginState$selected !== void 0 ? _pluginState$selected : _types.ToolbarDropdownOption.None,
40
44
  showToolbar: (_pluginState$showTool = pluginState === null || pluginState === void 0 ? void 0 : pluginState.showToolbar) !== null && _pluginState$showTool !== void 0 ? _pluginState$showTool : false
@@ -1,4 +1,4 @@
1
- /* PasteActionsMenuContent.tsx generated by @compiled/babel-plugin v0.38.1 */
1
+ /* PasteActionsMenuContent.tsx generated by @compiled/babel-plugin v0.39.1 */
2
2
  "use strict";
3
3
 
4
4
  var _typeof = require("@babel/runtime/helpers/typeof");
@@ -29,7 +29,8 @@ var PasteActionsMenuContent = exports.PasteActionsMenuContent = function PasteAc
29
29
  return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
30
30
  ref: setOutsideClickTargetRef,
31
31
  xcss: styles.container,
32
- onMouseDown: onMouseDown
32
+ onMouseDown: onMouseDown,
33
+ onMouseEnter: onMouseEnter
33
34
  }, aiSurface && aiSurfaceComponents && aiSurfaceComponents.length > 0 && /*#__PURE__*/_react.default.createElement(_editorUiControlModel.SurfaceRenderer, {
34
35
  surface: aiSurface,
35
36
  components: aiSurfaceComponents
@@ -37,8 +38,6 @@ var PasteActionsMenuContent = exports.PasteActionsMenuContent = function PasteAc
37
38
  return /*#__PURE__*/_react.default.createElement(_compiled.Pressable, {
38
39
  key: option.id,
39
40
  xcss: (0, _css.cx)(styles.option, option.selected && styles.selectedOption),
40
- onMouseEnter: onMouseEnter,
41
- onFocus: onMouseEnter,
42
41
  onClick: option.onClick
43
42
  }, option.label);
44
43
  }));
@@ -12,10 +12,12 @@ export const pasteOptionsToolbarPlugin = ({
12
12
  var _api$analytics;
13
13
  const editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
14
14
  const getSharedState = editorState => {
15
- var _pluginState$isPlainT, _pluginState$plaintex, _pluginState$selected, _pluginState$showTool;
15
+ var _pluginState$isPlainT, _pluginState$pasteEnd, _pluginState$pasteSta, _pluginState$plaintex, _pluginState$selected, _pluginState$showTool;
16
16
  if (!editorState) {
17
17
  return {
18
18
  isPlainText: false,
19
+ pasteEndPos: 0,
20
+ pasteStartPos: 0,
19
21
  plaintextLength: 0,
20
22
  selectedOption: ToolbarDropdownOption.None,
21
23
  showToolbar: false
@@ -24,6 +26,8 @@ export const pasteOptionsToolbarPlugin = ({
24
26
  const pluginState = pasteOptionsPluginKey.getState(editorState);
25
27
  return {
26
28
  isPlainText: (_pluginState$isPlainT = pluginState === null || pluginState === void 0 ? void 0 : pluginState.isPlainText) !== null && _pluginState$isPlainT !== void 0 ? _pluginState$isPlainT : false,
29
+ pasteEndPos: (_pluginState$pasteEnd = pluginState === null || pluginState === void 0 ? void 0 : pluginState.pasteEndPos) !== null && _pluginState$pasteEnd !== void 0 ? _pluginState$pasteEnd : 0,
30
+ pasteStartPos: (_pluginState$pasteSta = pluginState === null || pluginState === void 0 ? void 0 : pluginState.pasteStartPos) !== null && _pluginState$pasteSta !== void 0 ? _pluginState$pasteSta : 0,
27
31
  plaintextLength: (_pluginState$plaintex = pluginState === null || pluginState === void 0 ? void 0 : pluginState.plaintext.length) !== null && _pluginState$plaintex !== void 0 ? _pluginState$plaintex : 0,
28
32
  selectedOption: (_pluginState$selected = pluginState === null || pluginState === void 0 ? void 0 : pluginState.selectedOption) !== null && _pluginState$selected !== void 0 ? _pluginState$selected : ToolbarDropdownOption.None,
29
33
  showToolbar: (_pluginState$showTool = pluginState === null || pluginState === void 0 ? void 0 : pluginState.showToolbar) !== null && _pluginState$showTool !== void 0 ? _pluginState$showTool : false
@@ -1,4 +1,4 @@
1
- /* PasteActionsMenuContent.tsx generated by @compiled/babel-plugin v0.38.1 */
1
+ /* PasteActionsMenuContent.tsx generated by @compiled/babel-plugin v0.39.1 */
2
2
  import "./PasteActionsMenuContent.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React, { useContext } from 'react';
@@ -22,15 +22,14 @@ export const PasteActionsMenuContent = ({
22
22
  return /*#__PURE__*/React.createElement(Box, {
23
23
  ref: setOutsideClickTargetRef,
24
24
  xcss: styles.container,
25
- onMouseDown: onMouseDown
25
+ onMouseDown: onMouseDown,
26
+ onMouseEnter: onMouseEnter
26
27
  }, aiSurface && aiSurfaceComponents && aiSurfaceComponents.length > 0 && /*#__PURE__*/React.createElement(SurfaceRenderer, {
27
28
  surface: aiSurface,
28
29
  components: aiSurfaceComponents
29
30
  }), options.map(option => /*#__PURE__*/React.createElement(Pressable, {
30
31
  key: option.id,
31
32
  xcss: cx(styles.option, option.selected && styles.selectedOption),
32
- onMouseEnter: onMouseEnter,
33
- onFocus: onMouseEnter,
34
33
  onClick: option.onClick
35
34
  }, option.label)));
36
35
  };
@@ -14,10 +14,12 @@ export var pasteOptionsToolbarPlugin = function pasteOptionsToolbarPlugin(_ref)
14
14
  var api = _ref.api;
15
15
  var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
16
16
  var getSharedState = function getSharedState(editorState) {
17
- var _pluginState$isPlainT, _pluginState$plaintex, _pluginState$selected, _pluginState$showTool;
17
+ var _pluginState$isPlainT, _pluginState$pasteEnd, _pluginState$pasteSta, _pluginState$plaintex, _pluginState$selected, _pluginState$showTool;
18
18
  if (!editorState) {
19
19
  return {
20
20
  isPlainText: false,
21
+ pasteEndPos: 0,
22
+ pasteStartPos: 0,
21
23
  plaintextLength: 0,
22
24
  selectedOption: ToolbarDropdownOption.None,
23
25
  showToolbar: false
@@ -26,6 +28,8 @@ export var pasteOptionsToolbarPlugin = function pasteOptionsToolbarPlugin(_ref)
26
28
  var pluginState = pasteOptionsPluginKey.getState(editorState);
27
29
  return {
28
30
  isPlainText: (_pluginState$isPlainT = pluginState === null || pluginState === void 0 ? void 0 : pluginState.isPlainText) !== null && _pluginState$isPlainT !== void 0 ? _pluginState$isPlainT : false,
31
+ pasteEndPos: (_pluginState$pasteEnd = pluginState === null || pluginState === void 0 ? void 0 : pluginState.pasteEndPos) !== null && _pluginState$pasteEnd !== void 0 ? _pluginState$pasteEnd : 0,
32
+ pasteStartPos: (_pluginState$pasteSta = pluginState === null || pluginState === void 0 ? void 0 : pluginState.pasteStartPos) !== null && _pluginState$pasteSta !== void 0 ? _pluginState$pasteSta : 0,
29
33
  plaintextLength: (_pluginState$plaintex = pluginState === null || pluginState === void 0 ? void 0 : pluginState.plaintext.length) !== null && _pluginState$plaintex !== void 0 ? _pluginState$plaintex : 0,
30
34
  selectedOption: (_pluginState$selected = pluginState === null || pluginState === void 0 ? void 0 : pluginState.selectedOption) !== null && _pluginState$selected !== void 0 ? _pluginState$selected : ToolbarDropdownOption.None,
31
35
  showToolbar: (_pluginState$showTool = pluginState === null || pluginState === void 0 ? void 0 : pluginState.showToolbar) !== null && _pluginState$showTool !== void 0 ? _pluginState$showTool : false
@@ -1,4 +1,4 @@
1
- /* PasteActionsMenuContent.tsx generated by @compiled/babel-plugin v0.38.1 */
1
+ /* PasteActionsMenuContent.tsx generated by @compiled/babel-plugin v0.39.1 */
2
2
  import "./PasteActionsMenuContent.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React, { useContext } from 'react';
@@ -21,7 +21,8 @@ export var PasteActionsMenuContent = function PasteActionsMenuContent(_ref) {
21
21
  return /*#__PURE__*/React.createElement(Box, {
22
22
  ref: setOutsideClickTargetRef,
23
23
  xcss: styles.container,
24
- onMouseDown: onMouseDown
24
+ onMouseDown: onMouseDown,
25
+ onMouseEnter: onMouseEnter
25
26
  }, aiSurface && aiSurfaceComponents && aiSurfaceComponents.length > 0 && /*#__PURE__*/React.createElement(SurfaceRenderer, {
26
27
  surface: aiSurface,
27
28
  components: aiSurfaceComponents
@@ -29,8 +30,6 @@ export var PasteActionsMenuContent = function PasteActionsMenuContent(_ref) {
29
30
  return /*#__PURE__*/React.createElement(Pressable, {
30
31
  key: option.id,
31
32
  xcss: cx(styles.option, option.selected && styles.selectedOption),
32
- onMouseEnter: onMouseEnter,
33
- onFocus: onMouseEnter,
34
33
  onClick: option.onClick
35
34
  }, option.label);
36
35
  }));
@@ -10,6 +10,8 @@ export type PasteOptionsToolbarPluginDependencies = [
10
10
  ];
11
11
  export interface PasteOptionsToolbarSharedState {
12
12
  isPlainText: boolean;
13
+ pasteEndPos: number;
14
+ pasteStartPos: number;
13
15
  plaintextLength: number;
14
16
  selectedOption: ToolbarDropdownOption;
15
17
  showToolbar: boolean;
@@ -10,6 +10,8 @@ export type PasteOptionsToolbarPluginDependencies = [
10
10
  ];
11
11
  export interface PasteOptionsToolbarSharedState {
12
12
  isPlainText: boolean;
13
+ pasteEndPos: number;
14
+ pasteStartPos: number;
13
15
  plaintextLength: number;
14
16
  selectedOption: ToolbarDropdownOption;
15
17
  showToolbar: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste-options-toolbar",
3
- "version": "8.2.1",
3
+ "version": "8.2.3",
4
4
  "description": "Paste options toolbar for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -40,14 +40,14 @@
40
40
  "@atlaskit/icon": "^32.0.0",
41
41
  "@atlaskit/platform-feature-flags": "^1.1.0",
42
42
  "@atlaskit/primitives": "^18.0.0",
43
- "@atlaskit/tmp-editor-statsig": "^33.0.0",
43
+ "@atlaskit/tmp-editor-statsig": "^34.0.0",
44
44
  "@atlaskit/tokens": "^11.0.0",
45
45
  "@babel/runtime": "^7.0.0",
46
46
  "@emotion/react": "^11.7.1",
47
47
  "react-intl-next": "npm:react-intl@^5.18.1"
48
48
  },
49
49
  "peerDependencies": {
50
- "@atlaskit/editor-common": "^111.26.0",
50
+ "@atlaskit/editor-common": "^111.28.0",
51
51
  "react": "^18.2.0",
52
52
  "react-dom": "^18.2.0"
53
53
  },