@atlaskit/editor-plugin-hyperlink 4.4.2 → 4.4.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,20 @@
1
1
  # @atlaskit/editor-plugin-hyperlink
2
2
 
3
+ ## 4.4.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 4.4.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [#148126](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/148126)
14
+ [`2839a051cf613`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2839a051cf613) -
15
+ Migrate to useSharedPluginStateSelector for grid, guideline, help-dialog, highlight and hyperlink
16
+ plugins
17
+
3
18
  ## 4.4.2
4
19
 
5
20
  ### Patch Changes
@@ -17,6 +17,7 @@ var _hooks = require("@atlaskit/editor-common/hooks");
17
17
  var _link2 = require("@atlaskit/editor-common/link");
18
18
  var _messages = require("@atlaskit/editor-common/messages");
19
19
  var _ui = require("@atlaskit/editor-common/ui");
20
+ var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
20
21
  var _utils = require("@atlaskit/editor-common/utils");
21
22
  var _state = require("@atlaskit/editor-prosemirror/state");
22
23
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
@@ -63,6 +64,24 @@ function getLinkText(activeLinkMark, state) {
63
64
  }
64
65
  return activeLinkMark.node.text;
65
66
  }
67
+ var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
68
+ var timesViewed = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'hyperlink.timesViewed');
69
+ var inputMethod = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'hyperlink.inputMethod');
70
+ var searchSessionId = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'hyperlink.searchSessionId');
71
+ return {
72
+ timesViewed: timesViewed,
73
+ inputMethod: inputMethod,
74
+ searchSessionId: searchSessionId
75
+ };
76
+ }, function (api) {
77
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['hyperlink']),
78
+ hyperlinkState = _useSharedPluginState.hyperlinkState;
79
+ return {
80
+ timesViewed: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.timesViewed,
81
+ inputMethod: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.inputMethod,
82
+ searchSessionId: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.searchSessionId
83
+ };
84
+ });
66
85
  function HyperlinkAddToolbarWithState(_ref) {
67
86
  var _pluginInjectionApi$c;
68
87
  var _ref$linkPickerOption = _ref.linkPickerOptions,
@@ -79,8 +98,11 @@ function HyperlinkAddToolbarWithState(_ref) {
79
98
  onEscapeCallback = _ref.onEscapeCallback,
80
99
  onClickAwayCallback = _ref.onClickAwayCallback,
81
100
  pluginInjectionApi = _ref.pluginInjectionApi;
82
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['hyperlink']),
83
- hyperlinkState = _useSharedPluginState.hyperlinkState;
101
+ var _useSharedState = useSharedState(pluginInjectionApi),
102
+ timesViewed = _useSharedState.timesViewed,
103
+ inputMethod = _useSharedState.inputMethod,
104
+ searchSessionId = _useSharedState.searchSessionId;
105
+
84
106
  // This is constant rather than dynamic - because if someone's already got a hyperlink toolbar open,
85
107
  // we don't want to dynamically change it on them as this would cause data loss if they've already
86
108
  // started typing in the fields.
@@ -98,9 +120,9 @@ function HyperlinkAddToolbarWithState(_ref) {
98
120
  onClose: onClose,
99
121
  onEscapeCallback: onEscapeCallback,
100
122
  onClickAwayCallback: onClickAwayCallback,
101
- timesViewed: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.timesViewed,
102
- inputMethod: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.inputMethod,
103
- searchSessionId: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.searchSessionId,
123
+ timesViewed: timesViewed,
124
+ inputMethod: inputMethod,
125
+ searchSessionId: searchSessionId,
104
126
  isOffline: isOffline.current
105
127
  });
106
128
  }
@@ -2,10 +2,11 @@ import React, { useRef } from 'react';
2
2
  import { isSafeUrl } from '@atlaskit/adf-schema';
3
3
  import { ACTION, ACTION_SUBJECT_ID, INPUT_METHOD, buildVisitedLinkPayload } from '@atlaskit/editor-common/analytics';
