@atlaskit/editor-plugin-paste-options-toolbar 3.1.3 → 3.1.4

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,13 @@
1
1
  # @atlaskit/editor-plugin-paste-options-toolbar
2
2
 
3
+ ## 3.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`8497783928a16`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8497783928a16) -
8
+ ED-29110: clean up sharedPluginStateHookMigratorFactory in media, mentions and paste options
9
+ - Updated dependencies
10
+
3
11
  ## 3.1.3
4
12
 
5
13
  ### Patch Changes
@@ -10,24 +10,6 @@ var _commands = require("./editor-commands/commands");
10
10
  var _main = require("./pm-plugins/main");
11
11
  var _types = require("./types/types");
12
12
  var _toolbar = require("./ui/toolbar");
13
- var useSharedPasteState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
14
- var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['paste'], function (states) {
15
- var _states$pasteState;
16
- return {
17
- lastContentPasted: (_states$pasteState = states.pasteState) === null || _states$pasteState === void 0 ? void 0 : _states$pasteState.lastContentPasted
18
- };
19
- }),
20
- lastContentPasted = _useSharedPluginState.lastContentPasted;
21
- return {
22
- lastContentPasted: lastContentPasted
23
- };
24
- }, function (api) {
25
- var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['paste']),
26
- pasteState = _useSharedPluginState2.pasteState;
27
- return {
28
- lastContentPasted: pasteState === null || pasteState === void 0 ? void 0 : pasteState.lastContentPasted
29
- };
30
- });
31
13
  var pasteOptionsToolbarPlugin = exports.pasteOptionsToolbarPlugin = function pasteOptionsToolbarPlugin(_ref) {
32
14
  var _api$analytics;
33
15
  var config = _ref.config,
@@ -55,8 +37,13 @@ var pasteOptionsToolbarPlugin = exports.pasteOptionsToolbarPlugin = function pas
55
37
  },
