@atlaskit/editor-plugin-paste-options-toolbar 8.2.2 → 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 +10 -0
- package/dist/cjs/pasteOptionsToolbarPlugin.js +5 -1
- package/dist/cjs/ui/on-paste-actions-menu/PasteActionsMenuContent.js +3 -4
- package/dist/es2019/pasteOptionsToolbarPlugin.js +5 -1
- package/dist/es2019/ui/on-paste-actions-menu/PasteActionsMenuContent.js +3 -4
- package/dist/esm/pasteOptionsToolbarPlugin.js +5 -1
- package/dist/esm/ui/on-paste-actions-menu/PasteActionsMenuContent.js +3 -4
- package/dist/types/pasteOptionsToolbarPluginType.d.ts +2 -0
- package/dist/types-ts4.5/pasteOptionsToolbarPluginType.d.ts +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
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
|
+
|
|
3
13
|
## 8.2.2
|
|
4
14
|
|
|
5
15
|
### 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.
|
|
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.
|
|
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.
|
|
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;
|