@atlaskit/editor-plugin-hyperlink 3.4.2 → 3.5.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 +30 -0
- package/dist/cjs/hyperlinkPlugin.js +36 -15
- package/dist/cjs/ui/PrimaryToolbarComponent.js +46 -0
- package/dist/cjs/ui/toolbar/Toolbar.js +0 -2
- package/dist/es2019/hyperlinkPlugin.js +36 -15
- package/dist/es2019/ui/PrimaryToolbarComponent.js +44 -0
- package/dist/es2019/ui/toolbar/Toolbar.js +0 -2
- package/dist/esm/hyperlinkPlugin.js +36 -15
- package/dist/esm/ui/PrimaryToolbarComponent.js +39 -0
- package/dist/esm/ui/toolbar/Toolbar.js +0 -2
- package/dist/types/hyperlinkPluginType.d.ts +3 -1
- package/dist/types/ui/PrimaryToolbarComponent.d.ts +17 -0
- package/dist/types-ts4.5/hyperlinkPluginType.d.ts +3 -1
- package/dist/types-ts4.5/ui/PrimaryToolbarComponent.d.ts +17 -0
- package/package.json +7 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-hyperlink
|
|
2
2
|
|
|
3
|
+
## 3.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#116013](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/116013)
|
|
8
|
+
[`18e022766bfd3`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/18e022766bfd3) -
|
|
9
|
+
[ux] ED-26464 Hiding primary toolbar and docking contextual toolbar items to top
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 3.4.5
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
21
|
+
## 3.4.4
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
27
|
+
## 3.4.3
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies
|
|
32
|
+
|
|
3
33
|
## 3.4.2
|
|
4
34
|
|
|
5
35
|
### 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,
|
|
@@ -196,8 +214,8 @@ var hyperlinkPlugin = exports.hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
196
214
|
tooltipContent: (0, _keymaps.tooltip)(_keymaps.addLink, title),
|
|
197
215
|
showTitle: false,
|
|
198
216
|
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$
|
|
217
|
+
var _api$analytics8;
|
|
218
|
+
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
219
|
}
|
|
202
220
|
};
|
|
203
221
|
};
|
|
@@ -209,7 +227,10 @@ var hyperlinkPlugin = exports.hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
209
227
|
} else {
|
|
210
228
|
return undefined;
|
|
211
229
|
}
|
|
212
|
-
}
|
|
230
|
+
},
|
|
231
|
+
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
|
|
232
|
+
exposure: true
|
|
233
|
+
}) ? primaryToolbarComponent : undefined
|
|
213
234
|
}
|
|
214
235
|
};
|
|
215
236
|
};
|
|
@@ -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);
|
|
@@ -21,7 +21,6 @@ var _linkBroken = _interopRequireDefault(require("@atlaskit/icon/core/link-broke
|
|
|
21
21
|
var _linkExternal = _interopRequireDefault(require("@atlaskit/icon/core/link-external"));
|
|
22
22
|
var _unlink = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/unlink"));
|
|
23
23
|
var _shortcut = _interopRequireDefault(require("@atlaskit/icon/glyph/shortcut"));
|
|
24
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
25
24
|
var _commands = require("../../editor-commands/commands");
|
|
26
25
|
var _main = require("../../pm-plugins/main");
|
|
27
26
|
var _toolbarButtons = require("../../pm-plugins/toolbar-buttons");
|
|
@@ -180,7 +179,6 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(opti
|
|
|
180
179
|
type: 'separator'
|
|
181
180
|
}, {
|
|
182
181
|
type: 'copy-button',
|
|
183
|
-
supportsViewMode: !(0, _platformFeatureFlags.fg)('platform_editor_remove_copy_button_from_view_mode'),
|
|
184
182
|
items: [{
|
|
185
183
|
state: state,
|
|
186
184
|
formatMessage: formatMessage,
|
|
@@ -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,
|
|
@@ -178,8 +196,8 @@ export const hyperlinkPlugin = ({
|
|
|
178
196
|
tooltipContent: tooltip(addLink, title),
|
|
179
197
|
showTitle: false,
|
|
180
198
|
onClick: (state, dispatch) => {
|
|
181
|
-
var _api$
|
|
182
|
-
return editorCommandToPMCommand(showLinkToolbar(INPUT_METHOD.FLOATING_TB, api === null || api === void 0 ? void 0 : (_api$
|
|
199
|
+
var _api$analytics8;
|
|
200
|
+
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
201
|
}
|
|
184
202
|
};
|
|
185
203
|
};
|
|
@@ -191,7 +209,10 @@ export const hyperlinkPlugin = ({
|
|
|
191
209
|
} else {
|
|
192
210
|
return undefined;
|
|
193
211
|
}
|
|
194
|
-
}
|
|
212
|
+
},
|
|
213
|
+
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) && editorExperiment('platform_editor_controls', 'variant1', {
|
|
214
|
+
exposure: true
|
|
215
|
+
}) ? primaryToolbarComponent : undefined
|
|
195
216
|
}
|
|
196
217
|
};
|
|
197
218
|
};
|
|
@@ -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);
|
|
@@ -11,7 +11,6 @@ import LinkBrokenIcon from '@atlaskit/icon/core/link-broken';
|
|
|
11
11
|
import LinkExternalIcon from '@atlaskit/icon/core/link-external';
|
|
12
12
|
import UnlinkIcon from '@atlaskit/icon/glyph/editor/unlink';
|
|
13
13
|
import OpenIcon from '@atlaskit/icon/glyph/shortcut';
|
|
14
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
14
|
import { editInsertedLink, insertLinkWithAnalytics, onClickAwayCallback, onEscapeCallback, removeLink, updateLink } from '../../editor-commands/commands';
|
|
16
15
|
import { stateKey } from '../../pm-plugins/main';
|
|
17
16
|
import { toolbarKey } from '../../pm-plugins/toolbar-buttons';
|
|
@@ -171,7 +170,6 @@ export const getToolbarConfig = (options, pluginInjectionApi) => (state, intl, p
|
|
|
171
170
|
type: 'separator'
|
|
172
171
|
}, {
|
|
173
172
|
type: 'copy-button',
|
|
174
|
-
supportsViewMode: !fg('platform_editor_remove_copy_button_from_view_mode'),
|
|
175
173
|
items: [{
|
|
176
174
|
state,
|
|
177
175
|
formatMessage: formatMessage,
|
|
@@ -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,
|
|
@@ -189,8 +207,8 @@ export var hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
189
207
|
tooltipContent: tooltip(addLink, title),
|
|
190
208
|
showTitle: false,
|
|
191
209
|
onClick: function onClick(state, dispatch) {
|
|
192
|
-
var _api$
|
|
193
|
-
return editorCommandToPMCommand(_showLinkToolbar(INPUT_METHOD.FLOATING_TB, api === null || api === void 0 || (_api$
|
|
210
|
+
var _api$analytics8;
|
|
211
|
+
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
212
|
}
|
|
195
213
|
};
|
|
196
214
|
};
|
|
@@ -202,7 +220,10 @@ export var hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
202
220
|
} else {
|
|
203
221
|
return undefined;
|
|
204
222
|
}
|
|
205
|
-
}
|
|
223
|
+
},
|
|
224
|
+
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) && editorExperiment('platform_editor_controls', 'variant1', {
|
|
225
|
+
exposure: true
|
|
226
|
+
}) ? primaryToolbarComponent : undefined
|
|
206
227
|
}
|
|
207
228
|
};
|
|
208
229
|
};
|
|
@@ -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);
|
|
@@ -15,7 +15,6 @@ import LinkBrokenIcon from '@atlaskit/icon/core/link-broken';
|
|
|
15
15
|
import LinkExternalIcon from '@atlaskit/icon/core/link-external';
|
|
16
16
|
import UnlinkIcon from '@atlaskit/icon/glyph/editor/unlink';
|
|
17
17
|
import OpenIcon from '@atlaskit/icon/glyph/shortcut';
|
|
18
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
19
18
|
import { editInsertedLink, insertLinkWithAnalytics, onClickAwayCallback, onEscapeCallback, removeLink, updateLink } from '../../editor-commands/commands';
|
|
20
19
|
import { stateKey } from '../../pm-plugins/main';
|
|
21
20
|
import { toolbarKey } from '../../pm-plugins/toolbar-buttons';
|
|
@@ -173,7 +172,6 @@ export var getToolbarConfig = function getToolbarConfig(options, pluginInjection
|
|
|
173
172
|
type: 'separator'
|
|
174
173
|
}, {
|
|
175
174
|
type: 'copy-button',
|
|
176
|
-
supportsViewMode: !fg('platform_editor_remove_copy_button_from_view_mode'),
|
|
177
175
|
items: [{
|
|
178
176
|
state: state,
|
|
179
177
|
formatMessage: formatMessage,
|
|
@@ -3,6 +3,7 @@ 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';
|
|
6
7
|
import type { HideLinkToolbar, InsertLink, ShowLinkToolbar, UpdateLink } from './editor-commands/commands';
|
|
7
8
|
type HyperlinkPluginCommands = {
|
|
8
9
|
/**
|
|
@@ -45,7 +46,8 @@ type HyperlinkPluginCommands = {
|
|
|
45
46
|
export type HyperlinkPluginDependencies = [
|
|
46
47
|
OptionalPlugin<AnalyticsPlugin>,
|
|
47
48
|
OptionalPlugin<CardPlugin>,
|
|
48
|
-
OptionalPlugin<EditorViewModePlugin
|
|
49
|
+
OptionalPlugin<EditorViewModePlugin>,
|
|
50
|
+
OptionalPlugin<PrimaryToolbarPlugin>
|
|
49
51
|
];
|
|
50
52
|
export type HyperlinkPluginActions = {
|
|
51
53
|
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,7 @@ 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';
|
|
6
7
|
import type { HideLinkToolbar, InsertLink, ShowLinkToolbar, UpdateLink } from './editor-commands/commands';
|
|
7
8
|
type HyperlinkPluginCommands = {
|
|
8
9
|
/**
|
|
@@ -45,7 +46,8 @@ type HyperlinkPluginCommands = {
|
|
|
45
46
|
export type HyperlinkPluginDependencies = [
|
|
46
47
|
OptionalPlugin<AnalyticsPlugin>,
|
|
47
48
|
OptionalPlugin<CardPlugin>,
|
|
48
|
-
OptionalPlugin<EditorViewModePlugin
|
|
49
|
+
OptionalPlugin<EditorViewModePlugin>,
|
|
50
|
+
OptionalPlugin<PrimaryToolbarPlugin>
|
|
49
51
|
];
|
|
50
52
|
export type HyperlinkPluginActions = {
|
|
51
53
|
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.5.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,16 @@
|
|
|
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
|
-
"@atlaskit/editor-plugin-card": "4.6.
|
|
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",
|
|
40
41
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
41
|
-
"@atlaskit/icon": "^23.
|
|
42
|
-
"@atlaskit/platform-feature-flags": "^1.
|
|
42
|
+
"@atlaskit/icon": "^23.10.0",
|
|
43
|
+
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
43
44
|
"@atlaskit/prosemirror-input-rules": "^3.3.0",
|
|
44
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
45
|
+
"@atlaskit/tmp-editor-statsig": "^2.47.0",
|
|
45
46
|
"@babel/runtime": "^7.0.0",
|
|
46
47
|
"uuid": "^3.1.0"
|
|
47
48
|
},
|
|
@@ -98,9 +99,6 @@
|
|
|
98
99
|
"platform-feature-flags": {
|
|
99
100
|
"linking_platform_smart_links_in_live_pages": {
|
|
100
101
|
"type": "boolean"
|
|
101
|
-
},
|
|
102
|
-
"platform_editor_remove_copy_button_from_view_mode": {
|
|
103
|
-
"type": "boolean"
|
|
104
102
|
}
|
|
105
103
|
}
|
|
106
104
|
}
|