4
4
  import { commandWithMetadata } from '@atlaskit/editor-common/card';
5
- import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
5
+ import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
6
6
  import { HyperlinkAddToolbar } from '@atlaskit/editor-common/link';
7
7
  import { linkMessages, linkToolbarMessages as linkToolbarCommonMessages } from '@atlaskit/editor-common/messages';
8
8
  import { LINKPICKER_HEIGHT_IN_PX, RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '@atlaskit/editor-common/ui';
9
+ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
9
10
  import { normalizeUrl } from '@atlaskit/editor-common/utils';
10
11
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
11
12
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
@@ -47,6 +48,25 @@ function getLinkText(activeLinkMark, state) {
47
48
  }
48
49
  return activeLinkMark.node.text;
49
50
  }
51
+ const useSharedState = sharedPluginStateHookMigratorFactory(api => {
52
+ const timesViewed = useSharedPluginStateSelector(api, 'hyperlink.timesViewed');
53
+ const inputMethod = useSharedPluginStateSelector(api, 'hyperlink.inputMethod');
54
+ const searchSessionId = useSharedPluginStateSelector(api, 'hyperlink.searchSessionId');
55
+ return {
56
+ timesViewed,
57
+ inputMethod,
58
+ searchSessionId
59
+ };
60
+ }, api => {
61
+ const {
62
+ hyperlinkState
63
+ } = useSharedPluginState(api, ['hyperlink']);
64
+ return {
65
+ timesViewed: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.timesViewed,
66
+ inputMethod: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.inputMethod,
67
+ searchSessionId: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.searchSessionId
68
+ };
69
+ });
50
70
  export function HyperlinkAddToolbarWithState({
51
71
  linkPickerOptions = {},
52
72
  onSubmit,
@@ -64,8 +84,11 @@ export function HyperlinkAddToolbarWithState({
64
84
  }) {
65
85
  var _pluginInjectionApi$c, _pluginInjectionApi$c2;
66
86
  const {
67
- hyperlinkState
68
- } = useSharedPluginState(pluginInjectionApi, ['hyperlink']);
87
+ timesViewed,
88
+ inputMethod,
89
+ searchSessionId
90
+ } = useSharedState(pluginInjectionApi);
91
+
69
92
  // This is constant rather than dynamic - because if someone's already got a hyperlink toolbar open,
70
93
  // we don't want to dynamically change it on them as this would cause data loss if they've already
71
94
  // started typing in the fields.
@@ -83,9 +106,9 @@ export function HyperlinkAddToolbarWithState({
83
106
  onClose: onClose,
84
107
  onEscapeCallback: onEscapeCallback,
85
108
  onClickAwayCallback: onClickAwayCallback,
86
- timesViewed: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.timesViewed,
87
- inputMethod: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.inputMethod,
88
- searchSessionId: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.searchSessionId,
109
+ timesViewed: timesViewed,
110
+ inputMethod: inputMethod,
111
+ searchSessionId: searchSessionId,
89
112
  isOffline: isOffline.current
90
113
  });
91
114
  }
@@ -6,10 +6,11 @@ import React, { useRef } from 'react';
6
6
  import { isSafeUrl } from '@atlaskit/adf-schema';
7
7
  import { ACTION, ACTION_SUBJECT_ID, INPUT_METHOD, buildVisitedLinkPayload } from '@atlaskit/editor-common/analytics';
8
8
  import { commandWithMetadata } from '@atlaskit/editor-common/card';
9
- import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
9
+ import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
10
10
  import { HyperlinkAddToolbar } from '@atlaskit/editor-common/link';
11
11
  import { linkMessages, linkToolbarMessages as linkToolbarCommonMessages } from '@atlaskit/editor-common/messages';
12
12
  import { LINKPICKER_HEIGHT_IN_PX, RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '@atlaskit/editor-common/ui';
13
+ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
13
14
  import { normalizeUrl } from '@atlaskit/editor-common/utils';
14
15
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
15
16
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
@@ -53,6 +54,24 @@ function getLinkText(activeLinkMark, state) {
53
54
  }
54
55
  return activeLinkMark.node.text;
55
56
  }
57
+ var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
58
+ var timesViewed = useSharedPluginStateSelector(api, 'hyperlink.timesViewed');
59
+ var inputMethod = useSharedPluginStateSelector(api, 'hyperlink.inputMethod');
60
+ var searchSessionId = useSharedPluginStateSelector(api, 'hyperlink.searchSessionId');
61
+ return {
62
+ timesViewed: timesViewed,
63
+ inputMethod: inputMethod,
64
+ searchSessionId: searchSessionId
65
+ };
66
+ }, function (api) {
67
+ var _useSharedPluginState = useSharedPluginState(api, ['hyperlink']),
68
+ hyperlinkState = _useSharedPluginState.hyperlinkState;
69
+ return {
70
+ timesViewed: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.timesViewed,
71
+ inputMethod: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.inputMethod,
72
+ searchSessionId: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.searchSessionId
73
+ };
74
+ });
56
75
  export function HyperlinkAddToolbarWithState(_ref) {
57
76
  var _pluginInjectionApi$c;
58
77
  var _ref$linkPickerOption = _ref.linkPickerOptions,
@@ -69,8 +88,11 @@ export function HyperlinkAddToolbarWithState(_ref) {
69
88
  onEscapeCallback = _ref.onEscapeCallback,
70
89
  onClickAwayCallback = _ref.onClickAwayCallback,
71
90
  pluginInjectionApi = _ref.pluginInjectionApi;
72
- var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['hyperlink']),
73
- hyperlinkState = _useSharedPluginState.hyperlinkState;
91
+ var _useSharedState = useSharedState(pluginInjectionApi),
92
+ timesViewed = _useSharedState.timesViewed,
93
+ inputMethod = _useSharedState.inputMethod,
94
+ searchSessionId = _useSharedState.searchSessionId;
95
+
74
96
  // This is constant rather than dynamic - because if someone's already got a hyperlink toolbar open,
75
97
  // we don't want to dynamically change it on them as this would cause data loss if they've already
76
98
  // started typing in the fields.
@@ -88,9 +110,9 @@ export function HyperlinkAddToolbarWithState(_ref) {
88
110
  onClose: onClose,
89
111
  onEscapeCallback: onEscapeCallback,
90
112
  onClickAwayCallback: onClickAwayCallback,
91
- timesViewed: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.timesViewed,
92
- inputMethod: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.inputMethod,
93
- searchSessionId: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.searchSessionId,
113
+ timesViewed: timesViewed,
114
+ inputMethod: inputMethod,
115
+ searchSessionId: searchSessionId,
94
116
  isOffline: isOffline.current
95
117
  });
96
118
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-hyperlink",
3
- "version": "4.4.2",
3
+ "version": "4.4.4",
4
4
  "description": "Hyperlink plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -43,10 +43,10 @@
43
43
  "@atlaskit/editor-plugin-primary-toolbar": "^3.2.0",
44
44
  "@atlaskit/editor-plugin-selection-toolbar": "^3.6.0",
45
45
  "@atlaskit/editor-prosemirror": "7.0.0",
46
- "@atlaskit/icon": "^25.7.0",
46
+ "@atlaskit/icon": "^26.0.0",
47
47
  "@atlaskit/platform-feature-flags": "^1.1.0",
48
48
  "@atlaskit/prosemirror-input-rules": "^3.3.0",
49
- "@atlaskit/tmp-editor-statsig": "^4.18.0",
49
+ "@atlaskit/tmp-editor-statsig": "^4.19.0",
50
50
  "@babel/runtime": "^7.0.0",
51
51
  "@emotion/react": "^11.7.1",
52
52
  "uuid": "^3.1.0"