@atlaskit/editor-plugin-hyperlink 15.0.1 → 15.0.3

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,19 @@
1
1
  # @atlaskit/editor-plugin-hyperlink
2
2
 
3
+ ## 15.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 15.0.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [`7087f393ec725`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7087f393ec725) -
14
+ Add the categorized registered Quick Insert browse experience with representative native elements
15
+ - Updated dependencies
16
+
3
17
  ## 15.0.1
4
18
 
5
19
  ### Patch Changes
@@ -16,6 +16,7 @@ var _preset = require("@atlaskit/editor-common/preset");
16
16
  var _quickInsert = require("@atlaskit/editor-common/quick-insert");
17
17
  var _utils = require("@atlaskit/editor-common/utils");
18
18
  var _link2 = _interopRequireDefault(require("@atlaskit/icon/core/link"));
19
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
19
20
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
20
21
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
21
22
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
@@ -25,6 +26,7 @@ var _inputRule = require("./pm-plugins/input-rule");
25
26
  var _keymap = require("./pm-plugins/keymap");
26
27
  var _main = require("./pm-plugins/main");
27
28
  var _toolbarButtons = require("./pm-plugins/toolbar-buttons");
29
+ var _getHyperlinkQuickInsertComponents = require("./ui/quick-insert/getHyperlinkQuickInsertComponents");
28
30
  var _toolbarComponents = require("./ui/toolbar-components");
29
31
  var _Toolbar = require("./ui/toolbar/Toolbar");
30
32
  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; }
@@ -53,6 +55,13 @@ var hyperlinkPlugin = exports.hyperlinkPlugin = function hyperlinkPlugin(_ref) {
53
55
  api = _ref.api;
54
56
  var primaryToolbarComponent;
55
57
  var isToolbarAIFCEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar);
58
+ var isRegisteredSlashCommandEnabled = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_slash_command');
59
+ if (isRegisteredSlashCommandEnabled) {
60
+ var _api$uiControlRegistr;
61
+ api === null || api === void 0 || (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 || _api$uiControlRegistr.actions.register((0, _getHyperlinkQuickInsertComponents.getHyperlinkQuickInsertComponents)({
62
+ api: api
63
+ }));
64
+ }
56
65
  if (isToolbarAIFCEnabled) {
57
66
  var _api$toolbar;
58
67
  api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || _api$toolbar.actions.registerComponents((0, _toolbarComponents.getToolbarComponents)(api));
@@ -150,7 +159,7 @@ var hyperlinkPlugin = exports.hyperlinkPlugin = function hyperlinkPlugin(_ref) {
150
159
  }
151
160
  }];
152
161
  },