56
38
  usePluginHook: function usePluginHook(_ref3) {
57
39
  var editorView = _ref3.editorView;
58
- var _useSharedPasteState = useSharedPasteState(api),
59
- lastContentPasted = _useSharedPasteState.lastContentPasted;
40
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['paste'], function (states) {
41
+ var _states$pasteState;
42
+ return {
43
+ lastContentPasted: (_states$pasteState = states.pasteState) === null || _states$pasteState === void 0 ? void 0 : _states$pasteState.lastContentPasted
44
+ };
45
+ }),
46
+ lastContentPasted = _useSharedPluginState.lastContentPasted;
60
47
  (0, _react.useEffect)(function () {
61
48
  if (!lastContentPasted) {
62
49
  (0, _commands.hideToolbar)()(editorView.state, editorView.dispatch);
@@ -1,29 +1,9 @@
1
1
  import { useEffect } from 'react';
2
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
2
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
3
  import { hideToolbar, showToolbar } from './editor-commands/commands';
4
4
  import { createPlugin } from './pm-plugins/main';
5
5
  import { pasteOptionsPluginKey, ToolbarDropdownOption } from './types/types';
6
6
  import { buildToolbar, isToolbarVisible } from './ui/toolbar';
7
- const useSharedPasteState = sharedPluginStateHookMigratorFactory(api => {
8
- const {
9
- lastContentPasted
10
- } = useSharedPluginStateWithSelector(api, ['paste'], states => {
11
- var _states$pasteState;
12
- return {
13
- lastContentPasted: (_states$pasteState = states.pasteState) === null || _states$pasteState === void 0 ? void 0 : _states$pasteState.lastContentPasted
14
- };
15
- });
16
- return {
17
- lastContentPasted
18
- };
19
- }, api => {
20
- const {
21
- pasteState
22
- } = useSharedPluginState(api, ['paste']);
23
- return {
24
- lastContentPasted: pasteState === null || pasteState === void 0 ? void 0 : pasteState.lastContentPasted
25
- };
26
- });
27
7
  export const pasteOptionsToolbarPlugin = ({
28
8
  config,
29
9
  api
@@ -54,7 +34,12 @@ export const pasteOptionsToolbarPlugin = ({
54
34
  }) {
55
35
  const {
56
36
  lastContentPasted
57
- } = useSharedPasteState(api);
37
+ } = useSharedPluginStateWithSelector(api, ['paste'], states => {
38
+ var _states$pasteState;
39
+ return {
40
+ lastContentPasted: (_states$pasteState = states.pasteState) === null || _states$pasteState === void 0 ? void 0 : _states$pasteState.lastContentPasted
41
+ };
42
+ });
58
43
  useEffect(() => {
59
44
  if (!lastContentPasted) {
60
45
  hideToolbar()(editorView.state, editorView.dispatch);
@@ -1,27 +1,9 @@
1
1
  import { useEffect } from 'react';
2
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
2
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
3
  import { hideToolbar, showToolbar } from './editor-commands/commands';
4
4
  import { createPlugin } from './pm-plugins/main';
5
5
  import { pasteOptionsPluginKey, ToolbarDropdownOption } from './types/types';
6
6
  import { buildToolbar, isToolbarVisible } from './ui/toolbar';
7
- var useSharedPasteState = sharedPluginStateHookMigratorFactory(function (api) {
8
- var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['paste'], function (states) {
9
- var _states$pasteState;
10
- return {
11
- lastContentPasted: (_states$pasteState = states.pasteState) === null || _states$pasteState === void 0 ? void 0 : _states$pasteState.lastContentPasted
12
- };
13
- }),
14
- lastContentPasted = _useSharedPluginState.lastContentPasted;
15
- return {
16
- lastContentPasted: lastContentPasted
17
- };
18
- }, function (api) {
19
- var _useSharedPluginState2 = useSharedPluginState(api, ['paste']),
20
- pasteState = _useSharedPluginState2.pasteState;
21
- return {
22
- lastContentPasted: pasteState === null || pasteState === void 0 ? void 0 : pasteState.lastContentPasted
23
- };
24
- });
25
7
  export var pasteOptionsToolbarPlugin = function pasteOptionsToolbarPlugin(_ref) {
26
8
  var _api$analytics;
27
9
  var config = _ref.config,
@@ -49,8 +31,13 @@ export var pasteOptionsToolbarPlugin = function pasteOptionsToolbarPlugin(_ref)
49
31
  },
50
32
  usePluginHook: function usePluginHook(_ref3) {
51
33
  var editorView = _ref3.editorView;
52
- var _useSharedPasteState = useSharedPasteState(api),
53
- lastContentPasted = _useSharedPasteState.lastContentPasted;
34
+ var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['paste'], function (states) {
35
+ var _states$pasteState;
36
+ return {
37
+ lastContentPasted: (_states$pasteState = states.pasteState) === null || _states$pasteState === void 0 ? void 0 : _states$pasteState.lastContentPasted
38
+ };
39
+ }),
40
+ lastContentPasted = _useSharedPluginState.lastContentPasted;
54
41
  useEffect(function () {
55
42
  if (!lastContentPasted) {
56
43
  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": "3.1.3",
3
+ "version": "3.1.4",
4
4
  "description": "Paste options toolbar for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -28,24 +28,20 @@
28
28
  "*.compiled.css"
29
29
  ],
30
30
  "atlaskit:src": "src/index.ts",
31
- "af:exports": {
32
- ".": "./src/index.ts",
33
- "./styles": "./src/ui/styles.ts"
34
- },
35
31
  "dependencies": {
36
32
  "@atlaskit/editor-markdown-transformer": "^5.16.0",
37
33
  "@atlaskit/editor-plugin-analytics": "^3.0.0",
38
34
  "@atlaskit/editor-plugin-paste": "^4.1.0",
39
35
  "@atlaskit/editor-prosemirror": "7.0.0",
40
36
  "@atlaskit/editor-shared-styles": "^3.6.0",
41
- "@atlaskit/icon": "^28.0.0",
42
- "@atlaskit/tokens": "^6.0.0",
37
+ "@atlaskit/icon": "^28.1.0",
38
+ "@atlaskit/tokens": "^6.1.0",
43
39
  "@babel/runtime": "^7.0.0",
44
40
  "@emotion/react": "^11.7.1",
45
41
  "react-intl-next": "npm:react-intl@^5.18.1"
46
42
  },
47
43
  "peerDependencies": {
48
- "@atlaskit/editor-common": "^107.28.0",
44
+ "@atlaskit/editor-common": "^107.33.0",
49
45
  "react": "^18.2.0",
50
46
  "react-dom": "^18.2.0"
51
47
  },