@atlaskit/editor-plugin-mentions 4.5.2 → 4.6.0
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 +8 -0
- package/dist/cjs/nodeviews/mention.js +15 -3
- package/dist/cjs/pm-plugins/main.js +1 -1
- package/dist/cjs/ui/SecondaryToolbarComponent.js +16 -3
- package/dist/es2019/nodeviews/mention.js +17 -4
- package/dist/es2019/pm-plugins/main.js +1 -1
- package/dist/es2019/ui/SecondaryToolbarComponent.js +18 -4
- package/dist/esm/nodeviews/mention.js +16 -4
- package/dist/esm/pm-plugins/main.js +1 -1
- package/dist/esm/ui/SecondaryToolbarComponent.js +17 -4
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-mentions
|
|
2
2
|
|
|
3
|
+
## 4.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#150809](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/150809)
|
|
8
|
+
[`1416994f2bdb2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1416994f2bdb2) -
|
|
9
|
+
Used plugin selector conditionally behind feature flag
|
|
10
|
+
|
|
3
11
|
## 4.5.2
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -8,7 +8,20 @@ exports.MentionNodeView = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
10
10
|
var _providerFactory = require("@atlaskit/editor-common/provider-factory");
|
|
11
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
11
12
|
var _Mention = require("../ui/Mention");
|
|
13
|
+
var useSharedMentionState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
14
|
+
var mentionProvider = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'mention.mentionProvider');
|
|
15
|
+
return {
|
|
16
|
+
mentionProvider: mentionProvider
|
|
17
|
+
};
|
|
18
|
+
}, function (api) {
|
|
19
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['mention']),
|
|
20
|
+
mentionState = _useSharedPluginState.mentionState;
|
|
21
|
+
return {
|
|
22
|
+
mentionProvider: mentionState === null || mentionState === void 0 ? void 0 : mentionState.mentionProvider
|
|
23
|
+
};
|
|
24
|
+
});
|
|
12
25
|
var MentionNodeView = exports.MentionNodeView = function MentionNodeView(props) {
|
|
13
26
|
var providerFactory = props.providerFactory,
|
|
14
27
|
pluginInjectionApi = props.pluginInjectionApi;
|
|
@@ -17,9 +30,8 @@ var MentionNodeView = exports.MentionNodeView = function MentionNodeView(props)
|
|
|
17
30
|
text = _props$node$attrs.text,
|
|
18
31
|
accessLevel = _props$node$attrs.accessLevel,
|
|
19
32
|
localId = _props$node$attrs.localId;
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
var mentionProvider = mentionState === null || mentionState === void 0 ? void 0 : mentionState.mentionProvider;
|
|
33
|
+
var _useSharedMentionStat = useSharedMentionState(pluginInjectionApi),
|
|
34
|
+
mentionProvider = _useSharedMentionStat.mentionProvider;
|
|
23
35
|
var renderAssistiveTextWithProviders = function renderAssistiveTextWithProviders(providers) {
|
|
24
36
|
var _props$options;
|
|
25
37
|
var mentionProviderPromise = mentionProvider ? Promise.resolve(mentionProvider) : providers.mentionProvider;
|
|
@@ -26,7 +26,7 @@ var ACTIONS = exports.ACTIONS = {
|
|
|
26
26
|
SET_PROVIDER: 'SET_PROVIDER'
|
|
27
27
|
};
|
|
28
28
|
var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
|
|
29
|
-
var PACKAGE_VERSION = "4.
|
|
29
|
+
var PACKAGE_VERSION = "4.6.0";
|
|
30
30
|
var setProvider = function setProvider(provider) {
|
|
31
31
|
return function (state, dispatch) {
|
|
32
32
|
if (dispatch) {
|
|
@@ -9,17 +9,30 @@ exports.SecondaryToolbarComponent = SecondaryToolbarComponent;
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
11
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
12
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
12
13
|
var _ToolbarMention = _interopRequireDefault(require("./ToolbarMention"));
|
|
13
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
14
15
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
var useSharedMentionState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
17
|
+
var mentionProvider = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'mention.mentionProvider');
|
|
18
|
+
return {
|
|
19
|
+
mentionProvider: mentionProvider
|
|
20
|
+
};
|
|
21
|
+
}, function (api) {
|
|
22
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['mention']),
|
|
23
|
+
mentionState = _useSharedPluginState.mentionState;
|
|
24
|
+
return {
|
|
25
|
+
mentionProvider: mentionState === null || mentionState === void 0 ? void 0 : mentionState.mentionProvider
|
|
26
|
+
};
|
|
27
|
+
});
|
|
15
28
|
function SecondaryToolbarComponent(_ref) {
|
|
16
29
|
var _api$typeAhead2;
|
|
17
30
|
var editorView = _ref.editorView,
|
|
18
31
|
api = _ref.api,
|
|
19
32
|
typeAhead = _ref.typeAhead,
|
|
20
33
|
disabled = _ref.disabled;
|
|
21
|
-
var
|
|
22
|
-
|
|
34
|
+
var _useSharedMentionStat = useSharedMentionState(api),
|
|
35
|
+
mentionProvider = _useSharedMentionStat.mentionProvider;
|
|
23
36
|
var openMentionTypeAhead = (0, _react.useCallback)(function () {
|
|
24
37
|
var _api$typeAhead;
|
|
25
38
|
api === null || api === void 0 || (_api$typeAhead = api.typeAhead) === null || _api$typeAhead === void 0 || (_api$typeAhead = _api$typeAhead.actions) === null || _api$typeAhead === void 0 || _api$typeAhead.open({
|
|
@@ -27,7 +40,7 @@ function SecondaryToolbarComponent(_ref) {
|
|
|
27
40
|
inputMethod: _analytics.INPUT_METHOD.INSERT_MENU
|
|
28
41
|
});
|
|
29
42
|
}, [api, typeAhead]);
|
|
30
|
-
return !
|
|
43
|
+
return !mentionProvider ? null : /*#__PURE__*/_react.default.createElement(_ToolbarMention.default, {
|
|
31
44
|
editorView: editorView,
|
|
32
45
|
onInsertMention: openMentionTypeAhead,
|
|
33
46
|
isDisabled: disabled || (api === null || api === void 0 || (_api$typeAhead2 = api.typeAhead) === null || _api$typeAhead2 === void 0 ? void 0 : _api$typeAhead2.actions.isAllowed(editorView.state))
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
2
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
3
3
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
4
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
4
5
|
import { Mention } from '../ui/Mention';
|
|
6
|
+
const useSharedMentionState = sharedPluginStateHookMigratorFactory(api => {
|
|
7
|
+
const mentionProvider = useSharedPluginStateSelector(api, 'mention.mentionProvider');
|
|
8
|
+
return {
|
|
9
|
+
mentionProvider
|
|
10
|
+
};
|
|
11
|
+
}, api => {
|
|
12
|
+
const {
|
|
13
|
+
mentionState
|
|
14
|
+
} = useSharedPluginState(api, ['mention']);
|
|
15
|
+
return {
|
|
16
|
+
mentionProvider: mentionState === null || mentionState === void 0 ? void 0 : mentionState.mentionProvider
|
|
17
|
+
};
|
|
18
|
+
});
|
|
5
19
|
export const MentionNodeView = props => {
|
|
6
20
|
const {
|
|
7
21
|
providerFactory,
|
|
@@ -14,9 +28,8 @@ export const MentionNodeView = props => {
|
|
|
14
28
|
localId
|
|
15
29
|
} = props.node.attrs;
|
|
16
30
|
const {
|
|
17
|
-
|
|
18
|
-
} =
|
|
19
|
-
const mentionProvider = mentionState === null || mentionState === void 0 ? void 0 : mentionState.mentionProvider;
|
|
31
|
+
mentionProvider
|
|
32
|
+
} = useSharedMentionState(pluginInjectionApi);
|
|
20
33
|
const renderAssistiveTextWithProviders = providers => {
|
|
21
34
|
var _props$options;
|
|
22
35
|
const mentionProviderPromise = mentionProvider ? Promise.resolve(mentionProvider) : providers.mentionProvider;
|
|
@@ -15,7 +15,7 @@ export const ACTIONS = {
|
|
|
15
15
|
SET_PROVIDER: 'SET_PROVIDER'
|
|
16
16
|
};
|
|
17
17
|
const PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
|
|
18
|
-
const PACKAGE_VERSION = "4.
|
|
18
|
+
const PACKAGE_VERSION = "4.6.0";
|
|
19
19
|
const setProvider = provider => (state, dispatch) => {
|
|
20
20
|
if (dispatch) {
|
|
21
21
|
dispatch(state.tr.setMeta(mentionPluginKey, {
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
4
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
4
5
|
import ToolbarMention from './ToolbarMention';
|
|
6
|
+
const useSharedMentionState = sharedPluginStateHookMigratorFactory(api => {
|
|
7
|
+
const mentionProvider = useSharedPluginStateSelector(api, 'mention.mentionProvider');
|
|
8
|
+
return {
|
|
9
|
+
mentionProvider
|
|
10
|
+
};
|
|
11
|
+
}, api => {
|
|
12
|
+
const {
|
|
13
|
+
mentionState
|
|
14
|
+
} = useSharedPluginState(api, ['mention']);
|
|
15
|
+
return {
|
|
16
|
+
mentionProvider: mentionState === null || mentionState === void 0 ? void 0 : mentionState.mentionProvider
|
|
17
|
+
};
|
|
18
|
+
});
|
|
5
19
|
export function SecondaryToolbarComponent({
|
|
6
20
|
editorView,
|
|
7
21
|
api,
|
|
@@ -10,8 +24,8 @@ export function SecondaryToolbarComponent({
|
|
|
10
24
|
}) {
|
|
11
25
|
var _api$typeAhead2;
|
|
12
26
|
const {
|
|
13
|
-
|
|
14
|
-
} =
|
|
27
|
+
mentionProvider
|
|
28
|
+
} = useSharedMentionState(api);
|
|
15
29
|
const openMentionTypeAhead = useCallback(() => {
|
|
16
30
|
var _api$typeAhead, _api$typeAhead$action;
|
|
17
31
|
api === null || api === void 0 ? void 0 : (_api$typeAhead = api.typeAhead) === null || _api$typeAhead === void 0 ? void 0 : (_api$typeAhead$action = _api$typeAhead.actions) === null || _api$typeAhead$action === void 0 ? void 0 : _api$typeAhead$action.open({
|
|
@@ -19,7 +33,7 @@ export function SecondaryToolbarComponent({
|
|
|
19
33
|
inputMethod: INPUT_METHOD.INSERT_MENU
|
|
20
34
|
});
|
|
21
35
|
}, [api, typeAhead]);
|
|
22
|
-
return !
|
|
36
|
+
return !mentionProvider ? null : /*#__PURE__*/React.createElement(ToolbarMention, {
|
|
23
37
|
editorView: editorView,
|
|
24
38
|
onInsertMention: openMentionTypeAhead,
|
|
25
39
|
isDisabled: disabled || (api === null || api === void 0 ? void 0 : (_api$typeAhead2 = api.typeAhead) === null || _api$typeAhead2 === void 0 ? void 0 : _api$typeAhead2.actions.isAllowed(editorView.state))
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
2
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
3
3
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
4
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
4
5
|
import { Mention } from '../ui/Mention';
|
|
6
|
+
var useSharedMentionState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
7
|
+
var mentionProvider = useSharedPluginStateSelector(api, 'mention.mentionProvider');
|
|
8
|
+
return {
|
|
9
|
+
mentionProvider: mentionProvider
|
|
10
|
+
};
|
|
11
|
+
}, function (api) {
|
|
12
|
+
var _useSharedPluginState = useSharedPluginState(api, ['mention']),
|
|
13
|
+
mentionState = _useSharedPluginState.mentionState;
|
|
14
|
+
return {
|
|
15
|
+
mentionProvider: mentionState === null || mentionState === void 0 ? void 0 : mentionState.mentionProvider
|
|
16
|
+
};
|
|
17
|
+
});
|
|
5
18
|
export var MentionNodeView = function MentionNodeView(props) {
|
|
6
19
|
var providerFactory = props.providerFactory,
|
|
7
20
|
pluginInjectionApi = props.pluginInjectionApi;
|
|
@@ -10,9 +23,8 @@ export var MentionNodeView = function MentionNodeView(props) {
|
|
|
10
23
|
text = _props$node$attrs.text,
|
|
11
24
|
accessLevel = _props$node$attrs.accessLevel,
|
|
12
25
|
localId = _props$node$attrs.localId;
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
var mentionProvider = mentionState === null || mentionState === void 0 ? void 0 : mentionState.mentionProvider;
|
|
26
|
+
var _useSharedMentionStat = useSharedMentionState(pluginInjectionApi),
|
|
27
|
+
mentionProvider = _useSharedMentionStat.mentionProvider;
|
|
16
28
|
var renderAssistiveTextWithProviders = function renderAssistiveTextWithProviders(providers) {
|
|
17
29
|
var _props$options;
|
|
18
30
|
var mentionProviderPromise = mentionProvider ? Promise.resolve(mentionProvider) : providers.mentionProvider;
|
|
@@ -18,7 +18,7 @@ export var ACTIONS = {
|
|
|
18
18
|
SET_PROVIDER: 'SET_PROVIDER'
|
|
19
19
|
};
|
|
20
20
|
var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
|
|
21
|
-
var PACKAGE_VERSION = "4.
|
|
21
|
+
var PACKAGE_VERSION = "4.6.0";
|
|
22
22
|
var setProvider = function setProvider(provider) {
|
|
23
23
|
return function (state, dispatch) {
|
|
24
24
|
if (dispatch) {
|
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
4
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
4
5
|
import ToolbarMention from './ToolbarMention';
|
|
6
|
+
var useSharedMentionState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
7
|
+
var mentionProvider = useSharedPluginStateSelector(api, 'mention.mentionProvider');
|
|
8
|
+
return {
|
|
9
|
+
mentionProvider: mentionProvider
|
|
10
|
+
};
|
|
11
|
+
}, function (api) {
|
|
12
|
+
var _useSharedPluginState = useSharedPluginState(api, ['mention']),
|
|
13
|
+
mentionState = _useSharedPluginState.mentionState;
|
|
14
|
+
return {
|
|
15
|
+
mentionProvider: mentionState === null || mentionState === void 0 ? void 0 : mentionState.mentionProvider
|
|
16
|
+
};
|
|
17
|
+
});
|
|
5
18
|
export function SecondaryToolbarComponent(_ref) {
|
|
6
19
|
var _api$typeAhead2;
|
|
7
20
|
var editorView = _ref.editorView,
|
|
8
21
|
api = _ref.api,
|
|
9
22
|
typeAhead = _ref.typeAhead,
|
|
10
23
|
disabled = _ref.disabled;
|
|
11
|
-
var
|
|
12
|
-
|
|
24
|
+
var _useSharedMentionStat = useSharedMentionState(api),
|
|
25
|
+
mentionProvider = _useSharedMentionStat.mentionProvider;
|
|
13
26
|
var openMentionTypeAhead = useCallback(function () {
|
|
14
27
|
var _api$typeAhead;
|
|
15
28
|
api === null || api === void 0 || (_api$typeAhead = api.typeAhead) === null || _api$typeAhead === void 0 || (_api$typeAhead = _api$typeAhead.actions) === null || _api$typeAhead === void 0 || _api$typeAhead.open({
|
|
@@ -17,7 +30,7 @@ export function SecondaryToolbarComponent(_ref) {
|
|
|
17
30
|
inputMethod: INPUT_METHOD.INSERT_MENU
|
|
18
31
|
});
|
|
19
32
|
}, [api, typeAhead]);
|
|
20
|
-
return !
|
|
33
|
+
return !mentionProvider ? null : /*#__PURE__*/React.createElement(ToolbarMention, {
|
|
21
34
|
editorView: editorView,
|
|
22
35
|
onInsertMention: openMentionTypeAhead,
|
|
23
36
|
isDisabled: disabled || (api === null || api === void 0 || (_api$typeAhead2 = api.typeAhead) === null || _api$typeAhead2 === void 0 ? void 0 : _api$typeAhead2.actions.isAllowed(editorView.state))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-mentions",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.6.0",
|
|
4
4
|
"description": "Mentions plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
48
48
|
"@atlaskit/popper": "^7.0.0",
|
|
49
49
|
"@atlaskit/portal": "^5.1.0",
|
|
50
|
-
"@atlaskit/profilecard": "^23.
|
|
50
|
+
"@atlaskit/profilecard": "^23.11.0",
|
|
51
51
|
"@atlaskit/theme": "^18.0.0",
|
|
52
52
|
"@atlaskit/tmp-editor-statsig": "^4.19.0",
|
|
53
53
|
"@atlaskit/tokens": "^4.8.0",
|