@atlaskit/editor-plugin-hyperlink 3.4.5 → 3.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 +24 -0
- package/dist/cjs/hyperlinkPlugin.js +42 -15
- package/dist/cjs/ui/PrimaryToolbarComponent.js +46 -0
- package/dist/es2019/hyperlinkPlugin.js +42 -15
- package/dist/es2019/ui/PrimaryToolbarComponent.js +44 -0
- package/dist/esm/hyperlinkPlugin.js +42 -15
- package/dist/esm/ui/PrimaryToolbarComponent.js +39 -0
- package/dist/types/hyperlinkPluginType.d.ts +5 -1
- package/dist/types/ui/PrimaryToolbarComponent.d.ts +17 -0
- package/dist/types-ts4.5/hyperlinkPluginType.d.ts +5 -1
- package/dist/types-ts4.5/ui/PrimaryToolbarComponent.d.ts +17 -0
- package/package.json +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-hyperlink
|
|
2
2
|
|
|
3
|
+
## 3.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#116949](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/116949)
|
|
8
|
+
[`9154f7b89e3d2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9154f7b89e3d2) -
|
|
9
|
+
[ux] ED-26674 Hiding contextual toolbar menu items when the menu is docked to top
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 3.5.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [#116013](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/116013)
|
|
20
|
+
[`18e022766bfd3`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/18e022766bfd3) -
|
|
21
|
+
[ux] ED-26464 Hiding primary toolbar and docking contextual toolbar items to top
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
3
27
|
## 3.4.5
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -22,6 +22,7 @@ var _inputRule = require("./pm-plugins/input-rule");
|
|
|
22
22
|
var _keymap = require("./pm-plugins/keymap");
|
|
23
23
|
var _main = require("./pm-plugins/main");
|
|
24
24
|
var _toolbarButtons = require("./pm-plugins/toolbar-buttons");
|
|
25
|
+
var _PrimaryToolbarComponent = require("./ui/PrimaryToolbarComponent");
|
|
25
26
|
var _Toolbar = require("./ui/toolbar/Toolbar");
|
|
26
27
|
var getPosFromActiveLinkMark = function getPosFromActiveLinkMark(state) {
|
|
27
28
|
if (state === undefined) {
|
|
@@ -45,6 +46,23 @@ var hyperlinkPlugin = exports.hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
45
46
|
var _ref$config = _ref.config,
|
|
46
47
|
options = _ref$config === void 0 ? {} : _ref$config,
|
|
47
48
|
api = _ref.api;
|
|
49
|
+
var primaryToolbarComponent;
|
|
50
|
+
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
|
|
51
|
+
exposure: true
|
|
52
|
+
})) {
|
|
53
|
+
var _api$primaryToolbar;
|
|
54
|
+
primaryToolbarComponent = function primaryToolbarComponent() {
|
|
55
|
+
var _api$analytics;
|
|
56
|
+
return /*#__PURE__*/_react.default.createElement(_PrimaryToolbarComponent.PrimaryToolbarComponent, {
|
|
57
|
+
api: api,
|
|
58
|
+
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
api === null || api === void 0 || (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 || _api$primaryToolbar.actions.registerComponent({
|
|
62
|
+
name: 'hyperlink',
|
|
63
|
+
component: primaryToolbarComponent
|
|
64
|
+
});
|
|
65
|
+
}
|
|
48
66
|
return {
|
|
49
67
|
name: 'hyperlink',
|
|
50
68
|
marks: function marks() {
|
|
@@ -55,9 +73,9 @@ var hyperlinkPlugin = exports.hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
55
73
|
},
|
|
56
74
|
commands: {
|
|
57
75
|
showLinkToolbar: function showLinkToolbar() {
|
|
58
|
-
var _api$
|
|
76
|
+
var _api$analytics2;
|
|
59
77
|
var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.TOOLBAR;
|
|
60
|
-
return (0, _commands.showLinkToolbar)(inputMethod, api === null || api === void 0 || (_api$
|
|
78
|
+
return (0, _commands.showLinkToolbar)(inputMethod, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
|
|
61
79
|
},
|
|
62
80
|
updateLink: function updateLink(href, text) {
|
|
63
81
|
var _api$hyperlink;
|
|
@@ -71,7 +89,7 @@ var hyperlinkPlugin = exports.hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
71
89
|
return (0, _commands.updateLinkEditorCommand)(href, text, pos);
|
|
72
90
|
},
|
|
73
91
|
removeLink: function removeLink() {
|
|
74
|
-
var _api$hyperlink2, _api$
|
|
92
|
+
var _api$hyperlink2, _api$analytics3;
|
|
75
93
|
var linkMark = api === null || api === void 0 || (_api$hyperlink2 = api.hyperlink) === null || _api$hyperlink2 === void 0 || (_api$hyperlink2 = _api$hyperlink2.sharedState.currentState()) === null || _api$hyperlink2 === void 0 ? void 0 : _api$hyperlink2.activeLinkMark;
|
|
76
94
|
var pos = getPosFromActiveLinkMark(linkMark);
|
|
77
95
|
if (pos === undefined) {
|
|
@@ -79,17 +97,17 @@ var hyperlinkPlugin = exports.hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
79
97
|
return null;
|
|
80
98
|
};
|
|
81
99
|
}
|
|
82
|
-
return (0, _commands.removeLinkEditorCommand)(pos, api === null || api === void 0 || (_api$
|
|
100
|
+
return (0, _commands.removeLinkEditorCommand)(pos, api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
|
|
83
101
|
}
|
|
84
102
|
},
|
|
85
103
|
actions: {
|
|
86
104
|
hideLinkToolbar: _commands.hideLinkToolbarSetMeta,
|
|
87
105
|
insertLink: function insertLink(inputMethod, from, to, href, title, displayText) {
|
|
88
|
-
var _api$card, _api$
|
|
106
|
+
var _api$card, _api$analytics4;
|
|
89
107
|
var cardsAvailable = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
90
108
|
var sourceEvent = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : undefined;
|
|
91
109
|
var appearance = arguments.length > 8 ? arguments[8] : undefined;
|
|
92
|
-
return (0, _commands.insertLinkWithAnalytics)(inputMethod, from, to, href, api === null || api === void 0 || (_api$card = api.card) === null || _api$card === void 0 ? void 0 : _api$card.actions, api === null || api === void 0 || (_api$
|
|
110
|
+
return (0, _commands.insertLinkWithAnalytics)(inputMethod, from, to, href, api === null || api === void 0 || (_api$card = api.card) === null || _api$card === void 0 ? void 0 : _api$card.actions, api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions, title, displayText, cardsAvailable, sourceEvent, appearance);
|
|
93
111
|
},
|
|
94
112
|
updateLink: _commands.updateLink
|
|
95
113
|
},
|
|
@@ -117,15 +135,15 @@ var hyperlinkPlugin = exports.hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
117
135
|
}, {
|
|
118
136
|
name: 'hyperlinkInputRule',
|
|
119
137
|
plugin: function plugin(_ref3) {
|
|
120
|
-
var _api$
|
|
138
|
+
var _api$analytics5;
|
|
121
139
|
var schema = _ref3.schema;
|
|
122
|
-
return (0, _inputRule.createInputRulePlugin)(schema, api === null || api === void 0 || (_api$
|
|
140
|
+
return (0, _inputRule.createInputRulePlugin)(schema, api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions);
|
|
123
141
|
}
|
|
124
142
|
}, {
|
|
125
143
|
name: 'hyperlinkKeymap',
|
|
126
144
|
plugin: function plugin() {
|
|
127
|
-
var _api$
|
|
128
|
-
return (0, _keymap.createKeymapPlugin)(api === null || api === void 0 || (_api$
|
|
145
|
+
var _api$analytics6;
|
|
146
|
+
return (0, _keymap.createKeymapPlugin)(api === null || api === void 0 || (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions);
|
|
129
147
|
}
|
|
130
148
|
}, {
|
|
131
149
|
name: 'hyperlinkToolbarButtons',
|
|
@@ -152,13 +170,13 @@ var hyperlinkPlugin = exports.hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
152
170
|
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconLink, null);
|
|
153
171
|
},
|
|
154
172
|
action: function action(insert, state) {
|
|
155
|
-
var _api$
|
|
173
|
+
var _api$analytics7, _api$analytics7$attac;
|
|
156
174
|
var tr = insert(undefined);
|
|
157
175
|
tr.setMeta(_main.stateKey, {
|
|
158
176
|
type: _link.LinkAction.SHOW_INSERT_TOOLBAR,
|
|
159
177
|
inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
|
|
160
178
|
});
|
|
161
|
-
var analyticsAttached = api === null || api === void 0 || (_api$
|
|
179
|
+
var analyticsAttached = api === null || api === void 0 || (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 || (_api$analytics7 = _api$analytics7.actions) === null || _api$analytics7 === void 0 || (_api$analytics7$attac = _api$analytics7.attachAnalyticsEvent) === null || _api$analytics7$attac === void 0 ? void 0 : _api$analytics7$attac.call(_api$analytics7, {
|
|
162
180
|
action: _analytics.ACTION.INVOKED,
|
|
163
181
|
actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD,
|
|
164
182
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.TYPEAHEAD_LINK,
|
|
@@ -173,7 +191,13 @@ var hyperlinkPlugin = exports.hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
173
191
|
},
|
|
174
192
|
floatingToolbar: (0, _Toolbar.getToolbarConfig)(options, api),
|
|
175
193
|
selectionToolbar: function selectionToolbar(state, _ref5) {
|
|
194
|
+
var _api$selectionToolbar;
|
|
176
195
|
var formatMessage = _ref5.formatMessage;
|
|
196
|
+
if ((api === null || api === void 0 || (_api$selectionToolbar = api.selectionToolbar) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.sharedState) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.currentState()) === null || _api$selectionToolbar === void 0 ? void 0 : _api$selectionToolbar.toolbarDocking) === 'top' && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
|
|
197
|
+
exposure: true
|
|
198
|
+
})) {
|
|
199
|
+
return undefined;
|
|
200
|
+
}
|
|
177
201
|
if ((0, _experiments.editorExperiment)('contextual_formatting_toolbar', true, {
|
|
178
202
|
exposure: true
|
|
179
203
|
}) || (0, _experiments.editorExperiment)('platform_editor_contextual_formatting_toolbar_v2', 'variant1', {
|
|
@@ -196,8 +220,8 @@ var hyperlinkPlugin = exports.hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
196
220
|
tooltipContent: (0, _keymaps.tooltip)(_keymaps.addLink, title),
|
|
197
221
|
showTitle: false,
|
|
198
222
|
onClick: function onClick(state, dispatch) {
|
|
199
|
-
var _api$
|
|
200
|
-
return (0, _preset.editorCommandToPMCommand)((0, _commands.showLinkToolbar)(_analytics.INPUT_METHOD.FLOATING_TB, api === null || api === void 0 || (_api$
|
|
223
|
+
var _api$analytics8;
|
|
224
|
+
return (0, _preset.editorCommandToPMCommand)((0, _commands.showLinkToolbar)(_analytics.INPUT_METHOD.FLOATING_TB, api === null || api === void 0 || (_api$analytics8 = api.analytics) === null || _api$analytics8 === void 0 ? void 0 : _api$analytics8.actions))(state, dispatch);
|
|
201
225
|
}
|
|
202
226
|
};
|
|
203
227
|
};
|
|
@@ -209,7 +233,10 @@ var hyperlinkPlugin = exports.hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
209
233
|
} else {
|
|
210
234
|
return undefined;
|
|
211
235
|
}
|
|
212
|
-
}
|
|
236
|
+
},
|
|
237
|
+
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
|
|
238
|
+
exposure: true
|
|
239
|
+
}) ? primaryToolbarComponent : undefined
|
|
213
240
|
}
|
|
214
241
|
};
|
|
215
242
|
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.PrimaryToolbarComponent = void 0;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _react2 = require("@emotion/react");
|
|
10
|
+
var _reactIntlNext = require("react-intl-next");
|
|
11
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
|
+
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
13
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
14
|
+
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
15
|
+
var _link = _interopRequireDefault(require("@atlaskit/icon/core/link"));
|
|
16
|
+
/**
|
|
17
|
+
* @jsxRuntime classic
|
|
18
|
+
* @jsx jsx
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
22
|
+
|
|
23
|
+
var PrimaryToolbarComponentWithIntl = function PrimaryToolbarComponentWithIntl(_ref) {
|
|
24
|
+
var api = _ref.api,
|
|
25
|
+
intl = _ref.intl;
|
|
26
|
+
var formatMessage = intl.formatMessage;
|
|
27
|
+
var content = formatMessage(_messages.toolbarInsertBlockMessages.link);
|
|
28
|
+
var onClick = (0, _react.useCallback)(function () {
|
|
29
|
+
var _api$core, _api$hyperlink;
|
|
30
|
+
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$hyperlink = api.hyperlink) === null || _api$hyperlink === void 0 ? void 0 : _api$hyperlink.commands.showLinkToolbar(_analytics.INPUT_METHOD.TOOLBAR));
|
|
31
|
+
}, [api]);
|
|
32
|
+
return (0, _react2.jsx)("div", null, (0, _react2.jsx)(_uiMenu.ToolbarButton, {
|
|
33
|
+
onClick: onClick,
|
|
34
|
+
"aria-haspopup": "dialog",
|
|
35
|
+
"aria-keyshortcuts": (0, _keymaps.getAriaKeyshortcuts)(_keymaps.addLink),
|
|
36
|
+
"aria-label": content,
|
|
37
|
+
testId: content,
|
|
38
|
+
spacing: "default",
|
|
39
|
+
title: content
|
|
40
|
+
}, (0, _react2.jsx)(_link.default, {
|
|
41
|
+
label: "",
|
|
42
|
+
color: "currentColor",
|
|
43
|
+
spacing: "none"
|
|
44
|
+
})));
|
|
45
|
+
};
|
|
46
|
+
var PrimaryToolbarComponent = exports.PrimaryToolbarComponent = (0, _reactIntlNext.injectIntl)(PrimaryToolbarComponentWithIntl);
|
|
@@ -15,6 +15,7 @@ import { createInputRulePlugin } from './pm-plugins/input-rule';
|
|
|
15
15
|
import { createKeymapPlugin } from './pm-plugins/keymap';
|
|
16
16
|
import { plugin, stateKey } from './pm-plugins/main';
|
|
17
17
|
import { toolbarButtonsPlugin } from './pm-plugins/toolbar-buttons';
|
|
18
|
+
import { PrimaryToolbarComponent } from './ui/PrimaryToolbarComponent';
|
|
18
19
|
import { getToolbarConfig } from './ui/toolbar/Toolbar';
|
|
19
20
|
const getPosFromActiveLinkMark = state => {
|
|
20
21
|
if (state === undefined) {
|
|
@@ -38,6 +39,23 @@ export const hyperlinkPlugin = ({
|
|
|
38
39
|
config: options = {},
|
|
39
40
|
api
|
|
40
41
|
}) => {
|
|
42
|
+
let primaryToolbarComponent;
|
|
43
|
+
if (editorExperiment('platform_editor_controls', 'variant1', {
|
|
44
|
+
exposure: true
|
|
45
|
+
})) {
|
|
46
|
+
var _api$primaryToolbar;
|
|
47
|
+
primaryToolbarComponent = () => {
|
|
48
|
+
var _api$analytics;
|
|
49
|
+
return /*#__PURE__*/React.createElement(PrimaryToolbarComponent, {
|
|
50
|
+
api: api,
|
|
51
|
+
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
api === null || api === void 0 ? void 0 : (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 ? void 0 : _api$primaryToolbar.actions.registerComponent({
|
|
55
|
+
name: 'hyperlink',
|
|
56
|
+
component: primaryToolbarComponent
|
|
57
|
+
});
|
|
58
|
+
}
|
|
41
59
|
return {
|
|
42
60
|
name: 'hyperlink',
|
|
43
61
|
marks() {
|
|
@@ -48,8 +66,8 @@ export const hyperlinkPlugin = ({
|
|
|
48
66
|
},
|
|
49
67
|
commands: {
|
|
50
68
|
showLinkToolbar: (inputMethod = INPUT_METHOD.TOOLBAR) => {
|
|
51
|
-
var _api$
|
|
52
|
-
return showLinkToolbar(inputMethod, api === null || api === void 0 ? void 0 : (_api$
|
|
69
|
+
var _api$analytics2;
|
|
70
|
+
return showLinkToolbar(inputMethod, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
|
|
53
71
|
},
|
|
54
72
|
updateLink: (href, text) => {
|
|
55
73
|
var _api$hyperlink, _api$hyperlink$shared;
|
|
@@ -61,20 +79,20 @@ export const hyperlinkPlugin = ({
|
|
|
61
79
|
return updateLinkEditorCommand(href, text, pos);
|
|
62
80
|
},
|
|
63
81
|
removeLink: () => {
|
|
64
|
-
var _api$hyperlink2, _api$hyperlink2$share, _api$
|
|
82
|
+
var _api$hyperlink2, _api$hyperlink2$share, _api$analytics3;
|
|
65
83
|
const linkMark = api === null || api === void 0 ? void 0 : (_api$hyperlink2 = api.hyperlink) === null || _api$hyperlink2 === void 0 ? void 0 : (_api$hyperlink2$share = _api$hyperlink2.sharedState.currentState()) === null || _api$hyperlink2$share === void 0 ? void 0 : _api$hyperlink2$share.activeLinkMark;
|
|
66
84
|
const pos = getPosFromActiveLinkMark(linkMark);
|
|
67
85
|
if (pos === undefined) {
|
|
68
86
|
return () => null;
|
|
69
87
|
}
|
|
70
|
-
return removeLinkEditorCommand(pos, api === null || api === void 0 ? void 0 : (_api$
|
|
88
|
+
return removeLinkEditorCommand(pos, api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
|
|
71
89
|
}
|
|
72
90
|
},
|
|
73
91
|
actions: {
|
|
74
92
|
hideLinkToolbar: hideLinkToolbarSetMeta,
|
|
75
93
|
insertLink: (inputMethod, from, to, href, title, displayText, cardsAvailable = false, sourceEvent = undefined, appearance) => {
|
|
76
|
-
var _api$card, _api$
|
|
77
|
-
return insertLinkWithAnalytics(inputMethod, from, to, href, api === null || api === void 0 ? void 0 : (_api$card = api.card) === null || _api$card === void 0 ? void 0 : _api$card.actions, api === null || api === void 0 ? void 0 : (_api$
|
|
94
|
+
var _api$card, _api$analytics4;
|
|
95
|
+
return insertLinkWithAnalytics(inputMethod, from, to, href, api === null || api === void 0 ? void 0 : (_api$card = api.card) === null || _api$card === void 0 ? void 0 : _api$card.actions, api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions, title, displayText, cardsAvailable, sourceEvent, appearance);
|
|
78
96
|
},
|
|
79
97
|
updateLink: updateLink
|
|
80
98
|
},
|
|
@@ -101,14 +119,14 @@ export const hyperlinkPlugin = ({
|
|
|
101
119
|
plugin: ({
|
|
102
120
|
schema
|
|
103
121
|
}) => {
|
|
104
|
-
var _api$
|
|
105
|
-
return createInputRulePlugin(schema, api === null || api === void 0 ? void 0 : (_api$
|
|
122
|
+
var _api$analytics5;
|
|
123
|
+
return createInputRulePlugin(schema, api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions);
|
|
106
124
|
}
|
|
107
125
|
}, {
|
|
108
126
|
name: 'hyperlinkKeymap',
|
|
109
127
|
plugin: () => {
|
|
110
|
-
var _api$
|
|
111
|
-
return createKeymapPlugin(api === null || api === void 0 ? void 0 : (_api$
|
|
128
|
+
var _api$analytics6;
|
|
129
|
+
return createKeymapPlugin(api === null || api === void 0 ? void 0 : (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions);
|
|
112
130
|
}
|
|
113
131
|
}, {
|
|
114
132
|
name: 'hyperlinkToolbarButtons',
|
|
@@ -133,13 +151,13 @@ export const hyperlinkPlugin = ({
|
|
|
133
151
|
keyshortcut: tooltip(addLink),
|
|
134
152
|
icon: () => /*#__PURE__*/React.createElement(IconLink, null),
|
|
135
153
|
action(insert, state) {
|
|
136
|
-
var _api$
|
|
154
|
+
var _api$analytics7, _api$analytics7$actio, _api$analytics7$actio2;
|
|
137
155
|
const tr = insert(undefined);
|
|
138
156
|
tr.setMeta(stateKey, {
|
|
139
157
|
type: LinkAction.SHOW_INSERT_TOOLBAR,
|
|
140
158
|
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
141
159
|
});
|
|
142
|
-
const analyticsAttached = api === null || api === void 0 ? void 0 : (_api$
|
|
160
|
+
const analyticsAttached = api === null || api === void 0 ? void 0 : (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 ? void 0 : (_api$analytics7$actio = _api$analytics7.actions) === null || _api$analytics7$actio === void 0 ? void 0 : (_api$analytics7$actio2 = _api$analytics7$actio.attachAnalyticsEvent) === null || _api$analytics7$actio2 === void 0 ? void 0 : _api$analytics7$actio2.call(_api$analytics7$actio, {
|
|
143
161
|
action: ACTION.INVOKED,
|
|
144
162
|
actionSubject: ACTION_SUBJECT.TYPEAHEAD,
|
|
145
163
|
actionSubjectId: ACTION_SUBJECT_ID.TYPEAHEAD_LINK,
|
|
@@ -155,6 +173,12 @@ export const hyperlinkPlugin = ({
|
|
|
155
173
|
selectionToolbar: (state, {
|
|
156
174
|
formatMessage
|
|
157
175
|
}) => {
|
|
176
|
+
var _api$selectionToolbar, _api$selectionToolbar2, _api$selectionToolbar3;
|
|
177
|
+
if ((api === null || api === void 0 ? void 0 : (_api$selectionToolbar = api.selectionToolbar) === null || _api$selectionToolbar === void 0 ? void 0 : (_api$selectionToolbar2 = _api$selectionToolbar.sharedState) === null || _api$selectionToolbar2 === void 0 ? void 0 : (_api$selectionToolbar3 = _api$selectionToolbar2.currentState()) === null || _api$selectionToolbar3 === void 0 ? void 0 : _api$selectionToolbar3.toolbarDocking) === 'top' && editorExperiment('platform_editor_controls', 'variant1', {
|
|
178
|
+
exposure: true
|
|
179
|
+
})) {
|
|
180
|
+
return undefined;
|
|
181
|
+
}
|
|
158
182
|
if (editorExperiment('contextual_formatting_toolbar', true, {
|
|
159
183
|
exposure: true
|
|
160
184
|
}) || editorExperiment('platform_editor_contextual_formatting_toolbar_v2', 'variant1', {
|
|
@@ -178,8 +202,8 @@ export const hyperlinkPlugin = ({
|
|
|
178
202
|
tooltipContent: tooltip(addLink, title),
|
|
179
203
|
showTitle: false,
|
|
180
204
|
onClick: (state, dispatch) => {
|
|
181
|
-
var _api$
|
|
182
|
-
return editorCommandToPMCommand(showLinkToolbar(INPUT_METHOD.FLOATING_TB, api === null || api === void 0 ? void 0 : (_api$
|
|
205
|
+
var _api$analytics8;
|
|
206
|
+
return editorCommandToPMCommand(showLinkToolbar(INPUT_METHOD.FLOATING_TB, api === null || api === void 0 ? void 0 : (_api$analytics8 = api.analytics) === null || _api$analytics8 === void 0 ? void 0 : _api$analytics8.actions))(state, dispatch);
|
|
183
207
|
}
|
|
184
208
|
};
|
|
185
209
|
};
|
|
@@ -191,7 +215,10 @@ export const hyperlinkPlugin = ({
|
|
|
191
215
|
} else {
|
|
192
216
|
return undefined;
|
|
193
217
|
}
|
|
194
|
-
}
|
|
218
|
+
},
|
|
219
|
+
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) && editorExperiment('platform_editor_controls', 'variant1', {
|
|
220
|
+
exposure: true
|
|
221
|
+
}) ? primaryToolbarComponent : undefined
|
|
195
222
|
}
|
|
196
223
|
};
|
|
197
224
|
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { useCallback } from 'react';
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
|
+
import { jsx } from '@emotion/react';
|
|
10
|
+
import { injectIntl } from 'react-intl-next';
|
|
11
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
12
|
+
import { addLink, getAriaKeyshortcuts } from '@atlaskit/editor-common/keymaps';
|
|
13
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
14
|
+
import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
15
|
+
import LinkIcon from '@atlaskit/icon/core/link';
|
|
16
|
+
const PrimaryToolbarComponentWithIntl = ({
|
|
17
|
+
api,
|
|
18
|
+
// TODO - Analytics
|
|
19
|
+
// editorAnalyticsAPI,
|
|
20
|
+
intl
|
|
21
|
+
}) => {
|
|
22
|
+
const {
|
|
23
|
+
formatMessage
|
|
24
|
+
} = intl;
|
|
25
|
+
const content = formatMessage(messages.link);
|
|
26
|
+
const onClick = useCallback(() => {
|
|
27
|
+
var _api$core, _api$hyperlink;
|
|
28
|
+
api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 ? void 0 : (_api$hyperlink = api.hyperlink) === null || _api$hyperlink === void 0 ? void 0 : _api$hyperlink.commands.showLinkToolbar(INPUT_METHOD.TOOLBAR));
|
|
29
|
+
}, [api]);
|
|
30
|
+
return jsx("div", null, jsx(ToolbarButton, {
|
|
31
|
+
onClick: onClick,
|
|
32
|
+
"aria-haspopup": "dialog",
|
|
33
|
+
"aria-keyshortcuts": getAriaKeyshortcuts(addLink),
|
|
34
|
+
"aria-label": content,
|
|
35
|
+
testId: content,
|
|
36
|
+
spacing: "default",
|
|
37
|
+
title: content
|
|
38
|
+
}, jsx(LinkIcon, {
|
|
39
|
+
label: "",
|
|
40
|
+
color: "currentColor",
|
|
41
|
+
spacing: "none"
|
|
42
|
+
})));
|
|
43
|
+
};
|
|
44
|
+
export const PrimaryToolbarComponent = injectIntl(PrimaryToolbarComponentWithIntl);
|
|
@@ -15,6 +15,7 @@ import { createInputRulePlugin } from './pm-plugins/input-rule';
|
|
|
15
15
|
import { createKeymapPlugin } from './pm-plugins/keymap';
|
|
16
16
|
import { plugin as _plugin, stateKey } from './pm-plugins/main';
|
|
17
17
|
import { toolbarButtonsPlugin } from './pm-plugins/toolbar-buttons';
|
|
18
|
+
import { PrimaryToolbarComponent } from './ui/PrimaryToolbarComponent';
|
|
18
19
|
import { getToolbarConfig } from './ui/toolbar/Toolbar';
|
|
19
20
|
var getPosFromActiveLinkMark = function getPosFromActiveLinkMark(state) {
|
|
20
21
|
if (state === undefined) {
|
|
@@ -38,6 +39,23 @@ export var hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
38
39
|
var _ref$config = _ref.config,
|
|
39
40
|
options = _ref$config === void 0 ? {} : _ref$config,
|
|
40
41
|
api = _ref.api;
|
|
42
|
+
var primaryToolbarComponent;
|
|
43
|
+
if (editorExperiment('platform_editor_controls', 'variant1', {
|
|
44
|
+
exposure: true
|
|
45
|
+
})) {
|
|
46
|
+
var _api$primaryToolbar;
|
|
47
|
+
primaryToolbarComponent = function primaryToolbarComponent() {
|
|
48
|
+
var _api$analytics;
|
|
49
|
+
return /*#__PURE__*/React.createElement(PrimaryToolbarComponent, {
|
|
50
|
+
api: api,
|
|
51
|
+
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
api === null || api === void 0 || (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 || _api$primaryToolbar.actions.registerComponent({
|
|
55
|
+
name: 'hyperlink',
|
|
56
|
+
component: primaryToolbarComponent
|
|
57
|
+
});
|
|
58
|
+
}
|
|
41
59
|
return {
|
|
42
60
|
name: 'hyperlink',
|
|
43
61
|
marks: function marks() {
|
|
@@ -48,9 +66,9 @@ export var hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
48
66
|
},
|
|
49
67
|
commands: {
|
|
50
68
|
showLinkToolbar: function showLinkToolbar() {
|
|
51
|
-
var _api$
|
|
69
|
+
var _api$analytics2;
|
|
52
70
|
var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INPUT_METHOD.TOOLBAR;
|
|
53
|
-
return _showLinkToolbar(inputMethod, api === null || api === void 0 || (_api$
|
|
71
|
+
return _showLinkToolbar(inputMethod, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
|
|
54
72
|
},
|
|
55
73
|
updateLink: function updateLink(href, text) {
|
|
56
74
|
var _api$hyperlink;
|
|
@@ -64,7 +82,7 @@ export var hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
64
82
|
return updateLinkEditorCommand(href, text, pos);
|
|
65
83
|
},
|
|
66
84
|
removeLink: function removeLink() {
|
|
67
|
-
var _api$hyperlink2, _api$
|
|
85
|
+
var _api$hyperlink2, _api$analytics3;
|
|
68
86
|
var linkMark = api === null || api === void 0 || (_api$hyperlink2 = api.hyperlink) === null || _api$hyperlink2 === void 0 || (_api$hyperlink2 = _api$hyperlink2.sharedState.currentState()) === null || _api$hyperlink2 === void 0 ? void 0 : _api$hyperlink2.activeLinkMark;
|
|
69
87
|
var pos = getPosFromActiveLinkMark(linkMark);
|
|
70
88
|
if (pos === undefined) {
|
|
@@ -72,17 +90,17 @@ export var hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
72
90
|
return null;
|
|
73
91
|
};
|
|
74
92
|
}
|
|
75
|
-
return removeLinkEditorCommand(pos, api === null || api === void 0 || (_api$
|
|
93
|
+
return removeLinkEditorCommand(pos, api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
|
|
76
94
|
}
|
|
77
95
|
},
|
|
78
96
|
actions: {
|
|
79
97
|
hideLinkToolbar: hideLinkToolbarSetMeta,
|
|
80
98
|
insertLink: function insertLink(inputMethod, from, to, href, title, displayText) {
|
|
81
|
-
var _api$card, _api$
|
|
99
|
+
var _api$card, _api$analytics4;
|
|
82
100
|
var cardsAvailable = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
83
101
|
var sourceEvent = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : undefined;
|
|
84
102
|
var appearance = arguments.length > 8 ? arguments[8] : undefined;
|
|
85
|
-
return insertLinkWithAnalytics(inputMethod, from, to, href, api === null || api === void 0 || (_api$card = api.card) === null || _api$card === void 0 ? void 0 : _api$card.actions, api === null || api === void 0 || (_api$
|
|
103
|
+
return insertLinkWithAnalytics(inputMethod, from, to, href, api === null || api === void 0 || (_api$card = api.card) === null || _api$card === void 0 ? void 0 : _api$card.actions, api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions, title, displayText, cardsAvailable, sourceEvent, appearance);
|
|
86
104
|
},
|
|
87
105
|
updateLink: updateLink
|
|
88
106
|
},
|
|
@@ -110,15 +128,15 @@ export var hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
110
128
|
}, {
|
|
111
129
|
name: 'hyperlinkInputRule',
|
|
112
130
|
plugin: function plugin(_ref3) {
|
|
113
|
-
var _api$
|
|
131
|
+
var _api$analytics5;
|
|
114
132
|
var schema = _ref3.schema;
|
|
115
|
-
return createInputRulePlugin(schema, api === null || api === void 0 || (_api$
|
|
133
|
+
return createInputRulePlugin(schema, api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions);
|
|
116
134
|
}
|
|
117
135
|
}, {
|
|
118
136
|
name: 'hyperlinkKeymap',
|
|
119
137
|
plugin: function plugin() {
|
|
120
|
-
var _api$
|
|
121
|
-
return createKeymapPlugin(api === null || api === void 0 || (_api$
|
|
138
|
+
var _api$analytics6;
|
|
139
|
+
return createKeymapPlugin(api === null || api === void 0 || (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions);
|
|
122
140
|
}
|
|
123
141
|
}, {
|
|
124
142
|
name: 'hyperlinkToolbarButtons',
|
|
@@ -145,13 +163,13 @@ export var hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
145
163
|
return /*#__PURE__*/React.createElement(IconLink, null);
|
|
146
164
|
},
|
|
147
165
|
action: function action(insert, state) {
|
|
148
|
-
var _api$
|
|
166
|
+
var _api$analytics7, _api$analytics7$attac;
|
|
149
167
|
var tr = insert(undefined);
|
|
150
168
|
tr.setMeta(stateKey, {
|
|
151
169
|
type: LinkAction.SHOW_INSERT_TOOLBAR,
|
|
152
170
|
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
153
171
|
});
|
|
154
|
-
var analyticsAttached = api === null || api === void 0 || (_api$
|
|
172
|
+
var analyticsAttached = api === null || api === void 0 || (_api$analytics7 = api.analytics) === null || _api$analytics7 === void 0 || (_api$analytics7 = _api$analytics7.actions) === null || _api$analytics7 === void 0 || (_api$analytics7$attac = _api$analytics7.attachAnalyticsEvent) === null || _api$analytics7$attac === void 0 ? void 0 : _api$analytics7$attac.call(_api$analytics7, {
|
|
155
173
|
action: ACTION.INVOKED,
|
|
156
174
|
actionSubject: ACTION_SUBJECT.TYPEAHEAD,
|
|
157
175
|
actionSubjectId: ACTION_SUBJECT_ID.TYPEAHEAD_LINK,
|
|
@@ -166,7 +184,13 @@ export var hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
166
184
|
},
|
|
167
185
|
floatingToolbar: getToolbarConfig(options, api),
|
|
168
186
|
selectionToolbar: function selectionToolbar(state, _ref5) {
|
|
187
|
+
var _api$selectionToolbar;
|
|
169
188
|
var formatMessage = _ref5.formatMessage;
|
|
189
|
+
if ((api === null || api === void 0 || (_api$selectionToolbar = api.selectionToolbar) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.sharedState) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.currentState()) === null || _api$selectionToolbar === void 0 ? void 0 : _api$selectionToolbar.toolbarDocking) === 'top' && editorExperiment('platform_editor_controls', 'variant1', {
|
|
190
|
+
exposure: true
|
|
191
|
+
})) {
|
|
192
|
+
return undefined;
|
|
193
|
+
}
|
|
170
194
|
if (editorExperiment('contextual_formatting_toolbar', true, {
|
|
171
195
|
exposure: true
|
|
172
196
|
}) || editorExperiment('platform_editor_contextual_formatting_toolbar_v2', 'variant1', {
|
|
@@ -189,8 +213,8 @@ export var hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
189
213
|
tooltipContent: tooltip(addLink, title),
|
|
190
214
|
showTitle: false,
|
|
191
215
|
onClick: function onClick(state, dispatch) {
|
|
192
|
-
var _api$
|
|
193
|
-
return editorCommandToPMCommand(_showLinkToolbar(INPUT_METHOD.FLOATING_TB, api === null || api === void 0 || (_api$
|
|
216
|
+
var _api$analytics8;
|
|
217
|
+
return editorCommandToPMCommand(_showLinkToolbar(INPUT_METHOD.FLOATING_TB, api === null || api === void 0 || (_api$analytics8 = api.analytics) === null || _api$analytics8 === void 0 ? void 0 : _api$analytics8.actions))(state, dispatch);
|
|
194
218
|
}
|
|
195
219
|
};
|
|
196
220
|
};
|
|
@@ -202,7 +226,10 @@ export var hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
202
226
|
} else {
|
|
203
227
|
return undefined;
|
|
204
228
|
}
|
|
205
|
-
}
|
|
229
|
+
},
|
|
230
|
+
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) && editorExperiment('platform_editor_controls', 'variant1', {
|
|
231
|
+
exposure: true
|
|
232
|
+
}) ? primaryToolbarComponent : undefined
|
|
206
233
|
}
|
|
207
234
|
};
|
|
208
235
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { useCallback } from 'react';
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
|
+
import { jsx } from '@emotion/react';
|
|
10
|
+
import { injectIntl } from 'react-intl-next';
|
|
11
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
12
|
+
import { addLink, getAriaKeyshortcuts } from '@atlaskit/editor-common/keymaps';
|
|
13
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
14
|
+
import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
15
|
+
import LinkIcon from '@atlaskit/icon/core/link';
|
|
16
|
+
var PrimaryToolbarComponentWithIntl = function PrimaryToolbarComponentWithIntl(_ref) {
|
|
17
|
+
var api = _ref.api,
|
|
18
|
+
intl = _ref.intl;
|
|
19
|
+
var formatMessage = intl.formatMessage;
|
|
20
|
+
var content = formatMessage(messages.link);
|
|
21
|
+
var onClick = useCallback(function () {
|
|
22
|
+
var _api$core, _api$hyperlink;
|
|
23
|
+
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$hyperlink = api.hyperlink) === null || _api$hyperlink === void 0 ? void 0 : _api$hyperlink.commands.showLinkToolbar(INPUT_METHOD.TOOLBAR));
|
|
24
|
+
}, [api]);
|
|
25
|
+
return jsx("div", null, jsx(ToolbarButton, {
|
|
26
|
+
onClick: onClick,
|
|
27
|
+
"aria-haspopup": "dialog",
|
|
28
|
+
"aria-keyshortcuts": getAriaKeyshortcuts(addLink),
|
|
29
|
+
"aria-label": content,
|
|
30
|
+
testId: content,
|
|
31
|
+
spacing: "default",
|
|
32
|
+
title: content
|
|
33
|
+
}, jsx(LinkIcon, {
|
|
34
|
+
label: "",
|
|
35
|
+
color: "currentColor",
|
|
36
|
+
spacing: "none"
|
|
37
|
+
})));
|
|
38
|
+
};
|
|
39
|
+
export var PrimaryToolbarComponent = injectIntl(PrimaryToolbarComponentWithIntl);
|
|
@@ -3,6 +3,8 @@ import type { EditorCommand, HyperlinkPluginOptions, NextEditorPlugin, OptionalP
|
|
|
3
3
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
4
|
import type { CardPlugin } from '@atlaskit/editor-plugin-card';
|
|
5
5
|
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
6
|
+
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
|
|
7
|
+
import type { SelectionToolbarPlugin } from '@atlaskit/editor-plugin-selection-toolbar';
|
|
6
8
|
import type { HideLinkToolbar, InsertLink, ShowLinkToolbar, UpdateLink } from './editor-commands/commands';
|
|
7
9
|
type HyperlinkPluginCommands = {
|
|
8
10
|
/**
|
|
@@ -45,7 +47,9 @@ type HyperlinkPluginCommands = {
|
|
|
45
47
|
export type HyperlinkPluginDependencies = [
|
|
46
48
|
OptionalPlugin<AnalyticsPlugin>,
|
|
47
49
|
OptionalPlugin<CardPlugin>,
|
|
48
|
-
OptionalPlugin<EditorViewModePlugin
|
|
50
|
+
OptionalPlugin<EditorViewModePlugin>,
|
|
51
|
+
OptionalPlugin<PrimaryToolbarPlugin>,
|
|
52
|
+
OptionalPlugin<SelectionToolbarPlugin>
|
|
49
53
|
];
|
|
50
54
|
export type HyperlinkPluginActions = {
|
|
51
55
|
hideLinkToolbar: HideLinkToolbar;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
/// <reference types="react" />
|
|
6
|
+
import type { WrappedComponentProps } from 'react-intl-next';
|
|
7
|
+
import { type EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
8
|
+
import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
9
|
+
import type { HyperlinkPlugin } from '../hyperlinkPluginType';
|
|
10
|
+
type PrimaryToolbarComponentProps = {
|
|
11
|
+
api: ExtractInjectionAPI<HyperlinkPlugin> | undefined;
|
|
12
|
+
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
13
|
+
} & WrappedComponentProps;
|
|
14
|
+
export declare const PrimaryToolbarComponent: import("react").FC<import("react-intl-next").WithIntlProps<PrimaryToolbarComponentProps>> & {
|
|
15
|
+
WrappedComponent: import("react").ComponentType<PrimaryToolbarComponentProps>;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -3,6 +3,8 @@ import type { EditorCommand, HyperlinkPluginOptions, NextEditorPlugin, OptionalP
|
|
|
3
3
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
4
|
import type { CardPlugin } from '@atlaskit/editor-plugin-card';
|
|
5
5
|
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
6
|
+
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
|
|
7
|
+
import type { SelectionToolbarPlugin } from '@atlaskit/editor-plugin-selection-toolbar';
|
|
6
8
|
import type { HideLinkToolbar, InsertLink, ShowLinkToolbar, UpdateLink } from './editor-commands/commands';
|
|
7
9
|
type HyperlinkPluginCommands = {
|
|
8
10
|
/**
|
|
@@ -45,7 +47,9 @@ type HyperlinkPluginCommands = {
|
|
|
45
47
|
export type HyperlinkPluginDependencies = [
|
|
46
48
|
OptionalPlugin<AnalyticsPlugin>,
|
|
47
49
|
OptionalPlugin<CardPlugin>,
|
|
48
|
-
OptionalPlugin<EditorViewModePlugin
|
|
50
|
+
OptionalPlugin<EditorViewModePlugin>,
|
|
51
|
+
OptionalPlugin<PrimaryToolbarPlugin>,
|
|
52
|
+
OptionalPlugin<SelectionToolbarPlugin>
|
|
49
53
|
];
|
|
50
54
|
export type HyperlinkPluginActions = {
|
|
51
55
|
hideLinkToolbar: HideLinkToolbar;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
5
|
+
*/
|
|
6
|
+
import type { WrappedComponentProps } from 'react-intl-next';
|
|
7
|
+
import { type EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
8
|
+
import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
9
|
+
import type { HyperlinkPlugin } from '../hyperlinkPluginType';
|
|
10
|
+
type PrimaryToolbarComponentProps = {
|
|
11
|
+
api: ExtractInjectionAPI<HyperlinkPlugin> | undefined;
|
|
12
|
+
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
13
|
+
} & WrappedComponentProps;
|
|
14
|
+
export declare const PrimaryToolbarComponent: import("react").FC<import("react-intl-next").WithIntlProps<PrimaryToolbarComponentProps>> & {
|
|
15
|
+
WrappedComponent: import("react").ComponentType<PrimaryToolbarComponentProps>;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-hyperlink",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "Hyperlink plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,15 +33,17 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^47.2.1",
|
|
35
35
|
"@atlaskit/analytics-next": "^10.3.0",
|
|
36
|
-
"@atlaskit/editor-common": "^99.
|
|
36
|
+
"@atlaskit/editor-common": "^99.18.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^1.12.0",
|
|
38
38
|
"@atlaskit/editor-plugin-card": "4.6.5",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-viewmode": "^2.2.0",
|
|
40
|
+
"@atlaskit/editor-plugin-primary-toolbar": "^2.3.0",
|
|
41
|
+
"@atlaskit/editor-plugin-selection-toolbar": "^1.9.0",
|
|
40
42
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
41
|
-
"@atlaskit/icon": "^23.
|
|
43
|
+
"@atlaskit/icon": "^23.11.0",
|
|
42
44
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
43
45
|
"@atlaskit/prosemirror-input-rules": "^3.3.0",
|
|
44
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
46
|
+
"@atlaskit/tmp-editor-statsig": "^2.47.0",
|
|
45
47
|
"@babel/runtime": "^7.0.0",
|
|
46
48
|
"uuid": "^3.1.0"
|
|
47
49
|
},
|