@atlaskit/editor-plugin-hyperlink 3.6.0 → 4.0.1
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 +27 -0
- package/dist/cjs/ui/toolbar/Toolbar.js +17 -8
- package/dist/es2019/ui/toolbar/Toolbar.js +14 -10
- package/dist/esm/ui/toolbar/Toolbar.js +14 -8
- package/dist/types/hyperlinkPluginType.d.ts +2 -0
- package/dist/types/ui/toolbar/Toolbar.d.ts +3 -3
- package/dist/types-ts4.5/hyperlinkPluginType.d.ts +2 -0
- package/dist/types-ts4.5/ui/toolbar/Toolbar.d.ts +3 -3
- package/package.json +15 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-hyperlink
|
|
2
2
|
|
|
3
|
+
## 4.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#117901](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/117901)
|
|
8
|
+
[`873bfa0f59444`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/873bfa0f59444) -
|
|
9
|
+
Use fallback UI on link picker if we're offline and normal link picker has not loaded.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 4.0.0
|
|
13
|
+
|
|
14
|
+
### Major Changes
|
|
15
|
+
|
|
16
|
+
- [#117363](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/117363)
|
|
17
|
+
[`10a0f7f6c2027`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/10a0f7f6c2027) -
|
|
18
|
+
This package's `peerDependencies` have been adjusted for `react` and/or `react-dom` to reflect the
|
|
19
|
+
status of only supporting React 18 going forward. No explicit breaking change to React support has
|
|
20
|
+
been made in this release, but this is to signify going forward, breaking changes for React 16 or
|
|
21
|
+
React 17 may come via non-major semver releases.
|
|
22
|
+
|
|
23
|
+
Please refer this community post for more details:
|
|
24
|
+
https://community.developer.atlassian.com/t/rfc-78-dropping-support-for-react-16-and-rendering-in-a-react-18-concurrent-root-in-jira-and-confluence/87026
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies
|
|
29
|
+
|
|
3
30
|
## 3.6.0
|
|
4
31
|
|
|
5
32
|
### Minor Changes
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
@@ -8,7 +9,7 @@ exports.HyperlinkAddToolbarWithState = HyperlinkAddToolbarWithState;
|
|
|
8
9
|
exports.getToolbarConfig = void 0;
|
|
9
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
11
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
-
var _react =
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
13
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
13
14
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
14
15
|
var _card = require("@atlaskit/editor-common/card");
|
|
@@ -24,6 +25,8 @@ var _shortcut = _interopRequireDefault(require("@atlaskit/icon/glyph/shortcut"))
|
|
|
24
25
|
var _commands = require("../../editor-commands/commands");
|
|
25
26
|
var _main = require("../../pm-plugins/main");
|
|
26
27
|
var _toolbarButtons = require("../../pm-plugins/toolbar-buttons");
|
|
28
|
+
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); }
|
|
29
|
+
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; }
|
|
27
30
|
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; }
|
|
28
31
|
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; }
|
|
29
32
|
/* type guard for edit links */
|
|
@@ -58,6 +61,7 @@ function getLinkText(activeLinkMark, state) {
|
|
|
58
61
|
return activeLinkMark.node.text;
|
|
59
62
|
}
|
|
60
63
|
function HyperlinkAddToolbarWithState(_ref) {
|
|
64
|
+
var _pluginInjectionApi$c;
|
|
61
65
|
var _ref$linkPickerOption = _ref.linkPickerOptions,
|
|
62
66
|
linkPickerOptions = _ref$linkPickerOption === void 0 ? {} : _ref$linkPickerOption,
|
|
63
67
|
onSubmit = _ref.onSubmit,
|
|
@@ -74,6 +78,10 @@ function HyperlinkAddToolbarWithState(_ref) {
|
|
|
74
78
|
pluginInjectionApi = _ref.pluginInjectionApi;
|
|
75
79
|
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['hyperlink']),
|
|
76
80
|
hyperlinkState = _useSharedPluginState.hyperlinkState;
|
|
81
|
+
// This is constant rather than dynamic - because if someone's already got a hyperlink toolbar open,
|
|
82
|
+
// we don't want to dynamically change it on them as this would cause data loss if they've already
|
|
83
|
+
// started typing in the fields.
|
|
84
|
+
var isOffline = (0, _react.useRef)((pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.connectivity) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.sharedState.currentState()) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.mode) === 'offline');
|
|
77
85
|
return /*#__PURE__*/_react.default.createElement(_link2.HyperlinkAddToolbar, {
|
|
78
86
|
linkPickerOptions: linkPickerOptions,
|
|
79
87
|
onSubmit: onSubmit,
|
|
@@ -87,20 +95,21 @@ function HyperlinkAddToolbarWithState(_ref) {
|
|
|
87
95
|
onClose: onClose,
|
|
88
96
|
onEscapeCallback: onEscapeCallback,
|
|
89
97
|
onClickAwayCallback: onClickAwayCallback,
|
|
90
|
-
timesViewed: hyperlinkState.timesViewed,
|
|
91
|
-
inputMethod: hyperlinkState.inputMethod,
|
|
92
|
-
searchSessionId: hyperlinkState.searchSessionId
|
|
98
|
+
timesViewed: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.timesViewed,
|
|
99
|
+
inputMethod: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.inputMethod,
|
|
100
|
+
searchSessionId: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.searchSessionId,
|
|
101
|
+
isOffline: isOffline.current
|
|
93
102
|
});
|
|
94
103
|
}
|
|
95
104
|
var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(options, pluginInjectionApi) {
|
|
96
105
|
return function (state, intl, providerFactory) {
|
|
97
|
-
var _pluginInjectionApi$
|
|
106
|
+
var _pluginInjectionApi$c2, _pluginInjectionApi$a, _options$lpLinkPicker;
|
|
98
107
|
if (options.disableFloatingToolbar) {
|
|
99
108
|
return;
|
|
100
109
|
}
|
|
101
110
|
var formatMessage = intl.formatMessage;
|
|
102
111
|
var linkState = _main.stateKey.getState(state);
|
|
103
|
-
var editorCardActions = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
112
|
+
var editorCardActions = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.card) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions;
|
|
104
113
|
var editorAnalyticsApi = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
|
|
105
114
|
var lpLinkPicker = (_options$lpLinkPicker = options.lpLinkPicker) !== null && _options$lpLinkPicker !== void 0 ? _options$lpLinkPicker : true;
|
|
106
115
|
if (linkState && linkState.activeLinkMark) {
|
|
@@ -117,7 +126,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(opti
|
|
|
117
126
|
switch (activeLinkMark.type) {
|
|
118
127
|
case 'EDIT':
|
|
119
128
|
{
|
|
120
|
-
var _pluginInjectionApi$
|
|
129
|
+
var _pluginInjectionApi$c3, _cardActions$getStart, _cardActions$getEndin;
|
|
121
130
|
var pos = activeLinkMark.pos,
|
|
122
131
|
node = activeLinkMark.node;
|
|
123
132
|
var linkMark = node.marks.filter(function (mark) {
|
|
@@ -136,7 +145,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(opti
|
|
|
136
145
|
if (activeLinkMark.node.text) {
|
|
137
146
|
metadata.title = activeLinkMark.node.text;
|
|
138
147
|
}
|
|
139
|
-
var cardActions = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
148
|
+
var cardActions = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c3 = pluginInjectionApi.card) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.actions;
|
|
140
149
|
var startingToolbarItems = (_cardActions$getStart = cardActions === null || cardActions === void 0 ? void 0 : cardActions.getStartingToolbarItems(intl, link, (0, _commands.editInsertedLink)(editorAnalyticsApi), metadata)) !== null && _cardActions$getStart !== void 0 ? _cardActions$getStart : [{
|
|
141
150
|
id: 'editor.link.edit',
|
|
142
151
|
testId: 'editor.link.edit',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
2
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT_ID, buildVisitedLinkPayload, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { commandWithMetadata } from '@atlaskit/editor-common/card';
|
|
@@ -58,12 +58,15 @@ export function HyperlinkAddToolbarWithState({
|
|
|
58
58
|
onEscapeCallback,
|
|
59
59
|
onClickAwayCallback,
|
|
60
60
|
pluginInjectionApi
|
|
61
|
-
// Ignored via go/ees005
|
|
62
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
63
61
|
}) {
|
|
62
|
+
var _pluginInjectionApi$c, _pluginInjectionApi$c2;
|
|
64
63
|
const {
|
|
65
64
|
hyperlinkState
|
|
66
65
|
} = useSharedPluginState(pluginInjectionApi, ['hyperlink']);
|
|
66
|
+
// This is constant rather than dynamic - because if someone's already got a hyperlink toolbar open,
|
|
67
|
+
// we don't want to dynamically change it on them as this would cause data loss if they've already
|
|
68
|
+
// started typing in the fields.
|
|
69
|
+
const isOffline = useRef((pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.connectivity) === null || _pluginInjectionApi$c === void 0 ? void 0 : (_pluginInjectionApi$c2 = _pluginInjectionApi$c.sharedState.currentState()) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.mode) === 'offline');
|
|
67
70
|
return /*#__PURE__*/React.createElement(HyperlinkAddToolbar, {
|
|
68
71
|
linkPickerOptions: linkPickerOptions,
|
|
69
72
|
onSubmit: onSubmit,
|
|
@@ -77,13 +80,14 @@ export function HyperlinkAddToolbarWithState({
|
|
|
77
80
|
onClose: onClose,
|
|
78
81
|
onEscapeCallback: onEscapeCallback,
|
|
79
82
|
onClickAwayCallback: onClickAwayCallback,
|
|
80
|
-
timesViewed: hyperlinkState.timesViewed,
|
|
81
|
-
inputMethod: hyperlinkState.inputMethod,
|
|
82
|
-
searchSessionId: hyperlinkState.searchSessionId
|
|
83
|
+
timesViewed: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.timesViewed,
|
|
84
|
+
inputMethod: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.inputMethod,
|
|
85
|
+
searchSessionId: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.searchSessionId,
|
|
86
|
+
isOffline: isOffline.current
|
|
83
87
|
});
|
|
84
88
|
}
|
|
85
89
|
export const getToolbarConfig = (options, pluginInjectionApi) => (state, intl, providerFactory) => {
|
|
86
|
-
var _pluginInjectionApi$
|
|
90
|
+
var _pluginInjectionApi$c3, _pluginInjectionApi$a, _options$lpLinkPicker;
|
|
87
91
|
if (options.disableFloatingToolbar) {
|
|
88
92
|
return;
|
|
89
93
|
}
|
|
@@ -91,7 +95,7 @@ export const getToolbarConfig = (options, pluginInjectionApi) => (state, intl, p
|
|
|
91
95
|
formatMessage
|
|
92
96
|
} = intl;
|
|
93
97
|
const linkState = stateKey.getState(state);
|
|
94
|
-
const editorCardActions = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
98
|
+
const editorCardActions = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c3 = pluginInjectionApi.card) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.actions;
|
|
95
99
|
const editorAnalyticsApi = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
|
|
96
100
|
const lpLinkPicker = (_options$lpLinkPicker = options.lpLinkPicker) !== null && _options$lpLinkPicker !== void 0 ? _options$lpLinkPicker : true;
|
|
97
101
|
if (linkState && linkState.activeLinkMark) {
|
|
@@ -108,7 +112,7 @@ export const getToolbarConfig = (options, pluginInjectionApi) => (state, intl, p
|
|
|
108
112
|
switch (activeLinkMark.type) {
|
|
109
113
|
case 'EDIT':
|
|
110
114
|
{
|
|
111
|
-
var _pluginInjectionApi$
|
|
115
|
+
var _pluginInjectionApi$c4, _cardActions$getStart, _cardActions$getEndin;
|
|
112
116
|
const {
|
|
113
117
|
pos,
|
|
114
118
|
node
|
|
@@ -127,7 +131,7 @@ export const getToolbarConfig = (options, pluginInjectionApi) => (state, intl, p
|
|
|
127
131
|
if (activeLinkMark.node.text) {
|
|
128
132
|
metadata.title = activeLinkMark.node.text;
|
|
129
133
|
}
|
|
130
|
-
const cardActions = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
134
|
+
const cardActions = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c4 = pluginInjectionApi.card) === null || _pluginInjectionApi$c4 === void 0 ? void 0 : _pluginInjectionApi$c4.actions;
|
|
131
135
|
const startingToolbarItems = (_cardActions$getStart = cardActions === null || cardActions === void 0 ? void 0 : cardActions.getStartingToolbarItems(intl, link, editInsertedLink(editorAnalyticsApi), metadata)) !== null && _cardActions$getStart !== void 0 ? _cardActions$getStart : [{
|
|
132
136
|
id: 'editor.link.edit',
|
|
133
137
|
testId: 'editor.link.edit',
|
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
3
|
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; }
|
|
4
4
|
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) { _defineProperty(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; }
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { useRef } from 'react';
|
|
6
6
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
7
7
|
import { ACTION, ACTION_SUBJECT_ID, buildVisitedLinkPayload, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
8
8
|
import { commandWithMetadata } from '@atlaskit/editor-common/card';
|
|
@@ -51,6 +51,7 @@ function getLinkText(activeLinkMark, state) {
|
|
|
51
51
|
return activeLinkMark.node.text;
|
|
52
52
|
}
|
|
53
53
|
export function HyperlinkAddToolbarWithState(_ref) {
|
|
54
|
+
var _pluginInjectionApi$c;
|
|
54
55
|
var _ref$linkPickerOption = _ref.linkPickerOptions,
|
|
55
56
|
linkPickerOptions = _ref$linkPickerOption === void 0 ? {} : _ref$linkPickerOption,
|
|
56
57
|
onSubmit = _ref.onSubmit,
|
|
@@ -67,6 +68,10 @@ export function HyperlinkAddToolbarWithState(_ref) {
|
|
|
67
68
|
pluginInjectionApi = _ref.pluginInjectionApi;
|
|
68
69
|
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['hyperlink']),
|
|
69
70
|
hyperlinkState = _useSharedPluginState.hyperlinkState;
|
|
71
|
+
// This is constant rather than dynamic - because if someone's already got a hyperlink toolbar open,
|
|
72
|
+
// we don't want to dynamically change it on them as this would cause data loss if they've already
|
|
73
|
+
// started typing in the fields.
|
|
74
|
+
var isOffline = useRef((pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.connectivity) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.sharedState.currentState()) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.mode) === 'offline');
|
|
70
75
|
return /*#__PURE__*/React.createElement(HyperlinkAddToolbar, {
|
|
71
76
|
linkPickerOptions: linkPickerOptions,
|
|
72
77
|
onSubmit: onSubmit,
|
|
@@ -80,20 +85,21 @@ export function HyperlinkAddToolbarWithState(_ref) {
|
|
|
80
85
|
onClose: onClose,
|
|
81
86
|
onEscapeCallback: onEscapeCallback,
|
|
82
87
|
onClickAwayCallback: onClickAwayCallback,
|
|
83
|
-
timesViewed: hyperlinkState.timesViewed,
|
|
84
|
-
inputMethod: hyperlinkState.inputMethod,
|
|
85
|
-
searchSessionId: hyperlinkState.searchSessionId
|
|
88
|
+
timesViewed: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.timesViewed,
|
|
89
|
+
inputMethod: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.inputMethod,
|
|
90
|
+
searchSessionId: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.searchSessionId,
|
|
91
|
+
isOffline: isOffline.current
|
|
86
92
|
});
|
|
87
93
|
}
|
|
88
94
|
export var getToolbarConfig = function getToolbarConfig(options, pluginInjectionApi) {
|
|
89
95
|
return function (state, intl, providerFactory) {
|
|
90
|
-
var _pluginInjectionApi$
|
|
96
|
+
var _pluginInjectionApi$c2, _pluginInjectionApi$a, _options$lpLinkPicker;
|
|
91
97
|
if (options.disableFloatingToolbar) {
|
|
92
98
|
return;
|
|
93
99
|
}
|
|
94
100
|
var formatMessage = intl.formatMessage;
|
|
95
101
|
var linkState = stateKey.getState(state);
|
|
96
|
-
var editorCardActions = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
102
|
+
var editorCardActions = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.card) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions;
|
|
97
103
|
var editorAnalyticsApi = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
|
|
98
104
|
var lpLinkPicker = (_options$lpLinkPicker = options.lpLinkPicker) !== null && _options$lpLinkPicker !== void 0 ? _options$lpLinkPicker : true;
|
|
99
105
|
if (linkState && linkState.activeLinkMark) {
|
|
@@ -110,7 +116,7 @@ export var getToolbarConfig = function getToolbarConfig(options, pluginInjection
|
|
|
110
116
|
switch (activeLinkMark.type) {
|
|
111
117
|
case 'EDIT':
|
|
112
118
|
{
|
|
113
|
-
var _pluginInjectionApi$
|
|
119
|
+
var _pluginInjectionApi$c3, _cardActions$getStart, _cardActions$getEndin;
|
|
114
120
|
var pos = activeLinkMark.pos,
|
|
115
121
|
node = activeLinkMark.node;
|
|
116
122
|
var linkMark = node.marks.filter(function (mark) {
|
|
@@ -129,7 +135,7 @@ export var getToolbarConfig = function getToolbarConfig(options, pluginInjection
|
|
|
129
135
|
if (activeLinkMark.node.text) {
|
|
130
136
|
metadata.title = activeLinkMark.node.text;
|
|
131
137
|
}
|
|
132
|
-
var cardActions = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
138
|
+
var cardActions = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c3 = pluginInjectionApi.card) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.actions;
|
|
133
139
|
var startingToolbarItems = (_cardActions$getStart = cardActions === null || cardActions === void 0 ? void 0 : cardActions.getStartingToolbarItems(intl, link, editInsertedLink(editorAnalyticsApi), metadata)) !== null && _cardActions$getStart !== void 0 ? _cardActions$getStart : [{
|
|
134
140
|
id: 'editor.link.edit',
|
|
135
141
|
testId: 'editor.link.edit',
|
|
@@ -2,6 +2,7 @@ import type { HyperlinkState } from '@atlaskit/editor-common/link';
|
|
|
2
2
|
import type { EditorCommand, HyperlinkPluginOptions, 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
6
|
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
6
7
|
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
|
|
7
8
|
import type { SelectionToolbarPlugin } from '@atlaskit/editor-plugin-selection-toolbar';
|
|
@@ -48,6 +49,7 @@ export type HyperlinkPluginDependencies = [
|
|
|
48
49
|
OptionalPlugin<AnalyticsPlugin>,
|
|
49
50
|
OptionalPlugin<CardPlugin>,
|
|
50
51
|
OptionalPlugin<EditorViewModePlugin>,
|
|
52
|
+
OptionalPlugin<ConnectivityPlugin>,
|
|
51
53
|
OptionalPlugin<PrimaryToolbarPlugin>,
|
|
52
54
|
OptionalPlugin<SelectionToolbarPlugin>
|
|
53
55
|
];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { HyperlinkAddToolbarProps } from '@atlaskit/editor-common/link';
|
|
3
3
|
import type { ExtractInjectionAPI, FloatingToolbarHandler, HyperlinkPluginOptions } from '@atlaskit/editor-common/types';
|
|
4
|
-
import type {
|
|
4
|
+
import type { HyperlinkPlugin } from '../../hyperlinkPluginType';
|
|
5
5
|
export declare function HyperlinkAddToolbarWithState({ linkPickerOptions, onSubmit, displayText, displayUrl, providerFactory, view, onCancel, invokeMethod, lpLinkPicker, onClose, onEscapeCallback, onClickAwayCallback, pluginInjectionApi, }: HyperlinkAddToolbarProps & {
|
|
6
|
-
pluginInjectionApi:
|
|
6
|
+
pluginInjectionApi: ExtractInjectionAPI<HyperlinkPlugin> | undefined;
|
|
7
7
|
}): React.JSX.Element;
|
|
8
|
-
export declare const getToolbarConfig: (options: HyperlinkPluginOptions, pluginInjectionApi: ExtractInjectionAPI<
|
|
8
|
+
export declare const getToolbarConfig: (options: HyperlinkPluginOptions, pluginInjectionApi: ExtractInjectionAPI<HyperlinkPlugin> | undefined) => FloatingToolbarHandler;
|
|
@@ -2,6 +2,7 @@ import type { HyperlinkState } from '@atlaskit/editor-common/link';
|
|
|
2
2
|
import type { EditorCommand, HyperlinkPluginOptions, 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
6
|
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
6
7
|
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
|
|
7
8
|
import type { SelectionToolbarPlugin } from '@atlaskit/editor-plugin-selection-toolbar';
|
|
@@ -48,6 +49,7 @@ export type HyperlinkPluginDependencies = [
|
|
|
48
49
|
OptionalPlugin<AnalyticsPlugin>,
|
|
49
50
|
OptionalPlugin<CardPlugin>,
|
|
50
51
|
OptionalPlugin<EditorViewModePlugin>,
|
|
52
|
+
OptionalPlugin<ConnectivityPlugin>,
|
|
51
53
|
OptionalPlugin<PrimaryToolbarPlugin>,
|
|
52
54
|
OptionalPlugin<SelectionToolbarPlugin>
|
|
53
55
|
];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { HyperlinkAddToolbarProps } from '@atlaskit/editor-common/link';
|
|
3
3
|
import type { ExtractInjectionAPI, FloatingToolbarHandler, HyperlinkPluginOptions } from '@atlaskit/editor-common/types';
|
|
4
|
-
import type {
|
|
4
|
+
import type { HyperlinkPlugin } from '../../hyperlinkPluginType';
|
|
5
5
|
export declare function HyperlinkAddToolbarWithState({ linkPickerOptions, onSubmit, displayText, displayUrl, providerFactory, view, onCancel, invokeMethod, lpLinkPicker, onClose, onEscapeCallback, onClickAwayCallback, pluginInjectionApi, }: HyperlinkAddToolbarProps & {
|
|
6
|
-
pluginInjectionApi:
|
|
6
|
+
pluginInjectionApi: ExtractInjectionAPI<HyperlinkPlugin> | undefined;
|
|
7
7
|
}): React.JSX.Element;
|
|
8
|
-
export declare const getToolbarConfig: (options: HyperlinkPluginOptions, pluginInjectionApi: ExtractInjectionAPI<
|
|
8
|
+
export declare const getToolbarConfig: (options: HyperlinkPluginOptions, pluginInjectionApi: ExtractInjectionAPI<HyperlinkPlugin> | undefined) => FloatingToolbarHandler;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-hyperlink",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Hyperlink plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,30 +32,31 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^47.2.1",
|
|
35
|
-
"@atlaskit/analytics-next": "^
|
|
36
|
-
"@atlaskit/editor-common": "^
|
|
37
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
38
|
-
"@atlaskit/editor-plugin-card": "
|
|
39
|
-
"@atlaskit/editor-plugin-
|
|
40
|
-
"@atlaskit/editor-plugin-
|
|
41
|
-
"@atlaskit/editor-plugin-
|
|
35
|
+
"@atlaskit/analytics-next": "^11.0.0",
|
|
36
|
+
"@atlaskit/editor-common": "^100.1.0",
|
|
37
|
+
"@atlaskit/editor-plugin-analytics": "^2.0.0",
|
|
38
|
+
"@atlaskit/editor-plugin-card": "5.0.1",
|
|
39
|
+
"@atlaskit/editor-plugin-connectivity": "^2.0.0",
|
|
40
|
+
"@atlaskit/editor-plugin-editor-viewmode": "^3.0.0",
|
|
41
|
+
"@atlaskit/editor-plugin-primary-toolbar": "^3.0.0",
|
|
42
|
+
"@atlaskit/editor-plugin-selection-toolbar": "^2.0.0",
|
|
42
43
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
43
|
-
"@atlaskit/icon": "^
|
|
44
|
+
"@atlaskit/icon": "^24.0.0",
|
|
44
45
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
45
46
|
"@atlaskit/prosemirror-input-rules": "^3.3.0",
|
|
46
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
47
|
+
"@atlaskit/tmp-editor-statsig": "^3.1.0",
|
|
47
48
|
"@babel/runtime": "^7.0.0",
|
|
48
49
|
"uuid": "^3.1.0"
|
|
49
50
|
},
|
|
50
51
|
"peerDependencies": {
|
|
51
|
-
"react": "^
|
|
52
|
-
"react-dom": "^
|
|
52
|
+
"react": "^18.2.0",
|
|
53
|
+
"react-dom": "^18.2.0",
|
|
53
54
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
56
57
|
"@atlaskit/activity-provider": "^2.5.0",
|
|
57
|
-
"@atlaskit/link-test-helpers": "^
|
|
58
|
-
"@atlaskit/media-test-helpers": "^
|
|
58
|
+
"@atlaskit/link-test-helpers": "^8.0.0",
|
|
59
|
+
"@atlaskit/media-test-helpers": "^35.0.0",
|
|
59
60
|
"@atlaskit/ssr": "*",
|
|
60
61
|
"@atlaskit/util-data-test": "^18.0.0",
|
|
61
62
|
"@atlaskit/visual-regression": "*",
|