153
- pluginsOptions: _objectSpread(_objectSpread({
162
+ pluginsOptions: _objectSpread(_objectSpread(_objectSpread({}, isRegisteredSlashCommandEnabled ? {} : {
154
163
  quickInsert: function quickInsert(_ref4) {
155
164
  var formatMessage = _ref4.formatMessage;
156
165
  return [{
@@ -182,7 +191,8 @@ var hyperlinkPlugin = exports.hyperlinkPlugin = function hyperlinkPlugin(_ref) {
182
191
  return analyticsAttached !== false ? tr : false;
183
192
  }
184
193
  }];
185
- },
194
+ }
195
+ }), {}, {
186
196
  floatingToolbar: (0, _Toolbar.getToolbarConfig)(options, api)
187
197
  }, !isToolbarAIFCEnabled && {
188
198
  selectionToolbar: function selectionToolbar(state, _ref5) {
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.HyperlinkQuickInsertMenuItem = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _reactIntl = require("react-intl");
10
+ var _analytics = require("@atlaskit/editor-common/analytics");
11
+ var _keymaps = require("@atlaskit/editor-common/keymaps");
12
+ var _link = require("@atlaskit/editor-common/link");
13
+ var _messages = require("@atlaskit/editor-common/messages");
14
+ var _quickInsert = require("@atlaskit/editor-common/quick-insert");
15
+ var _menuItem = require("@atlaskit/editor-common/quick-insert/menu-item");
16
+ var _main = require("../../pm-plugins/main");
17
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
18
+ var HyperlinkQuickInsertMenuItem = exports.HyperlinkQuickInsertMenuItem = function HyperlinkQuickInsertMenuItem(_ref) {
19
+ var api = _ref.api;
20
+ var _useIntl = (0, _reactIntl.useIntl)(),
21
+ formatMessage = _useIntl.formatMessage;
22
+ var onSelect = (0, _react.useCallback)(function (_ref2) {
23
+ var _api$analytics, _api$analytics$attach;
24
+ var insert = _ref2.insert;
25
+ var tr = insert(undefined);
26
+ tr.setMeta(_main.stateKey, {
27
+ type: _link.LinkAction.SHOW_INSERT_TOOLBAR,
28
+ inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
29
+ });
30
+ var analyticsAttached = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 || (_api$analytics$attach = _api$analytics.attachAnalyticsEvent) === null || _api$analytics$attach === void 0 ? void 0 : _api$analytics$attach.call(_api$analytics, {
31
+ action: _analytics.ACTION.INVOKED,
32
+ actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD,
33
+ actionSubjectId: _analytics.ACTION_SUBJECT_ID.TYPEAHEAD_LINK,
34
+ attributes: {
35
+ inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
36
+ },
37
+ eventType: _analytics.EVENT_TYPE.UI
38
+ })(tr);
39
+ return analyticsAttached !== false ? tr : false;
40
+ }, [api]);
41
+ return /*#__PURE__*/_react.default.createElement(_menuItem.QuickInsertMenuItem, {
42
+ iconBefore: /*#__PURE__*/_react.default.createElement(_quickInsert.IconLink, null),
43
+ onSelect: onSelect,
44
+ shortcut: (0, _keymaps.tooltip)(_keymaps.addLink),
45
+ title: formatMessage(_messages.toolbarInsertBlockMessages.link)
46
+ });
47
+ };
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.getHyperlinkQuickInsertComponents = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _keys = require("@atlaskit/editor-common/quick-insert/keys");
10
+ var _rank = require("@atlaskit/editor-common/quick-insert/rank");
11
+ var _HyperlinkQuickInsertMenuItem = require("./HyperlinkQuickInsertMenuItem");
12
+ var getHyperlinkQuickInsertComponents = exports.getHyperlinkQuickInsertComponents = function getHyperlinkQuickInsertComponents(_ref) {
13
+ var api = _ref.api;
14
+ return [{
15
+ key: _keys.HYPERLINK_MENU_ITEM.key,
16
+ type: _keys.HYPERLINK_MENU_ITEM.type,
17
+ parents: [{
18
+ key: _keys.MEDIA_SECTION.key,
19
+ type: _keys.MEDIA_SECTION.type,
20
+ rank: _rank.MEDIA_SECTION_RANK[_keys.HYPERLINK_MENU_ITEM.key]
21
+ }],
22
+ component: function component() {
23
+ return /*#__PURE__*/_react.default.createElement(_HyperlinkQuickInsertMenuItem.HyperlinkQuickInsertMenuItem, {
24
+ api: api
25
+ });
26
+ }
27
+ }];
28
+ };
@@ -8,6 +8,7 @@ import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
8
8
  import { IconLink } from '@atlaskit/editor-common/quick-insert';
9
9
  import { canLinkBeCreatedInRange } from '@atlaskit/editor-common/utils';
10
10
  import LinkIcon from '@atlaskit/icon/core/link';
11
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
11
12
  import { fg } from '@atlaskit/platform-feature-flags';
12
13
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
13
14
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
@@ -17,6 +18,7 @@ import { createInputRulePlugin } from './pm-plugins/input-rule';
17
18
  import { createKeymapPlugin } from './pm-plugins/keymap';
18
19
  import { plugin, stateKey } from './pm-plugins/main';
19
20
  import { toolbarButtonsPlugin } from './pm-plugins/toolbar-buttons';
21
+ import { getHyperlinkQuickInsertComponents } from './ui/quick-insert/getHyperlinkQuickInsertComponents';
20
22
  import { getToolbarComponents } from './ui/toolbar-components';
21
23
  import { getToolbarConfig } from './ui/toolbar/Toolbar';
22
24
  const getPosFromActiveLinkMark = state => {
@@ -43,6 +45,13 @@ export const hyperlinkPlugin = ({
43
45
  }) => {
44
46
  let primaryToolbarComponent;
45
47
  const isToolbarAIFCEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar);
48
+ const isRegisteredSlashCommandEnabled = isExperimentEnabled('platform_editor_slash_command');
49
+ if (isRegisteredSlashCommandEnabled) {
50
+ var _api$uiControlRegistr;
51
+ api === null || api === void 0 ? void 0 : (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 ? void 0 : _api$uiControlRegistr.actions.register(getHyperlinkQuickInsertComponents({
52
+ api
53
+ }));
54
+ }
46
55
  if (isToolbarAIFCEnabled) {
47
56
  var _api$toolbar;
48
57
  api === null || api === void 0 ? void 0 : (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.actions.registerComponents(getToolbarComponents(api));
@@ -131,35 +140,37 @@ export const hyperlinkPlugin = ({
131
140
  }];
132
141
  },
133
142
  pluginsOptions: {
134
- quickInsert: ({
135
- formatMessage
136
- }) => [{
137
- id: 'hyperlink',
138
- title: formatMessage(messages.link),
139
- description: formatMessage(messages.linkDescription),
140
- keywords: ['hyperlink', 'url'],
141
- priority: expValEquals('confluence_quick_insert_embeds', 'cohort', 'prioritizeLinkInQIM', 'control') ? -300 : 1200,
142
- keyshortcut: tooltip(addLink),
143
- icon: () => /*#__PURE__*/React.createElement(IconLink, null),
144
- action(insert, state) {
145
- var _api$analytics6, _api$analytics6$actio, _api$analytics6$actio2;
146
- const tr = insert(undefined);
147
- tr.setMeta(stateKey, {
148
- type: LinkAction.SHOW_INSERT_TOOLBAR,
149
- inputMethod: INPUT_METHOD.QUICK_INSERT
150
- });
151
- const analyticsAttached = api === null || api === void 0 ? void 0 : (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : (_api$analytics6$actio = _api$analytics6.actions) === null || _api$analytics6$actio === void 0 ? void 0 : (_api$analytics6$actio2 = _api$analytics6$actio.attachAnalyticsEvent) === null || _api$analytics6$actio2 === void 0 ? void 0 : _api$analytics6$actio2.call(_api$analytics6$actio, {
152
- action: ACTION.INVOKED,
153
- actionSubject: ACTION_SUBJECT.TYPEAHEAD,
154
- actionSubjectId: ACTION_SUBJECT_ID.TYPEAHEAD_LINK,
155
- attributes: {
143
+ ...(isRegisteredSlashCommandEnabled ? {} : {
144
+ quickInsert: ({
145
+ formatMessage
146
+ }) => [{
147
+ id: 'hyperlink',
148
+ title: formatMessage(messages.link),
149
+ description: formatMessage(messages.linkDescription),
150
+ keywords: ['hyperlink', 'url'],
151
+ priority: expValEquals('confluence_quick_insert_embeds', 'cohort', 'prioritizeLinkInQIM', 'control') ? -300 : 1200,
152
+ keyshortcut: tooltip(addLink),
153
+ icon: () => /*#__PURE__*/React.createElement(IconLink, null),
154
+ action(insert, state) {
155
+ var _api$analytics6, _api$analytics6$actio, _api$analytics6$actio2;
156
+ const tr = insert(undefined);
157
+ tr.setMeta(stateKey, {
158
+ type: LinkAction.SHOW_INSERT_TOOLBAR,
156
159
  inputMethod: INPUT_METHOD.QUICK_INSERT
157
- },
158
- eventType: EVENT_TYPE.UI
159
- })(tr);
160
- return analyticsAttached !== false ? tr : false;
161
- }
162
- }],
160
+ });
161
+ const analyticsAttached = api === null || api === void 0 ? void 0 : (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : (_api$analytics6$actio = _api$analytics6.actions) === null || _api$analytics6$actio === void 0 ? void 0 : (_api$analytics6$actio2 = _api$analytics6$actio.attachAnalyticsEvent) === null || _api$analytics6$actio2 === void 0 ? void 0 : _api$analytics6$actio2.call(_api$analytics6$actio, {
162
+ action: ACTION.INVOKED,
163
+ actionSubject: ACTION_SUBJECT.TYPEAHEAD,
164
+ actionSubjectId: ACTION_SUBJECT_ID.TYPEAHEAD_LINK,
165
+ attributes: {
166
+ inputMethod: INPUT_METHOD.QUICK_INSERT
167
+ },
168
+ eventType: EVENT_TYPE.UI
169
+ })(tr);
170
+ return analyticsAttached !== false ? tr : false;
171
+ }
172
+ }]
173
+ }),
163
174
  floatingToolbar: getToolbarConfig(options, api),
164
175
  ...(!isToolbarAIFCEnabled && {
165
176
  selectionToolbar: (state, {
@@ -0,0 +1,42 @@
1
+ import React, { useCallback } from 'react';
2
+ import { useIntl } from 'react-intl';
3
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
+ import { addLink, tooltip } from '@atlaskit/editor-common/keymaps';
5
+ import { LinkAction } from '@atlaskit/editor-common/link';
6
+ import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
7
+ import { IconLink } from '@atlaskit/editor-common/quick-insert';
8
+ import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
9
+ import { stateKey } from '../../pm-plugins/main';
10
+ export const HyperlinkQuickInsertMenuItem = ({
11
+ api
12
+ }) => {
13
+ const {
14
+ formatMessage
15
+ } = useIntl();
16
+ const onSelect = useCallback(({
17
+ insert
18
+ }) => {
19
+ var _api$analytics, _api$analytics$action, _api$analytics$action2;
20
+ const tr = insert(undefined);
21
+ tr.setMeta(stateKey, {
22
+ type: LinkAction.SHOW_INSERT_TOOLBAR,
23
+ inputMethod: INPUT_METHOD.QUICK_INSERT
24
+ });
25
+ const analyticsAttached = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : (_api$analytics$action = _api$analytics.actions) === null || _api$analytics$action === void 0 ? void 0 : (_api$analytics$action2 = _api$analytics$action.attachAnalyticsEvent) === null || _api$analytics$action2 === void 0 ? void 0 : _api$analytics$action2.call(_api$analytics$action, {
26
+ action: ACTION.INVOKED,
27
+ actionSubject: ACTION_SUBJECT.TYPEAHEAD,
28
+ actionSubjectId: ACTION_SUBJECT_ID.TYPEAHEAD_LINK,
29
+ attributes: {
30
+ inputMethod: INPUT_METHOD.QUICK_INSERT
31
+ },
32
+ eventType: EVENT_TYPE.UI
33
+ })(tr);
34
+ return analyticsAttached !== false ? tr : false;
35
+ }, [api]);
36
+ return /*#__PURE__*/React.createElement(QuickInsertMenuItem, {
37
+ iconBefore: /*#__PURE__*/React.createElement(IconLink, null),
38
+ onSelect: onSelect,
39
+ shortcut: tooltip(addLink),
40
+ title: formatMessage(messages.link)
41
+ });
42
+ };
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { HYPERLINK_MENU_ITEM, MEDIA_SECTION } from '@atlaskit/editor-common/quick-insert/keys';
3
+ import { MEDIA_SECTION_RANK } from '@atlaskit/editor-common/quick-insert/rank';
4
+ import { HyperlinkQuickInsertMenuItem } from './HyperlinkQuickInsertMenuItem';
5
+ export const getHyperlinkQuickInsertComponents = ({
6
+ api
7
+ }) => [{
8
+ key: HYPERLINK_MENU_ITEM.key,
9
+ type: HYPERLINK_MENU_ITEM.type,
10
+ parents: [{
11
+ key: MEDIA_SECTION.key,
12
+ type: MEDIA_SECTION.type,
13
+ rank: MEDIA_SECTION_RANK[HYPERLINK_MENU_ITEM.key]
14
+ }],
15
+ component: () => /*#__PURE__*/React.createElement(HyperlinkQuickInsertMenuItem, {
16
+ api: api
17
+ })
18
+ }];
@@ -11,6 +11,7 @@ import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
11
11
  import { IconLink } from '@atlaskit/editor-common/quick-insert';
12
12
  import { canLinkBeCreatedInRange } from '@atlaskit/editor-common/utils';
13
13
  import LinkIcon from '@atlaskit/icon/core/link';
14
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
14
15
  import { fg } from '@atlaskit/platform-feature-flags';
15
16
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
16
17
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
@@ -20,6 +21,7 @@ import { createInputRulePlugin } from './pm-plugins/input-rule';
20
21
  import { createKeymapPlugin } from './pm-plugins/keymap';
21
22
  import { plugin as _plugin, stateKey } from './pm-plugins/main';
22
23
  import { toolbarButtonsPlugin } from './pm-plugins/toolbar-buttons';
24
+ import { getHyperlinkQuickInsertComponents } from './ui/quick-insert/getHyperlinkQuickInsertComponents';
23
25
  import { getToolbarComponents } from './ui/toolbar-components';
24
26
  import { getToolbarConfig } from './ui/toolbar/Toolbar';
25
27
  var getPosFromActiveLinkMark = function getPosFromActiveLinkMark(state) {
@@ -46,6 +48,13 @@ export var hyperlinkPlugin = function hyperlinkPlugin(_ref) {
46
48
  api = _ref.api;
47
49
  var primaryToolbarComponent;
48
50
  var isToolbarAIFCEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar);
51
+ var isRegisteredSlashCommandEnabled = isExperimentEnabled('platform_editor_slash_command');
52
+ if (isRegisteredSlashCommandEnabled) {
53
+ var _api$uiControlRegistr;
54
+ api === null || api === void 0 || (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 || _api$uiControlRegistr.actions.register(getHyperlinkQuickInsertComponents({
55
+ api: api
56
+ }));
57
+ }
49
58
  if (isToolbarAIFCEnabled) {
50
59
  var _api$toolbar;
51
60
  api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || _api$toolbar.actions.registerComponents(getToolbarComponents(api));
@@ -143,7 +152,7 @@ export var hyperlinkPlugin = function hyperlinkPlugin(_ref) {
143
152
  }
144
153
  }];
145
154
  },
146
- pluginsOptions: _objectSpread(_objectSpread({
155
+ pluginsOptions: _objectSpread(_objectSpread(_objectSpread({}, isRegisteredSlashCommandEnabled ? {} : {
147
156
  quickInsert: function quickInsert(_ref4) {
148
157
  var formatMessage = _ref4.formatMessage;
149
158
  return [{
@@ -175,7 +184,8 @@ export var hyperlinkPlugin = function hyperlinkPlugin(_ref) {
175
184
  return analyticsAttached !== false ? tr : false;
176
185
  }
177
186
  }];
178
- },
187
+ }
188
+ }), {}, {
179
189
  floatingToolbar: getToolbarConfig(options, api)
180
190
  }, !isToolbarAIFCEnabled && {
181
191
  selectionToolbar: function selectionToolbar(state, _ref5) {
@@ -0,0 +1,39 @@
1
+ import React, { useCallback } from 'react';
2
+ import { useIntl } from 'react-intl';
3
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
+ import { addLink, tooltip } from '@atlaskit/editor-common/keymaps';
5
+ import { LinkAction } from '@atlaskit/editor-common/link';
6
+ import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
7
+ import { IconLink } from '@atlaskit/editor-common/quick-insert';
8
+ import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
9
+ import { stateKey } from '../../pm-plugins/main';
10
+ export var HyperlinkQuickInsertMenuItem = function HyperlinkQuickInsertMenuItem(_ref) {
11
+ var api = _ref.api;
12
+ var _useIntl = useIntl(),
13
+ formatMessage = _useIntl.formatMessage;
14
+ var onSelect = useCallback(function (_ref2) {
15
+ var _api$analytics, _api$analytics$attach;
16
+ var insert = _ref2.insert;
17
+ var tr = insert(undefined);
18
+ tr.setMeta(stateKey, {
19
+ type: LinkAction.SHOW_INSERT_TOOLBAR,
20
+ inputMethod: INPUT_METHOD.QUICK_INSERT
21
+ });
22
+ var analyticsAttached = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 || (_api$analytics$attach = _api$analytics.attachAnalyticsEvent) === null || _api$analytics$attach === void 0 ? void 0 : _api$analytics$attach.call(_api$analytics, {
23
+ action: ACTION.INVOKED,
24
+ actionSubject: ACTION_SUBJECT.TYPEAHEAD,
25
+ actionSubjectId: ACTION_SUBJECT_ID.TYPEAHEAD_LINK,
26
+ attributes: {
27
+ inputMethod: INPUT_METHOD.QUICK_INSERT
28
+ },
29
+ eventType: EVENT_TYPE.UI
30
+ })(tr);
31
+ return analyticsAttached !== false ? tr : false;
32
+ }, [api]);
33
+ return /*#__PURE__*/React.createElement(QuickInsertMenuItem, {
34
+ iconBefore: /*#__PURE__*/React.createElement(IconLink, null),
35
+ onSelect: onSelect,
36
+ shortcut: tooltip(addLink),
37
+ title: formatMessage(messages.link)
38
+ });
39
+ };
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { HYPERLINK_MENU_ITEM, MEDIA_SECTION } from '@atlaskit/editor-common/quick-insert/keys';
3
+ import { MEDIA_SECTION_RANK } from '@atlaskit/editor-common/quick-insert/rank';
4
+ import { HyperlinkQuickInsertMenuItem } from './HyperlinkQuickInsertMenuItem';
5
+ export var getHyperlinkQuickInsertComponents = function getHyperlinkQuickInsertComponents(_ref) {
6
+ var api = _ref.api;
7
+ return [{
8
+ key: HYPERLINK_MENU_ITEM.key,
9
+ type: HYPERLINK_MENU_ITEM.type,
10
+ parents: [{
11
+ key: MEDIA_SECTION.key,
12
+ type: MEDIA_SECTION.type,
13
+ rank: MEDIA_SECTION_RANK[HYPERLINK_MENU_ITEM.key]
14
+ }],
15
+ component: function component() {
16
+ return /*#__PURE__*/React.createElement(HyperlinkQuickInsertMenuItem, {
17
+ api: api
18
+ });
19
+ }
20
+ }];
21
+ };
@@ -2,11 +2,12 @@ import type { HyperlinkState } from '@atlaskit/editor-common/link';
2
2
  import type { EditorCommand, HyperlinkPluginOptions as CommonHyperlinkPluginOptions, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
3
3
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
4
  import type { CardPlugin } from '@atlaskit/editor-plugin-card';
5
- import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
5
+ import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity/connectivityPluginType';
6
6
  import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
7
7
  import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
8
8
  import type { SelectionToolbarPlugin } from '@atlaskit/editor-plugin-selection-toolbar';
9
9
  import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
10
+ import type { UiControlRegistryPlugin } from '@atlaskit/editor-plugin-ui-control-registry/ui-control-registry-plugin-type';
10
11
  import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
11
12
  import type { UserPreferencesPlugin } from '@atlaskit/editor-plugin-user-preferences';
12
13
  import type { HideLinkToolbar, InsertLink, ShowLinkToolbar, UpdateLink } from './editor-commands/commands';
@@ -57,7 +58,8 @@ export type HyperlinkPluginDependencies = [
57
58
  OptionalPlugin<SelectionToolbarPlugin>,
58
59
  OptionalPlugin<UserPreferencesPlugin>,
59
60
  OptionalPlugin<ToolbarPlugin>,
60
- OptionalPlugin<UserIntentPlugin>
61
+ OptionalPlugin<UserIntentPlugin>,
62
+ OptionalPlugin<UiControlRegistryPlugin>
61
63
  ];
62
64
  export type HyperlinkPluginActions = {
63
65
  hideLinkToolbar: HideLinkToolbar;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
+ import type { HyperlinkPlugin } from '../../hyperlinkPluginType';
4
+ export declare const HyperlinkQuickInsertMenuItem: ({ api, }: {
5
+ api: ExtractInjectionAPI<HyperlinkPlugin> | undefined;
6
+ }) => React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import type { RegisterMenuItem } from '@atlaskit/editor-ui-control-model/types';
3
+ import type { HyperlinkPlugin } from '../../hyperlinkPluginType';
4
+ export declare const getHyperlinkQuickInsertComponents: ({ api, }: {
5
+ api: ExtractInjectionAPI<HyperlinkPlugin> | undefined;
6
+ }) => RegisterMenuItem[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-hyperlink",
3
- "version": "15.0.1",
3
+ "version": "15.0.3",
4
4
  "description": "Hyperlink plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -30,20 +30,23 @@
30
30
  "@atlaskit/editor-plugin-primary-toolbar": "^14.0.0",
31
31
  "@atlaskit/editor-plugin-selection-toolbar": "^14.0.0",
32
32
  "@atlaskit/editor-plugin-toolbar": "^10.0.0",
33
+ "@atlaskit/editor-plugin-ui-control-registry": "^7.0.0",
33
34
  "@atlaskit/editor-plugin-user-intent": "^11.0.0",
34
35
  "@atlaskit/editor-prosemirror": "^8.0.0",
35
36
  "@atlaskit/editor-toolbar": "^2.4.0",
36
37
  "@atlaskit/editor-toolbar-model": "^1.2.0",
37
- "@atlaskit/icon": "^37.2.0",
38
+ "@atlaskit/editor-ui-control-model": "^2.4.0",
39
+ "@atlaskit/icon": "^37.3.0",
40
+ "@atlaskit/platform-feature-experiments": "^0.3.0",
38
41
  "@atlaskit/platform-feature-flags": "^2.1.0",
39
42
  "@atlaskit/prosemirror-input-rules": "^4.0.0",
40
- "@atlaskit/tmp-editor-statsig": "^139.0.0",
43
+ "@atlaskit/tmp-editor-statsig": "^140.0.0",
41
44
  "@babel/runtime": "^7.0.0",
42
45
  "@emotion/react": "^11.7.1",
43
46
  "uuid": "^3.1.0"
44
47
  },
45
48
  "peerDependencies": {
46
- "@atlaskit/editor-common": "^117.0.0",
49
+ "@atlaskit/editor-common": "^117.2.0",
47
50
  "react": "^18.2.0 || ^19.2.0",
48
51
  "react-dom": "^18.2.0 || ^19.2.0",
49
52
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"