@atlaskit/editor-plugin-hyperlink 5.0.1 → 5.0.2
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,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-hyperlink
|
|
2
2
|
|
|
3
|
+
## 5.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#182839](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/182839)
|
|
8
|
+
[`81f1c3383bdab`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/81f1c3383bdab) -
|
|
9
|
+
refactor: use useSharedPluginStateWithSelector instead of useSharedPluginStateSelector
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 5.0.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -17,7 +17,6 @@ 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");
|
|
21
20
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
22
21
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
23
22
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
@@ -64,15 +63,16 @@ function getLinkText(activeLinkMark, state) {
|
|
|
64
63
|
}
|
|
65
64
|
return activeLinkMark.node.text;
|
|
66
65
|
}
|
|
67
|
-
var
|
|
68
|
-
var
|
|
69
|
-
var inputMethod = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'hyperlink.inputMethod');
|
|
70
|
-
var searchSessionId = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'hyperlink.searchSessionId');
|
|
66
|
+
var selector = function selector(states) {
|
|
67
|
+
var _states$hyperlinkStat, _states$hyperlinkStat2, _states$hyperlinkStat3;
|
|
71
68
|
return {
|
|
72
|
-
timesViewed: timesViewed,
|
|
73
|
-
inputMethod: inputMethod,
|
|
74
|
-
searchSessionId: searchSessionId
|
|
69
|
+
timesViewed: (_states$hyperlinkStat = states.hyperlinkState) === null || _states$hyperlinkStat === void 0 ? void 0 : _states$hyperlinkStat.timesViewed,
|
|
70
|
+
inputMethod: (_states$hyperlinkStat2 = states.hyperlinkState) === null || _states$hyperlinkStat2 === void 0 ? void 0 : _states$hyperlinkStat2.inputMethod,
|
|
71
|
+
searchSessionId: (_states$hyperlinkStat3 = states.hyperlinkState) === null || _states$hyperlinkStat3 === void 0 ? void 0 : _states$hyperlinkStat3.searchSessionId
|
|
75
72
|
};
|
|
73
|
+
};
|
|
74
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
75
|
+
return (0, _hooks.useSharedPluginStateWithSelector)(api, ['hyperlink'], selector);
|
|
76
76
|
}, function (api) {
|
|
77
77
|
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['hyperlink']),
|
|
78
78
|
hyperlinkState = _useSharedPluginState.hyperlinkState;
|
|
@@ -2,11 +2,10 @@ 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, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
5
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } 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';
|
|
10
9
|
import { normalizeUrl } from '@atlaskit/editor-common/utils';
|
|
11
10
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
12
11
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -49,15 +48,16 @@ function getLinkText(activeLinkMark, state) {
|
|
|
49
48
|
}
|
|
50
49
|
return activeLinkMark.node.text;
|
|
51
50
|
}
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
const inputMethod = useSharedPluginStateSelector(api, 'hyperlink.inputMethod');
|
|
55
|
-
const searchSessionId = useSharedPluginStateSelector(api, 'hyperlink.searchSessionId');
|
|
51
|
+
const selector = states => {
|
|
52
|
+
var _states$hyperlinkStat, _states$hyperlinkStat2, _states$hyperlinkStat3;
|
|
56
53
|
return {
|
|
57
|
-
timesViewed,
|
|
58
|
-
inputMethod,
|
|
59
|
-
searchSessionId
|
|
54
|
+
timesViewed: (_states$hyperlinkStat = states.hyperlinkState) === null || _states$hyperlinkStat === void 0 ? void 0 : _states$hyperlinkStat.timesViewed,
|
|
55
|
+
inputMethod: (_states$hyperlinkStat2 = states.hyperlinkState) === null || _states$hyperlinkStat2 === void 0 ? void 0 : _states$hyperlinkStat2.inputMethod,
|
|
56
|
+
searchSessionId: (_states$hyperlinkStat3 = states.hyperlinkState) === null || _states$hyperlinkStat3 === void 0 ? void 0 : _states$hyperlinkStat3.searchSessionId
|
|
60
57
|
};
|
|
58
|
+
};
|
|
59
|
+
const useSharedState = sharedPluginStateHookMigratorFactory(api => {
|
|
60
|
+
return useSharedPluginStateWithSelector(api, ['hyperlink'], selector);
|
|
61
61
|
}, api => {
|
|
62
62
|
const {
|
|
63
63
|
hyperlinkState
|
|
@@ -6,11 +6,10 @@ 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, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
9
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } 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';
|
|
14
13
|
import { normalizeUrl } from '@atlaskit/editor-common/utils';
|
|
15
14
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
16
15
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -55,15 +54,16 @@ function getLinkText(activeLinkMark, state) {
|
|
|
55
54
|
}
|
|
56
55
|
return activeLinkMark.node.text;
|
|
57
56
|
}
|
|
58
|
-
var
|
|
59
|
-
var
|
|
60
|
-
var inputMethod = useSharedPluginStateSelector(api, 'hyperlink.inputMethod');
|
|
61
|
-
var searchSessionId = useSharedPluginStateSelector(api, 'hyperlink.searchSessionId');
|
|
57
|
+
var selector = function selector(states) {
|
|
58
|
+
var _states$hyperlinkStat, _states$hyperlinkStat2, _states$hyperlinkStat3;
|
|
62
59
|
return {
|
|
63
|
-
timesViewed: timesViewed,
|
|
64
|
-
inputMethod: inputMethod,
|
|
65
|
-
searchSessionId: searchSessionId
|
|
60
|
+
timesViewed: (_states$hyperlinkStat = states.hyperlinkState) === null || _states$hyperlinkStat === void 0 ? void 0 : _states$hyperlinkStat.timesViewed,
|
|
61
|
+
inputMethod: (_states$hyperlinkStat2 = states.hyperlinkState) === null || _states$hyperlinkStat2 === void 0 ? void 0 : _states$hyperlinkStat2.inputMethod,
|
|
62
|
+
searchSessionId: (_states$hyperlinkStat3 = states.hyperlinkState) === null || _states$hyperlinkStat3 === void 0 ? void 0 : _states$hyperlinkStat3.searchSessionId
|
|
66
63
|
};
|
|
64
|
+
};
|
|
65
|
+
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
66
|
+
return useSharedPluginStateWithSelector(api, ['hyperlink'], selector);
|
|
67
67
|
}, function (api) {
|
|
68
68
|
var _useSharedPluginState = useSharedPluginState(api, ['hyperlink']),
|
|
69
69
|
hyperlinkState = _useSharedPluginState.hyperlinkState;
|