@atlaskit/editor-plugin-mentions 0.1.17 → 0.1.19
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 +12 -0
- package/dist/cjs/plugin.js +11 -27
- package/dist/cjs/ui/SecondaryToolbarComponent.js +35 -0
- package/dist/es2019/plugin.js +9 -23
- package/dist/es2019/ui/SecondaryToolbarComponent.js +27 -0
- package/dist/esm/plugin.js +11 -27
- package/dist/esm/ui/SecondaryToolbarComponent.js +25 -0
- package/dist/types/ui/SecondaryToolbarComponent.d.ts +12 -0
- package/dist/types-ts4.5/ui/SecondaryToolbarComponent.d.ts +12 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-mentions
|
|
2
2
|
|
|
3
|
+
## 0.1.19
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#67238](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/67238) [`40533849b2ec`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/40533849b2ec) - [ED-21835] Change EditorAPI type to always union with undefined
|
|
8
|
+
|
|
9
|
+
## 0.1.18
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#67189](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/67189) [`93cbf53ca0e0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/93cbf53ca0e0) - Removing instances of WithPluginState from mentions and type-ahead plugins.
|
|
14
|
+
|
|
3
15
|
## 0.1.17
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -12,12 +12,11 @@ var _adfSchema = require("@atlaskit/adf-schema");
|
|
|
12
12
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
13
13
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
14
14
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
15
|
-
var _withPluginState = require("@atlaskit/editor-common/with-plugin-state");
|
|
16
15
|
var _resource = require("@atlaskit/mention/resource");
|
|
17
16
|
var _key = require("./pm-plugins/key");
|
|
18
17
|
var _main = require("./pm-plugins/main");
|
|
19
18
|
var _typeAhead = require("./type-ahead");
|
|
20
|
-
var
|
|
19
|
+
var _SecondaryToolbarComponent = require("./ui/SecondaryToolbarComponent");
|
|
21
20
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
22
21
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
23
22
|
var mentionsPlugin = exports.mentionsPlugin = function mentionsPlugin(_ref) {
|
|
@@ -61,33 +60,17 @@ var mentionsPlugin = exports.mentionsPlugin = function mentionsPlugin(_ref) {
|
|
|
61
60
|
secondaryToolbarComponent: function secondaryToolbarComponent(_ref3) {
|
|
62
61
|
var editorView = _ref3.editorView,
|
|
63
62
|
disabled = _ref3.disabled;
|
|
64
|
-
|
|
65
|
-
var _api$typeAhead;
|
|
66
|
-
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({
|
|
67
|
-
triggerHandler: typeAhead,
|
|
68
|
-
inputMethod: _analytics.INPUT_METHOD.INSERT_MENU
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
return /*#__PURE__*/_react.default.createElement(_withPluginState.WithPluginState, {
|
|
63
|
+
return /*#__PURE__*/_react.default.createElement(_SecondaryToolbarComponent.SecondaryToolbarComponent, {
|
|
72
64
|
editorView: editorView,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
render: function render(_ref4) {
|
|
77
|
-
var _ref4$mentionState = _ref4.mentionState,
|
|
78
|
-
mentionState = _ref4$mentionState === void 0 ? {} : _ref4$mentionState;
|
|
79
|
-
return !mentionState.mentionProvider ? null : /*#__PURE__*/_react.default.createElement(_ToolbarMention.default, {
|
|
80
|
-
editorView: editorView,
|
|
81
|
-
onInsertMention: openMentionTypeAhead,
|
|
82
|
-
isDisabled: disabled || (api === null || api === void 0 ? void 0 : api.typeAhead.actions.isAllowed(editorView.state))
|
|
83
|
-
});
|
|
84
|
-
}
|
|
65
|
+
api: api,
|
|
66
|
+
disabled: disabled,
|
|
67
|
+
typeAhead: typeAhead
|
|
85
68
|
});
|
|
86
69
|
},
|
|
87
70
|
actions: {
|
|
88
71
|
openTypeAhead: function openTypeAhead(inputMethod) {
|
|
89
|
-
var _api$
|
|
90
|
-
return Boolean(api === null || api === void 0 || (_api$
|
|
72
|
+
var _api$typeAhead;
|
|
73
|
+
return Boolean(api === null || api === void 0 || (_api$typeAhead = api.typeAhead) === null || _api$typeAhead === void 0 || (_api$typeAhead = _api$typeAhead.actions) === null || _api$typeAhead === void 0 ? void 0 : _api$typeAhead.open({
|
|
91
74
|
triggerHandler: typeAhead,
|
|
92
75
|
inputMethod: inputMethod
|
|
93
76
|
}));
|
|
@@ -103,8 +86,8 @@ var mentionsPlugin = exports.mentionsPlugin = function mentionsPlugin(_ref) {
|
|
|
103
86
|
});
|
|
104
87
|
},
|
|
105
88
|
pluginsOptions: {
|
|
106
|
-
quickInsert: function quickInsert(
|
|
107
|
-
var formatMessage =
|
|
89
|
+
quickInsert: function quickInsert(_ref4) {
|
|
90
|
+
var formatMessage = _ref4.formatMessage;
|
|
108
91
|
return [{
|
|
109
92
|
id: 'mention',
|
|
110
93
|
title: formatMessage(_messages.toolbarInsertBlockMessages.mention),
|
|
@@ -116,12 +99,13 @@ var mentionsPlugin = exports.mentionsPlugin = function mentionsPlugin(_ref) {
|
|
|
116
99
|
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconMention, null);
|
|
117
100
|
},
|
|
118
101
|
action: function action(insert, state) {
|
|
102
|
+
var _api$typeAhead2;
|
|
119
103
|
var tr = insert(undefined);
|
|
120
104
|
var pluginState = _key.mentionPluginKey.getState(state);
|
|
121
105
|
if (pluginState && pluginState.canInsertMention === false) {
|
|
122
106
|
return false;
|
|
123
107
|
}
|
|
124
|
-
api === null || api === void 0 || api.typeAhead.actions.openAtTransaction({
|
|
108
|
+
api === null || api === void 0 || (_api$typeAhead2 = api.typeAhead) === null || _api$typeAhead2 === void 0 || _api$typeAhead2.actions.openAtTransaction({
|
|
125
109
|
triggerHandler: typeAhead,
|
|
126
110
|
inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
|
|
127
111
|
})(tr);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.SecondaryToolbarComponent = SecondaryToolbarComponent;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
12
|
+
var _ToolbarMention = _interopRequireDefault(require("./ToolbarMention"));
|
|
13
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
+
function SecondaryToolbarComponent(_ref) {
|
|
16
|
+
var _api$typeAhead2;
|
|
17
|
+
var editorView = _ref.editorView,
|
|
18
|
+
api = _ref.api,
|
|
19
|
+
typeAhead = _ref.typeAhead,
|
|
20
|
+
disabled = _ref.disabled;
|
|
21
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['mention']),
|
|
22
|
+
mentionState = _useSharedPluginState.mentionState;
|
|
23
|
+
var openMentionTypeAhead = (0, _react.useCallback)(function () {
|
|
24
|
+
var _api$typeAhead;
|
|
25
|
+
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({
|
|
26
|
+
triggerHandler: typeAhead,
|
|
27
|
+
inputMethod: _analytics.INPUT_METHOD.INSERT_MENU
|
|
28
|
+
});
|
|
29
|
+
}, [api, typeAhead]);
|
|
30
|
+
return !(mentionState !== null && mentionState !== void 0 && mentionState.mentionProvider) ? null : /*#__PURE__*/_react.default.createElement(_ToolbarMention.default, {
|
|
31
|
+
editorView: editorView,
|
|
32
|
+
onInsertMention: openMentionTypeAhead,
|
|
33
|
+
isDisabled: disabled || (api === null || api === void 0 || (_api$typeAhead2 = api.typeAhead) === null || _api$typeAhead2 === void 0 ? void 0 : _api$typeAhead2.actions.isAllowed(editorView.state))
|
|
34
|
+
});
|
|
35
|
+
}
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -4,12 +4,11 @@ import { mention } from '@atlaskit/adf-schema';
|
|
|
4
4
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { IconMention } from '@atlaskit/editor-common/quick-insert';
|
|
7
|
-
import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
|
|
8
7
|
import { ELEMENTS_CHANNEL } from '@atlaskit/mention/resource';
|
|
9
8
|
import { mentionPluginKey } from './pm-plugins/key';
|
|
10
9
|
import { createMentionPlugin } from './pm-plugins/main';
|
|
11
10
|
import { createTypeAheadConfig } from './type-ahead';
|
|
12
|
-
import
|
|
11
|
+
import { SecondaryToolbarComponent } from './ui/SecondaryToolbarComponent';
|
|
13
12
|
const mentionsPlugin = ({
|
|
14
13
|
config: options,
|
|
15
14
|
api
|
|
@@ -52,31 +51,17 @@ const mentionsPlugin = ({
|
|
|
52
51
|
editorView,
|
|
53
52
|
disabled
|
|
54
53
|
}) {
|
|
55
|
-
|
|
56
|
-
var _api$typeAhead, _api$typeAhead$action;
|
|
57
|
-
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({
|
|
58
|
-
triggerHandler: typeAhead,
|
|
59
|
-
inputMethod: INPUT_METHOD.INSERT_MENU
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
54
|
+
return /*#__PURE__*/React.createElement(SecondaryToolbarComponent, {
|
|
63
55
|
editorView: editorView,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
render: ({
|
|
68
|
-
mentionState = {}
|
|
69
|
-
}) => !mentionState.mentionProvider ? null : /*#__PURE__*/React.createElement(ToolbarMention, {
|
|
70
|
-
editorView: editorView,
|
|
71
|
-
onInsertMention: openMentionTypeAhead,
|
|
72
|
-
isDisabled: disabled || (api === null || api === void 0 ? void 0 : api.typeAhead.actions.isAllowed(editorView.state))
|
|
73
|
-
})
|
|
56
|
+
api: api,
|
|
57
|
+
disabled: disabled,
|
|
58
|
+
typeAhead: typeAhead
|
|
74
59
|
});
|
|
75
60
|
},
|
|
76
61
|
actions: {
|
|
77
62
|
openTypeAhead(inputMethod) {
|
|
78
|
-
var _api$
|
|
79
|
-
return Boolean(api === null || api === void 0 ? void 0 : (_api$
|
|
63
|
+
var _api$typeAhead, _api$typeAhead$action;
|
|
64
|
+
return Boolean(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({
|
|
80
65
|
triggerHandler: typeAhead,
|
|
81
66
|
inputMethod
|
|
82
67
|
}));
|
|
@@ -104,12 +89,13 @@ const mentionsPlugin = ({
|
|
|
104
89
|
keyshortcut: '@',
|
|
105
90
|
icon: () => /*#__PURE__*/React.createElement(IconMention, null),
|
|
106
91
|
action(insert, state) {
|
|
92
|
+
var _api$typeAhead2;
|
|
107
93
|
const tr = insert(undefined);
|
|
108
94
|
const pluginState = mentionPluginKey.getState(state);
|
|
109
95
|
if (pluginState && pluginState.canInsertMention === false) {
|
|
110
96
|
return false;
|
|
111
97
|
}
|
|
112
|
-
api === null || api === void 0 ? void 0 : api.typeAhead.actions.openAtTransaction({
|
|
98
|
+
api === null || api === void 0 ? void 0 : (_api$typeAhead2 = api.typeAhead) === null || _api$typeAhead2 === void 0 ? void 0 : _api$typeAhead2.actions.openAtTransaction({
|
|
113
99
|
triggerHandler: typeAhead,
|
|
114
100
|
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
115
101
|
})(tr);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
|
+
import ToolbarMention from './ToolbarMention';
|
|
5
|
+
export function SecondaryToolbarComponent({
|
|
6
|
+
editorView,
|
|
7
|
+
api,
|
|
8
|
+
typeAhead,
|
|
9
|
+
disabled
|
|
10
|
+
}) {
|
|
11
|
+
var _api$typeAhead2;
|
|
12
|
+
const {
|
|
13
|
+
mentionState
|
|
14
|
+
} = useSharedPluginState(api, ['mention']);
|
|
15
|
+
const openMentionTypeAhead = useCallback(() => {
|
|
16
|
+
var _api$typeAhead, _api$typeAhead$action;
|
|
17
|
+
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({
|
|
18
|
+
triggerHandler: typeAhead,
|
|
19
|
+
inputMethod: INPUT_METHOD.INSERT_MENU
|
|
20
|
+
});
|
|
21
|
+
}, [api, typeAhead]);
|
|
22
|
+
return !(mentionState !== null && mentionState !== void 0 && mentionState.mentionProvider) ? null : /*#__PURE__*/React.createElement(ToolbarMention, {
|
|
23
|
+
editorView: editorView,
|
|
24
|
+
onInsertMention: openMentionTypeAhead,
|
|
25
|
+
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))
|
|
26
|
+
});
|
|
27
|
+
}
|
package/dist/esm/plugin.js
CHANGED
|
@@ -7,12 +7,11 @@ import { mention } from '@atlaskit/adf-schema';
|
|
|
7
7
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
8
8
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
9
9
|
import { IconMention } from '@atlaskit/editor-common/quick-insert';
|
|
10
|
-
import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
|
|
11
10
|
import { ELEMENTS_CHANNEL } from '@atlaskit/mention/resource';
|
|
12
11
|
import { mentionPluginKey } from './pm-plugins/key';
|
|
13
12
|
import { createMentionPlugin } from './pm-plugins/main';
|
|
14
13
|
import { createTypeAheadConfig } from './type-ahead';
|
|
15
|
-
import
|
|
14
|
+
import { SecondaryToolbarComponent } from './ui/SecondaryToolbarComponent';
|
|
16
15
|
var mentionsPlugin = function mentionsPlugin(_ref) {
|
|
17
16
|
var options = _ref.config,
|
|
18
17
|
api = _ref.api;
|
|
@@ -54,33 +53,17 @@ var mentionsPlugin = function mentionsPlugin(_ref) {
|
|
|
54
53
|
secondaryToolbarComponent: function secondaryToolbarComponent(_ref3) {
|
|
55
54
|
var editorView = _ref3.editorView,
|
|
56
55
|
disabled = _ref3.disabled;
|
|
57
|
-
|
|
58
|
-
var _api$typeAhead;
|
|
59
|
-
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({
|
|
60
|
-
triggerHandler: typeAhead,
|
|
61
|
-
inputMethod: INPUT_METHOD.INSERT_MENU
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
56
|
+
return /*#__PURE__*/React.createElement(SecondaryToolbarComponent, {
|
|
65
57
|
editorView: editorView,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
render: function render(_ref4) {
|
|
70
|
-
var _ref4$mentionState = _ref4.mentionState,
|
|
71
|
-
mentionState = _ref4$mentionState === void 0 ? {} : _ref4$mentionState;
|
|
72
|
-
return !mentionState.mentionProvider ? null : /*#__PURE__*/React.createElement(ToolbarMention, {
|
|
73
|
-
editorView: editorView,
|
|
74
|
-
onInsertMention: openMentionTypeAhead,
|
|
75
|
-
isDisabled: disabled || (api === null || api === void 0 ? void 0 : api.typeAhead.actions.isAllowed(editorView.state))
|
|
76
|
-
});
|
|
77
|
-
}
|
|
58
|
+
api: api,
|
|
59
|
+
disabled: disabled,
|
|
60
|
+
typeAhead: typeAhead
|
|
78
61
|
});
|
|
79
62
|
},
|
|
80
63
|
actions: {
|
|
81
64
|
openTypeAhead: function openTypeAhead(inputMethod) {
|
|
82
|
-
var _api$
|
|
83
|
-
return Boolean(api === null || api === void 0 || (_api$
|
|
65
|
+
var _api$typeAhead;
|
|
66
|
+
return Boolean(api === null || api === void 0 || (_api$typeAhead = api.typeAhead) === null || _api$typeAhead === void 0 || (_api$typeAhead = _api$typeAhead.actions) === null || _api$typeAhead === void 0 ? void 0 : _api$typeAhead.open({
|
|
84
67
|
triggerHandler: typeAhead,
|
|
85
68
|
inputMethod: inputMethod
|
|
86
69
|
}));
|
|
@@ -96,8 +79,8 @@ var mentionsPlugin = function mentionsPlugin(_ref) {
|
|
|
96
79
|
});
|
|
97
80
|
},
|
|
98
81
|
pluginsOptions: {
|
|
99
|
-
quickInsert: function quickInsert(
|
|
100
|
-
var formatMessage =
|
|
82
|
+
quickInsert: function quickInsert(_ref4) {
|
|
83
|
+
var formatMessage = _ref4.formatMessage;
|
|
101
84
|
return [{
|
|
102
85
|
id: 'mention',
|
|
103
86
|
title: formatMessage(messages.mention),
|
|
@@ -109,12 +92,13 @@ var mentionsPlugin = function mentionsPlugin(_ref) {
|
|
|
109
92
|
return /*#__PURE__*/React.createElement(IconMention, null);
|
|
110
93
|
},
|
|
111
94
|
action: function action(insert, state) {
|
|
95
|
+
var _api$typeAhead2;
|
|
112
96
|
var tr = insert(undefined);
|
|
113
97
|
var pluginState = mentionPluginKey.getState(state);
|
|
114
98
|
if (pluginState && pluginState.canInsertMention === false) {
|
|
115
99
|
return false;
|
|
116
100
|
}
|
|
117
|
-
api === null || api === void 0 || api.typeAhead.actions.openAtTransaction({
|
|
101
|
+
api === null || api === void 0 || (_api$typeAhead2 = api.typeAhead) === null || _api$typeAhead2 === void 0 || _api$typeAhead2.actions.openAtTransaction({
|
|
118
102
|
triggerHandler: typeAhead,
|
|
119
103
|
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
120
104
|
})(tr);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
|
+
import ToolbarMention from './ToolbarMention';
|
|
5
|
+
export function SecondaryToolbarComponent(_ref) {
|
|
6
|
+
var _api$typeAhead2;
|
|
7
|
+
var editorView = _ref.editorView,
|
|
8
|
+
api = _ref.api,
|
|
9
|
+
typeAhead = _ref.typeAhead,
|
|
10
|
+
disabled = _ref.disabled;
|
|
11
|
+
var _useSharedPluginState = useSharedPluginState(api, ['mention']),
|
|
12
|
+
mentionState = _useSharedPluginState.mentionState;
|
|
13
|
+
var openMentionTypeAhead = useCallback(function () {
|
|
14
|
+
var _api$typeAhead;
|
|
15
|
+
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({
|
|
16
|
+
triggerHandler: typeAhead,
|
|
17
|
+
inputMethod: INPUT_METHOD.INSERT_MENU
|
|
18
|
+
});
|
|
19
|
+
}, [api, typeAhead]);
|
|
20
|
+
return !(mentionState !== null && mentionState !== void 0 && mentionState.mentionProvider) ? null : /*#__PURE__*/React.createElement(ToolbarMention, {
|
|
21
|
+
editorView: editorView,
|
|
22
|
+
onInsertMention: openMentionTypeAhead,
|
|
23
|
+
isDisabled: disabled || (api === null || api === void 0 || (_api$typeAhead2 = api.typeAhead) === null || _api$typeAhead2 === void 0 ? void 0 : _api$typeAhead2.actions.isAllowed(editorView.state))
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ExtractInjectionAPI, TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import type { MentionsPlugin } from '../types';
|
|
5
|
+
interface SecondaryToolbarComponentProps {
|
|
6
|
+
editorView: EditorView;
|
|
7
|
+
api: ExtractInjectionAPI<MentionsPlugin> | undefined;
|
|
8
|
+
typeAhead: TypeAheadHandler;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function SecondaryToolbarComponent({ editorView, api, typeAhead, disabled, }: SecondaryToolbarComponentProps): JSX.Element | null;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ExtractInjectionAPI, TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import type { MentionsPlugin } from '../types';
|
|
5
|
+
interface SecondaryToolbarComponentProps {
|
|
6
|
+
editorView: EditorView;
|
|
7
|
+
api: ExtractInjectionAPI<MentionsPlugin> | undefined;
|
|
8
|
+
typeAhead: TypeAheadHandler;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function SecondaryToolbarComponent({ editorView, api, typeAhead, disabled, }: SecondaryToolbarComponentProps): JSX.Element | null;
|
|
12
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-mentions",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
4
4
|
"description": "Mentions plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"releaseModel": "continuous",
|
|
15
15
|
"runReact18": false
|
|
16
16
|
},
|
|
17
|
-
"repository": "https://bitbucket.org/atlassian/atlassian-frontend",
|
|
17
|
+
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
18
18
|
"main": "dist/cjs/index.js",
|
|
19
19
|
"module": "dist/esm/index.js",
|
|
20
20
|
"module:es2019": "dist/es2019/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/adf-schema": "^35.3.0",
|
|
37
37
|
"@atlaskit/analytics-gas-types": "^5.1.0",
|
|
38
|
-
"@atlaskit/editor-common": "^76.
|
|
38
|
+
"@atlaskit/editor-common": "^76.39.0",
|
|
39
39
|
"@atlaskit/editor-plugin-analytics": "^0.4.0",
|
|
40
40
|
"@atlaskit/editor-plugin-type-ahead": "^0.9.0",
|
|
41
41
|
"@atlaskit/editor-prosemirror": "1.1.0",
|