@atlaskit/editor-plugin-paste-options-toolbar 2.0.7 → 2.1.1
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,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-paste-options-toolbar
|
|
2
2
|
|
|
3
|
+
## 2.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 2.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#150836](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/150836)
|
|
14
|
+
[`04b73eab35ce8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/04b73eab35ce8) -
|
|
15
|
+
Used plugin selector conditionally behind feature flag
|
|
16
|
+
|
|
3
17
|
## 2.0.7
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -6,10 +6,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.pasteOptionsToolbarPlugin = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
9
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
9
10
|
var _commands = require("./editor-commands/commands");
|
|
10
11
|
var _main = require("./pm-plugins/main");
|
|
11
12
|
var _types = require("./types/types");
|
|
12
13
|
var _toolbar = require("./ui/toolbar");
|
|
14
|
+
var useSharedPasteState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
15
|
+
var lastContentPasted = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'paste.lastContentPasted');
|
|
16
|
+
return {
|
|
17
|
+
lastContentPasted: lastContentPasted
|
|
18
|
+
};
|
|
19
|
+
}, function (api) {
|
|
20
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['paste']),
|
|
21
|
+
pasteState = _useSharedPluginState.pasteState;
|
|
22
|
+
return {
|
|
23
|
+
lastContentPasted: pasteState === null || pasteState === void 0 ? void 0 : pasteState.lastContentPasted
|
|
24
|
+
};
|
|
25
|
+
});
|
|
13
26
|
var pasteOptionsToolbarPlugin = exports.pasteOptionsToolbarPlugin = function pasteOptionsToolbarPlugin(_ref) {
|
|
14
27
|
var _api$analytics;
|
|
15
28
|
var config = _ref.config,
|
|
@@ -37,9 +50,8 @@ var pasteOptionsToolbarPlugin = exports.pasteOptionsToolbarPlugin = function pas
|
|
|
37
50
|
},
|
|
38
51
|
usePluginHook: function usePluginHook(_ref3) {
|
|
39
52
|
var editorView = _ref3.editorView;
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
var lastContentPasted = pasteState === null || pasteState === void 0 ? void 0 : pasteState.lastContentPasted;
|
|
53
|
+
var _useSharedPasteState = useSharedPasteState(api),
|
|
54
|
+
lastContentPasted = _useSharedPasteState.lastContentPasted;
|
|
43
55
|
(0, _react.useEffect)(function () {
|
|
44
56
|
if (!lastContentPasted) {
|
|
45
57
|
(0, _commands.hideToolbar)()(editorView.state, editorView.dispatch);
|
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
2
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
3
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
3
4
|
import { hideToolbar, showToolbar } from './editor-commands/commands';
|
|
4
5
|
import { createPlugin } from './pm-plugins/main';
|
|
5
6
|
import { pasteOptionsPluginKey, ToolbarDropdownOption } from './types/types';
|
|
6
7
|
import { buildToolbar, isToolbarVisible } from './ui/toolbar';
|
|
8
|
+
const useSharedPasteState = sharedPluginStateHookMigratorFactory(api => {
|
|
9
|
+
const lastContentPasted = useSharedPluginStateSelector(api, 'paste.lastContentPasted');
|
|
10
|
+
return {
|
|
11
|
+
lastContentPasted
|
|
12
|
+
};
|
|
13
|
+
}, api => {
|
|
14
|
+
const {
|
|
15
|
+
pasteState
|
|
16
|
+
} = useSharedPluginState(api, ['paste']);
|
|
17
|
+
return {
|
|
18
|
+
lastContentPasted: pasteState === null || pasteState === void 0 ? void 0 : pasteState.lastContentPasted
|
|
19
|
+
};
|
|
20
|
+
});
|
|
7
21
|
export const pasteOptionsToolbarPlugin = ({
|
|
8
22
|
config,
|
|
9
23
|
api
|
|
@@ -33,9 +47,8 @@ export const pasteOptionsToolbarPlugin = ({
|
|
|
33
47
|
editorView
|
|
34
48
|
}) {
|
|
35
49
|
const {
|
|
36
|
-
|
|
37
|
-
} =
|
|
38
|
-
const lastContentPasted = pasteState === null || pasteState === void 0 ? void 0 : pasteState.lastContentPasted;
|
|
50
|
+
lastContentPasted
|
|
51
|
+
} = useSharedPasteState(api);
|
|
39
52
|
useEffect(() => {
|
|
40
53
|
if (!lastContentPasted) {
|
|
41
54
|
hideToolbar()(editorView.state, editorView.dispatch);
|
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
2
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
3
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
3
4
|
import { hideToolbar, showToolbar } from './editor-commands/commands';
|
|
4
5
|
import { createPlugin } from './pm-plugins/main';
|
|
5
6
|
import { pasteOptionsPluginKey, ToolbarDropdownOption } from './types/types';
|
|
6
7
|
import { buildToolbar, isToolbarVisible } from './ui/toolbar';
|
|
8
|
+
var useSharedPasteState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
9
|
+
var lastContentPasted = useSharedPluginStateSelector(api, 'paste.lastContentPasted');
|
|
10
|
+
return {
|
|
11
|
+
lastContentPasted: lastContentPasted
|
|
12
|
+
};
|
|
13
|
+
}, function (api) {
|
|
14
|
+
var _useSharedPluginState = useSharedPluginState(api, ['paste']),
|
|
15
|
+
pasteState = _useSharedPluginState.pasteState;
|
|
16
|
+
return {
|
|
17
|
+
lastContentPasted: pasteState === null || pasteState === void 0 ? void 0 : pasteState.lastContentPasted
|
|
18
|
+
};
|
|
19
|
+
});
|
|
7
20
|
export var pasteOptionsToolbarPlugin = function pasteOptionsToolbarPlugin(_ref) {
|
|
8
21
|
var _api$analytics;
|
|
9
22
|
var config = _ref.config,
|
|
@@ -31,9 +44,8 @@ export var pasteOptionsToolbarPlugin = function pasteOptionsToolbarPlugin(_ref)
|
|
|
31
44
|
},
|
|
32
45
|
usePluginHook: function usePluginHook(_ref3) {
|
|
33
46
|
var editorView = _ref3.editorView;
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
var lastContentPasted = pasteState === null || pasteState === void 0 ? void 0 : pasteState.lastContentPasted;
|
|
47
|
+
var _useSharedPasteState = useSharedPasteState(api),
|
|
48
|
+
lastContentPasted = _useSharedPasteState.lastContentPasted;
|
|
37
49
|
useEffect(function () {
|
|
38
50
|
if (!lastContentPasted) {
|
|
39
51
|
hideToolbar()(editorView.state, editorView.dispatch);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-paste-options-toolbar",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Paste options toolbar for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"./styles": "./src/ui/styles.ts"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@atlaskit/editor-common": "^
|
|
37
|
+
"@atlaskit/editor-common": "^105.0.0",
|
|
38
38
|
"@atlaskit/editor-markdown-transformer": "^5.16.0",
|
|
39
39
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
40
40
|
"@atlaskit/editor-plugin-paste": "^3.3.0",
|